@oicl/openbridge-webcomponents 2.0.0-next.48 → 2.0.0-next.49
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.map +1 -1
- package/custom-elements.json +7 -1
- package/dist/components/icon-button/icon-button.d.ts +4 -0
- package/dist/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.js.map +1 -1
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -47352,7 +47352,7 @@
|
|
|
47352
47352
|
"declarations": [
|
|
47353
47353
|
{
|
|
47354
47354
|
"kind": "class",
|
|
47355
|
-
"description": "`<obc-icon-button>` – An icon-only or icon-with-label button for quick actions.\n\nProvides a compact, visually prominent button that displays an icon (and optionally a label) for triggering actions. Commonly used for toolbars, navigation, or contextual actions where space is limited and a recognizable icon can represent the function.\n\nAppears as a circular or rounded button with configurable visual styles, supporting progress indication and various layout adaptations.\n\n## Features\n- **Variants:**\n - `normal` (default): Standard appearance for most use cases.\n - `raised`: Adds elevation/shadow for prominence.\n - `flat`: Minimal, backgroundless style for subtle actions.\n- **Progress Indicator:**\n - Shows a circular progress spinner overlay when the `progress` property is set (0–100). Useful for indicating loading or ongoing actions.\n- **Label Support:**\n - Optionally displays a text label below the icon when `hasLabel` is true and content is provided in the `label` slot.\n- **Corner Alignment:**\n - `cornerLeft` and `cornerRight` adjust the button's border radius and alignment for seamless placement at the start or end of a container.\n- **Active State:**\n - `activated` visually highlights the button as selected or toggled.\n - `activeColor` applies an accent color for emphasis.\n- **Wide Mode:**\n - `wide` increases the button's width for easier touch targets or visual balance.\n- **Disabled State:**\n - `disabled` prevents interaction and visually dims the button.\n\n## Usage Guidelines\n- Use `obc-icon-button` for actions represented by icons, such as toolbars, navigation, or quick-access commands.\n- Add a label (with `hasLabel` and the `label` slot) when clarity is needed or when icons alone may not be universally understood.\n- Use the progress indicator for actions that take time, such as uploads or background processes.\n- Prefer the `normal` variant for most cases; use `raised` to draw attention, and `flat` for less prominent or inline actions.\n- For grouped or edge-aligned layouts, use `cornerLeft` or `cornerRight` to visually merge with container edges.\n- Avoid using icon buttons for destructive or critical actions unless paired with clear feedback.\n- **TODO(designer):** Clarify recommended icon sizes and when to use label vs. icon-only.\n\n## Slots\n| Slot Name | Renders When... | Purpose |\n|-----------|---------------------|----------------------------------------------|\n| (default) | Always | The icon to display (e.g., `<obi-search>`) |\n| label | If `hasLabel` is set | Optional label text below the icon |\n\n## Best Practices\n- Ensure icons are clear and universally recognizable.\n- For accessibility, provide an `aria-label` or descriptive label for the button's action.\n- When using the progress indicator, avoid showing it for very short actions to prevent visual flicker.\n\n## Example:\n```\n<obc-icon-button variant=\"normal\">\n <obi-search></obi-search>\n</obc-icon-button>\n\n<obc-icon-button variant=\"normal\" hasLabel>\n <obi-arrow></obi-arrow>\n <span slot=\"label\">Next</span>\n</obc-icon-button>\n```",
|
|
47355
|
+
"description": "`<obc-icon-button>` – An icon-only or icon-with-label button for quick actions.\n\nProvides a compact, visually prominent button that displays an icon (and optionally a label) for triggering actions. Commonly used for toolbars, navigation, or contextual actions where space is limited and a recognizable icon can represent the function.\n\nAppears as a circular or rounded button with configurable visual styles, supporting progress indication and various layout adaptations.\n\n## Features\n- **Variants:**\n - `normal` (default): Standard appearance for most use cases.\n - `raised`: Adds elevation/shadow for prominence.\n - `flat`: Minimal, backgroundless style for subtle actions.\n- **Progress Indicator:**\n - Shows a circular progress spinner overlay when the `progress` property is set (0–100). Useful for indicating loading or ongoing actions.\n- **Label Support:**\n - Optionally displays a text label below the icon when `hasLabel` is true and content is provided in the `label` slot.\n- **Corner Alignment:**\n - `cornerLeft` and `cornerRight` adjust the button's border radius and alignment for seamless placement at the start or end of a container.\n- **Active State:**\n - `activated` visually highlights the button as selected or toggled.\n - `activeColor` applies an accent color for emphasis.\n- **Wide Mode:**\n - `wide` increases the button's width for easier touch targets or visual balance.\n- **Disabled State:**\n - `disabled` prevents interaction and visually dims the button.\n\n## Usage Guidelines\n- Use `obc-icon-button` for actions represented by icons, such as toolbars, navigation, or quick-access commands.\n- Add a label (with `hasLabel` and the `label` slot) when clarity is needed or when icons alone may not be universally understood.\n- Use the progress indicator for actions that take time, such as uploads or background processes.\n- Prefer the `normal` variant for most cases; use `raised` to draw attention, and `flat` for less prominent or inline actions.\n- For grouped or edge-aligned layouts, use `cornerLeft` or `cornerRight` to visually merge with container edges.\n- Avoid using icon buttons for destructive or critical actions unless paired with clear feedback.\n- **TODO(designer):** Clarify recommended icon sizes and when to use label vs. icon-only.\n\n## Slots\n| Slot Name | Renders When... | Purpose |\n|-----------|---------------------|----------------------------------------------|\n| (default) | Always | The icon to display (e.g., `<obi-search>`) |\n| label | If `hasLabel` is set | Optional label text below the icon |\n\n## Events\n- Emits a standard `click` event (`onClick` handler in framework wrappers) when activated.\n\n## Best Practices\n- Ensure icons are clear and universally recognizable.\n- For accessibility, provide an `aria-label` or descriptive label for the button's action.\n- When using the progress indicator, avoid showing it for very short actions to prevent visual flicker.\n\n## Example:\n```\n<obc-icon-button variant=\"normal\">\n <obi-search></obi-search>\n</obc-icon-button>\n\n<obc-icon-button variant=\"normal\" hasLabel>\n <obi-arrow></obi-arrow>\n <span slot=\"label\">Next</span>\n</obc-icon-button>\n```",
|
|
47356
47356
|
"name": "ObcIconButton",
|
|
47357
47357
|
"slots": [
|
|
47358
47358
|
{
|
|
@@ -47469,6 +47469,12 @@
|
|
|
47469
47469
|
"readonly": true
|
|
47470
47470
|
}
|
|
47471
47471
|
],
|
|
47472
|
+
"events": [
|
|
47473
|
+
{
|
|
47474
|
+
"description": "Fired when the button is clicked (if not disabled).",
|
|
47475
|
+
"name": "click"
|
|
47476
|
+
}
|
|
47477
|
+
],
|
|
47472
47478
|
"attributes": [
|
|
47473
47479
|
{
|
|
47474
47480
|
"name": "variant",
|
|
@@ -52,6 +52,9 @@ export declare enum IconButtonVariant {
|
|
|
52
52
|
* | (default) | Always | The icon to display (e.g., `<obi-search>`) |
|
|
53
53
|
* | label | If `hasLabel` is set | Optional label text below the icon |
|
|
54
54
|
*
|
|
55
|
+
* ## Events
|
|
56
|
+
* - Emits a standard `click` event (`onClick` handler in framework wrappers) when activated.
|
|
57
|
+
*
|
|
55
58
|
* ## Best Practices
|
|
56
59
|
* - Ensure icons are clear and universally recognizable.
|
|
57
60
|
* - For accessibility, provide an `aria-label` or descriptive label for the button's action.
|
|
@@ -71,6 +74,7 @@ export declare enum IconButtonVariant {
|
|
|
71
74
|
*
|
|
72
75
|
* @slot - Icon slot (default): Place an icon such as <obi-search> here.
|
|
73
76
|
* @slot label - Optional label shown below the icon when `hasLabel` is true.
|
|
77
|
+
* @fires click - Fired when the button is clicked (if not disabled).
|
|
74
78
|
*/
|
|
75
79
|
export declare class ObcIconButton extends LitElement {
|
|
76
80
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/icon-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAQ,OAAO,EAAY,MAAM,KAAK,CAAC;AAMzD;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,WAAW,gBAAgB;CAC5B;AAED
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/icon-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAQ,OAAO,EAAY,MAAM,KAAK,CAAC;AAMzD;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,WAAW,gBAAgB;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C;;;;;OAKG;IACuB,OAAO,EAAE,iBAAiB,CACzB;IAE3B;;;OAGG;IACwB,SAAS,UAAS;IAE7C;;;OAGG;IACwB,UAAU,UAAS;IAE9C;;;OAGG;IACwB,WAAW,UAAS;IAE/C;;;OAGG;IACwB,WAAW,UAAS;IAE/C;;OAEG;IACwB,IAAI,UAAS;IAExC;;OAEG;IACwB,QAAQ,UAAS;IAE5C;;;;OAIG;IACuB,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAa;IAEnE;;OAEG;IACwB,QAAQ,EAAE,OAAO,CAAS;IAErD,iFAAiF;IACpC,WAAW,UAAQ;IAEhE,IAAI,eAAe,0DAoDlB;IAEQ,MAAM;IAiCf,OAAgB,MAAM,0BAAwB;CAC/C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.js","sources":["../../../src/components/icon-button/icon-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport iconStyle from './icon-button.css?inline';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../../decorator.js';\n\n/**\n * The available visual variants for `<obc-icon-button>`.\n * - `normal`: Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n */\nexport enum IconButtonVariant {\n normal = 'normal',\n raised = 'raised',\n flat = 'flat',\n integration = 'integration',\n}\n\n/**\n * `<obc-icon-button>` – An icon-only or icon-with-label button for quick actions.\n *\n * Provides a compact, visually prominent button that displays an icon (and optionally a label) for triggering actions. Commonly used for toolbars, navigation, or contextual actions where space is limited and a recognizable icon can represent the function.\n *\n * Appears as a circular or rounded button with configurable visual styles, supporting progress indication and various layout adaptations.\n *\n * ## Features\n * - **Variants:**\n * - `normal` (default): Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n * - **Progress Indicator:**\n * - Shows a circular progress spinner overlay when the `progress` property is set (0–100). Useful for indicating loading or ongoing actions.\n * - **Label Support:**\n * - Optionally displays a text label below the icon when `hasLabel` is true and content is provided in the `label` slot.\n * - **Corner Alignment:**\n * - `cornerLeft` and `cornerRight` adjust the button's border radius and alignment for seamless placement at the start or end of a container.\n * - **Active State:**\n * - `activated` visually highlights the button as selected or toggled.\n * - `activeColor` applies an accent color for emphasis.\n * - **Wide Mode:**\n * - `wide` increases the button's width for easier touch targets or visual balance.\n * - **Disabled State:**\n * - `disabled` prevents interaction and visually dims the button.\n *\n * ## Usage Guidelines\n * - Use `obc-icon-button` for actions represented by icons, such as toolbars, navigation, or quick-access commands.\n * - Add a label (with `hasLabel` and the `label` slot) when clarity is needed or when icons alone may not be universally understood.\n * - Use the progress indicator for actions that take time, such as uploads or background processes.\n * - Prefer the `normal` variant for most cases; use `raised` to draw attention, and `flat` for less prominent or inline actions.\n * - For grouped or edge-aligned layouts, use `cornerLeft` or `cornerRight` to visually merge with container edges.\n * - Avoid using icon buttons for destructive or critical actions unless paired with clear feedback.\n * - **TODO(designer):** Clarify recommended icon sizes and when to use label vs. icon-only.\n *\n * ## Slots\n * | Slot Name | Renders When... | Purpose |\n * |-----------|---------------------|----------------------------------------------|\n * | (default) | Always | The icon to display (e.g., `<obi-search>`) |\n * | label | If `hasLabel` is set | Optional label text below the icon |\n *\n * ## Best Practices\n * - Ensure icons are clear and universally recognizable.\n * - For accessibility, provide an `aria-label` or descriptive label for the button's action.\n * - When using the progress indicator, avoid showing it for very short actions to prevent visual flicker.\n *\n * ## Example:\n * ```\n * <obc-icon-button variant=\"normal\">\n * <obi-search></obi-search>\n * </obc-icon-button>\n *\n * <obc-icon-button variant=\"normal\" hasLabel>\n * <obi-arrow></obi-arrow>\n * <span slot=\"label\">Next</span>\n * </obc-icon-button>\n * ```\n *\n * @slot - Icon slot (default): Place an icon such as <obi-search> here.\n * @slot label - Optional label shown below the icon when `hasLabel` is true.\n */\n@customElement('obc-icon-button')\nexport class ObcIconButton extends LitElement {\n /**\n * Visual style of the button.\n * - `normal`: Standard appearance (default).\n * - `raised`: Elevated with shadow.\n * - `flat`: Minimal, backgroundless style.\n */\n @property({type: String}) variant: IconButtonVariant =\n IconButtonVariant.normal;\n\n /**\n * Whether the button is in an activated (selected/toggled) state.\n * Visually highlights the button to indicate selection.\n */\n @property({type: Boolean}) activated = false;\n\n /**\n * If true, aligns the button to the left edge and removes left border radius.\n * Useful for grouping or edge-aligned layouts.\n */\n @property({type: Boolean}) cornerLeft = false;\n\n /**\n * If true, aligns the button to the right edge and removes right border radius.\n * Useful for grouping or edge-aligned layouts.\n */\n @property({type: Boolean}) cornerRight = false;\n\n /**\n * Applies an accent color to the button for emphasis.\n * Used to visually distinguish active or important actions.\n */\n @property({type: Boolean}) activeColor = false;\n\n /**\n * Increases the button's width for larger touch targets or visual balance.\n */\n @property({type: Boolean}) wide = false;\n\n /**\n * Disables the button, preventing user interaction and dimming its appearance.\n */\n @property({type: Boolean}) disabled = false;\n\n /**\n * Shows a circular progress indicator overlay when set (0–100).\n * Use to indicate ongoing actions or loading states.\n * If undefined, no progress indicator is shown.\n */\n @property({type: Number}) progress: undefined | number = undefined;\n\n /**\n * If true, displays a label below the icon using the `label` slot.\n */\n @property({type: Boolean}) hasLabel: boolean = false;\n\n /** If false, and cornerLeft or cornerRight is true, the divider is not shown. */\n @property({type: Boolean, attribute: false}) showDivider = true;\n\n get progressSpinner() {\n if (this.progress === undefined) {\n return nothing;\n }\n if (this.progress === 100) {\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"#325B9A\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n </svg>\n </div>`;\n }\n const angleRad = (this.progress * 0.95 * 3.6 * Math.PI) / 180;\n const x = 20 + 18 * Math.sin(angleRad);\n const y = 20 - 18 * Math.cos(angleRad);\n const largeArcFlag = angleRad > Math.PI ? 1 : 0;\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"var(--container-backdrop-color)\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n <path\n d=\"M18 2 A18 18 0 ${largeArcFlag} 1 ${x} ${y}\"\n stroke=\"var(--instrument-enhanced-secondary-color)\"\n stroke-width=\"4\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>`;\n }\n\n override render() {\n return html`\n <button\n class=${classMap({\n wrapper: true,\n ['variant-' + this.variant]: true,\n activated: this.activated,\n 'corner-left': this.cornerLeft,\n 'corner-right': this.cornerRight,\n 'active-color': this.activeColor,\n 'has-label': this.hasLabel,\n wide: this.wide,\n progress: this.progress !== undefined,\n 'hide-divider': !this.showDivider,\n })}\n ?disabled=${this.disabled}\n part=\"wrapper\"\n >\n ${this.progress !== undefined ? this.progressSpinner : nothing}\n <div class=\"visible-wrapper\" part=\"visible-wrapper\">\n <div class=\"icon\" part=\"icon\">\n <slot></slot>\n </div>\n </div>\n ${this.hasLabel\n ? html`<div class=\"label\" part=\"label\">\n <slot name=\"label\"></slot>\n </div>`\n : nothing}\n </button>\n `;\n }\n\n static override styles = unsafeCSS(iconStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-icon-button': ObcIconButton;\n }\n}\n"],"names":["IconButtonVariant"],"mappings":";;;;;;;;;;;;;;;AAYO,IAAK,sCAAAA,uBAAL;AACLA,qBAAA,QAAA,IAAS;AACTA,qBAAA,QAAA,IAAS;AACTA,qBAAA,MAAA,IAAO;AACPA,qBAAA,aAAA,IAAc;AAJJ,SAAAA;AAAA,GAAA,qBAAA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C,WAAA,eAAA,CAAA;AAzDlC,gBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,aAAA;"}
|
|
1
|
+
{"version":3,"file":"icon-button.js","sources":["../../../src/components/icon-button/icon-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport iconStyle from './icon-button.css?inline';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../../decorator.js';\n\n/**\n * The available visual variants for `<obc-icon-button>`.\n * - `normal`: Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n */\nexport enum IconButtonVariant {\n normal = 'normal',\n raised = 'raised',\n flat = 'flat',\n integration = 'integration',\n}\n\n/**\n * `<obc-icon-button>` – An icon-only or icon-with-label button for quick actions.\n *\n * Provides a compact, visually prominent button that displays an icon (and optionally a label) for triggering actions. Commonly used for toolbars, navigation, or contextual actions where space is limited and a recognizable icon can represent the function.\n *\n * Appears as a circular or rounded button with configurable visual styles, supporting progress indication and various layout adaptations.\n *\n * ## Features\n * - **Variants:**\n * - `normal` (default): Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n * - **Progress Indicator:**\n * - Shows a circular progress spinner overlay when the `progress` property is set (0–100). Useful for indicating loading or ongoing actions.\n * - **Label Support:**\n * - Optionally displays a text label below the icon when `hasLabel` is true and content is provided in the `label` slot.\n * - **Corner Alignment:**\n * - `cornerLeft` and `cornerRight` adjust the button's border radius and alignment for seamless placement at the start or end of a container.\n * - **Active State:**\n * - `activated` visually highlights the button as selected or toggled.\n * - `activeColor` applies an accent color for emphasis.\n * - **Wide Mode:**\n * - `wide` increases the button's width for easier touch targets or visual balance.\n * - **Disabled State:**\n * - `disabled` prevents interaction and visually dims the button.\n *\n * ## Usage Guidelines\n * - Use `obc-icon-button` for actions represented by icons, such as toolbars, navigation, or quick-access commands.\n * - Add a label (with `hasLabel` and the `label` slot) when clarity is needed or when icons alone may not be universally understood.\n * - Use the progress indicator for actions that take time, such as uploads or background processes.\n * - Prefer the `normal` variant for most cases; use `raised` to draw attention, and `flat` for less prominent or inline actions.\n * - For grouped or edge-aligned layouts, use `cornerLeft` or `cornerRight` to visually merge with container edges.\n * - Avoid using icon buttons for destructive or critical actions unless paired with clear feedback.\n * - **TODO(designer):** Clarify recommended icon sizes and when to use label vs. icon-only.\n *\n * ## Slots\n * | Slot Name | Renders When... | Purpose |\n * |-----------|---------------------|----------------------------------------------|\n * | (default) | Always | The icon to display (e.g., `<obi-search>`) |\n * | label | If `hasLabel` is set | Optional label text below the icon |\n *\n * ## Events\n * - Emits a standard `click` event (`onClick` handler in framework wrappers) when activated.\n *\n * ## Best Practices\n * - Ensure icons are clear and universally recognizable.\n * - For accessibility, provide an `aria-label` or descriptive label for the button's action.\n * - When using the progress indicator, avoid showing it for very short actions to prevent visual flicker.\n *\n * ## Example:\n * ```\n * <obc-icon-button variant=\"normal\">\n * <obi-search></obi-search>\n * </obc-icon-button>\n *\n * <obc-icon-button variant=\"normal\" hasLabel>\n * <obi-arrow></obi-arrow>\n * <span slot=\"label\">Next</span>\n * </obc-icon-button>\n * ```\n *\n * @slot - Icon slot (default): Place an icon such as <obi-search> here.\n * @slot label - Optional label shown below the icon when `hasLabel` is true.\n * @fires click - Fired when the button is clicked (if not disabled).\n */\n@customElement('obc-icon-button')\nexport class ObcIconButton extends LitElement {\n /**\n * Visual style of the button.\n * - `normal`: Standard appearance (default).\n * - `raised`: Elevated with shadow.\n * - `flat`: Minimal, backgroundless style.\n */\n @property({type: String}) variant: IconButtonVariant =\n IconButtonVariant.normal;\n\n /**\n * Whether the button is in an activated (selected/toggled) state.\n * Visually highlights the button to indicate selection.\n */\n @property({type: Boolean}) activated = false;\n\n /**\n * If true, aligns the button to the left edge and removes left border radius.\n * Useful for grouping or edge-aligned layouts.\n */\n @property({type: Boolean}) cornerLeft = false;\n\n /**\n * If true, aligns the button to the right edge and removes right border radius.\n * Useful for grouping or edge-aligned layouts.\n */\n @property({type: Boolean}) cornerRight = false;\n\n /**\n * Applies an accent color to the button for emphasis.\n * Used to visually distinguish active or important actions.\n */\n @property({type: Boolean}) activeColor = false;\n\n /**\n * Increases the button's width for larger touch targets or visual balance.\n */\n @property({type: Boolean}) wide = false;\n\n /**\n * Disables the button, preventing user interaction and dimming its appearance.\n */\n @property({type: Boolean}) disabled = false;\n\n /**\n * Shows a circular progress indicator overlay when set (0–100).\n * Use to indicate ongoing actions or loading states.\n * If undefined, no progress indicator is shown.\n */\n @property({type: Number}) progress: undefined | number = undefined;\n\n /**\n * If true, displays a label below the icon using the `label` slot.\n */\n @property({type: Boolean}) hasLabel: boolean = false;\n\n /** If false, and cornerLeft or cornerRight is true, the divider is not shown. */\n @property({type: Boolean, attribute: false}) showDivider = true;\n\n get progressSpinner() {\n if (this.progress === undefined) {\n return nothing;\n }\n if (this.progress === 100) {\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"#325B9A\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n </svg>\n </div>`;\n }\n const angleRad = (this.progress * 0.95 * 3.6 * Math.PI) / 180;\n const x = 20 + 18 * Math.sin(angleRad);\n const y = 20 - 18 * Math.cos(angleRad);\n const largeArcFlag = angleRad > Math.PI ? 1 : 0;\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"var(--container-backdrop-color)\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n <path\n d=\"M18 2 A18 18 0 ${largeArcFlag} 1 ${x} ${y}\"\n stroke=\"var(--instrument-enhanced-secondary-color)\"\n stroke-width=\"4\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>`;\n }\n\n override render() {\n return html`\n <button\n class=${classMap({\n wrapper: true,\n ['variant-' + this.variant]: true,\n activated: this.activated,\n 'corner-left': this.cornerLeft,\n 'corner-right': this.cornerRight,\n 'active-color': this.activeColor,\n 'has-label': this.hasLabel,\n wide: this.wide,\n progress: this.progress !== undefined,\n 'hide-divider': !this.showDivider,\n })}\n ?disabled=${this.disabled}\n part=\"wrapper\"\n >\n ${this.progress !== undefined ? this.progressSpinner : nothing}\n <div class=\"visible-wrapper\" part=\"visible-wrapper\">\n <div class=\"icon\" part=\"icon\">\n <slot></slot>\n </div>\n </div>\n ${this.hasLabel\n ? html`<div class=\"label\" part=\"label\">\n <slot name=\"label\"></slot>\n </div>`\n : nothing}\n </button>\n `;\n }\n\n static override styles = unsafeCSS(iconStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-icon-button': ObcIconButton;\n }\n}\n"],"names":["IconButtonVariant"],"mappings":";;;;;;;;;;;;;;;AAYO,IAAK,sCAAAA,uBAAL;AACLA,qBAAA,QAAA,IAAS;AACTA,qBAAA,QAAA,IAAS;AACTA,qBAAA,MAAA,IAAO;AACPA,qBAAA,aAAA,IAAc;AAJJ,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;AAyEL,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AAOqB,SAAA,UACxB;AAMyB,SAAA,YAAY;AAMZ,SAAA,aAAa;AAMb,SAAA,cAAc;AAMd,SAAA,cAAc;AAKd,SAAA,OAAO;AAKP,SAAA,WAAW;AAOZ,SAAA,WAA+B;AAK9B,SAAA,WAAoB;AAGF,SAAA,cAAc;AAAA,EAAA;AAAA,EAE3D,IAAI,kBAAkB;AACpB,QAAI,KAAK,aAAa,QAAW;AAC/B,aAAO;AAAA,IACT;AACA,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