bank20baht-ui 0.7.4 → 0.8.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 (97) hide show
  1. package/README.md +13 -3
  2. package/dist/components/baht-form.d.ts +17 -1
  3. package/dist/components/baht-form.js +176 -160
  4. package/dist/components/baht-workflow.d.ts +11 -0
  5. package/dist/components/baht-workflow.js +136 -102
  6. package/dist/components/base.d.ts +27 -71
  7. package/dist/components/base.js +64 -174
  8. package/dist/components/field-base.d.ts +78 -0
  9. package/dist/components/field-base.js +145 -0
  10. package/dist/components/primitives/baht-accordion.js +3 -1
  11. package/dist/components/primitives/baht-alert.js +3 -1
  12. package/dist/components/primitives/baht-bar-chart.d.ts +1 -12
  13. package/dist/components/primitives/baht-bar-chart.js +152 -137
  14. package/dist/components/primitives/baht-checkbox.d.ts +1 -1
  15. package/dist/components/primitives/baht-checkbox.js +4 -2
  16. package/dist/components/primitives/baht-currency.d.ts +1 -1
  17. package/dist/components/primitives/baht-currency.js +20 -19
  18. package/dist/components/primitives/baht-datepicker.d.ts +7 -2
  19. package/dist/components/primitives/baht-datepicker.js +90 -67
  20. package/dist/components/primitives/baht-donut-chart.js +16 -15
  21. package/dist/components/primitives/baht-error-state.d.ts +1 -1
  22. package/dist/components/primitives/baht-error-state.js +3 -4
  23. package/dist/components/primitives/baht-file.d.ts +1 -1
  24. package/dist/components/primitives/baht-file.js +10 -4
  25. package/dist/components/primitives/baht-filter.js +10 -8
  26. package/dist/components/primitives/baht-heatmap.js +61 -44
  27. package/dist/components/primitives/baht-input.d.ts +1 -1
  28. package/dist/components/primitives/baht-input.js +12 -10
  29. package/dist/components/primitives/baht-keyvalue-editor.d.ts +1 -1
  30. package/dist/components/primitives/baht-keyvalue-editor.js +25 -20
  31. package/dist/components/primitives/baht-line-chart.js +70 -64
  32. package/dist/components/primitives/baht-list.js +25 -23
  33. package/dist/components/primitives/baht-meter.js +11 -12
  34. package/dist/components/primitives/baht-modal.js +38 -34
  35. package/dist/components/primitives/baht-multiselect.d.ts +1 -1
  36. package/dist/components/primitives/baht-multiselect.js +4 -2
  37. package/dist/components/primitives/baht-number.d.ts +1 -1
  38. package/dist/components/primitives/baht-number.js +13 -13
  39. package/dist/components/primitives/baht-otp.js +9 -3
  40. package/dist/components/primitives/baht-pagination.js +15 -5
  41. package/dist/components/primitives/baht-radio.d.ts +1 -1
  42. package/dist/components/primitives/baht-radio.js +7 -3
  43. package/dist/components/primitives/baht-range.js +19 -17
  44. package/dist/components/primitives/baht-rating.js +12 -4
  45. package/dist/components/primitives/baht-reference-picker.d.ts +3 -2
  46. package/dist/components/primitives/baht-reference-picker.js +47 -34
  47. package/dist/components/primitives/baht-repeater.d.ts +5 -3
  48. package/dist/components/primitives/baht-repeater.js +65 -68
  49. package/dist/components/primitives/baht-section.d.ts +2 -0
  50. package/dist/components/primitives/baht-section.js +15 -11
  51. package/dist/components/primitives/baht-select.d.ts +1 -1
  52. package/dist/components/primitives/baht-select.js +28 -18
  53. package/dist/components/primitives/baht-sparkline.js +22 -22
  54. package/dist/components/primitives/baht-stat.js +8 -8
  55. package/dist/components/primitives/baht-table.d.ts +11 -11
  56. package/dist/components/primitives/baht-table.js +79 -45
  57. package/dist/components/primitives/baht-text.d.ts +2 -0
  58. package/dist/components/primitives/baht-text.js +21 -17
  59. package/dist/components/primitives/baht-textarea.d.ts +1 -1
  60. package/dist/components/primitives/baht-textarea.js +11 -9
  61. package/dist/components/primitives/baht-toast.js +9 -3
  62. package/dist/components/primitives/baht-toggle.d.ts +1 -1
  63. package/dist/components/primitives/baht-toggle.js +4 -2
  64. package/dist/components/primitives/baht-tooltip.d.ts +2 -2
  65. package/dist/components/primitives/baht-tooltip.js +8 -8
  66. package/dist/components/primitives/baht-typeahead.js +23 -13
  67. package/dist/components/primitives/baht-upload.d.ts +6 -3
  68. package/dist/components/primitives/baht-upload.js +116 -93
  69. package/dist/components/primitives/charts.js +17 -18
  70. package/dist/components/primitives/tag-map.d.ts +4 -0
  71. package/dist/components/primitives/tag-map.js +15 -3
  72. package/dist/core/dates.d.ts +0 -1
  73. package/dist/core/dates.js +34 -35
  74. package/dist/core/defaults.js +13 -3
  75. package/dist/core/display.d.ts +2 -2
  76. package/dist/core/display.js +18 -7
  77. package/dist/core/engine/conditions.js +51 -53
  78. package/dist/core/engine/evaluate.js +145 -136
  79. package/dist/core/engine/expressions.js +25 -22
  80. package/dist/core/engine/graph.d.ts +1 -1
  81. package/dist/core/engine/scripts.js +49 -36
  82. package/dist/core/flags.js +19 -16
  83. package/dist/core/types.d.ts +3 -3
  84. package/dist/core/validators.d.ts +0 -8
  85. package/dist/core/validators.js +109 -99
  86. package/dist/css/components.css +57 -2
  87. package/dist/custom-elements.json +1273 -628
  88. package/dist/hydrate.js +1 -1
  89. package/dist/index.d.ts +2 -1
  90. package/dist/index.js +12 -11
  91. package/dist/overlay.js +33 -29
  92. package/dist/react.d.ts +4 -4
  93. package/dist/ssr.js +5 -3
  94. package/dist/tokens.css +58 -349
  95. package/dist/vscode.html-custom-data.json +2 -2
  96. package/dist/web-types.json +7 -7
  97. package/package.json +7 -4
