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 +6 -3
- package/dist/index322.js +99 -96
- package/package.json +2 -2
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)
|
|
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
|
|
7
|
-
import { useRouter as
|
|
8
|
-
import { useLogger as
|
|
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 = _,
|
|
59
|
-
isScrolling:
|
|
60
|
-
left:
|
|
61
|
-
right:
|
|
62
|
-
})), { isInertia:
|
|
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 &&
|
|
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
|
|
67
|
-
let e =
|
|
68
|
-
if (k.navigation && e)
|
|
69
|
-
else if (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
|
-
|
|
73
|
+
z.value = e.key;
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
let
|
|
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
|
-
}),
|
|
91
|
-
let e =
|
|
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,
|
|
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:
|
|
101
|
+
tabId: ee,
|
|
102
102
|
eager: a,
|
|
103
|
-
panelId:
|
|
103
|
+
panelId: o,
|
|
104
104
|
active: c,
|
|
105
105
|
ariaSelected: !!c,
|
|
106
|
-
labelSlotName:
|
|
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: () =>
|
|
117
|
-
onKeydown: (e) =>
|
|
116
|
+
onClick: () => K(n.key),
|
|
117
|
+
onKeydown: (e) => be(e)
|
|
118
118
|
};
|
|
119
119
|
});
|
|
120
|
-
}),
|
|
120
|
+
}), K = (e, t = k.replace) => {
|
|
121
121
|
let n = k.items.find((t) => t.key === e);
|
|
122
|
-
if (!u(n)
|
|
123
|
-
if (
|
|
124
|
-
|
|
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
|
-
...
|
|
130
|
+
...j.value?.query ?? {},
|
|
127
131
|
[k.querykey]: e
|
|
128
132
|
}, i = {
|
|
129
|
-
...
|
|
133
|
+
...j.value,
|
|
130
134
|
query: r
|
|
131
135
|
};
|
|
132
|
-
|
|
133
|
-
} else if (k.navigation &&
|
|
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 =
|
|
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 &&
|
|
144
|
+
k.modelValue !== e && A("update:modelValue", e), z.value = e;
|
|
141
145
|
}
|
|
142
146
|
};
|
|
143
|
-
|
|
144
|
-
let
|
|
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 = (
|
|
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 = (
|
|
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(`#${
|
|
169
|
-
},
|
|
170
|
-
if (!k.disabled) if (e.key === "ArrowRight")
|
|
171
|
-
else if (e.key === "ArrowLeft")
|
|
172
|
-
else if (e.key === "Home") e.preventDefault(),
|
|
173
|
-
else if (e.key === "End") e.preventDefault(),
|
|
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 &&
|
|
178
|
-
}), E(() =>
|
|
179
|
-
e && typeof e == "string" &&
|
|
180
|
-
}), E(
|
|
181
|
-
if (!
|
|
182
|
-
let e =
|
|
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 =
|
|
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
|
|
195
|
-
E(
|
|
196
|
-
e && t && (
|
|
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
|
|
199
|
-
if (!
|
|
200
|
-
let e =
|
|
201
|
-
e && (
|
|
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(),
|
|
205
|
-
}), E(
|
|
208
|
+
$(), await y(), Se.value = !0;
|
|
209
|
+
}), E(z, $, { flush: "post" }), t(I, () => {
|
|
206
210
|
$();
|
|
207
211
|
}), E(() => l(k.items), () => {
|
|
208
|
-
|
|
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:
|
|
214
|
-
isLast:
|
|
215
|
-
current:
|
|
216
|
-
currentIndex:
|
|
217
|
-
goTo:
|
|
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(
|
|
220
|
-
|
|
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(
|
|
230
|
+
g("span", null, [T(e.$slots, "header:prepend", x(v(R.value)))]),
|
|
228
231
|
g("ul", {
|
|
229
232
|
ref_key: "tablist",
|
|
230
|
-
ref:
|
|
231
|
-
class: b(["bb-tab__label-container", { "bb-tab__label-container--no-transition": !
|
|
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": `${
|
|
235
|
-
"--width": `${
|
|
236
|
-
"--height": `${
|
|
237
|
-
"--left": `${
|
|
238
|
-
"--top": `${
|
|
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(
|
|
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:
|
|
255
|
-
currentIndex:
|
|
257
|
+
current: z.value,
|
|
258
|
+
currentIndex: B.value,
|
|
256
259
|
disabled: t.disabled,
|
|
257
|
-
goTo:
|
|
258
|
-
isFirst:
|
|
259
|
-
isLast:
|
|
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:
|
|
265
|
-
currentIndex:
|
|
267
|
+
current: z.value,
|
|
268
|
+
currentIndex: B.value,
|
|
266
269
|
disabled: t.disabled,
|
|
267
|
-
goTo:
|
|
268
|
-
isFirst:
|
|
269
|
-
isLast:
|
|
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(
|
|
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(
|
|
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-${
|
|
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:
|
|
300
|
-
currentIndex:
|
|
302
|
+
current: z.value,
|
|
303
|
+
currentIndex: B.value,
|
|
301
304
|
disabled: t.disabled,
|
|
302
|
-
goTo:
|
|
303
|
-
isFirst:
|
|
304
|
-
isLast:
|
|
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.
|
|
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
|
+
}
|