bank20baht-ui 0.12.3 → 0.13.0
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/components/baht-form.js +18 -16
- package/dist/components/baht-workflow.js +27 -25
- package/dist/components/define.d.ts +7 -0
- package/dist/components/define.js +16 -0
- package/dist/components/primitives/baht-accordion.js +10 -9
- package/dist/components/primitives/baht-alert.js +22 -21
- package/dist/components/primitives/baht-avatar.js +5 -4
- package/dist/components/primitives/baht-badge.js +12 -11
- package/dist/components/primitives/baht-bar-chart.js +6 -5
- package/dist/components/primitives/baht-breadcrumbs.js +19 -18
- package/dist/components/primitives/baht-button.js +13 -12
- package/dist/components/primitives/baht-card.js +24 -23
- package/dist/components/primitives/baht-checkbox.js +6 -6
- package/dist/components/primitives/baht-code.js +11 -10
- package/dist/components/primitives/baht-currency.js +13 -12
- package/dist/components/primitives/baht-datepicker.js +12 -12
- package/dist/components/primitives/baht-donut-chart.js +10 -9
- package/dist/components/primitives/baht-empty-state.js +16 -15
- package/dist/components/primitives/baht-error-state.js +19 -18
- package/dist/components/primitives/baht-fieldset.js +10 -9
- package/dist/components/primitives/baht-file.js +38 -35
- package/dist/components/primitives/baht-filter.js +18 -17
- package/dist/components/primitives/baht-heatmap.js +12 -11
- package/dist/components/primitives/baht-input.js +6 -6
- package/dist/components/primitives/baht-keyvalue-editor.js +5 -4
- package/dist/components/primitives/baht-line-chart.js +24 -23
- package/dist/components/primitives/baht-link.js +8 -7
- package/dist/components/primitives/baht-list.js +6 -5
- package/dist/components/primitives/baht-loading-overlay.js +15 -14
- package/dist/components/primitives/baht-meter.js +7 -6
- package/dist/components/primitives/baht-modal.js +12 -11
- package/dist/components/primitives/baht-multiselect.js +6 -6
- package/dist/components/primitives/baht-number.js +6 -6
- package/dist/components/primitives/baht-otp.js +7 -6
- package/dist/components/primitives/baht-pagination.js +12 -11
- package/dist/components/primitives/baht-progress-ring.js +11 -10
- package/dist/components/primitives/baht-progress.js +8 -7
- package/dist/components/primitives/baht-radio.js +6 -6
- package/dist/components/primitives/baht-range.js +11 -10
- package/dist/components/primitives/baht-rating.js +9 -8
- package/dist/components/primitives/baht-reference-picker.js +5 -4
- package/dist/components/primitives/baht-repeater.js +42 -40
- package/dist/components/primitives/baht-section.js +12 -11
- package/dist/components/primitives/baht-select.js +11 -10
- package/dist/components/primitives/baht-skeleton.js +9 -8
- package/dist/components/primitives/baht-sparkline.js +10 -9
- package/dist/components/primitives/baht-spinner.js +9 -8
- package/dist/components/primitives/baht-stat-chart.js +14 -13
- package/dist/components/primitives/baht-stat.js +10 -9
- package/dist/components/primitives/baht-steps.js +8 -6
- package/dist/components/primitives/baht-swipe-row.js +8 -7
- package/dist/components/primitives/baht-table.js +5 -4
- package/dist/components/primitives/baht-tags.js +12 -11
- package/dist/components/primitives/baht-text.js +17 -16
- package/dist/components/primitives/baht-textarea.js +6 -6
- package/dist/components/primitives/baht-timeline.js +5 -4
- package/dist/components/primitives/baht-toast.js +22 -21
- package/dist/components/primitives/baht-toggle.js +6 -6
- package/dist/components/primitives/baht-tooltip.js +20 -19
- package/dist/components/primitives/baht-typeahead.js +19 -18
- package/dist/components/primitives/baht-upload.js +17 -15
- package/dist/core/i18n.d.ts +4 -0
- package/dist/core/i18n.js +4 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/core/pattern-safety.d.ts +13 -4
- package/dist/core/pattern-safety.js +124 -37
- package/dist/core/types.d.ts +2 -0
- package/dist/core/urls.d.ts +7 -0
- package/dist/core/urls.js +10 -0
- package/dist/core/validators.d.ts +2 -0
- package/dist/core/validators.js +116 -99
- package/dist/custom-elements.json +37 -0
- package/dist/engine.js +45 -42
- package/dist/index.js +190 -187
- package/dist/ssr.js +3 -2
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { nothing as g, html as p } from "lit";
|
|
2
|
-
import { property as d, state as m
|
|
3
|
-
import { repeat as
|
|
2
|
+
import { property as d, state as m } from "lit/decorators.js";
|
|
3
|
+
import { repeat as E } from "lit/directives/repeat.js";
|
|
4
4
|
import { html as $ } from "lit/static-html.js";
|
|
5
|
-
import { BahtElement as
|
|
6
|
-
import { TAG_FOR_TYPE as
|
|
5
|
+
import { BahtElement as P, hasDom as O } from "./base.js";
|
|
6
|
+
import { TAG_FOR_TYPE as T, WIDTH_CLASS as B, staticTag as I } from "./primitives/tag-map.js";
|
|
7
7
|
import { defaultValue as C } from "../core/defaults.js";
|
|
8
8
|
import { t as D } from "../core/i18n.js";
|
|
9
9
|
import { validateField as _ } from "../core/validators.js";
|
|
10
|
+
import "../core/pattern-safety.js";
|
|
10
11
|
import { resolveViewFields as M } from "../core/views.js";
|
|
11
|
-
import { applyFlags as
|
|
12
|
-
import { hasScripts as w, runScripts as F, createScriptContext as
|
|
13
|
-
import { displayValue as
|
|
12
|
+
import { applyFlags as j } from "../core/flags.js";
|
|
13
|
+
import { hasScripts as w, runScripts as F, createScriptContext as L, MAX_SCRIPT_DEPTH as x } from "../core/engine/scripts.js";
|
|
14
|
+
import { displayValue as A } from "../core/display.js";
|
|
14
15
|
import "./primitives/baht-input.js";
|
|
15
16
|
import "./primitives/baht-textarea.js";
|
|
16
17
|
import "./primitives/baht-number.js";
|
|
@@ -26,12 +27,13 @@ import "./primitives/baht-file.js";
|
|
|
26
27
|
import "./primitives/baht-text.js";
|
|
27
28
|
import "./primitives/baht-section.js";
|
|
28
29
|
import "./primitives/baht-repeater.js";
|
|
30
|
+
import { customElement as R } from "./define.js";
|
|
29
31
|
var U = Object.defineProperty, W = Object.getOwnPropertyDescriptor, h = (t, s, e, i) => {
|
|
30
32
|
for (var r = i > 1 ? void 0 : i ? W(s, e) : s, o = t.length - 1, a; o >= 0; o--)
|
|
31
33
|
(a = t[o]) && (r = (i ? a(s, e, r) : a(r)) || r);
|
|
32
34
|
return i && r && U(s, e, r), r;
|
|
33
35
|
};
|
|
34
|
-
let n = class extends
|
|
36
|
+
let n = class extends P {
|
|
35
37
|
constructor() {
|
|
36
38
|
super(...arguments), this.value = {}, this.registry = {}, this.showOptional = !1, this.options = {}, this.fieldStates = {}, this.flags = {}, this.readonly = !1, this.edits = {}, this.errors = [], this.scriptStates = {}, this.fieldMessages = {}, this.formMessages = [], this.scriptContext = null, this.scriptContextForm = null, this.scriptDepth = 0, this.loadedForm = null, this.dynamicOptions = /* @__PURE__ */ new Map(), this.optionsSnapshots = /* @__PURE__ */ new Map(), this.optionsEpoch = /* @__PURE__ */ new Map(), this.warnedViews = /* @__PURE__ */ new Set(), this.flagCache = {}, this.lastVisible = {}, this.nextVisible = {};
|
|
37
39
|
}
|
|
@@ -45,7 +47,7 @@ let n = class extends T {
|
|
|
45
47
|
get effectiveForm() {
|
|
46
48
|
const t = this.assignedForm;
|
|
47
49
|
if (t)
|
|
48
|
-
return (this.flagCache.form !== t || this.flagCache.flags !== this.flags) && (this.flagCache = { form: t, flags: this.flags, out:
|
|
50
|
+
return (this.flagCache.form !== t || this.flagCache.flags !== this.flags) && (this.flagCache = { form: t, flags: this.flags, out: j(t, this.flags) }), this.flagCache.out;
|
|
49
51
|
}
|
|
50
52
|
willUpdate(t) {
|
|
51
53
|
t.has("value") && (this.edits = {}), (t.has("form") || t.has("flags")) && (this.dynamicOptions.clear(), this.optionsSnapshots.clear(), this.optionsEpoch.clear()), t.has("form") && (this.scriptStates = {}, this.fieldMessages = {}, this.formMessages = [], this.scriptContext = null), (t.has("form") || t.has("flags") || t.has("value") || t.has("registry")) && this.syncDynamicOptions();
|
|
@@ -192,7 +194,7 @@ let n = class extends T {
|
|
|
192
194
|
// ---- client scripts (spec 01 §14) ----
|
|
193
195
|
/** The `g` (g_form) for the current form — built lazily over this component's state. */
|
|
194
196
|
g(t) {
|
|
195
|
-
return this.scriptContext && this.scriptContextForm === t ? this.scriptContext : (this.scriptContextForm = t, this.scriptContext =
|
|
197
|
+
return this.scriptContext && this.scriptContextForm === t ? this.scriptContext : (this.scriptContextForm = t, this.scriptContext = L(t, {
|
|
196
198
|
getData: () => this.getData(),
|
|
197
199
|
setValue: (s, e) => {
|
|
198
200
|
this.applyScriptValue(s, e);
|
|
@@ -316,15 +318,15 @@ let n = class extends T {
|
|
|
316
318
|
}
|
|
317
319
|
renderField(t) {
|
|
318
320
|
var S;
|
|
319
|
-
const s =
|
|
321
|
+
const s = T[t.type];
|
|
320
322
|
if (!s)
|
|
321
323
|
return console.warn(`[bahtui] unknown field type "${t.type}" — skipped`), g;
|
|
322
|
-
const e = this.stateFor(t), i =
|
|
324
|
+
const e = this.stateFor(t), i = B[t.width ?? "full"] ?? "baht-field--w-full", r = ((S = this.errors.find((u) => u.key === t.key)) == null ? void 0 : S.message) ?? null;
|
|
323
325
|
if (this.readonly && t.type !== "label" && t.type !== "section")
|
|
324
326
|
return this.renderReadonlyField(t, i, e.visible);
|
|
325
327
|
const o = t.options_from ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, a = this.valueFor(t), l = !e.enabled, c = this.readonly || e.readonly, b = this.options.inputDebounce, v = (u) => {
|
|
326
328
|
this.onControlInput(t.key, u);
|
|
327
|
-
}, f =
|
|
329
|
+
}, f = I(s);
|
|
328
330
|
let y;
|
|
329
331
|
if (t.type === "repeater") {
|
|
330
332
|
const u = this.errors.filter((q) => q.key.startsWith(`${t.key}[`)), V = this.rowStatesFor(t.key);
|
|
@@ -405,7 +407,7 @@ let n = class extends T {
|
|
|
405
407
|
e && this.onFieldInput(e, s);
|
|
406
408
|
}
|
|
407
409
|
renderReadonlyField(t, s, e) {
|
|
408
|
-
const i = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, r =
|
|
410
|
+
const i = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, r = A(t, this.valueFor(t), i), o = r.kind === "empty" ? p`<span class="baht-readonly-value baht-readonly-value--empty">${D("emptyValue")}</span>` : r.kind === "text" ? p`<span class="baht-readonly-value">${r.text}</span>` : r.kind === "chips" ? p`<span class="baht-readonly-value baht-readonly-chips"
|
|
409
411
|
>${r.items.map((a) => p`<span class="baht-readonly-chip">${a}</span>`)}</span
|
|
410
412
|
>` : p`<div class="baht-readonly-rows">
|
|
411
413
|
${r.rows.map(
|
|
@@ -441,7 +443,7 @@ let n = class extends T {
|
|
|
441
443
|
</div>`
|
|
442
444
|
)}
|
|
443
445
|
</div>` : g}
|
|
444
|
-
${
|
|
446
|
+
${E(
|
|
445
447
|
this.sortedFields,
|
|
446
448
|
(t) => t.key,
|
|
447
449
|
(t) => this.renderField(t)
|
|
@@ -492,7 +494,7 @@ h([
|
|
|
492
494
|
m()
|
|
493
495
|
], n.prototype, "formMessages", 2);
|
|
494
496
|
n = h([
|
|
495
|
-
|
|
497
|
+
R("baht-form")
|
|
496
498
|
], n);
|
|
497
499
|
export {
|
|
498
500
|
n as BahtForm
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { nothing as
|
|
2
|
-
import { property as m, state as
|
|
3
|
-
import { keyed as
|
|
4
|
-
import { boolOff as b, BahtElement as
|
|
1
|
+
import { nothing as f, html as h } from "lit";
|
|
2
|
+
import { property as m, state as c } from "lit/decorators.js";
|
|
3
|
+
import { keyed as g } from "lit/directives/keyed.js";
|
|
4
|
+
import { boolOff as b, BahtElement as _, obj as k, stringOf as v } from "./base.js";
|
|
5
5
|
import { t as d } from "../core/i18n.js";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import "../core/pattern-safety.js";
|
|
7
|
+
import { applyFlags as $ } from "../core/flags.js";
|
|
8
|
+
import { evaluate as y } from "../core/engine/evaluate.js";
|
|
9
|
+
import { resolveNext as F } from "../core/engine/graph.js";
|
|
9
10
|
import "./baht-form.js";
|
|
10
11
|
import "./primitives/baht-steps.js";
|
|
12
|
+
import { customElement as x } from "./define.js";
|
|
11
13
|
var j = Object.defineProperty, E = Object.getOwnPropertyDescriptor, o = (t, e, a, r) => {
|
|
12
14
|
for (var i = r > 1 ? void 0 : r ? E(e, a) : e, n = t.length - 1, l; n >= 0; n--)
|
|
13
15
|
(l = t[n]) && (i = (r ? l(e, a, i) : l(i)) || i);
|
|
14
16
|
return r && i && j(e, a, i), i;
|
|
15
17
|
};
|
|
16
|
-
let s = class extends
|
|
18
|
+
let s = class extends _ {
|
|
17
19
|
constructor() {
|
|
18
20
|
super(...arguments), this.value = {}, this.registry = {}, this.validateGate = !0, this.showBack = !0, this.direction = null, this.flags = {}, this.showSteps = !1, this.stepsVariant = "default", this.data = {}, this.derived = null, this.current = null, this.approvalError = null, this.history = [], this.flagCache = {};
|
|
19
21
|
}
|
|
@@ -30,16 +32,16 @@ let s = class extends k {
|
|
|
30
32
|
get effectiveWorkflow() {
|
|
31
33
|
const t = this.assignedWorkflow;
|
|
32
34
|
if (t)
|
|
33
|
-
return (this.flagCache.workflow !== t || this.flagCache.flags !== this.flags) && (this.flagCache = { workflow: t, flags: this.flags, out:
|
|
35
|
+
return (this.flagCache.workflow !== t || this.flagCache.flags !== this.flags) && (this.flagCache = { workflow: t, flags: this.flags, out: $(t, this.flags) }), this.flagCache.out;
|
|
34
36
|
}
|
|
35
37
|
willUpdate(t) {
|
|
36
38
|
var e, a;
|
|
37
|
-
this.assignedWorkflow && (t.has("workflow") || t.has("value") ? (this.data = structuredClone(
|
|
39
|
+
this.assignedWorkflow && (t.has("workflow") || t.has("value") ? (this.data = structuredClone(k(this.value)), this.reevaluate(), this.history = [], this.current = ((e = this.visibleForms[0]) == null ? void 0 : e.form_name) ?? null, this.approvalError = null) : t.has("flags") && (this.reevaluate(), this.current && !this.visibleForms.some((r) => r.form_name === this.current) && (this.current = ((a = this.visibleForms[0]) == null ? void 0 : a.form_name) ?? null)));
|
|
38
40
|
}
|
|
39
41
|
reevaluate() {
|
|
40
42
|
const t = this.effectiveWorkflow;
|
|
41
43
|
if (!t) return;
|
|
42
|
-
const e =
|
|
44
|
+
const e = y(t, this.data);
|
|
43
45
|
this.derived = e, this.data = e.data;
|
|
44
46
|
}
|
|
45
47
|
/** Forms in ascending order whose derived visibility is true. */
|
|
@@ -61,7 +63,7 @@ let s = class extends k {
|
|
|
61
63
|
const t = this.effectiveWorkflow;
|
|
62
64
|
if (!t) return "end";
|
|
63
65
|
if (t.transitions && t.transitions.length > 0)
|
|
64
|
-
return
|
|
66
|
+
return F(t, this.current, this.data);
|
|
65
67
|
const e = this.visibleForms, a = e.findIndex((i) => i.form_name === this.current);
|
|
66
68
|
return ((r = e[a + 1]) == null ? void 0 : r.form_name) ?? "end";
|
|
67
69
|
}
|
|
@@ -223,15 +225,15 @@ let s = class extends k {
|
|
|
223
225
|
</span>
|
|
224
226
|
<textarea
|
|
225
227
|
rows="3"
|
|
226
|
-
aria-required=${e === "required" ? "true" :
|
|
227
|
-
aria-invalid=${this.approvalError ? "true" :
|
|
228
|
+
aria-required=${e === "required" ? "true" : f}
|
|
229
|
+
aria-invalid=${this.approvalError ? "true" : f}
|
|
228
230
|
.value=${v((i = this.data[t.form_name]) == null ? void 0 : i.comment)}
|
|
229
231
|
@input=${(n) => {
|
|
230
232
|
this.onCommentInput(t.form_name, n.target.value);
|
|
231
233
|
}}
|
|
232
234
|
></textarea>
|
|
233
|
-
</label>` :
|
|
234
|
-
${this.approvalError ? h`<p class="baht-error" role="alert">${this.approvalError}</p>` :
|
|
235
|
+
</label>` : f}
|
|
236
|
+
${this.approvalError ? h`<p class="baht-error" role="alert">${this.approvalError}</p>` : f}
|
|
235
237
|
</div>`;
|
|
236
238
|
}
|
|
237
239
|
render() {
|
|
@@ -251,8 +253,8 @@ let s = class extends k {
|
|
|
251
253
|
.steps=${a.map((l) => l.form_name)}
|
|
252
254
|
.current=${r}
|
|
253
255
|
.variant=${this.stepsVariant}
|
|
254
|
-
></baht-steps>` :
|
|
255
|
-
${
|
|
256
|
+
></baht-steps>` : f}
|
|
257
|
+
${g(
|
|
256
258
|
t.form_name,
|
|
257
259
|
h`<div
|
|
258
260
|
class="baht-workflow-step${this.direction ? ` baht-workflow-step--${this.direction}` : ""}"
|
|
@@ -277,7 +279,7 @@ let s = class extends k {
|
|
|
277
279
|
}}
|
|
278
280
|
>
|
|
279
281
|
${this.backLabel ?? d("back")}
|
|
280
|
-
</button>` :
|
|
282
|
+
</button>` : f}
|
|
281
283
|
${e ? h`<button
|
|
282
284
|
type="button"
|
|
283
285
|
class="baht-button baht-button--reject"
|
|
@@ -334,7 +336,7 @@ o([
|
|
|
334
336
|
m({ attribute: "show-back", converter: b })
|
|
335
337
|
], s.prototype, "showBack", 2);
|
|
336
338
|
o([
|
|
337
|
-
|
|
339
|
+
c()
|
|
338
340
|
], s.prototype, "direction", 2);
|
|
339
341
|
o([
|
|
340
342
|
m({ attribute: !1 })
|
|
@@ -346,19 +348,19 @@ o([
|
|
|
346
348
|
m({ attribute: "steps-variant" })
|
|
347
349
|
], s.prototype, "stepsVariant", 2);
|
|
348
350
|
o([
|
|
349
|
-
|
|
351
|
+
c()
|
|
350
352
|
], s.prototype, "data", 2);
|
|
351
353
|
o([
|
|
352
|
-
|
|
354
|
+
c()
|
|
353
355
|
], s.prototype, "derived", 2);
|
|
354
356
|
o([
|
|
355
|
-
|
|
357
|
+
c()
|
|
356
358
|
], s.prototype, "current", 2);
|
|
357
359
|
o([
|
|
358
|
-
|
|
360
|
+
c()
|
|
359
361
|
], s.prototype, "approvalError", 2);
|
|
360
362
|
s = o([
|
|
361
|
-
|
|
363
|
+
x("baht-workflow")
|
|
362
364
|
], s);
|
|
363
365
|
export {
|
|
364
366
|
s as BahtWorkflow
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lit's `@customElement`, tolerating a tag being defined already. Module
|
|
3
|
+
* federation or a duplicated dependency can load two copies of bank20baht-ui
|
|
4
|
+
* into one page; the second copy keeps the first definition and warns
|
|
5
|
+
* instead of throwing from `customElements.define`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function customElement(tag: string): (cls: CustomElementConstructor) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const i = "0.13.0";
|
|
2
|
+
function o(e) {
|
|
3
|
+
return (n) => {
|
|
4
|
+
const t = customElements.get(e);
|
|
5
|
+
if (t) {
|
|
6
|
+
t !== n && console.warn(
|
|
7
|
+
`[bahtui] <${e}> is already defined (bank20baht-ui ${t.bahtVersion ?? "unknown"}); skipping the copy from bank20baht-ui ${i}`
|
|
8
|
+
);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(n, "bahtVersion", { value: i }), customElements.define(e, n);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
o as customElement
|
|
16
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { nothing as h, html as c } from "lit";
|
|
2
|
-
import { property as l, state as m
|
|
3
|
-
import { BahtElement as
|
|
4
|
-
import { renderIcon as
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { property as l, state as m } from "lit/decorators.js";
|
|
3
|
+
import { BahtElement as d } from "../base.js";
|
|
4
|
+
import { renderIcon as f } from "./icons.js";
|
|
5
|
+
import { customElement as g } from "../define.js";
|
|
6
|
+
var u = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (e, t, i, o) => {
|
|
7
|
+
for (var n = o > 1 ? void 0 : o ? b(t, i) : t, a = e.length - 1, p; a >= 0; a--)
|
|
7
8
|
(p = e[a]) && (n = (o ? p(t, i, n) : p(n)) || n);
|
|
8
|
-
return o && n &&
|
|
9
|
+
return o && n && u(t, i, n), n;
|
|
9
10
|
};
|
|
10
|
-
let r = class extends
|
|
11
|
+
let r = class extends d {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments), this.items = [], this.multiple = !1, this.openSet = /* @__PURE__ */ new Set(), this.itemsFingerprint = "";
|
|
13
14
|
}
|
|
@@ -40,7 +41,7 @@ let r = class extends g {
|
|
|
40
41
|
}}
|
|
41
42
|
>
|
|
42
43
|
<span>${e.title}</span>
|
|
43
|
-
<span class="baht-accordion-chevron" aria-hidden="true">${
|
|
44
|
+
<span class="baht-accordion-chevron" aria-hidden="true">${f("chevron-down")}</span>
|
|
44
45
|
</button>
|
|
45
46
|
${i ? c`<div class="baht-accordion-content" id=${n} role="region" aria-labelledby=${o}>${e.content}</div>` : h}
|
|
46
47
|
</div>`;
|
|
@@ -58,7 +59,7 @@ s([
|
|
|
58
59
|
m()
|
|
59
60
|
], r.prototype, "openSet", 2);
|
|
60
61
|
r = s([
|
|
61
|
-
|
|
62
|
+
g("baht-accordion")
|
|
62
63
|
], r);
|
|
63
64
|
export {
|
|
64
65
|
r as BahtAccordion
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { nothing as h, html as l } from "lit";
|
|
2
|
-
import { property as n, state as p
|
|
2
|
+
import { property as n, state as p } from "lit/decorators.js";
|
|
3
3
|
import { BahtElement as f } from "../base.js";
|
|
4
|
-
import { afterExit as
|
|
5
|
-
import { t as
|
|
6
|
-
|
|
4
|
+
import { afterExit as b } from "../motion.js";
|
|
5
|
+
import { t as g } from "../../core/i18n.js";
|
|
6
|
+
import { customElement as c } from "../define.js";
|
|
7
|
+
var v = Object.defineProperty, u = Object.getOwnPropertyDescriptor, a = (t, s, e, o) => {
|
|
7
8
|
for (var i = o > 1 ? void 0 : o ? u(s, e) : s, m = t.length - 1, d; m >= 0; m--)
|
|
8
9
|
(d = t[m]) && (i = (o ? d(s, e, i) : d(i)) || i);
|
|
9
10
|
return o && i && v(s, e, i), i;
|
|
10
11
|
};
|
|
11
|
-
let
|
|
12
|
+
let r = class extends f {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments), this.tone = "info", this.heading = "", this.message = "", this.dismissible = !1, this.dismissed = !1, this.generation = 0;
|
|
14
15
|
}
|
|
@@ -24,7 +25,7 @@ let a = class extends f {
|
|
|
24
25
|
s();
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
|
-
e.classList.add("baht-alert--leaving"),
|
|
28
|
+
e.classList.add("baht-alert--leaving"), b(e, s);
|
|
28
29
|
}
|
|
29
30
|
render() {
|
|
30
31
|
return this.dismissed ? h : l`<div class="baht-alert baht-alert--${this.tone}" role="alert">
|
|
@@ -32,30 +33,30 @@ let a = class extends f {
|
|
|
32
33
|
${this.heading ? l`<div class="baht-alert-title">${this.heading}</div>` : h}
|
|
33
34
|
${this.message ? l`<div class="baht-alert-message">${this.message}</div>` : h}
|
|
34
35
|
</div>
|
|
35
|
-
${this.dismissible ? l`<button type="button" class="baht-alert-dismiss" aria-label=${
|
|
36
|
+
${this.dismissible ? l`<button type="button" class="baht-alert-dismiss" aria-label=${g("dismiss")} @click=${() => {
|
|
36
37
|
this.dismiss();
|
|
37
38
|
}}>×</button>` : h}
|
|
38
39
|
</div>`;
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
|
-
|
|
42
|
+
a([
|
|
42
43
|
n()
|
|
43
|
-
],
|
|
44
|
-
|
|
44
|
+
], r.prototype, "tone", 2);
|
|
45
|
+
a([
|
|
45
46
|
n()
|
|
46
|
-
],
|
|
47
|
-
|
|
47
|
+
], r.prototype, "heading", 2);
|
|
48
|
+
a([
|
|
48
49
|
n()
|
|
49
|
-
],
|
|
50
|
-
|
|
50
|
+
], r.prototype, "message", 2);
|
|
51
|
+
a([
|
|
51
52
|
n({ type: Boolean })
|
|
52
|
-
],
|
|
53
|
-
|
|
53
|
+
], r.prototype, "dismissible", 2);
|
|
54
|
+
a([
|
|
54
55
|
p()
|
|
55
|
-
],
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
],
|
|
56
|
+
], r.prototype, "dismissed", 2);
|
|
57
|
+
r = a([
|
|
58
|
+
c("baht-alert")
|
|
59
|
+
], r);
|
|
59
60
|
export {
|
|
60
|
-
|
|
61
|
+
r as BahtAlert
|
|
61
62
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { html as h } from "lit";
|
|
2
|
-
import { property as n
|
|
3
|
-
import { BahtElement as
|
|
2
|
+
import { property as n } from "lit/decorators.js";
|
|
3
|
+
import { BahtElement as m } from "../base.js";
|
|
4
|
+
import { customElement as f } from "../define.js";
|
|
4
5
|
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, l = (e, t, s, i) => {
|
|
5
6
|
for (var r = i > 1 ? void 0 : i ? b(t, s) : t, o = e.length - 1, p; o >= 0; o--)
|
|
6
7
|
(p = e[o]) && (r = (i ? p(t, s, r) : p(r)) || r);
|
|
7
8
|
return i && r && v(t, s, r), r;
|
|
8
9
|
};
|
|
9
|
-
let a = class extends
|
|
10
|
+
let a = class extends m {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments), this.label = "", this.initials = "", this.size = "md";
|
|
12
13
|
}
|
|
@@ -35,7 +36,7 @@ l([
|
|
|
35
36
|
n()
|
|
36
37
|
], a.prototype, "size", 2);
|
|
37
38
|
a = l([
|
|
38
|
-
|
|
39
|
+
f("baht-avatar")
|
|
39
40
|
], a);
|
|
40
41
|
export {
|
|
41
42
|
a as BahtAvatar
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { nothing as u, html as i } from "lit";
|
|
2
|
-
import { property as
|
|
3
|
-
import { BahtElement as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { property as h } from "lit/decorators.js";
|
|
3
|
+
import { BahtElement as b } from "../base.js";
|
|
4
|
+
import { customElement as d } from "../define.js";
|
|
5
|
+
var m = Object.defineProperty, c = Object.getOwnPropertyDescriptor, n = (r, o, a, s) => {
|
|
6
|
+
for (var t = s > 1 ? void 0 : s ? c(o, a) : o, l = r.length - 1, p; l >= 0; l--)
|
|
7
|
+
(p = r[l]) && (t = (s ? p(o, a, t) : p(t)) || t);
|
|
8
|
+
return s && t && m(o, a, t), t;
|
|
8
9
|
};
|
|
9
|
-
let e = class extends
|
|
10
|
+
let e = class extends b {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments), this.tone = "neutral", this.label = "", this.dot = null;
|
|
12
13
|
}
|
|
@@ -21,16 +22,16 @@ let e = class extends d {
|
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
n([
|
|
24
|
-
|
|
25
|
+
h()
|
|
25
26
|
], e.prototype, "tone", 2);
|
|
26
27
|
n([
|
|
27
|
-
|
|
28
|
+
h()
|
|
28
29
|
], e.prototype, "label", 2);
|
|
29
30
|
n([
|
|
30
|
-
|
|
31
|
+
h({ attribute: !1 })
|
|
31
32
|
], e.prototype, "dot", 2);
|
|
32
33
|
e = n([
|
|
33
|
-
|
|
34
|
+
d("baht-badge")
|
|
34
35
|
], e);
|
|
35
36
|
export {
|
|
36
37
|
e as BahtBadge
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { html as o, nothing as k } from "lit";
|
|
2
|
-
import { property as v, state as V
|
|
2
|
+
import { property as v, state as V } from "lit/decorators.js";
|
|
3
3
|
import { hasDom as O, arr as n } from "../base.js";
|
|
4
|
-
import { BahtChartBase as
|
|
4
|
+
import { BahtChartBase as B, chartColor as F, niceTicks as L, renderTableTwin as E } from "./charts.js";
|
|
5
|
+
import { customElement as j } from "../define.js";
|
|
5
6
|
var P = Object.defineProperty, R = Object.getOwnPropertyDescriptor, $ = (t, a, e, r) => {
|
|
6
7
|
for (var i = r > 1 ? void 0 : r ? R(a, e) : a, s = t.length - 1, h; s >= 0; s--)
|
|
7
8
|
(h = t[s]) && (i = (r ? h(a, e, i) : h(i)) || i);
|
|
@@ -12,7 +13,7 @@ function _(t, a) {
|
|
|
12
13
|
const e = t[a];
|
|
13
14
|
return e !== void 0 && e !== "" ? e : "(empty)";
|
|
14
15
|
}
|
|
15
|
-
let p = class extends
|
|
16
|
+
let p = class extends B {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments), this.groups = [], this.series = [], this.categories = [], this.orientation = "horizontal", this.stacked = !1, this.compare = [], this.compareLabel = "Previous period", this.markers = [], this.labelValues = "ends", this.emphasis = null, this.color = "", this.label = "", this.band = 0;
|
|
18
19
|
}
|
|
@@ -90,7 +91,7 @@ let p = class extends E {
|
|
|
90
91
|
this.fmt(s.value),
|
|
91
92
|
...Array.from({ length: r.length - 2 }, () => "—")
|
|
92
93
|
]);
|
|
93
|
-
return
|
|
94
|
+
return E(this.label || "Bar chart data", r, i);
|
|
94
95
|
}
|
|
95
96
|
/** Markers with no `category` span the chart; the rest ride their own row. */
|
|
96
97
|
markersFor(t) {
|
|
@@ -353,7 +354,7 @@ $([
|
|
|
353
354
|
V()
|
|
354
355
|
], p.prototype, "band", 2);
|
|
355
356
|
p = $([
|
|
356
|
-
|
|
357
|
+
j("baht-bar-chart")
|
|
357
358
|
], p);
|
|
358
359
|
export {
|
|
359
360
|
p as BahtBarChart
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { html as n, nothing as
|
|
2
|
-
import { property as
|
|
3
|
-
import { BahtElement as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { html as n, nothing as c } from "lit";
|
|
2
|
+
import { property as b } from "lit/decorators.js";
|
|
3
|
+
import { BahtElement as i } from "../base.js";
|
|
4
|
+
import { customElement as u } from "../define.js";
|
|
5
|
+
var m = Object.defineProperty, f = Object.getOwnPropertyDescriptor, o = (t, r, s, e) => {
|
|
6
|
+
for (var a = e > 1 ? void 0 : e ? f(r, s) : r, l = t.length - 1, h; l >= 0; l--)
|
|
7
|
+
(h = t[l]) && (a = (e ? h(r, s, a) : h(a)) || a);
|
|
7
8
|
return e && a && m(r, s, a), a;
|
|
8
9
|
};
|
|
9
|
-
let
|
|
10
|
+
let p = class extends i {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments), this.items = [], this.separator = "›";
|
|
12
13
|
}
|
|
@@ -17,7 +18,7 @@ let l = class extends u {
|
|
|
17
18
|
const t = this.items.length - 1;
|
|
18
19
|
return n`<nav class="baht-breadcrumbs" aria-label="Breadcrumb">
|
|
19
20
|
${this.items.map((r, s) => {
|
|
20
|
-
const e = s < t ? n`<span class="baht-breadcrumbs-sep" aria-hidden="true">${this.separator}</span>` :
|
|
21
|
+
const e = s < t ? n`<span class="baht-breadcrumbs-sep" aria-hidden="true">${this.separator}</span>` : c;
|
|
21
22
|
return s === t ? n`<span class="baht-breadcrumbs-current" aria-current="page">${r.label}</span>${e}` : r.href ? n`<a class="baht-link" href=${r.href}>${r.label}</a>${e}` : n`<a
|
|
22
23
|
class="baht-link"
|
|
23
24
|
href="#"
|
|
@@ -29,15 +30,15 @@ let l = class extends u {
|
|
|
29
30
|
</nav>`;
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
],
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
],
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
],
|
|
33
|
+
o([
|
|
34
|
+
b({ attribute: !1 })
|
|
35
|
+
], p.prototype, "items", 2);
|
|
36
|
+
o([
|
|
37
|
+
b()
|
|
38
|
+
], p.prototype, "separator", 2);
|
|
39
|
+
p = o([
|
|
40
|
+
u("baht-breadcrumbs")
|
|
41
|
+
], p);
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
p as BahtBreadcrumbs
|
|
43
44
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { nothing as p, html as b } from "lit";
|
|
2
|
-
import { property as e, query as c
|
|
3
|
-
import { BahtElement as
|
|
4
|
-
import { isIconName as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { property as e, query as c } from "lit/decorators.js";
|
|
3
|
+
import { BahtElement as y, adoptLightChildren as u } from "../base.js";
|
|
4
|
+
import { isIconName as m, renderIcon as d } from "./icons.js";
|
|
5
|
+
import { customElement as f } from "../define.js";
|
|
6
|
+
var v = Object.defineProperty, O = Object.getOwnPropertyDescriptor, o = (a, s, r, n) => {
|
|
7
|
+
for (var i = n > 1 ? void 0 : n ? O(s, r) : s, l = a.length - 1, h; l >= 0; l--)
|
|
8
|
+
(h = a[l]) && (i = (n ? h(s, r, i) : h(i)) || i);
|
|
9
|
+
return n && i && v(s, r, i), i;
|
|
9
10
|
};
|
|
10
|
-
let t = class extends
|
|
11
|
+
let t = class extends y {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments), this.variant = "primary", this.size = "md", this.disabled = !1, this.type = "button", this.label = "", this.icon = "", this.iconOnly = !1, this.hostAriaLabel = "";
|
|
13
14
|
}
|
|
14
15
|
firstUpdated() {
|
|
15
|
-
this.iconOnly ||
|
|
16
|
+
this.iconOnly || u(this, this.buttonEl);
|
|
16
17
|
}
|
|
17
18
|
render() {
|
|
18
|
-
const
|
|
19
|
+
const a = this.variant === "primary" ? "" : ` baht-button--${this.variant}`, s = this.size === "md" ? "" : ` baht-button--${this.size}`, r = this.iconOnly ? " baht-button--icon" : "", n = this.icon && m(this.icon) ? d(this.icon) : p, i = this.hostAriaLabel || (this.iconOnly && this.label ? this.label : "");
|
|
19
20
|
return b`<button
|
|
20
|
-
class="baht-button${
|
|
21
|
+
class="baht-button${a}${s}${r}"
|
|
21
22
|
type=${this.type}
|
|
22
23
|
aria-label=${i || p}
|
|
23
24
|
?disabled=${this.disabled}
|
|
@@ -52,7 +53,7 @@ o([
|
|
|
52
53
|
c("button")
|
|
53
54
|
], t.prototype, "buttonEl", 2);
|
|
54
55
|
t = o([
|
|
55
|
-
|
|
56
|
+
f("baht-button")
|
|
56
57
|
], t);
|
|
57
58
|
export {
|
|
58
59
|
t as BahtButton
|