bank20baht-ui 0.5.0 → 0.5.1

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,8 +1,8 @@
1
1
  import { svg as r, html as p, nothing as d } from "lit";
2
2
  import { property as l, query as $, customElement as f, state as w } from "lit/decorators.js";
3
- import { B as v, b as C, h as g } from "./base-CajA2aCO.js";
4
- import { t as E } from "./i18n-Cnr3OLiz.js";
5
- const O = {
3
+ import { B as v, b as C, h as g } from "./base-CGS8ov6z.js";
4
+ import { t as O } from "./i18n-Cnr3OLiz.js";
5
+ const M = {
6
6
  copy: r`<rect x="6" y="6" width="8" height="8" rx="1.5"/><path d="M10 6V4.5A1.5 1.5 0 0 0 8.5 3H4.5A1.5 1.5 0 0 0 3 4.5v4A1.5 1.5 0 0 0 4.5 10H6"/>`,
7
7
  check: r`<path d="M3.5 8.5 6.5 11.5 12.5 4.5"/>`,
8
8
  download: r`<path d="M8 3v7m0 0 3-3m-3 3L5 7"/><path d="M3 12h10"/>`,
@@ -21,7 +21,7 @@ const O = {
21
21
  // column picker trigger (sliders)
22
22
  columns: r`<path d="M3 5h10M3 11h10"/><circle cx="6" cy="5" r="1.5" fill="var(--baht-color-surface, #fff)"/><circle cx="10" cy="11" r="1.5" fill="var(--baht-color-surface, #fff)"/>`
23
23
  };
24
- function _(t) {
24
+ function x(t) {
25
25
  return p`<svg
26
26
  class="baht-icon"
27
27
  width="16"
@@ -33,15 +33,15 @@ function _(t) {
33
33
  stroke-linecap="round"
34
34
  stroke-linejoin="round"
35
35
  aria-hidden="true"
36
- >${O[t]}</svg>`;
36
+ >${M[t]}</svg>`;
37
37
  }
38
- function x(t) {
39
- return t in O;
38
+ function S(t) {
39
+ return t in M;
40
40
  }
41
- var S = Object.defineProperty, k = Object.getOwnPropertyDescriptor, u = (t, s, o, i) => {
41
+ var E = Object.defineProperty, k = Object.getOwnPropertyDescriptor, u = (t, s, o, i) => {
42
42
  for (var e = i > 1 ? void 0 : i ? k(s, o) : s, a = t.length - 1, c; a >= 0; a--)
43
43
  (c = t[a]) && (e = (i ? c(s, o, e) : c(e)) || e);
44
- return i && e && S(s, o, e), e;
44
+ return i && e && E(s, o, e), e;
45
45
  };
46
46
  let h = class extends v {
47
47
  constructor() {
@@ -51,7 +51,7 @@ let h = class extends v {
51
51
  this.iconOnly || C(this, this.buttonEl);
52
52
  }
53
53
  render() {
54
- const t = this.variant === "primary" ? "" : ` baht-button--${this.variant}`, s = this.size === "md" ? "" : ` baht-button--${this.size}`, o = this.iconOnly ? " baht-button--icon" : "", i = this.icon && x(this.icon) ? _(this.icon) : d;
54
+ const t = this.variant === "primary" ? "" : ` baht-button--${this.variant}`, s = this.size === "md" ? "" : ` baht-button--${this.size}`, o = this.iconOnly ? " baht-button--icon" : "", i = this.icon && S(this.icon) ? x(this.icon) : d;
55
55
  return p`<button
56
56
  class="baht-button${t}${s}${o}"
57
57
  type=${this.type}
@@ -88,7 +88,7 @@ h = u([
88
88
  f("baht-button")
89
89
  ], h);
90
90
  const P = 600;
91
- function M(t, s) {
91
+ function _(t, s) {
92
92
  const o = typeof t.getAnimations == "function" ? t.getAnimations({ subtree: !0 }) : [];
93
93
  if (o.length === 0) {
94
94
  s();
@@ -101,7 +101,7 @@ function M(t, s) {
101
101
  Promise.all(o.map((a) => a.finished.catch(() => {
102
102
  }))).then(e, e), setTimeout(e, P);
103
103
  }
104
- var B = Object.defineProperty, T = Object.getOwnPropertyDescriptor, b = (t, s, o, i) => {
104
+ var B = Object.defineProperty, T = Object.getOwnPropertyDescriptor, m = (t, s, o, i) => {
105
105
  for (var e = i > 1 ? void 0 : i ? T(s, o) : s, a = t.length - 1, c; a >= 0; a--)
106
106
  (c = t[a]) && (e = (i ? c(s, o, e) : c(e)) || e);
107
107
  return i && e && B(s, o, e), e;
@@ -155,7 +155,7 @@ let n = class extends v {
155
155
  const i = ++this.closeToken, e = this.querySelector(".baht-modal-scrim"), a = () => {
156
156
  i === this.closeToken && !this.open && (this.closing = !1);
157
157
  };
158
- e ? M(e, a) : a();
158
+ e ? _(e, a) : a();
159
159
  }
160
160
  if (t.has("open") && this.open && (this.previousFocus = document.activeElement, (s = this.querySelector(".baht-modal")) == null || s.focus()), t.has("open") && !this.open && t.get("open") === !0) {
161
161
  const i = this.previousFocus;
@@ -164,9 +164,7 @@ let n = class extends v {
164
164
  }
165
165
  /** Ask the host to close (the host owns `open`). */
166
166
  requestClose(t = "button") {
167
- this.dispatchEvent(
168
- new CustomEvent("baht-close", { detail: { reason: t }, bubbles: !0, composed: !0 })
169
- );
167
+ this.emit("baht-close", { reason: t });
170
168
  }
171
169
  render() {
172
170
  return p`<div
@@ -184,7 +182,7 @@ let n = class extends v {
184
182
  >
185
183
  ${this.heading || this.showClose ? p`<header class="baht-modal-header">
186
184
  <div class="baht-modal-title" id=${this.titleId}>${this.heading}</div>
187
- ${this.showClose ? p`<button type="button" class="baht-modal-close" aria-label=${E("close")} @click=${() => this.requestClose("button")}>×</button>` : d}
185
+ ${this.showClose ? p`<button type="button" class="baht-modal-close" aria-label=${O("close")} @click=${() => this.requestClose("button")}>×</button>` : d}
188
186
  </header>` : d}
189
187
  <div class="baht-modal-body"></div>
190
188
  </div>
@@ -192,25 +190,25 @@ let n = class extends v {
192
190
  }
193
191
  };
194
192
  n.openStack = [];
195
- b([
193
+ m([
196
194
  l({ type: Boolean, reflect: !0 })
197
195
  ], n.prototype, "open", 2);
198
- b([
196
+ m([
199
197
  l()
200
198
  ], n.prototype, "heading", 2);
201
- b([
199
+ m([
202
200
  l({ type: Boolean, attribute: "show-close" })
203
201
  ], n.prototype, "showClose", 2);
204
- b([
202
+ m([
205
203
  l({ type: Boolean, attribute: "close-on-scrim" })
206
204
  ], n.prototype, "closeOnScrim", 2);
207
- b([
205
+ m([
208
206
  $(".baht-modal-body")
209
207
  ], n.prototype, "bodyEl", 2);
210
- b([
208
+ m([
211
209
  w()
212
210
  ], n.prototype, "closing", 2);
213
- n = b([
211
+ n = m([
214
212
  f("baht-modal")
215
213
  ], n);
216
214
  var D = Object.defineProperty, q = Object.getOwnPropertyDescriptor, y = (t, s, o, i) => {
@@ -218,13 +216,13 @@ var D = Object.defineProperty, q = Object.getOwnPropertyDescriptor, y = (t, s, o
218
216
  (c = t[a]) && (e = (i ? c(s, o, e) : c(e)) || e);
219
217
  return i && e && D(s, o, e), e;
220
218
  };
221
- let m = class extends v {
219
+ let b = class extends v {
222
220
  constructor() {
223
221
  super(...arguments), this.duration = 4e3, this.entries = [], this.timers = /* @__PURE__ */ new Map();
224
222
  }
225
223
  show(t) {
226
224
  const s = {
227
- id: ++m.counter,
225
+ id: ++b.counter,
228
226
  message: t.message,
229
227
  tone: t.tone ?? "neutral",
230
228
  duration: t.duration ?? this.duration
@@ -237,13 +235,7 @@ let m = class extends v {
237
235
  dismiss(t) {
238
236
  const s = this.entries.find((e) => e.id === t);
239
237
  if (!s || s.leaving) return;
240
- clearTimeout(this.timers.get(t)), this.timers.delete(t), this.entries = this.entries.map((e) => e.id === t ? { ...e, leaving: !0 } : e), this.dispatchEvent(
241
- new CustomEvent("baht-dismiss", {
242
- detail: { id: t, message: s.message },
243
- bubbles: !0,
244
- composed: !0
245
- })
246
- );
238
+ clearTimeout(this.timers.get(t)), this.timers.delete(t), this.entries = this.entries.map((e) => e.id === t ? { ...e, leaving: !0 } : e), this.emit("baht-dismiss", { id: t, message: s.message });
247
239
  const o = () => {
248
240
  this.entries = this.entries.filter((e) => e.id !== t);
249
241
  }, i = this.querySelector(`.baht-toast[data-toast="${t}"]`);
@@ -251,7 +243,7 @@ let m = class extends v {
251
243
  o();
252
244
  return;
253
245
  }
254
- i.classList.add("baht-toast--leaving"), M(i, o);
246
+ i.classList.add("baht-toast--leaving"), _(i, o);
255
247
  }
256
248
  disconnectedCallback() {
257
249
  this.timers.forEach((t) => clearTimeout(t)), this.timers.clear(), super.disconnectedCallback();
@@ -266,27 +258,27 @@ let m = class extends v {
266
258
  role=${t.tone === "danger" || t.tone === "warning" ? "alert" : d}
267
259
  >
268
260
  <span class="baht-toast-message">${t.message}</span>
269
- <button type="button" class="baht-toast-dismiss" aria-label=${E("dismiss")} @click=${() => this.dismiss(t.id)}>×</button>
261
+ <button type="button" class="baht-toast-dismiss" aria-label=${O("dismiss")} @click=${() => this.dismiss(t.id)}>×</button>
270
262
  </div>`
271
263
  )}
272
264
  </div>`;
273
265
  }
274
266
  };
275
- m.counter = 0;
267
+ b.counter = 0;
276
268
  y([
277
269
  l({ type: Number })
278
- ], m.prototype, "duration", 2);
270
+ ], b.prototype, "duration", 2);
279
271
  y([
280
272
  w()
281
- ], m.prototype, "entries", 2);
282
- m = y([
273
+ ], b.prototype, "entries", 2);
274
+ b = y([
283
275
  f("baht-toast")
284
- ], m);
276
+ ], b);
285
277
  export {
286
278
  h as B,
287
279
  n as a,
288
- m as b,
289
- M as c,
290
- x as i,
291
- _ as r
280
+ b,
281
+ _ as c,
282
+ S as i,
283
+ x as r
292
284
  };