bank20baht-ui 0.5.5 → 0.5.7

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,
@@ -2,10 +2,10 @@ import { nothing as h, html as l, svg as R } from "lit";
2
2
  import { property as n, customElement as f, state as v, query as Bt } from "lit/decorators.js";
3
3
  import { B as y, b as ce, h as j, a as X } from "./base-D1pT3J5T.js";
4
4
  import { t as u } from "./i18n-CWv5lrun.js";
5
- import { k as Re, j as ae, u as ye, n as qt, o as ws, x as xs, p as _s, d as ie, a as ps, s as ze, v as Ve, l as ge, t as we, c as ks, M as Ke, e as Os, h as Ps, q as Cs } from "./display-Cm3Pmp9U.js";
5
+ import { k as Re, j as ae, u as ye, n as qt, x as ws, o as xs, p as _s, d as ie, a as ps, s as ze, v as Ve, l as ge, t as we, c as ks, M as Ke, e as Os, h as Ps, q as Cs } from "./display-Cm3Pmp9U.js";
6
6
  import { repeat as Fe } from "lit/directives/repeat.js";
7
7
  import { html as se, unsafeStatic as ds } from "lit/static-html.js";
8
- import { r as T, e as Ds, i as us, d as pe, c as bs } from "./baht-toast-8qUXxEvh.js";
8
+ import { r as T, e as Ds, i as us, d as pe, c as bs } from "./baht-toast-DkZc1diO.js";
9
9
  import { live as Z } from "lit/directives/live.js";
10
10
  import { ifDefined as L } from "lit/directives/if-defined.js";
11
11
  import Ss from "flatpickr";
@@ -2041,10 +2041,13 @@ let Qe = class extends X {
2041
2041
  const e = this.lastEmitted ?? this.datesOf(this.value);
2042
2042
  this.sameInstants(t, e) || (this.lastEmitted = [...t], this.emitInput(this.toValue(t)));
2043
2043
  }
2044
- /** Host value (any mode) -> the Date list flatpickr works with. */
2044
+ /** Host value (any mode) -> the Date list flatpickr works with. A bare
2045
+ * day is accepted even with `enable_time` on (defaults to midnight) -
2046
+ * a host may not always have a time to feed back (an edited record that
2047
+ * predates this field, for one). */
2045
2048
  datesOf(t) {
2046
- const e = this.field.enable_time ? ws : qt;
2047
- return xs(t).map(e).filter((s) => s !== null);
2049
+ const e = (s) => (this.field.enable_time ? xs(s) : null) ?? qt(s);
2050
+ return ws(t).map(e).filter((s) => s !== null);
2048
2051
  }
2049
2052
  /** flatpickr's selection -> the value shape of the field's mode. */
2050
2053
  toValue(t) {
@@ -47,7 +47,10 @@ export declare class BahtDatepicker extends BahtFieldBase {
47
47
  private todayAllowed;
48
48
  private pickToday;
49
49
  private emitIfChanged;
50
- /** Host value (any mode) -> the Date list flatpickr works with. */
50
+ /** Host value (any mode) -> the Date list flatpickr works with. A bare
51
+ * day is accepted even with `enable_time` on (defaults to midnight) -
52
+ * a host may not always have a time to feed back (an edited record that
53
+ * predates this field, for one). */
51
54
  private datesOf;
52
55
  /** flatpickr's selection -> the value shape of the field's mode. */
53
56
  private toValue;
@@ -5412,7 +5412,7 @@
5412
5412
  }
5413
5413
  }
5414
5414
  ],
5415
- "description": "Host value (any mode) -> the Date list flatpickr works with."
5415
+ "description": "Host value (any mode) -> the Date list flatpickr works with. A bare\nday is accepted even with `enable_time` on (defaults to midnight) -\na host may not always have a time to feed back (an edited record that\npredates this field, for one)."
5416
5416
  },
