bank20baht-ui 0.2.2 → 0.2.3

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.
@@ -40,5 +40,5 @@ export declare abstract class BahtFieldBase extends BahtElement {
40
40
  protected get describedBy(): string | typeof nothing;
41
41
  /** 'true' while the field is in error, else absent (styles hook on [aria-invalid]). */
42
42
  protected get invalid(): string | typeof nothing;
43
- protected render(): TemplateResult;
43
+ protected render(): TemplateResult | typeof nothing;
44
44
  }
@@ -1,10 +1,10 @@
1
- import { TemplateResult } from 'lit';
1
+ import { nothing, TemplateResult } from 'lit';
2
2
  import { BahtElement } from '../base.js';
3
3
  import { FieldDescriptor } from '../../core/types.js';
4
4
  /** Section divider (`type: "section"`): heading + rule, no value, no emits. */
5
5
  export declare class BahtSection extends BahtElement {
6
6
  field: FieldDescriptor;
7
- protected render(): TemplateResult;
7
+ protected render(): TemplateResult | typeof nothing;
8
8
  }
9
9
  declare global {
10
10
  interface HTMLElementTagNameMap {
@@ -1,8 +1,8 @@
1
- import { TemplateResult } from 'lit';
1
+ import { nothing, TemplateResult } from 'lit';
2
2
  import { BahtElement } from '../base.js';
3
3
  import { FieldDescriptor } from '../../core/types.js';
4
4
  /** Static text block (`type: "label"`): no value, no emits. */
5
5
  export declare class BahtText extends BahtElement {
6
6
  field: FieldDescriptor;
7
- protected render(): TemplateResult;
7
+ protected render(): TemplateResult | typeof nothing;
8
8
  }
package/dist/index.js CHANGED
@@ -66,12 +66,12 @@ class g extends c {
66
66
  return this.error ? "true" : h;
67
67
  }
68
68
  render() {
69
- return n`
69
+ return this.field ? n`
70
70
  ${this.renderLabel()}
71
71
  ${this.renderControl()}
72
72
  ${this.field.help ? n`<div class="baht-help" id=${this.helpId}>${this.field.help}</div>` : h}
73
73
  ${this.error ? n`<div class="baht-error" id=${this.errorId} role="alert">${this.error}</div>` : h}
74
- `;
74
+ ` : h;
75
75
  }
76
76
  }
77
77
  et([
@@ -1891,6 +1891,7 @@ var Es = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, ae = (t, e
1891
1891
  };
1892
1892
  let It = class extends c {
1893
1893
  render() {
1894
+ if (!this.field) return h;
1894
1895
  const t = this.field.variant ?? "body";
1895
1896
  return n`<div class="baht-text baht-text--${t}">${this.field.text ?? this.field.label ?? ""}</div>`;
1896
1897
  }
@@ -1908,9 +1909,9 @@ var js = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, ie = (t, e
1908
1909
  };
1909
1910
  let qt = class extends c {
1910
1911
  render() {
1911
- return n`<div class="baht-section">
1912
+ return this.field ? n`<div class="baht-section">
1912
1913
  <span class="baht-section-label">${this.field.text ?? this.field.label ?? ""}</span>
1913
- </div>`;
1914
+ </div>` : h;
1914
1915
  }
1915
1916
  };
1916
1917
  ie([
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "bank20baht-ui",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bank20baht-ui",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "JSON-driven form + workflow engine. Send JSON in, get an interactive form out.",
6
6
  "license": "MIT",