@20baht/ui 0.0.0-stage → 0.1.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.
Files changed (246) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +501 -2
  3. package/dist/components/baht-form.d.ts +191 -0
  4. package/dist/components/baht-form.js +614 -0
  5. package/dist/components/baht-workflow.d.ts +173 -0
  6. package/dist/components/baht-workflow.js +430 -0
  7. package/dist/components/base.d.ts +92 -0
  8. package/dist/components/base.js +138 -0
  9. package/dist/components/combobox-controller.d.ts +65 -0
  10. package/dist/components/combobox-controller.js +82 -0
  11. package/dist/components/define.d.ts +7 -0
  12. package/dist/components/define.js +16 -0
  13. package/dist/components/field-base.d.ts +84 -0
  14. package/dist/components/field-base.js +152 -0
  15. package/dist/components/floating.d.ts +84 -0
  16. package/dist/components/floating.js +182 -0
  17. package/dist/components/form-layout.d.ts +39 -0
  18. package/dist/components/form-layout.js +67 -0
  19. package/dist/components/form-options.d.ts +39 -0
  20. package/dist/components/form-options.js +65 -0
  21. package/dist/components/form-readonly.d.ts +20 -0
  22. package/dist/components/form-readonly.js +70 -0
  23. package/dist/components/layers.d.ts +4 -0
  24. package/dist/components/layers.js +15 -0
  25. package/dist/components/menu-controller.d.ts +65 -0
  26. package/dist/components/menu-controller.js +134 -0
  27. package/dist/components/motion.d.ts +9 -0
  28. package/dist/components/motion.js +16 -0
  29. package/dist/components/primitives/baht-accordion.d.ts +29 -0
  30. package/dist/components/primitives/baht-accordion.js +66 -0
  31. package/dist/components/primitives/baht-alert.d.ts +20 -0
  32. package/dist/components/primitives/baht-alert.js +62 -0
  33. package/dist/components/primitives/baht-app-shell.d.ts +81 -0
  34. package/dist/components/primitives/baht-app-shell.js +161 -0
  35. package/dist/components/primitives/baht-approval-chain.d.ts +59 -0
  36. package/dist/components/primitives/baht-approval-chain.js +80 -0
  37. package/dist/components/primitives/baht-avatar.d.ts +19 -0
  38. package/dist/components/primitives/baht-avatar.js +43 -0
  39. package/dist/components/primitives/baht-badge.d.ts +24 -0
  40. package/dist/components/primitives/baht-badge.js +41 -0
  41. package/dist/components/primitives/baht-bar-chart.d.ts +78 -0
  42. package/dist/components/primitives/baht-bar-chart.js +361 -0
  43. package/dist/components/primitives/baht-breadcrumbs.d.ts +23 -0
  44. package/dist/components/primitives/baht-breadcrumbs.js +45 -0
  45. package/dist/components/primitives/baht-button.d.ts +89 -0
  46. package/dist/components/primitives/baht-button.js +146 -0
  47. package/dist/components/primitives/baht-calendar.d.ts +96 -0
  48. package/dist/components/primitives/baht-calendar.js +398 -0
  49. package/dist/components/primitives/baht-card.d.ts +34 -0
  50. package/dist/components/primitives/baht-card.js +70 -0
  51. package/dist/components/primitives/baht-catalog-card.d.ts +52 -0
  52. package/dist/components/primitives/baht-catalog-card.js +90 -0
  53. package/dist/components/primitives/baht-checkbox.d.ts +7 -0
  54. package/dist/components/primitives/baht-checkbox.js +40 -0
  55. package/dist/components/primitives/baht-choice-group.d.ts +52 -0
  56. package/dist/components/primitives/baht-choice-group.js +71 -0
  57. package/dist/components/primitives/baht-code.d.ts +18 -0
  58. package/dist/components/primitives/baht-code.js +33 -0
  59. package/dist/components/primitives/baht-column-picker.d.ts +69 -0
  60. package/dist/components/primitives/baht-column-picker.js +234 -0
  61. package/dist/components/primitives/baht-comments.d.ts +38 -0
  62. package/dist/components/primitives/baht-comments.js +102 -0
  63. package/dist/components/primitives/baht-currency.d.ts +13 -0
  64. package/dist/components/primitives/baht-currency.js +69 -0
  65. package/dist/components/primitives/baht-datepicker.d.ts +77 -0
  66. package/dist/components/primitives/baht-datepicker.js +235 -0
  67. package/dist/components/primitives/baht-donut-chart.d.ts +24 -0
  68. package/dist/components/primitives/baht-donut-chart.js +88 -0
  69. package/dist/components/primitives/baht-edit-table.d.ts +45 -0
  70. package/dist/components/primitives/baht-edit-table.js +176 -0
  71. package/dist/components/primitives/baht-empty-state.d.ts +26 -0
  72. package/dist/components/primitives/baht-empty-state.js +51 -0
  73. package/dist/components/primitives/baht-error-state.d.ts +21 -0
  74. package/dist/components/primitives/baht-error-state.js +44 -0
  75. package/dist/components/primitives/baht-facts.d.ts +42 -0
  76. package/dist/components/primitives/baht-facts.js +49 -0
  77. package/dist/components/primitives/baht-fieldset.d.ts +19 -0
  78. package/dist/components/primitives/baht-fieldset.js +42 -0
  79. package/dist/components/primitives/baht-file.d.ts +27 -0
  80. package/dist/components/primitives/baht-file.js +158 -0
  81. package/dist/components/primitives/baht-filter-builder.d.ts +39 -0
  82. package/dist/components/primitives/baht-filter-builder.js +201 -0
  83. package/dist/components/primitives/baht-filter.d.ts +36 -0
  84. package/dist/components/primitives/baht-filter.js +64 -0
  85. package/dist/components/primitives/baht-heatmap.d.ts +49 -0
  86. package/dist/components/primitives/baht-heatmap.js +168 -0
  87. package/dist/components/primitives/baht-input.d.ts +10 -0
  88. package/dist/components/primitives/baht-input.js +44 -0
  89. package/dist/components/primitives/baht-keyvalue-editor.d.ts +28 -0
  90. package/dist/components/primitives/baht-keyvalue-editor.js +106 -0
  91. package/dist/components/primitives/baht-line-chart.d.ts +45 -0
  92. package/dist/components/primitives/baht-line-chart.js +183 -0
  93. package/dist/components/primitives/baht-link.d.ts +26 -0
  94. package/dist/components/primitives/baht-link.js +48 -0
  95. package/dist/components/primitives/baht-list.d.ts +29 -0
  96. package/dist/components/primitives/baht-list.js +79 -0
  97. package/dist/components/primitives/baht-loading-overlay.d.ts +15 -0
  98. package/dist/components/primitives/baht-loading-overlay.js +33 -0
  99. package/dist/components/primitives/baht-markdown-view.d.ts +17 -0
  100. package/dist/components/primitives/baht-markdown-view.js +39 -0
  101. package/dist/components/primitives/baht-markdown.d.ts +34 -0
  102. package/dist/components/primitives/baht-markdown.js +177 -0
  103. package/dist/components/primitives/baht-menu.d.ts +53 -0
  104. package/dist/components/primitives/baht-menu.js +100 -0
  105. package/dist/components/primitives/baht-meter.d.ts +67 -0
  106. package/dist/components/primitives/baht-meter.js +107 -0
  107. package/dist/components/primitives/baht-modal.d.ts +71 -0
  108. package/dist/components/primitives/baht-modal.js +164 -0
  109. package/dist/components/primitives/baht-multiselect.d.ts +8 -0
  110. package/dist/components/primitives/baht-multiselect.js +47 -0
  111. package/dist/components/primitives/baht-notification-bell.d.ts +54 -0
  112. package/dist/components/primitives/baht-notification-bell.js +143 -0
  113. package/dist/components/primitives/baht-number.d.ts +5 -0
  114. package/dist/components/primitives/baht-number.js +39 -0
  115. package/dist/components/primitives/baht-order-box.d.ts +24 -0
  116. package/dist/components/primitives/baht-order-box.js +50 -0
  117. package/dist/components/primitives/baht-otp.d.ts +49 -0
  118. package/dist/components/primitives/baht-otp.js +109 -0
  119. package/dist/components/primitives/baht-page-header.d.ts +43 -0
  120. package/dist/components/primitives/baht-page-header.js +78 -0
  121. package/dist/components/primitives/baht-pagination.d.ts +33 -0
  122. package/dist/components/primitives/baht-pagination.js +86 -0
  123. package/dist/components/primitives/baht-popover.d.ts +45 -0
  124. package/dist/components/primitives/baht-popover.js +112 -0
  125. package/dist/components/primitives/baht-progress-ring.d.ts +22 -0
  126. package/dist/components/primitives/baht-progress-ring.js +62 -0
  127. package/dist/components/primitives/baht-progress.d.ts +17 -0
  128. package/dist/components/primitives/baht-progress.js +48 -0
  129. package/dist/components/primitives/baht-radio.d.ts +7 -0
  130. package/dist/components/primitives/baht-radio.js +74 -0
  131. package/dist/components/primitives/baht-range.d.ts +38 -0
  132. package/dist/components/primitives/baht-range.js +88 -0
  133. package/dist/components/primitives/baht-rating.d.ts +40 -0
  134. package/dist/components/primitives/baht-rating.js +107 -0
  135. package/dist/components/primitives/baht-record-bar.d.ts +30 -0
  136. package/dist/components/primitives/baht-record-bar.js +60 -0
  137. package/dist/components/primitives/baht-reference-dialog.d.ts +87 -0
  138. package/dist/components/primitives/baht-reference-dialog.js +418 -0
  139. package/dist/components/primitives/baht-reference-picker.d.ts +110 -0
  140. package/dist/components/primitives/baht-reference-picker.js +321 -0
  141. package/dist/components/primitives/baht-repeater.d.ts +59 -0
  142. package/dist/components/primitives/baht-repeater.js +315 -0
  143. package/dist/components/primitives/baht-rule-builder.d.ts +24 -0
  144. package/dist/components/primitives/baht-rule-builder.js +177 -0
  145. package/dist/components/primitives/baht-saved-filters.d.ts +41 -0
  146. package/dist/components/primitives/baht-saved-filters.js +126 -0
  147. package/dist/components/primitives/baht-search.d.ts +34 -0
  148. package/dist/components/primitives/baht-search.js +71 -0
  149. package/dist/components/primitives/baht-section-header.d.ts +28 -0
  150. package/dist/components/primitives/baht-section-header.js +48 -0
  151. package/dist/components/primitives/baht-section.d.ts +23 -0
  152. package/dist/components/primitives/baht-section.js +49 -0
  153. package/dist/components/primitives/baht-select.d.ts +49 -0
  154. package/dist/components/primitives/baht-select.js +197 -0
  155. package/dist/components/primitives/baht-skeleton.d.ts +16 -0
  156. package/dist/components/primitives/baht-skeleton.js +37 -0
  157. package/dist/components/primitives/baht-sparkline.d.ts +23 -0
  158. package/dist/components/primitives/baht-sparkline.js +56 -0
  159. package/dist/components/primitives/baht-spinner.d.ts +13 -0
  160. package/dist/components/primitives/baht-spinner.js +30 -0
  161. package/dist/components/primitives/baht-split-button.d.ts +43 -0
  162. package/dist/components/primitives/baht-split-button.js +87 -0
  163. package/dist/components/primitives/baht-stat-chart.d.ts +14 -0
  164. package/dist/components/primitives/baht-stat-chart.js +38 -0
  165. package/dist/components/primitives/baht-stat.d.ts +56 -0
  166. package/dist/components/primitives/baht-stat.js +117 -0
  167. package/dist/components/primitives/baht-steps.d.ts +33 -0
  168. package/dist/components/primitives/baht-steps.js +60 -0
  169. package/dist/components/primitives/baht-swipe-row.d.ts +64 -0
  170. package/dist/components/primitives/baht-swipe-row.js +178 -0
  171. package/dist/components/primitives/baht-table.d.ts +315 -0
  172. package/dist/components/primitives/baht-table.js +640 -0
  173. package/dist/components/primitives/baht-tabs.d.ts +54 -0
  174. package/dist/components/primitives/baht-tabs.js +128 -0
  175. package/dist/components/primitives/baht-tags.d.ts +96 -0
  176. package/dist/components/primitives/baht-tags.js +323 -0
  177. package/dist/components/primitives/baht-text.d.ts +10 -0
  178. package/dist/components/primitives/baht-text.js +29 -0
  179. package/dist/components/primitives/baht-textarea.d.ts +5 -0
  180. package/dist/components/primitives/baht-textarea.js +40 -0
  181. package/dist/components/primitives/baht-theme-toggle.d.ts +44 -0
  182. package/dist/components/primitives/baht-theme-toggle.js +101 -0
  183. package/dist/components/primitives/baht-timeline.d.ts +21 -0
  184. package/dist/components/primitives/baht-timeline.js +42 -0
  185. package/dist/components/primitives/baht-toast.d.ts +29 -0
  186. package/dist/components/primitives/baht-toast.js +83 -0
  187. package/dist/components/primitives/baht-toggle.d.ts +6 -0
  188. package/dist/components/primitives/baht-toggle.js +42 -0
  189. package/dist/components/primitives/baht-tooltip.d.ts +34 -0
  190. package/dist/components/primitives/baht-tooltip.js +85 -0
  191. package/dist/components/primitives/baht-tree.d.ts +58 -0
  192. package/dist/components/primitives/baht-tree.js +159 -0
  193. package/dist/components/primitives/baht-typeahead.d.ts +92 -0
  194. package/dist/components/primitives/baht-typeahead.js +258 -0
  195. package/dist/components/primitives/baht-upload.d.ts +108 -0
  196. package/dist/components/primitives/baht-upload.js +325 -0
  197. package/dist/components/primitives/baht-wizard.d.ts +57 -0
  198. package/dist/components/primitives/baht-wizard.js +147 -0
  199. package/dist/components/primitives/charts.d.ts +134 -0
  200. package/dist/components/primitives/charts.js +184 -0
  201. package/dist/components/primitives/column-map.d.ts +56 -0
  202. package/dist/components/primitives/column-map.js +70 -0
  203. package/dist/components/primitives/control-icons.d.ts +2 -0
  204. package/dist/components/primitives/control-icons.js +40 -0
  205. package/dist/components/primitives/icons.d.ts +24 -0
  206. package/dist/components/primitives/icons.js +86 -0
  207. package/dist/components/primitives/illustrations.d.ts +21 -0
  208. package/dist/components/primitives/illustrations.js +78 -0
  209. package/dist/components/primitives/index.d.ts +89 -0
  210. package/dist/components/primitives/kbd.d.ts +6 -0
  211. package/dist/components/primitives/kbd.js +9 -0
  212. package/dist/components/primitives/listbox.d.ts +2 -0
  213. package/dist/components/primitives/listbox.js +7 -0
  214. package/dist/components/primitives/markdown-render.d.ts +9 -0
  215. package/dist/components/primitives/markdown-render.js +77 -0
  216. package/dist/components/primitives/rule-rows.d.ts +55 -0
  217. package/dist/components/primitives/rule-rows.js +75 -0
  218. package/dist/components/primitives/tag-map.d.ts +6 -0
  219. package/dist/components/primitives/tag-map.js +39 -0
  220. package/dist/components/reference-labels.d.ts +22 -0
  221. package/dist/components/reference-labels.js +29 -0
  222. package/dist/components/shortcuts.d.ts +7 -0
  223. package/dist/components/shortcuts.js +43 -0
  224. package/dist/css/components.css +7517 -0
  225. package/dist/css/datepicker.css +346 -0
  226. package/dist/css/tokens.css +679 -0
  227. package/dist/custom-elements.json +45110 -0
  228. package/dist/engine.d.ts +1 -0
  229. package/dist/engine.js +1 -0
  230. package/dist/hydrate.d.ts +9 -0
  231. package/dist/hydrate.js +46 -0
  232. package/dist/index.d.ts +7 -0
  233. package/dist/index.js +210 -0
  234. package/dist/overlay.d.ts +50 -0
  235. package/dist/overlay.js +140 -0
  236. package/dist/react.d.ts +557 -0
  237. package/dist/react.js +1 -0
  238. package/dist/register.d.ts +106 -0
  239. package/dist/register.js +99 -0
  240. package/dist/ssr.d.ts +16 -0
  241. package/dist/ssr.js +125 -0
  242. package/dist/tokens.css +8197 -0
  243. package/dist/vscode.css-custom-data.json +6 -0
  244. package/dist/vscode.html-custom-data.json +2261 -0
  245. package/dist/web-types.json +6523 -0
  246. package/package.json +157 -4
