@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.58 → 2.0.0-next.60

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.
Files changed (213) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +8144 -5241
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +1937 -78
  4. package/dist/alert-severity.d.ts +38 -0
  5. package/dist/alert-severity.d.ts.map +1 -0
  6. package/dist/alert-severity.js +176 -0
  7. package/dist/alert-severity.js.map +1 -0
  8. package/dist/ar/building-blocks/poi-header/poi-header.css.js +38 -7
  9. package/dist/ar/building-blocks/poi-header/poi-header.css.js.map +1 -1
  10. package/dist/ar/building-blocks/poi-header/poi-header.d.ts +7 -2
  11. package/dist/ar/building-blocks/poi-header/poi-header.d.ts.map +1 -1
  12. package/dist/ar/building-blocks/poi-header/poi-header.js +5 -0
  13. package/dist/ar/building-blocks/poi-header/poi-header.js.map +1 -1
  14. package/dist/ar/poi-button/poi-button.css.js +110 -32
  15. package/dist/ar/poi-button/poi-button.css.js.map +1 -1
  16. package/dist/ar/poi-button/poi-button.d.ts +7 -2
  17. package/dist/ar/poi-button/poi-button.d.ts.map +1 -1
  18. package/dist/ar/poi-button/poi-button.js +15 -0
  19. package/dist/ar/poi-button/poi-button.js.map +1 -1
  20. package/dist/ar/types.d.ts +6 -1
  21. package/dist/ar/types.d.ts.map +1 -1
  22. package/dist/ar/types.js +5 -0
  23. package/dist/ar/types.js.map +1 -1
  24. package/dist/automation/automation-badge/automation-badge.d.ts +9 -1
  25. package/dist/automation/automation-badge/automation-badge.d.ts.map +1 -1
  26. package/dist/automation/automation-badge/automation-badge.js +119 -12
  27. package/dist/automation/automation-badge/automation-badge.js.map +1 -1
  28. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.d.ts +25 -1
  29. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.d.ts.map +1 -1
  30. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.js +7 -2
  31. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.js.map +1 -1
  32. package/dist/automation/automation-button/abstract-automation-button.d.ts +10 -3
  33. package/dist/automation/automation-button/abstract-automation-button.d.ts.map +1 -1
  34. package/dist/automation/automation-button/abstract-automation-button.js +23 -2
  35. package/dist/automation/automation-button/abstract-automation-button.js.map +1 -1
  36. package/dist/automation/automation-button/automation-button.css.js +9 -4
  37. package/dist/automation/automation-button/automation-button.css.js.map +1 -1
  38. package/dist/automation/automation-button/automation-button.d.ts +4 -2
  39. package/dist/automation/automation-button/automation-button.d.ts.map +1 -1
  40. package/dist/automation/automation-button/automation-button.js +24 -6
  41. package/dist/automation/automation-button/automation-button.js.map +1 -1
  42. package/dist/automation/automation-tank/automation-tank.d.ts +3 -2
  43. package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
  44. package/dist/automation/automation-tank/automation-tank.js +13 -2
  45. package/dist/automation/automation-tank/automation-tank.js.map +1 -1
  46. package/dist/components/accordion-card/accordion-card.css.js +34 -0
  47. package/dist/components/accordion-card/accordion-card.css.js.map +1 -1
  48. package/dist/components/accordion-card/accordion-card.d.ts +3 -2
  49. package/dist/components/accordion-card/accordion-card.d.ts.map +1 -1
  50. package/dist/components/accordion-card/accordion-card.js +4 -3
  51. package/dist/components/accordion-card/accordion-card.js.map +1 -1
  52. package/dist/components/alert-button/alert-button.css.js +744 -7
  53. package/dist/components/alert-button/alert-button.css.js.map +1 -1
  54. package/dist/components/alert-button/alert-button.d.ts +3 -1
  55. package/dist/components/alert-button/alert-button.d.ts.map +1 -1
  56. package/dist/components/alert-button/alert-button.js +33 -31
  57. package/dist/components/alert-button/alert-button.js.map +1 -1
  58. package/dist/components/alert-frame/alert-frame.css.js +116 -29
  59. package/dist/components/alert-frame/alert-frame.css.js.map +1 -1
  60. package/dist/components/alert-frame/alert-frame.d.ts +42 -15
  61. package/dist/components/alert-frame/alert-frame.d.ts.map +1 -1
  62. package/dist/components/alert-frame/alert-frame.js +68 -17
  63. package/dist/components/alert-frame/alert-frame.js.map +1 -1
  64. package/dist/components/alert-frame/critical-badge.d.ts +12 -0
  65. package/dist/components/alert-frame/critical-badge.d.ts.map +1 -0
  66. package/dist/components/alert-frame/critical-badge.js +47 -0
  67. package/dist/components/alert-frame/critical-badge.js.map +1 -0
  68. package/dist/components/alert-frame/diagnostic-badge.d.ts +12 -0
  69. package/dist/components/alert-frame/diagnostic-badge.d.ts.map +1 -0
  70. package/dist/components/alert-frame/diagnostic-badge.js +60 -0
  71. package/dist/components/alert-frame/diagnostic-badge.js.map +1 -0
  72. package/dist/components/alert-icon/alert-icon.d.ts +6 -1
  73. package/dist/components/alert-icon/alert-icon.d.ts.map +1 -1
  74. package/dist/components/alert-icon/alert-icon.js +96 -38
  75. package/dist/components/alert-icon/alert-icon.js.map +1 -1
  76. package/dist/components/alert-icon/icons/icon-critical.d.ts +3 -0
  77. package/dist/components/alert-icon/icons/icon-critical.d.ts.map +1 -0
  78. package/dist/components/alert-icon/icons/icon-critical.js +26 -0
  79. package/dist/components/alert-icon/icons/icon-critical.js.map +1 -0
  80. package/dist/components/alert-list-details/alert-list-details.d.ts.map +1 -1
  81. package/dist/components/alert-list-details/alert-list-details.js +6 -7
  82. package/dist/components/alert-list-details/alert-list-details.js.map +1 -1
  83. package/dist/components/badge/badge.css.js +50 -2
  84. package/dist/components/badge/badge.css.js.map +1 -1
  85. package/dist/components/badge/badge.d.ts +13 -2
  86. package/dist/components/badge/badge.d.ts.map +1 -1
  87. package/dist/components/badge/badge.js +54 -0
  88. package/dist/components/badge/badge.js.map +1 -1
  89. package/dist/components/navigation-item/navigation-item.css.js +5 -0
  90. package/dist/components/navigation-item/navigation-item.css.js.map +1 -1
  91. package/dist/components/navigation-item/navigation-item.d.ts +18 -0
  92. package/dist/components/navigation-item/navigation-item.d.ts.map +1 -1
  93. package/dist/components/navigation-item/navigation-item.js +49 -1
  94. package/dist/components/navigation-item/navigation-item.js.map +1 -1
  95. package/dist/components/navigation-item-group/navigation-item-group.css.js +8 -0
  96. package/dist/components/navigation-item-group/navigation-item-group.css.js.map +1 -1
  97. package/dist/components/navigation-item-group/navigation-item-group.d.ts +22 -0
  98. package/dist/components/navigation-item-group/navigation-item-group.d.ts.map +1 -1
  99. package/dist/components/navigation-item-group/navigation-item-group.js +63 -1
  100. package/dist/components/navigation-item-group/navigation-item-group.js.map +1 -1
  101. package/dist/components/navigation-menu/navigation-menu.d.ts +29 -1
  102. package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -1
  103. package/dist/components/navigation-menu/navigation-menu.js +105 -0
  104. package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
  105. package/dist/components/tree-navigation/tree-navigation.css.js +18 -0
  106. package/dist/components/tree-navigation/tree-navigation.css.js.map +1 -0
  107. package/dist/components/tree-navigation/tree-navigation.d.ts +74 -0
  108. package/dist/components/tree-navigation/tree-navigation.d.ts.map +1 -0
  109. package/dist/components/tree-navigation/tree-navigation.js +120 -0
  110. package/dist/components/tree-navigation/tree-navigation.js.map +1 -0
  111. package/dist/components/tree-navigation-group/tree-navigation-group.css.js +22 -0
  112. package/dist/components/tree-navigation-group/tree-navigation-group.css.js.map +1 -0
  113. package/dist/components/tree-navigation-group/tree-navigation-group.d.ts +94 -0
  114. package/dist/components/tree-navigation-group/tree-navigation-group.d.ts.map +1 -0
  115. package/dist/components/tree-navigation-group/tree-navigation-group.js +116 -0
  116. package/dist/components/tree-navigation-group/tree-navigation-group.js.map +1 -0
  117. package/dist/components/tree-navigation-item/tree-navigation-item.css.js +429 -0
  118. package/dist/components/tree-navigation-item/tree-navigation-item.css.js.map +1 -0
  119. package/dist/components/tree-navigation-item/tree-navigation-item.d.ts +160 -0
  120. package/dist/components/tree-navigation-item/tree-navigation-item.d.ts.map +1 -0
  121. package/dist/components/tree-navigation-item/tree-navigation-item.js +208 -0
  122. package/dist/components/tree-navigation-item/tree-navigation-item.js.map +1 -0
  123. package/dist/index.js +2 -1
  124. package/dist/internal/tree-roving-navigator.d.ts +71 -0
  125. package/dist/internal/tree-roving-navigator.d.ts.map +1 -0
  126. package/dist/internal/tree-roving-navigator.js +172 -0
  127. package/dist/internal/tree-roving-navigator.js.map +1 -0
  128. package/dist/manual-icon/icon-alerts-critical-twotone.d.ts +30 -0
  129. package/dist/manual-icon/icon-alerts-critical-twotone.d.ts.map +1 -0
  130. package/dist/manual-icon/icon-alerts-critical-twotone.js +55 -0
  131. package/dist/manual-icon/icon-alerts-critical-twotone.js.map +1 -0
  132. package/dist/manual-icon/icon-alerts-diagnostic-twotone.d.ts +30 -0
  133. package/dist/manual-icon/icon-alerts-diagnostic-twotone.d.ts.map +1 -0
  134. package/dist/manual-icon/icon-alerts-diagnostic-twotone.js +55 -0
  135. package/dist/manual-icon/icon-alerts-diagnostic-twotone.js.map +1 -0
  136. package/dist/navigation-instruments/readout/readout.css.js +3 -18
  137. package/dist/navigation-instruments/readout/readout.css.js.map +1 -1
  138. package/dist/navigation-instruments/readout/readout.d.ts +6 -7
  139. package/dist/navigation-instruments/readout/readout.d.ts.map +1 -1
  140. package/dist/navigation-instruments/readout/readout.js +54 -52
  141. package/dist/navigation-instruments/readout/readout.js.map +1 -1
  142. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +9 -36
  143. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
  144. package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts +8 -8
  145. package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts.map +1 -1
  146. package/dist/navigation-instruments/readout-list-item/readout-list-item.js +49 -42
  147. package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
  148. package/dist/openbridge.css +155 -0
  149. package/dist/types.d.ts +7 -1
  150. package/dist/types.d.ts.map +1 -1
  151. package/dist/types.js +18 -7
  152. package/dist/types.js.map +1 -1
  153. package/package.json +1 -1
  154. package/src/alert-severity.ts +225 -0
  155. package/src/ar/building-blocks/poi-header/poi-header.css +38 -7
  156. package/src/ar/building-blocks/poi-header/poi-header.ts +6 -1
  157. package/src/ar/poi-button/poi-button.css +126 -32
  158. package/src/ar/poi-button/poi-button.ts +16 -1
  159. package/src/ar/types.ts +5 -0
  160. package/src/automation/automation-badge/automation-badge.ts +124 -17
  161. package/src/automation/automation-button/abstract-automation-button-storybook-helpers.ts +5 -0
  162. package/src/automation/automation-button/abstract-automation-button.ts +21 -3
  163. package/src/automation/automation-button/automation-button.css +9 -4
  164. package/src/automation/automation-button/automation-button.ts +25 -7
  165. package/src/automation/automation-tank/automation-tank.stories.ts +22 -0
  166. package/src/automation/automation-tank/automation-tank.ts +12 -3
  167. package/src/components/accordion-card/accordion-card.css +33 -0
  168. package/src/components/accordion-card/accordion-card.stories.ts +2 -1
  169. package/src/components/accordion-card/accordion-card.ts +3 -4
  170. package/src/components/alert-button/alert-button.css +89 -5
  171. package/src/components/alert-button/alert-button.stories.ts +43 -0
  172. package/src/components/alert-button/alert-button.ts +43 -32
  173. package/src/components/alert-frame/alert-frame.css +116 -29
  174. package/src/components/alert-frame/alert-frame.stories.ts +63 -3
  175. package/src/components/alert-frame/alert-frame.ts +114 -23
  176. package/src/components/alert-frame/critical-badge.ts +39 -0
  177. package/src/components/alert-frame/diagnostic-badge.ts +52 -0
  178. package/src/components/alert-icon/alert-icon.stories.ts +41 -0
  179. package/src/components/alert-icon/alert-icon.ts +101 -38
  180. package/src/components/alert-icon/icons/icon-critical.ts +23 -0
  181. package/src/components/alert-list-details/alert-list-details.stories.ts +67 -0
  182. package/src/components/alert-list-details/alert-list-details.ts +11 -10
  183. package/src/components/badge/badge.css +52 -2
  184. package/src/components/badge/badge.stories.ts +75 -0
  185. package/src/components/badge/badge.ts +70 -2
  186. package/src/components/navigation-item/navigation-item.css +5 -0
  187. package/src/components/navigation-item/navigation-item.ts +56 -1
  188. package/src/components/navigation-item-group/navigation-item-group.css +8 -0
  189. package/src/components/navigation-item-group/navigation-item-group.ts +71 -1
  190. package/src/components/navigation-menu/navigation-menu.stories.ts +54 -0
  191. package/src/components/navigation-menu/navigation-menu.ts +151 -0
  192. package/src/components/tree-navigation/tree-navigation.css +7 -0
  193. package/src/components/tree-navigation/tree-navigation.stories.ts +162 -0
  194. package/src/components/tree-navigation/tree-navigation.ts +188 -0
  195. package/src/components/tree-navigation-group/tree-navigation-group.css +11 -0
  196. package/src/components/tree-navigation-group/tree-navigation-group.ts +157 -0
  197. package/src/components/tree-navigation-item/tree-navigation-item.css +258 -0
  198. package/src/components/tree-navigation-item/tree-navigation-item.stories.ts +119 -0
  199. package/src/components/tree-navigation-item/tree-navigation-item.ts +307 -0
  200. package/src/internal/tree-roving-navigator.ts +231 -0
  201. package/src/main.css +1 -0
  202. package/src/manual-icon/icon-alerts-critical-twotone.ts +60 -0
  203. package/src/manual-icon/icon-alerts-diagnostic-twotone.ts +60 -0
  204. package/src/mixins/alert.css +29 -0
  205. package/src/navigation-instruments/readout/readout.css +3 -24
  206. package/src/navigation-instruments/readout/readout.stories.ts +57 -4
  207. package/src/navigation-instruments/readout/readout.ts +69 -63
  208. package/src/navigation-instruments/readout-list-item/readout-list-item.css +9 -42
  209. package/src/navigation-instruments/readout-list-item/readout-list-item.stories.ts +57 -14
  210. package/src/navigation-instruments/readout-list-item/readout-list-item.ts +54 -44
  211. package/src/palettes/critical.md +95 -0
  212. package/src/palettes/manual.css +165 -0
  213. package/src/types.ts +20 -3
