bank20baht-ui 0.5.6 → 0.5.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,6 +1,6 @@
1
1
  import { svg as s, html as p, nothing as r } from "lit";
2
- import { property as n, query as q, customElement as v, state as C } from "lit/decorators.js";
3
- import { B as y, b as w, h as M } from "./base-D1pT3J5T.js";
2
+ import { property as n, query as C, customElement as y, state as w } from "lit/decorators.js";
3
+ import { B as f, b as v, h as q } from "./base-D1pT3J5T.js";
4
4
  import { t as A } from "./i18n-CWv5lrun.js";
5
5
  const x = {
6
6
  copy: {
@@ -116,12 +116,12 @@ var H = Object.defineProperty, O = Object.getOwnPropertyDescriptor, m = (c, t, o
116
116
  (h = c[l]) && (e = (a ? h(t, o, e) : h(e)) || e);
117
117
  return a && e && H(t, o, e), e;
118
118
  };
119
- let d = class extends y {
119
+ let d = class extends f {
120
120
  constructor() {
121
121
  super(...arguments), this.variant = "primary", this.size = "md", this.disabled = !1, this.type = "button", this.label = "", this.icon = "", this.iconOnly = !1;
122
122
  }
123
123
  firstUpdated() {
124
- this.iconOnly || w(this, this.buttonEl);
124
+ this.iconOnly || v(this, this.buttonEl);
125
125
  }
126
126
  render() {
127
127
  const c = this.variant === "primary" ? "" : ` baht-button--${this.variant}`, t = this.size === "md" ? "" : ` baht-button--${this.size}`, o = this.iconOnly ? " baht-button--icon" : "", a = this.icon && L(this.icon) ? $(this.icon) : r;
@@ -155,10 +155,10 @@ m([
155
155
  n({ type: Boolean, attribute: "icon-only" })
156
156
  ], d.prototype, "iconOnly", 2);
157
157
  m([
158
- q("button")
158
+ C("button")
159
159
  ], d.prototype, "buttonEl", 2);
160
160
  d = m([
161
- v("baht-button")
161
+ y("baht-button")
162
162
  ], d);
163
163
  const S = 600;
164
164
  function B(c, t) {
@@ -252,7 +252,7 @@ var V = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, u = (c, t, o
252
252
  (h = c[l]) && (e = (a ? h(t, o, e) : h(e)) || e);
253
253
  return a && e && V(t, o, e), e;
254
254
  };
255
- let i = class extends y {
255
+ let i = class extends f {
256
256
  constructor() {
257
257
  super(...arguments), this.open = !1, this.heading = "", this.description = "", this.showClose = !0, this.closeOnScrim = !0, this.closing = !1, this.closeToken = 0, this.previousFocus = null, this.onKeydown = (c) => {
258
258
  !this.open || i.openStack.at(-1) !== this || (c.key === "Escape" ? this.requestClose("escape") : c.key === "Tab" && this.trapFocus(c));
@@ -287,20 +287,26 @@ let i = class extends y {
287
287
  c.shiftKey && (l === a || l === o) ? (e.focus(), c.preventDefault()) : !c.shiftKey && l === e && (a.focus(), c.preventDefault());
288
288
  }
289
289
  connectedCallback() {
290
- super.connectedCallback(), M() && document.addEventListener("keydown", this.onKeydown);
290
+ super.connectedCallback(), q() && document.addEventListener("keydown", this.onKeydown);
291
291
  }
292
292
  disconnectedCallback() {
293
- M() && document.removeEventListener("keydown", this.onKeydown), i.openStack = i.openStack.filter((c) => c !== this), super.disconnectedCallback();
293
+ q() && document.removeEventListener("keydown", this.onKeydown), i.openStack = i.openStack.filter((c) => c !== this), super.disconnectedCallback();
294
294
  }
295
295
  firstUpdated() {
296
- w(this, this.bodyEl);
296
+ v(this, this.bodyEl);
297
297
  }
298
298
  willUpdate(c) {
299
299
  c.has("open") && (this.open ? this.closing = !1 : c.get("open") === !0 && (this.closing = !0));
300
300
  }
301
+ // A framework host (Angular/React) can project new light-DOM children into
302
+ // this element well after firstUpdated already ran — e.g. a conditionally
303
+ // rendered form that only mounts once its async form definition resolves.
304
+ // Re-running adoption on every update is cheap (a no-op once children are
305
+ // already under `.baht-modal-body`) and keeps that content inside the body
306
+ // instead of leaking it to render outside the modal entirely.
301
307
  updated(c) {
302
308
  var t, o;
303
- if (c.has("open") && (i.openStack = i.openStack.filter((a) => a !== this), this.open && i.openStack.push(this)), c.has("open") && !this.open && this.closing) {
309
+ if (v(this, this.bodyEl), c.has("open") && (i.openStack = i.openStack.filter((a) => a !== this), this.open && i.openStack.push(this)), c.has("open") && !this.open && this.closing) {
304
310
  const a = ++this.closeToken, e = this.querySelector(".baht-modal-scrim"), l = () => {
305
311
  a === this.closeToken && !this.open && (this.closing = !1);
306
312
  };
@@ -359,20 +365,20 @@ u([
359
365
  n({ type: Boolean, attribute: "close-on-scrim" })
360
366
  ], i.prototype, "closeOnScrim", 2);
361
367
  u([
362
- q(".baht-modal-body")
368
+ C(".baht-modal-body")
363
369
  ], i.prototype, "bodyEl", 2);
364
370
  u([
365
- C()
371
+ w()
366
372
  ], i.prototype, "closing", 2);
367
373
  i = u([
368
- v("baht-modal")
374
+ y("baht-modal")
369
375
  ], i);
370
- var E = Object.defineProperty, k = Object.getOwnPropertyDescriptor, f = (c, t, o, a) => {
376
+ var E = Object.defineProperty, k = Object.getOwnPropertyDescriptor, M = (c, t, o, a) => {
371
377
  for (var e = a > 1 ? void 0 : a ? k(t, o) : t, l = c.length - 1, h; l >= 0; l--)
372
378
  (h = c[l]) && (e = (a ? h(t, o, e) : h(e)) || e);
373
379
  return a && e && E(t, o, e), e;
374
380
  };
375
- let b = class extends y {
381
+ let b = class extends f {
376
382
  constructor() {
377
383
  super(...arguments), this.duration = 4e3, this.entries = [], this.timers = /* @__PURE__ */ new Map();
378
384
  }
@@ -421,14 +427,14 @@ let b = class extends y {
421
427
  }
422
428
  };
423
429
  b.counter = 0;
424
- f([
430
+ M([
425
431
  n({ type: Number })
426
432
  ], b.prototype, "duration", 2);
427
- f([
428
- C()
433
+ M([
434
+ w()
429
435
  ], b.prototype, "entries", 2);
430
- b = f([
431
- v("baht-toast")
436
+ b = M([
437
+ y("baht-toast")
432
438
  ], b);
433
439
  export {
434
440
  d as B,