@20baht/ui 0.0.0-stage → 0.1.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.
Files changed (246) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +512 -2
  3. package/dist/components/baht-form.d.ts +206 -0
  4. package/dist/components/baht-form.js +630 -0
  5. package/dist/components/baht-workflow.d.ts +187 -0
  6. package/dist/components/baht-workflow.js +455 -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 +45172 -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,89 @@
1
+ export { BahtButton, type ButtonVariant, type ButtonSize } from './baht-button.js';
2
+ export { renderIcon, isIconName, type IconName } from './icons.js';
3
+ export { BahtBadge, type BadgeTone } from './baht-badge.js';
4
+ export { BahtAvatar, type AvatarSize } from './baht-avatar.js';
5
+ export { BahtCode, type CodeVariant } from './baht-code.js';
6
+ export { BahtTable, type CellFn, type CellKind, type CellRenderer, type ColumnAlign, type ColumnMap, type ColumnSpec, type ColumnsChangeDetail, type GroupKey, type GroupLabelRenderer, type GroupToggleDetail, type RowMenuSelectDetail, type RowMenu, type SortDirection, type SortState, type TableVariant, } from './baht-table.js';
7
+ export { BahtList, type ListItem } from './baht-list.js';
8
+ export { BahtPagination } from './baht-pagination.js';
9
+ export { BahtModal, type ModalPlacement, type ModalSize } from './baht-modal.js';
10
+ export { BahtToast, type ToastOptions } from './baht-toast.js';
11
+ export { BahtTooltip } from './baht-tooltip.js';
12
+ export { BahtThemeToggle, type ThemeName } from './baht-theme-toggle.js';
13
+ export { BahtSplitButton, type MenuItem } from './baht-split-button.js';
14
+ export { BahtMenu } from './baht-menu.js';
15
+ export { BahtTabs, type TabItem } from './baht-tabs.js';
16
+ export { BahtPopover, type PopoverPlacement } from './baht-popover.js';
17
+ export { BahtAlert } from './baht-alert.js';
18
+ export { BahtRating } from './baht-rating.js';
19
+ export { BahtRange } from './baht-range.js';
20
+ export { BahtOtp } from './baht-otp.js';
21
+ export { BahtFilter, type FilterVariant } from './baht-filter.js';
22
+ export { BahtSwipeRow, type SwipeAction } from './baht-swipe-row.js';
23
+ export { BahtSkeleton } from './baht-skeleton.js';
24
+ export { BahtProgress } from './baht-progress.js';
25
+ export { BahtProgressRing, type ProgressRingTone } from './baht-progress-ring.js';
26
+ export { BahtSpinner } from './baht-spinner.js';
27
+ export { BahtLoadingOverlay } from './baht-loading-overlay.js';
28
+ export { BahtCard, type CardAccent } from './baht-card.js';
29
+ export { BahtFieldset } from './baht-fieldset.js';
30
+ export { BahtTimeline, type TimelineItem } from './baht-timeline.js';
31
+ export { BahtAccordion, type AccordionItem } from './baht-accordion.js';
32
+ export { BahtTree, type TreeNode } from './baht-tree.js';
33
+ export { BahtCalendar, calendarRange, type CalendarEvent, type CalendarMark, type CalendarNavigateDetail, type CalendarTone, type CalendarView, } from './baht-calendar.js';
34
+ export { BahtLink } from './baht-link.js';
35
+ export { BahtBreadcrumbs, type Crumb } from './baht-breadcrumbs.js';
36
+ export { BahtInput } from './baht-input.js';
37
+ export { BahtTextarea } from './baht-textarea.js';
38
+ export { BahtMarkdown } from './baht-markdown.js';
39
+ export { BahtMarkdownView } from './baht-markdown-view.js';
40
+ export { BahtNumber } from './baht-number.js';
41
+ export { BahtCurrency } from './baht-currency.js';
42
+ export { BahtSelect } from './baht-select.js';
43
+ export { BahtMultiselect } from './baht-multiselect.js';
44
+ export { BahtTags } from './baht-tags.js';
45
+ export { BahtCheckbox } from './baht-checkbox.js';
46
+ export { BahtRadio } from './baht-radio.js';
47
+ export { BahtToggle } from './baht-toggle.js';
48
+ export { BahtDatepicker } from './baht-datepicker.js';
49
+ export { BahtFile } from './baht-file.js';
50
+ export { BahtUpload, type UploadChangeDetail, type UploadProgressDetail, type UploadErrorDetail, } from './baht-upload.js';
51
+ export { BahtText } from './baht-text.js';
52
+ export { BahtSection } from './baht-section.js';
53
+ export { BahtStatChart } from './baht-stat-chart.js';
54
+ export { BahtStat } from './baht-stat.js';
55
+ export { BahtSparkline } from './baht-sparkline.js';
56
+ export { BahtDonutChart } from './baht-donut-chart.js';
57
+ export { BahtBarChart } from './baht-bar-chart.js';
58
+ export { BahtLineChart } from './baht-line-chart.js';
59
+ export { BahtHeatmap } from './baht-heatmap.js';
60
+ export { BahtMeter, type MeterKind, type MeterThresholds } from './baht-meter.js';
61
+ export { BahtChartBase, chartColor, chartSeqColor, foldOther, formatValue, linearScale, niceTicks, niceRange, minTickStep, renderTableTwin, type ChartDatePoint, type ChartFormat, type ChartGroup, type ChartMarker, type ChartSeries, } from './charts.js';
62
+ export { BahtEmptyState } from './baht-empty-state.js';
63
+ export { BahtErrorState } from './baht-error-state.js';
64
+ export { BahtKeyvalueEditor } from './baht-keyvalue-editor.js';
65
+ export { BahtReferencePicker, type FieldReferenceLookup, type ReferenceOption, } from './baht-reference-picker.js';
66
+ export { BahtTypeahead, type TypeaheadOption } from './baht-typeahead.js';
67
+ export { BahtRepeater } from './baht-repeater.js';
68
+ export { BahtSteps } from './baht-steps.js';
69
+ export { TAG_FOR_TYPE } from './tag-map.js';
70
+ export { BahtComments, type CommentEntry } from './baht-comments.js';
71
+ export { BahtEditTable, type EditColumn, type EditRow } from './baht-edit-table.js';
72
+ export { BahtNotificationBell, type NotificationItem } from './baht-notification-bell.js';
73
+ export { BahtRuleBuilder } from './baht-rule-builder.js';
74
+ export { BahtAppShell, type ShellNavItem } from './baht-app-shell.js';
75
+ export { BahtApprovalChain, type ChainApprover, type ChainStep } from './baht-approval-chain.js';
76
+ export { BahtCatalogCard } from './baht-catalog-card.js';
77
+ export { BahtFilterBuilder, matchesFilter, type FilterCondition, type FilterField, type FilterOp, type FilterValue, } from './baht-filter-builder.js';
78
+ export { BahtOrderBox } from './baht-order-box.js';
79
+ export { BahtPageHeader } from './baht-page-header.js';
80
+ export { BahtSectionHeader } from './baht-section-header.js';
81
+ export { BahtFacts, type FactItem } from './baht-facts.js';
82
+ export { BahtChoiceGroup, type ChoiceOption } from './baht-choice-group.js';
83
+ export { BahtSearch } from './baht-search.js';
84
+ export { BahtRecordBar } from './baht-record-bar.js';
85
+ export { BahtWizard, type WizardStep } from './baht-wizard.js';
86
+ export { BahtReferenceDialog, pageOfRows } from './baht-reference-dialog.js';
87
+ export { BahtColumnPicker } from './baht-column-picker.js';
88
+ export { BahtSavedFilters } from './baht-saved-filters.js';
89
+ export { filterFieldsOf, valueAt } from './column-map.js';
@@ -0,0 +1,6 @@
1
+ import { nothing, TemplateResult } from 'lit';
2
+ /**
3
+ * `<kbd class="baht-kbd">⌥Q</kbd>` for a shortcut spec (`Alt+Q` off Mac); nothing when
4
+ * the spec does not parse. Shared by the button tooltip and menu item hints.
5
+ */
6
+ export declare function renderKbd(spec: string, mac: boolean): TemplateResult | typeof nothing;
@@ -0,0 +1,9 @@
1
+ import { nothing as n, html as m } from "lit";
2
+ import { formatShortcut as b } from "@20baht/engine";
3
+ function c(r, o) {
4
+ const t = b(r, { mac: o });
5
+ return t ? m`<kbd class="baht-kbd">${t}</kbd>` : n;
6
+ }
7
+ export {
8
+ c as renderKbd
9
+ };
@@ -0,0 +1,2 @@
1
+ /** Keep the active option of an open listbox in view. */
2
+ export declare function scrollOptionIntoView(host: Element, open: boolean, index: number, id: string): void;
@@ -0,0 +1,7 @@
1
+ function l(o, r, t, n) {
2
+ var e;
3
+ !r || t < 0 || (e = o.querySelector(`#${n}`)) == null || e.scrollIntoView({ block: "nearest" });
4
+ }
5
+ export {
6
+ l as scrollOptionIntoView
7
+ };
@@ -0,0 +1,9 @@
1
+ /** Which image URLs a markdown field may embed; any other image stays a link. */
2
+ export type MarkdownImagePolicy = (href: string) => boolean;
3
+ type Render = (source: string, allowImage: MarkdownImagePolicy | undefined) => string;
4
+ /**
5
+ * marked and dompurify are PEER dependencies loaded on demand, like flatpickr: an app
6
+ * without markdown fields never ships them. Resolves undefined when they are missing.
7
+ */
8
+ export declare const loadMarkdown: () => Promise<Render | undefined>;
9
+ export {};
@@ -0,0 +1,77 @@
1
+ import { isSafeUrl as s } from "@20baht/engine";
2
+ const c = [
3
+ "a",
4
+ "blockquote",
5
+ "br",
6
+ "code",
7
+ "del",
8
+ "em",
9
+ "h1",
10
+ "h2",
11
+ "h3",
12
+ "h4",
13
+ "h5",
14
+ "h6",
15
+ "hr",
16
+ "img",
17
+ "input",
18
+ "li",
19
+ "ol",
20
+ "p",
21
+ "pre",
22
+ "strong",
23
+ "table",
24
+ "tbody",
25
+ "td",
26
+ "th",
27
+ "thead",
28
+ "tr",
29
+ "ul"
30
+ ], d = [
31
+ "align",
32
+ "alt",
33
+ "checked",
34
+ "disabled",
35
+ "href",
36
+ "src",
37
+ "start",
38
+ "title",
39
+ "type"
40
+ ], a = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), i = (t) => {
41
+ try {
42
+ return new URL(t, location.href).origin === location.origin;
43
+ } catch {
44
+ return !1;
45
+ }
46
+ }, p = async () => {
47
+ const [{ Marked: t }, { default: n }] = await Promise.all([
48
+ import("marked"),
49
+ import("dompurify")
50
+ ]);
51
+ n.addHook("afterSanitizeAttributes", (e) => {
52
+ e.tagName === "A" && (e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"));
53
+ });
54
+ let o = i;
55
+ const l = new t({
56
+ gfm: !0,
57
+ // Text written before a field became markdown relies on its line breaks.
58
+ breaks: !0,
59
+ renderer: {
60
+ // Raw HTML in the source reads as the text it is.
61
+ html: ({ text: e }) => a(e),
62
+ // An image from elsewhere would report every reader to that host.
63
+ image: ({ href: e, text: r }) => s(e) && o(e) ? !1 : `<a href="${a(e)}">${a(r || e)}</a>`
64
+ }
65
+ });
66
+ return (e, r) => (o = r ?? i, n.sanitize(l.parse(e, { async: !1 }), {
67
+ ALLOWED_TAGS: c,
68
+ ALLOWED_ATTR: d
69
+ }));
70
+ };
71
+ let u;
72
+ const g = () => u ?? (u = p().catch((t) => {
73
+ console.warn("[bahtui] markdown needs the `marked` and `dompurify` peer dependencies", t);
74
+ }));
75
+ export {
76
+ g as loadMarkdown
77
+ };
@@ -0,0 +1,55 @@
1
+ import { ConditionOp, Rule, WorkflowDefinition } from '@20baht/engine';
2
+ /**
3
+ * The rules editor's flat view of a workflow rule — ServiceNow UI policies
4
+ * (show / hide / mandatory / read-only), simple "set value" client scripts,
5
+ * and the workflow "If" that skips an approval — as rows a form can edit.
6
+ * Conditions are one level: all or any of a list of field comparisons.
7
+ */
8
+ interface RuleCondition {
9
+ field: string;
10
+ op: ConditionOp;
11
+ value: string;
12
+ }
13
+ export type RuleAction = {
14
+ action: 'show' | 'hide' | 'required' | 'optional' | 'readonly';
15
+ field: string;
16
+ } | {
17
+ action: 'setValue';
18
+ field: string;
19
+ value: string;
20
+ } | {
21
+ action: 'skipForm';
22
+ form: string;
23
+ };
24
+ export interface RuleRow {
25
+ id: string;
26
+ match: 'all' | 'any';
27
+ conditions: RuleCondition[];
28
+ actions: RuleAction[];
29
+ /** Parts the editor cannot show (else-branches, nested conditions): kept as they were. */
30
+ extra?: {
31
+ else?: Rule['else'] | undefined;
32
+ priority?: number | undefined;
33
+ flag?: string | undefined;
34
+ };
35
+ /** Not representable at all: shown read-only and written back untouched. */
36
+ raw?: Rule;
37
+ }
38
+ export declare const CONDITION_OPS: readonly {
39
+ op: ConditionOp;
40
+ label: string;
41
+ needsValue: boolean;
42
+ }[];
43
+ export declare const ACTIONS: readonly {
44
+ action: RuleAction['action'];
45
+ label: string;
46
+ }[];
47
+ /** Every input field across the workflow, as `Form_Name.key` with a readable label. */
48
+ export declare const fieldChoices: (draft: WorkflowDefinition) => {
49
+ ref: string;
50
+ label: string;
51
+ type: string;
52
+ }[];
53
+ export declare const toRows: (rules: readonly Rule[]) => RuleRow[];
54
+ export declare const toRules: (rows: readonly RuleRow[], draft: WorkflowDefinition) => Rule[];
55
+ export {};
@@ -0,0 +1,75 @@
1
+ const y = /* @__PURE__ */ new Set(["label", "section"]), b = [
2
+ { op: "eq", label: "is", needsValue: !0 },
3
+ { op: "ne", label: "is not", needsValue: !0 },
4
+ { op: "in", label: "is one of", needsValue: !0 },
5
+ { op: "notIn", label: "is none of", needsValue: !0 },
6
+ { op: "contains", label: "contains", needsValue: !0 },
7
+ { op: "gt", label: ">", needsValue: !0 },
8
+ { op: "lt", label: "<", needsValue: !0 },
9
+ { op: "isEmpty", label: "is empty", needsValue: !1 },
10
+ { op: "isNotEmpty", label: "is not empty", needsValue: !1 }
11
+ ], S = [
12
+ { action: "show", label: "Show" },
13
+ { action: "hide", label: "Hide" },
14
+ { action: "required", label: "Make mandatory" },
15
+ { action: "optional", label: "Make optional" },
16
+ { action: "readonly", label: "Make read-only" },
17
+ { action: "setValue", label: "Set value of" },
18
+ { action: "skipForm", label: "Skip step" }
19
+ ], V = (e) => e.forms.flatMap(
20
+ (t) => t.fields.filter((n) => !y.has(n.type)).map((n) => ({
21
+ ref: `${t.form_name}.${n.key}`,
22
+ label: `${t.form_name.replace(/_/g, " ")} › ${n.label ?? n.key}`,
23
+ type: n.type
24
+ }))
25
+ ), u = (e) => "field" in e, m = (e) => Array.isArray(e) ? e.map((t) => JSON.stringify(t).replace(/^"|"$/g, "")).join(", ") : e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), h = (e) => e ? u(e) ? { match: "all", list: [e] } : "and" in e && e.and.every(u) ? { match: "all", list: e.and } : "or" in e && e.or.every(u) ? { match: "any", list: e.or } : null : { match: "all", list: [] }, k = (e) => e.action === "skipForm" ? { action: "skipForm", form: e.target.form } : e.action === "setValue" ? "const" in e.value ? {
26
+ action: "setValue",
27
+ field: `${e.target.form}.${e.target.field}`,
28
+ value: m(e.value.const)
29
+ } : null : ["show", "hide", "required", "optional", "readonly"].includes(e.action) && "field" in e.target ? {
30
+ action: e.action,
31
+ field: `${e.target.form}.${e.target.field}`
32
+ } : null, $ = (e) => e.map((t, n) => {
33
+ const i = t.id ?? `rule-${n + 1}`, o = h(t.when), s = (t.then ?? []).map(k);
34
+ return !o || s.some((a) => a === null) ? { id: i, match: "all", conditions: [], actions: [], raw: t } : {
35
+ id: i,
36
+ match: o.match,
37
+ conditions: o.list.map((a) => ({ field: a.field, op: a.op, value: m(a.value) })),
38
+ actions: s,
39
+ extra: { else: t.else, priority: t.priority, flag: t.flag }
40
+ };
41
+ }), d = (e, t) => t === "checkbox" || t === "toggle" ? e.trim().toLowerCase() === "true" : t === "number" || t === "currency" ? Number(e) : e, f = (e) => {
42
+ const t = e.indexOf(".");
43
+ return { form: e.slice(0, t), field: e.slice(t + 1) };
44
+ }, O = (e, t) => {
45
+ const n = new Map(V(t).map((i) => [i.ref, i.type]));
46
+ return e.map((i) => {
47
+ if (i.raw) return i.raw;
48
+ const o = i.conditions.map((l) => {
49
+ var p;
50
+ const g = l.op === "in" || l.op === "notIn" ? l.value.split(",").map((c) => d(c.trim(), n.get(l.field))) : d(l.value, n.get(l.field));
51
+ return ((p = b.find((c) => c.op === l.op)) == null ? void 0 : p.needsValue) === !1 ? { field: l.field, op: l.op } : { field: l.field, op: l.op, value: g };
52
+ }), s = o.length === 0 ? void 0 : o.length === 1 ? o[0] : i.match === "all" ? { and: o } : { or: o }, a = i.actions.map(
53
+ (l) => l.action === "skipForm" ? { action: "skipForm", target: { form: l.form } } : l.action === "setValue" ? {
54
+ action: "setValue",
55
+ target: f(l.field),
56
+ value: { const: d(l.value, n.get(l.field)) }
57
+ } : { action: l.action, target: f(l.field) }
58
+ ), r = i.extra ?? {};
59
+ return {
60
+ id: i.id,
61
+ ...s ? { when: s } : {},
62
+ then: a,
63
+ ...r.else ? { else: r.else } : {},
64
+ ...r.priority !== void 0 ? { priority: r.priority } : {},
65
+ ...r.flag ? { flag: r.flag } : {}
66
+ };
67
+ });
68
+ };
69
+ export {
70
+ S as ACTIONS,
71
+ b as CONDITION_OPS,
72
+ V as fieldChoices,
73
+ $ as toRows,
74
+ O as toRules
75
+ };
@@ -0,0 +1,6 @@
1
+ import { StaticValue } from 'lit/static-html.js';
2
+ import { FieldType } from '@20baht/engine';
3
+ export declare const TAG_FOR_TYPE: Record<FieldType, string>;
4
+ /** `field.width` -> layout class, shared by <baht-form> and <baht-repeater>. */
5
+ export declare const WIDTH_CLASS: Record<string, string>;
6
+ export declare function staticTag(tag: string): StaticValue;
@@ -0,0 +1,39 @@
1
+ import { unsafeStatic as b } from "lit/static-html.js";
2
+ const e = "baht-input", n = {
3
+ text: e,
4
+ email: e,
5
+ password: e,
6
+ textarea: "baht-textarea",
7
+ markdown: "baht-markdown",
8
+ number: "baht-number",
9
+ currency: "baht-currency",
10
+ dropdown: "baht-select",
11
+ multiselect: "baht-multiselect",
12
+ checkbox: "baht-checkbox",
13
+ radio: "baht-radio",
14
+ toggle: "baht-toggle",
15
+ date: "baht-datepicker",
16
+ time: e,
17
+ file: "baht-file",
18
+ label: "baht-text",
19
+ section: "baht-section",
20
+ repeater: "baht-repeater",
21
+ tags: "baht-tags",
22
+ rating: "baht-rating",
23
+ range: "baht-range",
24
+ reference: "baht-reference-picker"
25
+ }, c = {
26
+ "1/4": "baht-field--w-1-4",
27
+ "1/2": "baht-field--w-1-2",
28
+ "3/4": "baht-field--w-3-4",
29
+ full: "baht-field--w-full"
30
+ }, r = /* @__PURE__ */ new Map();
31
+ function i(a) {
32
+ let t = r.get(a);
33
+ return t || (t = b(a), r.set(a, t)), t;
34
+ }
35
+ export {
36
+ n as TAG_FOR_TYPE,
37
+ c as WIDTH_CLASS,
38
+ i as staticTag
39
+ };
@@ -0,0 +1,22 @@
1
+ import { ReferenceOption } from '@20baht/engine';
2
+ type Resolver = (id: string) => ReferenceOption | null | Promise<ReferenceOption | null>;
3
+ /**
4
+ * Labels of stored reference ids, shared by every place that shows one: the picker,
5
+ * the repeater's row table and the form's read-only view. Each id is resolved once.
6
+ * An id the lookup does not know, or a lookup that throws, is not asked for again on
7
+ * every render, and is not given up on for good either: it is retried after a pause.
8
+ */
9
+ export declare class ReferenceLabels {
10
+ private readonly onChange;
11
+ private readonly known;
12
+ private readonly pending;
13
+ private readonly missedAt;
14
+ /** `onChange` runs when a label arrives, so the owner can re-render. */
15
+ constructor(onChange: () => void);
16
+ get(key: string): string | undefined;
17
+ /** A label learnt some other way (the user picked the record). */
18
+ set(key: string, label: string): void;
19
+ /** Resolve `id` under `key` unless it is known, on its way, or missed a moment ago. */
20
+ request(key: string, id: string, resolve: Resolver): void;
21
+ }
22
+ export {};
@@ -0,0 +1,29 @@
1
+ class d {
2
+ /** `onChange` runs when a label arrives, so the owner can re-render. */
3
+ constructor(e) {
4
+ this.onChange = e, this.known = /* @__PURE__ */ new Map(), this.pending = /* @__PURE__ */ new Set(), this.missedAt = /* @__PURE__ */ new Map();
5
+ }
6
+ get(e) {
7
+ return this.known.get(e);
8
+ }
9
+ /** A label learnt some other way (the user picked the record). */
10
+ set(e, t) {
11
+ this.known.set(e, t), this.missedAt.delete(e), this.onChange();
12
+ }
13
+ /** Resolve `id` under `key` unless it is known, on its way, or missed a moment ago. */
14
+ request(e, t, i) {
15
+ if (this.known.has(e) || this.pending.has(e)) return;
16
+ const s = this.missedAt.get(e);
17
+ s !== void 0 && Date.now() - s < 3e4 || (this.pending.add(e), Promise.resolve().then(() => i(t)).then(
18
+ (n) => {
19
+ this.pending.delete(e), n ? this.set(e, n.label) : this.missedAt.set(e, Date.now());
20
+ },
21
+ () => {
22
+ this.pending.delete(e), this.missedAt.set(e, Date.now());
23
+ }
24
+ ));
25
+ }
26
+ }
27
+ export {
28
+ d as ReferenceLabels
29
+ };
@@ -0,0 +1,7 @@
1
+ /** Apple platform (⌘ = `mod`, ⌃⌥⇧⌘ glyphs). Client-only; `false` without a DOM. */
2
+ export declare function isMacPlatform(): boolean;
3
+ /**
4
+ * Bind `spec` for `host`; returns the unbind function. An unparseable spec binds nothing.
5
+ * Call from `connectedCallback`/`updated` and unbind on disconnect.
6
+ */
7
+ export declare function bindShortcut(host: HTMLElement, spec: string, run: () => void, enabled?: () => boolean): () => void;
@@ -0,0 +1,43 @@
1
+ import { parseShortcut as f, matchShortcut as u } from "@20baht/engine";
2
+ import { hasDom as d } from "./base.js";
3
+ import { topLayer as l } from "./layers.js";
4
+ const i = /* @__PURE__ */ new Set();
5
+ let o = !1;
6
+ function m() {
7
+ var t;
8
+ if (typeof navigator > "u") return !1;
9
+ const e = ((t = navigator.userAgentData) == null ? void 0 : t.platform) ?? // fallback where userAgentData is absent (Safari, Firefox)
10
+ navigator.platform;
11
+ return /mac|iphone|ipad|ipod/i.test(e || navigator.userAgent);
12
+ }
13
+ function p(e) {
14
+ return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? !0 : e instanceof HTMLInputElement ? !["button", "checkbox", "radio", "submit", "reset", "range", "color", "file"].includes(
15
+ e.type
16
+ ) : !1 : !1;
17
+ }
18
+ function h(e) {
19
+ if (!e.isConnected || e.closest("[hidden], [inert]")) return !1;
20
+ const t = l();
21
+ return t ? t.contains(e) : !e.closest("baht-modal");
22
+ }
23
+ function v(e, t) {
24
+ return e.host.compareDocumentPosition(t.host) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
25
+ }
26
+ function c(e) {
27
+ if (e.defaultPrevented || e.repeat || e.isComposing) return;
28
+ const t = m(), s = p(e.target), r = Array.from(i).filter((n) => s && !(n.spec.ctrl || n.spec.alt || n.spec.meta || n.spec.mod) ? !1 : u(e, n.spec, { mac: t }) && n.enabled() && h(n.host)).sort(v)[0];
29
+ r && (e.preventDefault(), r.run());
30
+ }
31
+ function g(e, t, s, r = () => !0) {
32
+ const n = f(t);
33
+ if (!n || !d()) return () => {
34
+ };
35
+ const a = { host: e, spec: n, enabled: r, run: s };
36
+ return i.add(a), o || (document.addEventListener("keydown", c), o = !0), () => {
37
+ i.delete(a), i.size === 0 && o && (document.removeEventListener("keydown", c), o = !1);
38
+ };
39
+ }
40
+ export {
41
+ g as bindShortcut,
42
+ m as isMacPlatform
43
+ };