@@ -0,0 +1,119 @@
1
+ import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
+ import {
3
+ ObcTreeNavigationItem,
4
+ TreeBranchType,
5
+ TreeTerminalType,
6
+ } from './tree-navigation-item.js';
7
+ import './tree-navigation-item.js';
8
+ import {iconIds, iconIdToIconHtml} from '../../storybook-util.js';
9
+ import {html} from 'lit';
10
+ import {BadgeType} from '../badge/badge.js';
11
+
12
+ const meta: Meta<typeof ObcTreeNavigationItem> = {
13
+ title: 'UI Components/Menus and Navigation/Tree Navigation Item',
14
+ tags: ['autodocs', '6.0'],
15
+ component: 'obc-tree-navigation-item',
16
+ args: {
17
+ label: 'List item',
18
+ icon: 'placeholder',
19
+ branches: [TreeBranchType.straight, TreeBranchType.intersection],
20
+ expandable: true,
21
+ expanded: false,
22
+ checked: false,
23
+ disabled: false,
24
+ hasLeadingIcon: true,
25
+ terminalType: TreeTerminalType.regular,
26
+ hasAlertBadge: false,
27
+ alertCount: 9,
28
+ alertType: BadgeType.alarm,
29
+ },
30
+ argTypes: {
31
+ icon: {
32
+ options: iconIds,
33
+ control: {type: 'select'},
34
+ },
35
+ label: {control: {type: 'text'}},
36
+ branches: {control: {type: 'object'}},
37
+ expandable: {control: {type: 'boolean'}},
38
+ expanded: {control: {type: 'boolean'}},
39
+ checked: {control: {type: 'boolean'}},
40
+ disabled: {control: {type: 'boolean'}},
41
+ hasLeadingIcon: {control: {type: 'boolean'}},
42
+ terminalType: {
43
+ control: {type: 'select'},
44
+ options: Object.values(TreeTerminalType),
45
+ },
46
+ hasAlertBadge: {control: {type: 'boolean'}},
47
+ alertCount: {control: {type: 'number'}},
48
+ alertType: {
49
+ control: {type: 'select'},
50
+ options: Object.values(BadgeType),
51
+ if: {arg: 'hasAlertBadge'},
52
+ },
53
+ },
54
+ render: (args) => {
55
+ return html`<obc-tree-navigation-item
56
+ .label=${args.label}
57
+ .branches=${args.branches}
58
+ ?expandable=${args.expandable}
59
+ ?expanded=${args.expanded}
60
+ ?checked=${args.checked}
61
+ ?disabled=${args.disabled}
62
+ .hasLeadingIcon=${args.hasLeadingIcon}
63
+ .terminalType=${args.terminalType}
64
+ .hasAlertBadge=${args.hasAlertBadge}
65
+ .alertCount=${args.alertCount}
66
+ .alertType=${args.alertType}
67
+ @expand-toggle=${(e: CustomEvent<boolean>) => {
68
+ (e.currentTarget as ObcTreeNavigationItem).expanded = e.detail;
69
+ }}
70
+ >
71
+ ${args.hasLeadingIcon && args.icon
72
+ ? iconIdToIconHtml(args.icon as unknown as string, {slot: 'icon'})
73
+ : ''}
74
+ </obc-tree-navigation-item>`;
75
+ },
76
+ } satisfies Meta<ObcTreeNavigationItem>;
77
+
78
+ export default meta;
79
+ type Story = StoryObj<ObcTreeNavigationItem>;
80
+
81
+ export const Default: Story = {
82
+ args: {},
83
+ };
84
+
85
+ export const Checked: Story = {
86
+ args: {checked: true, expandable: false},
87
+ };
88
+
89
+ export const Expanded: Story = {
90
+ args: {expanded: true},
91
+ };
92
+
93
+ export const Disabled: Story = {
94
+ args: {disabled: true},
95
+ };
96
+
97
+ export const Leaf: Story = {
98
+ args: {expandable: false},
99
+ };
100
+
101
+ export const Root: Story = {
102
+ args: {branches: []},
103
+ };
104
+
105
+ export const IndentedNoConnectors: Story = {
106
+ args: {branches: [TreeBranchType.blank, TreeBranchType.blank]},
107
+ };
108
+
109
+ export const WithAlertBadge: Story = {
110
+ args: {hasAlertBadge: true, alertCount: 9},
111
+ };
112
+
113
+ export const AggregatedHeader: Story = {
114
+ args: {terminalType: TreeTerminalType.aggregatedHeader},
115
+ };
116
+
117
+ export const GroupHeader: Story = {
118
+ args: {terminalType: TreeTerminalType.groupHeader},
119
+ };
@@ -0,0 +1,307 @@
1
+ import {LitElement, html, nothing, unsafeCSS} from 'lit';
2
+ import {property, query} from 'lit/decorators.js';
3
+ import componentStyle from './tree-navigation-item.css?inline';
4
+ import {classMap} from 'lit/directives/class-map.js';
5
+ import {ifDefined} from 'lit/directives/if-defined.js';
6
+ import {customElement} from '../../decorator.js';
7
+ import '../../icons/icon-chevron-right-google.js';
8
+ import '../../icons/icon-alert-header-aggregated-iec.js';
9
+ import '../../icons/icon-alert-header-group-iec.js';
10
+ import '../badge/badge.js';
11
+ import {BadgeType} from '../badge/badge.js';
12
+
13
+ /**
14
+ * Guide line drawn for one indentation column. Normally computed by
15
+ * `obc-tree-navigation`; rarely set by hand.
16
+ *
17
+ * - `straight`: vertical pass-through (`│`)
18
+ * - `intersection`: vertical + stub for a non-last child (`├`)
19
+ * - `corner`: half vertical + stub for the last child (`└`)
20
+ * - `blank`: empty spacer
21
+ */
22
+ export enum TreeBranchType {
23
+ straight = 'straight',
24
+ intersection = 'intersection',
25
+ corner = 'corner',
26
+ blank = 'blank',
27
+ }
28
+
29
+ /**
30
+ * Terminal type for a tree item, controlling the alert-header marker shown in
31
+ * the terminal (top-right, by the chevron).
32
+ *
33
+ * - `regular`: No marker — a plain expand/collapse terminal.
34
+ * - `aggregatedHeader`: Shows the aggregated alert-header marker, indicating the
35
+ * node aggregates alerts from its descendants.
36
+ * - `groupHeader`: Shows the group alert-header marker, indicating a grouped set
37
+ * of alerts beneath the node.
38
+ */
39
+ export enum TreeTerminalType {
40
+ regular = 'regular',
41
+ aggregatedHeader = 'aggregated-header',
42
+ groupHeader = 'group-header',
43
+ }
44
+
45
+ /**
46
+ * `<obc-tree-navigation-item>` – A single row in a tree- or file-explorer-style
47
+ * navigation list, with indentation guide lines, an optional expand/collapse
48
+ * chevron, a leading icon, a label, and an optional alert badge.
49
+ *
50
+ * Each row represents one node in a hierarchy. Depth is expressed through the
51
+ * `branches` array: one entry per ancestor level, each describing the guide line
52
+ * to draw for that level. The expand chevron lets a node disclose its children,
53
+ * emitting `expand-toggle` so a parent can manage the open/closed state.
54
+ *
55
+ * ## Features
56
+ * - **Indentation guides:** Render one 32px guide column per `branches` entry —
57
+ * pass-through vertical lines for ancestors that continue, and an elbow
58
+ * (`intersection`) connecting the row to its parent.
59
+ * - **Expand/collapse:** Set `expandable` to show a chevron that rotates when
60
+ * `expanded`. The chevron is a visual indicator only — activating the row
61
+ * fires `expand-toggle` with the next state; manage `expanded` in response.
62
+ * When `expanded`, a vertical guide descends from the chevron to connect to
63
+ * the revealed child rows below.
64
+ * - **Terminal type:** `terminalType` adds an alert-header marker in the terminal
65
+ * (`aggregatedHeader` or `groupHeader`), indicating the node heads a set of
66
+ * aggregated or grouped alerts.
67
+ * - **Leading icon:** Provide an icon via the `icon` slot (shown when
68
+ * `hasLeadingIcon`).
69
+ * - **Alert badge:** A trailing counter badge (e.g. an alarm count), toggled with
70
+ * `hasAlertBadge` and configured via `alertCount` and `alertType`.
71
+ * - **Checked state:** `checked` highlights the current selection using the
72
+ * amplified elevation style. A checked row is the current item and is not
73
+ * re-selectable — it shows no hover/pressed feedback and fires no `click` or
74
+ * navigation. An expandable checked row still toggles (fires `expand-toggle`),
75
+ * so a group that is the current selection can be opened and closed. It stays
76
+ * keyboard-focusable.
77
+ * - **Link or button:** Set `href` to render the row as a link; otherwise it acts
78
+ * as a button.
79
+ *
80
+ * ## Usage Guidelines
81
+ * - Use for hierarchical navigation such as file trees, layer panels, or nested
82
+ * menus. For flat navigation lists, use `obc-navigation-item` instead.
83
+ * - Build `branches` from the row's ancestry: `intersection` for the level that
84
+ * owns this row, `straight` for ancestors with siblings still to come, and
85
+ * `blank` for ancestors whose subtrees have ended. When placed inside
86
+ * `obc-tree-navigation`, the container computes `branches` automatically.
87
+ * - Keep one row `checked` at a time within a tree to mark the current location.
88
+ * - Leaf nodes should leave `expandable` as `false` so no chevron is shown.
89
+ *
90
+ * ## Slots
91
+ *
92
+ * | Slot Name | Renders When... | Purpose |
93
+ * |----------------|---------------------------------|-------------------------------------------------------------------------|
94
+ * | icon | `hasLeadingIcon` is true | Leading icon for the row, e.g. `<obi-placeholder slot="icon">`. |
95
+ *
96
+ * @slot icon - Leading icon slot (shown when `hasLeadingIcon` is true).
97
+ * @fires expand-toggle {CustomEvent<boolean>} Fired when an expandable row is activated; detail is the next `expanded` value.
98
+ * @fires click {CustomEvent<void>} Fired when the row is activated.
99
+ */
100
+ @customElement('obc-tree-navigation-item')
101
+ export class ObcTreeNavigationItem extends LitElement {
102
+ /** The text label displayed for the row. */
103
+ @property({type: String}) label = 'List item';
104
+
105
+ /**
106
+ * Guide line for each ancestor level, outermost first; one 32px column per
107
+ * entry. Computed by `obc-tree-navigation` — rarely set by hand.
108
+ */
109
+ @property({type: Array}) branches: TreeBranchType[] = [];
110
+
111
+ /** Whether the row shows an expand/collapse chevron. Leave false for leaf nodes. */
112
+ @property({type: Boolean}) expandable = false;
113
+
114
+ /** Whether the node is expanded. Rotates the chevron and sets `aria-expanded`. */
115
+ @property({type: Boolean, reflect: true}) expanded = false;
116
+
117
+ /**
118
+ * Whether the row is the current selection. Applies the amplified style and
119
+ * makes the row inert to re-selection (no hover/pressed feedback, no `click`
120
+ * or navigation); it remains keyboard-focusable. An expandable checked row
121
+ * still fires `expand-toggle` so a selected group can open and close.
122
+ */
123
+ @property({type: Boolean, reflect: true}) checked = false;
124
+
125
+ /** Disables the row, removing it from the tab order and dimming its appearance. */
126
+ @property({type: Boolean, reflect: true}) disabled = false;
127
+
128
+ /**
129
+ * Whether the row is in the tab order. A tree container manages this as a
130
+ * roving tabindex (one row focusable at a time); standalone rows stay tabbable.
131
+ */
132
+ @property({type: Boolean, attribute: false}) focusable = true;
133
+
134
+ /**
135
+ * Whether the row shows a leading icon (provided via the `icon` slot).
136
+ */
137
+ @property({type: Boolean, attribute: false}) hasLeadingIcon = true;
138
+
139
+ /**
140
+ * Terminal type, controlling the alert-header marker shown in the terminal.
141
+ * One of `regular` (default), `aggregated-header`, or `group-header`.
142
+ */
143
+ @property({type: String}) terminalType: string = TreeTerminalType.regular;
144
+
145
+ /** Whether a trailing alert counter badge is shown. */
146
+ @property({type: Boolean}) hasAlertBadge = false;
147
+
148
+ /** The number shown in the alert badge when `hasAlertBadge` is true. */
149
+ @property({type: Number}) alertCount = 0;
150
+
151
+ /** The severity/type of the alert badge. One of the `obc-badge` types (default `alarm`). */
152
+ @property({type: String}) alertType: string = BadgeType.alarm;
153
+
154
+ /**
155
+ * The URL to navigate to when the row is activated. If set, the row renders as
156
+ * a link; otherwise it acts as a button.
157
+ */
158
+ @property({type: String}) href: string | undefined;
159
+
160
+ @query('.wrapper') private wrapperElement?: HTMLElement;
161
+
162
+ /** Focuses the row's interactive wrapper (the host itself is not focusable). */
163
+ public override focus(options?: FocusOptions): void {
164
+ this.wrapperElement?.focus(options);
165
+ }
166
+
167
+ /** A root-level row has no ancestor columns, so it draws no connector lines. */
168
+ private get isRoot(): boolean {
169
+ return this.branches.length === 0;
170
+ }
171
+
172
+ /**
173
+ * All ancestor columns are blank spacers — the row is indented but draws no
174
+ * guide lines, so the terminal connector and dropdown are suppressed too.
175
+ */
176
+ private get isBlankAncestry(): boolean {
177
+ return (
178
+ this.branches.length > 0 &&
179
+ this.branches.every((b) => b === TreeBranchType.blank)
180
+ );
181
+ }
182
+
183
+ private activate() {
184
+ if (this.disabled) return;
185
+ // An expandable row always toggles, even when checked — a group that is the
186
+ // current selection must still open and close. A checked leaf, however, is
187
+ // the current selection and is inert (no re-selection click or navigation).
188
+ if (this.expandable) {
189
+ this.dispatchEvent(
190
+ new CustomEvent<boolean>('expand-toggle', {detail: !this.expanded})
191
+ );
192
+ }
193
+ if (this.checked) return;
194
+ this.dispatchEvent(new CustomEvent('click'));
195
+ if (this.href !== undefined) {
196
+ window.location.href = this.href;
197
+ }
198
+ }
199
+
200
+ private handleKeydown(event: KeyboardEvent) {
201
+ if (this.disabled) return;
202
+ if (event.key !== 'Enter' && event.key !== ' ') return;
203
+ event.preventDefault();
204
+ this.activate();
205
+ }
206
+
207
+ private renderBranch(type: TreeBranchType) {
208
+ const hasVertical =
209
+ type === TreeBranchType.straight ||
210
+ type === TreeBranchType.intersection ||
211
+ type === TreeBranchType.corner;
212
+ const hasHorizontal =
213
+ type === TreeBranchType.intersection || type === TreeBranchType.corner;
214
+ return html`<div
215
+ class=${classMap({branch: true, ['branch-' + type]: true})}
216
+ >
217
+ ${hasVertical ? html`<div class="branch-vertical"></div>` : nothing}
218
+ ${hasHorizontal ? html`<div class="branch-horizontal"></div>` : nothing}
219
+ ${type === TreeBranchType.corner
220
+ ? html`<div class="branch-elbow"></div>`
221
+ : nothing}
222
+ </div>`;
223
+ }
224
+
225
+ private renderTerminalHeader() {
226
+ if (this.terminalType === TreeTerminalType.aggregatedHeader) {
227
+ return html`<div class="terminal-header" aria-hidden="true">
228
+ <obi-alert-header-aggregated-iec></obi-alert-header-aggregated-iec>
229
+ </div>`;
230
+ }
231
+ if (this.terminalType === TreeTerminalType.groupHeader) {
232
+ return html`<div class="terminal-header" aria-hidden="true">
233
+ <obi-alert-header-group-iec></obi-alert-header-group-iec>
234
+ </div>`;
235
+ }
236
+ return nothing;
237
+ }
238
+
239
+ override render() {
240
+ return html`
241
+ <div
242
+ class=${classMap({
243
+ wrapper: true,
244
+ checked: this.checked,
245
+ disabled: this.disabled,
246
+ 'has-icon': this.hasLeadingIcon,
247
+ })}
248
+ role="treeitem"
249
+ aria-expanded=${ifDefined(this.expandable ? this.expanded : undefined)}
250
+ aria-current=${ifDefined(this.checked ? 'page' : undefined)}
251
+ aria-selected=${ifDefined(this.checked ? 'true' : undefined)}
252
+ aria-disabled=${ifDefined(this.disabled ? 'true' : undefined)}
253
+ tabindex=${this.disabled ? -1 : this.focusable ? 0 : -1}
254
+ @click=${this.activate}
255
+ @keydown=${this.handleKeydown}
256
+ >
257
+ <div class="visible-wrapper">
258
+ <div class="tree-node-row">
259
+ ${this.branches.map((branch) => this.renderBranch(branch))}
260
+ <div class="terminal">
261
+ ${this.isRoot || this.isBlankAncestry
262
+ ? nothing
263
+ : html`<div class="terminal-connector"></div>`}
264
+ ${!this.isRoot &&
265
+ !this.isBlankAncestry &&
266
+ this.expandable &&
267
+ this.expanded
268
+ ? html`<div class="terminal-dropdown"></div>`
269
+ : nothing}
270
+ ${this.expandable
271
+ ? html`<div class="chevron" aria-hidden="true">
272
+ <obi-chevron-right-google></obi-chevron-right-google>
273
+ </div>`
274
+ : nothing}
275
+ ${this.renderTerminalHeader()}
276
+ </div>
277
+ </div>
278
+ <div class="label-container">
279
+ ${this.hasLeadingIcon
280
+ ? html`<div class="leading-icon">
281
+ <slot name="icon"></slot>
282
+ </div>`
283
+ : nothing}
284
+ <span part="label" class="label">${this.label}</span>
285
+ </div>
286
+ ${this.hasAlertBadge
287
+ ? html`<obc-badge
288
+ class="alert-badge"
289
+ .type=${this.alertType}
290
+ .number=${this.alertCount}
291
+ ></obc-badge>`
292
+ : nothing}
293
+ </div>
294
+ </div>
295
+ `;
296
+ }
297
+
298
+ static override styles = unsafeCSS(componentStyle);
299
+ }
300
+
301
+ export type ObcTreeNavigationItemExpandToggleEvent = CustomEvent<boolean>;
302
+
303
+ declare global {
304
+ interface HTMLElementTagNameMap {
305
+ 'obc-tree-navigation-item': ObcTreeNavigationItem;
306
+ }
307
+ }
@@ -0,0 +1,231 @@
1
+ import {ObcTreeNavigationItem} from '../components/tree-navigation-item/tree-navigation-item.js';
2
+
3
+ /**
4
+ * Host-specific row resolution. The two tree hosts differ only in row tags,
5
+ * expand-state storage, and DOM shape, so injecting these hooks lets one
6
+ * navigator drive both.
7
+ */
8
+ export interface TreeRovingAdapter<Row extends HTMLElement = HTMLElement> {
9
+ /** Top-level rows, in document order. */
10
+ getRows(): Row[];
11
+ /** Direct child rows of a row, in document order. */
12
+ childRows(row: Row): Row[];
13
+ isGroup(row: Row): boolean;
14
+ isExpanded(row: Row): boolean;
15
+ setExpanded(row: Row, expanded: boolean): void;
16
+ /** The focusable `obc-tree-navigation-item` for a row (a leaf is itself). */
17
+ innerItem(row: Row): ObcTreeNavigationItem | null;
18
+ /** Defaults to false when omitted. */
19
+ isDisabled?(row: Row): boolean;
20
+ }
21
+
22
+ /**
23
+ * Implements the [WAI-ARIA Tree View](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/)
24
+ * keyboard pattern for a tree host: a single tab stop (roving tabindex) plus
25
+ * Up/Down, Left/Right (collapse/expand → parent/child), and Home/End. Type-ahead
26
+ * and `*` are intentionally out of scope.
27
+ *
28
+ * The host owns the DOM and the event wiring; this class owns the navigation
29
+ * logic. The host calls {@link handleKeydown} from its `keydown` listener and
30
+ * {@link refresh} whenever the structure changes, and supplies a
31
+ * {@link TreeRovingAdapter} for row resolution. Focus only moves on user keys;
32
+ * `refresh` re-points the roving tabindex without stealing focus.
33
+ */
34
+ export class TreeRovingNavigator<Row extends HTMLElement = HTMLElement> {
35
+ private readonly adapter: TreeRovingAdapter<Row>;
36
+ private readonly host: HTMLElement;
37
+
38
+ /** The row that currently holds the single tab stop (roving tabindex). */
39
+ private activeRow?: Row;
40
+
41
+ constructor(host: HTMLElement, adapter: TreeRovingAdapter<Row>) {
42
+ this.adapter = adapter;
43
+ this.host = host;
44
+ }
45
+
46
+ private isDisabled(row: Row): boolean {
47
+ return this.adapter.isDisabled?.(row) ?? false;
48
+ }
49
+
50
+ /**
51
+ * Depth-first list of every visible row: descend into a group only when it is
52
+ * expanded. Disabled rows are included so {@link refresh} can re-point to a
53
+ * visible ancestor; arrow navigation filters them out via {@link navigableRows}.
54
+ */
55
+ private visibleRows(): Row[] {
56
+ const out: Row[] = [];
57
+ const walk = (rows: Row[]) => {
58
+ for (const row of rows) {
59
+ out.push(row);
60
+ if (this.adapter.isGroup(row) && this.adapter.isExpanded(row)) {
61
+ walk(this.adapter.childRows(row));
62
+ }
63
+ }
64
+ };
65
+ walk(this.adapter.getRows());
66
+ return out;
67
+ }
68
+
69
+ /** Visible rows that arrow navigation can land on (enabled rows). */
70
+ private navigableRows(): Row[] {
71
+ return this.visibleRows().filter((row) => !this.isDisabled(row));
72
+ }
73
+
74
+ /** The parent row of a row within this tree, or undefined for a top-level row. */
75
+ private parentRow(target: Row): Row | undefined {
76
+ let found: Row | undefined;
77
+ const walk = (rows: Row[], parent?: Row) => {
78
+ for (const row of rows) {
79
+ if (row === target) {
80
+ found = parent;
81
+ return;
82
+ }
83
+ if (this.adapter.isGroup(row)) {
84
+ walk(this.adapter.childRows(row), row);
85
+ if (found !== undefined) return;
86
+ }
87
+ }
88
+ };
89
+ walk(this.adapter.getRows(), undefined);
90
+ return found;
91
+ }
92
+
93
+ /**
94
+ * Rebuild the roving tabindex: exactly one navigable row is `focusable`. Keeps
95
+ * the active row if still navigable; else falls back to its nearest navigable
96
+ * ancestor, else the first navigable row. Never moves focus.
97
+ */
98
+ refresh(): void {
99
+ const navigable = this.navigableRows();
100
+ if (navigable.length === 0) {
101
+ this.activeRow = undefined;
102
+ return;
103
+ }
104
+
105
+ let next: Row | undefined;
106
+ if (this.activeRow && navigable.includes(this.activeRow)) {
107
+ next = this.activeRow;
108
+ } else if (this.activeRow) {
109
+ let ancestor = this.parentRow(this.activeRow);
110
+ while (ancestor && !navigable.includes(ancestor)) {
111
+ ancestor = this.parentRow(ancestor);
112
+ }
113
+ next = ancestor ?? navigable[0];
114
+ } else {
115
+ next = navigable[0];
116
+ }
117
+
118
+ this.setActiveRow(next, false);
119
+ }
120
+
121
+ private setActiveRow(row: Row, moveFocus: boolean): void {
122
+ this.activeRow = row;
123
+ for (const candidate of this.visibleRows()) {
124
+ const item = this.adapter.innerItem(candidate);
125
+ if (item) item.focusable = candidate === row;
126
+ }
127
+ if (!moveFocus) return;
128
+ // A row's header may render asynchronously (e.g. right after expanding a
129
+ // group), so fall back to a microtask if it isn't present yet.
130
+ const item = this.adapter.innerItem(row);
131
+ if (item) item.focus();
132
+ else queueMicrotask(() => this.adapter.innerItem(row)?.focus());
133
+ }
134
+
135
+ /**
136
+ * The originating tree row for a keydown. A group's header lives in the
137
+ * group's own shadow root, so the host-root check resolves a header to its
138
+ * group rather than the inner header item.
139
+ */
140
+ private rowFromEvent(event: KeyboardEvent): Row | undefined {
141
+ // Read the root live: the navigator is constructed before the host connects.
142
+ const root = this.host.getRootNode();
143
+ for (const target of event.composedPath()) {
144
+ if (
145
+ target instanceof HTMLElement &&
146
+ target.getRootNode() === root &&
147
+ this.isRow(target)
148
+ ) {
149
+ return target as Row;
150
+ }
151
+ }
152
+ return undefined;
153
+ }
154
+
155
+ /** Whether an element is one of this tree's rows (group or leaf). */
156
+ private isRow(el: HTMLElement): boolean {
157
+ const tops = this.adapter.getRows();
158
+ const stack = [...tops];
159
+ while (stack.length) {
160
+ const row = stack.pop()!;
161
+ if (row === el) return true;
162
+ if (this.adapter.isGroup(row)) stack.push(...this.adapter.childRows(row));
163
+ }
164
+ return false;
165
+ }
166
+
167
+ /** Handle a `keydown`; returns true if the key was consumed. */
168
+ handleKeydown(event: KeyboardEvent): boolean {
169
+ const row = this.rowFromEvent(event);
170
+ if (!row) return false;
171
+
172
+ switch (event.key) {
173
+ case 'ArrowDown':
174
+ this.moveByOffset(row, 1);
175
+ return true;
176
+ case 'ArrowUp':
177
+ this.moveByOffset(row, -1);
178
+ return true;
179
+ case 'ArrowRight':
180
+ this.onArrowRight(row);
181
+ return true;
182
+ case 'ArrowLeft':
183
+ this.onArrowLeft(row);
184
+ return true;
185
+ case 'Home':
186
+ this.moveToEdge(true);
187
+ return true;
188
+ case 'End':
189
+ this.moveToEdge(false);
190
+ return true;
191
+ default:
192
+ return false;
193
+ }
194
+ }
195
+
196
+ private moveByOffset(row: Row, offset: number): void {
197
+ const rows = this.navigableRows();
198
+ const index = rows.indexOf(row);
199
+ if (index === -1) return;
200
+ const target = rows[index + offset];
201
+ if (target) this.setActiveRow(target, true);
202
+ }
203
+
204
+ private moveToEdge(first: boolean): void {
205
+ const rows = this.navigableRows();
206
+ if (rows.length === 0) return;
207
+ this.setActiveRow(first ? rows[0] : rows[rows.length - 1], true);
208
+ }
209
+
210
+ private onArrowRight(row: Row): void {
211
+ if (!this.adapter.isGroup(row)) return;
212
+ if (!this.adapter.isExpanded(row)) {
213
+ this.adapter.setExpanded(row, true);
214
+ // Re-point the roving set for hosts that don't observe expansion themselves.
215
+ this.refresh();
216
+ return;
217
+ }
218
+ const child = this.adapter.childRows(row).find((c) => !this.isDisabled(c));
219
+ if (child) this.setActiveRow(child, true);
220
+ }
221
+
222
+ private onArrowLeft(row: Row): void {
223
+ if (this.adapter.isGroup(row) && this.adapter.isExpanded(row)) {
224
+ this.adapter.setExpanded(row, false);
225
+ this.refresh();
226
+ return;
227
+ }
228
+ const parent = this.parentRow(row);
229
+ if (parent) this.setActiveRow(parent, true);
230
+ }
231
+ }
package/src/main.css CHANGED
@@ -1,4 +1,5 @@
1
1
  @import "palettes/variables.css";
2
+ @import "palettes/manual.css";
2
3
  @import "components/radio/radio.css";
3
4
 
4
5
  html {