@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.143 → 2.0.0-next.145

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 (59) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +4865 -4498
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +259 -40
  4. package/dist/components/app-button/app-button.css.js +56 -0
  5. package/dist/components/app-button/app-button.css.js.map +1 -1
  6. package/dist/components/checkbox-item/checkbox-item.css.js +137 -12
  7. package/dist/components/checkbox-item/checkbox-item.css.js.map +1 -1
  8. package/dist/components/checkbox-item/checkbox-item.d.ts +68 -39
  9. package/dist/components/checkbox-item/checkbox-item.d.ts.map +1 -1
  10. package/dist/components/checkbox-item/checkbox-item.js +66 -25
  11. package/dist/components/checkbox-item/checkbox-item.js.map +1 -1
  12. package/dist/components/checkbox-list/checkbox-list-visibility.d.ts +16 -0
  13. package/dist/components/checkbox-list/checkbox-list-visibility.d.ts.map +1 -0
  14. package/dist/components/checkbox-list/checkbox-list-visibility.js +12 -0
  15. package/dist/components/checkbox-list/checkbox-list-visibility.js.map +1 -0
  16. package/dist/components/checkbox-list/checkbox-list.css.js +23 -0
  17. package/dist/components/checkbox-list/checkbox-list.css.js.map +1 -0
  18. package/dist/components/checkbox-list/checkbox-list.d.ts +66 -0
  19. package/dist/components/checkbox-list/checkbox-list.d.ts.map +1 -0
  20. package/dist/components/checkbox-list/checkbox-list.js +81 -0
  21. package/dist/components/checkbox-list/checkbox-list.js.map +1 -0
  22. package/dist/integration-systems/integration-app-bar/integration-app-bar.css.js +12 -1
  23. package/dist/integration-systems/integration-app-bar/integration-app-bar.css.js.map +1 -1
  24. package/dist/integration-systems/integration-app-bar/integration-app-bar.d.ts +2 -2
  25. package/dist/integration-systems/integration-app-bar/integration-app-bar.d.ts.map +1 -1
  26. package/dist/integration-systems/integration-app-bar/integration-app-bar.js +1 -21
  27. package/dist/integration-systems/integration-app-bar/integration-app-bar.js.map +1 -1
  28. package/dist/navigation-instruments/readout/readout.d.ts +11 -2
  29. package/dist/navigation-instruments/readout/readout.d.ts.map +1 -1
  30. package/dist/navigation-instruments/readout/readout.js +18 -0
  31. package/dist/navigation-instruments/readout/readout.js.map +1 -1
  32. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +25 -0
  33. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
  34. package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts +20 -4
  35. package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts.map +1 -1
  36. package/dist/navigation-instruments/readout-list-item/readout-list-item.js +18 -6
  37. package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/components/app-button/app-button.css +2 -0
  40. package/src/components/app-button/app-button.stories.ts +26 -0
  41. package/src/components/checkbox-item/checkbox-item.css +63 -17
  42. package/src/components/checkbox-item/checkbox-item.spec.ts +115 -0
  43. package/src/components/checkbox-item/checkbox-item.stories.ts +82 -97
  44. package/src/components/checkbox-item/checkbox-item.ts +118 -64
  45. package/src/components/checkbox-list/checkbox-list-visibility.spec.ts +68 -0
  46. package/src/components/checkbox-list/checkbox-list-visibility.ts +23 -0
  47. package/src/components/checkbox-list/checkbox-list.css +13 -0
  48. package/src/components/checkbox-list/checkbox-list.spec.ts +93 -0
  49. package/src/components/checkbox-list/checkbox-list.stories.ts +161 -0
  50. package/src/components/checkbox-list/checkbox-list.ts +130 -0
  51. package/src/integration-systems/integration-app-bar/integration-app-bar-sizing.stories.ts +130 -0
  52. package/src/integration-systems/integration-app-bar/integration-app-bar.css +11 -1
  53. package/src/integration-systems/integration-app-bar/integration-app-bar.ts +3 -27
  54. package/src/navigation-instruments/readout/readout.stories.ts +57 -4
  55. package/src/navigation-instruments/readout/readout.ts +28 -1
  56. package/src/navigation-instruments/readout-list/readout-list.stories.ts +62 -2
  57. package/src/navigation-instruments/readout-list-item/readout-list-item.css +21 -0
  58. package/src/navigation-instruments/readout-list-item/readout-list-item.stories.ts +56 -3
  59. package/src/navigation-instruments/readout-list-item/readout-list-item.ts +37 -19
