bank20baht-ui 0.2.1 → 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.
package/README.md CHANGED
@@ -298,9 +298,9 @@ vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('b
298
298
  - **Copy-out starters**: `examples/vanilla`, `examples/react`, `examples/angular` at the
299
299
  repo root — same workflow JSON in three hosts.
300
300
 
301
- ## Field types (12)
301
+ ## Field types (13)
302
302
 
303
- `text · textarea · number · email · dropdown · multiselect · checkbox · radio · toggle · date ·
303
+ `text · textarea · number · email · password · dropdown · multiselect · checkbox · radio · toggle · date ·
304
304
  file (capture only, no upload) · label (static)`
305
305
 
306
306
  Each field descriptor: `{ order, type, key, label, placeholder, width: '1/4'|'1/2'|'3/4'|'full',
@@ -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,6 +1,9 @@
1
1
  import { TemplateResult } from 'lit';
2
2
  import { BahtFieldBase } from '../base.js';
3
- /** text + email share one control; email differs only in input type + validator. */
3
+ /**
4
+ * text + email + password share one control; email differs only in input type +
5
+ * validator, password only in input type (masked, never formatted or logged).
6
+ */
4
7
  export declare class BahtInput extends BahtFieldBase {
5
8
  protected renderControl(): TemplateResult;
6
9
  }
@@ -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
  }
@@ -1,5 +1,5 @@
1
1
  /** Control types supported by v1 (spec 01 §2). */
2
- export type FieldType = 'text' | 'textarea' | 'number' | 'email' | 'dropdown' | 'multiselect' | 'checkbox' | 'radio' | 'toggle' | 'date' | 'file' | 'label' | 'section' | 'repeater';
2
+ export type FieldType = 'text' | 'textarea' | 'number' | 'email' | 'password' | 'dropdown' | 'multiselect' | 'checkbox' | 'radio' | 'toggle' | 'date' | 'file' | 'label' | 'section' | 'repeater';
3
3
  export type FieldWidth = '1/4' | '1/2' | '3/4' | 'full';
4
4
  export interface FieldOption {
5
5
  key: string;
@@ -3768,7 +3768,7 @@
3768
3768
  "declarations": [
3769
3769
  {
3770
3770
  "kind": "class",
3771
- "description": "text + email share one control; email differs only in input type + validator.",
3771
+ "description": "text + email + password share one control; email differs only in input type +\nvalidator, password only in input type (masked, never formatted or logged).",
3772
3772
  "name": "BahtInput",
3773
3773
  "members": [
3774
3774
  {
@@ -10490,7 +10490,7 @@
10490
10490
  "type": {
10491
10491
  "text": "Record<FieldType, string>"
10492
10492
  },
10493
- "default": "{ text: 'baht-input', email: 'baht-input', textarea: 'baht-textarea', number: 'baht-number', dropdown: 'baht-select', multiselect: 'baht-multiselect', checkbox: 'baht-checkbox', radio: 'baht-radio', toggle: 'baht-toggle', date: 'baht-datepicker', file: 'baht-file', label: 'baht-text', section: 'baht-section', repeater: 'baht-repeater', }",
10493
+ "default": "{ text: 'baht-input', email: 'baht-input', password: 'baht-input', textarea: 'baht-textarea', number: 'baht-number', dropdown: 'baht-select', multiselect: 'baht-multiselect', checkbox: 'baht-checkbox', radio: 'baht-radio', toggle: 'baht-toggle', date: 'baht-datepicker', file: 'baht-file', label: 'baht-text', section: 'baht-section', repeater: 'baht-repeater', }",
10494
10494
  "description": "field descriptor `type` -> primitive tag (used by <baht-form>, <baht-repeater>\nand the builder). Lives in its own module so baht-repeater can read it\nwithout importing the primitives barrel (which would be circular)."
10495
10495
  }
10496
10496
  ],
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([
@@ -1520,7 +1520,7 @@ let zt = class extends g {
1520
1520
  return n`<input
1521
1521
  class="baht-control baht-control--text"
1522
1522
  id=${this.controlId}
1523
- type=${this.field.type === "email" ? "email" : "text"}
1523
+ type=${this.field.type === "email" ? "email" : this.field.type === "password" ? "password" : "text"}
1524
1524
  .value=${B(this.value == null ? "" : String(this.value))}
1525
1525
  placeholder=${O(this.field.placeholder)}
1526
1526
  maxlength=${O(this.field.maxLength)}
@@ -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([
@@ -2411,6 +2412,7 @@ y = w([
2411
2412
  const le = {
2412
2413
  text: "baht-input",
2413
2414
  email: "baht-input",
2415
+ password: "baht-input",
2414
2416
  textarea: "baht-textarea",
2415
2417
  number: "baht-number",
2416
2418
  dropdown: "baht-select",
@@ -262,7 +262,7 @@
262
262
  },
263
263
  {
264
264
  "name": "baht-input",
265
- "description": "text + email share one control; email differs only in input type + validator.\n---\n\n\n### **Events:**\n - **baht-input**\n\n### **Methods:**\n ",
265
+ "description": "text + email + password share one control; email differs only in input type +\nvalidator, password only in input type (masked, never formatted or logged).\n---\n\n\n### **Events:**\n - **baht-input**\n\n### **Methods:**\n ",
266
266
  "attributes": [
267
267
  { "name": "disabled", "values": [] },
268
268
  { "name": "readonly", "values": [] },
@@ -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.1",
4
+ "version": "0.2.3",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -666,7 +666,7 @@
666
666
  },
667
667
  {
668
668
  "name": "baht-input",
669
- "description": "text + email share one control; email differs only in input type + validator.\n---\n\n\n### **Events:**\n - **baht-input**\n\n### **Methods:**\n ",
669
+ "description": "text + email + password share one control; email differs only in input type +\nvalidator, password only in input type (masked, never formatted or logged).\n---\n\n\n### **Events:**\n - **baht-input**\n\n### **Methods:**\n ",
670
670
  "doc-url": "",
671
671
  "attributes": [
672
672
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bank20baht-ui",
3
- "version": "0.2.1",
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",