@viasat/beam-web-components 2.21.1 → 2.23.0

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.
@@ -1,86 +1,108 @@
1
- import { unsafeCSS as _, LitElement as S, html as u } from "lit";
2
- import { property as s, queryAssignedNodes as x } from "lit/decorators.js";
3
- import f from "clsx";
4
- import { n as P, g as C } from "../../chunks/classNames.Cq_tbDRp.js";
5
- import { t as k } from "../../chunks/constants.jOWREYQE.js";
6
- import { c as $ } from "../../chunks/register-custom-element.DHGKOhmA.js";
7
- const q = ':root,:host,.bm-light,.bm-dark .bm-inverse,.bm-dark.bm-inverse,[data-bm-theme~=bm-dark] .bm-inverse,[data-bm-theme~=bm-dark].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-light]{--bm-comp-label-color-text: var(--bm-sem-color-text-secondary, #576775);--bm-comp-label-color-icon: var(--bm-sem-color-icon-secondary, #576775);--bm-comp-label-typo-default: var( --bm-sem-typo-label-sm, 600 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-optional: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-character-count: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-space-gap: var(--bm-sem-space-25, .25rem);--bm-comp-label-space-bottom: var(--bm-sem-space-50, .5rem);--bm-comp-label-size-icon: var(--bm-sem-size-icon-sm, 1rem)}:host,.bm-dark,.bm-light .bm-inverse,.bm-light.bm-inverse,[data-bm-theme~=bm-light] .bm-inverse,[data-bm-theme~=bm-light].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-dark]{--bm-comp-label-color-text: var(--bm-sem-color-text-secondary, #c3cdd5);--bm-comp-label-color-icon: var(--bm-sem-color-icon-secondary, #c3cdd5);--bm-comp-label-typo-default: var( --bm-sem-typo-label-sm, 600 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-optional: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-character-count: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-space-gap: var(--bm-sem-space-25, .25rem);--bm-comp-label-space-bottom: var(--bm-sem-space-50, .5rem);--bm-comp-label-size-icon: var(--bm-sem-size-icon-sm, 1rem)}.bm-label{color:var(--bm-comp-label-color-text);font:var(--bm-comp-label-typo-default);margin-bottom:var(--bm-comp-label-space-bottom, var(--bm-sem-space-0))}.bm-label label{cursor:var(--bm-comp-label-cursor, default);pointer-events:var(--bm-comp-label-pointer-events, inherit)}.bm-label--disabled label{opacity:var(--bm-sem-opacity-disabled)}.bm-label--required label:after{content:"*";color:var(--bm-sem-color-text-negative)}.bm-label--required label:has(:last-child):after{content:""}.bm-label--required label:has(:last-child)>*:last-child:after{content:"*";color:var(--bm-sem-color-text-negative)}.bm-label__optional{font:var(--bm-comp-label-typo-optional);margin-left:var(--bm-comp-label-space-gap)}.bm-label__tooltip{vertical-align:top;display:inline-block;margin-inline-start:var(--bm-comp-label-space-gap)}.bm-label__tooltip button{color:var(--bm-comp-tooltip-color-icon-trigger)}.bm-label__tooltip svg{height:var(--bm-comp-label-size-icon);width:var(--bm-comp-label-size-icon)}.bm-label--no-box{display:contents}';
8
- var w = Object.defineProperty, E = Object.getOwnPropertyDescriptor, g = (e) => {
1
+ import { r as $, a as P, E as k, x as d } from "../chunks/lit-element.CJtt9wj5.js";
2
+ import { n as s, c as C } from "../chunks/register-custom-element.vod7zfGv.js";
3
+ import { n as S } from "../chunks/query-assigned-nodes.Dgvsf6BR.js";
4
+ import { n as g, c as v, g as O } from "../chunks/classNames.C6fNrXWF.js";
5
+ import { t as w } from "../chunks/constants.jOWREYQE.js";
6
+ const E = ':root,:host,.bm-light,.bm-dark .bm-inverse,.bm-dark.bm-inverse,[data-bm-theme~=bm-dark] .bm-inverse,[data-bm-theme~=bm-dark].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-light]{--bm-comp-label-color-text: var(--bm-sem-color-text-secondary, #576775);--bm-comp-label-color-icon: var(--bm-sem-color-icon-secondary, #576775);--bm-comp-label-typo-default: var( --bm-sem-typo-label-sm, 600 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-optional: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-character-count: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-space-gap: var(--bm-sem-space-25, .25rem);--bm-comp-label-space-bottom: var(--bm-sem-space-50, .5rem);--bm-comp-label-size-icon: var(--bm-sem-size-icon-sm, 1rem)}:host,.bm-dark,.bm-light .bm-inverse,.bm-light.bm-inverse,[data-bm-theme~=bm-light] .bm-inverse,[data-bm-theme~=bm-light].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-dark]{--bm-comp-label-color-text: var(--bm-sem-color-text-secondary, #c3cdd5);--bm-comp-label-color-icon: var(--bm-sem-color-icon-secondary, #c3cdd5);--bm-comp-label-typo-default: var( --bm-sem-typo-label-sm, 600 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-optional: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-character-count: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-space-gap: var(--bm-sem-space-25, .25rem);--bm-comp-label-space-bottom: var(--bm-sem-space-50, .5rem);--bm-comp-label-size-icon: var(--bm-sem-size-icon-sm, 1rem)}.bm-label{color:var(--bm-comp-label-color-text);font:var(--bm-comp-label-typo-default);margin-bottom:var(--bm-comp-label-space-bottom, var(--bm-sem-space-0))}.bm-label label{cursor:var(--bm-comp-label-cursor, default);pointer-events:var(--bm-comp-label-pointer-events, inherit)}.bm-label--disabled label{opacity:var(--bm-sem-opacity-disabled)}.bm-label--required label:after{content:"*";color:var(--bm-sem-color-text-negative)}.bm-label--required label:has(:last-child):after{content:""}.bm-label--required label:has(:last-child)>*:last-child:after{content:"*";color:var(--bm-sem-color-text-negative)}.bm-label__optional{font:var(--bm-comp-label-typo-optional);margin-left:var(--bm-comp-label-space-gap)}.bm-label__tooltip{vertical-align:top;display:inline-block;margin-inline-start:var(--bm-comp-label-space-gap)}.bm-label__tooltip button{color:var(--bm-comp-tooltip-color-icon-trigger)}.bm-label__tooltip svg{height:var(--bm-comp-label-size-icon);width:var(--bm-comp-label-size-icon)}.bm-label--no-box{display:contents}';
7
+ var q = Object.defineProperty, N = Object.getOwnPropertyDescriptor, x = (e) => {
9
8
  throw TypeError(e);
10
- }, m = (e, t, a, b) => {
11
- for (var l = b > 1 ? void 0 : b ? E(t, a) : t, c = e.length - 1, n; c >= 0; c--)
12
- (n = e[c]) && (l = (b ? n(t, a, l) : n(l)) || l);
13
- return b && l && w(t, a, l), l;
14
- }, O = (e, t, a) => t.has(e) || g("Cannot " + a), r = (e, t, a) => (O(e, t, "read from private field"), a ? a.call(e) : t.get(e)), i = (e, t, a) => t.has(e) ? g("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, a), p, h, v, y;
15
- const { baseClassNamePrefix: N, subElementClassPrefix: z, classModifierPrefix: d } = C("label");
16
- let o = class extends S {
9
+ }, l = (e, t, a, i) => {
10
+ for (var r = i > 1 ? void 0 : i ? N(t, a) : t, c = e.length - 1, h; c >= 0; c--)
11
+ (h = e[c]) && (r = (i ? h(t, a, r) : h(r)) || r);
12
+ return i && r && q(t, a, r), r;
13
+ }, z = (e, t, a) => t.has(e) || x("Cannot " + a), m = (e, t, a) => (z(e, t, "read from private field"), a ? a.call(e) : t.get(e)), b = (e, t, a) => t.has(e) ? x("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, a), n, y, u, f;
14
+ const { baseClassNamePrefix: B, subElementClassPrefix: _, classModifierPrefix: p } = O("label");
15
+ let o = class extends P {
17
16
  constructor() {
18
- super(...arguments), this.disabled = !1, this.required = !1, i(this, p, () => !!(this.hasOptionalSlot || this.optional)), i(this, h, () => this.requestUpdate()), i(this, v, () => {
17
+ super(...arguments), this.disabled = !1, this.required = !1, b(this, n, () => this.requestUpdate()), b(this, y, () => {
18
+ if (this.for) {
19
+ const e = document.getElementById(this.for);
20
+ e == null || e.click();
21
+ }
19
22
  this.dispatchEvent(
20
23
  new CustomEvent("bm-label-click", {
21
24
  bubbles: !0,
22
25
  composed: !0
23
26
  })
24
27
  );
25
- }), i(this, y, () => u`
26
- <span
27
- class="${f(
28
- `${z}optional`,
29
- !r(this, p).call(this) && `${d}no-box`
28
+ }), b(this, u, () => d`
29
+ <span
30
+ class="${v(
31
+ `${_}optional`,
32
+ !this.hasOptional && `${p}no-box`
30
33
  )}"
31
- >
32
- <slot name="optional" @slotchange=${r(this, h)}>
33
- ${this.optional}
34
- </slot>
35
- </span>
36
- `);
34
+ >
35
+ <slot name="optional" @slotchange=${m(this, n)}> ${this.optional} </slot>
36
+ </span>
37
+ `), b(this, f, () => d`
38
+ <span
39
+ class="${v(
40
+ `${_}tooltip`,
41
+ !this.hasTooltipSlot && `${p}no-box`
42
+ )}"
43
+ >
44
+ <slot name="tooltip" @slotchange=${m(this, n)}></slot>
45
+ </span>
46
+ `);
37
47
  }
38
48
  get hasOptionalSlot() {
39
- return P(this.optionalNodes);
49
+ return g(this.optionalNodes);
50
+ }
51
+ get hasTooltipSlot() {
52
+ return g(this.tooltipNodes);
53
+ }
54
+ get hasOptional() {
55
+ return !!(this.hasOptionalSlot || this.optional);
40
56
  }
41
57
  render() {
42
- const e = f(
43
- N,
44
- this.theme && k(this.theme),
45
- this.disabled && `${d}disabled`,
46
- this.required && !r(this, p).call(this) && `${d}required`
58
+ const e = v(
59
+ B,
60
+ this.theme && w(this.theme),
61
+ this.disabled && `${p}disabled`,
62
+ this.required && !this.hasOptional && `${p}required`
47
63
  );
48
- return u`
64
+ return d`
49
65
  <div class="${e}">
50
- <label @click="${r(this, v)}">
66
+ <label for=${this.for || k} @click="${m(this, y)}">
51
67
  <slot name="text">${this.text}</slot>
52
- ${r(this, y).call(this)}
68
+ ${m(this, u).call(this)}
53
69
  </label>
54
- <slot name="tooltip"></slot>
70
+ ${m(this, f).call(this)}
55
71
  </div>
56
72
  `;
57
73
  }
58
74
  };
59
- p = /* @__PURE__ */ new WeakMap();
60
- h = /* @__PURE__ */ new WeakMap();
61
- v = /* @__PURE__ */ new WeakMap();
75
+ n = /* @__PURE__ */ new WeakMap();
62
76
  y = /* @__PURE__ */ new WeakMap();
63
- o.styles = _(q);
64
- m([
77
+ u = /* @__PURE__ */ new WeakMap();
78
+ f = /* @__PURE__ */ new WeakMap();
79
+ o.styles = $(E);
80
+ l([
65
81
  s({ type: Boolean })
66
82
  ], o.prototype, "disabled", 2);
67
- m([
83
+ l([
68
84
  s({ type: Boolean })
69
85
  ], o.prototype, "required", 2);
70
- m([
86
+ l([
71
87
  s({ type: String })
72
88
  ], o.prototype, "text", 2);
73
- m([
89
+ l([
74
90
  s({ type: String })
75
91
  ], o.prototype, "optional", 2);
76
- m([
92
+ l([
93
+ s({ type: String })
94
+ ], o.prototype, "for", 2);
95
+ l([
77
96
  s({ type: String })
78
97
  ], o.prototype, "theme", 2);
79
- m([
80
- x({ slot: "optional", flatten: !0 })
98
+ l([
99
+ S({ slot: "optional", flatten: !0 })
81
100
  ], o.prototype, "optionalNodes", 2);
82
- o = m([
83
- $("bm-label")
101
+ l([
102
+ S({ slot: "tooltip", flatten: !0 })
103
+ ], o.prototype, "tooltipNodes", 2);
104
+ o = l([
105
+ C("bm-label")
84
106
  ], o);
85
107
  export {
86
108
  o as BmLabel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-web-components",
3
- "version": "2.21.1",
3
+ "version": "2.23.0",
4
4
  "description": "Framework-agnostic web components for the Beam Design System built with Lit, compatible with Angular, Vue, Svelte, and vanilla JavaScript",
5
5
  "license": "MIT",
6
6
  "author": "Viasat",
@@ -64,11 +64,11 @@
64
64
  "access": "public"
65
65
  },
66
66
  "dependencies": {
67
- "@viasat/beam-fonts": "2.21.1",
68
- "@viasat/beam-shared": "2.21.1",
69
- "@viasat/beam-styles": "2.21.1",
70
- "@viasat/beam-tokens": "2.21.1",
71
- "@viasat/beam-icons": "2.21.1",
67
+ "@viasat/beam-fonts": "2.23.0",
68
+ "@viasat/beam-shared": "2.23.0",
69
+ "@viasat/beam-styles": "2.23.0",
70
+ "@viasat/beam-tokens": "2.23.0",
71
+ "@viasat/beam-icons": "2.23.0",
72
72
  "clsx": "^1.2.1",
73
73
  "lit": "^3.1.0",
74
74
  "@lit/context": "^1.1.1",