@@ -208,6 +208,62 @@ const compentStyle = css`* {
208
208
  "ss04" on;
209
209
  }
210
210
 
211
+ .wrapper.integration {
212
+ border-color: var(--integration-flat-enabled-border-color);
213
+ background-color: var(--integration-flat-enabled-background-color);
214
+ border-width: 1px;
215
+ border-style: solid;
216
+ cursor: pointer;
217
+ --base-border-color: var(--integration-flat-enabled-border-color);
218
+ --base-background-color: var(--integration-flat-enabled-background-color);
219
+ }
220
+
221
+ .wrapper.integration:focus {
222
+ outline: none;
223
+ }
224
+
225
+ .wrapper.integration.activated {
226
+ border-color: var(--integration-flat-activated-border-color);
227
+ background-color: var(--integration-flat-activated-background-color);
228
+ --base-border-color: var(--integration-flat-activated-border-color);
229
+ --base-background-color: var(--integration-flat-activated-background-color);
230
+ }
231
+
232
+ @media (hover:hover) {
233
+
234
+ .wrapper.integration:hover {
235
+ border-color: color-mix(in srgb, var(--integration-flat-hover-border-color) calc(var(--obc-can-hover) * 100%), var(--base-border-color));
236
+ background-color: color-mix(in srgb, var(--integration-flat-hover-background-color) calc(var(--obc-can-hover) * 100%), var(--base-background-color));
237
+ }
238
+ }
239
+
240
+ .wrapper.integration:active {
241
+ border-color: var(--integration-flat-pressed-border-color);
242
+ background-color: var(--integration-flat-pressed-background-color);
243
+ }
244
+
245
+ .wrapper.integration:focus-visible {
246
+ outline-color: var(--border-focus-color);
247
+ outline-width: var(--global-size-spacing-border-weight-focusframe);
248
+ outline-style: solid;
249
+ border-color: var(--container-global-color);
250
+ z-index: 1;
251
+ }
252
+
253
+ .wrapper.integration:disabled {
254
+ border-color: var(--integration-flat-disabled-border-color);
255
+ background-color: var(--integration-flat-disabled-background-color);
256
+ cursor: not-allowed;
257
+ color: var(--integration-on-flat-disabled-color) !important;
258
+ }
259
+
260
+ .wrapper.integration.disabled {
261
+ border-color: var(--integration-flat-disabled-border-color);
262
+ background-color: var(--integration-flat-disabled-background-color);
263
+ cursor: not-allowed;
264
+ color: var(--integration-on-flat-disabled-color) !important;
265
+ }
266
+
211
267
  :is(.wrapper.integration .icon-wrapper) {
212
268
  border-color: var(--integration-normal-enabled-border-color);
213
269
  background-color: var(--integration-normal-enabled-background-color);
@@ -1 +1 @@
1
- {"version":3,"file":"app-button.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"app-button.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -22,35 +22,146 @@ const componentStyle = css`* {
22
22
  cursor: pointer;
23
23
  }
24
24
 
25
+ .checkbox-item-container.has-description {
26
+ /* a second text line outgrows the fixed row; the hover surface follows */
27
+ height: auto;
28
+ min-height: var(--ui-components-checkbox-touch-target-size);
29
+ }
30
+
25
31
  .checkbox-item-container.disabled {
26
32
  cursor: not-allowed;
27
33
  }
28
34
 
