@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.129 → 2.0.0-next.131
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/bundle/openbridge-webcomponents.bundle.js +39 -7
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +35 -3
- package/dist/building-blocks/readout-block/readout-block.d.ts +9 -2
- package/dist/building-blocks/readout-block/readout-block.d.ts.map +1 -1
- package/dist/building-blocks/readout-block/readout-block.js +17 -6
- package/dist/building-blocks/readout-block/readout-block.js.map +1 -1
- package/dist/components/modal-window/modal-window.css.js +5 -0
- package/dist/components/modal-window/modal-window.css.js.map +1 -1
- package/dist/components/modal-window/modal-window.d.ts +8 -0
- package/dist/components/modal-window/modal-window.d.ts.map +1 -1
- package/dist/components/modal-window/modal-window.js.map +1 -1
- package/dist/components/progress-bar/progress-bar.css.js +8 -0
- package/dist/components/progress-bar/progress-bar.css.js.map +1 -1
- package/dist/components/progress-bar/progress-bar.d.ts +11 -0
- package/dist/components/progress-bar/progress-bar.d.ts.map +1 -1
- package/dist/components/progress-bar/progress-bar.js +12 -1
- package/dist/components/progress-bar/progress-bar.js.map +1 -1
- package/package.json +1 -1
- package/src/building-blocks/readout-block/readout-block.ts +17 -6
- package/src/components/modal-window/modal-window-sizing.stories.ts +155 -0
- package/src/components/modal-window/modal-window.css +5 -0
- package/src/components/modal-window/modal-window.ts +8 -0
- package/src/components/progress-bar/progress-bar.css +8 -0
- package/src/components/progress-bar/progress-bar.stories.ts +23 -0
- package/src/components/progress-bar/progress-bar.ts +18 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {styleMap} from 'lit/directives/style-map.js';\nimport componentStyle from './progress-bar.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../icons/icon-placeholder.js';\nimport {CircularProgressMode} from '../../building-blocks/circular-progress/circular-progress.js';\n\nexport enum ProgressBarType {\n linear = 'linear',\n circular = 'circular',\n}\n\nexport enum ProgressBarMode {\n determinate = 'determinate',\n indeterminate = 'indeterminate',\n}\n\nexport enum CircularProgressState {\n determinate = 'determinate',\n indeterminate = 'indeterminate',\n icon = 'icon',\n}\n\n/**\n * `<obc-progress-bar>` – A status-only progress indicator (progress meter / spinner /\n * loading indicator) for visualizing how far a task has advanced.\n *\n * Displays the progress of an ongoing operation either as a horizontal bar or as a circular\n * ring. Unlike `<obc-progress-button>`, this is a passive, non-interactive display element:\n * it shows status only and emits no events. Use it to communicate determinate progress\n * (a known percentage) or an open-ended \"working\" state.\n *\n * ## Features / Variants\n *\n * **Layout types (`type`)**\n * - **Linear** (default): A horizontal bar with an optional value label above and an optional\n * description below. Best inline within content where horizontal space is available.\n * - **Circular**: A ring with centered content. Best for compact, icon-led, or centered status.\n *\n * **Linear modes (`mode`)**\n * - **Determinate** (default): Fills proportionally to `value` (0–100); the label shows the\n * rounded percentage.\n * - **Indeterminate**: Animated, looping fill for work of unknown duration; the label shows\n * \"Loading\".\n *\n * **Circular states (`circularState`)**\n * - **Determinate**: Ring fills to `value`, with the rounded number (and optional `%` unit) centered.\n * - **Indeterminate**: Animated ring with the `icon` slot centered.\n * - **Icon**: A full ring acting as a frame around the centered `icon` slot (defaults to a placeholder).\n *\n * **Circular progressive indeterminate (`progressiveIndeterminate`)**\n * - A spinning arc that also grows with `value`, blending an indeterminate animation with a\n * numeric readout. Takes precedence over `circularState` when enabled.\n *\n * ## Usage Guidelines\n *\n * Use a progress bar to report the status of a task the user is waiting on. Choose\n * **determinate** when the completion percentage is known and **indeterminate** when it is not.\n * Pick the **linear** type for inline, full-width contexts and the **circular** type for compact\n * or centered placements. Because this component is display-only, pair it with a separate\n * control (such as `<obc-progress-button>`) when the user also needs to trigger or cancel the action.\n *\n * ## Slots\n *\n * | Slot | Renders When... | Purpose |\n * | ------ | ----------------------------------------------------------- | ----------------------------------------- |\n * | `icon` | `type=\"circular\"` && `circularState` is `indeterminate` or `icon` | Centered icon inside the circular ring. |\n *\n * @example\n * ```html\n * <obc-progress-bar\n * type=\"linear\"\n * mode=\"determinate\"\n * value=\"65\"\n * showValue\n * hasDescription\n * description=\"Uploading files...\"\n * ></obc-progress-bar>\n * ```\n *\n * @slot icon - Centered icon for the circular `indeterminate` and `icon` states.\n * @stable\n */\n@customElement('obc-progress-bar')\nexport class ObcProgressBar extends LitElement {\n /** Layout type: `linear` (horizontal bar) or `circular` (ring). */\n @property({type: String}) type: ProgressBarType = ProgressBarType.linear;\n /**\n * Progress mode: `determinate` tracks `value`, `indeterminate` loops indefinitely.\n * @availableWhen type==linear\n */\n @property({type: String}) mode: ProgressBarMode = ProgressBarMode.determinate;\n /**\n * Circular display state: `determinate` (numeric ring), `indeterminate` (animated ring with\n * icon), or `icon` (ring framing the icon slot).\n * @availableWhen type==circular\n */\n @property({type: String}) circularState: CircularProgressState =\n CircularProgressState.determinate;\n /** Progress percentage (0–100); clamped when rendered. */\n @property({type: Number}) value = 0;\n /**\n * Shows the value label above the bar (percentage when determinate, \"Loading\" when indeterminate).\n * @availableWhen type==linear\n */\n @property({type: Boolean}) showValue = false;\n /**\n * Appends a `%` unit next to the centered value.\n * @availableWhen type==circular && (progressiveIndeterminate==true || circularState==determinate)\n */\n @property({type: Boolean}) showUnit = false;\n /**\n * Shows the `description` text below the bar.\n * @availableWhen type==linear\n */\n @property({type: Boolean}) hasDescription = false;\n /**\n * Description text rendered below the bar.\n * @availableWhen type==linear && hasDescription==true\n */\n @property({type: String}) description = 'Description text';\n /**\n * Shows the `stateLabel` next to the value.\n *\n * **TODO(designer):** Confirm the intended purpose of the state indicator — the story labels\n * this a \"future feature\".\n * @availableWhen type==linear && showValue==true && mode==determinate\n */\n @property({type: Boolean}) showState = false;\n /**\n * Text shown alongside the value when `showState` is enabled.\n * @availableWhen type==linear && showValue==true && mode==determinate && showState==true\n */\n @property({type: String}) stateLabel = 'Open';\n /**\n * Uses a progressive indeterminate ring (spinning arc that grows with `value`); takes\n * precedence over `circularState`.\n * @availableWhen type==circular\n */\n @property({type: Boolean}) progressiveIndeterminate = false;\n\n override render() {\n if (this.type === ProgressBarType.circular) {\n return this.renderCircularProgress();\n }\n\n return this.renderLinearProgress();\n }\n\n private getCircularProgressMode(): CircularProgressMode {\n if (this.progressiveIndeterminate) {\n return CircularProgressMode.progressiveIndeterminate;\n }\n if (this.circularState === CircularProgressState.icon) {\n return CircularProgressMode.determinate;\n }\n if (this.circularState === CircularProgressState.indeterminate) {\n return CircularProgressMode.indeterminate;\n }\n return CircularProgressMode.determinate;\n }\n\n private renderCircularProgress() {\n const progressValue =\n this.circularState === CircularProgressState.icon ? 100 : this.value;\n\n return html`\n <div class=\"circular-wrapper\">\n <obc-circular-progress\n .mode=${this.getCircularProgressMode()}\n .value=${progressValue}\n .viewBoxSize=${48}\n .strokeWidth=${4}\n ></obc-circular-progress>\n\n <div class=\"circular-content\">${this.renderCircularContent()}</div>\n </div>\n `;\n }\n\n private renderCircularContent() {\n if (this.progressiveIndeterminate) {\n return html`\n <div class=\"circular-label-container\">\n <span class=\"circular-value\">${Math.round(this.value)}</span>\n ${this.showUnit\n ? html`<span class=\"circular-unit\">%</span>`\n : nothing}\n </div>\n `;\n }\n\n if (this.circularState === CircularProgressState.determinate) {\n return html`\n <div class=\"circular-label-container\">\n <span class=\"circular-value\">${Math.round(this.value)}</span>\n ${this.showUnit\n ? html`<span class=\"circular-unit\">%</span>`\n : nothing}\n </div>\n `;\n } else if (this.circularState === CircularProgressState.indeterminate) {\n return html`\n <div class=\"circular-label-container\">\n <span class=\"circular-value\">\n <slot name=\"icon\">...</slot>\n </span>\n </div>\n `;\n } else {\n return html`\n <div class=\"circular-icon-container\">\n <slot name=\"icon\">\n <obi-placeholder></obi-placeholder>\n </slot>\n </div>\n `;\n }\n }\n\n private renderLinearProgress() {\n const clampedValue = Math.max(0, Math.min(100, this.value));\n const progressWidth = `${clampedValue}%`;\n\n return html`\n <div class=\"wrapper\">\n ${this.showValue ? this.renderLabel() : ''}\n\n <div class=\"bar\">\n ${this.mode === ProgressBarMode.determinate\n ? html`\n <div\n class=\"loaded\"\n style=${styleMap({width: progressWidth})}\n ></div>\n `\n : html` <div class=\"indeterminate-track\"></div> `}\n </div>\n\n ${this.hasDescription\n ? html`\n <div class=\"description-container\">\n <span class=\"description-text\">${this.description}</span>\n </div>\n `\n : nothing}\n </div>\n `;\n }\n\n private renderLabel() {\n if (this.mode === ProgressBarMode.determinate) {\n return html`\n <div class=\"label-container\">\n <div class=\"value-frame\">\n <span class=\"value-number\">${Math.round(this.value)}</span>\n <span class=\"value-unit\">%</span>\n </div>\n ${this.showState\n ? html` <span class=\"state\">${this.stateLabel}</span> `\n : nothing}\n </div>\n `;\n } else {\n return html`\n <div class=\"label-container\">\n <span class=\"loading-text\">Loading</span>\n </div>\n `;\n }\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-progress-bar': ObcProgressBar;\n }\n}\n"],"names":["ProgressBarType","ProgressBarMode","CircularProgressState"],"mappings":";;;;;;;;;;;;;;;;;AAQO,IAAK,oCAAAA,qBAAL;AACLA,mBAAA,QAAA,IAAS;AACTA,mBAAA,UAAA,IAAW;AAFD,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAKL,IAAK,oCAAAC,qBAAL;AACLA,mBAAA,aAAA,IAAc;AACdA,mBAAA,eAAA,IAAgB;AAFN,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAKL,IAAK,0CAAAC,2BAAL;AACLA,yBAAA,aAAA,IAAc;AACdA,yBAAA,eAAA,IAAgB;AAChBA,yBAAA,MAAA,IAAO;AAHG,SAAAA;AAAA,GAAA,yBAAA,CAAA,CAAA;AAmEL,IAAM,iBAAN,cAA6B,WAAW;AAAA,EAAxC,cAAA;AAAA,UAA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,GAhBb,eAgBe,WAAA,SAAA,CAAA;AAKC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GArBd,eAqBgB,WAAA,aAAA,CAAA;AAKA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA1Bd,eA0BgB,WAAA,YAAA,CAAA;AAKA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA/Bd,eA+BgB,WAAA,kBAAA,CAAA;AAKD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GApCb,eAoCe,WAAA,eAAA,CAAA;AAQC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA5Cd,eA4CgB,WAAA,aAAA,CAAA;AAKD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAjDb,eAiDe,WAAA,cAAA,CAAA;AAMC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAvDd,eAuDgB,WAAA,4BAAA,CAAA;AAvDhB,iBAAN,gBAAA;AAAA,EADN,cAAc,kBAAkB;AAAA,GACpB,cAAA;"}
|
|
1
|
+
{"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\nimport componentStyle from './progress-bar.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../icons/icon-placeholder.js';\nimport {CircularProgressMode} from '../../building-blocks/circular-progress/circular-progress.js';\nimport {Priority} from '../../navigation-instruments/types.js';\n\nexport {Priority};\n\nexport enum ProgressBarType {\n linear = 'linear',\n circular = 'circular',\n}\n\nexport enum ProgressBarMode {\n determinate = 'determinate',\n indeterminate = 'indeterminate',\n}\n\nexport enum CircularProgressState {\n determinate = 'determinate',\n indeterminate = 'indeterminate',\n icon = 'icon',\n}\n\n/**\n * `<obc-progress-bar>` – A status-only progress indicator (progress meter / spinner /\n * loading indicator) for visualizing how far a task has advanced.\n *\n * Displays the progress of an ongoing operation either as a horizontal bar or as a circular\n * ring. Unlike `<obc-progress-button>`, this is a passive, non-interactive display element:\n * it shows status only and emits no events. Use it to communicate determinate progress\n * (a known percentage) or an open-ended \"working\" state.\n *\n * ## Features / Variants\n *\n * **Layout types (`type`)**\n * - **Linear** (default): A horizontal bar with an optional value label above and an optional\n * description below. Best inline within content where horizontal space is available.\n * - **Circular**: A ring with centered content. Best for compact, icon-led, or centered status.\n *\n * **Linear modes (`mode`)**\n * - **Determinate** (default): Fills proportionally to `value` (0–100); the label shows the\n * rounded percentage.\n * - **Indeterminate**: Animated, looping fill for work of unknown duration; the label shows\n * \"Loading\".\n *\n * **Color priority (`priority`)**\n * - **Enhanced** (default): Blue fill, for a bar that reads as the primary value.\n * - **Regular**: Neutral gray fill, for a bar that should recede as ancillary status.\n *\n * **Circular states (`circularState`)**\n * - **Determinate**: Ring fills to `value`, with the rounded number (and optional `%` unit) centered.\n * - **Indeterminate**: Animated ring with the `icon` slot centered.\n * - **Icon**: A full ring acting as a frame around the centered `icon` slot (defaults to a placeholder).\n *\n * **Circular progressive indeterminate (`progressiveIndeterminate`)**\n * - A spinning arc that also grows with `value`, blending an indeterminate animation with a\n * numeric readout. Takes precedence over `circularState` when enabled.\n *\n * ## Usage Guidelines\n *\n * Use a progress bar to report the status of a task the user is waiting on. Choose\n * **determinate** when the completion percentage is known and **indeterminate** when it is not.\n * Pick the **linear** type for inline, full-width contexts and the **circular** type for compact\n * or centered placements. Because this component is display-only, pair it with a separate\n * control (such as `<obc-progress-button>`) when the user also needs to trigger or cancel the action.\n *\n * ## Slots\n *\n * | Slot | Renders When... | Purpose |\n * | ------ | ----------------------------------------------------------- | ----------------------------------------- |\n * | `icon` | `type=\"circular\"` && `circularState` is `indeterminate` or `icon` | Centered icon inside the circular ring. |\n *\n * @example\n * ```html\n * <obc-progress-bar\n * type=\"linear\"\n * mode=\"determinate\"\n * value=\"65\"\n * showValue\n * hasDescription\n * description=\"Uploading files...\"\n * ></obc-progress-bar>\n * ```\n *\n * @slot icon - Centered icon for the circular `indeterminate` and `icon` states.\n * @stable\n */\n@customElement('obc-progress-bar')\nexport class ObcProgressBar extends LitElement {\n /** Layout type: `linear` (horizontal bar) or `circular` (ring). */\n @property({type: String}) type: ProgressBarType = ProgressBarType.linear;\n /**\n * Progress mode: `determinate` tracks `value`, `indeterminate` loops indefinitely.\n * @availableWhen type==linear\n */\n @property({type: String}) mode: ProgressBarMode = ProgressBarMode.determinate;\n /**\n * Circular display state: `determinate` (numeric ring), `indeterminate` (animated ring with\n * icon), or `icon` (ring framing the icon slot).\n * @availableWhen type==circular\n */\n @property({type: String}) circularState: CircularProgressState =\n CircularProgressState.determinate;\n /**\n * Color emphasis of the bar fill: `regular` (gray) or `enhanced` (blue).\n * @availableWhen type==linear\n */\n @property({type: String}) priority: Priority = Priority.enhanced;\n /** Progress percentage (0–100); clamped when rendered. */\n @property({type: Number}) value = 0;\n /**\n * Shows the value label above the bar (percentage when determinate, \"Loading\" when indeterminate).\n * @availableWhen type==linear\n */\n @property({type: Boolean}) showValue = false;\n /**\n * Appends a `%` unit next to the centered value.\n * @availableWhen type==circular && (progressiveIndeterminate==true || circularState==determinate)\n */\n @property({type: Boolean}) showUnit = false;\n /**\n * Shows the `description` text below the bar.\n * @availableWhen type==linear\n */\n @property({type: Boolean}) hasDescription = false;\n /**\n * Description text rendered below the bar.\n * @availableWhen type==linear && hasDescription==true\n */\n @property({type: String}) description = 'Description text';\n /**\n * Shows the `stateLabel` next to the value.\n *\n * **TODO(designer):** Confirm the intended purpose of the state indicator — the story labels\n * this a \"future feature\".\n * @availableWhen type==linear && showValue==true && mode==determinate\n */\n @property({type: Boolean}) showState = false;\n /**\n * Text shown alongside the value when `showState` is enabled.\n * @availableWhen type==linear && showValue==true && mode==determinate && showState==true\n */\n @property({type: String}) stateLabel = 'Open';\n /**\n * Uses a progressive indeterminate ring (spinning arc that grows with `value`); takes\n * precedence over `circularState`.\n * @availableWhen type==circular\n */\n @property({type: Boolean}) progressiveIndeterminate = false;\n\n override render() {\n if (this.type === ProgressBarType.circular) {\n return this.renderCircularProgress();\n }\n\n return this.renderLinearProgress();\n }\n\n private getCircularProgressMode(): CircularProgressMode {\n if (this.progressiveIndeterminate) {\n return CircularProgressMode.progressiveIndeterminate;\n }\n if (this.circularState === CircularProgressState.icon) {\n return CircularProgressMode.determinate;\n }\n if (this.circularState === CircularProgressState.indeterminate) {\n return CircularProgressMode.indeterminate;\n }\n return CircularProgressMode.determinate;\n }\n\n private renderCircularProgress() {\n const progressValue =\n this.circularState === CircularProgressState.icon ? 100 : this.value;\n\n return html`\n <div class=\"circular-wrapper\">\n <obc-circular-progress\n .mode=${this.getCircularProgressMode()}\n .value=${progressValue}\n .viewBoxSize=${48}\n .strokeWidth=${4}\n ></obc-circular-progress>\n\n <div class=\"circular-content\">${this.renderCircularContent()}</div>\n </div>\n `;\n }\n\n private renderCircularContent() {\n if (this.progressiveIndeterminate) {\n return html`\n <div class=\"circular-label-container\">\n <span class=\"circular-value\">${Math.round(this.value)}</span>\n ${this.showUnit\n ? html`<span class=\"circular-unit\">%</span>`\n : nothing}\n </div>\n `;\n }\n\n if (this.circularState === CircularProgressState.determinate) {\n return html`\n <div class=\"circular-label-container\">\n <span class=\"circular-value\">${Math.round(this.value)}</span>\n ${this.showUnit\n ? html`<span class=\"circular-unit\">%</span>`\n : nothing}\n </div>\n `;\n } else if (this.circularState === CircularProgressState.indeterminate) {\n return html`\n <div class=\"circular-label-container\">\n <span class=\"circular-value\">\n <slot name=\"icon\">...</slot>\n </span>\n </div>\n `;\n } else {\n return html`\n <div class=\"circular-icon-container\">\n <slot name=\"icon\">\n <obi-placeholder></obi-placeholder>\n </slot>\n </div>\n `;\n }\n }\n\n private renderLinearProgress() {\n const clampedValue = Math.max(0, Math.min(100, this.value));\n const progressWidth = `${clampedValue}%`;\n const barClasses = {\n bar: true,\n 'priority-regular': this.priority === Priority.regular,\n };\n\n return html`\n <div class=\"wrapper\">\n ${this.showValue ? this.renderLabel() : ''}\n\n <div class=${classMap(barClasses)}>\n ${this.mode === ProgressBarMode.determinate\n ? html`\n <div\n class=\"loaded\"\n style=${styleMap({width: progressWidth})}\n ></div>\n `\n : html` <div class=\"indeterminate-track\"></div> `}\n </div>\n\n ${this.hasDescription\n ? html`\n <div class=\"description-container\">\n <span class=\"description-text\">${this.description}</span>\n </div>\n `\n : nothing}\n </div>\n `;\n }\n\n private renderLabel() {\n if (this.mode === ProgressBarMode.determinate) {\n return html`\n <div class=\"label-container\">\n <div class=\"value-frame\">\n <span class=\"value-number\">${Math.round(this.value)}</span>\n <span class=\"value-unit\">%</span>\n </div>\n ${this.showState\n ? html` <span class=\"state\">${this.stateLabel}</span> `\n : nothing}\n </div>\n `;\n } else {\n return html`\n <div class=\"label-container\">\n <span class=\"loading-text\">Loading</span>\n </div>\n `;\n }\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-progress-bar': ObcProgressBar;\n }\n}\n"],"names":["ProgressBarType","ProgressBarMode","CircularProgressState"],"mappings":";;;;;;;;;;;;;;;;;;;AAYO,IAAK,oCAAAA,qBAAL;AACLA,mBAAA,QAAA,IAAS;AACTA,mBAAA,UAAA,IAAW;AAFD,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAKL,IAAK,oCAAAC,qBAAL;AACLA,mBAAA,aAAA,IAAc;AACdA,mBAAA,eAAA,IAAgB;AAFN,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAKL,IAAK,0CAAAC,2BAAL;AACLA,yBAAA,aAAA,IAAc;AACdA,yBAAA,eAAA,IAAgB;AAChBA,yBAAA,MAAA,IAAO;AAHG,SAAAA;AAAA,G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EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAPb,eAOe,WAAA,QAAA,CAAA;AAMA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAbb,eAae,WAAA,iBAAA,CAAA;AAMA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAnBb,eAmBe,WAAA,YAAA,CAAA;AAEA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GArBb,eAqBe,WAAA,SAAA,CAAA;AAKC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA1Bd,eA0BgB,WAAA,aAAA,CAAA;AAKA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA/Bd,eA+BgB,WAAA,YAAA,CAAA;AAKA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GApCd,eAoCgB,WAAA,kBAAA,CAAA;AAKD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAzCb,eAyCe,WAAA,eAAA,CAAA;AAQC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAjDd,eAiDgB,WAAA,aAAA,CAAA;AAKD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAtDb,eAsDe,WAAA,cAAA,CAAA;AAMC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA5Dd,eA4DgB,WAAA,4BAAA,CAAA;AA5DhB,iBAAN,gBAAA;AAAA,EADN,cAAc,kBAAkB;AAAA,GACpB,cAAA;"}
|
package/package.json
CHANGED
|
@@ -389,27 +389,38 @@ export class ObcReadoutBlock extends LitElement {
|
|
|
389
389
|
/**
|
|
390
390
|
* The advice marker for the current category / triggered state. Resting
|
|
391
391
|
* categories carry a neutral outline glyph (tinted via `currentColor`);
|
|
392
|
-
* triggered alert categories swap to the filled IEC status icon
|
|
393
|
-
*
|
|
392
|
+
* triggered alert categories swap to the filled IEC status icon rendered
|
|
393
|
+
* with `useCssColor`, which selects the icon's token-coloured variant
|
|
394
|
+
* (alert fill + on-alert glyph, e.g. `--alert-caution-color` +
|
|
395
|
+
* `--on-caution-active-color`) — without it the same icon is a
|
|
396
|
+
* single-colour `currentColor` silhouette. This mirrors `obc-alert-icon`.
|
|
397
|
+
* The resting icons and the advice diamond deliberately stay on
|
|
398
|
+
* `currentColor`: their css-colour variants hard-code
|
|
399
|
+
* `--element-active-color`, which would defeat the neutral tint and the
|
|
400
|
+
* optimal / eco triggered tint applied from CSS.
|
|
394
401
|
*/
|
|
395
402
|
private adviceFallbackIcon(): TemplateResult {
|
|
396
403
|
const active = this.active;
|
|
397
404
|
switch (this.category) {
|
|
398
405
|
case ReadoutAdviceCategory.caution:
|
|
399
406
|
return active
|
|
400
|
-
? html`<obi-caution-color-iec></obi-caution-color-iec>`
|
|
407
|
+
? html`<obi-caution-color-iec useCssColor></obi-caution-color-iec>`
|
|
401
408
|
: html`<obi-caution-google></obi-caution-google>`;
|
|
402
409
|
case ReadoutAdviceCategory.warning:
|
|
403
410
|
return active
|
|
404
|
-
? html`<obi-warning-unacknowledged-iec
|
|
411
|
+
? html`<obi-warning-unacknowledged-iec
|
|
412
|
+
useCssColor
|
|
413
|
+
></obi-warning-unacknowledged-iec>`
|
|
405
414
|
: html`<obi-warning-unacknowledged-outlined></obi-warning-unacknowledged-outlined>`;
|
|
406
415
|
case ReadoutAdviceCategory.alarm:
|
|
407
416
|
return active
|
|
408
|
-
? html`<obi-alarm-unacknowledged-iec
|
|
417
|
+
? html`<obi-alarm-unacknowledged-iec
|
|
418
|
+
useCssColor
|
|
419
|
+
></obi-alarm-unacknowledged-iec>`
|
|
409
420
|
: html`<obi-alarm></obi-alarm>`;
|
|
410
421
|
case ReadoutAdviceCategory.running:
|
|
411
422
|
return active
|
|
412
|
-
? html`<obi-running-color-iec></obi-running-color-iec>`
|
|
423
|
+
? html`<obi-running-color-iec useCssColor></obi-running-color-iec>`
|
|
413
424
|
: html`<obi-running></obi-running>`;
|
|
414
425
|
default:
|
|
415
426
|
// regular / optimal / eco share the advice diamond; the triggered tint
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type {Meta, StoryObj} from '@storybook/web-components-vite';
|
|
2
|
+
import {html} from 'lit';
|
|
3
|
+
import './modal-window.js';
|
|
4
|
+
import {ObcModalWindowSize} from './modal-window.js';
|
|
5
|
+
import '../../icons/icon-placeholder.js';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Application Components/Containers/Modal Window/Sizing',
|
|
9
|
+
component: 'obc-modal-window',
|
|
10
|
+
tags: ['autodocs', '6.0'],
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'padded',
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component: `By default \`obc-modal-window\` is as tall as its content,
|
|
16
|
+
capped at \`90vh\`. To size it externally, set the
|
|
17
|
+
\`--obc-modal-window-height\` custom property on the element — a fixed value,
|
|
18
|
+
or \`100%\` to follow a host element sized by its container. The \`90vh\` cap
|
|
19
|
+
always applies and the content area scrolls when the content does not fit.
|
|
20
|
+
|
|
21
|
+
Every frame below is 349 × 360 px, outlined.`,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
} satisfies Meta;
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj;
|
|
29
|
+
|
|
30
|
+
const FRAME = 'width: 349px; height: 360px; outline: 1px dashed #d0021b;';
|
|
31
|
+
const FILLED = 'position: relative; width: 100%; height: 100%;';
|
|
32
|
+
|
|
33
|
+
const filledBody = html`
|
|
34
|
+
<div slot="content" style=${FILLED}>
|
|
35
|
+
<div
|
|
36
|
+
style="position: absolute; inset: 0; padding: 16px; background: rgba(0, 122, 255, 0.12);"
|
|
37
|
+
>
|
|
38
|
+
Body content, sized by the modal.
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const naturalBody = html`
|
|
44
|
+
<div
|
|
45
|
+
slot="content"
|
|
46
|
+
style="padding: 16px; background: rgba(0, 122, 255, 0.12);"
|
|
47
|
+
>
|
|
48
|
+
Body content at its natural height.
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const modal = (style: string, body = filledBody) => html`
|
|
53
|
+
<obc-modal-window
|
|
54
|
+
style=${style}
|
|
55
|
+
.size=${ObcModalWindowSize.Small}
|
|
56
|
+
.hasOptionalAction=${false}
|
|
57
|
+
.hasLeadingIcon=${true}
|
|
58
|
+
>
|
|
59
|
+
<obi-placeholder slot="leading-icon"></obi-placeholder>
|
|
60
|
+
<span slot="title">Modal Title</span>
|
|
61
|
+
${body}
|
|
62
|
+
<span slot="cancel-label">Cancel</span>
|
|
63
|
+
<span slot="done-label">Done</span>
|
|
64
|
+
</obc-modal-window>
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const labelled = (label: string, content: unknown) => html`
|
|
68
|
+
<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
69
|
+
<span style="font: 12px/1.4 sans-serif;">${label}</span>
|
|
70
|
+
${content}
|
|
71
|
+
</div>
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const row = (...cells: unknown[]) => html`
|
|
75
|
+
<div style="display: flex; gap: 32px; align-items: flex-start;">${cells}</div>
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
export const ContentHeightByDefault: Story = {
|
|
79
|
+
render: () =>
|
|
80
|
+
row(
|
|
81
|
+
labelled(
|
|
82
|
+
'Plain frame — content height',
|
|
83
|
+
html`<div style=${FRAME}>${modal('', naturalBody)}</div>`
|
|
84
|
+
),
|
|
85
|
+
labelled(
|
|
86
|
+
'Flex frame — still content height',
|
|
87
|
+
html`<div style="${FRAME} display: flex;">
|
|
88
|
+
${modal('', naturalBody)}
|
|
89
|
+
</div>`
|
|
90
|
+
)
|
|
91
|
+
),
|
|
92
|
+
parameters: {
|
|
93
|
+
docs: {
|
|
94
|
+
description: {
|
|
95
|
+
story: `Without \`--obc-modal-window-height\` the modal keeps its
|
|
96
|
+
content height, also when a flex container stretches the host element. Nothing
|
|
97
|
+
an ancestor does can change the modal's height implicitly.`,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const FixedHeight: Story = {
|
|
104
|
+
render: () =>
|
|
105
|
+
row(
|
|
106
|
+
labelled(
|
|
107
|
+
'--obc-modal-window-height: 360px',
|
|
108
|
+
html`<div style=${FRAME}>
|
|
109
|
+
${modal('--obc-modal-window-height: 360px;')}
|
|
110
|
+
</div>`
|
|
111
|
+
),
|
|
112
|
+
labelled(
|
|
113
|
+
'Default for comparison',
|
|
114
|
+
html`<div style=${FRAME}>${modal('')}</div>`
|
|
115
|
+
)
|
|
116
|
+
),
|
|
117
|
+
parameters: {
|
|
118
|
+
docs: {
|
|
119
|
+
description: {
|
|
120
|
+
story: `A fixed \`--obc-modal-window-height\` sizes the modal exactly.
|
|
121
|
+
The body takes whatever the title bar and the action row leave, with no fixed
|
|
122
|
+
heights anywhere, and slotted content of \`height: 100%\` fills it. Values
|
|
123
|
+
taller than the viewport are still capped at \`90vh\`.`,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const FillContainer: Story = {
|
|
130
|
+
render: () =>
|
|
131
|
+
row(
|
|
132
|
+
labelled(
|
|
133
|
+
'Flex frame + --obc-modal-window-height: 100%',
|
|
134
|
+
html`<div style="${FRAME} display: flex;">
|
|
135
|
+
${modal('--obc-modal-window-height: 100%;')}
|
|
136
|
+
</div>`
|
|
137
|
+
),
|
|
138
|
+
labelled(
|
|
139
|
+
'Block frame + height: 100% on the element',
|
|
140
|
+
html`<div style=${FRAME}>
|
|
141
|
+
${modal('height: 100%; --obc-modal-window-height: 100%;')}
|
|
142
|
+
</div>`
|
|
143
|
+
)
|
|
144
|
+
),
|
|
145
|
+
parameters: {
|
|
146
|
+
docs: {
|
|
147
|
+
description: {
|
|
148
|
+
story: `\`--obc-modal-window-height: 100%\` makes the modal follow the
|
|
149
|
+
host element's height: let a flex container stretch the host, or give the
|
|
150
|
+
element an explicit \`height\`. Use this when the surrounding layout owns the
|
|
151
|
+
modal's size.`,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
};
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
.wrapper {
|
|
6
10
|
box-sizing: border-box;
|
|
7
11
|
background: var(--container-background-color);
|
|
@@ -13,6 +17,7 @@
|
|
|
13
17
|
display: flex;
|
|
14
18
|
flex-direction: column;
|
|
15
19
|
width: 100%;
|
|
20
|
+
height: var(--obc-modal-window-height, auto);
|
|
16
21
|
max-height: 90vh;
|
|
17
22
|
}
|
|
18
23
|
|
|
@@ -54,6 +54,13 @@ export enum ObcModalWindowSize {
|
|
|
54
54
|
* - `done-click`: Fired when the done button is clicked.
|
|
55
55
|
* - `option-click`: Fired when the optional action button is clicked.
|
|
56
56
|
*
|
|
57
|
+
* ### Sizing
|
|
58
|
+
* By default the modal is as tall as its content, capped at `90vh`. To give it
|
|
59
|
+
* an explicit height, set the `--obc-modal-window-height` custom property on
|
|
60
|
+
* the element — either a fixed value (`--obc-modal-window-height: 360px`) or
|
|
61
|
+
* `100%` to fill a host element that is sized by its container. The `90vh` cap
|
|
62
|
+
* always applies, and the content area scrolls when the content does not fit.
|
|
63
|
+
*
|
|
57
64
|
* ### Example:
|
|
58
65
|
* ```html
|
|
59
66
|
* <obc-modal-window size="medium" hasLeadingIcon>
|
|
@@ -78,6 +85,7 @@ export enum ObcModalWindowSize {
|
|
|
78
85
|
* @slot option-label - Slot for the label of the optional action button (shown when `hasOptionalAction` is true)
|
|
79
86
|
* @slot cancel-label - Slot for the label of the cancel button (shown when `hasCancelAction` is true)
|
|
80
87
|
* @slot done-label - Slot for the label of the done button
|
|
88
|
+
* @cssprop [--obc-modal-window-height=auto] - Height of the modal window. Defaults to content height (capped at 90vh); set a fixed value or `100%` to size the modal externally.
|
|
81
89
|
* @stable
|
|
82
90
|
*/
|
|
83
91
|
@customElement('obc-modal-window')
|
|
@@ -77,6 +77,10 @@
|
|
|
77
77
|
transition: width 0.3s ease-in-out;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
.bar.priority-regular .loaded {
|
|
81
|
+
background-color: var(--instrument-regular-secondary-color);
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
.indeterminate-track {
|
|
81
85
|
position: absolute;
|
|
82
86
|
top: 0;
|
|
@@ -88,6 +92,10 @@
|
|
|
88
92
|
animation: indeterminate-slide 1.5s ease-in-out infinite;
|
|
89
93
|
}
|
|
90
94
|
|
|
95
|
+
.bar.priority-regular .indeterminate-track {
|
|
96
|
+
background-color: var(--instrument-regular-secondary-color);
|
|
97
|
+
}
|
|
98
|
+
|
|
91
99
|
@keyframes indeterminate-slide {
|
|
92
100
|
0% {
|
|
93
101
|
transform: translateX(-100%);
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
ProgressBarMode,
|
|
6
6
|
ProgressBarType,
|
|
7
7
|
CircularProgressState,
|
|
8
|
+
Priority,
|
|
8
9
|
} from './progress-bar.js';
|
|
9
10
|
import './progress-bar.js';
|
|
10
11
|
|
|
@@ -19,6 +20,7 @@ const meta: Meta<typeof ObcProgressBar> = {
|
|
|
19
20
|
args: {
|
|
20
21
|
type: ProgressBarType.linear,
|
|
21
22
|
mode: ProgressBarMode.determinate,
|
|
23
|
+
priority: Priority.enhanced,
|
|
22
24
|
circularState: CircularProgressState.determinate,
|
|
23
25
|
value: 40,
|
|
24
26
|
showValue: false,
|
|
@@ -48,6 +50,16 @@ const meta: Meta<typeof ObcProgressBar> = {
|
|
|
48
50
|
},
|
|
49
51
|
if: {arg: 'type', eq: ProgressBarType.linear},
|
|
50
52
|
},
|
|
53
|
+
priority: {
|
|
54
|
+
control: {type: 'select'},
|
|
55
|
+
options: Object.values(Priority),
|
|
56
|
+
description:
|
|
57
|
+
'Color emphasis of the bar fill: enhanced (blue) or regular (gray)',
|
|
58
|
+
table: {
|
|
59
|
+
defaultValue: {summary: Priority.enhanced},
|
|
60
|
+
},
|
|
61
|
+
if: {arg: 'type', eq: ProgressBarType.linear},
|
|
62
|
+
},
|
|
51
63
|
circularState: {
|
|
52
64
|
control: {type: 'select'},
|
|
53
65
|
options: Object.values(CircularProgressState),
|
|
@@ -172,6 +184,17 @@ export const LinearPrimary: Story = {
|
|
|
172
184
|
},
|
|
173
185
|
};
|
|
174
186
|
|
|
187
|
+
export const LinearRegular: Story = {
|
|
188
|
+
name: 'Linear - Regular Priority',
|
|
189
|
+
args: {
|
|
190
|
+
type: ProgressBarType.linear,
|
|
191
|
+
mode: ProgressBarMode.determinate,
|
|
192
|
+
priority: Priority.regular,
|
|
193
|
+
value: 40,
|
|
194
|
+
showValue: true,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
175
198
|
export const LinearIndeterminateSimple: Story = {
|
|
176
199
|
name: 'Linear - Indeterminate Simple',
|
|
177
200
|
args: {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {LitElement, html, nothing, unsafeCSS} from 'lit';
|
|
2
2
|
import {property} from 'lit/decorators.js';
|
|
3
|
+
import {classMap} from 'lit/directives/class-map.js';
|
|
3
4
|
import {styleMap} from 'lit/directives/style-map.js';
|
|
4
5
|
import componentStyle from './progress-bar.css?inline';
|
|
5
6
|
import {customElement} from '../../decorator.js';
|
|
6
7
|
import '../../icons/icon-placeholder.js';
|
|
7
8
|
import {CircularProgressMode} from '../../building-blocks/circular-progress/circular-progress.js';
|
|
9
|
+
import {Priority} from '../../navigation-instruments/types.js';
|
|
10
|
+
|
|
11
|
+
export {Priority};
|
|
8
12
|
|
|
9
13
|
export enum ProgressBarType {
|
|
10
14
|
linear = 'linear',
|
|
@@ -44,6 +48,10 @@ export enum CircularProgressState {
|
|
|
44
48
|
* - **Indeterminate**: Animated, looping fill for work of unknown duration; the label shows
|
|
45
49
|
* "Loading".
|
|
46
50
|
*
|
|
51
|
+
* **Color priority (`priority`)**
|
|
52
|
+
* - **Enhanced** (default): Blue fill, for a bar that reads as the primary value.
|
|
53
|
+
* - **Regular**: Neutral gray fill, for a bar that should recede as ancillary status.
|
|
54
|
+
*
|
|
47
55
|
* **Circular states (`circularState`)**
|
|
48
56
|
* - **Determinate**: Ring fills to `value`, with the rounded number (and optional `%` unit) centered.
|
|
49
57
|
* - **Indeterminate**: Animated ring with the `icon` slot centered.
|
|
@@ -98,6 +106,11 @@ export class ObcProgressBar extends LitElement {
|
|
|
98
106
|
*/
|
|
99
107
|
@property({type: String}) circularState: CircularProgressState =
|
|
100
108
|
CircularProgressState.determinate;
|
|
109
|
+
/**
|
|
110
|
+
* Color emphasis of the bar fill: `regular` (gray) or `enhanced` (blue).
|
|
111
|
+
* @availableWhen type==linear
|
|
112
|
+
*/
|
|
113
|
+
@property({type: String}) priority: Priority = Priority.enhanced;
|
|
101
114
|
/** Progress percentage (0–100); clamped when rendered. */
|
|
102
115
|
@property({type: Number}) value = 0;
|
|
103
116
|
/**
|
|
@@ -222,12 +235,16 @@ export class ObcProgressBar extends LitElement {
|
|
|
222
235
|
private renderLinearProgress() {
|
|
223
236
|
const clampedValue = Math.max(0, Math.min(100, this.value));
|
|
224
237
|
const progressWidth = `${clampedValue}%`;
|
|
238
|
+
const barClasses = {
|
|
239
|
+
bar: true,
|
|
240
|
+
'priority-regular': this.priority === Priority.regular,
|
|
241
|
+
};
|
|
225
242
|
|
|
226
243
|
return html`
|
|
227
244
|
<div class="wrapper">
|
|
228
245
|
${this.showValue ? this.renderLabel() : ''}
|
|
229
246
|
|
|
230
|
-
<div class
|
|
247
|
+
<div class=${classMap(barClasses)}>
|
|
231
248
|
${this.mode === ProgressBarMode.determinate
|
|
232
249
|
? html`
|
|
233
250
|
<div
|