5417
5417
  {
5418
5418
  "kind": "method",
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { M as s, a as e, b as r, c as h, d as B, e as o, f as l, g as i, h as n, i as p, j as d, k as c, l as m, m as S, p as u, n as C, o as T, r as f, q as g, s as x, t as b, v as k, w as D } from "./chunks/display-Cm3Pmp9U.js";
2
2
  import { g as F, s as I, a as v, t as R } from "./chunks/i18n-CWv5lrun.js";
3
3
  import { LEGACY_KEY_MAP as P, normalizeLegacySchema as A } from "./engine.js";
4
- import { B as M, a as _, b as w, i as V, c as N, r as H, d as O } from "./chunks/baht-toast-8qUXxEvh.js";
5
- import { B as q, a as G, b as K, c as j, d as z, e as U, f as W, g as X, h as J, i as Q, j as Z, k as $, l as aa, m as ta, n as sa, o as ea, p as ra, q as ha, r as Ba, s as oa, t as la, u as ia, v as na, w as pa, x as da, y as ca, z as ma, A as Sa, C as ua, D as Ca, E as Ta, F as fa, G as ga, H as xa, I as ba, J as ka, K as Da, L as Ea, M as Fa, N as Ia, O as va, P as Ra, Q as ya, R as Pa, S as Aa, T as La, U as Ma, V as _a, W as wa, X as Va, Y as Na, Z as Ha, _ as Oa, $ as Ya, a0 as qa, a1 as Ga, a2 as Ka, a3 as ja, a4 as za, a5 as Ua } from "./chunks/baht-workflow-C27godQM.js";
4
+ import { B as M, a as _, b as w, i as V, c as N, r as H, d as O } from "./chunks/baht-toast-DkZc1diO.js";
5
+ import { B as q, a as G, b as K, c as j, d as z, e as U, f as W, g as X, h as J, i as Q, j as Z, k as $, l as aa, m as ta, n as sa, o as ea, p as ra, q as ha, r as Ba, s as oa, t as la, u as ia, v as na, w as pa, x as da, y as ca, z as ma, A as Sa, C as ua, D as Ca, E as Ta, F as fa, G as ga, H as xa, I as ba, J as ka, K as Da, L as Ea, M as Fa, N as Ia, O as va, P as Ra, Q as ya, R as Pa, S as Aa, T as La, U as Ma, V as _a, W as wa, X as Va, Y as Na, Z as Ha, _ as Oa, $ as Ya, a0 as qa, a1 as Ga, a2 as Ka, a3 as ja, a4 as za, a5 as Ua } from "./chunks/baht-workflow-CdiF0vxT.js";
6
6
  import { B as Xa, a as Ja, S as Qa, b as Za, h as $a, c as at } from "./chunks/base-D1pT3J5T.js";
7
7
  export {
8
8
  q as BahtAccordion,
package/dist/overlay.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as I } from "./chunks/baht-toast-8qUXxEvh.js";
1
+ import { e as I } from "./chunks/baht-toast-DkZc1diO.js";
2
2
  let E = Promise.resolve();
3
3
  function L(e) {
4
4
  const t = E.then(e, e);
package/dist/ssr.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { render as d } from "@lit-labs/ssr";
2
2
  import { collectResult as u } from "@lit-labs/ssr/lib/render-result.js";
3
- import "./chunks/baht-toast-8qUXxEvh.js";
4
- import "./chunks/baht-workflow-C27godQM.js";
3
+ import "./chunks/baht-toast-DkZc1diO.js";
4
+ import "./chunks/baht-workflow-CdiF0vxT.js";
5
5
  import "./chunks/base-D1pT3J5T.js";
6
6
  const c = /<template shadowroot="(?:open|closed)" shadowrootmode="(?:open|closed)"[^>]*>|<template\b[^>]*>|<\/template>/g, x = (e) => e.startsWith("baht-");
7
7
  function f(e, i = x) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "bank20baht-ui",
4
- "version": "0.5.5",
4
+ "version": "0.5.7",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bank20baht-ui",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "type": "module",
5
5
  "description": "JSON-driven form + workflow engine. Send JSON in, get an interactive form out.",
6
6
  "license": "MIT",