29
- .checkbox-item-container .chevron-container,.checkbox-item-container .nested-spacer {
35
+ .checkbox-item-container .chevron-container {
30
36
  display: flex;
31
37
  width: var(--global-size-spacing-touch-target-min);
32
- height: var(--global-size-spacing-touch-target-min);
33
38
  min-width: var(--global-size-spacing-touch-target-min);
34
- min-height: var(--global-size-spacing-touch-target-min);
35
- padding: 0px;
39
+ height: var(--global-size-spacing-touch-target-min);
36
40
  align-items: center;
37
41
  justify-content: center;
38
42
  flex-shrink: 0;
39
43
  }
40
44
 
45
+ .checkbox-item-container .nested-spacer {
46
+ /* one indent step per level above 1; --checkbox-item-depth is set inline */
47
+ width: calc(
48
+ var(--checkbox-item-depth, 0) *
49
+ var(--ui-components-checkbox-nested-item-padding-left)
50
+ );
51
+ flex-shrink: 0;
52
+ align-self: stretch;
53
+ }
54
+
55
+ :is(.checkbox-item-container .chevron-button) {
56
+ cursor: pointer;
57
+ }
58
+
59
+ :is(.checkbox-item-container .chevron-button):focus {
60
+ outline: none;
61
+ }
62
+
63
+ :is(.checkbox-item-container .chevron-button) .chevron-visible {
64
+ border-color: var(--flat-enabled-border-color);
65
+ background-color: var(--flat-enabled-background-color);
66
+ border-width: 1px;
67
+ border-style: solid;
68
+ cursor: pointer;
69
+ --base-border-color: var(--flat-enabled-border-color);
70
+ --base-background-color: var(--flat-enabled-background-color);
71
+ }
72
+
73
+ .activated:is(.checkbox-item-container .chevron-button) .chevron-visible {
74
+ border-color: var(--flat-activated-border-color);
75
+ background-color: var(--flat-activated-background-color);
76
+ --base-border-color: var(--flat-activated-border-color);
77
+ --base-background-color: var(--flat-activated-background-color);
78
+ }
79
+
80
+ @media (hover:hover) {
81
+
82
+ :is(.checkbox-item-container .chevron-button):hover .chevron-visible {
83
+ border-color: color-mix(in srgb, var(--flat-hover-border-color) calc(var(--obc-can-hover) * 100%), var(--base-border-color));
84
+ background-color: color-mix(in srgb, var(--flat-hover-background-color) calc(var(--obc-can-hover) * 100%), var(--base-background-color));
85
+ }
86
+ }
87
+
88
+ :is(.checkbox-item-container .chevron-button):active .chevron-visible {
89
+ border-color: var(--flat-pressed-border-color);
90
+ background-color: var(--flat-pressed-background-color);
91
+ }
92
+
93
+ :is(.checkbox-item-container .chevron-button):focus-visible .chevron-visible {
94
+ outline-color: var(--border-focus-color);
95
+ outline-width: var(--global-size-spacing-border-weight-focusframe);
96
+ outline-style: solid;
97
+ border-color: var(--container-global-color);
98
+ z-index: 1;
99
+ }
100
+
101
+ :is(.checkbox-item-container .chevron-button):disabled .chevron-visible {
102
+ border-color: var(--flat-disabled-border-color);
103
+ background-color: var(--flat-disabled-background-color);
104
+ cursor: not-allowed;
105
+ color: var(--on-flat-disabled-color) !important;
106
+ }
107
+
108
+ .disabled:is(.checkbox-item-container .chevron-button) .chevron-visible {
109
+ border-color: var(--flat-disabled-border-color);
110
+ background-color: var(--flat-disabled-background-color);
111
+ cursor: not-allowed;
112
+ color: var(--on-flat-disabled-color) !important;
113
+ }
114
+
115
+ :is(.checkbox-item-container .chevron-button):disabled {
116
+ cursor: not-allowed;
117
+ }
118
+
119
+ .disabled:is(.checkbox-item-container .chevron-button) {
120
+ cursor: not-allowed;
121
+ }
122
+
123
+ .checkbox-item-container .chevron-button {
124
+ appearance: none;
125
+ border: none;
126
+ background: transparent;
127
+ padding: 0;
128
+ width: 100%;
129
+ height: 100%;
130
+ display: flex;
131
+ align-items: center;
132
+ justify-content: center;
133
+ cursor: pointer;
134
+ color: var(--on-flat-neutral-color);
135
+ }
136
+
137
+ :is(.checkbox-item-container .chevron-button):disabled {
138
+ cursor: not-allowed;
139
+ }
140
+
141
+ .checkbox-item-container .chevron-visible {
142
+ /* same visible box as obc-icon-button so the two align in one list */
143
+ width: var(--ui-components-icon-button-visual-target-size);
144
+ height: var(--ui-components-icon-button-visual-target-size);
145
+ border-radius: var(--ui-components-button-border-radius-top-left);
146
+ display: flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ }
150
+
41
151
  .checkbox-item-container .chevron-icon {
42
152
  width: var(--global-size-spacing-icon-icon-size-regular);
43
153
  height: var(--global-size-spacing-icon-icon-size-regular);
44
- color: var(--on-flat-neutral-color);
45
154
  }
46
155
 
47
156
  .checkbox-item-container .checkbox-label-container {
48
157
  display: flex;
158
+ flex-direction: column;
159
+ justify-content: center;
160
+ min-width: 0; /* lets the label ellipsis instead of widening the row */
49
161
  padding: 0 var(--global-size-spacing-list-item-padding-vertical) 0 0;
50
162
  margin-left: calc(
51
163
  var(--global-size-spacing-list-item-padding-vertical) / -2
52
164
  );
53
- align-items: center;
54
165
  flex-grow: 1;
55
166
  }
56
167
 
@@ -85,6 +196,25 @@ const componentStyle = css`* {
85
196
  color: var(--element-disabled-color);
86
197
  }
87
198
 
199
+ .checkbox-item-container .checkbox-description {
200
+ color: var(--element-active-color);
201
+ font-family: var(--global-typography-font-family);
202
+ font-weight: var(--global-typography-ui-label-font-weight);
203
+ font-size: var(--global-typography-ui-label-font-size);
204
+ line-height: var(--global-typography-ui-label-line-height);
205
+ font-feature-settings:
206
+ "liga" off,
207
+ "clig" off,
208
+ "ss04" on;
209
+ white-space: nowrap;
210
+ overflow: hidden;
211
+ text-overflow: ellipsis;
212
+ }
213
+
214
+ .disabled :is(.checkbox-item-container .checkbox-description) {
215
+ color: var(--element-disabled-color);
216
+ }
217
+
88
218
  .checkbox-item-container.hover-style-touch-target {
89
219
  cursor: pointer;
90
220
  }
@@ -162,11 +292,6 @@ const componentStyle = css`* {
162
292
  --base-background-color: var(--flat-enabled-background-color);
163
293
  }
164
294
 
165
- .checkbox-item-container.hover-style-visual-target .chevron-container,.checkbox-item-container.hover-style-visual-target .nested-spacer {
166
- width: var(--ui-components-checkbox-nested-item-padding-left);
167
- min-width: var(--ui-components-checkbox-nested-item-padding-left);
168
- }
169
-
170
295
  .content-container {
171
296
  display: flex;
172
297
  width: 100%;
@@ -179,7 +304,7 @@ const componentStyle = css`* {
179
304
  border-radius: var(--ui-components-checkbox-list-item-border-radius);
180
305
  }
181
306
 
182
- .checkbox-item-container.hover-style-visual-target:not(.is-nested):not(.is-level-1):not(.is-level-2) .content-container {
307
+ .checkbox-item-container.hover-style-visual-target:not(.is-nested) .content-container {
183
308
  margin-left: calc(var(--ui-components-checkbox-padding-horizontal) * -1);
184
309
  }
185
310
 
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox-item.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"checkbox-item.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,6 +2,7 @@ import { LitElement } from 'lit';
2
2
  import { CheckboxStatus } from '../checkbox/checkbox.js';
3
3
  import '../checkbox/checkbox.js';
4
4
  import '../../icons/icon-chevron-right-google.js';
5
+ import '../../icons/icon-chevron-down-google.js';
5
6
  export declare enum ObcCheckboxItemState {
6
7
  enabled = "enabled",
7
8
  disabled = "disabled"
@@ -10,76 +11,104 @@ export declare enum ObcCheckboxItemHoverStyle {
10
11
  touchTarget = "touch-target",
11
12
  visualTarget = "visual-target"
12
13
  }
14
+ export type ObcCheckboxItemExpandToggleEvent = CustomEvent<boolean>;
13
15
  /**
14
- * `<obc-checkbox-item>` – A list-item wrapper for `<obc-checkbox>` with label
15
- * and optional nested indentation affordances.
16
+ * `<obc-checkbox-item>` – A list row that pairs `<obc-checkbox>` with a label,
17
+ * an optional description, and hierarchy affordances for nested lists.
16
18
  *
17
19
  * ### Overview
18
- * Combines checkbox interaction with a row-like container used in menus and
19
- * hierarchical selection lists. The component proxies checkbox state changes,
20
- * supports touch-target or visual-target interaction behavior, and can render
21
- * nested structure indicators.
20
+ * The row is the touch target: clicking anywhere on it toggles the checkbox,
21
+ * except on the chevron button, which only asks to expand or collapse. Depth
22
+ * is a number (`level`); the row indents itself so a flat sequence of rows
23
+ * reads as a tree. `<obc-checkbox-list>` builds on this to hide the rows
24
+ * under a collapsed parent.
22
25
  *
23
26
  * ### Features
24
- * - Three checkbox statuses: `unchecked`, `checked`, `mixed`.
25
- * - Item state control: `enabled` or `disabled`.
26
- * - Two hover/focus interaction modes: `touch-target` and `visual-target`.
27
- * - Optional nested layout controls via `isNested`, `isLevel1`, `isLevel2`.
28
- * - Forwards `aria-describedby` to the inner checkbox for assistive context.
29
- *
30
- * ### Variants
31
- * - **Nested level 1:** Chevron icon is shown.
32
- * - **Nested level 2:** Chevron slot is reserved and nested spacer is shown.
27
+ * - Three statuses: `unchecked`, `checked`, `mixed`.
28
+ * - `touch-target` or `visual-target` hover treatment.
29
+ * - `level` indentation: level 1 reserves the chevron slot, each further
30
+ * level adds a spacer.
31
+ * - `expandable` rows show a chevron button that fires `expand-toggle`; the
32
+ * host owns `expanded`.
33
+ * - Optional `description` line under the label.
34
+ * - Forwards `aria-describedby` to the inner checkbox.
33
35
  *
34
36
  * ### Usage Guidelines
35
- * - Use for checkbox rows that require text labels and optional hierarchy.
36
- * - Keep `status` as the source of truth for checked/mixed/unchecked value.
37
- * - Use `state="disabled"` or `disabled` to lock interaction.
38
- * - Prefer `hoverStyle="touch-target"` for standard list behavior.
39
- *
40
- * ### Slots / Content
41
- * - No named slots. Label content is provided through the `label` property.
42
- *
43
- * ### Events
44
- * - `change` – Fired when status changes (from row click or inner checkbox).
45
- * **detail:** `{ status, disabled }`
37
+ * - Keep `status` as the source of truth; update it from the `change` event.
38
+ * - Set `expanded` in response to `expand-toggle` the row never flips it
39
+ * itself, so a parent (or `<obc-checkbox-list>`) can veto or persist it.
40
+ * - Use `level` 0 for a plain list; start at 1 when any row in the list is
41
+ * expandable so chevrons and checkboxes line up.
42
+ * - Prefer `hoverStyle="touch-target"` for standard list behaviour.
46
43
  *
47
- * ### Best Practices
48
- * - Provide non-empty `label` for accessible naming.
49
- * - Use `aria-describedby` when additional contextual text exists outside.
50
- * - For deep hierarchies, use `isNested` with `isLevel1` / `isLevel2`
51
- * consistently to preserve spacing and alignment.
44
+ * ### Accessibility
45
+ * The checkbox and the chevron are separate controls in the natural tab
46
+ * order. The chevron is a native button named by the row's label, with the
47
+ * state in `aria-expanded`, following the WAI-ARIA checkbox and disclosure
48
+ * button patterns.
52
49
  *
53
50
  * ### Example
54
51
  * ```html
55
52
  * <obc-checkbox-item
53
+ * level="1"
54
+ * expandable
55
+ * expanded
56
56
  * status="mixed"
57
- * label="Include archived items"
58
- * hoverStyle="touch-target"
57
+ * label="Reports"
58
+ * ></obc-checkbox-item>
59
+ * <obc-checkbox-item
60
+ * level="2"
61
+ * status="checked"
62
+ * label="Monthly"
63
+ * description="Sent on the 1st"
59
64
  * ></obc-checkbox-item>
60
65
  * ```
61
66
  *
62
- * @availableWhen isLevel1 isNested==true || hoverStyle==visual-target
63
- * @availableWhen isLevel2 isNested==true || hoverStyle==visual-target
64
- * @slot - No named slots.
67
+ * @property status - Checkbox status: `unchecked`, `checked` or `mixed`.
68
+ * @property state - Item state: `enabled` or `disabled`.
69
+ * @property disabled - Disables the row and the inner checkbox.
70
+ * @property label - Text label; also the checkbox's accessible name.
71
+ * @property description - Secondary line under the label; hidden when empty.
72
+ * @property level - Depth in a nested list. 0 is a plain row; 1 reserves the chevron slot; each level above 1 adds a spacer.
73
+ * @property expandable - Shows the chevron button that fires `expand-toggle`.
74
+ * @property expanded - Whether the row's children are shown; drives the chevron direction and `aria-expanded`.
75
+ * @availableWhen expanded expandable==true
76
+ * @property hoverStyle - Which box shows hover and focus: the whole row (`touch-target`) or the checkbox (`visual-target`).
77
+ * @property ariaDescribedBy - Forwarded to the inner checkbox as `aria-describedby`.
65
78
  * @fires {ObcCheckboxChangeEvent} change - Emitted when status changes.
79
+ * @fires {ObcCheckboxItemExpandToggleEvent} expand-toggle - Emitted when the chevron is activated; detail is the next `expanded` value. Bubbles and is composed.
66
80
  * @stable
67
81
  */
68
82
  export declare class ObcCheckboxItem extends LitElement {
83
+ /** Checkbox status: `unchecked`, `checked` or `mixed`. */
69
84
  status: CheckboxStatus;
85
+ /** Item state: `enabled` or `disabled`. */
70
86
  state: ObcCheckboxItemState;
87
+ /** Disables the row and the inner checkbox. */
71
88
  disabled: boolean;
89
+ /** Text label; also the checkbox's accessible name. */
72
90
  label: string;
73
- isNested: boolean;
74
- isLevel1: boolean;
75
- isLevel2: boolean;
91
+ /** Secondary line under the label; hidden when empty. */
92
+ description: string;
93
+ /** Depth in a nested list. 0 is a plain row; 1 reserves the chevron slot; each level above 1 adds a spacer. */
94
+ level: number;
95
+ /** Shows the chevron button that fires `expand-toggle`. */
96
+ expandable: boolean;
97
+ /** Whether the row's children are shown; drives the chevron direction and `aria-expanded`. */
98
+ expanded: boolean;
99
+ /** Which box shows hover and focus: the whole row (`touch-target`) or the checkbox (`visual-target`). */
76
100
  hoverStyle: ObcCheckboxItemHoverStyle;
101
+ /** Forwarded to the inner checkbox as `aria-describedby`. */
77
102
  ariaDescribedBy: string;
78
103
  private checkboxElement?;
104
+ private chevronButton?;
105
+ private get isDisabled();
79
106
  private toggleStatusFromItem;
80
107
  private handleItemClick;
108
+ private handleChevronClick;
81
109
  private handleCheckboxChange;
82
110
  focus(options?: FocusOptions): void;
111
+ private renderChevron;
83
112
  render(): import('lit-html').TemplateResult<1>;
84
113
  static styles: import('lit').CSSResult;
85
114
  }
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox-item.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox-item/checkbox-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAMzD,OAAO,yBAAyB,CAAC;AACjC,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAEjC,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,oBAAY,yBAAyB;IACnC,WAAW,iBAAiB;IAC5B,YAAY,kBAAkB;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,qBACa,eAAgB,SAAQ,UAAU;IACnB,MAAM,EAAE,cAAc,CAA4B;IAElD,KAAK,EAAE,oBAAoB,CACtB;IAEJ,QAAQ,UAAS;IAElB,KAAK,SAAM;IAEK,QAAQ,UAAS;IAEjB,QAAQ,UAAS;IAEjB,QAAQ,UAAS;IAEjC,UAAU,EAAE,yBAAyB,CACvB;IAGxC,eAAe,SAAM;IAEE,OAAO,CAAC,eAAe,CAAC,CAAc;IAE7D,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,oBAAoB;IAWZ,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAI1C,MAAM;IAuDf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
1
+ {"version":3,"file":"checkbox-item.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox-item/checkbox-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAOzD,OAAO,yBAAyB,CAAC;AACjC,OAAO,0CAA0C,CAAC;AAClD,OAAO,yCAAyC,CAAC;AACjD,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAEjC,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,oBAAY,yBAAyB;IACnC,WAAW,iBAAiB;IAC5B,YAAY,kBAAkB;CAC/B;AAED,MAAM,MAAM,gCAAgC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,qBACa,eAAgB,SAAQ,UAAU;IACnB,MAAM,EAAE,cAAc,CAA4B;IAElD,KAAK,EAAE,oBAAoB,CACtB;IAEJ,QAAQ,UAAS;IAElB,KAAK,SAAM;IAEX,WAAW,SAAM;IAEF,KAAK,SAAK;IAET,UAAU,UAAS;IAEnB,QAAQ,UAAS;IAEjC,UAAU,EAAE,yBAAyB,CACvB;IAGxC,eAAe,SAAM;IAEE,OAAO,CAAC,eAAe,CAAC,CAAc;IAEnC,OAAO,CAAC,aAAa,CAAC,CAAc;IAE9D,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,oBAAoB;IAWZ,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAInD,OAAO,CAAC,aAAa;IAsBZ,MAAM;IAuDf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
@@ -2,10 +2,12 @@ import { unsafeCSS, LitElement, nothing, html } from "lit";
2
2
  import { property, query } from "lit/decorators.js";
3
3
  import { classMap } from "lit/directives/class-map.js";
4
4
  import { ifDefined } from "lit/directives/if-defined.js";
5
+ import { styleMap } from "lit/directives/style-map.js";
5
6
  import { customElement } from "../../decorator.js";
6
7
  import componentStyle from "./checkbox-item.css.js";
7
8
  import { CheckboxStatus, CheckboxState } from "../checkbox/checkbox.js";
8
9
  import "../../icons/icon-chevron-right-google.js";
10
+ import "../../icons/icon-chevron-down-google.js";
9
11
  var __defProp = Object.defineProperty;
10
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
13
  var __decorateClass = (decorators, target, key, kind) => {
@@ -33,14 +35,17 @@ let ObcCheckboxItem = class extends LitElement {
33
35
  this.state = "enabled";
34
36
  this.disabled = false;
35
37
  this.label = "";
36
- this.isNested = false;
37
- this.isLevel1 = false;
38
- this.isLevel2 = false;
38
+ this.description = "";
39
+ this.level = 0;
40
+ this.expandable = false;
41
+ this.expanded = false;
39
42
  this.hoverStyle = "touch-target";
40
43
  this.ariaDescribedBy = "";
41
44
  }
45
+ get isDisabled() {
46
+ return this.disabled || this.state === "disabled";
47
+ }
42
48
  toggleStatusFromItem() {
43
- const isDisabled = this.disabled || this.state === "disabled";
44
49
  if (this.status === CheckboxStatus.checked) {
45
50
  this.status = CheckboxStatus.unchecked;
46
51
  } else {
@@ -50,18 +55,28 @@ let ObcCheckboxItem = class extends LitElement {
50
55
  new CustomEvent("change", {
51
56
  detail: {
52
57
  status: this.status,
53
- disabled: isDisabled
58
+ disabled: this.isDisabled
54
59
  }
55
60
  })
56
61
  );
57
62
  }
58
63
  handleItemClick(event) {
59
- if (this.disabled || this.state === "disabled") return;
64
+ if (this.isDisabled) return;
60
65
  const path = event.composedPath();
61
- const checkboxElement = this.checkboxElement;
62
- if (checkboxElement && path.includes(checkboxElement)) return;
66
+ if (this.checkboxElement && path.includes(this.checkboxElement)) return;
67
+ if (this.chevronButton && path.includes(this.chevronButton)) return;
63
68
  this.toggleStatusFromItem();
64
69
  }
70
+ handleChevronClick(event) {
71
+ event.stopPropagation();
72
+ this.dispatchEvent(
73
+ new CustomEvent("expand-toggle", {
74
+ detail: !this.expanded,
75
+ bubbles: true,
76
+ composed: true
77
+ })
78
+ );
79
+ }
65
80
  handleCheckboxChange(event) {
66
81
  const checkboxEvent = event;
67
82
  this.status = checkboxEvent.detail.status;
@@ -74,12 +89,30 @@ let ObcCheckboxItem = class extends LitElement {
74
89
  focus(options) {
75
90
  this.checkboxElement?.focus(options);
76
91
  }
92
+ renderChevron() {
93
+ if (!this.expandable) return nothing;
94
+ return html`<button
95
+ type="button"
96
+ class="chevron-button"
97
+ aria-expanded=${this.expanded ? "true" : "false"}
98
+ aria-label=${ifDefined(this.label.trim() || void 0)}
99
+ ?disabled=${this.isDisabled}
100
+ @click=${this.handleChevronClick}
101
+ >
102
+ <span class="chevron-visible">
103
+ ${this.expanded ? html`<obi-chevron-down-google
104
+ class="chevron-icon"
105
+ ></obi-chevron-down-google>` : html`<obi-chevron-right-google
106
+ class="chevron-icon"
107
+ ></obi-chevron-right-google>`}
108
+ </span>
109
+ </button>`;
110
+ }
77
111
  render() {
78
- const isDisabled = this.disabled || this.state === "disabled";
112
+ const isDisabled = this.isDisabled;
79
113
  const hasCheckboxHoverEffects = !(this.hoverStyle === "touch-target" && !isDisabled);
80
- const shouldRenderNestedSpacer = this.isNested && this.isLevel2;
81
- const shouldRenderChevronContainer = this.isNested;
82
- const shouldRenderChevronIcon = this.isNested && this.isLevel1;
114
+ const depth = Math.max(0, Math.floor(this.level) - 1);
115
+ const hasChevronSlot = this.level >= 1 || this.expandable;
83
116
  const checkboxAriaLabel = this.label.trim().length > 0 ? this.label : void 0;
84
117
  return html`
85
118
  <div
@@ -87,19 +120,18 @@ let ObcCheckboxItem = class extends LitElement {
87
120
  "checkbox-item-container": true,
88
121
  [`status-${this.status}`]: true,
89
122
  [`hover-style-${this.hoverStyle}`]: true,
90
- "is-nested": this.isNested,
91
- "is-level-1": this.isLevel1,
92
- "is-level-2": this.isLevel2,
123
+ "is-nested": hasChevronSlot,
124
+ "has-description": this.description !== "",
93
125
  disabled: isDisabled
94
126
  })}