@@ -0,0 +1,640 @@
1
+ import { html as a, nothing as c } from "lit";
2
+ import { property as n, state as g } from "lit/decorators.js";
3
+ import { boolOff as m, BahtElement as P, hasDom as O, hasSsrMarkup as F, stringOf as f } from "../base.js";
4
+ import { t as p } from "@20baht/engine";
5
+ import { renderIcon as d } from "./icons.js";
6
+ import { completeFilter as k, conditionText as x } from "./baht-filter-builder.js";
7
+ import { titleCase as $, specAt as S, labelAt as A, filterFieldsOf as B, valueAt as w, cellText as T, cellTone as G, cellBusy as M } from "./column-map.js";
8
+ import "./baht-badge.js";
9
+ import "./baht-code.js";
10
+ import "./baht-column-picker.js";
11
+ import "./baht-menu.js";
12
+ import "./baht-pagination.js";
13
+ import "./baht-saved-filters.js";
14
+ import { customElement as K } from "../define.js";
15
+ var R = Object.defineProperty, I = Object.getOwnPropertyDescriptor, o = (t, e, s, i) => {
16
+ for (var r = i > 1 ? void 0 : i ? I(e, s) : e, h = t.length - 1, b; h >= 0; h--)
17
+ (b = t[h]) && (r = (i ? b(e, s, r) : b(r)) || r);
18
+ return i && r && R(e, s, r), r;
19
+ };
20
+ const v = { match: "all", conditions: [] }, C = (t) => t !== null && typeof t == "object" && !Array.isArray(t) && !(t instanceof Date);
21
+ let l = class extends P {
22
+ constructor() {
23
+ super(...arguments), this.items = [], this.columns = {}, this.loading = !1, this.error = !1, this.errorMessage = "Couldn't load data. Try again.", this.emptyMessage = "No records yet.", this.showIndex = !0, this.indexOffset = 0, this.skeletonRows = 10, this.rowKey = "", this.clickable = !0, this.renderers = {}, this.visibleColumns = [], this.groupCollapsible = !0, this.groupCollapsed = !1, this.hideHeader = !1, this.columnPicker = !0, this.variant = "default", this.selectable = !1, this.selected = [], this.sortable = !1, this.sort = null, this.filterable = !1, this.filter = v, this.savedFilters = null, this.rowActions = !1, this.rowMenu = null, this.page = 1, this.totalPages = 1, this.alwaysPaginate = !1, this.cursorMode = !1, this.hasNext = !1, this.hasPrev = !1, this.pickerOpen = !1, this.pickedColumns = null, this.filterOpen = !1, this.draftFilter = v, this.toggledGroups = [], this.emptySlot = null, this.derivedSpec = null, this.onOpenPicker = () => {
24
+ this.pickerOpen = !0;
25
+ }, this.onClosePicker = (t) => {
26
+ t.stopPropagation(), this.pickerOpen = !1;
27
+ }, this.onSavedFilterPick = (t) => {
28
+ t.stopPropagation(), this.applyFilter(t.detail.value);
29
+ }, this.onSavedFiltersChange = (t) => {
30
+ t.stopPropagation(), this.savedFilters = t.detail.filters, this.emit("baht-saved-filters-change", { filters: t.detail.filters });
31
+ }, this.onPageChange = (t) => {
32
+ t.stopPropagation(), this.emit("baht-page-change", { page: t.detail.page });
33
+ }, this.onCursorChange = (t) => {
34
+ t.stopPropagation(), this.emit("baht-cursor-change", { direction: t.detail.direction });
35
+ }, this.onToggleFilterPanel = () => {
36
+ this.filterOpen = !this.filterOpen;
37
+ };
38
+ }
39
+ /** The picker is its own element: done means done rendering it too. */
40
+ async getUpdateComplete() {
41
+ var e, s, i;
42
+ const t = await super.getUpdateComplete();
43
+ return await ((e = this.querySelector("baht-column-picker")) == null ? void 0 : e.updateComplete), await ((s = this.querySelector("baht-filter-builder")) == null ? void 0 : s.updateComplete), await ((i = this.querySelector("baht-saved-filters")) == null ? void 0 : i.updateComplete), t;
44
+ }
45
+ willUpdate(t) {
46
+ this.emptySlot = this.findEmptySlot(), t.has("visibleColumns") && (this.pickedColumns = null), t.has("filter") && (this.draftFilter = this.filter), (t.has("items") || t.has("page") || t.has("groupBy") || t.has("groupCollapsed")) && this.toggledGroups.length > 0 && (this.toggledGroups = []);
47
+ }
48
+ /**
49
+ * A `data-slot="empty"` child of the host, else the one already taken unless the host removed
50
+ * it. None during a server render or the hydrating render, so both match the server's markup.
51
+ */
52
+ findEmptySlot() {
53
+ if (!O() || F(this)) return null;
54
+ const t = Array.from(this.children).find(
55
+ (e) => e instanceof HTMLElement && e.dataset.slot === "empty"
56
+ );
57
+ return t || (this.emptySlot && this.contains(this.emptySlot) ? this.emptySlot : null);
58
+ }
59
+ /** The empty row went away with the slot inside it: park the slot back in the host. */
60
+ updated() {
61
+ const t = this.emptySlot;
62
+ t && !this.contains(t) && this.insertBefore(t, this.firstChild);
63
+ }
64
+ // ---- column model ----------------------------------------------------
65
+ /** The declared map, or one derived from the first row (nested objects become reference columns). */
66
+ get spec() {
67
+ var s;
68
+ if (Object.keys(this.columns).length > 0) return this.columns;
69
+ const t = this.items[0];
70
+ if (!t) return {};
71
+ if (((s = this.derivedSpec) == null ? void 0 : s.from) === t) return this.derivedSpec.spec;
72
+ const e = {};
73
+ for (const [i, r] of Object.entries(t))
74
+ e[i] = C(r) ? {
75
+ label: $(i),
76
+ fields: Object.fromEntries(Object.keys(r).map((h) => [h, $(h)]))
77
+ } : $(i);
78
+ return this.derivedSpec = { from: t, spec: e }, e;
79
+ }
80
+ specAt(t) {
81
+ return S(this.spec, t);
82
+ }
83
+ get allColumnKeys() {
84
+ return Object.keys(this.spec);
85
+ }
86
+ get columnKeys() {
87
+ return (this.pickedColumns ?? (this.visibleColumns.length > 0 ? this.visibleColumns : this.allColumnKeys)).filter((e) => this.specAt(e) !== void 0);
88
+ }
89
+ labelFor(t) {
90
+ return A(this.spec, t);
91
+ }
92
+ confirmPicker(t) {
93
+ this.pickedColumns = t.visibleColumns, this.emit("baht-columns-change", t);
94
+ }
95
+ // ---- filter -----------------------------------------------------------
96
+ get filterFields() {
97
+ return B(this.spec);
98
+ }
99
+ applyFilter(t) {
100
+ this.filter = t, this.emit("baht-filter-change", { value: t });
101
+ }
102
+ /** Run: a condition still waiting for its value is not applied. */
103
+ runFilter() {
104
+ this.applyFilter(k(this.draftFilter));
105
+ }
106
+ renderFilterToggle() {
107
+ const t = this.filter.conditions.length;
108
+ return a`<button
109
+ type="button"
110
+ class="baht-table-filter-toggle baht-button baht-button--ghost baht-button--sm"
111
+ aria-expanded=${this.filterOpen ? "true" : "false"}
112
+ @click=${this.onToggleFilterPanel}
113
+ >${d("filter")}<span>${p("refFilter")}${t ? ` (${String(t)})` : ""}</span></button>`;
114
+ }
115
+ renderFilterPanel() {
116
+ return a`<div class="baht-table-filter">
117
+ <baht-filter-builder
118
+ .fields=${this.filterFields}
119
+ .value=${this.draftFilter}
120
+ @baht-change=${(t) => {
121
+ t.stopPropagation(), this.draftFilter = t.detail.value;
122
+ }}
123
+ ></baht-filter-builder>
124
+ <div class="baht-table-filter-actions">
125
+ <button
126
+ type="button"
127
+ class="baht-table-filter-run baht-button baht-button--secondary baht-button--sm"
128
+ @click=${() => {
129
+ this.runFilter();
130
+ }}
131
+ >${p("refRun")}</button>
132
+ <button
133
+ type="button"
134
+ class="baht-table-filter-clear baht-button baht-button--ghost baht-button--sm"
135
+ @click=${() => {
136
+ this.applyFilter(v);
137
+ }}
138
+ >${p("refClearFilter")}</button>
139
+ ${this.savedFilters ? a`<baht-saved-filters
140
+ .filters=${this.savedFilters}
141
+ .current=${k(this.draftFilter)}
142
+ .fields=${this.filterFields}
143
+ @baht-filter-pick=${this.onSavedFilterPick}
144
+ @baht-saved-filters-change=${this.onSavedFiltersChange}
145
+ ></baht-saved-filters>` : c}
146
+ </div>
147
+ </div>`;
148
+ }
149
+ /** The applied conditions, each one removable (ServiceNow's breadcrumbs). */
150
+ renderFilterCrumbs() {
151
+ const { conditions: t, match: e } = this.filter;
152
+ if (t.length === 0) return c;
153
+ const s = this.filterFields, i = p(e === "any" ? "filterOr" : "filterAnd");
154
+ return a`<div class="baht-table-crumbs" role="group" aria-label=${p("refFilter")}>
155
+ ${t.map((r, h) => {
156
+ const b = x(r, s);
157
+ return a`${h > 0 ? a`<span class="baht-table-crumb-join">${i}</span>` : c}
158
+ <span class="baht-table-crumb">
159
+ <span>${b}</span>
160
+ <button
161
+ type="button"
162
+ aria-label=${p("filterRemove", { condition: b })}
163
+ @click=${() => {
164
+ this.applyFilter({
165
+ ...this.filter,
166
+ conditions: t.filter((u, y) => y !== h)
167
+ });
168
+ }}
169
+ >×</button>
170
+ </span>`;
171
+ })}
172
+ </div>`;
173
+ }
174
+ idOf(t) {
175
+ return this.rowKey ? t[this.rowKey] : void 0;
176
+ }
177
+ emitRow(t, e) {
178
+ this.clickable && this.emit("baht-row-click", { row: t, index: e, id: this.idOf(t) });
179
+ }
180
+ // ---- selection --------------------------------------------------------
181
+ /** Selection key of a row: its `rowKey` value, else its index on this page. */
182
+ keyOf(t, e) {
183
+ return this.rowKey ? t[this.rowKey] : e;
184
+ }
185
+ isSelected(t, e) {
186
+ return this.selected.includes(this.keyOf(t, e));
187
+ }
188
+ emitSelection(t) {
189
+ const e = this.items.filter((s, i) => t.includes(this.keyOf(s, i)));
190
+ this.emit("baht-selection-change", { selected: t, rows: e });
191
+ }
192
+ toggleRow(t, e) {
193
+ const s = this.keyOf(t, e), i = this.isSelected(t, e) ? this.selected.filter((r) => r !== s) : [...this.selected, s];
194
+ this.emitSelection(i);
195
+ }
196
+ get pageKeys() {
197
+ return this.items.map((t, e) => this.keyOf(t, e));
198
+ }
199
+ get allOnPageSelected() {
200
+ const t = this.pageKeys;
201
+ return t.length > 0 && t.every((e) => this.selected.includes(e));
202
+ }
203
+ get someOnPageSelected() {
204
+ return this.pageKeys.some((t) => this.selected.includes(t));
205
+ }
206
+ toggleAll() {
207
+ if (this.allOnPageSelected) {
208
+ const t = this.pageKeys;
209
+ this.emitSelection(this.selected.filter((e) => !t.includes(e)));
210
+ } else {
211
+ const t = this.pageKeys;
212
+ this.emitSelection([...this.selected.filter((e) => !t.includes(e)), ...t]);
213
+ }
214
+ }
215
+ // ---- sorting ----------------------------------------------------------
216
+ isSortable(t) {
217
+ var e;
218
+ return this.sortable || ((e = this.specAt(t)) == null ? void 0 : e.sortable) === !0;
219
+ }
220
+ requestSort(t) {
221
+ var s;
222
+ const e = ((s = this.sort) == null ? void 0 : s.key) === t && this.sort.direction === "asc" ? "desc" : "asc";
223
+ this.emit("baht-sort-change", { key: t, direction: e });
224
+ }
225
+ /** Alignment class for a column (explicit `align` beats `numeric`). */
226
+ alignClass(t) {
227
+ const e = this.specAt(t);
228
+ return e != null && e.align ? ` baht-table-align-${e.align}` : e != null && e.numeric ? " baht-table-numeric" : "";
229
+ }
230
+ cell(t, e) {
231
+ const s = this.renderers[e], i = w(t, e);
232
+ if (s) return s(i, t);
233
+ const r = C(i) ? i.name ?? i.label ?? i.title ?? i.id : i, h = this.specAt(e);
234
+ if (!h) return f(r);
235
+ if (h.empty !== void 0 && f(r) === "") return h.empty;
236
+ const b = T(h, r, t);
237
+ return b === "" || h.cell === void 0 || h.cell === "text" ? b : h.cell === "badge" ? a`<baht-badge
238
+ tone=${G(h, r, t)}
239
+ label=${b}
240
+ ?busy=${M(h, r, t)}
241
+ ></baht-badge>` : a`<baht-code code=${b}></baht-code>`;
242
+ }
243
+ span(t) {
244
+ return t.length + (this.hasIndex ? 1 : 0) + (this.selectable ? 1 : 0) + (this.hasActions ? 1 : 0);
245
+ }
246
+ groupValue(t) {
247
+ const e = this.groupBy;
248
+ return typeof e == "function" ? e(t) : w(t, e ?? "");
249
+ }
250
+ /** Stable identity of a group value for the collapsed set (objects by JSON, else by type+string). */
251
+ static groupId(t) {
252
+ if (t == null) return "nil";
253
+ if (typeof t == "object")
254
+ try {
255
+ return `o:${JSON.stringify(t)}`;
256
+ } catch {
257
+ return "o:?";
258
+ }
259
+ return `${typeof t}:${f(t)}`;
260
+ }
261
+ /**
262
+ * The page's rows bucketed by group value, in first-appearance order. Each
263
+ * row keeps its page index so numbering and event indexes stay host-order.
264
+ */
265
+ get groups() {
266
+ const t = /* @__PURE__ */ new Map();
267
+ return this.items.forEach((e, s) => {
268
+ const i = this.groupValue(e), r = l.groupId(i), h = t.get(r);
269
+ h ? h.rows.push({ row: e, index: s }) : t.set(r, { id: r, value: i, rows: [{ row: e, index: s }] });
270
+ }), Array.from(t.values());
271
+ }
272
+ get isGrouped() {
273
+ return !!this.groupBy && !this.loading && !this.error && this.items.length > 0;
274
+ }
275
+ isCollapsed(t) {
276
+ if (!this.groupCollapsible) return !1;
277
+ const e = this.toggledGroups.includes(t);
278
+ return this.groupCollapsed ? !e : e;
279
+ }
280
+ toggleGroup(t, e) {
281
+ this.toggledGroups = this.toggledGroups.includes(t) ? this.toggledGroups.filter((s) => s !== t) : [...this.toggledGroups, t], this.emit("baht-group-toggle", {
282
+ value: e,
283
+ collapsed: this.isCollapsed(t)
284
+ });
285
+ }
286
+ /** Default header: "Column: value (n)" — no column prefix for a function key. */
287
+ defaultGroupLabel(t, e) {
288
+ const s = t == null || t === "" ? p("emptyValue") : f(t), i = typeof this.groupBy == "string" ? `${this.labelFor(this.groupBy)}: ` : "";
289
+ return a`<span class="baht-table-group-label">${i}${s}</span>
290
+ <span class="baht-table-group-count">(${e})</span>`;
291
+ }
292
+ renderGroups(t) {
293
+ const e = this.span(t);
294
+ return a`${this.groups.map((s) => {
295
+ const i = s.rows.map((u) => u.row), r = this.isCollapsed(s.id), h = this.groupLabel ? this.groupLabel(s.value, i) : this.defaultGroupLabel(s.value, i.length), b = this.groupCollapsible ? a`<button
296
+ type="button"
297
+ class="baht-table-group-toggle"
298
+ aria-expanded=${r ? "false" : "true"}
299
+ @click=${() => {
300
+ this.toggleGroup(s.id, s.value);
301
+ }}
302
+ >${d(r ? "chevron-right" : "chevron-down")}<span class="baht-table-group-text">${h}</span></button>` : a`<span class="baht-table-group-text">${h}</span>`;
303
+ return a`<tbody class="baht-table-group${r ? " baht-table-group--collapsed" : ""}">
304
+ <tr class="baht-table-group-row">
305
+ <th scope="rowgroup" colspan=${e} class="baht-table-group-head">${b}</th>
306
+ </tr>
307
+ ${r ? c : s.rows.map(({ row: u, index: y }) => this.renderRow(u, y, t))}
308
+ </tbody>`;
309
+ })}`;
310
+ }
311
+ renderBody(t) {
312
+ const e = this.span(t);
313
+ return this.loading ? a`${Array.from(
314
+ { length: this.skeletonRows },
315
+ (s, i) => a`<tr class="baht-table-row">
316
+ ${this.selectable ? a`<td class="baht-table-select"></td>` : c}
317
+ ${this.hasIndex ? a`<td class="baht-table-index">${this.indexOffset + i + 1}</td>` : c}
318
+ ${t.map(() => a`<td><span class="baht-skeleton" style="height:16px;"></span></td>`)}
319
+ ${this.hasActions ? a`<td class="baht-table-actions"></td>` : c}
320
+ </tr>`
321
+ )}` : this.error ? a`<tr><td colspan=${e}><div class="baht-table-state baht-table-state--error" role="alert">${this.errorMessage}</div></td></tr>` : this.items.length === 0 ? a`<tr><td colspan=${e}><div class="baht-table-state">${this.emptySlot ?? this.emptyMessage}</div></td></tr>` : a`${this.items.map((s, i) => this.renderRow(s, i, t))}`;
322
+ }
323
+ renderRow(t, e, s) {
324
+ const i = this.selectable && this.isSelected(t, e);
325
+ return a`<tr
326
+ class="baht-table-row${i ? " baht-table-row--selected" : ""}"
327
+ aria-selected=${this.selectable ? i ? "true" : "false" : c}
328
+ tabindex=${this.clickable ? "0" : c}
329
+ @click=${() => {
330
+ this.emitRow(t, e);
331
+ }}
332
+ @keydown=${(r) => {
333
+ r.key !== "Enter" && r.key !== " " || r.target === r.currentTarget && (r.preventDefault(), this.emitRow(t, e));
334
+ }}
335
+ >
336
+ ${this.selectable ? a`<td class="baht-table-select">
337
+ <input
338
+ type="checkbox"
339
+ aria-label=${p("selectRow", { n: this.indexOffset + e + 1 })}
340
+ .checked=${i}
341
+ @click=${(r) => {
342
+ r.stopPropagation(), this.toggleRow(t, e);
343
+ }}
344
+ />
345
+ </td>` : c}
346
+ ${this.hasIndex ? a`<td class="baht-table-index">${this.indexOffset + e + 1}</td>` : c}
347
+ ${s.map(
348
+ (r) => a`<td data-col=${r} class="baht-table-cell${this.alignClass(r)}">${this.cell(t, r)}</td>`
349
+ )}
350
+ ${this.renderActions(t, e)}
351
+ </tr>`;
352
+ }
353
+ /** The "No." column is on: `show-index`, unless the table is plain. */
354
+ get hasIndex() {
355
+ return this.showIndex && this.variant !== "plain";
356
+ }
357
+ /** The "Columns" button is on: `column-picker`, unless the table is plain. */
358
+ get hasPicker() {
359
+ return this.columnPicker && this.variant !== "plain";
360
+ }
361
+ /** Has a trailing actions column: the `row-actions` button or a `rowMenu`. */
362
+ get hasActions() {
363
+ return this.rowActions || this.rowMenu !== null;
364
+ }
365
+ renderActions(t, e) {
366
+ const s = this.rowMenu;
367
+ if (s) {
368
+ const i = typeof s == "function" ? s(t, e) : s;
369
+ return a`<td
370
+ class="baht-table-actions"
371
+ @click=${(r) => {
372
+ r.stopPropagation();
373
+ }}
374
+ >
375
+ ${i.length > 0 ? a`<baht-menu
376
+ size="sm"
377
+ label=${p("rowActions")}
378
+ .items=${i}
379
+ @baht-select=${(r) => {
380
+ r.stopPropagation(), this.emit("baht-row-menu-select", {
381
+ value: r.detail.value,
382
+ item: r.detail.item,
383
+ row: t,
384
+ index: e,
385
+ id: this.idOf(t)
386
+ });
387
+ }}
388
+ ></baht-menu>` : c}
389
+ </td>`;
390
+ }
391
+ return this.rowActions ? a`<td class="baht-table-actions">
392
+ <button
393
+ type="button"
394
+ class="baht-table-actions-btn baht-button baht-button--ghost baht-button--icon baht-button--sm"
395
+ aria-label=${p("rowActions")}
396
+ @click=${(i) => {
397
+ i.stopPropagation(), this.emit("baht-row-actions", { row: t, index: e, id: this.idOf(t) });
398
+ }}
399
+ >${d("more")}</button>
400
+ </td>` : c;
401
+ }
402
+ renderHeaderCell(t) {
403
+ var u;
404
+ const e = this.labelFor(t), s = ((u = this.sort) == null ? void 0 : u.key) === t ? this.sort.direction : null, i = s === "asc" ? "ascending" : s === "desc" ? "descending" : c, h = `baht-table-cell${t.includes(".") ? " baht-table-cell--walked" : ""}${this.alignClass(t)}`;
405
+ if (!this.isSortable(t))
406
+ return a`<th scope="col" data-col=${t} class=${h}>${e}</th>`;
407
+ const b = s === "asc" ? "chevron-up" : s === "desc" ? "chevron-down" : "sort";
408
+ return a`<th scope="col" data-col=${t} class=${h} aria-sort=${i}>
409
+ <button
410
+ type="button"
411
+ class="baht-table-sort${s ? " baht-table-sort--active" : ""}"
412
+ aria-label=${p("sortBy", { label: e })}
413
+ @click=${() => {
414
+ this.requestSort(t);
415
+ }}
416
+ >
417
+ <span>${e}</span>${d(b)}
418
+ </button>
419
+ </th>`;
420
+ }
421
+ get hasToolbar() {
422
+ return this.total !== void 0 || this.hasPicker || this.filterable;
423
+ }
424
+ renderToolbar() {
425
+ return a`<div class="baht-table-toolbar">
426
+ <div class="baht-table-toolbar-start">
427
+ ${this.filterable ? this.renderFilterToggle() : c}
428
+ ${this.total !== void 0 ? a`<span class="baht-table-count">${p("results", { n: this.total })}</span>` : c}
429
+ </div>
430
+ <div class="baht-table-toolbar-end">
431
+ ${this.hasPicker ? this.renderColumnToggle() : c}
432
+ </div>
433
+ </div>`;
434
+ }
435
+ renderColumnToggle() {
436
+ return a`<button
437
+ type="button"
438
+ class="baht-table-picker-toggle baht-button baht-button--ghost baht-button--icon baht-button--sm"
439
+ aria-label=${p("columns")}
440
+ title=${p("columns")}
441
+ aria-haspopup="dialog"
442
+ aria-expanded=${this.pickerOpen ? "true" : "false"}
443
+ @click=${this.onOpenPicker}
444
+ >${d("columns")}</button>`;
445
+ }
446
+ render() {
447
+ const t = this.columnKeys;
448
+ return a`<div
449
+ class="baht-table-wrap"
450
+ tabindex=${this.clickable ? c : "0"}
451
+ aria-busy=${this.loading ? "true" : c}
452
+ >
453
+ ${this.hasToolbar ? this.renderToolbar() : c}
454
+ ${this.filterable && this.filterOpen ? this.renderFilterPanel() : c}
455
+ ${this.filterable ? this.renderFilterCrumbs() : c}
456
+ ${this.hasPicker && this.pickerOpen ? a`<baht-column-picker
457
+ .open=${!0}
458
+ .columns=${this.spec}
459
+ .selected=${t}
460
+ @baht-close=${this.onClosePicker}
461
+ @baht-columns-change=${(e) => {
462
+ e.stopPropagation(), this.confirmPicker(e.detail);
463
+ }}
464
+ ></baht-column-picker>` : c}
465
+ <table class="baht-table">
466
+ ${this.hideHeader ? c : this.renderHead(t)}
467
+ ${this.isGrouped ? this.renderGroups(t) : a`<tbody>${this.renderBody(t)}</tbody>`}
468
+ </table>
469
+ ${this.renderFooter()}
470
+ </div>`;
471
+ }
472
+ renderHead(t) {
473
+ return a`<thead>
474
+ <tr>
475
+ ${this.selectable ? a`<th scope="col" class="baht-table-select">
476
+ <input
477
+ type="checkbox"
478
+ aria-label=${p("selectAll")}
479
+ .checked=${this.allOnPageSelected}
480
+ .indeterminate=${!this.allOnPageSelected && this.someOnPageSelected}
481
+ @click=${() => {
482
+ this.toggleAll();
483
+ }}
484
+ />
485
+ </th>` : c}
486
+ ${this.hasIndex ? a`<th scope="col" class="baht-table-index">${p("rowNumber")}</th>` : c}
487
+ ${t.map((e) => this.renderHeaderCell(e))}
488
+ ${this.hasActions ? a`<th scope="col" class="baht-table-actions">
489
+ <span class="baht-visually-hidden">${p("rowActions")}</span>
490
+ </th>` : c}
491
+ </tr>
492
+ </thead>`;
493
+ }
494
+ renderFooter() {
495
+ return a`${this.cursorMode ? a`<div class="baht-table-footer">
496
+ <baht-pagination
497
+ variant="cursor"
498
+ ?has-next=${this.hasNext}
499
+ ?has-prev=${this.hasPrev}
500
+ @baht-cursor-change=${this.onCursorChange}
501
+ ></baht-pagination>
502
+ </div>` : this.totalPages > 1 || this.alwaysPaginate ? a`<div class="baht-table-footer">
503
+ <baht-pagination
504
+ variant="compact"
505
+ page=${this.page}
506
+ total-pages=${this.totalPages}
507
+ @baht-page-change=${this.onPageChange}
508
+ ></baht-pagination>
509
+ </div>` : c}`;
510
+ }
511
+ };
512
+ o([
513
+ n({ attribute: !1 })
514
+ ], l.prototype, "items", 2);
515
+ o([
516
+ n({ attribute: !1 })
517
+ ], l.prototype, "columns", 2);
518
+ o([
519
+ n({ type: Boolean })
520
+ ], l.prototype, "loading", 2);
521
+ o([
522
+ n({ type: Boolean })
523
+ ], l.prototype, "error", 2);
524
+ o([
525
+ n({ attribute: "error-message" })
526
+ ], l.prototype, "errorMessage", 2);
527
+ o([
528
+ n({ attribute: "empty-message" })
529
+ ], l.prototype, "emptyMessage", 2);
530
+ o([
531
+ n({ attribute: "show-index", converter: m })
532
+ ], l.prototype, "showIndex", 2);
533
+ o([
534
+ n({ type: Number, attribute: "index-offset" })
535
+ ], l.prototype, "indexOffset", 2);
536
+ o([
537
+ n({ type: Number, attribute: "skeleton-rows" })
538
+ ], l.prototype, "skeletonRows", 2);
539
+ o([
540
+ n({ attribute: "row-key" })
541
+ ], l.prototype, "rowKey", 2);
542
+ o([
543
+ n({ converter: m })
544
+ ], l.prototype, "clickable", 2);
545
+ o([
546
+ n({ attribute: !1 })
547
+ ], l.prototype, "renderers", 2);
548
+ o([
549
+ n({ attribute: !1 })
550
+ ], l.prototype, "visibleColumns", 2);
551
+ o([
552
+ n({ attribute: "group-by" })
553
+ ], l.prototype, "groupBy", 2);
554
+ o([
555
+ n({ attribute: !1 })
556
+ ], l.prototype, "groupLabel", 2);
557
+ o([
558
+ n({ attribute: "group-collapsible", converter: m })
559
+ ], l.prototype, "groupCollapsible", 2);
560
+ o([
561
+ n({ type: Boolean, attribute: "group-collapsed" })
562
+ ], l.prototype, "groupCollapsed", 2);
563
+ o([
564
+ n({ type: Boolean, attribute: "hide-header" })
565
+ ], l.prototype, "hideHeader", 2);
566
+ o([
567
+ n({ attribute: "column-picker", converter: m })
568
+ ], l.prototype, "columnPicker", 2);
569
+ o([
570
+ n()
571
+ ], l.prototype, "variant", 2);
572
+ o([
573
+ n({ type: Number })
574
+ ], l.prototype, "total", 2);
575
+ o([
576
+ n({ type: Boolean })
577
+ ], l.prototype, "selectable", 2);
578
+ o([
579
+ n({ attribute: !1 })
580
+ ], l.prototype, "selected", 2);
581
+ o([
582
+ n({ type: Boolean })
583
+ ], l.prototype, "sortable", 2);
584
+ o([
585
+ n({ attribute: !1 })
586
+ ], l.prototype, "sort", 2);
587
+ o([
588
+ n({ type: Boolean })
589
+ ], l.prototype, "filterable", 2);
590
+ o([
591
+ n({ attribute: !1 })
592
+ ], l.prototype, "filter", 2);
593
+ o([
594
+ n({ attribute: !1 })
595
+ ], l.prototype, "savedFilters", 2);
596
+ o([
597
+ n({ type: Boolean, attribute: "row-actions" })
598
+ ], l.prototype, "rowActions", 2);
599
+ o([
600
+ n({ attribute: !1 })
601
+ ], l.prototype, "rowMenu", 2);
602
+ o([
603
+ n({ type: Number })
604
+ ], l.prototype, "page", 2);
605
+ o([
606
+ n({ type: Number, attribute: "total-pages" })
607
+ ], l.prototype, "totalPages", 2);
608
+ o([
609
+ n({ type: Boolean, attribute: "always-paginate" })
610
+ ], l.prototype, "alwaysPaginate", 2);
611
+ o([
612
+ n({ type: Boolean, attribute: "cursor-mode" })
613
+ ], l.prototype, "cursorMode", 2);
614
+ o([
615
+ n({ type: Boolean, attribute: "has-next" })
616
+ ], l.prototype, "hasNext", 2);
617
+ o([
618
+ n({ type: Boolean, attribute: "has-prev" })
619
+ ], l.prototype, "hasPrev", 2);
620
+ o([
621
+ g()
622
+ ], l.prototype, "pickerOpen", 2);
623
+ o([
624
+ g()
625
+ ], l.prototype, "pickedColumns", 2);
626
+ o([
627
+ g()
628
+ ], l.prototype, "filterOpen", 2);
629
+ o([
630
+ g()
631
+ ], l.prototype, "draftFilter", 2);
632
+ o([
633
+ g()
634
+ ], l.prototype, "toggledGroups", 2);
635
+ l = o([
636
+ K("baht-table")
637
+ ], l);
638
+ export {
639
+ l as BahtTable
640
+ };
@@ -0,0 +1,54 @@
1
+ import { TemplateResult } from 'lit';
2
+ import { BahtElement } from '../base.js';
3
+ /** One tab of `<baht-tabs>`; its panel is the child with `data-tab="<key>"`. */
4
+ export interface TabItem {
5
+ key: string;
6
+ label: string;
7
+ disabled?: boolean;
8
+ /** Short count or tag shown after the label ("3", "New"). */
9
+ badge?: string;
10
+ }
11
+ /**
12
+ * Tabs (APG tab pattern). The tab strip comes from `tabs`; the panels are your own children,
13
+ * matched by `data-tab="<key>"` — they get `role="tabpanel"`, ids and `hidden` for you. A hidden
14
+ * panel also gets an inline `display: none !important`, so page CSS that gives panels a `display`
15
+ * (`.panel { display: flex }`) never shows two at once.
16
+ *
17
+ * <baht-tabs label="Ticket">
18
+ * <section data-tab="details">…</section>
19
+ * <section data-tab="history">…</section>
20
+ * </baht-tabs>
21
+ * el.tabs = [{ key: 'details', label: 'Details' }, { key: 'history', label: 'History', badge: '3' }];
22
+ * el.addEventListener('baht-change', (e) => (location.hash = e.detail.value));
23
+ *
24
+ * `value` is the selected key (the first enabled tab when unset or unknown). Keyboard: ←/→
25
+ * move between tabs (wrapping, skipping disabled), Home/End jump; with `activation="manual"`
26
+ * the arrows only move focus and Enter/Space selects. Only the selected tab is in the Tab order.
27
+ *
28
+ * @fires {CustomEvent<{ value: string }>} baht-change - The user selected a tab. `detail: { value }`. Setting `value` does not fire it.
29
+ */
30
+ export declare class BahtTabs extends BahtElement {
31
+ /** The tab strip. Set as a property: `el.tabs = [...]`. */
32
+ tabs: TabItem[];
33
+ /** Selected tab key. */
34
+ value: string;
35
+ /** Accessible name of the tab list. */
36
+ label: string;
37
+ /** `automatic` (default): arrows select. `manual`: arrows focus, Enter/Space selects. */
38
+ activation: 'automatic' | 'manual';
39
+ /** `line` (default): an underline strip. `pill`: rounded chips; the active fill is `--baht-tabs-pill-active`. */
40
+ variant: 'line' | 'pill';
41
+ private panelKeys;
42
+ private panelsEl;
43
+ private tabId;
44
+ private panelId;
45
+ /** The tab actually shown: `value` when it names an enabled tab, else the first enabled one. */
46
+ get selected(): string;
47
+ protected firstUpdated(): void;
48
+ protected adoptChildren(): void;
49
+ private syncPanels;
50
+ private select;
51
+ private focusTab;
52
+ private readonly onKeydown;
53
+ protected render(): TemplateResult;
54
+ }