package/README.md CHANGED
@@ -5,6 +5,7 @@ Components (Lit, light DOM) with a pure-TypeScript rules core.
5
5
 
6
6
  ```
7
7
  npm i bank20baht-ui
8
+ npm i flatpickr # peer dependency — only if you render date fields / <baht-datepicker>
8
9
  ```
9
10
 
10
11
  ## Quick start — one form (Level 1)
@@ -313,13 +314,22 @@ await registerElements(['baht-button', 'baht-avatar']);
313
314
  ```
314
315
 
315
316
  ```css
316
- /* 3. split stylesheets instead of the all-in-one tokens.css (139 KB) */
317
+ /* 3. split stylesheets instead of the all-in-one tokens.css (~115 KB) */
317
318
  @import 'bank20baht-ui/css/tokens.css'; /* custom properties only, 18 KB */
318
319
  @import 'bank20baht-ui/css/components.css'; /* .baht-* classes */
319
- @import 'bank20baht-ui/css/datepicker.css'; /* flatpickr base + re-skin — only with <baht-datepicker> / date fields */
320
320
  ```
321
321
 
322
- `bank20baht-ui/tokens.css` stays the one-import sheet (all three, flatpickr included).
322
+ `bank20baht-ui/tokens.css` = the two sheets above in one import. The calendar is opt-in:
323
+
324
+ ```css
325
+ /* with <baht-datepicker> / date fields — flatpickr's base sheet + the token re-skin */
326
+ @import 'bank20baht-ui/css/datepicker.css';
327
+ ```
328
+
329
+ flatpickr itself is a **peer dependency** (`npm i flatpickr`) loaded with a dynamic
330
+ `import()` the first time a `<baht-datepicker>` mounts, so apps without date fields never
331
+ bundle it and apps with them get it as its own chunk. `await el.updateComplete` on the
332
+ element resolves once the calendar is attached.
323
333
 
324
334
  ## One install, typed everywhere
325
335
 
@@ -26,7 +26,7 @@ export declare class BahtForm extends BahtElement {
26
26
  * but getData() still returns the FULL form — the server always validates
27
27
  * the complete schema, views never change the submit payload.
28
28
  */
29
- view?: string;
29
+ view?: string | undefined;
30
30
  /**
31
31
  * Feature-flag values (spec 01 §12) — fields whose `flag` is off behave as
32
32
  * if they were never in the schema: no render, no validation, no payload.
@@ -58,6 +58,11 @@ export declare class BahtForm extends BahtElement {
58
58
  private warnedViews;
59
59
  /** applyFlags result, memoized on (form, flags) identity. */
60
60
  private flagCache;
61
+ /**
62
+ * `form` as the host may actually have left it: a framework can connect the element
63
+ * before it binds the property, so internally it is optional until then.
64
+ */
65
+ private get assignedForm();
61
66
  private get effectiveForm();
62
67
  protected willUpdate(changed: Map<PropertyKey, unknown>): void;
63
68
  /**
@@ -73,6 +78,15 @@ export declare class BahtForm extends BahtElement {
73
78
  */
74
79
  private clearDependents;
75
80
  private get sortedFields();
81
+ /**
82
+ * Visibility as of the last completed render, by key. A field that was
83
+ * hidden there and is visible now gets `baht-field--revealed` for one
84
+ * render so the stylesheet can fade it in; fields visible from the first
85
+ * render never animate (a form should not shimmer on mount).
86
+ */
87
+ private lastVisible;
88
+ private nextVisible;
89
+ private revealClass;
76
90
  private stateFor;
77
91
  private valueFor;
78
92
  /** Debounced keystrokes still in a control land in `edits` before anyone reads them. */
@@ -116,6 +130,8 @@ export declare class BahtForm extends BahtElement {
116
130
  * `renderField`/`.baht-error`). No-op for 'change'/'submit' modes. */
117
131
  private onFieldBlur;
118
132
  private renderField;
133
+ private uploaderFor;
134
+ private renderFieldMsg;
119
135
  /**
120
136
  * Resolve the descriptor at event time — it may have changed since the control
121
137
  * was first rendered (the same node is reused across renders, see render()).