95
127
  @click=${this.handleItemClick}
96
128
  >
97
- ${shouldRenderChevronContainer ? html`<div class="chevron-container" aria-hidden="true">
98
- ${shouldRenderChevronIcon ? html`<obi-chevron-right-google
99
- class="chevron-icon"
100
- ></obi-chevron-right-google>` : nothing}
101
- </div>` : nothing}
102
- ${shouldRenderNestedSpacer ? html`<div class="nested-spacer" aria-hidden="true"></div>` : nothing}
129
+ ${depth > 0 ? html`<div
130
+ class="nested-spacer"
131
+ aria-hidden="true"
132
+ style=${styleMap({ "--checkbox-item-depth": String(depth) })}
133
+ ></div>` : nothing}
134
+ ${hasChevronSlot ? html`<div class="chevron-container">${this.renderChevron()}</div>` : nothing}
103
135
  <div class="content-container">
104
136
  <obc-checkbox
105
137
  .status=${this.status}
@@ -112,6 +144,9 @@ let ObcCheckboxItem = class extends LitElement {
112
144
  ></obc-checkbox>
113
145
  <div class="checkbox-label-container">
114
146
  <span class="checkbox-label">${this.label}</span>
147
+ ${this.description ? html`<span class="checkbox-description"
148
+ >${this.description}</span
149
+ >` : nothing}
115
150
  </div>
116
151
  </div>
117
152
  </div>
@@ -132,14 +167,17 @@ __decorateClass([
132
167
  property({ type: String })
133
168
  ], ObcCheckboxItem.prototype, "label", 2);
134
169
  __decorateClass([
135
- property({ type: Boolean, reflect: true })
136
- ], ObcCheckboxItem.prototype, "isNested", 2);
170
+ property({ type: String })
171
+ ], ObcCheckboxItem.prototype, "description", 2);
172
+ __decorateClass([
173
+ property({ type: Number, reflect: true })
174
+ ], ObcCheckboxItem.prototype, "level", 2);
137
175
  __decorateClass([
138
176
  property({ type: Boolean, reflect: true })
139
- ], ObcCheckboxItem.prototype, "isLevel1", 2);
177
+ ], ObcCheckboxItem.prototype, "expandable", 2);
140
178
  __decorateClass([
141
179
  property({ type: Boolean, reflect: true })
142
- ], ObcCheckboxItem.prototype, "isLevel2", 2);
180
+ ], ObcCheckboxItem.prototype, "expanded", 2);
143
181
  __decorateClass([
144
182
  property({ type: String })
145
183
  ], ObcCheckboxItem.prototype, "hoverStyle", 2);
@@ -149,6 +187,9 @@ __decorateClass([
149
187
  __decorateClass([
150
188
  query("obc-checkbox")
151
189
  ], ObcCheckboxItem.prototype, "checkboxElement", 2);
190
+ __decorateClass([
191
+ query(".chevron-button")
192
+ ], ObcCheckboxItem.prototype, "chevronButton", 2);
152
193
  ObcCheckboxItem = __decorateClass([
153
194
  customElement("obc-checkbox-item")
154
195
  ], ObcCheckboxItem);