Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* update dependencies
* update dropdown tests
  • Loading branch information
thednp committed Nov 19, 2024
1 parent 67b6577 commit b12e371
Show file tree
Hide file tree
Showing 40 changed files with 619 additions and 628 deletions.
2 changes: 1 addition & 1 deletion dist/bootstrap-native.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bootstrap-native.cjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bootstrap-native.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bootstrap-native.js.map

Large diffs are not rendered by default.

77 changes: 37 additions & 40 deletions dist/bootstrap-native.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -815,46 +815,43 @@ const Lt = ["dropdown", "dropup", "dropstart", "dropend"], qn = "Dropdown", Yn =
`hide.bs.${et}`
), qs = E(`hidden.bs.${et}`), Xn = E(`updated.bs.${et}`), Ys = (e) => {
const { element: t, menu: s, parentElement: n, options: o } = e, { offset: i } = o;
if (R(s, "position") !== "static") {
const r = Tt(t), c = h(s, zi);
["margin", "top", "bottom", "left", "right"].forEach((B) => {
const Ct = {};
Ct[B] = "", _(s, Ct);
});
let l = Lt.find(
(B) => h(n, B)
) || et;
const f = {
dropdown: [i, 0, 0],
dropup: [0, 0, i],
dropstart: r ? [-1, 0, 0, i] : [-1, i, 0],
dropend: r ? [-1, i, 0] : [-1, 0, 0, i]
}, u = {
dropdown: { top: "100%" },
dropup: { top: "auto", bottom: "100%" },
dropstart: r ? { left: "100%", right: "auto" } : { left: "auto", right: "100%" },
dropend: r ? { left: "auto", right: "100%" } : { left: "100%", right: "auto" },
menuStart: r ? { right: "0", left: "auto" } : { right: "auto", left: "0" },
menuEnd: r ? { right: "auto", left: "0" } : { right: "0", left: "auto" }
}, { offsetWidth: $, offsetHeight: N } = s, { clientWidth: q, clientHeight: Z } = dt(t), {
left: m,
top: K,
width: $t,
height: yt
} = It(t), C = m - $ - i < 0, ft = m + $ + $t + i >= q, it = K + N + i >= Z, J = K + N + yt + i >= Z, Bt = K - N - i < 0, y = (!r && c || r && !c) && m + $t - $ < 0, W = (r && c || !r && !c) && m + $ >= q;
if (zs.includes(l) && C && ft && (l = et), l === es && (r ? ft : C) && (l = ss), l === ss && (r ? C : ft) && (l = es), l === ts && Bt && !J && (l = et), l === et && J && !Bt && (l = ts), zs.includes(l) && it && at(u[l], {
top: "auto",
bottom: 0
}), js.includes(l) && (y || W)) {
let B = { left: "auto", right: "auto" };
!y && W && !r && (B = { left: "auto", right: 0 }), y && !W && r && (B = { left: 0, right: "auto" }), B && at(u[l], B);
}
const Rt = f[l];
_(s, {
...u[l],
margin: `${Rt.map((B) => B && `${B}px`).join(" ")}`
}), js.includes(l) && c && c && _(s, u[!r && y || r && W ? "menuStart" : "menuEnd"]), b(n, Xn);
}
if (R(s, "position") === "static") return;
const r = Tt(t), c = h(s, zi);
["margin", "top", "bottom", "left", "right"].forEach((B) => {
const Ct = {};
Ct[B] = "", _(s, Ct);
});
let l = Lt.find((B) => h(n, B)) || et;
const f = {
dropdown: [i, 0, 0],
dropup: [0, 0, i],
dropstart: r ? [-1, 0, 0, i] : [-1, i, 0],
dropend: r ? [-1, i, 0] : [-1, 0, 0, i]
}, u = {
dropdown: { top: "100%" },
dropup: { top: "auto", bottom: "100%" },
dropstart: r ? { left: "100%", right: "auto" } : { left: "auto", right: "100%" },
dropend: r ? { left: "auto", right: "100%" } : { left: "100%", right: "auto" },
menuStart: r ? { right: "0", left: "auto" } : { right: "auto", left: "0" },
menuEnd: r ? { right: "auto", left: "0" } : { right: "0", left: "auto" }
}, { offsetWidth: $, offsetHeight: N } = s, { clientWidth: q, clientHeight: Z } = dt(t), {
left: m,
top: K,
width: $t,
height: yt
} = It(t), C = m - $ - i < 0, ft = m + $ + $t + i >= q, it = K + N + i >= Z, J = K + N + yt + i >= Z, Bt = K - N - i < 0, y = (!r && c || r && !c) && m + $t - $ < 0, W = (r && c || !r && !c) && m + $ >= q;
if (zs.includes(l) && C && ft && (l = et), l === es && (r ? ft : C) && (l = ss), l === ss && (r ? C : ft) && (l = es), l === ts && Bt && !J && (l = et), l === et && J && !Bt && (l = ts), zs.includes(l) && it && at(u[l], {
top: "auto",
bottom: 0
}), js.includes(l) && (y || W)) {
let B = { left: "auto", right: "auto" };
!y && W && !r && (B = { left: "auto", right: 0 }), y && !W && r && (B = { left: 0, right: "auto" }), B && at(u[l], B);
}
const Rt = f[l];
_(s, {
...u[l],
margin: `${Rt.map((B) => B && `${B}px`).join(" ")}`
}), js.includes(l) && c && c && _(s, u[!r && y || r && W ? "menuStart" : "menuEnd"]), b(n, Xn);
}, Vi = (e) => Array.from(e.children).map((t) => {
if (t && Ks.includes(t.tagName)) return t;
const { firstElementChild: s } = t;
Expand Down
2 changes: 1 addition & 1 deletion dist/bootstrap-native.mjs.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/components/alert.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { B as f, t as g, R as u, Z as i, q as c, m, Y as v, s as h, E, r as A, v as C } from "./base-component-CQAH5ZXF.mjs";
import { B as f, R as g, Z as i, q as c, Y as u, s as v, t as h, m, E, r as A, v as C } from "./base-component-DAxvn9am.mjs";
import { f as $ } from "./fadeClass-CLIYI_zn.mjs";
import { s as r } from "./showClass-C8hdJfjQ.mjs";
import { d as b } from "./dataBsDismiss-DdNPQYa-.mjs";
import { i as L } from "./isDisabled-bThyhy2g.mjs";
const n = "alert", d = "Alert", _ = `.${n}`, B = `[${b}="${n}"]`, D = (s) => g(s, d), I = (s) => new w(s), a = m(
import { i as L } from "./isDisabled-DRrRkHiq.mjs";
const n = "alert", d = "Alert", _ = `.${n}`, B = `[${b}="${n}"]`, D = (s) => h(s, d), I = (s) => new w(s), a = m(
`close.bs.${n}`
), S = m(
`closed.bs.${n}`
Expand All @@ -17,7 +17,7 @@ class w extends f {
static getInstance = D;
dismiss;
constructor(t) {
super(t), this.dismiss = u(
super(t), this.dismiss = g(
B,
this.element
), this._toggleEventListeners(!0);
Expand All @@ -32,7 +32,7 @@ class w extends f {
*/
close = (t) => {
const { element: e, dismiss: o } = this;
!e || !i(e, r) || t && o && L(o) || (c(e, a), !a.defaultPrevented && (v(e, r), i(e, $) ? h(e, () => l(this)) : l(this)));
!e || !i(e, r) || t && o && L(o) || (c(e, a), !a.defaultPrevented && (u(e, r), i(e, $) ? v(e, () => l(this)) : l(this)));
};
/**
* Toggle on / off the `click` event listener.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class mt {
}
}
export {
Xe as $,
Re as $,
Ne as A,
mt as B,
Se as C,
Expand All @@ -309,32 +309,32 @@ export {
he as H,
De as I,
U as J,
A as K,
L,
Ge as M,
Ge as K,
A as L,
L as M,
D as N,
Me as O,
Ae as P,
pe as P,
Oe as Q,
ie as R,
C as S,
pe as T,
ve as T,
ut as U,
je as V,
ze as W,
Pe as X,
Ae as V,
je as W,
ze as X,
Ve as Y,
$e as Z,
ve as _,
Pe as _,
ge as a,
Re as a0,
Xe as a0,
V as a1,
fe as a2,
_e as a3,
st as a4,
Y as a5,
dt as a6,
ht as a7,
ht as a6,
dt as a7,
me as a8,
ye as a9,
we as aa,
Expand All @@ -349,9 +349,9 @@ export {
ne as aj,
nt as ak,
oe as al,
de as am,
Le as an,
Fe as ao,
Le as am,
Fe as an,
de as ao,
We as b,
at as c,
d,
Expand All @@ -361,12 +361,12 @@ export {
Je as h,
ke as i,
Ce as j,
re as k,
S as l,
be as k,
re as l,
Qe as m,
Be as n,
S as n,
He as o,
be as p,
Be as p,
Z as q,
le as r,
qe as s,
Expand All @@ -378,4 +378,4 @@ export {
x as y,
xe as z
};
//# sourceMappingURL=base-component-CQAH5ZXF.mjs.map
//# sourceMappingURL=base-component-DAxvn9am.mjs.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/components/button.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { B as l, t as g, Z as i, Q as a, a as c, Y as u, b as m, E as p, r as v, v as f } from "./base-component-CQAH5ZXF.mjs";
import { B as l, Z as i, Q as a, a as c, v as g, t as u, Y as m, b as p, E as v, r as f } from "./base-component-DAxvn9am.mjs";
import { a as n } from "./activeClass-iqaD75Su.mjs";
import { d as h } from "./dataBsToggle-B84TS15h.mjs";
import { i as b } from "./isDisabled-bThyhy2g.mjs";
const d = "button", r = "Button", B = `[${h}="${d}"]`, A = (e) => g(e, r), C = (e) => new E(e);
import { i as b } from "./isDisabled-DRrRkHiq.mjs";
const d = "button", r = "Button", B = `[${h}="${d}"]`, A = (e) => u(e, r), C = (e) => new E(e);
class E extends l {
static selector = B;
static init = C;
Expand Down Expand Up @@ -30,15 +30,15 @@ class E extends l {
s && s.preventDefault();
const { element: t, isActive: o } = this;
if (b(t)) return;
(o ? u : m)(t, n), a(t, c, o ? "false" : "true"), this.isActive = i(t, n);
(o ? m : p)(t, n), a(t, c, o ? "false" : "true"), this.isActive = i(t, n);
};
/**
* Toggles on/off the `click` event listener.
*
* @param add when `true`, event listener is added
*/
_toggleEventListeners = (s) => {
(s ? p : v)(this.element, f, this.toggle);
(s ? v : f)(this.element, g, this.toggle);
};
dispose() {
this._toggleEventListeners(), super.dispose();
Expand Down
28 changes: 14 additions & 14 deletions dist/components/carousel.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { B as it, t as nt, U as C, G as ot, R as S, c as at, d as I, e as T, b as u, Y as $, Z as N, h as d, D as Y, N as B, m as Z, q as L, u as rt, f as ct, s as K, E as Q, r as F, w as lt, A as dt, g as O, z as ht, I as ft, O as ut, i as gt, j as mt, k as J, l as V, v as j, n as U, o as _, p as pt } from "./base-component-CQAH5ZXF.mjs";
import { B as it, U as C, G as nt, c as ot, d as I, e as T, R as S, b as u, Z as N, h as d, Y as $, D as Y, N as B, q as L, u as at, f as rt, s as K, t as ct, m as Z, E as Q, r as F, w as lt, A as dt, g as O, O as ht, i as ft, j as ut, v as j, k as gt, l as J, n as V, z as mt, I as pt, o as U, p as _ } from "./base-component-DAxvn9am.mjs";
import { a as g } from "./activeClass-iqaD75Su.mjs";
import { d as q, g as W } from "./getTargetElement-v_1VfmtN.mjs";
import { i as tt } from "./isDisabled-bThyhy2g.mjs";
import { d as q, g as W } from "./getTargetElement-C1k_p6ls.mjs";
import { i as tt } from "./isDisabled-DRrRkHiq.mjs";
const P = "carousel", et = "Carousel", A = `[data-bs-ride="${P}"]`, h = `${P}-item`, R = "data-bs-slide-to", v = "data-bs-slide", x = "paused", z = {
pause: "hover",
keyboard: !1,
touch: !0,
interval: 5e3
}, m = (i) => nt(i, et), vt = (i) => new Ct(i);
}, m = (i) => ct(i, et), vt = (i) => new Ct(i);
let y = 0, b = 0, H = 0;
const w = Z(`slide.bs.${P}`), X = Z(`slid.bs.${P}`), G = (i) => {
const { index: s, direction: t, element: e, slides: o, options: a } = i;
Expand Down Expand Up @@ -42,7 +42,7 @@ const Tt = ({ code: i, target: s }) => {
const t = I(s), [e] = [...T(A, t)].filter((l) => Y(l)), o = m(e);
if (!o || o.isAnimating || /textarea|input|select/i.test(s.nodeName)) return;
const a = C(e);
i === (a ? _ : U) ? o.prev() : i === (a ? U : _) && o.next();
i === (a ? U : _) ? o.prev() : i === (a ? _ : U) && o.next();
};
function M(i) {
const { target: s } = i, t = m(this);
Expand Down Expand Up @@ -70,12 +70,12 @@ const At = (i) => {
const { element: t } = i, e = s ? Q : F;
e(
I(t),
ht,
mt,
At,
O
), e(
I(t),
ft,
pt,
bt,
O
);
Expand All @@ -97,11 +97,11 @@ class Ct extends it {
constructor(s, t) {
super(s, t);
const { element: e } = this;
this.direction = C(e) ? "right" : "left", this.isTouch = !1, this.slides = ot(h, e);
this.direction = C(e) ? "right" : "left", this.isTouch = !1, this.slides = nt(h, e);
const { slides: o } = this;
if (o.length < 2) return;
const a = k(this), r = [...o].find(
(f) => at(f, `.${h}-next`)
(f) => ot(f, `.${h}-next`)
);
this.index = a;
const n = I(e);
Expand Down Expand Up @@ -196,10 +196,10 @@ class Ct extends it {
to: n,
direction: l
};
B(w, c), B(X, c), L(t, w), !w.defaultPrevented && (this.index = n, D(this, n), rt(e[n]) && N(t, "slide") ? d.set(
B(w, c), B(X, c), L(t, w), !w.defaultPrevented && (this.index = n, D(this, n), at(e[n]) && N(t, "slide") ? d.set(
t,
() => {
u(e[n], `${h}-${f}`), ct(e[n]), u(e[n], `${h}-${p}`), u(e[a], `${h}-${p}`), K(
u(e[n], `${h}-${f}`), rt(e[n]), u(e[n], `${h}-${p}`), u(e[a], `${h}-${p}`), K(
e[n],
() => this.slides && this.slides.length && G(this)
);
Expand All @@ -224,14 +224,14 @@ class Ct extends it {
const { element: t, options: e, slides: o, controls: a, indicators: r } = this, { touch: n, pause: l, interval: f, keyboard: p } = e, c = s ? Q : F;
l && f && (c(t, lt, xt), c(t, dt, $t)), n && o.length > 2 && (c(
t,
ut,
ht,
yt,
O
), c(t, gt, M, { passive: !1 }), c(t, mt, M, { passive: !1 })), a.length && a.forEach((E) => {
), c(t, ft, M, { passive: !1 }), c(t, ut, M, { passive: !1 })), a.length && a.forEach((E) => {
c(E, j, It);
}), r.length && r.forEach((E) => {
c(E, j, Pt);
}), p && c(I(t), pt, Tt);
}), p && c(I(t), gt, Tt);
};
dispose() {
const { isAnimating: s } = this, t = {
Expand Down
20 changes: 10 additions & 10 deletions dist/components/collapse.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { B as D, t as L, d as S, e as v, x as T, y as _, R as q, h as l, q as f, m as u, C as d, F as h, Y as g, b as c, f as P, s as x, Q as k, H, Z as Q, E as R, r as Y, k as Z, v as y } from "./base-component-CQAH5ZXF.mjs";
import { B as D, d as L, e as v, x as S, y as T, R as _, h as l, b as c, Y as g, Z as q, t as P, m as u, q as f, C as d, F as h, s as x, Q as k, H, f as Q, E as R, r as Y, v as Z, l as y } from "./base-component-DAxvn9am.mjs";
import { d as A } from "./dataBsToggle-B84TS15h.mjs";
import { c as m } from "./collapsingClass-BxKtDBMH.mjs";
import { s as C } from "./showClass-C8hdJfjQ.mjs";
import { g as E } from "./getTargetElement-v_1VfmtN.mjs";
import { i as F } from "./isDisabled-bThyhy2g.mjs";
const n = "collapse", I = "Collapse", N = `.${n}`, B = `[${A}="${n}"]`, O = { parent: null }, p = (a) => L(a, I), j = (a) => new M(a), $ = u(`show.bs.${n}`), z = u(`shown.bs.${n}`), b = u(`hide.bs.${n}`), G = u(`hidden.bs.${n}`), J = (a) => {
import { g as E } from "./getTargetElement-C1k_p6ls.mjs";
import { i as F } from "./isDisabled-DRrRkHiq.mjs";
const n = "collapse", I = "Collapse", N = `.${n}`, B = `[${A}="${n}"]`, O = { parent: null }, p = (a) => P(a, I), j = (a) => new M(a), $ = u(`show.bs.${n}`), z = u(`shown.bs.${n}`), b = u(`hide.bs.${n}`), G = u(`hidden.bs.${n}`), J = (a) => {
const { element: e, parent: t, triggers: s } = a;
f(e, $), $.defaultPrevented || (l.set(e, d, 17), t && l.set(t, d, 17), c(e, m), g(e, n), h(e, { height: `${e.scrollHeight}px` }), x(e, () => {
l.clear(e), t && l.clear(t), s.forEach((o) => k(o, H, "true")), g(e, m), c(e, n), c(e, C), h(e, { height: "" }), f(e, z);
}));
}, w = (a) => {
const { element: e, parent: t, triggers: s } = a;
f(e, b), b.defaultPrevented || (l.set(e, d, 17), t && l.set(t, d, 17), h(e, { height: `${e.scrollHeight}px` }), g(e, n), g(e, C), c(e, m), P(e), h(e, { height: "0px" }), x(e, () => {
f(e, b), b.defaultPrevented || (l.set(e, d, 17), t && l.set(t, d, 17), h(e, { height: `${e.scrollHeight}px` }), g(e, n), g(e, C), c(e, m), Q(e), h(e, { height: "0px" }), x(e, () => {
l.clear(e), t && l.clear(t), s.forEach((o) => k(o, H, "false")), g(e, m), c(e, n), h(e, { height: "" }), f(e, G);
}));
}, K = (a) => {
const { target: e } = a, t = e && Z(e, B), s = t && E(t), o = s && p(s);
const { target: e } = a, t = e && y(e, B), s = t && E(t), o = s && p(s);
t && F(t) || o && (o.toggle(), t?.tagName === "A" && a.preventDefault());
};
class M extends D {
Expand All @@ -28,10 +28,10 @@ class M extends D {
*/
constructor(e, t) {
super(e, t);
const { element: s, options: o } = this, i = S(s);
const { element: s, options: o } = this, i = L(s);
this.triggers = [...v(B, i)].filter(
(r) => E(r) === s
), this.parent = T(o.parent) ? o.parent : _(o.parent) ? E(s) || q(o.parent, i) : null, this._toggleEventListeners(!0);
), this.parent = S(o.parent) ? o.parent : T(o.parent) ? E(s) || _(o.parent, i) : null, this._toggleEventListeners(!0);
}
/**
* Returns component name string.
Expand Down Expand Up @@ -59,7 +59,7 @@ class M extends D {
})), J(this), s.length && s.forEach((r) => g(r, `${n}d`)));
}
toggle() {
Q(this.element, C) ? this.hide() : this.show();
q(this.element, C) ? this.hide() : this.show();
}
/**
* Toggles on/off the event listener(s) of the `Collapse` instance.
Expand All @@ -69,7 +69,7 @@ class M extends D {
_toggleEventListeners = (e) => {
const t = e ? R : Y, { triggers: s } = this;
s.length && s.forEach((o) => {
t(o, y, K);
t(o, Z, K);
});
};
dispose() {
Expand Down
Loading

0 comments on commit b12e371

Please sign in to comment.