bitboss-ui 2.1.120 → 2.1.121

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/ai/BbTab.md CHANGED
@@ -144,8 +144,6 @@ const route = useRoute();
144
144
  const router = useRouter();
145
145
  const { error } = useLogger();
146
146
 
147
- const tabs = ref();
148
-
149
147
  const id = props.id ?? useId().id.value;
150
148
  const instanceid = `bb-tab_${id}`;
151
149
 
@@ -280,7 +278,12 @@ const mappedItems = computed(() => {
280
278
  const onTabSelected = (tab: BbTabItem<K>['key'], replace = props.replace) => {
281
279
  const tabItem = props.items.find((i) => i.key === tab);
282
280
  if (isNil(tabItem)) return;
283
- if (tabItem.key === selectedTab.value) return;
281
+ if (tabItem.key === selectedTab.value) {
282
+ if (props.modelValue !== tab) {
283
+ emit('update:modelValue', tab);
284
+ }
285
+ return;
286
+ }
284
287
 
285
288
  /* For Vue or Nuxt context */
286
289
  if (props.navigation && route.value && queryTabParam.value !== tab) {
package/dist/index322.js CHANGED
@@ -3,9 +3,9 @@ import { useResizeObserver as t, useScroll as n } from "./index14.js";
3
3
  import { useFrameworkDetection as r } from "./index17.js";
4
4
  import { useQuery as i } from "./index18.js";
5
5
  import { isNotNil as a } from "./index26.js";
6
- import { useRoute as o } from "./index28.js";
7
- import { useRouter as s } from "./index29.js";
8
- import { useLogger as ee } from "./index31.js";
6
+ import { useRoute as ee } from "./index28.js";
7
+ import { useRouter as o } from "./index29.js";
8
+ import { useLogger as s } from "./index31.js";
9
9
  import c from "./index36.js";
10
10
  import { hash as l } from "./index81.js";
11
11
  import { isNil as u } from "./index94.js";
@@ -55,26 +55,26 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
55
55
  },
56
56
  emits: ["update:modelValue"],
57
57
  setup(_, { expose: O, emit: he }) {
58
- let k = _, ge = he, A = o(), j = s(), { error: M } = ee(), _e = C(), N = k.id ?? e().id.value, P = `bb-tab_${N}`, F = C(), { isScrolling: ve, arrivedState: I } = n(F), L = p(() => ({
59
- isScrolling: ve.value,
60
- left: I.left,
61
- right: I.right
62
- })), { isInertia: ye } = r(), be = ie(), R = C(null), z = p(() => k.items.findIndex((e) => e.key === R.value)), B = p(() => z.value === 0), V = p(() => z.value === k.items.length - 1);
58
+ let k = _, A = he, j = ee(), M = o(), { error: N } = s(), P = k.id ?? e().id.value, F = `bb-tab_${P}`, I = C(), { isScrolling: ge, arrivedState: L } = n(I), R = p(() => ({
59
+ isScrolling: ge.value,
60
+ left: L.left,
61
+ right: L.right
62
+ })), { isInertia: _e } = r(), ve = ie(), z = C(null), B = p(() => k.items.findIndex((e) => e.key === z.value)), V = p(() => B.value === 0), H = p(() => B.value === k.items.length - 1);
63
63
  k.items.forEach((e) => {
64
- e.key ? (k.server || e.server) && !k.navigation && M(`A tab item has a server property but the navigation prop is false: ${JSON.stringify(e, null, 2)}`) : M(`A tab item has no key: ${JSON.stringify(e, null, 2)}`);
64
+ e.key ? (k.server || e.server) && !k.navigation && N(`A tab item has a server property but the navigation prop is false: ${JSON.stringify(e, null, 2)}`) : N(`A tab item has no key: ${JSON.stringify(e, null, 2)}`);
65
65
  });
66
- let H = p(() => [i()[k.querykey]].flat()[0]), U = () => {
67
- let e = H.value;
68
- if (k.navigation && e) R.value = e;
69
- else if (k.modelValue) R.value = k.modelValue;
66
+ let U = p(() => [i()[k.querykey]].flat()[0]), W = () => {
67
+ let e = U.value;
68
+ if (k.navigation && e) z.value = e;
69
+ else if (k.modelValue) z.value = k.modelValue;
70
70
  else if (k.items[0]) {
71
71
  let e = k.items.find((e) => !e.disabled);
72
72
  if (!e) throw Error("No tab has been selected so it defaulted to the first available. Still, all the tabs are disabled so no tab can be selected.");
73
- R.value = e.key;
73
+ z.value = e.key;
74
74
  }
75
75
  };
76
- U();
77
- let xe = (e) => ({
76
+ W();
77
+ let ye = (e) => ({
78
78
  headers: e.headers ?? k.headers,
79
79
  only: e.only ?? k.only,
80
80
  preserveScroll: e.preserveScroll ?? k.preserveScroll,
@@ -87,10 +87,10 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
87
87
  onError: e.onError ?? k.onError,
88
88
  onCancel: e.onCancel ?? k.onCancel,
89
89
  onFinish: e.onFinish ?? k.onFinish
90
- }), W = p(() => {
91
- let e = R.value, t = z.value;
90
+ }), G = p(() => {
91
+ let e = z.value, t = B.value;
92
92
  return k.items.map((n) => {
93
- let { key: r, label: i, eager: a } = n, o = `${P}_tab_${n.key}`, s = `${P}_tabpanel_${n.key}`, ee = `label-${n.key}`, c = n.key === R.value, l = {
93
+ let { key: r, label: i, eager: a } = n, ee = `${F}_tab_${n.key}`, o = `${F}_tabpanel_${n.key}`, s = `label-${n.key}`, c = n.key === z.value, l = {
94
94
  "bb-tab__btn": !0,
95
95
  "bb-tab__btn--active": c
96
96
  }, u = {
@@ -98,12 +98,12 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
98
98
  "bb-tab__pane--shown": c
99
99
  }, d = !!(n.disabled || k.disabled);
100
100
  return {
101
- tabId: o,
101
+ tabId: ee,
102
102
  eager: a,
103
- panelId: s,
103
+ panelId: o,
104
104
  active: c,
105
105
  ariaSelected: !!c,
106
- labelSlotName: ee,
106
+ labelSlotName: s,
107
107
  tabClasses: l,
108
108
  paneClasses: u,
109
109
  role: "tab",
@@ -113,35 +113,39 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
113
113
  key: r,
114
114
  label: i,
115
115
  currentIndex: t,
116
- onClick: () => G(n.key),
117
- onKeydown: (e) => Se(e)
116
+ onClick: () => K(n.key),
117
+ onKeydown: (e) => be(e)
118
118
  };
119
119
  });
120
- }), G = (e, t = k.replace) => {
120
+ }), K = (e, t = k.replace) => {
121
121
  let n = k.items.find((t) => t.key === e);
122
- if (!u(n) && n.key !== R.value) {
123
- if (k.navigation && A.value && H.value !== e) {
124
- if (!j) return;
122
+ if (!u(n)) {
123
+ if (n.key === z.value) {
124
+ k.modelValue !== e && A("update:modelValue", e);
125
+ return;
126
+ }
127
+ if (k.navigation && j.value && U.value !== e) {
128
+ if (!M) return;
125
129
  let n = t ? "replace" : "push", r = {
126
- ...A.value?.query ?? {},
130
+ ...j.value?.query ?? {},
127
131
  [k.querykey]: e
128
132
  }, i = {
129
- ...A.value,
133
+ ...j.value,
130
134
  query: r
131
135
  };
132
- j[n](i);
133
- } else if (k.navigation && ye) {
136
+ M[n](i);
137
+ } else if (k.navigation && _e) {
134
138
  let r = n.href ?? globalThis.location.href, i = new URL(r, window.location.origin);
135
139
  if (i.searchParams.set(k.querykey, e), k.server || n.server) {
136
- let e = be?.proxy?.$inertia, t = xe(n), r = Object.fromEntries(Object.entries(t).filter(([e, t]) => a(t)));
140
+ let e = ve?.proxy?.$inertia, t = ye(n), r = Object.fromEntries(Object.entries(t).filter(([e, t]) => a(t)));
137
141
  e.visit(i.toString(), r);
138
142
  } else t ? window.history.replaceState(window.history.state, "", i.toString()) : window.history.pushState(window.history.state, "", i.toString());
139
143
  }
140
- k.modelValue !== e && ge("update:modelValue", e), R.value = e;
144
+ k.modelValue !== e && A("update:modelValue", e), z.value = e;
141
145
  }
142
146
  };
143
- R.value && G(R.value, !0);
144
- let K = (e) => {
147
+ z.value && K(z.value, !0);
148
+ let q = (e) => {
145
149
  var t = null;
146
150
  switch (e) {
147
151
  case "first":
@@ -149,12 +153,12 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
149
153
  break;
150
154
  case "previous": {
151
155
  let e = 1;
152
- for (; e < k.items.length && (t = (z.value + k.items.length - e) % k.items.length, k.items[t].disabled);) e++;
156
+ for (; e < k.items.length && (t = (B.value + k.items.length - e) % k.items.length, k.items[t].disabled);) e++;
153
157
  break;
154
158
  }
155
159
  case "next": {
156
160
  let e = 1;
157
- for (; e < k.items.length && (t = (z.value + e) % k.items.length, k.items[t].disabled);) e++;
161
+ for (; e < k.items.length && (t = (B.value + e) % k.items.length, k.items[t].disabled);) e++;
158
162
  break;
159
163
  }
160
164
  case "last":
@@ -165,24 +169,24 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
165
169
  if (t === null) throw Error("Could not navigate to next tab");
166
170
  if (k.items[t].disabled) return;
167
171
  let n = k.items[t].key;
168
- document.querySelector(`#${P}_tab_${n}`)?.focus(), G(n);
169
- }, Se = (e) => {
170
- if (!k.disabled) if (e.key === "ArrowRight") K("next");
171
- else if (e.key === "ArrowLeft") K("previous");
172
- else if (e.key === "Home") e.preventDefault(), K("first");
173
- else if (e.key === "End") e.preventDefault(), K("last");
172
+ document.querySelector(`#${F}_tab_${n}`)?.focus(), K(n);
173
+ }, be = (e) => {
174
+ if (!k.disabled) if (e.key === "ArrowRight") q("next");
175
+ else if (e.key === "ArrowLeft") q("previous");
176
+ else if (e.key === "Home") e.preventDefault(), q("first");
177
+ else if (e.key === "End") e.preventDefault(), q("last");
174
178
  else return;
175
179
  };
176
180
  E(() => k.modelValue, (e) => {
177
- e && G(e);
178
- }), E(() => A.value?.query?.[k.querykey], (e) => {
179
- e && typeof e == "string" && G(e);
180
- }), E(R, async () => {
181
- if (!F.value) return;
182
- let e = F.value.querySelector(".bb-tab__btn--active");
181
+ e && K(e);
182
+ }), E(() => j.value?.query?.[k.querykey], (e) => {
183
+ e && typeof e == "string" && K(e);
184
+ }), E(z, async () => {
185
+ if (!I.value) return;
186
+ let e = I.value.querySelector(".bb-tab__btn--active");
183
187
  if (!e) return;
184
188
  await y();
185
- let t = F.value, n = e.offsetLeft, r = n + e.offsetWidth, i = t.scrollLeft, a = i + t.clientWidth;
189
+ let t = I.value, n = e.offsetLeft, r = n + e.offsetWidth, i = t.scrollLeft, a = i + t.clientWidth;
186
190
  n < i ? t.scrollTo({
187
191
  left: n,
188
192
  behavior: "smooth"
@@ -191,53 +195,52 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
191
195
  behavior: "smooth"
192
196
  });
193
197
  }, { flush: "post" });
194
- let q = C("right");
195
- E(R, (e, t) => {
196
- e && t && (q.value = k.items.findIndex((t) => t.key === e) > k.items.findIndex((e) => e.key === t) ? "right" : "left");
198
+ let J = C("right");
199
+ E(z, (e, t) => {
200
+ e && t && (J.value = k.items.findIndex((t) => t.key === e) > k.items.findIndex((e) => e.key === t) ? "right" : "left");
197
201
  }, { flush: "sync" });
198
- let J = C(0), Y = C(0), X = C(0), Z = C(0), Q = C(0), Ce = C(!1), $ = () => {
199
- if (!F.value) return;
200
- let e = F.value.querySelector(".bb-tab__btn--active");
201
- e && (X.value = e.offsetLeft, Z.value = e.offsetTop, J.value = e.clientWidth, Y.value = e.clientHeight, Q.value = F.value.scrollWidth);
202
+ let Y = C(0), X = C(0), Z = C(0), Q = C(0), xe = C(0), Se = C(!1), $ = () => {
203
+ if (!I.value) return;
204
+ let e = I.value.querySelector(".bb-tab__btn--active");
205
+ e && (Z.value = e.offsetLeft, Q.value = e.offsetTop, Y.value = e.clientWidth, X.value = e.clientHeight, xe.value = I.value.scrollWidth);
202
206
  };
203
207
  return oe(async () => {
204
- $(), await y(), Ce.value = !0;
205
- }), E(R, $, { flush: "post" }), t(F, () => {
208
+ $(), await y(), Se.value = !0;
209
+ }), E(z, $, { flush: "post" }), t(I, () => {
206
210
  $();
207
211
  }), E(() => l(k.items), () => {
208
- R.value && !k.items.find((e) => e.key === R.value) && U();
212
+ z.value && !k.items.find((e) => e.key === z.value) && W();
209
213
  }, {
210
214
  immediate: !0,
211
215
  deep: !0
212
216
  }), O({
213
- isFirst: B,
214
- isLast: V,
215
- current: R,
216
- currentIndex: z,
217
- goTo: K
217
+ isFirst: V,
218
+ isLast: H,
219
+ current: z,
220
+ currentIndex: B,
221
+ goTo: q
218
222
  }), (e, t) => (S(), h("div", {
219
- id: le(N),
220
- ref_key: "tabs",
221
- ref: _e,
223
+ id: le(P),
224
+ ref: "tabs",
222
225
  class: b(["bb-tab", {
223
226
  [`bb-tab--${e.direction}`]: !0,
224
227
  "bb-tab--disabled": e.disabled
225
228
  }])
226
229
  }, [g("div", de, [
227
- g("span", null, [T(e.$slots, "header:prepend", x(v(L.value)))]),
230
+ g("span", null, [T(e.$slots, "header:prepend", x(v(R.value)))]),
228
231
  g("ul", {
229
232
  ref_key: "tablist",
230
- ref: F,
231
- class: b(["bb-tab__label-container", { "bb-tab__label-container--no-transition": !Ce.value }]),
233
+ ref: I,
234
+ class: b(["bb-tab__label-container", { "bb-tab__label-container--no-transition": !Se.value }]),
232
235
  role: "tablist",
233
236
  style: ae({
234
- "--inner-width": `${Q.value}px`,
235
- "--width": `${J.value}px`,
236
- "--height": `${Y.value}px`,
237
- "--left": `${X.value}px`,
238
- "--top": `${Z.value}px`
237
+ "--inner-width": `${xe.value}px`,
238
+ "--width": `${Y.value}px`,
239
+ "--height": `${X.value}px`,
240
+ "--left": `${Z.value}px`,
241
+ "--top": `${Q.value}px`
239
242
  })
240
- }, [(S(!0), h(f, null, w(W.value, (t) => (S(), h("li", {
243
+ }, [(S(!0), h(f, null, w(G.value, (t) => (S(), h("li", {
241
244
  key: t.tabId,
242
245
  role: "presentation"
243
246
  }, [re(c, {
@@ -251,22 +254,22 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
251
254
  onKeydown: t.onKeydown
252
255
  }, {
253
256
  default: D(() => [T(e.$slots, t.labelSlotName, {
254
- current: R.value,
255
- currentIndex: z.value,
257
+ current: z.value,
258
+ currentIndex: B.value,
256
259
  disabled: t.disabled,
257
- goTo: K,
258
- isFirst: B.value,
259
- isLast: V.value,
260
+ goTo: q,
261
+ isFirst: V.value,
262
+ isLast: H.value,
260
263
  selected: t.active,
261
264
  text: t.label,
262
265
  value: t.key
263
266
  }, () => [T(e.$slots, "label", {
264
- current: R.value,
265
- currentIndex: z.value,
267
+ current: z.value,
268
+ currentIndex: B.value,
266
269
  disabled: t.disabled,
267
- goTo: K,
268
- isFirst: B.value,
269
- isLast: V.value,
270
+ goTo: q,
271
+ isFirst: V.value,
272
+ isLast: H.value,
270
273
  selected: t.active,
271
274
  text: t.label,
272
275
  value: t.key
@@ -281,12 +284,12 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
281
284
  "onClick",
282
285
  "onKeydown"
283
286
  ])]))), 128))], 6),
284
- g("span", null, [T(e.$slots, "header:append", x(v(L.value)))])
287
+ g("span", null, [T(e.$slots, "header:append", x(v(R.value)))])
285
288
  ]), g("div", pe, [(S(), m(se(k.animateY ? d : "div"), null, {
286
- default: D(() => [(S(!0), h(f, null, w(W.value, (t) => (S(), m(te, {
289
+ default: D(() => [(S(!0), h(f, null, w(G.value, (t) => (S(), m(te, {
287
290
  key: t.tabId,
288
291
  css: k.animateX,
289
- name: `tab-slide-${q.value}`
292
+ name: `tab-slide-${J.value}`
290
293
  }, {
291
294
  default: D(() => [t.active || k.eager || t.eager ? (S(), h("section", {
292
295
  key: 0,
@@ -296,12 +299,12 @@ var ue = ["id"], de = { class: "bb-tab__label-boundary" }, fe = { class: "bb-tab
296
299
  role: "tabpanel",
297
300
  tabindex: t.tabindex
298
301
  }, [T(e.$slots, t.key, {
299
- current: R.value,
300
- currentIndex: z.value,
302
+ current: z.value,
303
+ currentIndex: B.value,
301
304
  disabled: t.disabled,
302
- goTo: K,
303
- isFirst: B.value,
304
- isLast: V.value,
305
+ goTo: q,
306
+ isFirst: V.value,
307
+ isLast: H.value,
305
308
  selected: t.active,
306
309
  text: t.label,
307
310
  value: t.key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitboss-ui",
3
- "version": "2.1.120",
3
+ "version": "2.1.121",
4
4
  "description": "Vue 3 component library by BitBoss: forms, selects, layout, overlays, and more.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -113,4 +113,4 @@
113
113
  "lint-staged": {
114
114
  "*.{js,css,md,html,json,vue,ts}": "prettier --write"
115
115
  }
116
- }
116
+ }