@sula-tech/webcomponents 0.0.0-snapshot-feature-workbench-menu-57f51ec → 0.0.0-snapshot-update-release-workflow-eeeefa9

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 (164) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/sula-avatar_32.cjs.entry.js +176 -99
  3. package/dist/cjs/sula-avatar_32.cjs.entry.js.map +1 -1
  4. package/dist/cjs/sula-profile-menu.cjs.entry.js +1 -1
  5. package/dist/cjs/sula-profile-menu.cjs.entry.js.map +1 -1
  6. package/dist/cjs/sula-profile-menu.entry.cjs.js.map +1 -1
  7. package/dist/cjs/sula-toast-stack.cjs.entry.js +4 -4
  8. package/dist/cjs/sula-toast.cjs.entry.js +2 -2
  9. package/dist/cjs/sula-workbench-menu.cjs.entry.js +124 -61
  10. package/dist/cjs/sula-workbench-menu.cjs.entry.js.map +1 -1
  11. package/dist/cjs/sula-workbench-menu.entry.cjs.js.map +1 -1
  12. package/dist/cjs/webcomponents.cjs.js +1 -1
  13. package/dist/collection/components/sula-button/sula-button.css +1 -1
  14. package/dist/collection/components/sula-calendar/sula-calendar.css +1 -1
  15. package/dist/collection/components/sula-calendar/sula-calendar.js +56 -17
  16. package/dist/collection/components/sula-calendar/sula-calendar.js.map +1 -1
  17. package/dist/collection/components/sula-calendar/sula-calendar.stories.js +16 -1
  18. package/dist/collection/components/sula-calendar/sula-calendar.stories.js.map +1 -1
  19. package/dist/collection/components/sula-chip/sula-chip.css +1 -1
  20. package/dist/collection/components/sula-chip/sula-chip.js +30 -4
  21. package/dist/collection/components/sula-chip/sula-chip.js.map +1 -1
  22. package/dist/collection/components/sula-chip/sula-chip.stories.js +55 -0
  23. package/dist/collection/components/sula-chip/sula-chip.stories.js.map +1 -1
  24. package/dist/collection/components/sula-dropdown/sula-dropdown.js +3 -3
  25. package/dist/collection/components/sula-icon/sula-icon.css +1 -1
  26. package/dist/collection/components/sula-icon/sula-icon.js +1 -1
  27. package/dist/collection/components/sula-icon-picker/sula-icon-picker.js +2 -2
  28. package/dist/collection/components/sula-loader/sula-loader.css +1 -1
  29. package/dist/collection/components/sula-loader/sula-loader.js +1 -1
  30. package/dist/collection/components/sula-menu/sula-menu.css +1 -1
  31. package/dist/collection/components/sula-menu/sula-menu.js +13 -13
  32. package/dist/collection/components/sula-menu/sula-menu.js.map +1 -1
  33. package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.css +1 -1
  34. package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js +1 -1
  35. package/dist/collection/components/sula-modal/sula-modal.css +1 -1
  36. package/dist/collection/components/sula-modal/sula-modal.js +142 -11
  37. package/dist/collection/components/sula-modal/sula-modal.js.map +1 -1
  38. package/dist/collection/components/sula-modal/sula-modal.stories.js +48 -0
  39. package/dist/collection/components/sula-modal/sula-modal.stories.js.map +1 -1
  40. package/dist/collection/components/sula-profile-menu/sula-profile-menu.css +1 -1
  41. package/dist/collection/components/sula-progress-bar/sula-progress-bar.js +2 -2
  42. package/dist/collection/components/sula-radio-button/sula-radio-button.js +2 -2
  43. package/dist/collection/components/sula-search-bar/sula-search-bar.js +2 -2
  44. package/dist/collection/components/sula-segmented-control/sula-segmented-control.js +1 -1
  45. package/dist/collection/components/sula-switch/sula-switch.css +1 -1
  46. package/dist/collection/components/sula-switch/sula-switch.js +4 -4
  47. package/dist/collection/components/sula-table/sula-table.js +3 -3
  48. package/dist/collection/components/sula-table-body/sula-table-body.js +1 -1
  49. package/dist/collection/components/sula-table-cell/sula-table-cell.js +2 -2
  50. package/dist/collection/components/sula-table-head-cell/sula-table-head-cell.js +2 -2
  51. package/dist/collection/components/sula-table-header/sula-table-header.js +1 -1
  52. package/dist/collection/components/sula-table-row/sula-table-row.js +1 -1
  53. package/dist/collection/components/sula-tag/sula-tag.js +3 -3
  54. package/dist/collection/components/sula-textarea/sula-textarea.js +6 -6
  55. package/dist/collection/components/sula-textfield/sula-textfield.css +1 -1
  56. package/dist/collection/components/sula-textfield/sula-textfield.js +2 -2
  57. package/dist/collection/components/sula-tiles/sula-tiles.js +1 -1
  58. package/dist/collection/components/sula-timeline-list/sula-timeline-list.js +1 -1
  59. package/dist/collection/components/sula-toast/sula-toast.js +2 -2
  60. package/dist/collection/components/sula-toast-stack/sula-toast-stack.js +4 -4
  61. package/dist/collection/components/sula-toggle/sula-toggle.js +1 -1
  62. package/dist/collection/components/sula-tooltip/sula-tooltip.js +1 -1
  63. package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.css +1 -1
  64. package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.js +138 -74
  65. package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.js.map +1 -1
  66. package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.stories.js +218 -99
  67. package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.stories.js.map +1 -1
  68. package/dist/components/{p-Wd3q-zRy.js → p-1SBJ2JjF.js} +6 -6
  69. package/dist/components/{p-Wd3q-zRy.js.map → p-1SBJ2JjF.js.map} +1 -1
  70. package/dist/components/{p-YsuXC_9x.js → p-BD4DLCMm.js} +5 -5
  71. package/dist/components/{p-YsuXC_9x.js.map → p-BD4DLCMm.js.map} +1 -1
  72. package/dist/components/{p-DkXdsyPr.js → p-Bdc73E-Z.js} +7 -7
  73. package/dist/components/{p-DkXdsyPr.js.map → p-Bdc73E-Z.js.map} +1 -1
  74. package/dist/components/{p-MPkJUrNl.js → p-BlRYoc3b.js} +4 -4
  75. package/dist/components/{p-MPkJUrNl.js.map → p-BlRYoc3b.js.map} +1 -1
  76. package/dist/components/{p-B5MmQ8zn.js → p-BrjLS4Oh.js} +5 -5
  77. package/dist/components/{p-B5MmQ8zn.js.map → p-BrjLS4Oh.js.map} +1 -1
  78. package/dist/components/{p-CZdy_Df-.js → p-Cktbp7SD.js} +5 -5
  79. package/dist/components/{p-CZdy_Df-.js.map → p-Cktbp7SD.js.map} +1 -1
  80. package/dist/components/{p-DpW2KDYm.js → p-DP9qGgPM.js} +4 -4
  81. package/dist/components/{p-DpW2KDYm.js.map → p-DP9qGgPM.js.map} +1 -1
  82. package/dist/components/{p-CvpbIDzE.js → p-DTZo84U5.js} +5 -5
  83. package/dist/components/{p-CvpbIDzE.js.map → p-DTZo84U5.js.map} +1 -1
  84. package/dist/components/{p-B8AsfKSM.js → p-KIC3LfH4.js} +7 -7
  85. package/dist/components/{p-B8AsfKSM.js.map → p-KIC3LfH4.js.map} +1 -1
  86. package/dist/components/{p-DCGHpgTv.js → p-boQwbNNO.js} +5 -5
  87. package/dist/components/{p-DCGHpgTv.js.map → p-boQwbNNO.js.map} +1 -1
  88. package/dist/components/sula-avatar.js +1 -1
  89. package/dist/components/sula-badge.js +1 -1
  90. package/dist/components/sula-breadcrumb.js +1 -1
  91. package/dist/components/sula-button.js +1 -1
  92. package/dist/components/sula-calendar.js +59 -20
  93. package/dist/components/sula-calendar.js.map +1 -1
  94. package/dist/components/sula-checkbox.js +1 -1
  95. package/dist/components/sula-chip.js +15 -7
  96. package/dist/components/sula-chip.js.map +1 -1
  97. package/dist/components/sula-dropdown.js +1 -1
  98. package/dist/components/sula-icon-picker.js +6 -6
  99. package/dist/components/sula-icon.js +1 -1
  100. package/dist/components/sula-loader.js +1 -1
  101. package/dist/components/sula-menu-select-list.js +1 -1
  102. package/dist/components/sula-menu.js +15 -15
  103. package/dist/components/sula-menu.js.map +1 -1
  104. package/dist/components/sula-modal.js +51 -15
  105. package/dist/components/sula-modal.js.map +1 -1
  106. package/dist/components/sula-profile-menu.js +1 -1
  107. package/dist/components/sula-progress-bar.js +3 -3
  108. package/dist/components/sula-radio-button.js +2 -2
  109. package/dist/components/sula-search-bar.js +1 -1
  110. package/dist/components/sula-segmented-control.js +2 -2
  111. package/dist/components/sula-switch.js +1 -1
  112. package/dist/components/sula-table-body.js +1 -1
  113. package/dist/components/sula-table-cell.js +2 -2
  114. package/dist/components/sula-table-head-cell.js +2 -2
  115. package/dist/components/sula-table-header.js +1 -1
  116. package/dist/components/sula-table-row.js +1 -1
  117. package/dist/components/sula-table.js +3 -3
  118. package/dist/components/sula-tag.js +4 -4
  119. package/dist/components/sula-textarea.js +6 -6
  120. package/dist/components/sula-textfield.js +1 -1
  121. package/dist/components/sula-tiles.js +2 -2
  122. package/dist/components/sula-timeline-list.js +2 -2
  123. package/dist/components/sula-toast-stack.js +6 -6
  124. package/dist/components/sula-toast.js +1 -1
  125. package/dist/components/sula-toggle.js +2 -2
  126. package/dist/components/sula-tooltip.js +2 -2
  127. package/dist/components/sula-workbench-menu.js +131 -66
  128. package/dist/components/sula-workbench-menu.js.map +1 -1
  129. package/dist/esm/loader.js +1 -1
  130. package/dist/esm/sula-avatar_32.entry.js +176 -99
  131. package/dist/esm/sula-avatar_32.entry.js.map +1 -1
  132. package/dist/esm/sula-profile-menu.entry.js +1 -1
  133. package/dist/esm/sula-profile-menu.entry.js.map +1 -1
  134. package/dist/esm/sula-toast-stack.entry.js +4 -4
  135. package/dist/esm/sula-toast.entry.js +2 -2
  136. package/dist/esm/sula-workbench-menu.entry.js +124 -61
  137. package/dist/esm/sula-workbench-menu.entry.js.map +1 -1
  138. package/dist/esm/webcomponents.js +1 -1
  139. package/dist/types/components/sula-calendar/sula-calendar.d.ts +9 -3
  140. package/dist/types/components/sula-calendar/sula-calendar.stories.d.ts +1 -0
  141. package/dist/types/components/sula-chip/sula-chip.d.ts +5 -0
  142. package/dist/types/components/sula-chip/sula-chip.stories.d.ts +12 -0
  143. package/dist/types/components/sula-modal/sula-modal.d.ts +21 -0
  144. package/dist/types/components/sula-modal/sula-modal.stories.d.ts +22 -0
  145. package/dist/types/components/sula-workbench-menu/sula-workbench-menu.d.ts +18 -9
  146. package/dist/types/components/sula-workbench-menu/sula-workbench-menu.stories.d.ts +26 -19
  147. package/dist/types/components.d.ts +79 -23
  148. package/dist/webcomponents/{p-df271629.entry.js → p-18c84807.entry.js} +6 -6
  149. package/dist/webcomponents/p-235dcb90.entry.js +880 -0
  150. package/dist/webcomponents/p-235dcb90.entry.js.map +1 -0
  151. package/dist/webcomponents/{p-60d2ad8f.entry.js → p-3344a9f9.entry.js} +406 -289
  152. package/dist/webcomponents/p-3344a9f9.entry.js.map +1 -0
  153. package/dist/webcomponents/{p-c552c435.entry.js → p-705e2424.entry.js} +16 -16
  154. package/dist/webcomponents/{p-4251c973.entry.js → p-7e31b463.entry.js} +2 -2
  155. package/dist/webcomponents/sula-profile-menu.entry.esm.js.map +1 -1
  156. package/dist/webcomponents/sula-workbench-menu.entry.esm.js.map +1 -1
  157. package/dist/webcomponents/webcomponents.esm.js +15 -7
  158. package/package.json +1 -1
  159. package/dist/webcomponents/p-569d0bad.entry.js +0 -807
  160. package/dist/webcomponents/p-569d0bad.entry.js.map +0 -1
  161. package/dist/webcomponents/p-60d2ad8f.entry.js.map +0 -1
  162. /package/dist/webcomponents/{p-df271629.entry.js.map → p-18c84807.entry.js.map} +0 -0
  163. /package/dist/webcomponents/{p-c552c435.entry.js.map → p-705e2424.entry.js.map} +0 -0
  164. /package/dist/webcomponents/{p-4251c973.entry.js.map → p-7e31b463.entry.js.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { SulaMenuDensity, SulaMenuLabelOverflow } from "../sula-menu/model/sula-menu.model";
3
3
  /**
4
- * Navigation menu that combines an inline expandable tree with a drill-down panel.
5
- * Levels above `drilldownLevel` expand in place, as in `sula-menu`. Items at or below
6
- * that level with children open a single-level panel with a breadcrumb trail.
4
+ * Navigation menu that expands in place, as in `sula-menu`, while the tree has up to 3 levels.
5
+ * When any visible item reaches a 4th level, every item with children opens a single-level
6
+ * drill-down panel with a breadcrumb trail instead.
7
7
  *
8
8
  * @part shell - Main visual container of the menu.
9
9
  * @part title - Menu title, or the current level title while drilled in.
@@ -12,7 +12,7 @@ import { SulaMenuDensity, SulaMenuLabelOverflow } from "../sula-menu/model/sula-
12
12
  * @part toggle-label - Label of the collapse/expand control.
13
13
  * @slot profile-content - Extra content rendered inside the profile popover.
14
14
  * @part profile-popover - Popover opened from the user area.
15
- * @cssprop --sula-menu-width - Width of the expanded menu. Defaults to 256px.
15
+ * @cssprop --sula-menu-width - Width of the expanded menu. Defaults to 300px.
16
16
  * @cssprop --sula-menu-collapsed-width - Width of the collapsed menu. Defaults to 88px.
17
17
  */
18
18
  export class SulaWorkbenchMenu {
@@ -38,11 +38,6 @@ export class SulaWorkbenchMenu {
38
38
  * Overflow behavior for item labels.
39
39
  */
40
40
  this.labelOverflow = SulaMenuLabelOverflow.Wrap;
41
- /**
42
- * Depth (1-based) from which items with children open a drill-down panel instead of expanding in place.
43
- * With the default of 3, the first two levels expand inline and deeper branches drill down.
44
- */
45
- this.drilldownLevel = 3;
46
41
  /**
47
42
  * Menu items. Each item may use `icon` (icon font class) or `image` (URL or data URI of an image or SVG).
48
43
  */
@@ -57,6 +52,7 @@ export class SulaWorkbenchMenu {
57
52
  this.profileItems = [];
58
53
  this.collapsed = false;
59
54
  this.previewExpanded = false;
55
+ this.drillMode = false;
60
56
  this.stack = [];
61
57
  this.direction = 'forward';
62
58
  this.selectedPath = [];
@@ -76,6 +72,7 @@ export class SulaWorkbenchMenu {
76
72
  this.syncWithItems(this.items);
77
73
  }
78
74
  syncWithItems(items) {
75
+ this.drillMode = this.maxDepth(items) > 3;
79
76
  const nextSelected = this.findSelectedIds(items);
80
77
  if (nextSelected) {
81
78
  this.selectedPath = nextSelected;
@@ -83,7 +80,61 @@ export class SulaWorkbenchMenu {
83
80
  else if (!this.selectedPath.length || !this.isStillSelectable(items, this.selectedPath)) {
84
81
  this.selectedPath = [];
85
82
  }
86
- this.stack = this.rebuildStack(items, this.stack);
83
+ this.stack = this.drillMode ? this.rebuildStack(items, this.stack) : [];
84
+ if (this.drillPath && (this.drillMode || this.drillPath !== this.expandedPath))
85
+ this.applyDrillPath(this.drillPath);
86
+ }
87
+ syncDrillPath(path) {
88
+ if (path)
89
+ this.applyDrillPath(path);
90
+ }
91
+ applyDrillPath(path) {
92
+ var _a;
93
+ if (!this.drillMode) {
94
+ this.expandInline(path);
95
+ return;
96
+ }
97
+ const next = [];
98
+ let level = this.items;
99
+ for (const id of path) {
100
+ const match = this.getVisibleItems(level).find(item => item.id === id);
101
+ if (!match)
102
+ break;
103
+ next.push(match);
104
+ level = (_a = match.children) !== null && _a !== void 0 ? _a : [];
105
+ }
106
+ const same = next.length === this.stack.length && next.every((item, index) => item.id === this.stack[index].id);
107
+ if (same)
108
+ return;
109
+ this.direction = next.length < this.stack.length ? 'back' : 'forward';
110
+ this.stack = next;
111
+ }
112
+ expandInline(path) {
113
+ var _a;
114
+ if (!this.items.length)
115
+ return;
116
+ this.expandedPath = path;
117
+ const ids = [];
118
+ let level = this.items;
119
+ for (const id of path) {
120
+ const match = this.getVisibleItems(level).find(item => item.id === id);
121
+ if (!match)
122
+ break;
123
+ if (!match.expanded && this.hasVisibleChildren(match))
124
+ ids.push(id);
125
+ level = (_a = match.children) !== null && _a !== void 0 ? _a : [];
126
+ }
127
+ if (ids.length)
128
+ this.items = this.markExpanded(this.items, ids);
129
+ }
130
+ markExpanded(items, ids) {
131
+ return items.map(item => (Object.assign(Object.assign(Object.assign({}, item), (ids.includes(item.id) ? { expanded: true } : {})), (item.children ? { children: this.markExpanded(item.children, ids) } : {}))));
132
+ }
133
+ maxDepth(items) {
134
+ const visible = this.getVisibleItems(items);
135
+ if (!visible.length)
136
+ return 0;
137
+ return 1 + Math.max(...visible.map(item => this.maxDepth(item.children)));
87
138
  }
88
139
  componentDidRender() {
89
140
  this.positionProfile();
@@ -119,7 +170,7 @@ export class SulaWorkbenchMenu {
119
170
  return this.getVisibleItems(item.children).length > 0;
120
171
  }
121
172
  isDrilled() {
122
- return this.stack.length >= this.drilldownLevel;
173
+ return this.drillMode && this.stack.length > 0;
123
174
  }
124
175
  findSelectedIds(items, trail = []) {
125
176
  for (const item of this.getVisibleItems(items)) {
@@ -206,16 +257,16 @@ export class SulaWorkbenchMenu {
206
257
  this.selectedPath = path.map(p => p.id);
207
258
  this.itemSelected.emit(item);
208
259
  }
209
- handleRowClick(item, depth) {
260
+ handleRowClick(item) {
210
261
  if (item.disabled)
211
262
  return;
212
263
  this.itemClicked.emit(item);
213
264
  if (this.hasVisibleChildren(item)) {
214
- if (depth < this.drilldownLevel) {
215
- this.toggleInline(item.id);
265
+ if (this.drillMode) {
266
+ this.enterDrill(item);
216
267
  }
217
268
  else {
218
- this.enterDrill(item);
269
+ this.toggleInline(item.id);
219
270
  }
220
271
  return;
221
272
  }
@@ -235,7 +286,7 @@ export class SulaWorkbenchMenu {
235
286
  const button = event.currentTarget;
236
287
  this.crumbMenu = {
237
288
  open: true,
238
- left: button.offsetLeft,
289
+ left: 0,
239
290
  top: button.offsetTop + button.offsetHeight + 6,
240
291
  };
241
292
  }
@@ -283,24 +334,26 @@ export class SulaWorkbenchMenu {
283
334
  if (this.collapsed && !this.hovering)
284
335
  this.previewExpanded = false;
285
336
  }
286
- // Fixed position, so ancestors with overflow hidden do not clip the popover.
337
+ // Fixed position, so ancestors with overflow hidden do not clip the popover. A transformed ancestor
338
+ // (e.g. the Storybook docs canvas) becomes the containing block, so coordinates are made relative to its origin.
287
339
  positionProfile() {
340
+ var _a, _b;
288
341
  if (!this.profileOpen || !this.profileEl || !this.userInfoEl || !this.shellEl)
289
342
  return;
290
343
  const gap = 8;
291
344
  const inset = 12;
292
345
  const anchor = this.userInfoEl.getBoundingClientRect();
293
346
  const shell = this.shellEl.getBoundingClientRect();
347
+ const origin = (_b = (_a = this.profileOriginEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : { left: 0, top: 0 };
294
348
  const style = this.profileEl.style;
295
- if (!this.collapsed || this.previewExpanded) {
296
- style.left = `${shell.left + inset}px`;
297
- style.width = `${shell.width - inset * 2}px`;
298
- style.bottom = `${window.innerHeight - anchor.top + gap}px`;
299
- return;
300
- }
301
- style.left = `${shell.right + gap}px`;
302
- style.width = '';
303
- style.bottom = `${window.innerHeight - anchor.bottom}px`;
349
+ const expandedView = !this.collapsed || this.previewExpanded;
350
+ style.width = expandedView ? `${shell.width - inset * 2}px` : '';
351
+ const height = this.profileEl.offsetHeight;
352
+ const left = expandedView ? shell.left + inset : shell.right + gap;
353
+ const bottom = expandedView ? anchor.top - gap : anchor.bottom;
354
+ style.bottom = 'auto';
355
+ style.left = `${left - origin.left}px`;
356
+ style.top = `${bottom - height - origin.top}px`;
304
357
  }
305
358
  // Inner events are composed; stopping them avoids clashing with this menu's own itemClicked.
306
359
  handleProfileItemClicked(event) {
@@ -356,12 +409,14 @@ export class SulaWorkbenchMenu {
356
409
  renderUserInfo(expandedView) {
357
410
  const user = this.user;
358
411
  return (h("button", { type: "button", class: {
359
- 'user-info flex min-w-0 cursor-pointer items-center rounded-xs p-8 text-left hover:bg-box-shadow-body': true,
360
- 'user-info--active bg-box-shadow-body': this.profileOpen,
361
- 'flex-1': expandedView,
412
+ 'user-info flex min-w-0 cursor-pointer items-center text-left': true,
413
+ 'user-info--card w-full gap-16 rounded-md bg-surface-on-body p-16': expandedView,
414
+ 'rounded-xs p-8 hover:bg-states-empty-bg-hover': !expandedView,
415
+ 'user-info--active bg-states-empty-bg-hover': this.profileOpen && !expandedView,
362
416
  }, title: `Ver perfil de ${user.name}`, "aria-label": `Ver perfil de ${user.name}`, "aria-haspopup": "dialog", "aria-expanded": String(this.profileOpen), ref: el => (this.userInfoEl = el), onClick: () => this.toggleProfile() }, h("span", { class: "user-avatar flex h-9 w-9 flex-none items-center justify-center overflow-hidden rounded-full bg-brand-primary text-sm font-semibold text-negative-negative-1" }, user.photo ? h("img", { src: user.photo, alt: user.name }) : this.getInitials(user.name)), h("span", { "aria-hidden": !expandedView, class: {
363
417
  'user-copy': true,
364
- 'ml-8': true,
418
+ 'ml-8': !expandedView,
419
+ 'flex-1': expandedView,
365
420
  'user-copy--visible': expandedView,
366
421
  'user-copy--hidden': !expandedView,
367
422
  } }, h("span", { part: "user-name", class: "user-name truncate text-sm font-semibold text-text-primary" }, user.name), user.email && h("span", { part: "user-email", class: "user-email truncate text-xs text-text-secondary" }, user.email))));
@@ -375,7 +430,7 @@ export class SulaWorkbenchMenu {
375
430
  }
376
431
  renderCollapseButton() {
377
432
  const label = this.collapsed ? 'Expandir menu' : 'Recolher menu';
378
- return (h("button", { type: "button", class: "menu-toggle flex flex-none items-center justify-center", title: label, "aria-label": label, "aria-expanded": String(!this.collapsed), onClick: () => this.toggleMenu() }, h("sula-icon", { icon: `ph-bold ph-caret-${this.collapsed ? 'right' : 'left'}`, customClass: "text-lg" })));
433
+ return (h("button", { type: "button", class: "menu-toggle flex flex-none items-center justify-center", title: label, "aria-label": label, "aria-expanded": String(!this.collapsed), onClick: () => this.toggleMenu() }, h("sula-icon", { icon: "ph-bold ph-sidebar", customClass: "text-lg" })));
379
434
  }
380
435
  renderRootHeader(expandedView) {
381
436
  return (h("div", { class: {
@@ -391,7 +446,9 @@ export class SulaWorkbenchMenu {
391
446
  renderTrail(ancestors) {
392
447
  const hasHidden = ancestors.length > 2;
393
448
  const visible = hasHidden ? ancestors.slice(-2) : ancestors;
394
- const crumbs = [];
449
+ const crumbs = [
450
+ h("button", { key: "root", type: "button", class: "crumb-btn", title: `Ir para o início de ${this.menuTitle}`, onClick: () => this.goToDepth(-1) }, this.menuTitle || 'Início'),
451
+ ];
395
452
  if (hasHidden) {
396
453
  crumbs.push(h("button", { key: "ellipsis", type: "button", class: "crumb-btn crumb-btn--ellipsis", "aria-haspopup": "true", "aria-expanded": String(this.crumbMenu.open), title: `${ancestors.length - 2} nível(is) anterior(es)`, ref: el => (this.crumbEllipsisEl = el), onClick: event => this.toggleCrumbMenu(event) }, h("sula-icon", { icon: "ph-bold ph-dots-three", customClass: "text-base text-text-secondary" })));
397
454
  }
@@ -410,24 +467,27 @@ export class SulaWorkbenchMenu {
410
467
  if (!this.crumbMenu.open || ancestors.length <= 2)
411
468
  return null;
412
469
  const hidden = ancestors.slice(0, -2);
413
- return (h("div", { class: "crumb-dropdown", role: "menu", ref: el => (this.crumbDropdownEl = el), style: { left: `${this.crumbMenu.left}px`, top: `${this.crumbMenu.top}px` } }, hidden.map(ancestor => (h("button", { key: ancestor.id, type: "button", role: "menuitem", class: "crumb-dropdown-item", onClick: () => this.goToDepth(this.stack.indexOf(ancestor)) }, h("span", { class: "item-icon flex flex-none items-center justify-center" }, this.renderItemIcon(ancestor, 'text-sm text-icon-primary', 'sm')), h("span", { class: "truncate" }, ancestor.label))))));
470
+ return (h("div", { class: "crumb-dropdown", role: "menu", ref: el => (this.crumbDropdownEl = el), style: { left: `${this.crumbMenu.left}px`, top: `${this.crumbMenu.top}px` } }, hidden.map(ancestor => (h("button", { key: ancestor.id, type: "button", role: "menuitem", class: "crumb-dropdown-item", onClick: () => this.goToDepth(this.stack.indexOf(ancestor)) }, h("span", { class: "item-icon flex flex-none items-center justify-center" }, this.renderItemIcon(ancestor, 'text-sm text-icon-primary', 'sm')), h("span", { class: "min-w-0 truncate" }, ancestor.label))))));
414
471
  }
415
472
  renderDrillHeader(activeParent) {
416
473
  const ancestors = this.stack.slice(0, -1);
417
474
  const backLabel = ancestors.length ? ancestors[ancestors.length - 1].label : this.menuTitle || 'Início';
418
- const backButton = (h("button", { type: "button", class: "back-btn", title: `Voltar para ${backLabel}`, "aria-label": `Voltar para ${backLabel}`, onClick: () => this.goToDepth(this.stack.length - 2) }, h("sula-icon", { icon: "ph ph-arrow-left", customClass: "text-lg text-icon-primary" })));
419
- return (h("div", { class: "menu-header menu-header--drilldown mb-16 flex flex-col border-b border-line-general pb-24" }, h("div", { class: "identity-row flex items-center" }, h("button", { type: "button", class: "identity-strip", title: `Ir para o início de ${this.menuTitle}`, onClick: () => this.goToDepth(-1) }, this.image && (h("span", { class: "identity-image" }, h("img", { src: this.image, alt: "" }))), h("span", { class: "identity-label truncate" }, this.menuTitle)), this.renderCollapseButton()), ancestors.length > 0 && (h("div", { class: "breadcrumb-row" }, backButton, this.renderTrail(ancestors), this.renderCrumbDropdown(ancestors))), h("div", { class: { 'context-row flex items-center min-w-0': true, 'mt-8': ancestors.length > 0 } }, ancestors.length === 0 && backButton, this.hasIcon(activeParent) && (h("span", { class: "context-icon flex flex-none items-center justify-center" }, this.renderItemIcon(activeParent, 'text-xl text-brand-primary', 'md'))), h("h1", { part: "title", class: "context-title truncate text-xl font-semibold leading-tight text-text-primary" }, activeParent.label))));
475
+ const backButton = (h("button", { type: "button", class: "back-btn", title: `Voltar para ${backLabel}`, "aria-label": `Voltar para ${backLabel}`, onClick: () => this.goToDepth(this.stack.length - 2) }, h("sula-icon", { icon: "ph ph-arrow-left", customClass: "text-xl text-icon-primary" })));
476
+ return (h("div", { key: this.stack.map(item => item.id).join('/'), class: {
477
+ 'menu-header menu-header--drilldown flex flex-col': true,
478
+ 'menu-header--back': this.direction === 'back',
479
+ } }, h("div", { class: "drill-toolbar flex items-center justify-between" }, backButton, this.renderCollapseButton()), ancestors.length > 0 && (h("div", { class: "breadcrumb-row" }, this.renderTrail(ancestors), this.renderCrumbDropdown(ancestors))), h("div", { class: "context-row flex items-center min-w-0" }, this.hasIcon(activeParent) && (h("span", { class: "context-icon flex flex-none items-center justify-center" }, this.renderItemIcon(activeParent, 'text-xl text-brand-primary', 'md'))), h("h1", { part: "title", class: "context-title text-text-primary", title: activeParent.label }, activeParent.label))));
420
480
  }
421
- renderDrillRow(item, reserve) {
481
+ renderDrillRow(item, reserve, index) {
422
482
  const branch = this.hasVisibleChildren(item);
423
483
  const active = this.isActive(item, branch);
424
484
  const faded = this.isFaded(item, active);
425
- return (h("li", { class: "list-none", key: item.id }, h("div", { class: {
426
- 'menu-item flex items-center justify-between rounded-xs px-8': true,
427
- 'cursor-pointer hover:bg-box-shadow-body': !item.disabled && !active,
485
+ return (h("li", { class: "list-none", key: item.id, style: { '--row-index': String(Math.min(index, 8)) } }, h("div", { class: {
486
+ 'menu-item flex items-center justify-between rounded-md px-8': true,
487
+ 'cursor-pointer hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed': !item.disabled && !active,
428
488
  'cursor-pointer': !item.disabled && active,
429
489
  'cursor-not-allowed': !!item.disabled,
430
- }, "aria-disabled": !!item.disabled, onClick: () => this.handleRowClick(item, this.stack.length + 1) }, h("span", { class: "flex min-w-0 flex-1 items-center gap-8" }, this.renderIconSlot(item, this.getIconClass(active, faded, 'text-base'), faded, reserve), h("span", { part: "item-label", class: {
490
+ }, "aria-disabled": !!item.disabled, onClick: () => this.handleRowClick(item) }, h("span", { class: "flex min-w-0 flex-1 items-center gap-8" }, this.renderIconSlot(item, this.getIconClass(active, faded, 'text-base'), faded, reserve), h("span", { part: "item-label", class: {
431
491
  'menu-item-label truncate': this.labelOverflow !== SulaMenuLabelOverflow.Wrap,
432
492
  'menu-item-label menu-item-label--wrap': this.labelOverflow === SulaMenuLabelOverflow.Wrap,
433
493
  'font-bold text-text-primary': active,
@@ -435,6 +495,11 @@ export class SulaWorkbenchMenu {
435
495
  'text-text-secondary': !active && !faded,
436
496
  } }, item.label)), branch && h("sula-icon", { icon: "ph ph-caret-right", customClass: faded ? 'text-text-disabled text-xs' : 'text-text-secondary text-xs' }))));
437
497
  }
498
+ // Strips on the left edge suggest the levels already navigated; the prototype shows at most two.
499
+ renderDrillLayers() {
500
+ const count = Math.min(this.stack.length, 2);
501
+ return (h("div", { class: "drill-layers", "aria-hidden": "true" }, Array.from({ length: count }, (_, index) => (h("span", { key: index, class: "drill-layer", style: { width: `${12 * (index + 1)}px`, zIndex: String(count - index) } })))));
502
+ }
438
503
  renderDrillPanel() {
439
504
  const activeParent = this.stack[this.stack.length - 1];
440
505
  const panelKey = this.stack.map(item => item.id).join('/');
@@ -442,7 +507,7 @@ export class SulaWorkbenchMenu {
442
507
  'menu-panel flex flex-col': true,
443
508
  'menu-panel--forward': this.direction === 'forward',
444
509
  'menu-panel--back': this.direction === 'back',
445
- } }, this.getVisibleItems(activeParent.children).map(item => this.renderDrillRow(item, this.siblingsHaveIcon(activeParent.children)))));
510
+ } }, this.getVisibleItems(activeParent.children).map((item, index) => this.renderDrillRow(item, this.siblingsHaveIcon(activeParent.children), index))));
446
511
  }
447
512
  getMainIconClass(active, faded) {
448
513
  if (faded)
@@ -476,15 +541,15 @@ export class SulaWorkbenchMenu {
476
541
  return null;
477
542
  return h("span", { class: "item-icon flex flex-none items-center justify-center" }, this.renderItemIcon(item, customClass, 'lg', faded));
478
543
  }
479
- renderMainRow(item, expandedView, branch, expanded, active, faded, reserve) {
544
+ renderMainRow(item, expandedView, branch, expanded, active, faded, drill, reserve) {
480
545
  const labelOverflowTruncate = this.labelOverflow === SulaMenuLabelOverflow.Truncate;
481
546
  return (h("div", { class: {
482
- 'menu-item flex items-center rounded-xs px-8': true,
483
- 'cursor-pointer hover:bg-box-shadow-body': !item.disabled,
547
+ 'menu-item flex items-center rounded-md px-8': true,
548
+ 'cursor-pointer hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed': !item.disabled,
484
549
  'cursor-not-allowed': !!item.disabled,
485
550
  'justify-between': expandedView,
486
551
  'justify-center': !expandedView,
487
- }, title: !expandedView ? item.label : undefined, "aria-disabled": !!item.disabled, onClick: () => this.handleRowClick(item, 1) }, h("div", { class: { 'flex items-center': true, 'flex-1 min-w-0 gap-8': expandedView, 'justify-center': !expandedView } }, this.renderIconSlot(item, this.getMainIconClass(active, faded), faded, reserve), h("span", { part: "main-item-label", title: expandedView ? item.label : undefined, "aria-hidden": !expandedView, class: {
552
+ }, title: !expandedView ? item.label : undefined, "aria-disabled": !!item.disabled, onClick: () => this.handleRowClick(item) }, h("div", { class: { 'flex items-center': true, 'flex-1 min-w-0 gap-8': expandedView, 'justify-center': !expandedView } }, this.renderIconSlot(item, this.getMainIconClass(active, faded), faded, reserve), h("span", { part: "main-item-label", title: expandedView ? item.label : undefined, "aria-hidden": !expandedView, class: {
488
553
  'menu-item-label menu-copy': true,
489
554
  'menu-item-label--truncate': labelOverflowTruncate,
490
555
  'menu-item-label--wrap': !labelOverflowTruncate,
@@ -498,15 +563,15 @@ export class SulaWorkbenchMenu {
498
563
  'menu-item-caret--expanded': expanded,
499
564
  'menu-item-caret--visible': expandedView,
500
565
  'menu-item-caret--hidden': !expandedView,
501
- }, icon: "ph ph-caret-down", customClass: this.getMainCaretClass(active, faded) }))));
566
+ }, icon: drill ? 'ph ph-caret-right' : 'ph ph-caret-down', customClass: this.getMainCaretClass(active, faded) }))));
502
567
  }
503
568
  renderSubRow(item, expandedView, branch, expanded, active, faded, drill, reserve) {
504
569
  const caretIcon = drill ? 'ph-bold ph-caret-right' : `ph-bold ph-caret-${expanded && expandedView ? 'up' : 'down'}`;
505
- const onClick = () => this.handleRowClick(item, this.depthOf(item));
570
+ const onClick = () => this.handleRowClick(item);
506
571
  const rowClass = {
507
- 'submenu-item flex min-w-0 items-center rounded-xs py-8 pr-8 select-none': true,
572
+ 'submenu-item flex min-w-0 items-center rounded-md py-8 pr-8 select-none': true,
508
573
  'submenu-item--branch w-full': branch,
509
- 'cursor-pointer hover:bg-box-shadow-body': !item.disabled,
574
+ 'cursor-pointer hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed': !item.disabled,
510
575
  'cursor-not-allowed': !!item.disabled,
511
576
  'font-bold': active && branch,
512
577
  };
@@ -520,31 +585,27 @@ export class SulaWorkbenchMenu {
520
585
  'font-bold': active,
521
586
  } }, item.label));
522
587
  if (!branch) {
523
- return (h("a", { class: rowClass, style: { paddingLeft: '16px' }, title: item.label, "aria-disabled": !!item.disabled, onClick: onClick }, this.renderIconSlot(item, this.getSubIconClass(faded, active && !branch), faded, reserve), label));
588
+ return (h("a", { class: rowClass, style: { paddingLeft: '8px' }, title: item.label, "aria-disabled": !!item.disabled, onClick: onClick }, this.renderIconSlot(item, this.getSubIconClass(faded, active && !branch), faded, reserve), label));
524
589
  }
525
- return (h("a", { class: rowClass, style: { paddingLeft: '16px' }, title: item.label, "aria-disabled": !!item.disabled, onClick: onClick }, h("div", { class: "submenu-item-branch-content flex min-w-0 flex-1 items-center" }, this.renderIconSlot(item, this.getSubIconClass(faded, active && !branch), faded, reserve), label), h("div", { class: "submenu-item-branch-caret flex flex-none items-center justify-end pl-8" }, h("sula-icon", { icon: caretIcon, customClass: this.getSubCaretClass(faded) }))));
526
- }
527
- depthOf(item) {
528
- const path = this.findPath(this.items, item.id);
529
- return path ? path.length : 1;
590
+ return (h("a", { class: rowClass, style: { paddingLeft: '8px' }, title: item.label, "aria-disabled": !!item.disabled, onClick: onClick }, h("div", { class: "submenu-item-branch-content flex min-w-0 flex-1 items-center" }, this.renderIconSlot(item, this.getSubIconClass(faded, active && !branch), faded, reserve), label), h("div", { class: "submenu-item-branch-caret flex flex-none items-center justify-end pl-8" }, h("sula-icon", { icon: caretIcon, customClass: this.getSubCaretClass(faded) }))));
530
591
  }
531
592
  renderInlineList(items, depth, expandedView) {
532
593
  const reserve = this.siblingsHaveIcon(items);
533
594
  return this.getVisibleItems(items).map(item => {
534
595
  const branch = this.hasVisibleChildren(item);
535
- const drill = branch && depth >= this.drilldownLevel;
596
+ const drill = branch && this.drillMode;
536
597
  const inline = branch && !drill;
537
598
  const expanded = inline && !!item.expanded;
538
599
  const active = this.isActive(item, branch) || expanded;
539
600
  const faded = this.isFaded(item, active);
540
601
  const row = depth === 1
541
- ? this.renderMainRow(item, expandedView, branch, expanded, active, faded, reserve)
602
+ ? this.renderMainRow(item, expandedView, branch, expanded, active, faded, drill, reserve)
542
603
  : this.renderSubRow(item, expandedView, branch, expanded, active, faded, drill, reserve);
543
604
  return (h("li", { class: { 'decoration-none list-none': true, 'menu-group': depth === 1, 'is-selected': depth > 1 && active && !branch }, key: item.id }, row, inline && (h("ul", { "aria-hidden": !expandedView || !expanded, class: {
544
605
  submenu: true,
545
606
  'submenu--expanded': expandedView && expanded,
546
- 'ml-[8px] border-l border-line-general': depth === 1,
547
- 'submenu-branch ml-[24px] border-l border-line-general': depth > 1,
607
+ 'ml-[8px] border-l border-line-general pl-12': depth === 1,
608
+ 'submenu-branch ml-[20px]': depth > 1,
548
609
  } }, this.renderInlineList(item.children, depth + 1, expandedView)))));
549
610
  });
550
611
  }
@@ -552,20 +613,21 @@ export class SulaWorkbenchMenu {
552
613
  const expandedView = !this.collapsed || this.previewExpanded;
553
614
  const drilled = expandedView && this.isDrilled();
554
615
  const activeParent = this.stack[this.stack.length - 1];
555
- return (h(Host, { key: 'fa3316250db59fc3a5efcc4955fe8f3d16bd6124', class: {
616
+ return (h(Host, { key: 'bcfe0dcba1c108dd509ddbc03587a48187634886', class: {
556
617
  'menu-host--collapsed': this.collapsed,
557
618
  'menu-host--preview': this.collapsed && this.previewExpanded,
558
619
  'menu-host--density-compact': this.density === SulaMenuDensity.Compact,
559
620
  'menu-host--density-comfortable': this.density === SulaMenuDensity.Comfortable,
560
- }, style: this.hostStyleVariables, onMouseEnter: () => this.handleMenuMouseEnter(), onMouseLeave: () => this.handleMenuMouseLeave() }, h("aside", { key: '250446792bed12a5811a513bcf2d437b99d5dfb0', part: "shell", ref: el => (this.shellEl = el), class: {
621
+ }, style: this.hostStyleVariables, onMouseEnter: () => this.handleMenuMouseEnter(), onMouseLeave: () => this.handleMenuMouseLeave() }, h("aside", { key: '1fd3ab998fff6a0bac168956b7e60efd37cb1889', part: "shell", ref: el => (this.shellEl = el), class: {
561
622
  'menu-shell flex h-full flex-col bg-surface-body shadow-md z-50': true,
562
623
  'menu-shell--collapsed': this.collapsed && !this.previewExpanded,
563
624
  'menu-shell--expanded': expandedView,
564
625
  'menu-shell--preview': this.collapsed && this.previewExpanded,
565
- } }, drilled ? this.renderDrillHeader(activeParent) : this.renderRootHeader(expandedView), h("nav", { key: 'e9a5cf34e8bed42747ae8a44b891440d6effd708', class: {
626
+ 'menu-shell--drilled': drilled,
627
+ } }, drilled && this.renderDrillLayers(), drilled ? this.renderDrillHeader(activeParent) : this.renderRootHeader(expandedView), h("nav", { key: '40063d935bf797fde0378a37da3594ebeca1d3ff', class: {
566
628
  'menu-nav flex h-full flex-col overflow-y-auto overflow-x-hidden': true,
567
629
  'px-12': !expandedView,
568
- } }, drilled ? (this.renderDrillPanel()) : (h("ul", { class: "flex flex-col" }, this.renderInlineList(this.items, 1, expandedView)))), this.user && (h("div", { key: 'c0797a8bb709541aa54aa6d41b9da91b3a319f30', class: "menu-footer border-t border-line-general pt-12" }, this.renderUserInfo(expandedView)))), this.user && this.renderProfilePopover(expandedView)));
630
+ } }, drilled ? (this.renderDrillPanel()) : (h("ul", { class: "flex flex-col" }, this.renderInlineList(this.items, 1, expandedView)))), this.user && (h("div", { key: 'ce167e4897f3b43ee167fcec275e81abdc20b697', class: "menu-footer pt-12" }, this.renderUserInfo(expandedView)))), this.user && h("span", { key: 'fa2b56c1c22499896404466de15ad32aa7915f93', class: "profile-origin", "aria-hidden": "true", ref: el => (this.profileOriginEl = el) }), this.user && this.renderProfilePopover(expandedView)));
569
631
  }
570
632
  static get is() { return "sula-workbench-menu"; }
571
633
  static get encapsulation() { return "shadow"; }
@@ -693,25 +755,23 @@ export class SulaWorkbenchMenu {
693
755
  "reflect": false,
694
756
  "defaultValue": "SulaMenuLabelOverflow.Wrap"
695
757
  },
696
- "drilldownLevel": {
697
- "type": "number",
698
- "attribute": "drilldown-level",
758
+ "drillPath": {
759
+ "type": "unknown",
760
+ "attribute": "drill-path",
699
761
  "mutable": false,
700
762
  "complexType": {
701
- "original": "number",
702
- "resolved": "number",
763
+ "original": "string[]",
764
+ "resolved": "string[]",
703
765
  "references": {}
704
766
  },
705
767
  "required": false,
706
- "optional": false,
768
+ "optional": true,
707
769
  "docs": {
708
770
  "tags": [],
709
- "text": "Depth (1-based) from which items with children open a drill-down panel instead of expanding in place.\nWith the default of 3, the first two levels expand inline and deeper branches drill down."
771
+ "text": "Controls the navigation from the host: ids from the root to the item whose children are shown.\nIn drill-down mode an empty array goes back to the root; in inline mode the items on the path are expanded.\nLeave it undefined to let only user clicks navigate."
710
772
  },
711
773
  "getter": false,
712
- "setter": false,
713
- "reflect": false,
714
- "defaultValue": "3"
774
+ "setter": false
715
775
  },
716
776
  "items": {
717
777
  "type": "unknown",
@@ -813,6 +873,7 @@ export class SulaWorkbenchMenu {
813
873
  return {
814
874
  "collapsed": {},
815
875
  "previewExpanded": {},
876
+ "drillMode": {},
816
877
  "stack": {},
817
878
  "direction": {},
818
879
  "selectedPath": {},
@@ -850,7 +911,7 @@ export class SulaWorkbenchMenu {
850
911
  "composed": true,
851
912
  "docs": {
852
913
  "tags": [],
853
- "text": "Emitted when any item is clicked"
914
+ "text": "Emitted when any item is clickede"
854
915
  },
855
916
  "complexType": {
856
917
  "original": "SulaWorkbenchMenuItem",
@@ -969,6 +1030,9 @@ export class SulaWorkbenchMenu {
969
1030
  return [{
970
1031
  "propName": "items",
971
1032
  "methodName": "syncWithItems"
1033
+ }, {
1034
+ "propName": "drillPath",
1035
+ "methodName": "syncDrillPath"
972
1036
  }];
973
1037
  }
974
1038
  static get listeners() {