bank20baht-ui 0.8.1 → 0.8.2
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.
|
@@ -12,6 +12,7 @@ export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
|
12
12
|
* <baht-button label="Save workflow"></baht-button>
|
|
13
13
|
* <baht-button icon="copy" variant="ghost" size="sm">Copy</baht-button>
|
|
14
14
|
* <baht-button icon="close" icon-only label="Close"></baht-button> <!-- label = a11y name -->
|
|
15
|
+
* <baht-button aria-label="Previous month">‹</baht-button> <!-- glyph child, host aria-label wins -->
|
|
15
16
|
*/
|
|
16
17
|
export declare class BahtButton extends BahtElement {
|
|
17
18
|
variant: ButtonVariant;
|
|
@@ -25,6 +26,18 @@ export declare class BahtButton extends BahtElement {
|
|
|
25
26
|
icon: IconName | '';
|
|
26
27
|
/** Square icon-only button. Requires `label` for the accessible name. */
|
|
27
28
|
iconOnly: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A host `aria-label` never reaches assistive tech on its own — light DOM has no
|
|
31
|
+
* implicit ARIA relationship between a custom element and its rendered children, so an
|
|
32
|
+
* `aria-label` written on `<baht-button>` stays on the host and the inner native
|
|
33
|
+
* `<button>` keeps whatever text (or none) is inside it. Mirroring the attribute into
|
|
34
|
+
* this property forwards it to the inner button's `aria-label`, taking priority over
|
|
35
|
+
* `label`/icon-only fallback — this is how a glyph-only child (e.g. `‹`) gets a real
|
|
36
|
+
* accessible name without `icon-only`. Mapped to the plain `aria-label` attribute so
|
|
37
|
+
* hosts write it the way they naturally would; kept off the `ariaLabel` IDL accessor to
|
|
38
|
+
* avoid shadowing the platform's own ARIAMixin.
|
|
39
|
+
*/
|
|
40
|
+
hostAriaLabel: string;
|
|
28
41
|
private buttonEl;
|
|
29
42
|
protected firstUpdated(): void;
|
|
30
43
|
protected render(): TemplateResult;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { nothing as
|
|
1
|
+
import { nothing as p, html as b } from "lit";
|
|
2
2
|
import { property as e, query as c, customElement as y } from "lit/decorators.js";
|
|
3
3
|
import { BahtElement as u, adoptLightChildren as m } from "../base.js";
|
|
4
4
|
import { isIconName as d, renderIcon as f } from "./icons.js";
|
|
5
|
-
var v = Object.defineProperty, O = Object.getOwnPropertyDescriptor, o = (
|
|
6
|
-
for (var i =
|
|
7
|
-
(
|
|
8
|
-
return
|
|
5
|
+
var v = Object.defineProperty, O = Object.getOwnPropertyDescriptor, o = (r, s, a, n) => {
|
|
6
|
+
for (var i = n > 1 ? void 0 : n ? O(s, a) : s, l = r.length - 1, h; l >= 0; l--)
|
|
7
|
+
(h = r[l]) && (i = (n ? h(s, a, i) : h(i)) || i);
|
|
8
|
+
return n && i && v(s, a, i), i;
|
|
9
9
|
};
|
|
10
10
|
let t = class extends u {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this.variant = "primary", this.size = "md", this.disabled = !1, this.type = "button", this.label = "", this.icon = "", this.iconOnly = !1;
|
|
12
|
+
super(...arguments), this.variant = "primary", this.size = "md", this.disabled = !1, this.type = "button", this.label = "", this.icon = "", this.iconOnly = !1, this.hostAriaLabel = "";
|
|
13
13
|
}
|
|
14
14
|
firstUpdated() {
|
|
15
15
|
this.iconOnly || m(this, this.buttonEl);
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
|
-
const
|
|
18
|
+
const r = this.variant === "primary" ? "" : ` baht-button--${this.variant}`, s = this.size === "md" ? "" : ` baht-button--${this.size}`, a = this.iconOnly ? " baht-button--icon" : "", n = this.icon && d(this.icon) ? f(this.icon) : p, i = this.hostAriaLabel || (this.iconOnly && this.label ? this.label : "");
|
|
19
19
|
return b`<button
|
|
20
|
-
class="baht-button${
|
|
20
|
+
class="baht-button${r}${s}${a}"
|
|
21
21
|
type=${this.type}
|
|
22
|
-
aria-label=${
|
|
22
|
+
aria-label=${i || p}
|
|
23
23
|
?disabled=${this.disabled}
|
|
24
|
-
>${
|
|
24
|
+
>${n}${this.iconOnly ? p : this.label}</button>`;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
o([
|
|
@@ -45,6 +45,9 @@ o([
|
|
|
45
45
|
o([
|
|
46
46
|
e({ type: Boolean, attribute: "icon-only" })
|
|
47
47
|
], t.prototype, "iconOnly", 2);
|
|
48
|
+
o([
|
|
49
|
+
e({ attribute: "aria-label" })
|
|
50
|
+
], t.prototype, "hostAriaLabel", 2);
|
|
48
51
|
o([
|
|
49
52
|
c("button")
|
|
50
53
|
], t.prototype, "buttonEl", 2);
|
|
@@ -4015,7 +4015,7 @@
|
|
|
4015
4015
|
"declarations": [
|
|
4016
4016
|
{
|
|
4017
4017
|
"kind": "class",
|
|
4018
|
-
"description": "Design-system button (20baht: no scale, no shadow change — color does the work).\nStandalone primitive: children become the label, listen for the native `click`.\n(Light DOM has no <slot>, so the initial children are moved into the button.)\n\n <baht-button variant=\"danger\" size=\"sm\">Delete</baht-button>\n <baht-button label=\"Save workflow\"></baht-button>\n <baht-button icon=\"copy\" variant=\"ghost\" size=\"sm\">Copy</baht-button>\n <baht-button icon=\"close\" icon-only label=\"Close\"></baht-button> <!-- label = a11y name -->",
|
|
4018
|
+
"description": "Design-system button (20baht: no scale, no shadow change — color does the work).\nStandalone primitive: children become the label, listen for the native `click`.\n(Light DOM has no <slot>, so the initial children are moved into the button.)\n\n <baht-button variant=\"danger\" size=\"sm\">Delete</baht-button>\n <baht-button label=\"Save workflow\"></baht-button>\n <baht-button icon=\"copy\" variant=\"ghost\" size=\"sm\">Copy</baht-button>\n <baht-button icon=\"close\" icon-only label=\"Close\"></baht-button> <!-- label = a11y name -->\n <baht-button aria-label=\"Previous month\">‹</baht-button> <!-- glyph child, host aria-label wins -->",
|
|
4019
4019
|
"name": "BahtButton",
|
|
4020
4020
|
"members": [
|
|
4021
4021
|
{
|
|
@@ -4085,6 +4085,16 @@
|
|
|
4085
4085
|
"description": "Square icon-only button. Requires `label` for the accessible name.",
|
|
4086
4086
|
"attribute": "icon-only"
|
|
4087
4087
|
},
|
|
4088
|
+
{
|
|
4089
|
+
"kind": "field",
|
|
4090
|
+
"name": "hostAriaLabel",
|
|
4091
|
+
"type": {
|
|
4092
|
+
"text": "string"
|
|
4093
|
+
},
|
|
4094
|
+
"default": "''",
|
|
4095
|
+
"description": "A host `aria-label` never reaches assistive tech on its own — light DOM has no\nimplicit ARIA relationship between a custom element and its rendered children, so an\n`aria-label` written on `<baht-button>` stays on the host and the inner native\n`<button>` keeps whatever text (or none) is inside it. Mirroring the attribute into\nthis property forwards it to the inner button's `aria-label`, taking priority over\n`label`/icon-only fallback — this is how a glyph-only child (e.g. `‹`) gets a real\naccessible name without `icon-only`. Mapped to the plain `aria-label` attribute so\nhosts write it the way they naturally would; kept off the `ariaLabel` IDL accessor to\navoid shadowing the platform's own ARIAMixin.",
|
|
4096
|
+
"attribute": "aria-label"
|
|
4097
|
+
},
|
|
4088
4098
|
{
|
|
4089
4099
|
"kind": "field",
|
|
4090
4100
|
"name": "buttonEl",
|
|
@@ -4199,6 +4209,15 @@
|
|
|
4199
4209
|
"description": "Square icon-only button. Requires `label` for the accessible name.",
|
|
4200
4210
|
"fieldName": "iconOnly"
|
|
4201
4211
|
},
|
|
4212
|
+
{
|
|
4213
|
+
"name": "aria-label",
|
|
4214
|
+
"type": {
|
|
4215
|
+
"text": "string"
|
|
4216
|
+
},
|
|
4217
|
+
"default": "''",
|
|
4218
|
+
"description": "A host `aria-label` never reaches assistive tech on its own — light DOM has no\nimplicit ARIA relationship between a custom element and its rendered children, so an\n`aria-label` written on `<baht-button>` stays on the host and the inner native\n`<button>` keeps whatever text (or none) is inside it. Mirroring the attribute into\nthis property forwards it to the inner button's `aria-label`, taking priority over\n`label`/icon-only fallback — this is how a glyph-only child (e.g. `‹`) gets a real\naccessible name without `icon-only`. Mapped to the plain `aria-label` attribute so\nhosts write it the way they naturally would; kept off the `ariaLabel` IDL accessor to\navoid shadowing the platform's own ARIAMixin.",
|
|
4219
|
+
"fieldName": "hostAriaLabel"
|
|
4220
|
+
},
|
|
4202
4221
|
{
|
|
4203
4222
|
"name": "defer-hydration",
|
|
4204
4223
|
"inheritedFrom": {
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
191
|
"name": "baht-button",
|
|
192
|
-
"description": "Design-system button (20baht: no scale, no shadow change — color does the work).\nStandalone primitive: children become the label, listen for the native `click`.\n(Light DOM has no <slot>, so the initial children are moved into the button.)\n\n <baht-button variant=\"danger\" size=\"sm\">Delete</baht-button>\n <baht-button label=\"Save workflow\"></baht-button>\n <baht-button icon=\"copy\" variant=\"ghost\" size=\"sm\">Copy</baht-button>\n <baht-button icon=\"close\" icon-only label=\"Close\"></baht-button> <!-- label = a11y name -->\n---\n\n\n### **Events:**\n - **name**\n\n### **Methods:**\n ",
|
|
192
|
+
"description": "Design-system button (20baht: no scale, no shadow change — color does the work).\nStandalone primitive: children become the label, listen for the native `click`.\n(Light DOM has no <slot>, so the initial children are moved into the button.)\n\n <baht-button variant=\"danger\" size=\"sm\">Delete</baht-button>\n <baht-button label=\"Save workflow\"></baht-button>\n <baht-button icon=\"copy\" variant=\"ghost\" size=\"sm\">Copy</baht-button>\n <baht-button icon=\"close\" icon-only label=\"Close\"></baht-button> <!-- label = a11y name -->\n <baht-button aria-label=\"Previous month\">‹</baht-button> <!-- glyph child, host aria-label wins -->\n---\n\n\n### **Events:**\n - **name**\n\n### **Methods:**\n ",
|
|
193
193
|
"attributes": [
|
|
194
194
|
{ "name": "variant", "values": [{ "name": "ButtonVariant" }] },
|
|
195
195
|
{ "name": "size", "values": [{ "name": "ButtonSize" }] },
|
|
@@ -214,6 +214,11 @@
|
|
|
214
214
|
"description": "Square icon-only button. Requires `label` for the accessible name.",
|
|
215
215
|
"values": []
|
|
216
216
|
},
|
|
217
|
+
{
|
|
218
|
+
"name": "aria-label",
|
|
219
|
+
"description": "A host `aria-label` never reaches assistive tech on its own — light DOM has no\nimplicit ARIA relationship between a custom element and its rendered children, so an\n`aria-label` written on `<baht-button>` stays on the host and the inner native\n`<button>` keeps whatever text (or none) is inside it. Mirroring the attribute into\nthis property forwards it to the inner button's `aria-label`, taking priority over\n`label`/icon-only fallback — this is how a glyph-only child (e.g. `‹`) gets a real\naccessible name without `icon-only`. Mapped to the plain `aria-label` attribute so\nhosts write it the way they naturally would; kept off the `ariaLabel` IDL accessor to\navoid shadowing the platform's own ARIAMixin.",
|
|
220
|
+
"values": []
|
|
221
|
+
},
|
|
217
222
|
{ "name": "defer-hydration", "values": [] }
|
|
218
223
|
],
|
|
219
224
|
"references": []
|
package/dist/web-types.json
CHANGED
|
@@ -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.8.
|
|
4
|
+
"version": "0.8.2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
},
|
|
455
455
|
{
|
|
456
456
|
"name": "baht-button",
|
|
457
|
-
"description": "Design-system button (20baht: no scale, no shadow change — color does the work).\nStandalone primitive: children become the label, listen for the native `click`.\n(Light DOM has no <slot>, so the initial children are moved into the button.)\n\n <baht-button variant=\"danger\" size=\"sm\">Delete</baht-button>\n <baht-button label=\"Save workflow\"></baht-button>\n <baht-button icon=\"copy\" variant=\"ghost\" size=\"sm\">Copy</baht-button>\n <baht-button icon=\"close\" icon-only label=\"Close\"></baht-button> <!-- label = a11y name -->\n---\n\n\n### **Events:**\n - **name**\n\n### **Methods:**\n ",
|
|
457
|
+
"description": "Design-system button (20baht: no scale, no shadow change — color does the work).\nStandalone primitive: children become the label, listen for the native `click`.\n(Light DOM has no <slot>, so the initial children are moved into the button.)\n\n <baht-button variant=\"danger\" size=\"sm\">Delete</baht-button>\n <baht-button label=\"Save workflow\"></baht-button>\n <baht-button icon=\"copy\" variant=\"ghost\" size=\"sm\">Copy</baht-button>\n <baht-button icon=\"close\" icon-only label=\"Close\"></baht-button> <!-- label = a11y name -->\n <baht-button aria-label=\"Previous month\">‹</baht-button> <!-- glyph child, host aria-label wins -->\n---\n\n\n### **Events:**\n - **name**\n\n### **Methods:**\n ",
|
|
458
458
|
"doc-url": "",
|
|
459
459
|
"attributes": [
|
|
460
460
|
{
|
|
@@ -489,6 +489,11 @@
|
|
|
489
489
|
"description": "Square icon-only button. Requires `label` for the accessible name.",
|
|
490
490
|
"value": { "type": "boolean", "default": "false" }
|
|
491
491
|
},
|
|
492
|
+
{
|
|
493
|
+
"name": "aria-label",
|
|
494
|
+
"description": "A host `aria-label` never reaches assistive tech on its own — light DOM has no\nimplicit ARIA relationship between a custom element and its rendered children, so an\n`aria-label` written on `<baht-button>` stays on the host and the inner native\n`<button>` keeps whatever text (or none) is inside it. Mirroring the attribute into\nthis property forwards it to the inner button's `aria-label`, taking priority over\n`label`/icon-only fallback — this is how a glyph-only child (e.g. `‹`) gets a real\naccessible name without `icon-only`. Mapped to the plain `aria-label` attribute so\nhosts write it the way they naturally would; kept off the `ariaLabel` IDL accessor to\navoid shadowing the platform's own ARIAMixin.",
|
|
495
|
+
"value": { "type": "string", "default": "''" }
|
|
496
|
+
},
|
|
492
497
|
{ "name": "defer-hydration", "value": { "type": "string" } }
|
|
493
498
|
],
|
|
494
499
|
"events": [{ "name": "name", "type": "CustomEvent" }],
|
|
@@ -516,6 +521,11 @@
|
|
|
516
521
|
"name": "iconOnly",
|
|
517
522
|
"description": "Square icon-only button. Requires `label` for the accessible name.",
|
|
518
523
|
"type": "boolean"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"name": "hostAriaLabel",
|
|
527
|
+
"description": "A host `aria-label` never reaches assistive tech on its own — light DOM has no\nimplicit ARIA relationship between a custom element and its rendered children, so an\n`aria-label` written on `<baht-button>` stays on the host and the inner native\n`<button>` keeps whatever text (or none) is inside it. Mirroring the attribute into\nthis property forwards it to the inner button's `aria-label`, taking priority over\n`label`/icon-only fallback — this is how a glyph-only child (e.g. `‹`) gets a real\naccessible name without `icon-only`. Mapped to the plain `aria-label` attribute so\nhosts write it the way they naturally would; kept off the `ariaLabel` IDL accessor to\navoid shadowing the platform's own ARIAMixin.",
|
|
528
|
+
"type": "string"
|
|
519
529
|
}
|
|
520
530
|
],
|
|
521
531
|
"events": [{ "name": "name", "type": "CustomEvent" }]
|