@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.155 → 2.0.0-next.157
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/LICENSE-AGPL.txt +661 -0
- package/LICENSE-APACHE.txt +177 -0
- package/LICENSE.txt +35 -0
- package/bundle/openbridge-webcomponents.bundle.js +3502 -3298
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +193 -31
- package/dist/automation/transmitter/transmitter-shared.d.ts +11 -0
- package/dist/automation/transmitter/transmitter-shared.d.ts.map +1 -0
- package/dist/automation/transmitter/transmitter-shared.js +16 -0
- package/dist/automation/transmitter/transmitter-shared.js.map +1 -0
- package/dist/automation/transmitter/transmitter.css.js +12 -1
- package/dist/automation/transmitter/transmitter.css.js.map +1 -1
- package/dist/automation/transmitter/transmitter.d.ts +9 -10
- package/dist/automation/transmitter/transmitter.d.ts.map +1 -1
- package/dist/automation/transmitter/transmitter.js +12 -15
- package/dist/automation/transmitter/transmitter.js.map +1 -1
- package/dist/automation/transmitter-button/transmitter-button.css.js +18 -42
- package/dist/automation/transmitter-button/transmitter-button.css.js.map +1 -1
- package/dist/automation/transmitter-button/transmitter-button.d.ts +31 -21
- package/dist/automation/transmitter-button/transmitter-button.d.ts.map +1 -1
- package/dist/automation/transmitter-button/transmitter-button.js +37 -39
- package/dist/automation/transmitter-button/transmitter-button.js.map +1 -1
- package/dist/automation/transmitter-stack/transmitter-stack.css.js +144 -0
- package/dist/automation/transmitter-stack/transmitter-stack.css.js.map +1 -0
- package/dist/automation/transmitter-stack/transmitter-stack.d.ts +93 -0
- package/dist/automation/transmitter-stack/transmitter-stack.d.ts.map +1 -0
- package/dist/automation/transmitter-stack/transmitter-stack.js +97 -0
- package/dist/automation/transmitter-stack/transmitter-stack.js.map +1 -0
- package/dist/building-blocks/readout-block/readout-block.d.ts +1 -1
- package/dist/building-blocks/readout-block/readout-block.js.map +1 -1
- package/dist/components/textarea-field/textarea-field.css.js +0 -2
- package/dist/components/textarea-field/textarea-field.css.js.map +1 -1
- package/dist/components/textbox/textbox.d.ts +1 -1
- package/dist/components/textbox/textbox.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.css.js +2 -23
- package/dist/navigation-instruments/readout/readout.css.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.d.ts +1 -1
- package/dist/navigation-instruments/readout/readout.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +1 -0
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js +3 -0
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
- package/package.json +6 -3
- package/script/prepare-full-bundle.ts +5 -0
- package/src/automation/transmitter/transmitter-shared.ts +16 -0
- package/src/automation/transmitter/transmitter.css +3 -71
- package/src/automation/transmitter/transmitter.stories.ts +13 -1
- package/src/automation/transmitter/transmitter.ts +19 -16
- package/src/automation/transmitter-button/transmitter-button.css +11 -36
- package/src/automation/transmitter-button/transmitter-button.stories.ts +3 -1
- package/src/automation/transmitter-button/transmitter-button.ts +62 -66
- package/src/automation/transmitter-stack/transmitter-stack.css +56 -0
- package/src/automation/transmitter-stack/transmitter-stack.spec.ts +210 -0
- package/src/automation/transmitter-stack/transmitter-stack.stories.ts +149 -0
- package/src/automation/transmitter-stack/transmitter-stack.ts +172 -0
- package/src/building-blocks/readout-block/readout-block.stories.ts +1 -1
- package/src/building-blocks/readout-block/readout-block.ts +1 -1
- package/src/components/textarea-field/textarea-field.css +1 -8
- package/src/components/textbox/textbox.stories.ts +1 -1
- package/src/components/textbox/textbox.ts +1 -1
- package/src/mixins/transmitter.css +90 -0
- package/src/mixins/visually-hidden.css +10 -0
- package/src/navigation-instruments/readout/readout.css +2 -22
- package/src/navigation-instruments/readout/readout.spec.ts +74 -1
- package/src/navigation-instruments/readout/readout.stories.ts +1 -1
- package/src/navigation-instruments/readout/readout.ts +1 -1
- package/src/navigation-instruments/readout-list-item/readout-list-item.css +1 -0
- package/src/navigation-instruments/readout-list-item/readout-list-item.stories.ts +1 -1
- package/src/navigation-instruments/readout-list-item/readout-list-item.ts +12 -2
|
@@ -3,7 +3,7 @@ import { property } from "lit/decorators.js";
|
|
|
3
3
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
4
|
import componentStyle from "./transmitter.css.js";
|
|
5
5
|
import { customElement } from "../../decorator.js";
|
|
6
|
-
import {
|
|
6
|
+
import { TransmitterOrientation, transmitterLeaderOffset } from "./transmitter-shared.js";
|
|
7
7
|
import { TransmitterButtonSize, TransmitterButtonVariant } from "../transmitter-button/transmitter-button.js";
|
|
8
8
|
import { ObcIndicatorGraphSize } from "../../navigation-instruments/indicator-graph/indicator-graph.js";
|
|
9
9
|
import { ObcAlertFrameType } from "../../components/alert-frame/alert-frame.js";
|
|
@@ -17,13 +17,6 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
17
|
if (kind && result) __defProp(target, key, result);
|
|
18
18
|
return result;
|
|
19
19
|
};
|
|
20
|
-
var TransmitterOrientation = /* @__PURE__ */ ((TransmitterOrientation2) => {
|
|
21
|
-
TransmitterOrientation2["top"] = "top";
|
|
22
|
-
TransmitterOrientation2["right"] = "right";
|
|
23
|
-
TransmitterOrientation2["bottom"] = "bottom";
|
|
24
|
-
TransmitterOrientation2["left"] = "left";
|
|
25
|
-
return TransmitterOrientation2;
|
|
26
|
-
})(TransmitterOrientation || {});
|
|
27
20
|
var TransmitterType = /* @__PURE__ */ ((TransmitterType2) => {
|
|
28
21
|
TransmitterType2["indicator"] = "indicator";
|
|
29
22
|
TransmitterType2["value"] = "value";
|
|
@@ -34,7 +27,7 @@ var TransmitterType = /* @__PURE__ */ ((TransmitterType2) => {
|
|
|
34
27
|
let ObcTransmitter = class extends LitElement {
|
|
35
28
|
constructor() {
|
|
36
29
|
super(...arguments);
|
|
37
|
-
this.orientation =
|
|
30
|
+
this.orientation = TransmitterOrientation.bottom;
|
|
38
31
|
this.type = "value";
|
|
39
32
|
this.lineType = void 0;
|
|
40
33
|
this.unit = "";
|
|
@@ -42,6 +35,7 @@ let ObcTransmitter = class extends LitElement {
|
|
|
42
35
|
this.maxDigits = 0;
|
|
43
36
|
this.hintedZeros = false;
|
|
44
37
|
this.hasSignSpacer = false;
|
|
38
|
+
this.hasDegree = false;
|
|
45
39
|
this.size = TransmitterButtonSize.regular;
|
|
46
40
|
this.hasIcon = false;
|
|
47
41
|
this.hasAdvice = false;
|
|
@@ -54,9 +48,6 @@ let ObcTransmitter = class extends LitElement {
|
|
|
54
48
|
get hasGraph() {
|
|
55
49
|
return this.type === "horizontal-graph" || this.type === "vertical-graph";
|
|
56
50
|
}
|
|
57
|
-
get lineOffset() {
|
|
58
|
-
return this.lineType === void 0 ? 0 : lineWidth(this.lineType) / 2;
|
|
59
|
-
}
|
|
60
51
|
renderButton() {
|
|
61
52
|
const isIndicator = this.type === "indicator";
|
|
62
53
|
return html`
|
|
@@ -70,12 +61,14 @@ let ObcTransmitter = class extends LitElement {
|
|
|
70
61
|
.maxDigits=${this.maxDigits}
|
|
71
62
|
.hintedZeros=${this.hintedZeros}
|
|
72
63
|
.hasSignSpacer=${this.hasSignSpacer}
|
|
64
|
+
.hasDegree=${this.hasDegree}
|
|
73
65
|
.hasIcon=${this.hasIcon}
|
|
74
66
|
.hasAdvice=${this.hasAdvice}
|
|
75
67
|
.adviceValue=${this.adviceValue}
|
|
76
68
|
.hasSetPoint=${this.hasSetPoint}
|
|
77
69
|
.setpointValue=${this.setpointValue}
|
|
78
70
|
.label=${this.tag}
|
|
71
|
+
.idTag=${this.idTag}
|
|
79
72
|
>
|
|
80
73
|
<slot name="icon" slot="icon"></slot>
|
|
81
74
|
</obc-transmitter-button>
|
|
@@ -100,7 +93,7 @@ let ObcTransmitter = class extends LitElement {
|
|
|
100
93
|
if (!this.idTag) {
|
|
101
94
|
return nothing;
|
|
102
95
|
}
|
|
103
|
-
return html`<div class="id-tag">${this.idTag}</div>`;
|
|
96
|
+
return html`<div class="id-tag" aria-hidden="true">${this.idTag}</div>`;
|
|
104
97
|
}
|
|
105
98
|
renderContent() {
|
|
106
99
|
return html`
|
|
@@ -128,7 +121,7 @@ let ObcTransmitter = class extends LitElement {
|
|
|
128
121
|
[`orientation-${this.orientation}`]: true,
|
|
129
122
|
[`type-${this.type}`]: true
|
|
130
123
|
})}
|
|
131
|
-
style="--offset: ${this.
|
|
124
|
+
style="--offset: ${transmitterLeaderOffset(this.lineType)}px;"
|
|
132
125
|
>
|
|
133
126
|
${content}
|
|
134
127
|
</div>
|
|
@@ -163,6 +156,9 @@ __decorateClass([
|
|
|
163
156
|
__decorateClass([
|
|
164
157
|
property({ type: Boolean })
|
|
165
158
|
], ObcTransmitter.prototype, "hasSignSpacer", 2);
|
|
159
|
+
__decorateClass([
|
|
160
|
+
property({ type: Boolean })
|
|
161
|
+
], ObcTransmitter.prototype, "hasDegree", 2);
|
|
166
162
|
__decorateClass([
|
|
167
163
|
property({ type: String })
|
|
168
164
|
], ObcTransmitter.prototype, "size", 2);
|
|
@@ -199,6 +195,7 @@ ObcTransmitter = __decorateClass([
|
|
|
199
195
|
export {
|
|
200
196
|
ObcTransmitter,
|
|
201
197
|
TransmitterOrientation,
|
|
202
|
-
TransmitterType
|
|
198
|
+
TransmitterType,
|
|
199
|
+
transmitterLeaderOffset
|
|
203
200
|
};
|
|
204
201
|
//# sourceMappingURL=transmitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transmitter.js","sources":["../../../src/automation/transmitter/transmitter.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './transmitter.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {LineType, lineWidth} from '../index.js';\nimport {\n TransmitterButtonSize,\n TransmitterButtonVariant,\n} from '../transmitter-button/transmitter-button.js';\nimport '../transmitter-button/transmitter-button.js';\nimport {\n ObcIndicatorGraphSize,\n type ObcIndicatorGraphLayout,\n} from '../../navigation-instruments/indicator-graph/indicator-graph.js';\nimport '../../navigation-instruments/indicator-graph/indicator-graph.js';\nimport {ObcAlertFrameType} from '../../components/alert-frame/alert-frame.js';\nimport '../../components/alert-frame/alert-frame.js';\n\nexport enum TransmitterOrientation {\n top = 'top',\n right = 'right',\n bottom = 'bottom',\n left = 'left',\n}\n\nexport enum TransmitterType {\n indicator = 'indicator',\n value = 'value',\n horizontalGraph = 'horizontal-graph',\n verticalGraph = 'vertical-graph',\n}\n\n/**\n * `<obc-transmitter>` – A readout label that attaches to a line on a process\n * diagram via a leader line, showing a measured value, a tag identifier, or a\n * value paired with a trend graph.\n *\n * Positioning (orientation + leader line) follows `<obc-automation-readout>`.\n * The value chip is an `<obc-transmitter-button>` and the trend is an\n * `<obc-indicator-graph>` with its area fill enabled.\n *\n * ### Features / Variants\n * - **`type`** – `indicator` (tag pill), `value` (icon/value/unit), or value\n * paired with a `horizontal-graph` (beside) or `vertical-graph` (below).\n * - **`orientation`** – `top`, `right`, `bottom`, `left`; controls which edge\n * the leader line attaches to.\n * - **Segments** – opt into a leading advice segment with `hasAdvice`/\n * `adviceValue` and a setpoint segment with `hasSetPoint`/`setpointValue`;\n * both are read-only and shown in the value chip for non-`indicator` types.\n * - **`hasAlert`** – wraps the whole transmitter in an alarm `<obc-alert-frame>`.\n * - **Formatting** – `fractionDigits`, `maxDigits`, `hintedZeros` and\n * `hasSignSpacer` are forwarded to the value chip to control decimal\n * precision, muted leading-zero padding (e.g. `0012.3`) and the sign\n * column. The advice and setpoint segments reuse the same formatting.\n * `value`, `adviceValue` and `setpointValue` render dashes when they are\n * `NaN`, `null` or `undefined`.\n *\n * ### Slots\n * | Slot Name | Conditions | Purpose |\n * |-----------|-------------------------|---------------------------------|\n * | icon | value/graph + `hasIcon` | Leading icon in the value chip. |\n *\n * @property maxDigits - Integer digits to reserve / hint (independent of `fractionDigits`).\n * @property hasSignSpacer - Reserve a minus-sign column on every segment, filled by the real sign\n * only while a value is negative, so the chip's width does not change\n * across zero.\n * @property hasAlert - Wrap the transmitter in an `<obc-alert-frame>` (alarm) when true.\n * @property adviceValue - Advisory value shown in the leading advice segment when `hasAdvice`.\n * @property setpointValue - Target value shown in the setpoint segment when `hasSetPoint`.\n * @property tag - Tag identifier shown when `type` is `indicator` (e.g. `TT`).\n * @property idTag - Optional identifier shown below the chip (e.g. `#0000`).\n * @property data - Trend data for the graph types: `[xValues, yValues]`.\n * @slot icon - Leading icon in the value chip.\n *\n * @experimental\n */\n@customElement('obc-transmitter')\nexport class ObcTransmitter extends LitElement {\n @property({type: String}) orientation: TransmitterOrientation =\n TransmitterOrientation.bottom;\n @property({type: String}) type: TransmitterType = TransmitterType.value;\n @property({type: String}) lineType: LineType | undefined = undefined;\n\n @property({type: Number}) value?: number | null;\n @property({type: String}) unit = '';\n @property({type: Number}) fractionDigits = 1;\n\n @property({type: Number}) maxDigits = 0;\n\n @property({type: Boolean}) hintedZeros = false;\n @property({type: Boolean}) hasSignSpacer = false;\n @property({type: String}) size: TransmitterButtonSize =\n TransmitterButtonSize.regular;\n @property({type: Boolean}) hasIcon = false;\n @property({type: Boolean}) hasAdvice = false;\n\n @property({type: Boolean}) hasAlert = false;\n\n @property({type: Number}) adviceValue?: number | null;\n\n @property({type: Boolean}) hasSetPoint = false;\n\n @property({type: Number}) setpointValue?: number | null;\n\n @property({type: String}) tag = '';\n\n @property({type: String}) idTag = '';\n\n @property({type: Array}) data: [number[], number[]] = [[], []];\n\n private get hasGraph() {\n return (\n this.type === TransmitterType.horizontalGraph ||\n this.type === TransmitterType.verticalGraph\n );\n }\n\n private get lineOffset() {\n return this.lineType === undefined ? 0 : lineWidth(this.lineType) / 2;\n }\n\n private renderButton() {\n const isIndicator = this.type === TransmitterType.indicator;\n return html`\n <obc-transmitter-button\n class=\"chip\"\n .variant=${isIndicator\n ? TransmitterButtonVariant.tag\n : TransmitterButtonVariant.value}\n .size=${this.size}\n .value=${this.value}\n .unit=${this.unit}\n .fractionDigits=${this.fractionDigits}\n .maxDigits=${this.maxDigits}\n .hintedZeros=${this.hintedZeros}\n .hasSignSpacer=${this.hasSignSpacer}\n .hasIcon=${this.hasIcon}\n .hasAdvice=${this.hasAdvice}\n .adviceValue=${this.adviceValue}\n .hasSetPoint=${this.hasSetPoint}\n .setpointValue=${this.setpointValue}\n .label=${this.tag}\n >\n <slot name=\"icon\" slot=\"icon\"></slot>\n </obc-transmitter-button>\n `;\n }\n\n private renderGraph() {\n if (!this.hasGraph) {\n return nothing;\n }\n const layout: ObcIndicatorGraphLayout = {\n size: ObcIndicatorGraphSize.small,\n fill: true,\n };\n return html`\n <div class=\"graph-box\">\n <obc-indicator-graph .data=${this.data} .layout=${layout}>\n </obc-indicator-graph>\n </div>\n `;\n }\n\n private renderLabel() {\n if (!this.idTag) {\n return nothing;\n }\n return html`<div class=\"id-tag\">${this.idTag}</div>`;\n }\n\n private renderContent() {\n return html`\n <div class=\"content\">\n <div class=\"body\">${this.renderButton()} ${this.renderGraph()}</div>\n ${this.renderLabel()}\n </div>\n `;\n }\n\n override render() {\n const content = this.hasAlert\n ? html`\n <obc-alert-frame\n class=\"alert-frame\"\n .type=${ObcAlertFrameType.Regular}\n .wrapContent=${true}\n >\n ${this.renderContent()}\n </obc-alert-frame>\n `\n : this.renderContent();\n\n return html`\n <div\n class=${classMap({\n transmitter: true,\n 'has-alert': this.hasAlert,\n [`orientation-${this.orientation}`]: true,\n [`type-${this.type}`]: true,\n })}\n style=\"--offset: ${this.lineOffset}px;\"\n >\n ${content}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-transmitter': ObcTransmitter;\n }\n}\n"],"names":["TransmitterOrientation","TransmitterType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AO;AAAA,GArBb,eAqBe,WAAA,eAAA,CAAA;AAEC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAvBd,eAuBgB,WAAA,eAAA,CAAA;AAED,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAzBb,eAyBe,WAAA,iBAAA,CAAA;AAEA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA3Bb,eA2Be,WAAA,OAAA,CAAA;AAEA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA7Bb,eA6Be,WAAA,SAAA,CAAA;AAED,gBAAA;AAAA,EAAxB,SAAS,EAAC,MAAM,MAAA,CAAM;AAAA,GA/BZ,eA+Bc,WAAA,QAAA,CAAA;AA/Bd,iBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,cAAA;"}
|
|
1
|
+
{"version":3,"file":"transmitter.js","sources":["../../../src/automation/transmitter/transmitter.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './transmitter.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {LineType} from '../index.js';\nimport {\n TransmitterOrientation,\n transmitterLeaderOffset,\n} from './transmitter-shared.js';\nimport {\n TransmitterButtonSize,\n TransmitterButtonVariant,\n} from '../transmitter-button/transmitter-button.js';\nimport '../transmitter-button/transmitter-button.js';\nimport {\n ObcIndicatorGraphSize,\n type ObcIndicatorGraphLayout,\n} from '../../navigation-instruments/indicator-graph/indicator-graph.js';\nimport '../../navigation-instruments/indicator-graph/indicator-graph.js';\nimport {ObcAlertFrameType} from '../../components/alert-frame/alert-frame.js';\nimport '../../components/alert-frame/alert-frame.js';\n\nexport {\n TransmitterOrientation,\n transmitterLeaderOffset,\n} from './transmitter-shared.js';\n\nexport enum TransmitterType {\n indicator = 'indicator',\n value = 'value',\n horizontalGraph = 'horizontal-graph',\n verticalGraph = 'vertical-graph',\n}\n\n/**\n * `<obc-transmitter>` – A readout label that attaches to a line via a leader\n * line, showing a measured value, a tag identifier, or a value paired with a\n * trend graph.\n *\n * Positioning (orientation + leader line) follows `<obc-automation-readout>`.\n * The value chip is an `<obc-transmitter-button>` and the trend is an\n * `<obc-indicator-graph>` with its area fill enabled.\n *\n * ### Features / Variants\n * - **`type`** – `indicator` (tag pill), `value` (icon/value/unit), or value\n * paired with a `horizontal-graph` (beside) or `vertical-graph` (below).\n * - **`orientation`** – `top`, `right`, `bottom`, `left`; controls which edge\n * the leader line attaches to.\n * - **Segments** – opt into a leading advice segment with `hasAdvice`/\n * `adviceValue` and a setpoint segment with `hasSetPoint`/`setpointValue`;\n * both are read-only and shown in the value chip for non-`indicator` types.\n * - **`hasAlert`** – wraps the whole transmitter in an alarm `<obc-alert-frame>`.\n * - **Formatting** – `fractionDigits`, `maxDigits`, `hintedZeros` and\n * `hasSignSpacer` are forwarded to the value chip to control decimal\n * precision, muted leading-zero padding (e.g. `0012.3`) and the sign\n * column. The advice and setpoint segments reuse the same formatting.\n * `hasDegree` adds a degree column between the value and the unit.\n * `value`, `adviceValue` and `setpointValue` render dashes when they are\n * `NaN`, `null` or `undefined`.\n *\n * ### Slots\n * | Slot Name | Conditions | Purpose |\n * |-----------|-------------------------|---------------------------------|\n * | icon | value/graph + `hasIcon` | Leading icon in the value chip. |\n *\n * @property maxDigits - Integer digits to reserve / hint (independent of `fractionDigits`).\n * @property hasSignSpacer - Reserve a minus-sign column on every segment, filled by the real sign\n * only while a value is negative, so the chip's width does not change\n * across zero.\n * @property hasDegree - Show a degree column between the value and the unit (e.g. `12.3°` then `C`).\n * @property hasAlert - Wrap the transmitter in an `<obc-alert-frame>` (alarm) when true.\n * @property adviceValue - Advisory value shown in the leading advice segment when `hasAdvice`.\n * @property setpointValue - Target value shown in the setpoint segment when `hasSetPoint`.\n * @property tag - Tag identifier shown when `type` is `indicator` (e.g. `TT`).\n * @property idTag - Optional identifier shown below the chip (e.g. `#0000`).\n * @property data - Trend data for the graph types: `[xValues, yValues]`.\n * @slot icon - Leading icon in the value chip.\n *\n * @experimental\n */\n@customElement('obc-transmitter')\nexport class ObcTransmitter extends LitElement {\n @property({type: String}) orientation: TransmitterOrientation =\n TransmitterOrientation.bottom;\n @property({type: String}) type: TransmitterType = TransmitterType.value;\n @property({type: String}) lineType: LineType | undefined = undefined;\n\n @property({type: Number}) value?: number | null;\n @property({type: String}) unit = '';\n @property({type: Number}) fractionDigits = 1;\n\n @property({type: Number}) maxDigits = 0;\n\n @property({type: Boolean}) hintedZeros = false;\n @property({type: Boolean}) hasSignSpacer = false;\n @property({type: Boolean}) hasDegree = false;\n @property({type: String}) size: TransmitterButtonSize =\n TransmitterButtonSize.regular;\n @property({type: Boolean}) hasIcon = false;\n @property({type: Boolean}) hasAdvice = false;\n\n @property({type: Boolean}) hasAlert = false;\n\n @property({type: Number}) adviceValue?: number | null;\n\n @property({type: Boolean}) hasSetPoint = false;\n\n @property({type: Number}) setpointValue?: number | null;\n\n @property({type: String}) tag = '';\n\n @property({type: String}) idTag = '';\n\n @property({type: Array}) data: [number[], number[]] = [[], []];\n\n private get hasGraph() {\n return (\n this.type === TransmitterType.horizontalGraph ||\n this.type === TransmitterType.verticalGraph\n );\n }\n\n private renderButton() {\n const isIndicator = this.type === TransmitterType.indicator;\n return html`\n <obc-transmitter-button\n class=\"chip\"\n .variant=${isIndicator\n ? TransmitterButtonVariant.tag\n : TransmitterButtonVariant.value}\n .size=${this.size}\n .value=${this.value}\n .unit=${this.unit}\n .fractionDigits=${this.fractionDigits}\n .maxDigits=${this.maxDigits}\n .hintedZeros=${this.hintedZeros}\n .hasSignSpacer=${this.hasSignSpacer}\n .hasDegree=${this.hasDegree}\n .hasIcon=${this.hasIcon}\n .hasAdvice=${this.hasAdvice}\n .adviceValue=${this.adviceValue}\n .hasSetPoint=${this.hasSetPoint}\n .setpointValue=${this.setpointValue}\n .label=${this.tag}\n .idTag=${this.idTag}\n >\n <slot name=\"icon\" slot=\"icon\"></slot>\n </obc-transmitter-button>\n `;\n }\n\n private renderGraph() {\n if (!this.hasGraph) {\n return nothing;\n }\n const layout: ObcIndicatorGraphLayout = {\n size: ObcIndicatorGraphSize.small,\n fill: true,\n };\n return html`\n <div class=\"graph-box\">\n <obc-indicator-graph .data=${this.data} .layout=${layout}>\n </obc-indicator-graph>\n </div>\n `;\n }\n\n private renderLabel() {\n if (!this.idTag) {\n return nothing;\n }\n return html`<div class=\"id-tag\" aria-hidden=\"true\">${this.idTag}</div>`;\n }\n\n private renderContent() {\n return html`\n <div class=\"content\">\n <div class=\"body\">${this.renderButton()} ${this.renderGraph()}</div>\n ${this.renderLabel()}\n </div>\n `;\n }\n\n override render() {\n const content = this.hasAlert\n ? html`\n <obc-alert-frame\n class=\"alert-frame\"\n .type=${ObcAlertFrameType.Regular}\n .wrapContent=${true}\n >\n ${this.renderContent()}\n </obc-alert-frame>\n `\n : this.renderContent();\n\n return html`\n <div\n class=${classMap({\n transmitter: true,\n 'has-alert': this.hasAlert,\n [`orientation-${this.orientation}`]: true,\n [`type-${this.type}`]: true,\n })}\n style=\"--offset: ${transmitterLeaderOffset(this.lineType)}px;\"\n >\n ${content}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-transmitter': ObcTransmitter;\n }\n}\n"],"names":["TransmitterType"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BO,IAAK,oCAAAA,qBAAL;AACLA,mBAAA,WAAA,IAAY;AACZA,mBAAA,OAAA,IAAQ;AACRA,mBAAA,iBAAA,IAAkB;AAClBA,mBAAA,eAAA,IAAgB;AAJN,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAsDL,IAAM,iBAAN,cAA6B,WAAW;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,c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A,GA9Bb,eA8Be,WAAA,SAAA,CAAA;AAED,gBAAA;AAAA,EAAxB,SAAS,EAAC,MAAM,MAAA,CAAM;AAAA,GAhCZ,eAgCc,WAAA,QAAA,CAAA;AAhCd,iBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,cAAA;"}
|
|
@@ -16,7 +16,7 @@ const componentStyle = css`* {
|
|
|
16
16
|
display: inline-flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
justify-content: center;
|
|
19
|
-
width:
|
|
19
|
+
width: 100%; /* follows the host: hugs by default, fills a stretched grid cell */
|
|
20
20
|
padding: 0;
|
|
21
21
|
appearance: none;
|
|
22
22
|
background: none;
|
|
@@ -92,58 +92,24 @@ const componentStyle = css`* {
|
|
|
92
92
|
cursor: not-allowed;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/* Figma draws the 1 px stroke inside its 4 / 2 px padding, so the padding
|
|
96
|
+
gives the border back and the chip stays 24 px high. */
|
|
97
|
+
|
|
95
98
|
.visible-wrapper {
|
|
96
99
|
display: inline-flex;
|
|
97
100
|
align-items: center;
|
|
98
|
-
|
|
99
|
-
padding: 2px 4px;
|
|
101
|
+
padding: 1px 3px;
|
|
100
102
|
border: 1px solid var(--normal-enabled-border-color);
|
|
101
103
|
border-radius: 4px;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
align-items: center;
|
|
107
|
-
gap: 2px;
|
|
108
|
-
padding: 0 2px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.icon {
|
|
112
|
-
display: inline-flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
justify-content: center;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.unit {
|
|
118
|
-
font-family: var(--global-typography-font-family);
|
|
119
|
-
font-size: var(--global-typography-instrument-unit-font-size);
|
|
120
|
-
line-height: var(--global-typography-instrument-unit-line-height);
|
|
121
|
-
font-feature-settings:
|
|
122
|
-
"liga" off,
|
|
123
|
-
"clig" off,
|
|
124
|
-
"ss04" on;
|
|
125
|
-
align-self: flex-end;
|
|
126
|
-
color: var(--element-neutral-color);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.size-regular .icon ::slotted(*) {
|
|
130
|
-
width: 16px;
|
|
131
|
-
height: 16px;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.size-medium .icon ::slotted(*) {
|
|
135
|
-
width: 20px;
|
|
136
|
-
height: 20px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.size-large .icon ::slotted(*) {
|
|
140
|
-
width: 24px;
|
|
141
|
-
height: 24px;
|
|
106
|
+
obc-readout-list-item {
|
|
107
|
+
width: auto; /* the list item fills a row by default; hugging lets a stretched chip centre the reading */
|
|
142
108
|
}
|
|
143
109
|
|
|
144
110
|
.size-medium .visible-wrapper:not(.tag),
|
|
145
111
|
.size-large .visible-wrapper:not(.tag) {
|
|
146
|
-
padding:
|
|
112
|
+
padding: 3px 7px;
|
|
147
113
|
border-radius: 6px;
|
|
148
114
|
}
|
|
149
115
|
|
|
@@ -164,6 +130,16 @@ const componentStyle = css`* {
|
|
|
164
130
|
"ss04" on;
|
|
165
131
|
color: var(--element-neutral-color);
|
|
166
132
|
}
|
|
133
|
+
|
|
134
|
+
.visually-hidden {
|
|
135
|
+
clip: rect(0 0 0 0);
|
|
136
|
+
clip-path: inset(50%);
|
|
137
|
+
height: 1px;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
position: absolute;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
width: 1px;
|
|
142
|
+
}
|
|
167
143
|
`;
|
|
168
144
|
export {
|
|
169
145
|
componentStyle as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transmitter-button.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transmitter-button.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import '../../
|
|
2
|
+
import '../../navigation-instruments/readout-list-item/readout-list-item.js';
|
|
3
3
|
export declare enum TransmitterButtonVariant {
|
|
4
4
|
value = "value",
|
|
5
5
|
tag = "tag"
|
|
@@ -10,24 +10,24 @@ export declare enum TransmitterButtonSize {
|
|
|
10
10
|
large = "large"
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* `<obc-transmitter-button>` – The pressable readout chip
|
|
14
|
-
* transmitter
|
|
13
|
+
* `<obc-transmitter-button>` – The pressable readout chip at the core of a
|
|
14
|
+
* transmitter: a bordered button around one reading.
|
|
15
15
|
*
|
|
16
|
-
* The
|
|
17
|
-
* value
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* provides the type-specific content.
|
|
16
|
+
* The reading is a label-less `<obc-readout-list-item>` (the Figma "automation
|
|
17
|
+
* value"): leading icon, optional advice and setpoint, value, optional degree
|
|
18
|
+
* and unit, all rendered by the readout family. The leading icon is slotted so
|
|
19
|
+
* the consumer provides the type-specific content.
|
|
21
20
|
*
|
|
22
21
|
* ### Features / Variants
|
|
23
|
-
* - **`value`** –
|
|
24
|
-
* leading advice segment with `hasAdvice`/`adviceValue
|
|
25
|
-
* with `hasSetPoint`/`setpointValue
|
|
22
|
+
* - **`value`** – bordered chip showing an icon, value and unit. Opt into a
|
|
23
|
+
* leading advice segment with `hasAdvice`/`adviceValue`, a setpoint segment
|
|
24
|
+
* with `hasSetPoint`/`setpointValue`, and a degree column before the unit
|
|
25
|
+
* with `hasDegree`.
|
|
26
26
|
* - **`tag`** – a static rounded pill showing a short identifier (e.g. `TT`)
|
|
27
27
|
* from the `label` property, with no live value.
|
|
28
|
-
* - **`size`** – `regular`, `medium` or `large`,
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* - **`size`** – `regular`, `medium` or `large`, the list item's `small`,
|
|
29
|
+
* `medium` and `large` tiers: the value text, the icon and the advice/setpoint
|
|
30
|
+
* segments scale, the unit stays extra small.
|
|
31
31
|
* - **Formatting** – `fractionDigits` sets the decimal precision, `maxDigits`
|
|
32
32
|
* reserves a number of integer digits, and `hintedZeros` renders the reserved
|
|
33
33
|
* leading positions as muted zeros (e.g. `0012.3`). The sign never consumes
|
|
@@ -40,9 +40,15 @@ export declare enum TransmitterButtonSize {
|
|
|
40
40
|
* dashes fill the whole reserved width (e.g. `---.-`).
|
|
41
41
|
*
|
|
42
42
|
* ### Usage Guidelines
|
|
43
|
-
* Use as a building block for `<obc-transmitter
|
|
44
|
-
* the measured value or the tag identifier. Slot in
|
|
45
|
-
* advice and setpoint segments are value-driven and
|
|
43
|
+
* Use as a building block for `<obc-transmitter>` and `<obc-transmitter-stack>`;
|
|
44
|
+
* it is the part that carries the measured value or the tag identifier. Slot in
|
|
45
|
+
* the type-specific icon; the advice and setpoint segments are value-driven and
|
|
46
|
+
* read-only.
|
|
47
|
+
*
|
|
48
|
+
* **TODO(designer):** the hit area is the visible chip, 24 px high at `regular`:
|
|
49
|
+
* at the WCAG 2.5.8 floor of 24 px, below the 48 px touch-target token. A
|
|
50
|
+
* 48 px target would overlap the id tag, the leader line and neighbouring
|
|
51
|
+
* `<obc-transmitter-stack>` segments, so the size needs a design decision.
|
|
46
52
|
*
|
|
47
53
|
* ### Slots
|
|
48
54
|
* | Slot Name | Conditions | Purpose |
|
|
@@ -52,9 +58,12 @@ export declare enum TransmitterButtonSize {
|
|
|
52
58
|
* @property maxDigits - Integer digits to reserve / hint (independent of `fractionDigits`).
|
|
53
59
|
* @property hasSignSpacer - Reserve a minus-sign column on every segment, filled by the real sign
|
|
54
60
|
* only while a value is negative, so the width does not change across zero.
|
|
61
|
+
* @property hasDegree - Show a degree column between the value and the unit (e.g. `12.3°` then `C`).
|
|
55
62
|
* @property adviceValue - Advisory value shown in the leading advice segment when `hasAdvice`.
|
|
56
63
|
* @property setpointValue - Target value shown in the setpoint segment when `hasSetPoint`.
|
|
57
64
|
* @property label - Short tag identifier shown in the `tag` variant (e.g. `TT`).
|
|
65
|
+
* @property idTag - Identifier appended to the button's accessible name only (e.g. `#0001`); the
|
|
66
|
+
* parent transmitter draws the visible tag outside the button, where it cannot join the name.
|
|
58
67
|
* @slot icon - Leading icon beside the value.
|
|
59
68
|
*
|
|
60
69
|
* @experimental
|
|
@@ -70,6 +79,8 @@ export declare class ObcTransmitterButton extends LitElement {
|
|
|
70
79
|
hintedZeros: boolean;
|
|
71
80
|
/** Reserve a minus-sign column on every segment, filled by the real sign only while a value is negative, so the width does not change across zero. */
|
|
72
81
|
hasSignSpacer: boolean;
|
|
82
|
+
/** Show a degree column between the value and the unit (e.g. `12.3°` then `C`). */
|
|
83
|
+
hasDegree: boolean;
|
|
73
84
|
hasIcon: boolean;
|
|
74
85
|
hasAdvice: boolean;
|
|
75
86
|
/** Advisory value shown in the leading advice segment when `hasAdvice`. */
|
|
@@ -79,11 +90,10 @@ export declare class ObcTransmitterButton extends LitElement {
|
|
|
79
90
|
setpointValue?: number | null;
|
|
80
91
|
/** Short tag identifier shown in the `tag` variant (e.g. `TT`). */
|
|
81
92
|
label: string;
|
|
93
|
+
/** Identifier appended to the button's accessible name only (e.g. `#0001`); the parent transmitter draws the visible tag outside the button, where it cannot join the name. */
|
|
94
|
+
idTag: string;
|
|
82
95
|
private get isTag();
|
|
83
|
-
private
|
|
84
|
-
private renderAdvice;
|
|
85
|
-
private renderSetpoint;
|
|
86
|
-
private renderContent;
|
|
96
|
+
private renderReading;
|
|
87
97
|
render(): import('lit-html').TemplateResult<1>;
|
|
88
98
|
static styles: import('lit').CSSResult;
|
|
89
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transmitter-button.d.ts","sourceRoot":"","sources":["../../../src/automation/transmitter-button/transmitter-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAKzD,OAAO,
|
|
1
|
+
{"version":3,"file":"transmitter-button.d.ts","sourceRoot":"","sources":["../../../src/automation/transmitter-button/transmitter-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAKzD,OAAO,qEAAqE,CAAC;AAG7E,oBAAY,wBAAwB;IAClC,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAED,oBAAY,qBAAqB;IAC/B,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,qBACa,oBAAqB,SAAQ,UAAU;IACxB,OAAO,EAAE,wBAAwB,CAC1B;IACP,IAAI,EAAE,qBAAqB,CACrB;IACN,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,SAAM;IACV,cAAc,SAAK;IAEnB,SAAS,SAAK;IAEb,WAAW,UAAS;IACpB,aAAa,UAAS;IACtB,SAAS,UAAS;IAClB,OAAO,UAAS;IAChB,SAAS,UAAS;IAEnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,WAAW,UAAS;IAErB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,KAAK,SAAM;IAEX,KAAK,SAAM;IAErC,OAAO,KAAK,KAAK,GAEhB;IAED,OAAO,CAAC,aAAa;IA4BZ,MAAM;IAqBf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,wBAAwB,EAAE,oBAAoB,CAAC;KAChD;CACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { unsafeCSS, LitElement,
|
|
1
|
+
import { unsafeCSS, LitElement, nothing, html } from "lit";
|
|
2
2
|
import { property } from "lit/decorators.js";
|
|
3
3
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
4
|
import componentStyle from "./transmitter-button.css.js";
|
|
5
5
|
import { customElement } from "../../decorator.js";
|
|
6
|
-
import {
|
|
6
|
+
import { ReadoutListItemSize } from "../../navigation-instruments/readout-list-item/readout-list-item.js";
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
9
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -29,15 +29,15 @@ const readoutSizeBySize = {
|
|
|
29
29
|
[
|
|
30
30
|
"regular"
|
|
31
31
|
/* regular */
|
|
32
|
-
]:
|
|
32
|
+
]: ReadoutListItemSize.small,
|
|
33
33
|
[
|
|
34
34
|
"medium"
|
|
35
35
|
/* medium */
|
|
36
|
-
]:
|
|
36
|
+
]: ReadoutListItemSize.medium,
|
|
37
37
|
[
|
|
38
38
|
"large"
|
|
39
39
|
/* large */
|
|
40
|
-
]:
|
|
40
|
+
]: ReadoutListItemSize.large
|
|
41
41
|
};
|
|
42
42
|
let ObcTransmitterButton = class extends LitElement {
|
|
43
43
|
constructor() {
|
|
@@ -49,48 +49,39 @@ let ObcTransmitterButton = class extends LitElement {
|
|
|
49
49
|
this.maxDigits = 0;
|
|
50
50
|
this.hintedZeros = false;
|
|
51
51
|
this.hasSignSpacer = false;
|
|
52
|
+
this.hasDegree = false;
|
|
52
53
|
this.hasIcon = false;
|
|
53
54
|
this.hasAdvice = false;
|
|
54
55
|
this.hasSetPoint = false;
|
|
55
56
|
this.label = "";
|
|
57
|
+
this.idTag = "";
|
|
56
58
|
}
|
|
57
59
|
get isTag() {
|
|
58
60
|
return this.variant === "tag";
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
.fractionDigits=${this.fractionDigits}
|
|
66
|
-
.maxDigits=${this.maxDigits}
|
|
67
|
-
.hintedZeros=${this.hintedZeros}
|
|
68
|
-
.hasSignSpacer=${this.hasSignSpacer}
|
|
69
|
-
></obc-readout-block>`;
|
|
70
|
-
}
|
|
71
|
-
renderAdvice() {
|
|
72
|
-
if (!this.hasAdvice) {
|
|
73
|
-
return nothing;
|
|
74
|
-
}
|
|
75
|
-
return this.renderBlock(ReadoutBlockVariant.advice, this.adviceValue);
|
|
76
|
-
}
|
|
77
|
-
renderSetpoint() {
|
|
78
|
-
if (!this.hasSetPoint) {
|
|
79
|
-
return nothing;
|
|
80
|
-
}
|
|
81
|
-
return this.renderBlock(ReadoutBlockVariant.setpoint, this.setpointValue);
|
|
82
|
-
}
|
|
83
|
-
renderContent() {
|
|
84
|
-
if (this.isTag) {
|
|
85
|
-
return html`<span class="label">${this.label}</span>`;
|
|
86
|
-
}
|
|
62
|
+
renderReading() {
|
|
63
|
+
const format = {
|
|
64
|
+
hintedZeros: this.hintedZeros,
|
|
65
|
+
hasSignSpacer: this.hasSignSpacer
|
|
66
|
+
};
|
|
87
67
|
return html`
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
68
|
+
<obc-readout-list-item
|
|
69
|
+
.size=${readoutSizeBySize[this.size]}
|
|
70
|
+
.value=${this.value ?? null}
|
|
71
|
+
.unit=${this.unit}
|
|
72
|
+
.hasDegree=${this.hasDegree}
|
|
73
|
+
.fractionDigits=${this.fractionDigits}
|
|
74
|
+
.maxDigits=${this.maxDigits}
|
|
75
|
+
.valueOptions=${{ ...format, hasIcon: this.hasIcon }}
|
|
76
|
+
.hasSetpoint=${this.hasSetPoint}
|
|
77
|
+
.setpoint=${this.setpointValue ?? void 0}
|
|
78
|
+
.setpointOptions=${format}
|
|
79
|
+
.hasAdvice=${this.hasAdvice}
|
|
80
|
+
.advice=${this.adviceValue ?? void 0}
|
|
81
|
+
.adviceOptions=${format}
|
|
82
|
+
>
|
|
83
|
+
${this.hasIcon ? html`<slot name="icon" slot="value-icon"></slot>` : nothing}
|
|
84
|
+
</obc-readout-list-item>
|
|
94
85
|
`;
|
|
95
86
|
}
|
|
96
87
|
render() {
|
|
@@ -103,8 +94,9 @@ let ObcTransmitterButton = class extends LitElement {
|
|
|
103
94
|
tag: this.isTag
|
|
104
95
|
})}
|
|
105
96
|
>
|
|
106
|
-
${this.
|
|
97
|
+
${this.isTag ? html`<span class="label">${this.label}</span>` : this.renderReading()}
|
|
107
98
|
</div>
|
|
99
|
+
${this.idTag ? html`<span class="visually-hidden">${this.idTag}</span>` : nothing}
|
|
108
100
|
</button>
|
|
109
101
|
`;
|
|
110
102
|
}
|
|
@@ -134,6 +126,9 @@ __decorateClass([
|
|
|
134
126
|
__decorateClass([
|
|
135
127
|
property({ type: Boolean })
|
|
136
128
|
], ObcTransmitterButton.prototype, "hasSignSpacer", 2);
|
|
129
|
+
__decorateClass([
|
|
130
|
+
property({ type: Boolean })
|
|
131
|
+
], ObcTransmitterButton.prototype, "hasDegree", 2);
|
|
137
132
|
__decorateClass([
|
|
138
133
|
property({ type: Boolean })
|
|
139
134
|
], ObcTransmitterButton.prototype, "hasIcon", 2);
|
|
@@ -152,6 +147,9 @@ __decorateClass([
|
|
|
152
147
|
__decorateClass([
|
|
153
148
|
property({ type: String })
|
|
154
149
|
], ObcTransmitterButton.prototype, "label", 2);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
property({ type: String })
|
|
152
|
+
], ObcTransmitterButton.prototype, "idTag", 2);
|
|
155
153
|
ObcTransmitterButton = __decorateClass([
|
|
156
154
|
customElement("obc-transmitter-button")
|
|
157
155
|
], ObcTransmitterButton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transmitter-button.js","sources":["../../../src/automation/transmitter-button/transmitter-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './transmitter-button.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../building-blocks/readout-block/readout-block.js';\nimport {\n ReadoutBlockSize,\n ReadoutBlockVariant,\n} from '../../building-blocks/readout-block/readout-block.js';\n\nexport enum TransmitterButtonVariant {\n value = 'value',\n tag = 'tag',\n}\n\nexport enum TransmitterButtonSize {\n regular = 'regular',\n medium = 'medium',\n large = 'large',\n}\n\nconst readoutSizeBySize: Record<TransmitterButtonSize, ReadoutBlockSize> = {\n [TransmitterButtonSize.regular]: ReadoutBlockSize.small,\n [TransmitterButtonSize.medium]: ReadoutBlockSize.medium,\n [TransmitterButtonSize.large]: ReadoutBlockSize.large,\n};\n\n/**\n * `<obc-transmitter-button>` – The pressable readout chip used as the core of a\n * transmitter on a process diagram.\n *\n * The value content (leading icon, optional advice and setpoint segments,\n * value, unit) is laid out inline. The value, advice and setpoint segments all\n * share one numeric format, so they support fixed-width values and muted\n * leading zeros identically. The leading icon is slotted so the consumer\n * provides the type-specific content.\n *\n * ### Features / Variants\n * - **`value`** – white, bordered box showing an icon, value and unit. Opt into a\n * leading advice segment with `hasAdvice`/`adviceValue` and a setpoint segment\n * with `hasSetPoint`/`setpointValue`.\n * - **`tag`** – a static rounded pill showing a short identifier (e.g. `TT`)\n * from the `label` property, with no live value.\n * - **`size`** – `regular`, `medium` or `large`, scaling the value text, the icon\n * glyph and the advice/setpoint segments. The unit stays at a fixed size across\n * all sizes.\n * - **Formatting** – `fractionDigits` sets the decimal precision, `maxDigits`\n * reserves a number of integer digits, and `hintedZeros` renders the reserved\n * leading positions as muted zeros (e.g. `0012.3`). The sign never consumes\n * a reserved position (`-0012.3`), so a negative value is one character\n * wider than a positive one; `hasSignSpacer` reserves the sign column so\n * the width does not change across zero. All three segments share this\n * formatting — it is `obc-readout-block`'s.\n * - **Missing values** – `value`, `adviceValue` and `setpointValue` each render\n * dashes when they are `NaN`, `null` or `undefined`; with `hintedZeros` the\n * dashes fill the whole reserved width (e.g. `---.-`).\n *\n * ### Usage Guidelines\n * Use as a building block for `<obc-transmitter>`; it is the part that carries\n * the measured value or the tag identifier. Slot in the type-specific icon; the\n * advice and setpoint segments are value-driven and read-only.\n *\n * ### Slots\n * | Slot Name | Conditions | Purpose |\n * |-----------|-------------------------------|--------------------------------|\n * | icon | `value` variant and `hasIcon` | Leading icon beside the value. |\n *\n * @property maxDigits - Integer digits to reserve / hint (independent of `fractionDigits`).\n * @property hasSignSpacer - Reserve a minus-sign column on every segment, filled by the real sign\n * only while a value is negative, so the width does not change across zero.\n * @property adviceValue - Advisory value shown in the leading advice segment when `hasAdvice`.\n * @property setpointValue - Target value shown in the setpoint segment when `hasSetPoint`.\n * @property label - Short tag identifier shown in the `tag` variant (e.g. `TT`).\n * @slot icon - Leading icon beside the value.\n *\n * @experimental\n */\n@customElement('obc-transmitter-button')\nexport class ObcTransmitterButton extends LitElement {\n @property({type: String}) variant: TransmitterButtonVariant =\n TransmitterButtonVariant.value;\n @property({type: String}) size: TransmitterButtonSize =\n TransmitterButtonSize.regular;\n @property({type: Number}) value?: number | null;\n @property({type: String}) unit = '';\n @property({type: Number}) fractionDigits = 1;\n\n @property({type: Number}) maxDigits = 0;\n\n @property({type: Boolean}) hintedZeros = false;\n @property({type: Boolean}) hasSignSpacer = false;\n @property({type: Boolean}) hasIcon = false;\n @property({type: Boolean}) hasAdvice = false;\n\n @property({type: Number}) adviceValue?: number | null;\n\n @property({type: Boolean}) hasSetPoint = false;\n\n @property({type: Number}) setpointValue?: number | null;\n\n @property({type: String}) label = '';\n\n private get isTag() {\n return this.variant === TransmitterButtonVariant.tag;\n }\n\n private renderBlock(\n variant: ReadoutBlockVariant,\n value: number | null | undefined\n ) {\n return html`<obc-readout-block\n .variant=${variant}\n .value=${value ?? null}\n .size=${readoutSizeBySize[this.size]}\n .fractionDigits=${this.fractionDigits}\n .maxDigits=${this.maxDigits}\n .hintedZeros=${this.hintedZeros}\n .hasSignSpacer=${this.hasSignSpacer}\n ></obc-readout-block>`;\n }\n\n private renderAdvice() {\n if (!this.hasAdvice) {\n return nothing;\n }\n return this.renderBlock(ReadoutBlockVariant.advice, this.adviceValue);\n }\n\n private renderSetpoint() {\n if (!this.hasSetPoint) {\n return nothing;\n }\n return this.renderBlock(ReadoutBlockVariant.setpoint, this.setpointValue);\n }\n\n private renderContent() {\n if (this.isTag) {\n return html`<span class=\"label\">${this.label}</span>`;\n }\n\n return html`\n ${this.renderAdvice()} ${this.renderSetpoint()}\n <div class=\"value-container\">\n ${this.hasIcon\n ? html`<div class=\"icon\"><slot name=\"icon\"></slot></div>`\n : nothing}\n ${this.renderBlock(ReadoutBlockVariant.value, this.value)}\n ${this.unit ? html`<span class=\"unit\">${this.unit}</span>` : nothing}\n </div>\n `;\n }\n\n override render() {\n return html`\n <button type=\"button\" class=\"button ${this.variant} size-${this.size}\">\n <div\n part=\"button\"\n class=${classMap({\n 'visible-wrapper': true,\n tag: this.isTag,\n })}\n >\n ${this.renderContent()}\n </div>\n </button>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-transmitter-button': ObcTransmitterButton;\n }\n}\n"],"names":["TransmitterButtonVariant","TransmitterButtonSize"],"mappings":";;;;;;;;;;;;;;;;AAWO,IAAK,6CAAAA,8BAAL;AACLA,4BAAA,OAAA,IAAQ;AACRA,4BAAA,KAAA,IAAM;AAFI,SAAAA;AAAA,GAAA,4BAAA,CAAA,CAAA;AAKL,IAAK,0CAAAC,2BAAL;AACLA,yBAAA,SAAA,IAAU;AACVA,yBAAA,QAAA,IAAS;AACTA,yBAAA,OAAA,IAAQ;AAHE,SAAAA;AAAA,GAAA,yBAAA,CAAA,CAAA;AAMZ,MAAM,oBAAqE;AAAA,EACzE;AAAA,IAAC;AAAA;AAAA,EAAA,GAAgC,iBAAiB;AAAA,EAClD;AAAA,IAAC;AAAA;AAAA,EAAA,GAA+B,iBAAiB;AAAA,EACjD;AAAA,IA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AA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAhBb,qBAgBe,WAAA,eAAA,CAAA;AAEC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAlBd,qBAkBgB,WAAA,eAAA,CAAA;AAED,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GApBb,qBAoBe,WAAA,iBAAA,CAAA;AAEA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAtBb,qBAsBe,WAAA,SAAA,CAAA;AAtBf,uBAAN,gBAAA;AAAA,EADN,cAAc,wBAAwB;AAAA,GAC1B,oBAAA;"}
|
|
1
|
+
{"version":3,"file":"transmitter-button.js","sources":["../../../src/automation/transmitter-button/transmitter-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './transmitter-button.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../navigation-instruments/readout-list-item/readout-list-item.js';\nimport {ReadoutListItemSize} from '../../navigation-instruments/readout-list-item/readout-list-item.js';\n\nexport enum TransmitterButtonVariant {\n value = 'value',\n tag = 'tag',\n}\n\nexport enum TransmitterButtonSize {\n regular = 'regular',\n medium = 'medium',\n large = 'large',\n}\n\nconst readoutSizeBySize: Record<TransmitterButtonSize, ReadoutListItemSize> = {\n [TransmitterButtonSize.regular]: ReadoutListItemSize.small,\n [TransmitterButtonSize.medium]: ReadoutListItemSize.medium,\n [TransmitterButtonSize.large]: ReadoutListItemSize.large,\n};\n\n/**\n * `<obc-transmitter-button>` – The pressable readout chip at the core of a\n * transmitter: a bordered button around one reading.\n *\n * The reading is a label-less `<obc-readout-list-item>` (the Figma \"automation\n * value\"): leading icon, optional advice and setpoint, value, optional degree\n * and unit, all rendered by the readout family. The leading icon is slotted so\n * the consumer provides the type-specific content.\n *\n * ### Features / Variants\n * - **`value`** – bordered chip showing an icon, value and unit. Opt into a\n * leading advice segment with `hasAdvice`/`adviceValue`, a setpoint segment\n * with `hasSetPoint`/`setpointValue`, and a degree column before the unit\n * with `hasDegree`.\n * - **`tag`** – a static rounded pill showing a short identifier (e.g. `TT`)\n * from the `label` property, with no live value.\n * - **`size`** – `regular`, `medium` or `large`, the list item's `small`,\n * `medium` and `large` tiers: the value text, the icon and the advice/setpoint\n * segments scale, the unit stays extra small.\n * - **Formatting** – `fractionDigits` sets the decimal precision, `maxDigits`\n * reserves a number of integer digits, and `hintedZeros` renders the reserved\n * leading positions as muted zeros (e.g. `0012.3`). The sign never consumes\n * a reserved position (`-0012.3`), so a negative value is one character\n * wider than a positive one; `hasSignSpacer` reserves the sign column so\n * the width does not change across zero. All three segments share this\n * formatting — it is `obc-readout-block`'s.\n * - **Missing values** – `value`, `adviceValue` and `setpointValue` each render\n * dashes when they are `NaN`, `null` or `undefined`; with `hintedZeros` the\n * dashes fill the whole reserved width (e.g. `---.-`).\n *\n * ### Usage Guidelines\n * Use as a building block for `<obc-transmitter>` and `<obc-transmitter-stack>`;\n * it is the part that carries the measured value or the tag identifier. Slot in\n * the type-specific icon; the advice and setpoint segments are value-driven and\n * read-only.\n *\n * **TODO(designer):** the hit area is the visible chip, 24 px high at `regular`:\n * at the WCAG 2.5.8 floor of 24 px, below the 48 px touch-target token. A\n * 48 px target would overlap the id tag, the leader line and neighbouring\n * `<obc-transmitter-stack>` segments, so the size needs a design decision.\n *\n * ### Slots\n * | Slot Name | Conditions | Purpose |\n * |-----------|-------------------------------|--------------------------------|\n * | icon | `value` variant and `hasIcon` | Leading icon beside the value. |\n *\n * @property maxDigits - Integer digits to reserve / hint (independent of `fractionDigits`).\n * @property hasSignSpacer - Reserve a minus-sign column on every segment, filled by the real sign\n * only while a value is negative, so the width does not change across zero.\n * @property hasDegree - Show a degree column between the value and the unit (e.g. `12.3°` then `C`).\n * @property adviceValue - Advisory value shown in the leading advice segment when `hasAdvice`.\n * @property setpointValue - Target value shown in the setpoint segment when `hasSetPoint`.\n * @property label - Short tag identifier shown in the `tag` variant (e.g. `TT`).\n * @property idTag - Identifier appended to the button's accessible name only (e.g. `#0001`); the\n * parent transmitter draws the visible tag outside the button, where it cannot join the name.\n * @slot icon - Leading icon beside the value.\n *\n * @experimental\n */\n@customElement('obc-transmitter-button')\nexport class ObcTransmitterButton extends LitElement {\n @property({type: String}) variant: TransmitterButtonVariant =\n TransmitterButtonVariant.value;\n @property({type: String}) size: TransmitterButtonSize =\n TransmitterButtonSize.regular;\n @property({type: Number}) value?: number | null;\n @property({type: String}) unit = '';\n @property({type: Number}) fractionDigits = 1;\n\n @property({type: Number}) maxDigits = 0;\n\n @property({type: Boolean}) hintedZeros = false;\n @property({type: Boolean}) hasSignSpacer = false;\n @property({type: Boolean}) hasDegree = false;\n @property({type: Boolean}) hasIcon = false;\n @property({type: Boolean}) hasAdvice = false;\n\n @property({type: Number}) adviceValue?: number | null;\n\n @property({type: Boolean}) hasSetPoint = false;\n\n @property({type: Number}) setpointValue?: number | null;\n\n @property({type: String}) label = '';\n\n @property({type: String}) idTag = '';\n\n private get isTag() {\n return this.variant === TransmitterButtonVariant.tag;\n }\n\n private renderReading() {\n const format = {\n hintedZeros: this.hintedZeros,\n hasSignSpacer: this.hasSignSpacer,\n };\n return html`\n <obc-readout-list-item\n .size=${readoutSizeBySize[this.size]}\n .value=${this.value ?? null}\n .unit=${this.unit}\n .hasDegree=${this.hasDegree}\n .fractionDigits=${this.fractionDigits}\n .maxDigits=${this.maxDigits}\n .valueOptions=${{...format, hasIcon: this.hasIcon}}\n .hasSetpoint=${this.hasSetPoint}\n .setpoint=${this.setpointValue ?? undefined}\n .setpointOptions=${format}\n .hasAdvice=${this.hasAdvice}\n .advice=${this.adviceValue ?? undefined}\n .adviceOptions=${format}\n >\n ${this.hasIcon\n ? html`<slot name=\"icon\" slot=\"value-icon\"></slot>`\n : nothing}\n </obc-readout-list-item>\n `;\n }\n\n override render() {\n return html`\n <button type=\"button\" class=\"button ${this.variant} size-${this.size}\">\n <div\n part=\"button\"\n class=${classMap({\n 'visible-wrapper': true,\n tag: this.isTag,\n })}\n >\n ${this.isTag\n ? html`<span class=\"label\">${this.label}</span>`\n : this.renderReading()}\n </div>\n ${this.idTag\n ? html`<span class=\"visually-hidden\">${this.idTag}</span>`\n : nothing}\n </button>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-transmitter-button': ObcTransmitterButton;\n }\n}\n"],"names":["TransmitterButtonVariant","TransmitterButtonSize"],"mappings":";;;;;;;;;;;;;;;;AAQO,IAAK,6CAAAA,8BAAL;AACLA,4BAAA,OAAA,IAAQ;AACRA,4BAAA,KAAA,IAAM;AAFI,SAAAA;AAAA,GAAA,4BAAA,CAAA,CAAA;AAKL,IAAK,0CAAAC,2BAAL;AACLA,yBAAA,SAAA,IAAU;AACVA,yBAAA,QAAA,IAAS;AACTA,yBAAA,OAAA,IAAQ;AAHE,SAAAA;AAAA,GAAA,yBAAA,CAAA,CAAA;AAMZ,MAAM,oBAAwE;AAAA,EAC5E;AAAA,IAAC;AAAA;AAAA,EAAA,GAAgC,oBAAoB;AAAA,EACrD;AAAA,IAAC;AAAA;AAAA,EAAA,GAA+B,oBAAoB;AAAA,EACpD;AAAA,IAAC;AAAA;AAAA,EAAA,GAA8B,oBAAoB;AACrD;AA8DO,IAAM,uBAAN,cAAmC,WAAW;AAAA,EAA9C,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,UACxB;AACwB,SAAA,OACxB;AAEwB,SAAA,OAAO;AACP,SAAA,iBAAiB;AAEjB,SAAA,YAAY;AAEX,SAAA,cAAc;AACd,SAAA,gBAAgB;AAChB,SAAA,YAAY;AACZ,SAAA,UAAU;AACV,SAAA,YAAY;AAIZ,SAAA,cAAc;AAIf,SAAA,QAAQ;AAER,SAAA,QAAQ;AAAA,EAAA;AAAA,EAElC,IAAY,QAAQ;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