@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.19 → 2.2.0-next.20
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 +43 -35
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +108 -7
- package/dist/components/button/button.d.ts +8 -0
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +6 -0
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/command-menu/command-menu.d.ts +42 -14
- package/dist/components/command-menu/command-menu.d.ts.map +1 -1
- package/dist/components/command-menu/command-menu.js +25 -6
- package/dist/components/command-menu/command-menu.js.map +1 -1
- package/dist/components/start-stop-switch/start-stop-switch.css_inline.js +3 -22
- package/dist/components/start-stop-switch/start-stop-switch.d.ts +3 -2
- package/dist/components/start-stop-switch/start-stop-switch.d.ts.map +1 -1
- package/dist/components/start-stop-switch/start-stop-switch.js +9 -7
- package/dist/components/start-stop-switch/start-stop-switch.js.map +1 -1
- package/docs/MigrationGuide22.mdx +10 -2
- package/docs/migration-guide-2-2/renamed-slots.md +7 -0
- package/package.json +1 -1
- package/src/components/button/button.spec.ts +75 -0
- package/src/components/button/button.stories.ts +2 -0
- package/src/components/button/button.ts +10 -0
- package/src/components/command-menu/command-menu.spec.ts +125 -0
- package/src/components/command-menu/command-menu.stories.ts +41 -4
- package/src/components/command-menu/command-menu.ts +57 -20
- package/src/components/start-stop-switch/start-stop-switch.css +2 -20
- package/src/components/start-stop-switch/start-stop-switch.spec.ts +59 -0
- package/src/components/start-stop-switch/start-stop-switch.ts +19 -9
- package/src/components/tabbed-card/tabbed-card.stories.ts +1 -1
package/custom-elements.json
CHANGED
|
@@ -77785,7 +77785,7 @@
|
|
|
77785
77785
|
"declarations": [
|
|
77786
77786
|
{
|
|
77787
77787
|
"kind": "class",
|
|
77788
|
-
"description": "`<obc-button>` – A versatile button component supporting icons, variants, and link behavior.\n\nThe obc-button component provides a flexible, accessible button for triggering actions or navigation. It can display leading and/or trailing icons, adapt its appearance via multiple visual variants, and optionally render as a link when an `href` is provided. Designed for consistency and usability across a wide range of UI scenarios.\n\n### Features\n- **Variants:**\n - `normal` (default): Standard button appearance for primary actions.\n - `raised`: Button with elevated styling for emphasis.\n - `flat`: Minimal, low-emphasis button for secondary actions.\n- **Icon Support:**\n - Leading icon (slot=\"leading-icon\") and/or trailing icon (slot=\"trailing-icon\") can be displayed.\n- **Full Width:**\n - Set `fullWidth` to make the button expand to the width of its container.\n- **Button or Link:**\n - Renders as a native `<button>` by default, or as an `<a>` anchor when `href` is set (with optional `target`).\n- **Disabled State:**\n - Supports disabling for both button and link modes.\n- **Segmented Group Support:**\n - `segmentPosition` property allows the button to visually join with others in a segmented group.\n\n### Usage Guidelines\nUse `obc-button` for interactive actions such as submitting forms, triggering dialogs, or navigating to other views.\n- Choose the `normal` variant for primary actions, `raised` for extra emphasis, and `flat` for less prominent or inline actions.\n- Use leading/trailing icons to visually reinforce the button's purpose (e.g., a download or arrow icon).\n- When navigation is required, provide an `href` so the button renders as a link for proper semantics and accessibility.\n- For icon-only buttons, supply an accessible label via the default slot or `aria-label`.\n- Avoid using multiple buttons with conflicting actions in close proximity; follow standard UI guidelines for button grouping and emphasis.\n- Use `segmentPosition` to visually group buttons for related actions.\n- **TODO(designer):** Confirm if there are recommended icon sizes or spacing guidelines for best visual alignment.\n\n### Slots\n| Slot Name | Renders When... | Purpose |\n|-----------------|--------------------------|----------------------------------------------|\n| (default) | Always | Button label text (required for accessibility)|\n| leading-icon | `showLeadingIcon` is true | Icon displayed before the label |\n| trailing-icon | `showTrailingIcon` is true| Icon displayed after the label |\n\n### Properties\n- `variant` (ButtonVariant): Controls the visual style. Default is `normal`.\n- `fullWidth` (boolean): Expands button to fill container width when true.\n- `disabled` (boolean): Disables the button or link.\n- `showLeadingIcon` (boolean): Shows the leading icon slot when true.\n- `showTrailingIcon` (boolean): Shows the trailing icon slot when true.\n- `href` (string): If set, renders as an anchor link.\n- `target` (string): Link target (only applies when `href` is set).\n- `segmentPosition` (segmentPosition): Visual grouping for segmented button layouts.\n\n### Best Practices\n- Always provide a clear label for accessibility, even if using only icons.\n- Use only one primary action per view for clarity.\n- When using as a link, ensure `href` points to a valid destination and consider `target=\"_blank\"` for external links.\n- Disabled state prevents all interaction and applies correct styling.\n- For segmented groups, set `segmentPosition` appropriately on each button to ensure correct border radius and grouping.\n\n### Example:\n```\n<obc-button variant=\"raised\" showLeadingIcon>\n <span slot=\"leading-icon\"><obi-search></obi-search></span>\n Search\n</obc-button>\n```",
|
|
77788
|
+
"description": "`<obc-button>` – A versatile button component supporting icons, variants, and link behavior.\n\nThe obc-button component provides a flexible, accessible button for triggering actions or navigation. It can display leading and/or trailing icons, adapt its appearance via multiple visual variants, and optionally render as a link when an `href` is provided. Designed for consistency and usability across a wide range of UI scenarios.\n\n### Features\n- **Variants:**\n - `normal` (default): Standard button appearance for primary actions.\n - `raised`: Button with elevated styling for emphasis.\n - `flat`: Minimal, low-emphasis button for secondary actions.\n- **Icon Support:**\n - Leading icon (slot=\"leading-icon\") and/or trailing icon (slot=\"trailing-icon\") can be displayed.\n- **Full Width:**\n - Set `fullWidth` to make the button expand to the width of its container.\n- **Button or Link:**\n - Renders as a native `<button>` by default, or as an `<a>` anchor when `href` is set (with optional `target`).\n- **Disabled State:**\n - Supports disabling for both button and link modes.\n- **Segmented Group Support:**\n - `segmentPosition` property allows the button to visually join with others in a segmented group.\n\n### Usage Guidelines\nUse `obc-button` for interactive actions such as submitting forms, triggering dialogs, or navigating to other views.\n- Choose the `normal` variant for primary actions, `raised` for extra emphasis, and `flat` for less prominent or inline actions.\n- Use leading/trailing icons to visually reinforce the button's purpose (e.g., a download or arrow icon).\n- When navigation is required, provide an `href` so the button renders as a link for proper semantics and accessibility.\n- For icon-only buttons, supply an accessible label via the default slot or `aria-label`.\n- Avoid using multiple buttons with conflicting actions in close proximity; follow standard UI guidelines for button grouping and emphasis.\n- Use `segmentPosition` to visually group buttons for related actions.\n- **TODO(designer):** Confirm if there are recommended icon sizes or spacing guidelines for best visual alignment.\n\n### Slots\n| Slot Name | Renders When... | Purpose |\n|-----------------|--------------------------|----------------------------------------------|\n| (default) | Always | Button label text (required for accessibility)|\n| leading-icon | `showLeadingIcon` is true | Icon displayed before the label |\n| trailing-icon | `showTrailingIcon` is true| Icon displayed after the label |\n\n### Properties\n- `variant` (ButtonVariant): Controls the visual style. Default is `normal`.\n- `fullWidth` (boolean): Expands button to fill container width when true.\n- `disabled` (boolean): Disables the button or link.\n- `showLeadingIcon` (boolean): Shows the leading icon slot when true.\n- `showTrailingIcon` (boolean): Shows the trailing icon slot when true.\n- `href` (string): If set, renders as an anchor link.\n- `target` (string): Link target (only applies when `href` is set).\n- `segmentPosition` (segmentPosition): Visual grouping for segmented button layouts.\n- `ariaLabel` (string): Accessible name of the button, in place of its slotted text.\n\n### Best Practices\n- Always provide a clear label for accessibility, even if using only icons.\n- Use only one primary action per view for clarity.\n- When using as a link, ensure `href` points to a valid destination and consider `target=\"_blank\"` for external links.\n- Disabled state prevents all interaction and applies correct styling.\n- For segmented groups, set `segmentPosition` appropriately on each button to ensure correct border radius and grouping.\n\n### Example:\n```\n<obc-button variant=\"raised\" showLeadingIcon>\n <span slot=\"leading-icon\"><obi-search></obi-search></span>\n Search\n</obc-button>\n```",
|
|
77789
77789
|
"name": "ObcButton",
|
|
77790
77790
|
"slots": [
|
|
77791
77791
|
{
|
|
@@ -77881,6 +77881,16 @@
|
|
|
77881
77881
|
"description": "Position within a segmented button group: `single` stands alone, `start`, `middle` and `end` shape the button for the first, an inner and the last segment.",
|
|
77882
77882
|
"attribute": "segmentPosition"
|
|
77883
77883
|
},
|
|
77884
|
+
{
|
|
77885
|
+
"kind": "field",
|
|
77886
|
+
"name": "ariaLabel",
|
|
77887
|
+
"type": {
|
|
77888
|
+
"text": "string | null"
|
|
77889
|
+
},
|
|
77890
|
+
"default": "null",
|
|
77891
|
+
"description": "Accessible name forwarded to the inner `<button>` or `<a>`, mapped to the `aria-label` attribute. It replaces the slotted text as the name, for a button whose text describes a state rather than the action it takes. Start it with the visible text, so a user who speaks the label they see still reaches the button. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary.",
|
|
77892
|
+
"attribute": "aria-label"
|
|
77893
|
+
},
|
|
77884
77894
|
{
|
|
77885
77895
|
"kind": "method",
|
|
77886
77896
|
"name": "renderLeadingIcon",
|
|
@@ -77968,6 +77978,15 @@
|
|
|
77968
77978
|
},
|
|
77969
77979
|
"description": "Position within a segmented button group: `single` stands alone, `start`, `middle` and `end` shape the button for the first, an inner and the last segment.",
|
|
77970
77980
|
"fieldName": "segmentPosition"
|
|
77981
|
+
},
|
|
77982
|
+
{
|
|
77983
|
+
"name": "aria-label",
|
|
77984
|
+
"type": {
|
|
77985
|
+
"text": "string | null"
|
|
77986
|
+
},
|
|
77987
|
+
"default": "null",
|
|
77988
|
+
"description": "Accessible name forwarded to the inner `<button>` or `<a>`, mapped to the `aria-label` attribute. It replaces the slotted text as the name, for a button whose text describes a state rather than the action it takes. Start it with the visible text, so a user who speaks the label they see still reaches the button. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary.",
|
|
77989
|
+
"fieldName": "ariaLabel"
|
|
77971
77990
|
}
|
|
77972
77991
|
],
|
|
77973
77992
|
"superclass": {
|
|
@@ -80250,7 +80269,7 @@
|
|
|
80250
80269
|
"declarations": [
|
|
80251
80270
|
{
|
|
80252
80271
|
"kind": "class",
|
|
80253
|
-
"description": "`<obc-command-menu>` – A toggleable command status menu for switching between \"in command\" and \"no command\" states.\n\nDisplays the current command status, description, and (optionally) location, along with a prominent toggle control for taking or releasing command. The component is designed for scenarios where a user needs to view and change the active command state for a system or station.\n\n---\n\n### Features\n- **Command State Toggle:** Switch between \"in command\" and \"no command\" states using an integrated toggle (based on `obc-start-stop-switch`).\n- **Status Display:** Shows a customizable status label, description, and optional location for the current command.\n- **Icon Support:** Accepts custom icons for command state via slots.\n- **Customizable Labels:** All action and state labels for the toggle can be customized via slots.\n- **Visual Feedback:** The component visually distinguishes between \"in command\" and \"no command\" states, including color and icon changes.\n- **Location Support:** Optionally displays the location of the command if `showLocation` is true.\n\n---\n\n### Usage Guidelines\nUse `<obc-command-menu>` to present and manage the active command state for a system, device, or station. It is ideal when users need to clearly see the current command status and quickly toggle control. The component is suitable for dashboards, control panels, or any interface where command handover is required.\n\n**TODO(designer):** Confirm if there are recommended icons, color schemes, or text length limits for status/description. Clarify if there are any constraints on when to use this component versus other status/toggle components.\n\n---\n\n### Slots\n| Slot Name | Renders When... | Purpose |\n|---------------------------------------|-------------------------------|-----------------------------------------------------------------|\n| `command-icon` | Always | Main icon representing the current command state. |\n| `command-status` | Always | Status label (e.g., \"Joystick\", \"NO CMD\"). |\n| `command-description` | Always | Description of the command state (e.g., \"DP\", \"CMD at DP\"). |\n| `command-location` | `showLocation` is true | Location label for the command (e.g., \"Aft Bridge\"). |\n| `
|
|
80272
|
+
"description": "`<obc-command-menu>` – A toggleable command status menu for switching between \"in command\" and \"no command\" states.\n\nDisplays the current command status, description, and (optionally) location, along with a prominent toggle control for taking or releasing command. The component is designed for scenarios where a user needs to view and change the active command state for a system or station.\n\n---\n\n### Features\n- **Command State Toggle:** Switch between \"in command\" and \"no command\" states using an integrated toggle (based on `obc-start-stop-switch`).\n- **Status Display:** Shows a customizable status label, description, and optional location for the current command.\n- **Icon Support:** Accepts custom icons for command state via slots.\n- **Customizable Labels:** All action and state labels for the toggle can be customized via slots.\n- **Visual Feedback:** The component visually distinguishes between \"in command\" and \"no command\" states, including color and icon changes.\n- **Location Support:** Optionally displays the location of the command if `showLocation` is true.\n- **Action Description:** A caption under the toggle, shown when `hasActionDescription` is true.\n- **Disabled State:** `disabled` greys out the toggle and stops it from being used, for a menu with nothing to take or release, for example while a request is pending.\n\n---\n\n### Usage Guidelines\nUse `<obc-command-menu>` to present and manage the active command state for a system, device, or station. It is ideal when users need to clearly see the current command status and quickly toggle control. The component is suitable for dashboards, control panels, or any interface where command handover is required.\n\n**TODO(designer):** Confirm if there are recommended icons, color schemes, or text length limits for status/description. Clarify if there are any constraints on when to use this component versus other status/toggle components.\n\n---\n\n### Slots\n| Slot Name | Renders When... | Purpose |\n|---------------------------------------|-------------------------------|-----------------------------------------------------------------|\n| `command-icon` | Always | Main icon representing the current command state. |\n| `command-status` | Always | Status label (e.g., \"Joystick\", \"NO CMD\"). |\n| `command-description` | Always | Description of the command state (e.g., \"DP\", \"CMD at DP\"). |\n| `command-location` | `showLocation` is true | Location label for the command (e.g., \"Aft Bridge\"). |\n| `toggle-action-to-in-command-label` | Always | Label for the action to take command (toggle to \"in command\"). |\n| `toggle-action-to-no-command-label` | Always | Label for the action to release command (toggle to \"no command\").|\n| `toggle-state-in-command-label` | Always | Status label when in \"in command\" state. |\n| `toggle-state-no-command-label` | Always | Status label when in \"no command\" state. |\n| `toggle-state-in-command-icon` | Always | Icon for the \"in command\" state (defaults to `<obi-command-in>`).|\n\nThe misspelled `toogle-…` names of these five slots are deprecated aliases: each is read only while its `toggle-…` slot is empty, and goes in the next major release (#1370).\n\n---\n\n### Properties and Attributes\n- **`inCommand`** (`boolean`): Whether the menu is in the \"in command\" state. Controls the toggle and visual state. (Default: `false`)\n- **`showLocation`** (`boolean`): Whether to display the location slot. If `false`, the location is omitted. (Default: `true`)\n- **`disabled`** (`boolean`): Disables the toggle. (Default: `false`)\n- **`hasActionDescription`** (`boolean`): Shows `actionDescription` under the toggle. (Default: `false`)\n- **`actionDescription`** (`string`): Caption under the toggle. (Default: `'Action description'`)\n\n---\n\n### Events\n- **`change`** – Fired when the command state is toggled. The event detail contains `{inCommand: boolean}` indicating the new state.\n\n---\n\n### Best Practices & Constraints\n- Use clear, concise labels for status and actions to ensure quick recognition.\n- Only display the location if it is relevant to the command context.\n- Keep only one command menu active per system at a time, so the states cannot conflict.\n- For accessibility, provide meaningful icons and text in all slots.\n- **TODO(designer):** Specify if there are any timing, animation, or accessibility requirements for the toggle interaction.\n\n---\n\n### Example\n```html\n<obc-command-menu .inCommand=${true}>\n <div slot=\"command-icon\"><obi-joystick></obi-joystick></div>\n <div slot=\"command-status\">Joystick</div>\n <div slot=\"command-description\">DP</div>\n <div slot=\"command-location\">Aft Bridge</div>\n <div slot=\"toggle-action-to-in-command-label\">Take</div>\n <div slot=\"toggle-action-to-no-command-label\">Release</div>\n <div slot=\"toggle-state-in-command-label\">In CMD</div>\n <div slot=\"toggle-state-no-command-label\">DP Aft Bridge</div>\n</obc-command-menu>\n```",
|
|
80254
80273
|
"name": "ObcCommandMenu",
|
|
80255
80274
|
"slots": [
|
|
80256
80275
|
{
|
|
@@ -80271,22 +80290,42 @@
|
|
|
80271
80290
|
},
|
|
80272
80291
|
{
|
|
80273
80292
|
"description": "Label for the action to take command.",
|
|
80274
|
-
"name": "
|
|
80293
|
+
"name": "toggle-action-to-in-command-label"
|
|
80275
80294
|
},
|
|
80276
80295
|
{
|
|
80277
80296
|
"description": "Label for the action to release command.",
|
|
80278
|
-
"name": "
|
|
80297
|
+
"name": "toggle-action-to-no-command-label"
|
|
80279
80298
|
},
|
|
80280
80299
|
{
|
|
80281
80300
|
"description": "Status label when in \"in command\" state.",
|
|
80282
|
-
"name": "
|
|
80301
|
+
"name": "toggle-state-in-command-label"
|
|
80283
80302
|
},
|
|
80284
80303
|
{
|
|
80285
80304
|
"description": "Status label when in \"no command\" state.",
|
|
80286
|
-
"name": "
|
|
80305
|
+
"name": "toggle-state-no-command-label"
|
|
80287
80306
|
},
|
|
80288
80307
|
{
|
|
80289
80308
|
"description": "Icon for the \"in command\" state (defaults to `<obi-command-in>`).",
|
|
80309
|
+
"name": "toggle-state-in-command-icon"
|
|
80310
|
+
},
|
|
80311
|
+
{
|
|
80312
|
+
"description": "Deprecated: use `toggle-action-to-in-command-label`. Read only while that slot is empty.",
|
|
80313
|
+
"name": "toogle-action-to-in-command-label"
|
|
80314
|
+
},
|
|
80315
|
+
{
|
|
80316
|
+
"description": "Deprecated: use `toggle-action-to-no-command-label`. Read only while that slot is empty.",
|
|
80317
|
+
"name": "toogle-action-to-no-command-label"
|
|
80318
|
+
},
|
|
80319
|
+
{
|
|
80320
|
+
"description": "Deprecated: use `toggle-state-in-command-label`. Read only while that slot is empty.",
|
|
80321
|
+
"name": "toogle-state-in-command-label"
|
|
80322
|
+
},
|
|
80323
|
+
{
|
|
80324
|
+
"description": "Deprecated: use `toggle-state-no-command-label`. Read only while that slot is empty.",
|
|
80325
|
+
"name": "toogle-state-no-command-label"
|
|
80326
|
+
},
|
|
80327
|
+
{
|
|
80328
|
+
"description": "Deprecated: use `toggle-state-in-command-icon`. Read only while that slot is empty.",
|
|
80290
80329
|
"name": "toogle-state-in-command-icon"
|
|
80291
80330
|
}
|
|
80292
80331
|
],
|
|
@@ -80342,6 +80381,41 @@
|
|
|
80342
80381
|
"default": "true",
|
|
80343
80382
|
"description": "Whether to display the location slot. If false, the location is omitted from the menu."
|
|
80344
80383
|
},
|
|
80384
|
+
{
|
|
80385
|
+
"kind": "field",
|
|
80386
|
+
"name": "disabled",
|
|
80387
|
+
"type": {
|
|
80388
|
+
"text": "boolean"
|
|
80389
|
+
},
|
|
80390
|
+
"default": "false",
|
|
80391
|
+
"description": "Disables the toggle, for a menu with nothing to offer: no user signed in, a request already pending, or a user who holds the command and may not release it. The toggle then hides its thumb and shows only the current side's state label.",
|
|
80392
|
+
"attribute": "disabled"
|
|
80393
|
+
},
|
|
80394
|
+
{
|
|
80395
|
+
"kind": "field",
|
|
80396
|
+
"name": "hasActionDescription",
|
|
80397
|
+
"type": {
|
|
80398
|
+
"text": "boolean"
|
|
80399
|
+
},
|
|
80400
|
+
"default": "false",
|
|
80401
|
+
"description": "Shows `actionDescription` as a caption under the toggle.",
|
|
80402
|
+
"attribute": "hasActionDescription"
|
|
80403
|
+
},
|
|
80404
|
+
{
|
|
80405
|
+
"kind": "field",
|
|
80406
|
+
"name": "actionDescription",
|
|
80407
|
+
"type": {
|
|
80408
|
+
"text": "string"
|
|
80409
|
+
},
|
|
80410
|
+
"default": "'Action description'",
|
|
80411
|
+
"description": "Caption under the toggle that says what taking or releasing the command does.\n\nAvailable when `hasActionDescription==true`.",
|
|
80412
|
+
"attribute": "actionDescription",
|
|
80413
|
+
"availableWhen": "hasActionDescription==true",
|
|
80414
|
+
"availableWhenIf": {
|
|
80415
|
+
"arg": "hasActionDescription",
|
|
80416
|
+
"truthy": true
|
|
80417
|
+
}
|
|
80418
|
+
},
|
|
80345
80419
|
{
|
|
80346
80420
|
"kind": "method",
|
|
80347
80421
|
"name": "onChange",
|
|
@@ -80400,6 +80474,33 @@
|
|
|
80400
80474
|
"default": "false",
|
|
80401
80475
|
"description": "Whether the menu is in the \"in command\" state. Controls the toggle and visual state.",
|
|
80402
80476
|
"fieldName": "inCommand"
|
|
80477
|
+
},
|
|
80478
|
+
{
|
|
80479
|
+
"name": "disabled",
|
|
80480
|
+
"type": {
|
|
80481
|
+
"text": "boolean"
|
|
80482
|
+
},
|
|
80483
|
+
"default": "false",
|
|
80484
|
+
"description": "Disables the toggle, for a menu with nothing to offer: no user signed in, a request already pending, or a user who holds the command and may not release it. The toggle then hides its thumb and shows only the current side's state label.",
|
|
80485
|
+
"fieldName": "disabled"
|
|
80486
|
+
},
|
|
80487
|
+
{
|
|
80488
|
+
"name": "hasActionDescription",
|
|
80489
|
+
"type": {
|
|
80490
|
+
"text": "boolean"
|
|
80491
|
+
},
|
|
80492
|
+
"default": "false",
|
|
80493
|
+
"description": "Shows `actionDescription` as a caption under the toggle.",
|
|
80494
|
+
"fieldName": "hasActionDescription"
|
|
80495
|
+
},
|
|
80496
|
+
{
|
|
80497
|
+
"name": "actionDescription",
|
|
80498
|
+
"type": {
|
|
80499
|
+
"text": "string"
|
|
80500
|
+
},
|
|
80501
|
+
"default": "'Action description'",
|
|
80502
|
+
"description": "Caption under the toggle that says what taking or releasing the command does.\n\nAvailable when `hasActionDescription==true`.",
|
|
80503
|
+
"fieldName": "actionDescription"
|
|
80403
80504
|
}
|
|
80404
80505
|
],
|
|
80405
80506
|
"superclass": {
|
|
@@ -96376,7 +96477,7 @@
|
|
|
96376
96477
|
"declarations": [
|
|
96377
96478
|
{
|
|
96378
96479
|
"kind": "class",
|
|
96379
|
-
"description": "`<obc-start-stop-switch>` – A two-state draggable toggle switch for significant binary actions like start/stop or enable/disable.\n\nThis switch provides a visually distinct, draggable toggle for binary actions where both states need to be explicitly labeled and reinforced. Unlike a simple on/off toggle, it displays both the current state label and an action label on the draggable thumb, making it ideal for consequential actions where user awareness is critical.\n\n### Features\n- **Drag-to-toggle interaction:** Users must drag the thumb across the track to change state (90% threshold required). This deliberate interaction prevents accidental toggles.\n- **Dual state labels:** Displays both a state label (e.g., \"Running\", \"Stopped\") and an action label on the thumb (e.g., \"Start\", \"Stop\").\n- **Visual variants:**\n - `normal`: Standard blue appearance when checked (default)\n - `running`: Green appearance indicating an active process (e.g., motor running)\n - `loading`: Light blue appearance indicating a pending/transitional state\n- **Size options:** `regular` (32px track height) or `large` (48px track height, matching touch target).\n- **Alert frame:** Optional red border to indicate alarm or critical state.\n- **Description text:** Optional text below the switch for additional context.\n- **Animated transitions:** Smooth CSS transitions for thumb movement and state changes.\n- **Keyboard accessible:** The switch is focusable and follows the ARIA switch pattern — `Enter` or `Space` toggles the state and fires the same `change` event as a completed drag.\n\n### Usage Guidelines\nUse `<obc-start-stop-switch>` when you need a prominent control for toggling between two mutually exclusive states where:\n- Both states should be explicitly labeled (not just \"on/off\")\n- The action has significant consequences (starting a motor, enabling a system)\n- Accidental activation should be prevented through deliberate drag interaction\n\nAvoid using this component for simple preferences or settings where a standard `<obc-switch>` or checkbox would suffice. This component is best suited for operational controls where the user must be aware of both the current state and the action they're about to take.\n\n**Related components:** For simple binary toggles without labels, use `<obc-switch>`. For grouped selections, use `<obc-radio>` or `<obc-checkbox>`.\n\n### Slots\n| Slot Name | Renders When... | Purpose |\n|---------------------------|----------------------|------------------------------------------------------------|\n| checked-state-icon | Always (if provided) | Icon displayed in the checked state area. |\n| unchecked-state-icon | Always (if provided) | Icon displayed in the unchecked state area. |\n| checked-state-label | Always | Label shown when switch is in checked position. |\n| unchecked-state-label | Always | Label shown when switch is in unchecked position. |\n| to-checked-action-label | When unchecked | Action label on thumb prompting user to activate. |\n| to-unchecked-action-label | When checked | Action label on thumb prompting user to deactivate. |\n\n### Events\n- `change` – Fired when the switch state changes after a successful drag. The event detail contains `{checked: boolean}` indicating the new state.\n\n### Best Practices\n- Keep labels concise (1-2 words) to fit within the track width.\n- Use meaningful action verbs: \"Start/Stop\", \"Enable/Disable\", \"Request/Release\".\n- Use the `running` variant to indicate an actively running process.\n- Use the `loading` variant during async operations before transitioning to `running` or `normal`.\n- Consider using `hasAlert` when the switch controls a critical system in alarm state.\n- The accessible name is computed from the slotted labels; provide `aria-label` on the host when those labels alone are not descriptive (`aria-labelledby` is not supported — ID references cannot cross the shadow boundary).\n\n### Example\n```html\n<obc-start-stop-switch checked variant=\"running\">\n <div slot=\"checked-state-icon\"><obi-placeholder></obi-placeholder></div>\n <div slot=\"checked-state-label\">Running</div>\n <div slot=\"unchecked-state-label\">Stopped</div>\n <div slot=\"to-checked-action-label\">Start</div>\n <div slot=\"to-unchecked-action-label\">Stop</div>\n</obc-start-stop-switch>\n```\n\n### Keyboard\n[APG Switch](https://www.w3.org/WAI/ARIA/apg/patterns/switch/): `Space` and\n`Enter` toggle it. The knob inside is a drag handle for pointers
|
|
96480
|
+
"description": "`<obc-start-stop-switch>` – A two-state draggable toggle switch for significant binary actions like start/stop or enable/disable.\n\nThis switch provides a visually distinct, draggable toggle for binary actions where both states need to be explicitly labeled and reinforced. Unlike a simple on/off toggle, it displays both the current state label and an action label on the draggable thumb, making it ideal for consequential actions where user awareness is critical.\n\n### Features\n- **Drag-to-toggle interaction:** Users must drag the thumb across the track to change state (90% threshold required). This deliberate interaction prevents accidental toggles.\n- **Dual state labels:** Displays both a state label (e.g., \"Running\", \"Stopped\") and an action label on the thumb (e.g., \"Start\", \"Stop\").\n- **Visual variants:**\n - `normal`: Standard blue appearance when checked (default)\n - `running`: Green appearance indicating an active process (e.g., motor running)\n - `loading`: Light blue appearance indicating a pending/transitional state\n- **Size options:** `regular` (32px track height) or `large` (48px track height, matching touch target).\n- **Alert frame:** Optional red border to indicate alarm or critical state.\n- **Description text:** Optional text below the switch for additional context.\n- **Animated transitions:** Smooth CSS transitions for thumb movement and state changes.\n- **Keyboard accessible:** The switch is focusable and follows the ARIA switch pattern — `Enter` or `Space` toggles the state and fires the same `change` event as a completed drag.\n\n### Usage Guidelines\nUse `<obc-start-stop-switch>` when you need a prominent control for toggling between two mutually exclusive states where:\n- Both states should be explicitly labeled (not just \"on/off\")\n- The action has significant consequences (starting a motor, enabling a system)\n- Accidental activation should be prevented through deliberate drag interaction\n\nAvoid using this component for simple preferences or settings where a standard `<obc-switch>` or checkbox would suffice. This component is best suited for operational controls where the user must be aware of both the current state and the action they're about to take.\n\n**Related components:** For simple binary toggles without labels, use `<obc-switch>`. For grouped selections, use `<obc-radio>` or `<obc-checkbox>`.\n\n### Slots\n| Slot Name | Renders When... | Purpose |\n|---------------------------|----------------------|------------------------------------------------------------|\n| checked-state-icon | Always (if provided) | Icon displayed in the checked state area. |\n| unchecked-state-icon | Always (if provided) | Icon displayed in the unchecked state area. |\n| checked-state-label | Always | Label shown when switch is in checked position. |\n| unchecked-state-label | Always | Label shown when switch is in unchecked position. |\n| to-checked-action-label | When unchecked | Action label on thumb prompting user to activate. |\n| to-unchecked-action-label | When checked | Action label on thumb prompting user to deactivate. |\n\n### Events\n- `change` – Fired when the switch state changes after a successful drag. The event detail contains `{checked: boolean}` indicating the new state.\n\n### Best Practices\n- Keep labels concise (1-2 words) to fit within the track width.\n- Use meaningful action verbs: \"Start/Stop\", \"Enable/Disable\", \"Request/Release\".\n- Use the `running` variant to indicate an actively running process.\n- Use the `loading` variant during async operations before transitioning to `running` or `normal`.\n- Consider using `hasAlert` when the switch controls a critical system in alarm state.\n- The accessible name is computed from the slotted labels; provide `aria-label` on the host when those labels alone are not descriptive (`aria-labelledby` is not supported — ID references cannot cross the shadow boundary).\n\n### Example\n```html\n<obc-start-stop-switch checked variant=\"running\">\n <div slot=\"checked-state-icon\"><obi-placeholder></obi-placeholder></div>\n <div slot=\"checked-state-label\">Running</div>\n <div slot=\"unchecked-state-label\">Stopped</div>\n <div slot=\"to-checked-action-label\">Start</div>\n <div slot=\"to-unchecked-action-label\">Stop</div>\n</obc-start-stop-switch>\n```\n\n### Keyboard\n[APG Switch](https://www.w3.org/WAI/ARIA/apg/patterns/switch/): `Space` and\n`Enter` toggle it. The knob inside is a drag handle for pointers, not a\ncontrol of its own: a switch announces its content as one name, so nothing\ninside it may take focus. The description, when shown, describes the switch.\n\nLeft out: nothing.",
|
|
96380
96481
|
"name": "ObcStartStopSwitch",
|
|
96381
96482
|
"slots": [
|
|
96382
96483
|
{
|
|
@@ -70,6 +70,7 @@ export declare enum segmentPosition {
|
|
|
70
70
|
* - `href` (string): If set, renders as an anchor link.
|
|
71
71
|
* - `target` (string): Link target (only applies when `href` is set).
|
|
72
72
|
* - `segmentPosition` (segmentPosition): Visual grouping for segmented button layouts.
|
|
73
|
+
* - `ariaLabel` (string): Accessible name of the button, in place of its slotted text.
|
|
73
74
|
*
|
|
74
75
|
* ### Best Practices
|
|
75
76
|
* - Always provide a clear label for accessibility, even if using only icons.
|
|
@@ -101,6 +102,11 @@ export declare enum segmentPosition {
|
|
|
101
102
|
* @property segmentPosition - Position within a segmented button group: `single` stands alone, `start`,
|
|
102
103
|
* `middle` and `end` shape the button for the first, an inner and the last
|
|
103
104
|
* segment.
|
|
105
|
+
* @property ariaLabel - Accessible name forwarded to the inner `<button>` or `<a>`, mapped to the
|
|
106
|
+
* `aria-label` attribute. It replaces the slotted text as the name, for a button whose text
|
|
107
|
+
* describes a state rather than the action it takes. Start it with the visible text, so a user
|
|
108
|
+
* who speaks the label they see still reaches the button. `aria-labelledby` is not supported:
|
|
109
|
+
* ID references cannot cross the shadow boundary.
|
|
104
110
|
* @fires click - Fired when the button is clicked (if not disabled).
|
|
105
111
|
*
|
|
106
112
|
* @slot - Default slot for button label text (required for accessibility)
|
|
@@ -125,6 +131,8 @@ export declare class ObcButton extends LitElement {
|
|
|
125
131
|
target?: string;
|
|
126
132
|
/** Position within a segmented button group: `single` stands alone, `start`, `middle` and `end` shape the button for the first, an inner and the last segment. */
|
|
127
133
|
segmentPosition: segmentPosition;
|
|
134
|
+
/** Accessible name forwarded to the inner `<button>` or `<a>`, mapped to the `aria-label` attribute. It replaces the slotted text as the name, for a button whose text describes a state rather than the action it takes. Start it with the visible text, so a user who speaks the label they see still reaches the button. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary. */
|
|
135
|
+
ariaLabel: string | null;
|
|
128
136
|
private renderLeadingIcon;
|
|
129
137
|
private renderTrailingIcon;
|
|
130
138
|
render(): import('lit-html').TemplateResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAQ1C;;;;;GAKG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAQ1C;;;;;GAKG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,qBACa,SAAU,SAAQ,UAAU;IACb,OAAO,EAAE,aAAa,CAAwB;IAE9B,SAAS,UAAS;IAEjC,QAAQ,UAAS;IAEjB,eAAe,UAAS;IAExB,gBAAgB,UAAS;IAE1B,IAAI,CAAC,EAAE,MAAM,CAAa;IAE1B,MAAM,CAAC,EAAE,MAAM,CAAa;IAE5B,eAAe,EAAE,eAAe,CACjC;IAGhB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEzC,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,kBAAkB;IAWjB,MAAM;IA8Bf,OAAgB,MAAM,0BAAwB;CAC/C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
|
@@ -44,6 +44,7 @@ var ObcButton = class ObcButton extends LitElement {
|
|
|
44
44
|
this.href = void 0;
|
|
45
45
|
this.target = void 0;
|
|
46
46
|
this.segmentPosition = "single";
|
|
47
|
+
this.ariaLabel = null;
|
|
47
48
|
}
|
|
48
49
|
renderLeadingIcon() {
|
|
49
50
|
if (this.showLeadingIcon) return html$1`
|
|
@@ -76,6 +77,7 @@ var ObcButton = class ObcButton extends LitElement {
|
|
|
76
77
|
?disabled=${this.disabled}
|
|
77
78
|
href=${ifDefined(this.href)}
|
|
78
79
|
target=${ifDefined(this.target)}
|
|
80
|
+
aria-label=${ifDefined(this.ariaLabel ?? void 0)}
|
|
79
81
|
part="wrapper"
|
|
80
82
|
>
|
|
81
83
|
<div class="visible-wrapper" part="visible-wrapper">
|
|
@@ -103,6 +105,10 @@ __decorate([property({ type: Boolean })], ObcButton.prototype, "showTrailingIcon
|
|
|
103
105
|
__decorate([property({ type: String })], ObcButton.prototype, "href", void 0);
|
|
104
106
|
__decorate([property({ type: String })], ObcButton.prototype, "target", void 0);
|
|
105
107
|
__decorate([property({ type: String })], ObcButton.prototype, "segmentPosition", void 0);
|
|
108
|
+
__decorate([property({
|
|
109
|
+
type: String,
|
|
110
|
+
attribute: "aria-label"
|
|
111
|
+
})], ObcButton.prototype, "ariaLabel", void 0);
|
|
106
112
|
ObcButton = __decorate([customElement("obc-button")], ObcButton);
|
|
107
113
|
export { ButtonVariant, ObcButton, segmentPosition };
|
|
108
114
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["iconStyle","_decorate"],"sources":["../../../src/components/button/button.ts"],"sourcesContent":["import {LitElement, unsafeCSS} from 'lit';\nimport {html, literal} from 'lit/static-html.js';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {ifDefined} from 'lit/directives/if-defined.js';\nimport {customElement} from '../../decorator.js';\nimport iconStyle from './button.css?inline';\n\n/**\n * Enum for button visual variants.\n * - `normal`: Standard button appearance for primary actions.\n * - `raised`: Button with elevated styling for emphasis.\n * - `flat`: Minimal, low-emphasis button for secondary actions.\n */\nexport enum ButtonVariant {\n normal = 'normal',\n raised = 'raised',\n flat = 'flat',\n}\n\n/**\n * Enum for segment position in a segmented button group.\n * - `single`: Standalone button.\n * - `start`: First button in a group.\n * - `middle`: Middle button in a group.\n * - `end`: Last button in a group.\n */\nexport enum segmentPosition {\n single = 'single',\n start = 'start',\n middle = 'middle',\n end = 'end',\n}\n\n/**\n * `<obc-button>` – A versatile button component supporting icons, variants, and link behavior.\n *\n * The obc-button component provides a flexible, accessible button for triggering actions or navigation. It can display leading and/or trailing icons, adapt its appearance via multiple visual variants, and optionally render as a link when an `href` is provided. Designed for consistency and usability across a wide range of UI scenarios.\n *\n * ### Features\n * - **Variants:**\n * - `normal` (default): Standard button appearance for primary actions.\n * - `raised`: Button with elevated styling for emphasis.\n * - `flat`: Minimal, low-emphasis button for secondary actions.\n * - **Icon Support:**\n * - Leading icon (slot=\"leading-icon\") and/or trailing icon (slot=\"trailing-icon\") can be displayed.\n * - **Full Width:**\n * - Set `fullWidth` to make the button expand to the width of its container.\n * - **Button or Link:**\n * - Renders as a native `<button>` by default, or as an `<a>` anchor when `href` is set (with optional `target`).\n * - **Disabled State:**\n * - Supports disabling for both button and link modes.\n * - **Segmented Group Support:**\n * - `segmentPosition` property allows the button to visually join with others in a segmented group.\n *\n * ### Usage Guidelines\n * Use `obc-button` for interactive actions such as submitting forms, triggering dialogs, or navigating to other views.\n * - Choose the `normal` variant for primary actions, `raised` for extra emphasis, and `flat` for less prominent or inline actions.\n * - Use leading/trailing icons to visually reinforce the button's purpose (e.g., a download or arrow icon).\n * - When navigation is required, provide an `href` so the button renders as a link for proper semantics and accessibility.\n * - For icon-only buttons, supply an accessible label via the default slot or `aria-label`.\n * - Avoid using multiple buttons with conflicting actions in close proximity; follow standard UI guidelines for button grouping and emphasis.\n * - Use `segmentPosition` to visually group buttons for related actions.\n * - **TODO(designer):** Confirm if there are recommended icon sizes or spacing guidelines for best visual alignment.\n *\n * ### Slots\n * | Slot Name | Renders When... | Purpose |\n * |-----------------|--------------------------|----------------------------------------------|\n * | (default) | Always | Button label text (required for accessibility)|\n * | leading-icon | `showLeadingIcon` is true | Icon displayed before the label |\n * | trailing-icon | `showTrailingIcon` is true| Icon displayed after the label |\n *\n * ### Properties\n * - `variant` (ButtonVariant): Controls the visual style. Default is `normal`.\n * - `fullWidth` (boolean): Expands button to fill container width when true.\n * - `disabled` (boolean): Disables the button or link.\n * - `showLeadingIcon` (boolean): Shows the leading icon slot when true.\n * - `showTrailingIcon` (boolean): Shows the trailing icon slot when true.\n * - `href` (string): If set, renders as an anchor link.\n * - `target` (string): Link target (only applies when `href` is set).\n * - `segmentPosition` (segmentPosition): Visual grouping for segmented button layouts.\n *\n * ### Best Practices\n * - Always provide a clear label for accessibility, even if using only icons.\n * - Use only one primary action per view for clarity.\n * - When using as a link, ensure `href` points to a valid destination and consider `target=\"_blank\"` for external links.\n * - Disabled state prevents all interaction and applies correct styling.\n * - For segmented groups, set `segmentPosition` appropriately on each button to ensure correct border radius and grouping.\n *\n * ### Example:\n * ```\n * <obc-button variant=\"raised\" showLeadingIcon>\n * <span slot=\"leading-icon\"><obi-search></obi-search></span>\n * Search\n * </obc-button>\n * ```\n *\n * @property fullWidth - Expands the button to fill the width of its container when true.\n * @property disabled - Disables the button or link, preventing user interaction and applying disabled styling.\n * @property showLeadingIcon - Whether to show the leading icon slot (`slot=\"leading-icon\"`).\n * When true, content in the `leading-icon` slot will be displayed before the label.\n * @property showTrailingIcon - Whether to show the trailing icon slot (`slot=\"trailing-icon\"`).\n * When true, content in the `trailing-icon` slot will be displayed after the label.\n * @property href - When provided, renders the button as an anchor link (`<a>`) instead of a native button.\n * Use for navigation actions.\n * @property target - Specifies the target for the anchor link (only applies when `href` is set).\n * Common values: `_blank`, `_self`, `_parent`, `_top`.\n * @property variant - Visual style: `normal` (default) is the standard button, `raised` is\n * elevated for emphasis, `flat` is minimal and low-emphasis.\n * @property segmentPosition - Position within a segmented button group: `single` stands alone, `start`,\n * `middle` and `end` shape the button for the first, an inner and the last\n * segment.\n * @fires click - Fired when the button is clicked (if not disabled).\n *\n * @slot - Default slot for button label text (required for accessibility)\n * @slot leading-icon - Slot for an icon to appear before the label (shown when `showLeadingIcon` is true)\n * @slot trailing-icon - Slot for an icon to appear after the label (shown when `showTrailingIcon` is true)\n * @stable\n */\n@customElement('obc-button')\nexport class ObcButton extends LitElement {\n @property({type: String}) variant: ButtonVariant = ButtonVariant.normal;\n\n @property({type: Boolean, reflect: true}) fullWidth = false;\n\n @property({type: Boolean}) disabled = false;\n\n @property({type: Boolean}) showLeadingIcon = false;\n\n @property({type: Boolean}) showTrailingIcon = false;\n\n @property({type: String}) href?: string = undefined;\n\n @property({type: String}) target?: string = undefined;\n\n @property({type: String}) segmentPosition: segmentPosition =\n segmentPosition.single;\n\n private renderLeadingIcon() {\n if (this.showLeadingIcon) {\n return html`\n <span class=\"icon leading\" part=\"icon leading\">\n <slot name=\"leading-icon\"></slot>\n </span>\n `;\n }\n return html``;\n }\n\n private renderTrailingIcon() {\n if (this.showTrailingIcon) {\n return html`\n <span class=\"icon trailing\" part=\"icon trailing\">\n <slot name=\"trailing-icon\"></slot>\n </span>\n `;\n }\n return html``;\n }\n\n override render() {\n const tag = this.href ? literal`a` : literal`button`;\n\n return html`\n <${tag}\n class=${classMap({\n wrapper: true,\n ['variant-' + this.variant]: true,\n hasIconLeading: this.showLeadingIcon,\n hasIconTrailing: this.showTrailingIcon,\n 'full-width': this.fullWidth,\n ['segment-position-' + this.segmentPosition]: true,\n })}\n ?disabled=${this.disabled}\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n part=\"wrapper\"\n >\n <div class=\"visible-wrapper\" part=\"visible-wrapper\">\n ${this.renderLeadingIcon()}\n <span class=\"label\" part=\"label\">\n <slot></slot>\n </span>\n ${this.renderTrailingIcon()}\n </div>\n </${tag}>\n `;\n }\n\n static override styles = unsafeCSS(iconStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-button': ObcButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAY,gBAAL,yBAAA,eAAA;CACL,cAAA,YAAA;CACA,cAAA,YAAA;CACA,cAAA,UAAA;;AACF,EAAA,CAAA,CAAA;;;;;;;;AASA,IAAY,kBAAL,yBAAA,iBAAA;CACL,gBAAA,YAAA;CACA,gBAAA,WAAA;CACA,gBAAA,YAAA;CACA,gBAAA,SAAA;;AACF,EAAA,CAAA,CAAA;AAwFO,IAAM,YAAN,MAAM,kBAAkB,WAAW;;;;EAGc,KAAA,YAAA;EAEhB,KAAA,WAAA;EAEO,KAAA,kBAAA;EAEC,KAAA,mBAAA;EAEJ,KAAA,OAAA,KAAA;EAEE,KAAA,SAAA,KAAA;;;CAK5C,oBAA4B;EAC1B,IAAI,KAAK,iBACP,OAAO,MAAI;;;;;EAMb,OAAO,MAAI;CACb;CAEA,qBAA6B;EAC3B,IAAI,KAAK,kBACP,OAAO,MAAI;;;;;EAMb,OAAO,MAAI;CACb;CAEA,SAAkB;EAChB,MAAM,MAAM,KAAK,OAAO,OAAO,MAAM,OAAO;EAE5C,OAAO,MAAI;SACN,IAAI;gBACG,SAAS;GACf,SAAS;IACR,aAAa,KAAK,UAAU;GAC7B,gBAAgB,KAAK;GACrB,iBAAiB,KAAK;GACtB,cAAc,KAAK;IAClB,sBAAsB,KAAK,kBAAkB;EAChD,CAAC,EAAE;oBACS,KAAK,SAAS;eACnB,UAAU,KAAK,IAAI,EAAE;iBACnB,UAAU,KAAK,MAAM,EAAE;;;;YAI5B,KAAK,kBAAkB,EAAE;;;;YAIzB,KAAK,mBAAmB,EAAE;;UAE5B,IAAI;;CAEZ;;EAEyB,KAAA,SAAA,UAAUA,cAAS;;AAC9C;AArEGC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,WAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAS,SAAS;AAAI,CAAC,CAAA,GAAA,UAAA,WAAA,aAAA,KAAA,CAAA;AAEvCA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,UAAA,WAAA,YAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,UAAA,WAAA,mBAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,UAAA,WAAA,oBAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,QAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,UAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,mBAAA,KAAA,CAAA;AAhBzB,YAAAA,WAAA,CAAA,cAAc,YAAY,CAAA,GAAA,SAAA"}
|
|
1
|
+
{"version":3,"file":"button.js","names":["iconStyle","_decorate"],"sources":["../../../src/components/button/button.ts"],"sourcesContent":["import {LitElement, unsafeCSS} from 'lit';\nimport {html, literal} from 'lit/static-html.js';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {ifDefined} from 'lit/directives/if-defined.js';\nimport {customElement} from '../../decorator.js';\nimport iconStyle from './button.css?inline';\n\n/**\n * Enum for button visual variants.\n * - `normal`: Standard button appearance for primary actions.\n * - `raised`: Button with elevated styling for emphasis.\n * - `flat`: Minimal, low-emphasis button for secondary actions.\n */\nexport enum ButtonVariant {\n normal = 'normal',\n raised = 'raised',\n flat = 'flat',\n}\n\n/**\n * Enum for segment position in a segmented button group.\n * - `single`: Standalone button.\n * - `start`: First button in a group.\n * - `middle`: Middle button in a group.\n * - `end`: Last button in a group.\n */\nexport enum segmentPosition {\n single = 'single',\n start = 'start',\n middle = 'middle',\n end = 'end',\n}\n\n/**\n * `<obc-button>` – A versatile button component supporting icons, variants, and link behavior.\n *\n * The obc-button component provides a flexible, accessible button for triggering actions or navigation. It can display leading and/or trailing icons, adapt its appearance via multiple visual variants, and optionally render as a link when an `href` is provided. Designed for consistency and usability across a wide range of UI scenarios.\n *\n * ### Features\n * - **Variants:**\n * - `normal` (default): Standard button appearance for primary actions.\n * - `raised`: Button with elevated styling for emphasis.\n * - `flat`: Minimal, low-emphasis button for secondary actions.\n * - **Icon Support:**\n * - Leading icon (slot=\"leading-icon\") and/or trailing icon (slot=\"trailing-icon\") can be displayed.\n * - **Full Width:**\n * - Set `fullWidth` to make the button expand to the width of its container.\n * - **Button or Link:**\n * - Renders as a native `<button>` by default, or as an `<a>` anchor when `href` is set (with optional `target`).\n * - **Disabled State:**\n * - Supports disabling for both button and link modes.\n * - **Segmented Group Support:**\n * - `segmentPosition` property allows the button to visually join with others in a segmented group.\n *\n * ### Usage Guidelines\n * Use `obc-button` for interactive actions such as submitting forms, triggering dialogs, or navigating to other views.\n * - Choose the `normal` variant for primary actions, `raised` for extra emphasis, and `flat` for less prominent or inline actions.\n * - Use leading/trailing icons to visually reinforce the button's purpose (e.g., a download or arrow icon).\n * - When navigation is required, provide an `href` so the button renders as a link for proper semantics and accessibility.\n * - For icon-only buttons, supply an accessible label via the default slot or `aria-label`.\n * - Avoid using multiple buttons with conflicting actions in close proximity; follow standard UI guidelines for button grouping and emphasis.\n * - Use `segmentPosition` to visually group buttons for related actions.\n * - **TODO(designer):** Confirm if there are recommended icon sizes or spacing guidelines for best visual alignment.\n *\n * ### Slots\n * | Slot Name | Renders When... | Purpose |\n * |-----------------|--------------------------|----------------------------------------------|\n * | (default) | Always | Button label text (required for accessibility)|\n * | leading-icon | `showLeadingIcon` is true | Icon displayed before the label |\n * | trailing-icon | `showTrailingIcon` is true| Icon displayed after the label |\n *\n * ### Properties\n * - `variant` (ButtonVariant): Controls the visual style. Default is `normal`.\n * - `fullWidth` (boolean): Expands button to fill container width when true.\n * - `disabled` (boolean): Disables the button or link.\n * - `showLeadingIcon` (boolean): Shows the leading icon slot when true.\n * - `showTrailingIcon` (boolean): Shows the trailing icon slot when true.\n * - `href` (string): If set, renders as an anchor link.\n * - `target` (string): Link target (only applies when `href` is set).\n * - `segmentPosition` (segmentPosition): Visual grouping for segmented button layouts.\n * - `ariaLabel` (string): Accessible name of the button, in place of its slotted text.\n *\n * ### Best Practices\n * - Always provide a clear label for accessibility, even if using only icons.\n * - Use only one primary action per view for clarity.\n * - When using as a link, ensure `href` points to a valid destination and consider `target=\"_blank\"` for external links.\n * - Disabled state prevents all interaction and applies correct styling.\n * - For segmented groups, set `segmentPosition` appropriately on each button to ensure correct border radius and grouping.\n *\n * ### Example:\n * ```\n * <obc-button variant=\"raised\" showLeadingIcon>\n * <span slot=\"leading-icon\"><obi-search></obi-search></span>\n * Search\n * </obc-button>\n * ```\n *\n * @property fullWidth - Expands the button to fill the width of its container when true.\n * @property disabled - Disables the button or link, preventing user interaction and applying disabled styling.\n * @property showLeadingIcon - Whether to show the leading icon slot (`slot=\"leading-icon\"`).\n * When true, content in the `leading-icon` slot will be displayed before the label.\n * @property showTrailingIcon - Whether to show the trailing icon slot (`slot=\"trailing-icon\"`).\n * When true, content in the `trailing-icon` slot will be displayed after the label.\n * @property href - When provided, renders the button as an anchor link (`<a>`) instead of a native button.\n * Use for navigation actions.\n * @property target - Specifies the target for the anchor link (only applies when `href` is set).\n * Common values: `_blank`, `_self`, `_parent`, `_top`.\n * @property variant - Visual style: `normal` (default) is the standard button, `raised` is\n * elevated for emphasis, `flat` is minimal and low-emphasis.\n * @property segmentPosition - Position within a segmented button group: `single` stands alone, `start`,\n * `middle` and `end` shape the button for the first, an inner and the last\n * segment.\n * @property ariaLabel - Accessible name forwarded to the inner `<button>` or `<a>`, mapped to the\n * `aria-label` attribute. It replaces the slotted text as the name, for a button whose text\n * describes a state rather than the action it takes. Start it with the visible text, so a user\n * who speaks the label they see still reaches the button. `aria-labelledby` is not supported:\n * ID references cannot cross the shadow boundary.\n * @fires click - Fired when the button is clicked (if not disabled).\n *\n * @slot - Default slot for button label text (required for accessibility)\n * @slot leading-icon - Slot for an icon to appear before the label (shown when `showLeadingIcon` is true)\n * @slot trailing-icon - Slot for an icon to appear after the label (shown when `showTrailingIcon` is true)\n * @stable\n */\n@customElement('obc-button')\nexport class ObcButton extends LitElement {\n @property({type: String}) variant: ButtonVariant = ButtonVariant.normal;\n\n @property({type: Boolean, reflect: true}) fullWidth = false;\n\n @property({type: Boolean}) disabled = false;\n\n @property({type: Boolean}) showLeadingIcon = false;\n\n @property({type: Boolean}) showTrailingIcon = false;\n\n @property({type: String}) href?: string = undefined;\n\n @property({type: String}) target?: string = undefined;\n\n @property({type: String}) segmentPosition: segmentPosition =\n segmentPosition.single;\n\n @property({type: String, attribute: 'aria-label'})\n override ariaLabel: string | null = null;\n\n private renderLeadingIcon() {\n if (this.showLeadingIcon) {\n return html`\n <span class=\"icon leading\" part=\"icon leading\">\n <slot name=\"leading-icon\"></slot>\n </span>\n `;\n }\n return html``;\n }\n\n private renderTrailingIcon() {\n if (this.showTrailingIcon) {\n return html`\n <span class=\"icon trailing\" part=\"icon trailing\">\n <slot name=\"trailing-icon\"></slot>\n </span>\n `;\n }\n return html``;\n }\n\n override render() {\n const tag = this.href ? literal`a` : literal`button`;\n\n return html`\n <${tag}\n class=${classMap({\n wrapper: true,\n ['variant-' + this.variant]: true,\n hasIconLeading: this.showLeadingIcon,\n hasIconTrailing: this.showTrailingIcon,\n 'full-width': this.fullWidth,\n ['segment-position-' + this.segmentPosition]: true,\n })}\n ?disabled=${this.disabled}\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n aria-label=${ifDefined(this.ariaLabel ?? undefined)}\n part=\"wrapper\"\n >\n <div class=\"visible-wrapper\" part=\"visible-wrapper\">\n ${this.renderLeadingIcon()}\n <span class=\"label\" part=\"label\">\n <slot></slot>\n </span>\n ${this.renderTrailingIcon()}\n </div>\n </${tag}>\n `;\n }\n\n static override styles = unsafeCSS(iconStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-button': ObcButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAY,gBAAL,yBAAA,eAAA;CACL,cAAA,YAAA;CACA,cAAA,YAAA;CACA,cAAA,UAAA;;AACF,EAAA,CAAA,CAAA;;;;;;;;AASA,IAAY,kBAAL,yBAAA,iBAAA;CACL,gBAAA,YAAA;CACA,gBAAA,WAAA;CACA,gBAAA,YAAA;CACA,gBAAA,SAAA;;AACF,EAAA,CAAA,CAAA;AA8FO,IAAM,YAAN,MAAM,kBAAkB,WAAW;;;;EAGc,KAAA,YAAA;EAEhB,KAAA,WAAA;EAEO,KAAA,kBAAA;EAEC,KAAA,mBAAA;EAEJ,KAAA,OAAA,KAAA;EAEE,KAAA,SAAA,KAAA;;EAMR,KAAA,YAAA;;CAEpC,oBAA4B;EAC1B,IAAI,KAAK,iBACP,OAAO,MAAI;;;;;EAMb,OAAO,MAAI;CACb;CAEA,qBAA6B;EAC3B,IAAI,KAAK,kBACP,OAAO,MAAI;;;;;EAMb,OAAO,MAAI;CACb;CAEA,SAAkB;EAChB,MAAM,MAAM,KAAK,OAAO,OAAO,MAAM,OAAO;EAE5C,OAAO,MAAI;SACN,IAAI;gBACG,SAAS;GACf,SAAS;IACR,aAAa,KAAK,UAAU;GAC7B,gBAAgB,KAAK;GACrB,iBAAiB,KAAK;GACtB,cAAc,KAAK;IAClB,sBAAsB,KAAK,kBAAkB;EAChD,CAAC,EAAE;oBACS,KAAK,SAAS;eACnB,UAAU,KAAK,IAAI,EAAE;iBACnB,UAAU,KAAK,MAAM,EAAE;qBACnB,UAAU,KAAK,aAAa,KAAA,CAAS,EAAE;;;;YAIhD,KAAK,kBAAkB,EAAE;;;;YAIzB,KAAK,mBAAmB,EAAE;;UAE5B,IAAI;;CAEZ;;EAEyB,KAAA,SAAA,UAAUA,cAAS;;AAC9C;AAzEGC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,WAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAS,SAAS;AAAI,CAAC,CAAA,GAAA,UAAA,WAAA,aAAA,KAAA,CAAA;AAEvCA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,UAAA,WAAA,YAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,UAAA,WAAA,mBAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,UAAA,WAAA,oBAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,QAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,UAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,UAAA,WAAA,mBAAA,KAAA,CAAA;AAGvBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAY,CAAC,CAAA,GAAA,UAAA,WAAA,aAAA,KAAA,CAAA;AAnBlD,YAAAA,WAAA,CAAA,cAAc,YAAY,CAAA,GAAA,SAAA"}
|
|
@@ -19,6 +19,8 @@ export type ObcCommandMenuChangeEvent = CustomEvent<{
|
|
|
19
19
|
* - **Customizable Labels:** All action and state labels for the toggle can be customized via slots.
|
|
20
20
|
* - **Visual Feedback:** The component visually distinguishes between "in command" and "no command" states, including color and icon changes.
|
|
21
21
|
* - **Location Support:** Optionally displays the location of the command if `showLocation` is true.
|
|
22
|
+
* - **Action Description:** A caption under the toggle, shown when `hasActionDescription` is true.
|
|
23
|
+
* - **Disabled State:** `disabled` greys out the toggle and stops it from being used, for a menu with nothing to take or release, for example while a request is pending.
|
|
22
24
|
*
|
|
23
25
|
* ---
|
|
24
26
|
*
|
|
@@ -36,17 +38,22 @@ export type ObcCommandMenuChangeEvent = CustomEvent<{
|
|
|
36
38
|
* | `command-status` | Always | Status label (e.g., "Joystick", "NO CMD"). |
|
|
37
39
|
* | `command-description` | Always | Description of the command state (e.g., "DP", "CMD at DP"). |
|
|
38
40
|
* | `command-location` | `showLocation` is true | Location label for the command (e.g., "Aft Bridge"). |
|
|
39
|
-
* | `
|
|
40
|
-
* | `
|
|
41
|
-
* | `
|
|
42
|
-
* | `
|
|
43
|
-
* | `
|
|
41
|
+
* | `toggle-action-to-in-command-label` | Always | Label for the action to take command (toggle to "in command"). |
|
|
42
|
+
* | `toggle-action-to-no-command-label` | Always | Label for the action to release command (toggle to "no command").|
|
|
43
|
+
* | `toggle-state-in-command-label` | Always | Status label when in "in command" state. |
|
|
44
|
+
* | `toggle-state-no-command-label` | Always | Status label when in "no command" state. |
|
|
45
|
+
* | `toggle-state-in-command-icon` | Always | Icon for the "in command" state (defaults to `<obi-command-in>`).|
|
|
46
|
+
*
|
|
47
|
+
* The misspelled `toogle-…` names of these five slots are deprecated aliases: each is read only while its `toggle-…` slot is empty, and goes in the next major release (#1370).
|
|
44
48
|
*
|
|
45
49
|
* ---
|
|
46
50
|
*
|
|
47
51
|
* ### Properties and Attributes
|
|
48
52
|
* - **`inCommand`** (`boolean`): Whether the menu is in the "in command" state. Controls the toggle and visual state. (Default: `false`)
|
|
49
53
|
* - **`showLocation`** (`boolean`): Whether to display the location slot. If `false`, the location is omitted. (Default: `true`)
|
|
54
|
+
* - **`disabled`** (`boolean`): Disables the toggle. (Default: `false`)
|
|
55
|
+
* - **`hasActionDescription`** (`boolean`): Shows `actionDescription` under the toggle. (Default: `false`)
|
|
56
|
+
* - **`actionDescription`** (`string`): Caption under the toggle. (Default: `'Action description'`)
|
|
50
57
|
*
|
|
51
58
|
* ---
|
|
52
59
|
*
|
|
@@ -71,10 +78,10 @@ export type ObcCommandMenuChangeEvent = CustomEvent<{
|
|
|
71
78
|
* <div slot="command-status">Joystick</div>
|
|
72
79
|
* <div slot="command-description">DP</div>
|
|
73
80
|
* <div slot="command-location">Aft Bridge</div>
|
|
74
|
-
* <div slot="
|
|
75
|
-
* <div slot="
|
|
76
|
-
* <div slot="
|
|
77
|
-
* <div slot="
|
|
81
|
+
* <div slot="toggle-action-to-in-command-label">Take</div>
|
|
82
|
+
* <div slot="toggle-action-to-no-command-label">Release</div>
|
|
83
|
+
* <div slot="toggle-state-in-command-label">In CMD</div>
|
|
84
|
+
* <div slot="toggle-state-no-command-label">DP Aft Bridge</div>
|
|
78
85
|
* </obc-command-menu>
|
|
79
86
|
* ```
|
|
80
87
|
*
|
|
@@ -85,15 +92,26 @@ export type ObcCommandMenuChangeEvent = CustomEvent<{
|
|
|
85
92
|
* @property softDismiss - Lets the menu close itself on a click outside it, on `Escape`, or when another menu opens. The page is covered while the menu is open, so the closing click reaches nothing there; only the top bar's strip stays clickable, which is how its buttons switch or close menus in one click. Wire it with three bindings: set `softDismiss`, bind `open` to a flag you keep, and reset that flag on `close`. The button that opens the menu needs no wiring of its own: flip the flag from its click, or from the button event of `obc-top-bar` or `obc-integration-bar`. The user menu's *Soft Dismiss From A Bar Button* story shows that wiring, the brilliance menu's *Soft Dismiss* story the one for a button you hold yourself (`bindPopoverTrigger`), and the vue demo runs its top bar this way. Leave it off to show and hide the menu yourself.
|
|
86
93
|
* @property open - Whether the menu is showing. Bind it to a flag you keep rather than toggling it from the menu's own value: when the menu closes itself, `open` is written back to `false` before the button's click reaches your handler, so `menu.open = !menu.open` gets out of step. Reset the flag on `close`.
|
|
87
94
|
* @availableWhen open softDismiss==true
|
|
95
|
+
* @property disabled - Disables the toggle, for a menu with nothing to offer: no user signed in, a request
|
|
96
|
+
* already pending, or a user who holds the command and may not release it. The toggle then hides its
|
|
97
|
+
* thumb and shows only the current side's state label.
|
|
98
|
+
* @property hasActionDescription - Shows `actionDescription` as a caption under the toggle.
|
|
99
|
+
* @property actionDescription - Caption under the toggle that says what taking or releasing the command does.
|
|
100
|
+
* @availableWhen actionDescription hasActionDescription==true
|
|
88
101
|
* @slot command-icon - Main icon representing the current command state.
|
|
89
102
|
* @slot command-status - Status label (e.g., "Joystick", "NO CMD").
|
|
90
103
|
* @slot command-description - Description of the command state.
|
|
91
104
|
* @slot command-location - Location label for the command (shown if `showLocation` is true).
|
|
92
|
-
* @slot
|
|
93
|
-
* @slot
|
|
94
|
-
* @slot
|
|
95
|
-
* @slot
|
|
96
|
-
* @slot
|
|
105
|
+
* @slot toggle-action-to-in-command-label - Label for the action to take command.
|
|
106
|
+
* @slot toggle-action-to-no-command-label - Label for the action to release command.
|
|
107
|
+
* @slot toggle-state-in-command-label - Status label when in "in command" state.
|
|
108
|
+
* @slot toggle-state-no-command-label - Status label when in "no command" state.
|
|
109
|
+
* @slot toggle-state-in-command-icon - Icon for the "in command" state (defaults to `<obi-command-in>`).
|
|
110
|
+
* @slot toogle-action-to-in-command-label - Deprecated: use `toggle-action-to-in-command-label`. Read only while that slot is empty.
|
|
111
|
+
* @slot toogle-action-to-no-command-label - Deprecated: use `toggle-action-to-no-command-label`. Read only while that slot is empty.
|
|
112
|
+
* @slot toogle-state-in-command-label - Deprecated: use `toggle-state-in-command-label`. Read only while that slot is empty.
|
|
113
|
+
* @slot toogle-state-no-command-label - Deprecated: use `toggle-state-no-command-label`. Read only while that slot is empty.
|
|
114
|
+
* @slot toogle-state-in-command-icon - Deprecated: use `toggle-state-in-command-icon`. Read only while that slot is empty.
|
|
97
115
|
* @fires {CustomEvent<{inCommand: boolean}>} change - Fired when the command state is toggled.
|
|
98
116
|
* @fires {CustomEvent<void>} close - Fired when the menu closed on its own, from a click outside, `Escape`, or another menu opening. `open` is already `false` by the time it arrives; reset the flag you bind to `open` here, or the next click on the button finds it still set and asks a closed menu to close.
|
|
99
117
|
* @beta
|
|
@@ -112,6 +130,16 @@ export declare class ObcCommandMenu extends LitElement {
|
|
|
112
130
|
inCommand: boolean;
|
|
113
131
|
/** Whether to display the location slot. If false, the location is omitted from the menu. */
|
|
114
132
|
showLocation: boolean;
|
|
133
|
+
/** Disables the toggle, for a menu with nothing to offer: no user signed in, a request already pending, or a user who holds the command and may not release it. The toggle then hides its thumb and shows only the current side's state label. */
|
|
134
|
+
disabled: boolean;
|
|
135
|
+
/** Shows `actionDescription` as a caption under the toggle. */
|
|
136
|
+
hasActionDescription: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Caption under the toggle that says what taking or releasing the command does.
|
|
139
|
+
*
|
|
140
|
+
* Available when `hasActionDescription==true`.
|
|
141
|
+
*/
|
|
142
|
+
actionDescription: string;
|
|
115
143
|
render(): import('lit-html').TemplateResult<1>;
|
|
116
144
|
/**
|
|
117
145
|
* Handles the toggle change event from the start-stop switch and emits a `change` event with the new command state.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-menu.d.ts","sourceRoot":"","sources":["../../../src/components/command-menu/command-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAGzD,OAAO,2CAA2C,CAAC;AACnD,OAAO,gCAAgC,CAAC;AAIxC,OAAO,EAAC,iBAAiB,EAAC,MAAM,sCAAsC,CAAC;AAEvE,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,CAAC,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"command-menu.d.ts","sourceRoot":"","sources":["../../../src/components/command-menu/command-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAGzD,OAAO,2CAA2C,CAAC;AACnD,OAAO,gCAAgC,CAAC;AAIxC,OAAO,EAAC,iBAAiB,EAAC,MAAM,sCAAsC,CAAC;AAEvE,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8GG;AACH,qBACa,cAAe,SAAQ,UAAU;IACjB,WAAW,UAAS;IAEpB,IAAI,UAAS;IAExC,SAAS,CAAC,QAAQ,CAAC,qBAAqB,oBAA+B;IAE5C,SAAS,UAAS;IAEA,YAAY,EAAE,OAAO,CAAQ;IAE/C,QAAQ,UAAS;IAEjB,oBAAoB,UAAS;IAE9B,iBAAiB,SAAwB;IAE1D,MAAM;IA8Ef;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAehB,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF"}
|
|
@@ -16,6 +16,9 @@ var ObcCommandMenu = class ObcCommandMenu extends LitElement {
|
|
|
16
16
|
this.softDismissController = new PopoverController(this);
|
|
17
17
|
this.inCommand = false;
|
|
18
18
|
this.showLocation = true;
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this.hasActionDescription = false;
|
|
21
|
+
this.actionDescription = "Action description";
|
|
19
22
|
}
|
|
20
23
|
render() {
|
|
21
24
|
return html`
|
|
@@ -53,23 +56,36 @@ var ObcCommandMenu = class ObcCommandMenu extends LitElement {
|
|
|
53
56
|
@change=${this.onChange}
|
|
54
57
|
.checked=${this.inCommand}
|
|
55
58
|
.size=${"large"}
|
|
59
|
+
.disabled=${this.disabled}
|
|
60
|
+
.hasDescription=${this.hasActionDescription}
|
|
61
|
+
.description=${this.actionDescription}
|
|
56
62
|
>
|
|
57
63
|
<div slot="to-checked-action-label">
|
|
58
|
-
<slot name="
|
|
64
|
+
<slot name="toggle-action-to-in-command-label">
|
|
65
|
+
<slot name="toogle-action-to-in-command-label"></slot>
|
|
66
|
+
</slot>
|
|
59
67
|
</div>
|
|
60
68
|
<div slot="to-unchecked-action-label">
|
|
61
|
-
<slot name="
|
|
69
|
+
<slot name="toggle-action-to-no-command-label">
|
|
70
|
+
<slot name="toogle-action-to-no-command-label"></slot>
|
|
71
|
+
</slot>
|
|
62
72
|
</div>
|
|
63
73
|
<div slot="checked-state-label">
|
|
64
|
-
<slot name="
|
|
74
|
+
<slot name="toggle-state-in-command-label">
|
|
75
|
+
<slot name="toogle-state-in-command-label"></slot>
|
|
76
|
+
</slot>
|
|
65
77
|
</div>
|
|
66
78
|
<div slot="checked-state-icon">
|
|
67
|
-
<slot name="
|
|
68
|
-
<
|
|
79
|
+
<slot name="toggle-state-in-command-icon">
|
|
80
|
+
<slot name="toogle-state-in-command-icon">
|
|
81
|
+
<obi-command-in></obi-command-in>
|
|
82
|
+
</slot>
|
|
69
83
|
</slot>
|
|
70
84
|
</div>
|
|
71
85
|
<div slot="unchecked-state-label">
|
|
72
|
-
<slot name="
|
|
86
|
+
<slot name="toggle-state-no-command-label">
|
|
87
|
+
<slot name="toogle-state-no-command-label"></slot>
|
|
88
|
+
</slot>
|
|
73
89
|
</div>
|
|
74
90
|
</obc-start-stop-switch>
|
|
75
91
|
</div>
|
|
@@ -103,6 +119,9 @@ __decorate([property({
|
|
|
103
119
|
type: Boolean,
|
|
104
120
|
attribute: false
|
|
105
121
|
})], ObcCommandMenu.prototype, "showLocation", void 0);
|
|
122
|
+
__decorate([property({ type: Boolean })], ObcCommandMenu.prototype, "disabled", void 0);
|
|
123
|
+
__decorate([property({ type: Boolean })], ObcCommandMenu.prototype, "hasActionDescription", void 0);
|
|
124
|
+
__decorate([property({ type: String })], ObcCommandMenu.prototype, "actionDescription", void 0);
|
|
106
125
|
ObcCommandMenu = __decorate([customElement("obc-command-menu")], ObcCommandMenu);
|
|
107
126
|
export { ObcCommandMenu };
|
|
108
127
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-menu.js","names":["compentStyle","_decorate"],"sources":["../../../src/components/command-menu/command-menu.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport compentStyle from './command-menu.css?inline';\nimport '../start-stop-switch/start-stop-switch.js';\nimport '../../icons/icon-command-in.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {ObcStartStopSwitchChangeEvent} from '../start-stop-switch/start-stop-switch.js';\nimport {customElement} from '../../decorator.js';\nimport {PopoverController} from '../../internal/popover-controller.js';\n\nexport type ObcCommandMenuChangeEvent = CustomEvent<{inCommand: boolean}>;\n\n/**\n * `<obc-command-menu>` – A toggleable command status menu for switching between \"in command\" and \"no command\" states.\n *\n * Displays the current command status, description, and (optionally) location, along with a prominent toggle control for taking or releasing command. The component is designed for scenarios where a user needs to view and change the active command state for a system or station.\n *\n * ---\n *\n * ### Features\n * - **Command State Toggle:** Switch between \"in command\" and \"no command\" states using an integrated toggle (based on `obc-start-stop-switch`).\n * - **Status Display:** Shows a customizable status label, description, and optional location for the current command.\n * - **Icon Support:** Accepts custom icons for command state via slots.\n * - **Customizable Labels:** All action and state labels for the toggle can be customized via slots.\n * - **Visual Feedback:** The component visually distinguishes between \"in command\" and \"no command\" states, including color and icon changes.\n * - **Location Support:** Optionally displays the location of the command if `showLocation` is true.\n *\n * ---\n *\n * ### Usage Guidelines\n * Use `<obc-command-menu>` to present and manage the active command state for a system, device, or station. It is ideal when users need to clearly see the current command status and quickly toggle control. The component is suitable for dashboards, control panels, or any interface where command handover is required.\n *\n * **TODO(designer):** Confirm if there are recommended icons, color schemes, or text length limits for status/description. Clarify if there are any constraints on when to use this component versus other status/toggle components.\n *\n * ---\n *\n * ### Slots\n * | Slot Name | Renders When... | Purpose |\n * |---------------------------------------|-------------------------------|-----------------------------------------------------------------|\n * | `command-icon` | Always | Main icon representing the current command state. |\n * | `command-status` | Always | Status label (e.g., \"Joystick\", \"NO CMD\"). |\n * | `command-description` | Always | Description of the command state (e.g., \"DP\", \"CMD at DP\"). |\n * | `command-location` | `showLocation` is true | Location label for the command (e.g., \"Aft Bridge\"). |\n * | `toogle-action-to-in-command-label` | Always | Label for the action to take command (toggle to \"in command\"). |\n * | `toogle-action-to-no-command-label` | Always | Label for the action to release command (toggle to \"no command\").|\n * | `toogle-state-in-command-label` | Always | Status label when in \"in command\" state. |\n * | `toogle-state-no-command-label` | Always | Status label when in \"no command\" state. |\n * | `toogle-state-in-command-icon` | Always | Icon for the \"in command\" state (defaults to `<obi-command-in>`).|\n *\n * ---\n *\n * ### Properties and Attributes\n * - **`inCommand`** (`boolean`): Whether the menu is in the \"in command\" state. Controls the toggle and visual state. (Default: `false`)\n * - **`showLocation`** (`boolean`): Whether to display the location slot. If `false`, the location is omitted. (Default: `true`)\n *\n * ---\n *\n * ### Events\n * - **`change`** – Fired when the command state is toggled. The event detail contains `{inCommand: boolean}` indicating the new state.\n *\n * ---\n *\n * ### Best Practices & Constraints\n * - Use clear, concise labels for status and actions to ensure quick recognition.\n * - Only display the location if it is relevant to the command context.\n * - Keep only one command menu active per system at a time, so the states cannot conflict.\n * - For accessibility, provide meaningful icons and text in all slots.\n * - **TODO(designer):** Specify if there are any timing, animation, or accessibility requirements for the toggle interaction.\n *\n * ---\n *\n * ### Example\n * ```html\n * <obc-command-menu .inCommand=${true}>\n * <div slot=\"command-icon\"><obi-joystick></obi-joystick></div>\n * <div slot=\"command-status\">Joystick</div>\n * <div slot=\"command-description\">DP</div>\n * <div slot=\"command-location\">Aft Bridge</div>\n * <div slot=\"toogle-action-to-in-command-label\">Take</div>\n * <div slot=\"toogle-action-to-no-command-label\">Release</div>\n * <div slot=\"toogle-state-in-command-label\">In CMD</div>\n * <div slot=\"toogle-state-no-command-label\">DP Aft Bridge</div>\n * </obc-command-menu>\n * ```\n *\n * @property inCommand - Whether the menu is in the \"in command\" state.\n * Controls the toggle and visual state.\n * @property showLocation - Whether to display the location slot.\n * If false, the location is omitted from the menu.\n * @property softDismiss - Lets the menu close itself on a click outside it, on `Escape`, or when another menu opens. The page is covered while the menu is open, so the closing click reaches nothing there; only the top bar's strip stays clickable, which is how its buttons switch or close menus in one click. Wire it with three bindings: set `softDismiss`, bind `open` to a flag you keep, and reset that flag on `close`. The button that opens the menu needs no wiring of its own: flip the flag from its click, or from the button event of `obc-top-bar` or `obc-integration-bar`. The user menu's *Soft Dismiss From A Bar Button* story shows that wiring, the brilliance menu's *Soft Dismiss* story the one for a button you hold yourself (`bindPopoverTrigger`), and the vue demo runs its top bar this way. Leave it off to show and hide the menu yourself.\n * @property open - Whether the menu is showing. Bind it to a flag you keep rather than toggling it from the menu's own value: when the menu closes itself, `open` is written back to `false` before the button's click reaches your handler, so `menu.open = !menu.open` gets out of step. Reset the flag on `close`.\n * @availableWhen open softDismiss==true\n * @slot command-icon - Main icon representing the current command state.\n * @slot command-status - Status label (e.g., \"Joystick\", \"NO CMD\").\n * @slot command-description - Description of the command state.\n * @slot command-location - Location label for the command (shown if `showLocation` is true).\n * @slot toogle-action-to-in-command-label - Label for the action to take command.\n * @slot toogle-action-to-no-command-label - Label for the action to release command.\n * @slot toogle-state-in-command-label - Status label when in \"in command\" state.\n * @slot toogle-state-no-command-label - Status label when in \"no command\" state.\n * @slot toogle-state-in-command-icon - Icon for the \"in command\" state (defaults to `<obi-command-in>`).\n * @fires {CustomEvent<{inCommand: boolean}>} change - Fired when the command state is toggled.\n * @fires {CustomEvent<void>} close - Fired when the menu closed on its own, from a click outside, `Escape`, or another menu opening. `open` is already `false` by the time it arrives; reset the flag you bind to `open` here, or the next click on the button finds it still set and asks a closed menu to close.\n * @beta\n */\n@customElement('obc-command-menu')\nexport class ObcCommandMenu extends LitElement {\n @property({type: Boolean}) softDismiss = false;\n\n @property({type: Boolean}) open = false;\n\n protected readonly softDismissController = new PopoverController(this);\n\n @property({type: Boolean}) inCommand = false;\n\n @property({type: Boolean, attribute: false}) showLocation: boolean = true;\n\n override render() {\n return html`\n <div\n class=${classMap({\n card: true,\n 'in-command': this.inCommand,\n 'no-command': !this.inCommand,\n 'has-location': this.showLocation,\n })}\n >\n <div class=\"title-container\">Command</div>\n <div class=\"command-container\">\n <div class=\"value-container\">\n <div class=\"icon command\">\n <slot name=\"command-icon\"></slot>\n </div>\n <div class=\"value\">\n <div class=\"status\">\n <slot name=\"command-status\"></slot>\n </div>\n <div class=\"description\">\n <div class=\"command-description\">\n <slot name=\"command-description\"></slot>\n </div>\n ${\n this.showLocation\n ? html` <div class=\"divider\"></div>\n <div class=\"command-location\">\n <slot name=\"command-location\"></slot>\n </div>`\n : nothing\n }\n </div>\n </div>\n </div>\n <div class=\"action-container\">\n <obc-start-stop-switch\n @change=${this.onChange}\n .checked=${this.inCommand}\n .size=${'large'}\n >\n <div slot=\"to-checked-action-label\">\n <slot name=\"toogle-action-to-in-command-label\"></slot>\n </div>\n <div slot=\"to-unchecked-action-label\">\n <slot name=\"toogle-action-to-no-command-label\"></slot>\n </div>\n <div slot=\"checked-state-label\">\n <slot name=\"toogle-state-in-command-label\"></slot>\n </div>\n <div slot=\"checked-state-icon\">\n <slot name=\"toogle-state-in-command-icon\">\n <obi-command-in></obi-command-in>\n </slot>\n </div>\n <div slot=\"unchecked-state-label\">\n <slot name=\"toogle-state-no-command-label\"></slot>\n </div>\n </obc-start-stop-switch>\n </div>\n </div>\n </div>\n `;\n }\n\n /**\n * Handles the toggle change event from the start-stop switch and emits a `change` event with the new command state.\n *\n * @fires change\n */\n private onChange(event: ObcStartStopSwitchChangeEvent) {\n // Stop the start-stop-switch's composed event from leaking through\n // our shadow DOM — consumers should only see command-menu's own event.\n event.stopPropagation();\n const newValue = event.detail.checked;\n this.inCommand = newValue;\n this.dispatchEvent(\n new CustomEvent<{inCommand: boolean}>('change', {\n detail: {inCommand: newValue},\n bubbles: true,\n composed: true,\n })\n );\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-command-menu': ObcCommandMenu;\n }\n}\n"],"mappings":";;;;;;;;;;AA0GO,IAAM,iBAAN,MAAM,uBAAuB,WAAW;;;EACJ,KAAA,cAAA;EAEP,KAAA,OAAA;EAES,KAAA,wBAAA,IAAI,kBAAkB,IAAI;EAE9B,KAAA,YAAA;EAE8B,KAAA,eAAA;;CAErE,SAAkB;EAChB,OAAO,IAAI;;gBAEC,SAAS;GACf,MAAM;GACN,cAAc,KAAK;GACnB,cAAc,CAAC,KAAK;GACpB,gBAAgB,KAAK;EACvB,CAAC,EAAE;;;;;;;;;;;;;;;;kBAiBO,KAAK,eACD,IAAI;;;kCAIJ,QACL;;;;;;wBAMO,KAAK,SAAS;yBACb,KAAK,UAAU;sBAClB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;CAwB5B;;;;;;CAOA,SAAiB,OAAsC;EAGrD,MAAM,gBAAgB;EACtB,MAAM,WAAW,MAAM,OAAO;EAC9B,KAAK,YAAY;EACjB,KAAK,cACH,IAAI,YAAkC,UAAU;GAC9C,QAAQ,EAAC,WAAW,SAAQ;GAC5B,SAAS;GACT,UAAU;EACZ,CAAC,CACH;CACF;;EAEyB,KAAA,SAAA,UAAUA,oBAAY;;AACjD;AAhGGC,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,eAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,QAAA,KAAA,CAAA;AAIxBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,aAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAS,WAAW;AAAK,CAAC,CAAA,GAAA,eAAA,WAAA,gBAAA,KAAA,CAAA;AAV5C,iBAAAA,WAAA,CAAA,cAAc,kBAAkB,CAAA,GAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"command-menu.js","names":["compentStyle","_decorate"],"sources":["../../../src/components/command-menu/command-menu.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport compentStyle from './command-menu.css?inline';\nimport '../start-stop-switch/start-stop-switch.js';\nimport '../../icons/icon-command-in.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {ObcStartStopSwitchChangeEvent} from '../start-stop-switch/start-stop-switch.js';\nimport {customElement} from '../../decorator.js';\nimport {PopoverController} from '../../internal/popover-controller.js';\n\nexport type ObcCommandMenuChangeEvent = CustomEvent<{inCommand: boolean}>;\n\n/**\n * `<obc-command-menu>` – A toggleable command status menu for switching between \"in command\" and \"no command\" states.\n *\n * Displays the current command status, description, and (optionally) location, along with a prominent toggle control for taking or releasing command. The component is designed for scenarios where a user needs to view and change the active command state for a system or station.\n *\n * ---\n *\n * ### Features\n * - **Command State Toggle:** Switch between \"in command\" and \"no command\" states using an integrated toggle (based on `obc-start-stop-switch`).\n * - **Status Display:** Shows a customizable status label, description, and optional location for the current command.\n * - **Icon Support:** Accepts custom icons for command state via slots.\n * - **Customizable Labels:** All action and state labels for the toggle can be customized via slots.\n * - **Visual Feedback:** The component visually distinguishes between \"in command\" and \"no command\" states, including color and icon changes.\n * - **Location Support:** Optionally displays the location of the command if `showLocation` is true.\n * - **Action Description:** A caption under the toggle, shown when `hasActionDescription` is true.\n * - **Disabled State:** `disabled` greys out the toggle and stops it from being used, for a menu with nothing to take or release, for example while a request is pending.\n *\n * ---\n *\n * ### Usage Guidelines\n * Use `<obc-command-menu>` to present and manage the active command state for a system, device, or station. It is ideal when users need to clearly see the current command status and quickly toggle control. The component is suitable for dashboards, control panels, or any interface where command handover is required.\n *\n * **TODO(designer):** Confirm if there are recommended icons, color schemes, or text length limits for status/description. Clarify if there are any constraints on when to use this component versus other status/toggle components.\n *\n * ---\n *\n * ### Slots\n * | Slot Name | Renders When... | Purpose |\n * |---------------------------------------|-------------------------------|-----------------------------------------------------------------|\n * | `command-icon` | Always | Main icon representing the current command state. |\n * | `command-status` | Always | Status label (e.g., \"Joystick\", \"NO CMD\"). |\n * | `command-description` | Always | Description of the command state (e.g., \"DP\", \"CMD at DP\"). |\n * | `command-location` | `showLocation` is true | Location label for the command (e.g., \"Aft Bridge\"). |\n * | `toggle-action-to-in-command-label` | Always | Label for the action to take command (toggle to \"in command\"). |\n * | `toggle-action-to-no-command-label` | Always | Label for the action to release command (toggle to \"no command\").|\n * | `toggle-state-in-command-label` | Always | Status label when in \"in command\" state. |\n * | `toggle-state-no-command-label` | Always | Status label when in \"no command\" state. |\n * | `toggle-state-in-command-icon` | Always | Icon for the \"in command\" state (defaults to `<obi-command-in>`).|\n *\n * The misspelled `toogle-…` names of these five slots are deprecated aliases: each is read only while its `toggle-…` slot is empty, and goes in the next major release (#1370).\n *\n * ---\n *\n * ### Properties and Attributes\n * - **`inCommand`** (`boolean`): Whether the menu is in the \"in command\" state. Controls the toggle and visual state. (Default: `false`)\n * - **`showLocation`** (`boolean`): Whether to display the location slot. If `false`, the location is omitted. (Default: `true`)\n * - **`disabled`** (`boolean`): Disables the toggle. (Default: `false`)\n * - **`hasActionDescription`** (`boolean`): Shows `actionDescription` under the toggle. (Default: `false`)\n * - **`actionDescription`** (`string`): Caption under the toggle. (Default: `'Action description'`)\n *\n * ---\n *\n * ### Events\n * - **`change`** – Fired when the command state is toggled. The event detail contains `{inCommand: boolean}` indicating the new state.\n *\n * ---\n *\n * ### Best Practices & Constraints\n * - Use clear, concise labels for status and actions to ensure quick recognition.\n * - Only display the location if it is relevant to the command context.\n * - Keep only one command menu active per system at a time, so the states cannot conflict.\n * - For accessibility, provide meaningful icons and text in all slots.\n * - **TODO(designer):** Specify if there are any timing, animation, or accessibility requirements for the toggle interaction.\n *\n * ---\n *\n * ### Example\n * ```html\n * <obc-command-menu .inCommand=${true}>\n * <div slot=\"command-icon\"><obi-joystick></obi-joystick></div>\n * <div slot=\"command-status\">Joystick</div>\n * <div slot=\"command-description\">DP</div>\n * <div slot=\"command-location\">Aft Bridge</div>\n * <div slot=\"toggle-action-to-in-command-label\">Take</div>\n * <div slot=\"toggle-action-to-no-command-label\">Release</div>\n * <div slot=\"toggle-state-in-command-label\">In CMD</div>\n * <div slot=\"toggle-state-no-command-label\">DP Aft Bridge</div>\n * </obc-command-menu>\n * ```\n *\n * @property inCommand - Whether the menu is in the \"in command\" state.\n * Controls the toggle and visual state.\n * @property showLocation - Whether to display the location slot.\n * If false, the location is omitted from the menu.\n * @property softDismiss - Lets the menu close itself on a click outside it, on `Escape`, or when another menu opens. The page is covered while the menu is open, so the closing click reaches nothing there; only the top bar's strip stays clickable, which is how its buttons switch or close menus in one click. Wire it with three bindings: set `softDismiss`, bind `open` to a flag you keep, and reset that flag on `close`. The button that opens the menu needs no wiring of its own: flip the flag from its click, or from the button event of `obc-top-bar` or `obc-integration-bar`. The user menu's *Soft Dismiss From A Bar Button* story shows that wiring, the brilliance menu's *Soft Dismiss* story the one for a button you hold yourself (`bindPopoverTrigger`), and the vue demo runs its top bar this way. Leave it off to show and hide the menu yourself.\n * @property open - Whether the menu is showing. Bind it to a flag you keep rather than toggling it from the menu's own value: when the menu closes itself, `open` is written back to `false` before the button's click reaches your handler, so `menu.open = !menu.open` gets out of step. Reset the flag on `close`.\n * @availableWhen open softDismiss==true\n * @property disabled - Disables the toggle, for a menu with nothing to offer: no user signed in, a request\n * already pending, or a user who holds the command and may not release it. The toggle then hides its\n * thumb and shows only the current side's state label.\n * @property hasActionDescription - Shows `actionDescription` as a caption under the toggle.\n * @property actionDescription - Caption under the toggle that says what taking or releasing the command does.\n * @availableWhen actionDescription hasActionDescription==true\n * @slot command-icon - Main icon representing the current command state.\n * @slot command-status - Status label (e.g., \"Joystick\", \"NO CMD\").\n * @slot command-description - Description of the command state.\n * @slot command-location - Location label for the command (shown if `showLocation` is true).\n * @slot toggle-action-to-in-command-label - Label for the action to take command.\n * @slot toggle-action-to-no-command-label - Label for the action to release command.\n * @slot toggle-state-in-command-label - Status label when in \"in command\" state.\n * @slot toggle-state-no-command-label - Status label when in \"no command\" state.\n * @slot toggle-state-in-command-icon - Icon for the \"in command\" state (defaults to `<obi-command-in>`).\n * @slot toogle-action-to-in-command-label - Deprecated: use `toggle-action-to-in-command-label`. Read only while that slot is empty.\n * @slot toogle-action-to-no-command-label - Deprecated: use `toggle-action-to-no-command-label`. Read only while that slot is empty.\n * @slot toogle-state-in-command-label - Deprecated: use `toggle-state-in-command-label`. Read only while that slot is empty.\n * @slot toogle-state-no-command-label - Deprecated: use `toggle-state-no-command-label`. Read only while that slot is empty.\n * @slot toogle-state-in-command-icon - Deprecated: use `toggle-state-in-command-icon`. Read only while that slot is empty.\n * @fires {CustomEvent<{inCommand: boolean}>} change - Fired when the command state is toggled.\n * @fires {CustomEvent<void>} close - Fired when the menu closed on its own, from a click outside, `Escape`, or another menu opening. `open` is already `false` by the time it arrives; reset the flag you bind to `open` here, or the next click on the button finds it still set and asks a closed menu to close.\n * @beta\n */\n@customElement('obc-command-menu')\nexport class ObcCommandMenu extends LitElement {\n @property({type: Boolean}) softDismiss = false;\n\n @property({type: Boolean}) open = false;\n\n protected readonly softDismissController = new PopoverController(this);\n\n @property({type: Boolean}) inCommand = false;\n\n @property({type: Boolean, attribute: false}) showLocation: boolean = true;\n\n @property({type: Boolean}) disabled = false;\n\n @property({type: Boolean}) hasActionDescription = false;\n\n @property({type: String}) actionDescription = 'Action description';\n\n override render() {\n return html`\n <div\n class=${classMap({\n card: true,\n 'in-command': this.inCommand,\n 'no-command': !this.inCommand,\n 'has-location': this.showLocation,\n })}\n >\n <div class=\"title-container\">Command</div>\n <div class=\"command-container\">\n <div class=\"value-container\">\n <div class=\"icon command\">\n <slot name=\"command-icon\"></slot>\n </div>\n <div class=\"value\">\n <div class=\"status\">\n <slot name=\"command-status\"></slot>\n </div>\n <div class=\"description\">\n <div class=\"command-description\">\n <slot name=\"command-description\"></slot>\n </div>\n ${\n this.showLocation\n ? html` <div class=\"divider\"></div>\n <div class=\"command-location\">\n <slot name=\"command-location\"></slot>\n </div>`\n : nothing\n }\n </div>\n </div>\n </div>\n <div class=\"action-container\">\n <obc-start-stop-switch\n @change=${this.onChange}\n .checked=${this.inCommand}\n .size=${'large'}\n .disabled=${this.disabled}\n .hasDescription=${this.hasActionDescription}\n .description=${this.actionDescription}\n >\n <div slot=\"to-checked-action-label\">\n <slot name=\"toggle-action-to-in-command-label\">\n <slot name=\"toogle-action-to-in-command-label\"></slot>\n </slot>\n </div>\n <div slot=\"to-unchecked-action-label\">\n <slot name=\"toggle-action-to-no-command-label\">\n <slot name=\"toogle-action-to-no-command-label\"></slot>\n </slot>\n </div>\n <div slot=\"checked-state-label\">\n <slot name=\"toggle-state-in-command-label\">\n <slot name=\"toogle-state-in-command-label\"></slot>\n </slot>\n </div>\n <div slot=\"checked-state-icon\">\n <slot name=\"toggle-state-in-command-icon\">\n <slot name=\"toogle-state-in-command-icon\">\n <obi-command-in></obi-command-in>\n </slot>\n </slot>\n </div>\n <div slot=\"unchecked-state-label\">\n <slot name=\"toggle-state-no-command-label\">\n <slot name=\"toogle-state-no-command-label\"></slot>\n </slot>\n </div>\n </obc-start-stop-switch>\n </div>\n </div>\n </div>\n `;\n }\n\n /**\n * Handles the toggle change event from the start-stop switch and emits a `change` event with the new command state.\n *\n * @fires change\n */\n private onChange(event: ObcStartStopSwitchChangeEvent) {\n // Stop the start-stop-switch's composed event from leaking through\n // our shadow DOM — consumers should only see command-menu's own event.\n event.stopPropagation();\n const newValue = event.detail.checked;\n this.inCommand = newValue;\n this.dispatchEvent(\n new CustomEvent<{inCommand: boolean}>('change', {\n detail: {inCommand: newValue},\n bubbles: true,\n composed: true,\n })\n );\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-command-menu': ObcCommandMenu;\n }\n}\n"],"mappings":";;;;;;;;;;AA4HO,IAAM,iBAAN,MAAM,uBAAuB,WAAW;;;EACJ,KAAA,cAAA;EAEP,KAAA,OAAA;EAES,KAAA,wBAAA,IAAI,kBAAkB,IAAI;EAE9B,KAAA,YAAA;EAE8B,KAAA,eAAA;EAE/B,KAAA,WAAA;EAEY,KAAA,uBAAA;EAEJ,KAAA,oBAAA;;CAE9C,SAAkB;EAChB,OAAO,IAAI;;gBAEC,SAAS;GACf,MAAM;GACN,cAAc,KAAK;GACnB,cAAc,CAAC,KAAK;GACpB,gBAAgB,KAAK;EACvB,CAAC,EAAE;;;;;;;;;;;;;;;;kBAiBO,KAAK,eACD,IAAI;;;kCAIJ,QACL;;;;;;wBAMO,KAAK,SAAS;yBACb,KAAK,UAAU;sBAClB,QAAQ;0BACJ,KAAK,SAAS;gCACR,KAAK,qBAAqB;6BAC7B,KAAK,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkClD;;;;;;CAOA,SAAiB,OAAsC;EAGrD,MAAM,gBAAgB;EACtB,MAAM,WAAW,MAAM,OAAO;EAC9B,KAAK,YAAY;EACjB,KAAK,cACH,IAAI,YAAkC,UAAU;GAC9C,QAAQ,EAAC,WAAW,SAAQ;GAC5B,SAAS;GACT,UAAU;EACZ,CAAC,CACH;CACF;;EAEyB,KAAA,SAAA,UAAUA,oBAAY;;AACjD;AAnHGC,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,eAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,QAAA,KAAA,CAAA;AAIxBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,aAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAS,WAAW;AAAK,CAAC,CAAA,GAAA,eAAA,WAAA,gBAAA,KAAA,CAAA;AAE1CA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,YAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,wBAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,eAAA,WAAA,qBAAA,KAAA,CAAA;AAhBzB,iBAAAA,WAAA,CAAA,cAAc,kBAAkB,CAAA,GAAA,cAAA"}
|