@mintplayer/web-components 1.0.0 → 1.1.0

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 (236) hide show
  1. package/a11y/index.mjs +2 -56
  2. package/calendar/index.mjs +2 -363
  3. package/checkbox/index.mjs +4 -0
  4. package/checkbox/src/components/index.d.ts +2 -0
  5. package/checkbox/src/components/mp-checkbox.d.ts +69 -0
  6. package/checkbox/src/index.d.ts +2 -0
  7. package/chunks/color-C4VT0EL7.mjs +847 -0
  8. package/chunks/form-check.styles-jBlHetYX.mjs +151 -0
  9. package/chunks/live-announcer-CZDTKulf.mjs +58 -0
  10. package/chunks/mp-calendar.element-UC68iDbi.mjs +365 -0
  11. package/chunks/mp-checkbox-BokLL7BS.mjs +211 -0
  12. package/chunks/mp-datatable-CpAu8JJD.mjs +750 -0
  13. package/chunks/mp-pagination-BGxsawFL.mjs +326 -0
  14. package/chunks/mp-select-BDS1-YGn.mjs +254 -0
  15. package/chunks/mp-splitter-C8cGCmac.mjs +633 -0
  16. package/chunks/mp-tab-page-D1b4x-y2.mjs +414 -0
  17. package/chunks/mp-timepicker.element-BwEiwX92.mjs +428 -0
  18. package/chunks/mp-toggle-button-dLZNDUVz.mjs +534 -0
  19. package/chunks/mp-treeview-Bfq4_IVW.mjs +474 -0
  20. package/code-snippet/index.mjs +16 -13
  21. package/datatable/index.mjs +7 -0
  22. package/datatable/src/components/index.d.ts +2 -0
  23. package/datatable/src/components/mp-datatable.d.ts +156 -0
  24. package/datatable/src/index.d.ts +6 -0
  25. package/datatable/src/sort/compute-next-sort.d.ts +18 -0
  26. package/datatable/src/sort/index.d.ts +3 -0
  27. package/datatable/src/sort/sort-rows.d.ts +6 -0
  28. package/datatable/src/styles/datatable.styles.d.ts +2 -0
  29. package/datatable/src/styles/index.d.ts +1 -0
  30. package/datatable/src/types/column-def.d.ts +30 -0
  31. package/datatable/src/types/index.d.ts +1 -0
  32. package/datepicker/index.mjs +240 -0
  33. package/datepicker/src/index.d.ts +1 -0
  34. package/datepicker/src/mp-datepicker.element.d.ts +94 -0
  35. package/datepicker/src/mp-datepicker.element.template.d.ts +2 -0
  36. package/datetime-picker/index.mjs +427 -0
  37. package/datetime-picker/src/index.d.ts +1 -0
  38. package/datetime-picker/src/mp-datetime-picker.element.d.ts +174 -0
  39. package/datetime-picker/src/mp-datetime-picker.element.template.d.ts +2 -0
  40. package/dock/index.mjs +2402 -0
  41. package/dock/src/components/index.d.ts +1 -0
  42. package/dock/src/components/mint-dock-manager.element.d.ts +313 -0
  43. package/dock/src/components/mint-dock-manager.element.template.d.ts +2 -0
  44. package/dock/src/index.d.ts +2 -0
  45. package/dock/src/types/dock-layout.d.ts +65 -0
  46. package/dock/src/types/index.d.ts +1 -0
  47. package/file-manager/index.mjs +1263 -0
  48. package/file-manager/src/components/index.d.ts +2 -0
  49. package/file-manager/src/components/mp-file-manager.d.ts +320 -0
  50. package/file-manager/src/index.d.ts +5 -0
  51. package/file-manager/src/styles/file-manager.styles.d.ts +2 -0
  52. package/file-manager/src/styles/index.d.ts +1 -0
  53. package/file-manager/src/types/file-system-node.d.ts +24 -0
  54. package/file-manager/src/types/index.d.ts +3 -0
  55. package/file-manager/src/types/messages.d.ts +43 -0
  56. package/multi-range/index.mjs +407 -0
  57. package/multi-range/src/index.d.ts +2 -0
  58. package/multi-range/src/mint-multi-range.element.d.ts +124 -0
  59. package/multi-range/src/mint-multi-range.element.template.d.ts +2 -0
  60. package/multi-range/src/types/multi-range-orientation.d.ts +1 -0
  61. package/otp-input/index.mjs +362 -0
  62. package/otp-input/src/index.d.ts +4 -0
  63. package/otp-input/src/mint-otp-input.element.d.ts +134 -0
  64. package/otp-input/src/mint-otp-input.element.template.d.ts +2 -0
  65. package/otp-input/src/types/otp-input-case.d.ts +1 -0
  66. package/otp-input/src/types/otp-input-size.d.ts +1 -0
  67. package/otp-input/src/types/otp-input-type.d.ts +1 -0
  68. package/overlay/index.mjs +260 -0
  69. package/overlay/src/index.d.ts +2 -0
  70. package/overlay/src/overlay-controller.d.ts +205 -0
  71. package/package.json +1 -1
  72. package/pagination/index.mjs +5 -0
  73. package/pagination/src/components/index.d.ts +2 -0
  74. package/pagination/src/components/mp-pagination.d.ts +95 -0
  75. package/pagination/src/index.d.ts +2 -0
  76. package/pagination/src/styles/index.d.ts +1 -0
  77. package/pagination/src/styles/pagination.styles.d.ts +2 -0
  78. package/query-builder/index.mjs +3720 -0
  79. package/query-builder/src/context.d.ts +14 -0
  80. package/query-builder/src/dnd/drag-controller.d.ts +69 -0
  81. package/query-builder/src/index.d.ts +23 -0
  82. package/query-builder/src/model/default-tree.d.ts +7 -0
  83. package/query-builder/src/model/editor.d.ts +15 -0
  84. package/query-builder/src/model/errors.d.ts +6 -0
  85. package/query-builder/src/model/expression.d.ts +22 -0
  86. package/query-builder/src/model/field-def.d.ts +17 -0
  87. package/query-builder/src/model/messages.d.ts +17 -0
  88. package/query-builder/src/model/operator-overrides.d.ts +21 -0
  89. package/query-builder/src/model/operators.d.ts +8 -0
  90. package/query-builder/src/model/saved-query.d.ts +6 -0
  91. package/query-builder/src/model/sort.d.ts +9 -0
  92. package/query-builder/src/model/tree-ops.d.ts +56 -0
  93. package/query-builder/src/mp-query-builder.element.d.ts +158 -0
  94. package/query-builder/src/mp-query-builder.element.template.d.ts +2 -0
  95. package/query-builder/src/mp-query-condition.element.d.ts +44 -0
  96. package/query-builder/src/mp-query-condition.element.template.d.ts +2 -0
  97. package/query-builder/src/mp-query-group.element.d.ts +52 -0
  98. package/query-builder/src/mp-query-group.element.template.d.ts +2 -0
  99. package/query-builder/src/mp-query-subquery.element.d.ts +37 -0
  100. package/query-builder/src/mp-query-subquery.element.template.d.ts +2 -0
  101. package/query-builder/src/preview/render-expression.d.ts +23 -0
  102. package/query-builder/src/value-editors/builtin-editors.d.ts +6 -0
  103. package/query-builder/src/visitor/visit-tree.d.ts +29 -0
  104. package/query-builder/src/visitor/visitor-types.d.ts +15 -0
  105. package/radio/index.mjs +162 -0
  106. package/radio/src/components/index.d.ts +2 -0
  107. package/radio/src/components/mp-radio.d.ts +63 -0
  108. package/radio/src/index.d.ts +2 -0
  109. package/ribbon/index.mjs +3151 -0
  110. package/ribbon/src/index.d.ts +10 -0
  111. package/ribbon/src/items/index.d.ts +15 -0
  112. package/ribbon/src/items/mp-ribbon-button.element.d.ts +10 -0
  113. package/ribbon/src/items/mp-ribbon-checkbox.element.d.ts +11 -0
  114. package/ribbon/src/items/mp-ribbon-color-picker.element.d.ts +12 -0
  115. package/ribbon/src/items/mp-ribbon-combobox.element.d.ts +19 -0
  116. package/ribbon/src/items/mp-ribbon-dropdown-button.element.d.ts +16 -0
  117. package/ribbon/src/items/mp-ribbon-gallery-item.element.d.ts +15 -0
  118. package/ribbon/src/items/mp-ribbon-gallery.element.d.ts +11 -0
  119. package/ribbon/src/items/mp-ribbon-group-button.element.d.ts +18 -0
  120. package/ribbon/src/items/mp-ribbon-item-base.d.ts +68 -0
  121. package/ribbon/src/items/mp-ribbon-menu-item.element.d.ts +13 -0
  122. package/ribbon/src/items/mp-ribbon-menu-separator.element.d.ts +6 -0
  123. package/ribbon/src/items/mp-ribbon-split-button.element.d.ts +23 -0
  124. package/ribbon/src/items/mp-ribbon-template-item.element.d.ts +12 -0
  125. package/ribbon/src/items/mp-ribbon-toggle-button.element.d.ts +12 -0
  126. package/ribbon/src/mp-quick-access-toolbar.element.d.ts +35 -0
  127. package/ribbon/src/mp-ribbon-contextual-tab-set.element.d.ts +18 -0
  128. package/ribbon/src/mp-ribbon-group.element.d.ts +59 -0
  129. package/ribbon/src/mp-ribbon-tab.element.d.ts +72 -0
  130. package/ribbon/src/mp-ribbon.element.d.ts +211 -0
  131. package/ribbon/src/types/ribbon.types.d.ts +4 -0
  132. package/scheduler/index.mjs +3567 -0
  133. package/scheduler/src/components/mp-scheduler.d.ts +238 -0
  134. package/scheduler/src/drag/drag-manager.d.ts +90 -0
  135. package/scheduler/src/drag/drag-preview.d.ts +42 -0
  136. package/scheduler/src/drag/drag-state-machine.d.ts +102 -0
  137. package/scheduler/src/drag/drag-types.d.ts +104 -0
  138. package/scheduler/src/drag/index.d.ts +4 -0
  139. package/scheduler/src/events/event-types.d.ts +58 -0
  140. package/scheduler/src/events/index.d.ts +2 -0
  141. package/scheduler/src/events/scheduler-event-emitter.d.ts +52 -0
  142. package/scheduler/src/index.d.ts +6 -0
  143. package/scheduler/src/input/index.d.ts +2 -0
  144. package/scheduler/src/input/input-handler.d.ts +105 -0
  145. package/scheduler/src/input/pointer-event.d.ts +39 -0
  146. package/scheduler/src/state/scheduler-state.d.ts +189 -0
  147. package/scheduler/src/styles/scheduler.styles.d.ts +2 -0
  148. package/scheduler/src/views/base-view.d.ts +87 -0
  149. package/scheduler/src/views/day-view.d.ts +25 -0
  150. package/scheduler/src/views/index.d.ts +6 -0
  151. package/scheduler/src/views/month-view.d.ts +27 -0
  152. package/scheduler/src/views/timeline-view.d.ts +23 -0
  153. package/scheduler/src/views/week-view.d.ts +28 -0
  154. package/scheduler/src/views/year-view.d.ts +25 -0
  155. package/scheduler-core/index.mjs +174 -0
  156. package/scheduler-core/src/index.d.ts +3 -0
  157. package/scheduler-core/src/models/drag-state.d.ts +43 -0
  158. package/scheduler-core/src/models/event.d.ts +111 -0
  159. package/scheduler-core/src/models/events.d.ts +108 -0
  160. package/scheduler-core/src/models/index.d.ts +7 -0
  161. package/scheduler-core/src/models/options.d.ts +88 -0
  162. package/scheduler-core/src/models/resource.d.ts +58 -0
  163. package/scheduler-core/src/models/time-slot.d.ts +31 -0
  164. package/scheduler-core/src/models/types.d.ts +20 -0
  165. package/scheduler-core/src/services/date.service.d.ts +140 -0
  166. package/scheduler-core/src/services/index.d.ts +4 -0
  167. package/scheduler-core/src/services/position.service.d.ts +35 -0
  168. package/scheduler-core/src/services/resource.service.d.ts +83 -0
  169. package/scheduler-core/src/services/timeline.service.d.ts +103 -0
  170. package/scheduler-core/src/utils/color.d.ts +24 -0
  171. package/scheduler-core/src/utils/dom.d.ts +54 -0
  172. package/scheduler-core/src/utils/id.d.ts +16 -0
  173. package/scheduler-core/src/utils/index.d.ts +3 -0
  174. package/select/index.mjs +4 -0
  175. package/select/src/components/index.d.ts +2 -0
  176. package/select/src/components/mp-select.d.ts +82 -0
  177. package/select/src/index.d.ts +2 -0
  178. package/splitter/index.mjs +10 -0
  179. package/splitter/src/components/index.d.ts +2 -0
  180. package/splitter/src/components/mp-splitter.d.ts +109 -0
  181. package/splitter/src/index.d.ts +11 -0
  182. package/splitter/src/input/index.d.ts +4 -0
  183. package/splitter/src/input/input-handler.d.ts +36 -0
  184. package/splitter/src/input/pointer-event.d.ts +9 -0
  185. package/splitter/src/managers/index.d.ts +2 -0
  186. package/splitter/src/managers/resize-manager.d.ts +13 -0
  187. package/splitter/src/state/index.d.ts +2 -0
  188. package/splitter/src/state/splitter-state.d.ts +24 -0
  189. package/splitter/src/styles/index.d.ts +1 -0
  190. package/splitter/src/styles/splitter.styles.d.ts +2 -0
  191. package/splitter/src/types/direction.d.ts +1 -0
  192. package/splitter/src/types/index.d.ts +5 -0
  193. package/splitter/src/types/panel-info.d.ts +6 -0
  194. package/splitter/src/types/point.d.ts +4 -0
  195. package/splitter/src/types/resize-operation.d.ts +13 -0
  196. package/tab-control/index.mjs +6 -0
  197. package/tab-control/src/components/index.d.ts +3 -0
  198. package/tab-control/src/components/mp-tab-control.d.ts +50 -0
  199. package/tab-control/src/components/mp-tab-page.d.ts +35 -0
  200. package/tab-control/src/index.d.ts +4 -0
  201. package/tab-control/src/styles/index.d.ts +1 -0
  202. package/tab-control/src/styles/tab-control.styles.d.ts +2 -0
  203. package/tab-control/src/types/index.d.ts +1 -0
  204. package/tab-control/src/types/tabs-position.d.ts +1 -0
  205. package/tile-manager/index.mjs +867 -0
  206. package/tile-manager/src/components/index.d.ts +2 -0
  207. package/tile-manager/src/components/mint-tile-manager.element.d.ts +204 -0
  208. package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +2 -0
  209. package/tile-manager/src/index.d.ts +4 -0
  210. package/tile-manager/src/types/grid-rect.d.ts +12 -0
  211. package/tile-manager/src/types/index.d.ts +3 -0
  212. package/tile-manager/src/types/tile-layout-snapshot.d.ts +15 -0
  213. package/tile-manager/src/types/tile-position.d.ts +10 -0
  214. package/tile-manager/src/utils/index.d.ts +1 -0
  215. package/tile-manager/src/utils/pack.d.ts +24 -0
  216. package/timepicker/index.mjs +5 -0
  217. package/timepicker/src/index.d.ts +2 -0
  218. package/timepicker/src/mp-time-list.element.d.ts +76 -0
  219. package/timepicker/src/mp-time-list.element.template.d.ts +2 -0
  220. package/timepicker/src/mp-timepicker.element.d.ts +87 -0
  221. package/timepicker/src/mp-timepicker.element.template.d.ts +2 -0
  222. package/toggle-button/index.mjs +5 -0
  223. package/toggle-button/src/components/index.d.ts +2 -0
  224. package/toggle-button/src/components/mp-toggle-button.d.ts +50 -0
  225. package/toggle-button/src/index.d.ts +3 -0
  226. package/toggle-button/src/styles/index.d.ts +1 -0
  227. package/toggle-button/src/styles/toggle-button.styles.d.ts +2 -0
  228. package/treeview/index.mjs +5 -0
  229. package/treeview/src/components/index.d.ts +2 -0
  230. package/treeview/src/components/mp-treeview.d.ts +113 -0
  231. package/treeview/src/index.d.ts +4 -0
  232. package/treeview/src/styles/index.d.ts +1 -0
  233. package/treeview/src/styles/treeview.styles.d.ts +2 -0
  234. package/treeview/src/types/index.d.ts +1 -0
  235. package/treeview/src/types/tree-node.d.ts +14 -0
  236. package/custom-elements.json +0 -1774
@@ -0,0 +1,3151 @@
1
+ import { LitElement as w, css as g, nothing as B, html as d } from "lit";
2
+ import { property as l, state as _, query as S } from "lit/decorators.js";
3
+ import { L as se } from "../chunks/live-announcer-CZDTKulf.mjs";
4
+ import { OverlayController as G } from "../overlay/index.mjs";
5
+ var be = Object.defineProperty, F = (s, e, o, r) => {
6
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
7
+ (n = s[i]) && (t = n(e, o, t) || t);
8
+ return t && be(e, o, t), t;
9
+ };
10
+ class k extends w {
11
+ constructor() {
12
+ super(), this.activeTabId = "", this.tabsList = [], this.contextualSets = [], this.contentSlot = null, this.layout = "classic", this.minimized = !1, this.version = "office-2016", this.colorScheme = "auto", this.touchMode = "auto", this.keyTips = "on", this.keyTipMode = "off", this.keyTipBadges = [], this.currentTabIndex = 0, this.reflowFrame = 0, this.naturalWidths = /* @__PURE__ */ new WeakMap(), this.liveAnnouncer = new se(this), this.collapsedGroupLabels = /* @__PURE__ */ new WeakMap(), this.previousCollapsedGroups = /* @__PURE__ */ new Set(), this.contextualSetHiddenState = /* @__PURE__ */ new Map(), this.appliedReduceSteps = /* @__PURE__ */ new WeakMap(), this.originalItemSizes = /* @__PURE__ */ new WeakMap(), this.altPressed = !1, this.altUsedForCombo = !1, this.onKeyTipKeyDown = (e) => {
13
+ if (this.keyTips === "on") {
14
+ if (e.key === "Alt" && !e.repeat) {
15
+ this.altPressed = !0, this.altUsedForCombo = !1;
16
+ return;
17
+ }
18
+ if (e.altKey && e.key !== "Alt") {
19
+ this.altUsedForCombo = !0;
20
+ return;
21
+ }
22
+ if (this.keyTipMode !== "off") {
23
+ if (e.key === "Escape") {
24
+ e.preventDefault(), this.keyTipMode === "items" ? this.openKeyTipsTabsLevel() : this.closeKeyTips();
25
+ return;
26
+ }
27
+ if (e.key.length === 1) {
28
+ const o = e.key.toUpperCase(), r = this.keyTipBadges.find((t) => t.tip === o);
29
+ if (!r) return;
30
+ if (e.preventDefault(), this.keyTipMode === "tabs") {
31
+ const t = r.target.getAttribute("data-tab-id");
32
+ t && this.selectTab(t), this.openKeyTipsItemsLevel();
33
+ } else
34
+ this.activateKeyTipTarget(r.target), this.closeKeyTips();
35
+ }
36
+ }
37
+ }
38
+ }, this.onKeyTipKeyUp = (e) => {
39
+ if (this.keyTips === "on" && e.key === "Alt") {
40
+ if (this.altPressed = !1, this.altUsedForCombo) {
41
+ this.altUsedForCombo = !1;
42
+ return;
43
+ }
44
+ e.preventDefault(), this.keyTipMode !== "off" ? this.closeKeyTips() : this.openKeyTipsTabsLevel();
45
+ }
46
+ }, this.onHostKeyDown = (e) => {
47
+ if (e.ctrlKey && e.key === "F1") {
48
+ e.preventDefault(), this.toggleMinimizedFromUser();
49
+ return;
50
+ }
51
+ if (e.ctrlKey && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
52
+ const o = e.composedPath();
53
+ if (o.some((t) => t instanceof HTMLElement && t.getAttribute("role") === "tab"))
54
+ return;
55
+ const r = o.find(
56
+ (t) => t instanceof HTMLElement && t.tagName === "MP-RIBBON-GROUP"
57
+ );
58
+ if (r) {
59
+ const i = !(getComputedStyle(this).direction === "rtl"), n = e.key === "ArrowRight" === i ? 1 : -1;
60
+ this.moveFocusBetweenGroups(r, n) && e.preventDefault();
61
+ }
62
+ }
63
+ }, this.onContextualVisibilityChange = (e) => {
64
+ const o = e.detail;
65
+ if (o?.label) {
66
+ const r = this.contextualSetHiddenState.get(o.label);
67
+ r !== void 0 && r !== o.hidden && this.liveAnnouncer.announce(
68
+ o.hidden ? `${o.label}, contextual, hidden` : `${o.label}, contextual, now available`
69
+ ), this.contextualSetHiddenState.set(o.label, o.hidden);
70
+ }
71
+ this.contentSlot && this.processSlot(this.contentSlot);
72
+ }, this.onSlotChange = (e) => {
73
+ const o = e.target;
74
+ this.contentSlot = o, this.processSlot(o);
75
+ }, this.onTabListKeydown = (e) => {
76
+ const { key: o } = e;
77
+ let r = !1;
78
+ const t = getComputedStyle(this).direction === "rtl";
79
+ switch (o) {
80
+ case "ArrowLeft":
81
+ t ? this.focusNextTab() : this.focusPreviousTab(), r = !0;
82
+ break;
83
+ case "ArrowUp":
84
+ this.focusPreviousTab(), r = !0;
85
+ break;
86
+ case "ArrowRight":
87
+ t ? this.focusPreviousTab() : this.focusNextTab(), r = !0;
88
+ break;
89
+ case "ArrowDown":
90
+ this.focusNextTab(), r = !0;
91
+ break;
92
+ case "Home":
93
+ this.focusTabAt(0), r = !0;
94
+ break;
95
+ case "End":
96
+ this.focusTabAt(this.tabsList.length - 1), r = !0;
97
+ break;
98
+ case "Enter":
99
+ case " ":
100
+ const i = this.tabElements[this.currentTabIndex];
101
+ if (i) {
102
+ const n = i.getAttribute("data-tab-id");
103
+ n && (this.selectTab(n), r = !0);
104
+ }
105
+ break;
106
+ }
107
+ r && e.preventDefault();
108
+ };
109
+ }
110
+ static {
111
+ this.styles = g`
112
+ :host {
113
+ display: block;
114
+ /* Tell the UA to pick the right scheme for native form controls
115
+ inside the ribbon (selects, color inputs, etc). */
116
+ color-scheme: light dark;
117
+ /* ---- Default tokens (neutral, Bootstrap-anchored) ---- */
118
+ --bs-ribbon-app-accent: var(--bs-primary, #0d6efd);
119
+ --bs-ribbon-app-accent-on-dark:
120
+ color-mix(in oklab, var(--bs-ribbon-app-accent) 55%, white 45%);
121
+ --bs-ribbon-font-family: inherit;
122
+ --bs-ribbon-container-bg: var(--bs-body-bg, #fafafa);
123
+ --bs-ribbon-container-border: var(--bs-border-color, #e0e0e0);
124
+ --bs-ribbon-tabstrip-bg: var(--bs-tertiary-bg, #f5f5f5);
125
+ --bs-ribbon-tabstrip-border: var(--bs-border-color, #d0d0d0);
126
+ --bs-ribbon-tab-idle-color: inherit;
127
+ --bs-ribbon-tab-hover-bg: var(--bs-secondary-bg, #f0f0f0);
128
+ --bs-ribbon-tab-active-bg: transparent;
129
+ --bs-ribbon-tab-active-color: var(--bs-ribbon-app-accent);
130
+ --bs-ribbon-tab-active-indicator-color: var(--bs-ribbon-app-accent);
131
+ --bs-ribbon-tab-active-indicator-width: 2px;
132
+ --bs-ribbon-tab-radius: 0;
133
+ --bs-ribbon-tab-padding: 10px 16px;
134
+ --bs-ribbon-tabpanel-bg: var(--bs-body-bg, #fff);
135
+ --bs-ribbon-group-separator: var(--bs-border-color, #e0e0e0);
136
+ --bs-ribbon-group-separator-inset: 0px;
137
+ --bs-ribbon-group-label-color: var(--bs-secondary-color, #6c757d);
138
+ --bs-ribbon-item-hover-bg: var(--bs-secondary-bg, #e9ecef);
139
+ --bs-ribbon-item-hover-border: var(--bs-border-color, #ced4da);
140
+ --bs-ribbon-item-pressed-bg: var(--bs-secondary-bg, #dee2e6);
141
+ --bs-ribbon-item-radius: 3px;
142
+ }
143
+
144
+ /* ---- Office 2007: glossy blue gradient, honey hover ---- */
145
+ :host([version="office-2007"]) {
146
+ --bs-ribbon-font-family: "Segoe UI", Tahoma, sans-serif;
147
+ --bs-ribbon-container-bg: linear-gradient(#F4F8FD, #DCE7F5);
148
+ --bs-ribbon-container-border: #5C85B6;
149
+ --bs-ribbon-tabstrip-bg: linear-gradient(#C7DEFD, #A4C5F4);
150
+ --bs-ribbon-tabstrip-border: #5C85B6;
151
+ --bs-ribbon-tab-idle-color: #1F3A5F;
152
+ --bs-ribbon-tab-hover-bg: linear-gradient(#FFE8A1, #FFC759);
153
+ --bs-ribbon-tab-active-bg: linear-gradient(#F4F8FD, #DCE7F5);
154
+ --bs-ribbon-tab-active-color: #1F3A5F;
155
+ --bs-ribbon-tab-active-indicator-color: transparent;
156
+ --bs-ribbon-tab-active-indicator-width: 0px;
157
+ --bs-ribbon-tab-radius: 6px 6px 0 0;
158
+ --bs-ribbon-tabpanel-bg: linear-gradient(#F4F8FD, #DCE7F5);
159
+ --bs-ribbon-group-separator: rgba(0, 0, 0, 0.18);
160
+ --bs-ribbon-group-separator-inset: 0px;
161
+ --bs-ribbon-group-label-color: #3B5A82;
162
+ --bs-ribbon-item-hover-bg: linear-gradient(#FFE8A1, #FFC759);
163
+ --bs-ribbon-item-hover-border: #D9A03C;
164
+ --bs-ribbon-item-pressed-bg: linear-gradient(#F5B23A, #E08A1A);
165
+ --bs-ribbon-item-radius: 2px;
166
+ }
167
+
168
+ /* ---- Office 2010: neutral silver, soft cream hover ---- */
169
+ :host([version="office-2010"]) {
170
+ --bs-ribbon-font-family: "Segoe UI", Calibri, sans-serif;
171
+ --bs-ribbon-container-bg: #F2F4F6;
172
+ --bs-ribbon-container-border: #B8BDC2;
173
+ --bs-ribbon-tabstrip-bg: linear-gradient(#E8ECEF, #D6DBE0);
174
+ --bs-ribbon-tabstrip-border: #B8BDC2;
175
+ --bs-ribbon-tab-idle-color: #2D2D2D;
176
+ --bs-ribbon-tab-hover-bg: linear-gradient(#FFF6D8, #FFEAB0);
177
+ --bs-ribbon-tab-active-bg: #F2F4F6;
178
+ --bs-ribbon-tab-active-color: #2D2D2D;
179
+ --bs-ribbon-tab-active-indicator-color: transparent;
180
+ --bs-ribbon-tab-active-indicator-width: 0px;
181
+ --bs-ribbon-tab-radius: 0;
182
+ --bs-ribbon-tabpanel-bg: #F2F4F6;
183
+ --bs-ribbon-group-separator: #C8CDD2;
184
+ --bs-ribbon-group-separator-inset: 0px;
185
+ --bs-ribbon-group-label-color: #5E6770;
186
+ --bs-ribbon-item-hover-bg: #FFEFB7;
187
+ --bs-ribbon-item-hover-border: #E8C46A;
188
+ --bs-ribbon-item-pressed-bg: #F5DC8A;
189
+ --bs-ribbon-item-radius: 2px;
190
+ }
191
+
192
+ /* ---- Office 2013: flat white panel, app-tinted strip ---- */
193
+ :host([version="office-2013"]) {
194
+ --bs-ribbon-app-accent: #2B579A;
195
+ --bs-ribbon-font-family: "Segoe UI", sans-serif;
196
+ --bs-ribbon-container-bg: #FFFFFF;
197
+ --bs-ribbon-container-border: #D2D2D2;
198
+ --bs-ribbon-tabstrip-bg: color-mix(
199
+ in srgb,
200
+ var(--bs-ribbon-app-accent) 18%,
201
+ #FFFFFF
202
+ );
203
+ --bs-ribbon-tabstrip-border: color-mix(
204
+ in srgb,
205
+ var(--bs-ribbon-app-accent) 40%,
206
+ #FFFFFF
207
+ );
208
+ --bs-ribbon-tab-idle-color: #444;
209
+ --bs-ribbon-tab-hover-bg: rgba(0, 0, 0, 0.04);
210
+ --bs-ribbon-tab-active-bg: #FFFFFF;
211
+ --bs-ribbon-tab-active-color: var(--bs-ribbon-app-accent);
212
+ --bs-ribbon-tab-active-indicator-color: transparent;
213
+ --bs-ribbon-tab-active-indicator-width: 0px;
214
+ --bs-ribbon-tab-radius: 0;
215
+ --bs-ribbon-tabpanel-bg: #FFFFFF;
216
+ --bs-ribbon-group-separator: #D2D2D2;
217
+ --bs-ribbon-group-separator-inset: 8px;
218
+ --bs-ribbon-group-label-color: #666;
219
+ --bs-ribbon-item-hover-bg: #EAEAEA;
220
+ --bs-ribbon-item-hover-border: transparent;
221
+ --bs-ribbon-item-pressed-bg: #D6D6D6;
222
+ --bs-ribbon-item-radius: 0;
223
+ }
224
+
225
+ /* ---- Office 2016: full app-accent strip, white panel ---- */
226
+ :host([version="office-2016"]) {
227
+ --bs-ribbon-app-accent: #2B579A;
228
+ --bs-ribbon-font-family: "Segoe UI", sans-serif;
229
+ --bs-ribbon-container-bg: #FFFFFF;
230
+ --bs-ribbon-container-border: #D2D2D2;
231
+ --bs-ribbon-tabstrip-bg: var(--bs-ribbon-app-accent);
232
+ --bs-ribbon-tabstrip-border: var(--bs-ribbon-app-accent);
233
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.85);
234
+ --bs-ribbon-tab-hover-bg: rgba(255, 255, 255, 0.15);
235
+ --bs-ribbon-tab-active-bg: #FFFFFF;
236
+ --bs-ribbon-tab-active-color: var(--bs-ribbon-app-accent);
237
+ --bs-ribbon-tab-active-indicator-color: var(--bs-ribbon-app-accent);
238
+ --bs-ribbon-tab-active-indicator-width: 2px;
239
+ --bs-ribbon-tab-radius: 0;
240
+ --bs-ribbon-tabpanel-bg: #FFFFFF;
241
+ --bs-ribbon-group-separator: #D2D2D2;
242
+ --bs-ribbon-group-separator-inset: 8px;
243
+ --bs-ribbon-group-label-color: #666;
244
+ --bs-ribbon-item-hover-bg: #E6E6E6;
245
+ --bs-ribbon-item-hover-border: transparent;
246
+ --bs-ribbon-item-pressed-bg: #CCCCCC;
247
+ --bs-ribbon-item-radius: 0;
248
+ }
249
+
250
+ /* ============================================================
251
+ DARK MODE
252
+ office-2013 → "Dark Gray" (Microsoft-shipped)
253
+ office-2016 → "Black" (Microsoft-shipped)
254
+ office-2007 → reconstructed from the original Black colour scheme
255
+ office-2010 → reconstructed from the original Black colour scheme
256
+ Each block exists twice: once for explicit [colorScheme]="dark"
257
+ and once under @media (prefers-color-scheme: dark) for
258
+ [colorScheme]="auto" — keeps cascade specificity equal.
259
+ Each block only sets the tokens that *differ* from its light
260
+ counterpart; same-value tokens (font-family, tab-radius, etc.)
261
+ continue to cascade from the per-version light block.
262
+ ============================================================ */
263
+
264
+ /* Office 2007 — Black scheme (reconstructed) */
265
+ :host([color-scheme="dark"][version="office-2007"]) {
266
+ color: rgba(255, 255, 255, 0.87);
267
+ --bs-ribbon-container-bg: linear-gradient(#2B2F38, #1E2024);
268
+ --bs-ribbon-container-border: #15171A;
269
+ --bs-ribbon-tabstrip-bg: linear-gradient(#252830, #15171A);
270
+ --bs-ribbon-tabstrip-border: #15171A;
271
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.78);
272
+ --bs-ribbon-tab-hover-bg: #3A3A3A;
273
+ --bs-ribbon-tab-active-bg: linear-gradient(#2B2F38, #1E2024);
274
+ --bs-ribbon-tab-active-color: #FFFFFF;
275
+ --bs-ribbon-tabpanel-bg: linear-gradient(#2B2F38, #1E2024);
276
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.10);
277
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.60);
278
+ --bs-ribbon-item-hover-bg: #3F3F3F;
279
+ --bs-ribbon-item-hover-border: rgba(255, 255, 255, 0.15);
280
+ --bs-ribbon-item-pressed-bg: #4A4A4A;
281
+ }
282
+
283
+ /* Office 2010 — Black scheme (reconstructed) */
284
+ :host([color-scheme="dark"][version="office-2010"]) {
285
+ color: rgba(255, 255, 255, 0.87);
286
+ --bs-ribbon-container-bg: #2A2C2F;
287
+ --bs-ribbon-container-border: #1A1A1A;
288
+ --bs-ribbon-tabstrip-bg: linear-gradient(#34373B, #25282B);
289
+ --bs-ribbon-tabstrip-border: #1A1A1A;
290
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.78);
291
+ --bs-ribbon-tab-hover-bg: #3A3A3A;
292
+ --bs-ribbon-tab-active-bg: #2A2C2F;
293
+ --bs-ribbon-tab-active-color: #FFFFFF;
294
+ --bs-ribbon-tabpanel-bg: #2A2C2F;
295
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.10);
296
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.60);
297
+ --bs-ribbon-item-hover-bg: #3F3F3F;
298
+ --bs-ribbon-item-hover-border: rgba(255, 255, 255, 0.15);
299
+ --bs-ribbon-item-pressed-bg: #4A4A4A;
300
+ }
301
+
302
+ /* Office 2016 — Black */
303
+ :host([color-scheme="dark"][version="office-2016"]) {
304
+ color: rgba(255, 255, 255, 0.87);
305
+ --bs-ribbon-container-bg: #262626;
306
+ --bs-ribbon-container-border: #1A1A1A;
307
+ --bs-ribbon-tabstrip-bg: #1F1F1F;
308
+ --bs-ribbon-tabstrip-border: #1A1A1A;
309
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.78);
310
+ --bs-ribbon-tab-hover-bg: #3A3A3A;
311
+ --bs-ribbon-tab-active-bg: #363636;
312
+ --bs-ribbon-tab-active-color: #FFFFFF;
313
+ --bs-ribbon-tab-active-indicator-color: var(--bs-ribbon-app-accent-on-dark);
314
+ --bs-ribbon-tabpanel-bg: #363636;
315
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.10);
316
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.60);
317
+ --bs-ribbon-item-hover-bg: #3F3F3F;
318
+ --bs-ribbon-item-hover-border: rgba(255, 255, 255, 0.15);
319
+ --bs-ribbon-item-pressed-bg: #4A4A4A;
320
+ }
321
+
322
+ /* Office 2013 — Dark Gray */
323
+ :host([color-scheme="dark"][version="office-2013"]) {
324
+ color: rgba(255, 255, 255, 0.87);
325
+ --bs-ribbon-container-bg: #444444;
326
+ --bs-ribbon-container-border: #2B2B2B;
327
+ --bs-ribbon-tabstrip-bg: #2B2B2B;
328
+ --bs-ribbon-tabstrip-border: #1F1F1F;
329
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.70);
330
+ --bs-ribbon-tab-hover-bg: #525252;
331
+ --bs-ribbon-tab-active-bg: #444444;
332
+ --bs-ribbon-tab-active-color: #FFFFFF;
333
+ --bs-ribbon-tab-active-indicator-color: transparent;
334
+ --bs-ribbon-tabpanel-bg: #444444;
335
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.08);
336
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.55);
337
+ --bs-ribbon-item-hover-bg: #5A5A5A;
338
+ --bs-ribbon-item-hover-border: transparent;
339
+ --bs-ribbon-item-pressed-bg: #6A6A6A;
340
+ }
341
+
342
+ @media (prefers-color-scheme: dark) {
343
+ :host([color-scheme="auto"][version="office-2007"]) {
344
+ color: rgba(255, 255, 255, 0.87);
345
+ --bs-ribbon-container-bg: linear-gradient(#2B2F38, #1E2024);
346
+ --bs-ribbon-container-border: #15171A;
347
+ --bs-ribbon-tabstrip-bg: linear-gradient(#252830, #15171A);
348
+ --bs-ribbon-tabstrip-border: #15171A;
349
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.78);
350
+ --bs-ribbon-tab-hover-bg: #3A3A3A;
351
+ --bs-ribbon-tab-active-bg: linear-gradient(#2B2F38, #1E2024);
352
+ --bs-ribbon-tab-active-color: #FFFFFF;
353
+ --bs-ribbon-tabpanel-bg: linear-gradient(#2B2F38, #1E2024);
354
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.10);
355
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.60);
356
+ --bs-ribbon-item-hover-bg: #3F3F3F;
357
+ --bs-ribbon-item-hover-border: rgba(255, 255, 255, 0.15);
358
+ --bs-ribbon-item-pressed-bg: #4A4A4A;
359
+ }
360
+ :host([color-scheme="auto"][version="office-2010"]) {
361
+ color: rgba(255, 255, 255, 0.87);
362
+ --bs-ribbon-container-bg: #2A2C2F;
363
+ --bs-ribbon-container-border: #1A1A1A;
364
+ --bs-ribbon-tabstrip-bg: linear-gradient(#34373B, #25282B);
365
+ --bs-ribbon-tabstrip-border: #1A1A1A;
366
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.78);
367
+ --bs-ribbon-tab-hover-bg: #3A3A3A;
368
+ --bs-ribbon-tab-active-bg: #2A2C2F;
369
+ --bs-ribbon-tab-active-color: #FFFFFF;
370
+ --bs-ribbon-tabpanel-bg: #2A2C2F;
371
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.10);
372
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.60);
373
+ --bs-ribbon-item-hover-bg: #3F3F3F;
374
+ --bs-ribbon-item-hover-border: rgba(255, 255, 255, 0.15);
375
+ --bs-ribbon-item-pressed-bg: #4A4A4A;
376
+ }
377
+ :host([color-scheme="auto"][version="office-2016"]) {
378
+ color: rgba(255, 255, 255, 0.87);
379
+ --bs-ribbon-container-bg: #262626;
380
+ --bs-ribbon-container-border: #1A1A1A;
381
+ --bs-ribbon-tabstrip-bg: #1F1F1F;
382
+ --bs-ribbon-tabstrip-border: #1A1A1A;
383
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.78);
384
+ --bs-ribbon-tab-hover-bg: #3A3A3A;
385
+ --bs-ribbon-tab-active-bg: #363636;
386
+ --bs-ribbon-tab-active-color: #FFFFFF;
387
+ --bs-ribbon-tab-active-indicator-color: var(--bs-ribbon-app-accent-on-dark);
388
+ --bs-ribbon-tabpanel-bg: #363636;
389
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.10);
390
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.60);
391
+ --bs-ribbon-item-hover-bg: #3F3F3F;
392
+ --bs-ribbon-item-hover-border: rgba(255, 255, 255, 0.15);
393
+ --bs-ribbon-item-pressed-bg: #4A4A4A;
394
+ }
395
+ :host([color-scheme="auto"][version="office-2013"]) {
396
+ color: rgba(255, 255, 255, 0.87);
397
+ --bs-ribbon-container-bg: #444444;
398
+ --bs-ribbon-container-border: #2B2B2B;
399
+ --bs-ribbon-tabstrip-bg: #2B2B2B;
400
+ --bs-ribbon-tabstrip-border: #1F1F1F;
401
+ --bs-ribbon-tab-idle-color: rgba(255, 255, 255, 0.70);
402
+ --bs-ribbon-tab-hover-bg: #525252;
403
+ --bs-ribbon-tab-active-bg: #444444;
404
+ --bs-ribbon-tab-active-color: #FFFFFF;
405
+ --bs-ribbon-tab-active-indicator-color: transparent;
406
+ --bs-ribbon-tabpanel-bg: #444444;
407
+ --bs-ribbon-group-separator: rgba(255, 255, 255, 0.08);
408
+ --bs-ribbon-group-label-color: rgba(255, 255, 255, 0.55);
409
+ --bs-ribbon-item-hover-bg: #5A5A5A;
410
+ --bs-ribbon-item-hover-border: transparent;
411
+ --bs-ribbon-item-pressed-bg: #6A6A6A;
412
+ }
413
+ }
414
+
415
+ /* ============================================================
416
+ TOUCH MODE (FR-37 / FR-38)
417
+ Bumps tab buttons to WCAG-recommended ≥44px tall when the
418
+ primary pointer is coarse (touch / stylus) or when the
419
+ consumer explicitly opts in via [touchMode]="on".
420
+ Item-level bumps live in mp-ribbon-button / -toggle / -checkbox
421
+ / etc. so each item kind controls its own padding ramp.
422
+ ============================================================ */
423
+ :host([touch-mode="on"]) .ribbon-tab,
424
+ :host([touch-mode="on"]) .ribbon-contextual-group-tabs > .ribbon-tab {
425
+ min-height: 44px;
426
+ padding: 12px 18px;
427
+ }
428
+ @media (pointer: coarse) {
429
+ :host([touch-mode="auto"]) .ribbon-tab,
430
+ :host([touch-mode="auto"]) .ribbon-contextual-group-tabs > .ribbon-tab {
431
+ min-height: 44px;
432
+ padding: 12px 18px;
433
+ }
434
+ }
435
+
436
+ /* Contextual band: dark mode bypasses the JS-computed luminance
437
+ text rule. Hue is desaturated + darkened so it doesn't punch
438
+ through dark chrome; text is always white. */
439
+ :host([color-scheme="dark"]) .ribbon-contextual-group-band {
440
+ background: color-mix(
441
+ in oklab,
442
+ var(--bs-ribbon-contextual-color) 40%,
443
+ #1F1F1F 60%
444
+ );
445
+ color: #FFFFFF;
446
+ }
447
+ @media (prefers-color-scheme: dark) {
448
+ :host([color-scheme="auto"]) .ribbon-contextual-group-band {
449
+ background: color-mix(
450
+ in oklab,
451
+ var(--bs-ribbon-contextual-color) 40%,
452
+ #1F1F1F 60%
453
+ );
454
+ color: #FFFFFF;
455
+ }
456
+ }
457
+
458
+ .ribbon-container {
459
+ border: 1px solid;
460
+ border-color: var(--bs-ribbon-container-border);
461
+ background: var(--bs-ribbon-container-bg);
462
+ font-family: var(--bs-ribbon-font-family);
463
+ }
464
+ .ribbon-tabstrip {
465
+ /* Wraps the tablist + tell-me so the search box can sit at the
466
+ trailing edge VISUALLY without violating ARIA's role=tablist
467
+ child constraints (axe-core's aria-required-children rule —
468
+ tablist's allowed children are role=tab only). */
469
+ display: flex;
470
+ align-items: flex-end;
471
+ border-bottom: 1px solid;
472
+ border-bottom-color: var(--bs-ribbon-tabstrip-border);
473
+ background: var(--bs-ribbon-tabstrip-bg);
474
+ }
475
+ .ribbon-tablist {
476
+ display: flex;
477
+ align-items: flex-end;
478
+ flex: 1 1 auto;
479
+ min-width: 0;
480
+ overflow-x: auto;
481
+ scrollbar-width: thin;
482
+ }
483
+ .ribbon-tab {
484
+ flex: 0 0 auto;
485
+ }
486
+ /* "Tell Me" slot (FR-24): consumer-projected search/command-palette
487
+ area pinned to the trailing edge of the tab strip. Now a sibling
488
+ of role="tablist", not a child, so the ARIA tree stays clean. */
489
+ .ribbon-tell-me {
490
+ flex: 0 0 auto;
491
+ padding-inline: 6px;
492
+ align-self: center;
493
+ display: flex;
494
+ align-items: center;
495
+ }
496
+ .ribbon-tell-me:empty { display: none; }
497
+ .ribbon-tab {
498
+ padding: var(--bs-ribbon-tab-padding);
499
+ background: transparent;
500
+ border: none;
501
+ border-bottom: var(--bs-ribbon-tab-active-indicator-width) solid
502
+ transparent;
503
+ border-radius: var(--bs-ribbon-tab-radius);
504
+ cursor: pointer;
505
+ font-size: 14px;
506
+ color: var(--bs-ribbon-tab-idle-color);
507
+ transition: background 0.15s ease, color 0.15s ease;
508
+ }
509
+
510
+ /* FR-18: honour prefers-reduced-motion. Disable hover/active colour
511
+ transitions on the tab strip + any future animations inside the
512
+ ribbon's shadow root. Slotted item elements (mp-ribbon-button etc.)
513
+ each carry their own reduced-motion block where they introduce
514
+ transitions; today only the tab strip has any. */
515
+ @media (prefers-reduced-motion: reduce) {
516
+ .ribbon-tab,
517
+ .ribbon-tab:hover,
518
+ .ribbon-tab.active {
519
+ transition: none;
520
+ }
521
+ * {
522
+ animation-duration: 0.001ms !important;
523
+ animation-iteration-count: 1 !important;
524
+ transition-duration: 0.001ms !important;
525
+ scroll-behavior: auto !important;
526
+ }
527
+ }
528
+ .ribbon-tab:hover { background: var(--bs-ribbon-tab-hover-bg); }
529
+ .ribbon-tab.active {
530
+ background: var(--bs-ribbon-tab-active-bg);
531
+ border-bottom-color: var(--bs-ribbon-tab-active-indicator-color);
532
+ color: var(--bs-ribbon-tab-active-color);
533
+ font-weight: 500;
534
+ }
535
+ .ribbon-tab:focus-visible {
536
+ outline: 2px solid var(--bs-ribbon-app-accent);
537
+ outline-offset: -2px;
538
+ }
539
+ .ribbon-content {
540
+ padding: 0;
541
+ background: var(--bs-ribbon-tabpanel-bg);
542
+ overflow: hidden;
543
+ }
544
+ .ribbon-contextual-group {
545
+ display: inline-flex;
546
+ flex-direction: column;
547
+ align-self: flex-end;
548
+ }
549
+ .ribbon-contextual-group-band {
550
+ background: var(--bs-ribbon-contextual-color, #F0AF84);
551
+ color: var(--ribbon-contextual-text, #262626);
552
+ font-size: 11px;
553
+ font-weight: 400;
554
+ line-height: 1.3;
555
+ padding: 5px 12px;
556
+ text-align: center;
557
+ white-space: nowrap;
558
+ }
559
+ .ribbon-contextual-group-tabs {
560
+ display: flex;
561
+ flex-direction: row;
562
+ align-self: stretch;
563
+ }
564
+ .ribbon-contextual-group-tabs > .ribbon-tab {
565
+ flex: 1 0 auto;
566
+ text-align: center;
567
+ justify-content: center;
568
+ }
569
+ /* Contextual tabs no longer need a coloured top-border — the band
570
+ directly above them is the visual indicator. Keeping their layout
571
+ identical to plain tabs avoids the colour from the band appearing
572
+ to bleed 3px down into the tab. */
573
+
574
+ /* KeyTips overlay (FR-12). Position: fixed badges anchored to each
575
+ tab / item via getBoundingClientRect; one shadow-DOM layer renders
576
+ all badges. Office-style yellow tile with a thin border. */
577
+ .keytip-badge {
578
+ position: fixed;
579
+ z-index: 1100;
580
+ min-width: 18px;
581
+ padding: 1px 5px;
582
+ background: #FFFFFF;
583
+ border: 1px solid #919191;
584
+ color: #444;
585
+ font-size: 11px;
586
+ font-family: var(--bs-ribbon-font-family, "Segoe UI", sans-serif);
587
+ font-weight: 600;
588
+ line-height: 1.2;
589
+ text-align: center;
590
+ pointer-events: none;
591
+ box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.15);
592
+ }
593
+ :host([color-scheme="dark"]) .keytip-badge {
594
+ background: #2A2A2A;
595
+ border-color: #6E6E6E;
596
+ color: #F2F2F2;
597
+ }
598
+ @media (prefers-color-scheme: dark) {
599
+ :host([color-scheme="auto"]) .keytip-badge {
600
+ background: #2A2A2A;
601
+ border-color: #6E6E6E;
602
+ color: #F2F2F2;
603
+ }
604
+ }
605
+ `;
606
+ }
607
+ get tabElements() {
608
+ return Array.from(this.renderRoot.querySelectorAll('[role="tab"]'));
609
+ }
610
+ connectedCallback() {
611
+ super.connectedCallback(), this.setAttribute("role", "region"), this.setAttribute("aria-label", "Ribbon"), typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => this.scheduleReflow()), this.resizeObserver.observe(this)), this.addEventListener(
612
+ "contextual-visibility-change",
613
+ this.onContextualVisibilityChange
614
+ ), this.addEventListener("keydown", this.onHostKeyDown), document.addEventListener("keydown", this.onKeyTipKeyDown), document.addEventListener("keyup", this.onKeyTipKeyUp);
615
+ }
616
+ disconnectedCallback() {
617
+ super.disconnectedCallback(), this.resizeObserver?.disconnect(), this.reflowFrame && cancelAnimationFrame(this.reflowFrame), this.removeEventListener(
618
+ "contextual-visibility-change",
619
+ this.onContextualVisibilityChange
620
+ ), this.removeEventListener("keydown", this.onHostKeyDown), document.removeEventListener("keydown", this.onKeyTipKeyDown), document.removeEventListener("keyup", this.onKeyTipKeyUp);
621
+ }
622
+ openKeyTipsTabsLevel() {
623
+ this.keyTipMode = "tabs", this.keyTipBadges = this.deriveTabBadges();
624
+ }
625
+ openKeyTipsItemsLevel() {
626
+ this.keyTipMode = "items", requestAnimationFrame(() => {
627
+ this.keyTipBadges = this.deriveItemBadges();
628
+ });
629
+ }
630
+ closeKeyTips() {
631
+ this.keyTipMode = "off", this.keyTipBadges = [];
632
+ }
633
+ /**
634
+ * Activate the underlying target. For tabs, switch tabs (handled in the
635
+ * caller). For items, dispatch the appropriate event — `mp-ribbon-button`
636
+ * etc. listen for `click` and fire their own `item-click`; for dropdown
637
+ * triggers, click opens the menu. delegatesFocus + `click()` covers both.
638
+ */
639
+ activateKeyTipTarget(e) {
640
+ e.focus(), e.click();
641
+ }
642
+ /**
643
+ * Deterministic 1-letter tip allocator (FR-12). Tries (in order):
644
+ * 1. Explicit `data-key-tip` attribute on the element.
645
+ * 2. First letter of the label that isn't already taken.
646
+ * 3. Subsequent consonants in the label.
647
+ * 4. Other letters of the label.
648
+ * 5. Digits 1-9 then 0 (fallback when every letter is taken).
649
+ */
650
+ allocateKeyTip(e, o, r) {
651
+ if (o) {
652
+ const n = o.toUpperCase().slice(0, 1);
653
+ return r.add(n), n;
654
+ }
655
+ const t = (e ?? "").toUpperCase(), i = (n) => "AEIOU".includes(n);
656
+ if (t.length > 0) {
657
+ const n = t[0];
658
+ if (/[A-Z0-9]/.test(n) && !r.has(n))
659
+ return r.add(n), n;
660
+ }
661
+ for (let n = 1; n < t.length; n++) {
662
+ const b = t[n];
663
+ if (/[A-Z]/.test(b) && !i(b) && !r.has(b))
664
+ return r.add(b), b;
665
+ }
666
+ for (let n = 0; n < t.length; n++) {
667
+ const b = t[n];
668
+ if (/[A-Z]/.test(b) && !r.has(b))
669
+ return r.add(b), b;
670
+ }
671
+ for (const n of "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0")
672
+ if (!r.has(n))
673
+ return r.add(n), n;
674
+ return "?";
675
+ }
676
+ /** Compute key-tip badges anchored under each tab button in the strip. */
677
+ deriveTabBadges() {
678
+ const e = [], o = /* @__PURE__ */ new Set(), r = this.tabElements;
679
+ for (const t of r) {
680
+ const i = t.getAttribute("data-tab-id") ?? "", n = this.tabsList.find((u) => u.tabId === i)?.element, b = t.getAttribute("data-key-tip") ?? n?.getAttribute("data-key-tip") ?? null, c = t.textContent ?? "", a = this.allocateKeyTip(c, b, o), h = t.getBoundingClientRect();
681
+ e.push({ tip: a, target: t, rect: { left: h.left + 4, top: h.bottom - 4 } });
682
+ }
683
+ return e;
684
+ }
685
+ /** Compute key-tip badges for every item inside the currently active tab. */
686
+ deriveItemBadges() {
687
+ const e = this.tabsList.find((i) => i.tabId === this.activeTabId);
688
+ if (!e) return [];
689
+ const o = this.collectActiveGroups(e.element), r = /* @__PURE__ */ new Set(), t = [];
690
+ for (const i of o) {
691
+ if (i.getAttribute("data-resolved-size") === "popup") {
692
+ const b = i.shadowRoot?.querySelector(
693
+ ".ribbon-popup-trigger"
694
+ );
695
+ if (b) {
696
+ const c = i.getAttribute("data-key-tip"), a = i.getAttribute("label") ?? "", h = this.allocateKeyTip(a, c, r), u = b.getBoundingClientRect();
697
+ t.push({ tip: h, target: b, rect: { left: u.left + 4, top: u.bottom - 6 } });
698
+ }
699
+ continue;
700
+ }
701
+ const n = this.collectGroupItems(i);
702
+ for (const b of n) {
703
+ if (b.hasAttribute("disabled")) continue;
704
+ const c = b.getAttribute("data-key-tip"), a = b.getAttribute("label") ?? "", h = this.allocateKeyTip(a, c, r), u = b.getBoundingClientRect();
705
+ t.push({ tip: h, target: b, rect: { left: u.left + 2, top: u.bottom - 6 } });
706
+ }
707
+ }
708
+ return t;
709
+ }
710
+ toggleMinimizedFromUser() {
711
+ this.minimized = !this.minimized, this.dispatchEvent(
712
+ new CustomEvent("minimize-toggle", {
713
+ detail: { minimized: this.minimized },
714
+ bubbles: !0,
715
+ composed: !0
716
+ })
717
+ );
718
+ }
719
+ moveFocusBetweenGroups(e, o) {
720
+ const r = this.tabsList.find((c) => c.tabId === this.activeTabId);
721
+ if (!r) return !1;
722
+ const t = this.collectActiveGroups(r.element).filter(
723
+ (c) => c.getAttribute("data-resolved-size") !== "popup" || c.hasAttribute("data-popup-open")
724
+ );
725
+ if (t.length === 0) return !1;
726
+ const i = t.indexOf(e);
727
+ if (i === -1) return !1;
728
+ const n = i + o;
729
+ if (n < 0 || n >= t.length) return !1;
730
+ const b = this.firstFocusableInGroup(t[n]);
731
+ return b ? (b.focus(), !0) : !1;
732
+ }
733
+ firstFocusableInGroup(e) {
734
+ const o = Array.from(
735
+ e.querySelectorAll(
736
+ "mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-combobox, mp-ribbon-color-picker, mp-ribbon-group-button, mp-ribbon-split-button, mp-ribbon-dropdown-button, mp-ribbon-gallery, mp-ribbon-template-item"
737
+ )
738
+ ).filter((r) => !r.hasAttribute("disabled"));
739
+ return o.length === 0 ? null : o.find((r) => r.getAttribute("tabindex") === "0") ?? o[0];
740
+ }
741
+ updated(e) {
742
+ if (e.has("activeTabId")) {
743
+ this.applyActiveAttribute();
744
+ const o = this.tabsList.findIndex((r) => r.tabId === this.activeTabId);
745
+ o >= 0 && (this.currentTabIndex = o);
746
+ }
747
+ (e.has("activeTabId") || e.has("minimized")) && this.scheduleReflow(), e.has("minimized") && e.get("minimized") !== void 0 && this.liveAnnouncer.announce(
748
+ this.minimized ? "Ribbon minimized" : "Ribbon restored"
749
+ ), e.has("layout") && (this.applyLayoutPropagation(), this.scheduleReflow());
750
+ }
751
+ /**
752
+ * FR-39: stamp `data-ribbon-layout` on every slotted descendant so each
753
+ * element's shadow-DOM CSS can switch to its Simplified rendering. Walking
754
+ * the light-DOM tree is necessary because CSS custom properties can be
755
+ * read in `var()` values but not as conditional selectors.
756
+ *
757
+ * Also force every item's `size` to `small` in Simplified, and restore
758
+ * the consumer-declared original size (saved in `originalItemSizes` by
759
+ * the FR-6 path) when switching back to Classic.
760
+ */
761
+ applyLayoutPropagation() {
762
+ const e = this.layout === "simplified" ? "simplified" : "classic", o = this.querySelectorAll(
763
+ "mp-ribbon-tab, mp-ribbon-group, mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-combobox, mp-ribbon-color-picker, mp-ribbon-group-button, mp-ribbon-split-button, mp-ribbon-dropdown-button, mp-ribbon-gallery"
764
+ );
765
+ for (const t of Array.from(o))
766
+ t.setAttribute("data-ribbon-layout", e);
767
+ const r = this.querySelectorAll(
768
+ "mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-combobox, mp-ribbon-color-picker, mp-ribbon-group-button, mp-ribbon-split-button, mp-ribbon-dropdown-button, mp-ribbon-gallery"
769
+ );
770
+ if (this.layout === "simplified")
771
+ for (const t of Array.from(r)) {
772
+ if (!this.originalItemSizes.has(t)) {
773
+ const i = t.getAttribute("size") ?? "medium";
774
+ this.originalItemSizes.set(t, i);
775
+ }
776
+ t.getAttribute("size") !== "small" && t.setAttribute("size", "small");
777
+ }
778
+ else
779
+ for (const t of Array.from(r)) {
780
+ const i = this.originalItemSizes.get(t);
781
+ i && t.getAttribute("size") !== i && t.setAttribute("size", i);
782
+ }
783
+ }
784
+ render() {
785
+ return d`
786
+ <div class="ribbon-container">
787
+ <div class="ribbon-tabstrip">
788
+ <div
789
+ role="tablist"
790
+ class="ribbon-tablist"
791
+ @keydown="${this.onTabListKeydown}"
792
+ >
793
+ ${this.renderTabStripItems()}
794
+ </div>
795
+ <div class="ribbon-tell-me">
796
+ <slot name="tell-me"></slot>
797
+ </div>
798
+ </div>
799
+
800
+ ${this.minimized ? d`<div hidden><slot @slotchange="${this.onSlotChange}"></slot></div>` : d`<div class="ribbon-content">
801
+ <slot @slotchange="${this.onSlotChange}"></slot>
802
+ </div>`}
803
+ </div>
804
+ ${this.keyTipMode !== "off" ? this.renderKeyTipOverlay() : B}
805
+ ${this.liveAnnouncer.template()}
806
+ `;
807
+ }
808
+ renderKeyTipOverlay() {
809
+ return d`
810
+ ${this.keyTipBadges.map(
811
+ (e) => d`
812
+ <span
813
+ class="keytip-badge"
814
+ style="left: ${e.rect.left}px; top: ${e.rect.top}px;"
815
+ aria-hidden="true"
816
+ >${e.tip}</span>
817
+ `
818
+ )}
819
+ `;
820
+ }
821
+ renderTabStripItems() {
822
+ const e = [];
823
+ let o = 0;
824
+ for (; o < this.tabsList.length; ) {
825
+ const r = this.tabsList[o];
826
+ if (!r.contextualColor || !r.contextualSetLabel) {
827
+ e.push(this.renderTabButton(r, o)), o++;
828
+ continue;
829
+ }
830
+ const t = r.contextualSetLabel, i = r.contextualColor, n = o;
831
+ for (; o < this.tabsList.length && this.tabsList[o].contextualSetLabel === t && this.tabsList[o].contextualColor === i; )
832
+ o++;
833
+ const b = this.tabsList.slice(n, o), c = this.getBandTextColor(i), a = `--bs-ribbon-contextual-color: ${i};--ribbon-contextual-text: ${c};`;
834
+ e.push(d`
835
+ <div class="ribbon-contextual-group" style="${a}">
836
+ <div class="ribbon-contextual-group-band">${t}</div>
837
+ <div class="ribbon-contextual-group-tabs">
838
+ ${b.map(
839
+ (h, u) => this.renderTabButton(h, n + u)
840
+ )}
841
+ </div>
842
+ </div>
843
+ `);
844
+ }
845
+ return e;
846
+ }
847
+ /**
848
+ * Office-faithful contrast rule: dark text on pastel bands, white text on
849
+ * saturated bands. Uses W3C relative luminance with a 0.6 cutoff. Accepts
850
+ * 6-digit hex; falls back to dark on parse failure (safe default).
851
+ */
852
+ getBandTextColor(e) {
853
+ const o = e.replace("#", "").trim();
854
+ if (o.length !== 6 || !/^[0-9a-fA-F]{6}$/.test(o)) return "#262626";
855
+ const r = parseInt(o.substring(0, 2), 16) / 255, t = parseInt(o.substring(2, 4), 16) / 255, i = parseInt(o.substring(4, 6), 16) / 255;
856
+ return 0.2126 * r + 0.7152 * t + 0.0722 * i >= 0.6 ? "#262626" : "#FFFFFF";
857
+ }
858
+ renderTabButton(e, o) {
859
+ const r = e.tabId === this.activeTabId, t = !!e.contextualColor, i = r ? 0 : -1;
860
+ return d`
861
+ <button
862
+ role="tab"
863
+ id="ribbon-tab-${e.tabId}"
864
+ class="ribbon-tab ${r ? "active" : ""} ${t ? "contextual" : ""}"
865
+ aria-selected="${r}"
866
+ aria-controls="ribbon-panel-${e.tabId}"
867
+ tabindex="${i}"
868
+ data-tab-id="${e.tabId}"
869
+ @click="${() => this.selectTab(e.tabId)}"
870
+ @dblclick="${() => this.toggleMinimizedFromUser()}"
871
+ >${e.label}</button>
872
+ `;
873
+ }
874
+ processSlot(e) {
875
+ const o = [], r = [];
876
+ for (const i of e.assignedElements()) {
877
+ let n = null;
878
+ if (i.tagName === "MP-RIBBON-CONTEXTUAL-TAB-SET" ? n = i : n = i.querySelector(
879
+ "mp-ribbon-contextual-tab-set"
880
+ ), n) {
881
+ if (n.hasAttribute("hidden") || i.hasAttribute("hidden")) continue;
882
+ const a = n.getAttribute("color") ?? "#5BAEFF", h = n.getAttribute("label") ?? "", u = Array.from(
883
+ n.querySelectorAll("mp-ribbon-tab")
884
+ ), f = [];
885
+ for (const m of u) {
886
+ const x = m.getAttribute("tab-id") ?? "";
887
+ o.push({
888
+ tabId: x,
889
+ label: m.getAttribute("label") ?? "",
890
+ element: m,
891
+ contextualColor: a,
892
+ contextualSetLabel: h
893
+ }), f.push(x);
894
+ }
895
+ f.length > 0 && r.push({ label: h, color: a, tabIds: f });
896
+ continue;
897
+ }
898
+ let b = null;
899
+ i.tagName === "MP-RIBBON-TAB" ? b = i : b = i.querySelector("mp-ribbon-tab"), b && o.push({
900
+ tabId: b.getAttribute("tab-id") ?? "",
901
+ label: b.getAttribute("label") ?? "",
902
+ element: b
903
+ });
904
+ }
905
+ this.tabsList = o, this.contextualSets = r, !o.some((i) => i.tabId === this.activeTabId) && o.length > 0 ? this.activeTabId = o[0].tabId : !this.activeTabId && o.length > 0 && (this.activeTabId = o[0].tabId), this.applyActiveAttribute(), this.applyLayoutPropagation(), this.scheduleReflow();
906
+ }
907
+ applyActiveAttribute() {
908
+ for (const e of this.tabsList)
909
+ e.tabId === this.activeTabId ? e.element.setAttribute("active", "") : e.element.removeAttribute("active");
910
+ }
911
+ selectTab(e) {
912
+ const o = this.activeTabId;
913
+ this.activeTabId = e;
914
+ const r = this.tabsList.findIndex((t) => t.tabId === e);
915
+ r !== -1 && (this.currentTabIndex = r), this.dispatchEvent(
916
+ new CustomEvent("tab-change", {
917
+ detail: { previousTabId: o, activeTabId: e },
918
+ bubbles: !0,
919
+ composed: !0
920
+ })
921
+ );
922
+ }
923
+ focusPreviousTab() {
924
+ const e = Math.max(0, this.currentTabIndex - 1);
925
+ this.focusTabAt(e);
926
+ }
927
+ focusNextTab() {
928
+ const e = Math.min(this.tabsList.length - 1, this.currentTabIndex + 1);
929
+ this.focusTabAt(e);
930
+ }
931
+ focusTabAt(e) {
932
+ e >= 0 && e < this.tabElements.length && (this.tabElements[e].focus(), this.currentTabIndex = e);
933
+ }
934
+ scheduleReflow() {
935
+ this.reflowFrame || (this.reflowFrame = requestAnimationFrame(() => {
936
+ this.reflowFrame = 0, this.reflowOverflow();
937
+ }));
938
+ }
939
+ /**
940
+ * Walks the active tab's groups and toggles `data-resolved-size="popup"` on
941
+ * the rightmost group(s) until the tab content fits. On grow, expands the
942
+ * leftmost popup'd group (i.e. the most-recently-collapsed) when room allows.
943
+ *
944
+ * MVP: single step per group (large -> popup). Author-declared reduceOrder
945
+ * with intermediate sizes is a follow-up (FR-6 P0 deferred to later milestone).
946
+ */
947
+ reflowOverflow() {
948
+ if (this.minimized) return;
949
+ const e = this.tabsList.find((p) => p.tabId === this.activeTabId);
950
+ if (!e) return;
951
+ const o = e.element, r = this.collectActiveGroups(o);
952
+ if (r.length === 0) return;
953
+ if (this.layout === "simplified") {
954
+ for (const p of r)
955
+ p.hasAttribute("data-resolved-size") && p.removeAttribute("data-resolved-size");
956
+ this.diffCollapsedGroupsAndAnnounce(r);
957
+ return;
958
+ }
959
+ for (const p of r)
960
+ p.getAttribute("data-resolved-size") !== "popup" && this.naturalWidths.set(p, p.offsetWidth);
961
+ const t = o.reduceOrder, i = o.idealSizes;
962
+ if (t && t.length > 0) {
963
+ if (this.applyAuthorReduceOrder(
964
+ o,
965
+ r,
966
+ t,
967
+ i ?? {}
968
+ )) {
969
+ this.scheduleReflow();
970
+ return;
971
+ }
972
+ this.diffCollapsedGroupsAndAnnounce(r);
973
+ return;
974
+ }
975
+ const n = o.clientWidth, b = 8, c = () => r.reduce(
976
+ (p, A, C) => p + A.offsetWidth + (C > 0 ? b : 0),
977
+ 0
978
+ );
979
+ let a = !1;
980
+ const h = (p) => Number(p.getAttribute("priority") ?? "0"), u = (p) => p.getAttribute("auto-scale") !== "false", f = () => {
981
+ let p = null, A = 1 / 0, C = -1;
982
+ for (let y = 0; y < r.length; y++) {
983
+ const I = r[y];
984
+ if (I.getAttribute("data-resolved-size") === "popup" || !u(I)) continue;
985
+ const z = h(I);
986
+ (z < A || z === A && y > C) && (p = I, A = z, C = y);
987
+ }
988
+ return p;
989
+ }, m = () => {
990
+ let p = null, A = -1 / 0, C = 1 / 0;
991
+ for (let y = 0; y < r.length; y++) {
992
+ const I = r[y];
993
+ if (I.getAttribute("data-resolved-size") !== "popup") continue;
994
+ const z = h(I);
995
+ (z > A || z === A && y < C) && (p = I, A = z, C = y);
996
+ }
997
+ return p;
998
+ };
999
+ let x = r.length;
1000
+ for (; c() > n && x-- > 0; ) {
1001
+ const p = f();
1002
+ if (!p) break;
1003
+ p.setAttribute("data-resolved-size", "popup"), a = !0;
1004
+ }
1005
+ for (x = r.length; c() < n && x-- > 0; ) {
1006
+ const p = m();
1007
+ if (!p) break;
1008
+ const A = this.naturalWidths.get(p) ?? 0, C = p.offsetWidth;
1009
+ if (c() + (A - C) > n) break;
1010
+ p.removeAttribute("data-resolved-size"), a = !0;
1011
+ }
1012
+ if (a) {
1013
+ this.scheduleReflow();
1014
+ return;
1015
+ }
1016
+ this.diffCollapsedGroupsAndAnnounce(r);
1017
+ }
1018
+ /**
1019
+ * Diff the popped set against the previous frame and announce threshold
1020
+ * crossings via the live region. Shared by both reflow paths (priority
1021
+ * default + author reduceOrder).
1022
+ */
1023
+ diffCollapsedGroupsAndAnnounce(e) {
1024
+ const o = /* @__PURE__ */ new Set();
1025
+ for (const r of e)
1026
+ if (r.getAttribute("data-resolved-size") === "popup") {
1027
+ o.add(r);
1028
+ const t = r.getAttribute("label") ?? "";
1029
+ t && this.collapsedGroupLabels.set(r, t);
1030
+ }
1031
+ for (const r of o)
1032
+ if (!this.previousCollapsedGroups.has(r)) {
1033
+ const t = this.collapsedGroupLabels.get(r) ?? r.getAttribute("label") ?? "";
1034
+ t && this.liveAnnouncer.announce(`${t} group collapsed`);
1035
+ }
1036
+ for (const r of this.previousCollapsedGroups)
1037
+ if (!o.has(r)) {
1038
+ const t = this.collapsedGroupLabels.get(r) ?? "";
1039
+ t && this.liveAnnouncer.announce(`${t} group expanded`);
1040
+ }
1041
+ this.previousCollapsedGroups.clear();
1042
+ for (const r of o) this.previousCollapsedGroups.add(r);
1043
+ }
1044
+ /**
1045
+ * FR-6: walk an author-declared reduceOrder list. Returns true if any
1046
+ * mutation happened (caller re-runs the reflow to settle).
1047
+ *
1048
+ * - On shrink (occupied > available): apply more steps from the front of
1049
+ * the list, advancing the per-tab `appliedReduceSteps` counter.
1050
+ * - On grow (occupied < available): revert the most-recently-applied
1051
+ * step IF the reverted layout would still fit. Walks the prefix of the
1052
+ * list to recompute the "size before step N" for the reverted group.
1053
+ * - Groups with `auto-scale="false"` are still skipped — even if the
1054
+ * author lists a step for them, we drop a console.warn at validate
1055
+ * time and the runtime treats it as a no-op.
1056
+ */
1057
+ applyAuthorReduceOrder(e, o, r, t) {
1058
+ const n = e.clientWidth, b = () => o.reduce(
1059
+ (f, m, x) => f + m.offsetWidth + (x > 0 ? 8 : 0),
1060
+ 0
1061
+ ), c = (f) => o.find((m) => m.getAttribute("group-id") === f) ?? null;
1062
+ let a = this.appliedReduceSteps.get(e) ?? 0, h = !1, u = r.length - a;
1063
+ for (; b() > n && a < r.length && u-- > 0; ) {
1064
+ const [f, m] = r[a], x = c(f);
1065
+ if (!x || x.getAttribute("auto-scale") === "false") {
1066
+ a++;
1067
+ continue;
1068
+ }
1069
+ this.applyGroupSize(x, m, t), a++, h = !0;
1070
+ }
1071
+ for (u = a; a > 0 && u-- > 0; ) {
1072
+ const [f] = r[a - 1], m = c(f);
1073
+ if (!m) {
1074
+ a--;
1075
+ continue;
1076
+ }
1077
+ const x = this.sizeAtStepIndex(r, a - 1, f, t), p = this.sizeAtStepIndex(r, a, f, t);
1078
+ if (this.applyGroupSize(m, x, t), b() > n) {
1079
+ this.applyGroupSize(m, p, t);
1080
+ break;
1081
+ }
1082
+ a--, h = !0;
1083
+ }
1084
+ return this.appliedReduceSteps.set(e, a), h;
1085
+ }
1086
+ /**
1087
+ * Compute the resolved size of `groupId` after the first `count` steps of
1088
+ * `steps` have been applied. The starting point is `idealSizes[groupId]`
1089
+ * or `large` if unset.
1090
+ */
1091
+ sizeAtStepIndex(e, o, r, t) {
1092
+ let i = t[r] ?? "large";
1093
+ for (let n = 0; n < o; n++)
1094
+ e[n][0] === r && (i = e[n][1]);
1095
+ return i;
1096
+ }
1097
+ /**
1098
+ * Apply a resolved size to a group + mutate slotted item sizes so the
1099
+ * intermediate (`medium` / `small`) sizes have a visible effect. Saves
1100
+ * each item's original `size` to `originalItemSizes` the first time the
1101
+ * group downsizes, so going back to `large` restores it.
1102
+ */
1103
+ applyGroupSize(e, o, r) {
1104
+ if (o === "popup") {
1105
+ e.setAttribute("data-resolved-size", "popup");
1106
+ return;
1107
+ }
1108
+ o === "large" ? e.removeAttribute("data-resolved-size") : e.setAttribute("data-resolved-size", o);
1109
+ const t = this.collectGroupItems(e);
1110
+ for (const i of t) {
1111
+ if (!this.originalItemSizes.has(i)) {
1112
+ const c = i.getAttribute("size") ?? "medium";
1113
+ this.originalItemSizes.set(i, c);
1114
+ }
1115
+ const n = this.originalItemSizes.get(i), b = this.deriveItemSize(n, o);
1116
+ i.getAttribute("size") !== b && i.setAttribute("size", b);
1117
+ }
1118
+ }
1119
+ /**
1120
+ * Compute the rendered item size given its consumer-declared "original"
1121
+ * size and the group's resolved size. Items can only ever shrink, never
1122
+ * grow above their original.
1123
+ */
1124
+ deriveItemSize(e, o) {
1125
+ return o === "large" ? e : o === "small" ? "small" : e === "large" ? "medium" : e;
1126
+ }
1127
+ collectGroupItems(e) {
1128
+ return Array.from(
1129
+ e.querySelectorAll(
1130
+ "mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-combobox, mp-ribbon-color-picker, mp-ribbon-group-button, mp-ribbon-split-button, mp-ribbon-dropdown-button, mp-ribbon-gallery"
1131
+ )
1132
+ );
1133
+ }
1134
+ /**
1135
+ * Returns the `<mp-ribbon-group>` elements assigned to the active tab's slot.
1136
+ * Handles both raw web-component usage and the Angular `<bs-ribbon-group>`
1137
+ * wrapper (which delegates to an inner `<mp-ribbon-group>` via Angular's
1138
+ * `display: contents` host). The slot lives in `mp-ribbon-tab`'s shadow
1139
+ * root since each tab owns its own default slot.
1140
+ */
1141
+ collectActiveGroups(e) {
1142
+ const o = e.shadowRoot?.querySelector("slot");
1143
+ if (!o) return [];
1144
+ const r = [];
1145
+ for (const t of o.assignedElements()) {
1146
+ if (t.tagName === "MP-RIBBON-GROUP") {
1147
+ r.push(t);
1148
+ continue;
1149
+ }
1150
+ const i = t.querySelector("mp-ribbon-group");
1151
+ i && r.push(i);
1152
+ }
1153
+ return r;
1154
+ }
1155
+ }
1156
+ F([
1157
+ l({ type: String, attribute: "active-tab-id", reflect: !0 })
1158
+ ], k.prototype, "activeTabId");
1159
+ F([
1160
+ _()
1161
+ ], k.prototype, "tabsList");
1162
+ F([
1163
+ _()
1164
+ ], k.prototype, "contextualSets");
1165
+ F([
1166
+ l({ type: String, reflect: !0 })
1167
+ ], k.prototype, "layout");
1168
+ F([
1169
+ l({ type: Boolean })
1170
+ ], k.prototype, "minimized");
1171
+ F([
1172
+ l({ type: String, reflect: !0 })
1173
+ ], k.prototype, "version");
1174
+ F([
1175
+ l({ type: String, attribute: "color-scheme", reflect: !0 })
1176
+ ], k.prototype, "colorScheme");
1177
+ F([
1178
+ l({ type: String, attribute: "touch-mode", reflect: !0 })
1179
+ ], k.prototype, "touchMode");
1180
+ F([
1181
+ l({ type: String, attribute: "key-tips" })
1182
+ ], k.prototype, "keyTips");
1183
+ F([
1184
+ _()
1185
+ ], k.prototype, "keyTipMode");
1186
+ F([
1187
+ _()
1188
+ ], k.prototype, "keyTipBadges");
1189
+ typeof customElements < "u" && !customElements.get("mp-ribbon") && customElements.define("mp-ribbon", k);
1190
+ var ae = Object.defineProperty, Z = (s, e, o, r) => {
1191
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
1192
+ (n = s[i]) && (t = n(e, o, t) || t);
1193
+ return t && ae(e, o, t), t;
1194
+ };
1195
+ class N extends w {
1196
+ constructor() {
1197
+ super(...arguments), this.label = "Quick Access Toolbar", this.touchMode = "auto", this.onKeyDown = (e) => {
1198
+ const { key: o } = e;
1199
+ if (o !== "ArrowLeft" && o !== "ArrowRight" && o !== "Home" && o !== "End")
1200
+ return;
1201
+ const r = this.collectItems();
1202
+ if (r.length === 0) return;
1203
+ const t = e.composedPath(), i = r.findIndex((h) => t.includes(h)), n = getComputedStyle(this).direction === "rtl", b = n ? o === "ArrowLeft" : o === "ArrowRight", c = n ? o === "ArrowRight" : o === "ArrowLeft";
1204
+ let a = i;
1205
+ c ? a = Math.max(0, i - 1) : b ? a = Math.min(r.length - 1, i + 1) : o === "Home" ? a = 0 : o === "End" && (a = r.length - 1), a !== i && a >= 0 && (r[a].focus(), e.preventDefault());
1206
+ };
1207
+ }
1208
+ static {
1209
+ this.styles = g`
1210
+ :host {
1211
+ display: block;
1212
+ color-scheme: light dark;
1213
+ --bs-ribbon-app-accent: var(--bs-primary, #0d6efd);
1214
+ --bs-ribbon-app-accent-on-dark:
1215
+ color-mix(in oklab, var(--bs-ribbon-app-accent) 55%, white 45%);
1216
+ }
1217
+ .qat {
1218
+ display: flex;
1219
+ flex-direction: row;
1220
+ align-items: center;
1221
+ gap: 2px;
1222
+ padding: 2px 6px;
1223
+ background: var(--bs-ribbon-tabstrip-bg, var(--bs-ribbon-app-accent));
1224
+ border: 1px solid var(--bs-ribbon-tabstrip-border, transparent);
1225
+ color: var(--bs-ribbon-tab-idle-color, #fff);
1226
+ font-family: var(--bs-ribbon-font-family, inherit);
1227
+ font-size: 12px;
1228
+ min-height: 28px;
1229
+ }
1230
+ .qat-label {
1231
+ font-size: 11px;
1232
+ opacity: 0.75;
1233
+ margin-inline-end: 4px;
1234
+ white-space: nowrap;
1235
+ }
1236
+ .qat-divider {
1237
+ width: 1px;
1238
+ height: 16px;
1239
+ background: currentColor;
1240
+ opacity: 0.25;
1241
+ margin: 0 4px;
1242
+ }
1243
+ /*
1244
+ * The QAT is a horizontal flex row. Item-base WCs default to
1245
+ * \`:host { display: inline-flex }\`, but their \`[size="small"]\`
1246
+ * variant overrides to \`display: flex; width: 100%\` (intended for
1247
+ * vertical stacking inside a ribbon-group column). In the QAT context
1248
+ * that's wrong: each button would stretch to fill the toolbar. Reset
1249
+ * width here so the QAT keeps its compact horizontal layout regardless
1250
+ * of which item element the consumer slots in. The Angular demo
1251
+ * doesn't hit this because <bs-ribbon-button> wraps the WC in an
1252
+ * inline-flex host, but React/Vue use the WC tags directly.
1253
+ */
1254
+ ::slotted(mp-ribbon-button[size="small"]),
1255
+ ::slotted(mp-ribbon-toggle-button[size="small"]),
1256
+ ::slotted(mp-ribbon-dropdown-button[size="small"]),
1257
+ ::slotted(mp-ribbon-split-button[size="small"]),
1258
+ ::slotted(mp-ribbon-checkbox[size="small"]) {
1259
+ width: auto;
1260
+ }
1261
+ @media (pointer: coarse) {
1262
+ :host([touch-mode="auto"]) .qat,
1263
+ :host([touch-mode="on"]) .qat {
1264
+ min-height: 44px;
1265
+ }
1266
+ }
1267
+ :host([touch-mode="on"]) .qat {
1268
+ min-height: 44px;
1269
+ }
1270
+ `;
1271
+ }
1272
+ connectedCallback() {
1273
+ super.connectedCallback(), this.setAttribute("role", "toolbar"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", this.label), this.addEventListener("keydown", this.onKeyDown);
1274
+ }
1275
+ disconnectedCallback() {
1276
+ super.disconnectedCallback(), this.removeEventListener("keydown", this.onKeyDown);
1277
+ }
1278
+ updated(e) {
1279
+ e.has("label") && this.setAttribute("aria-label", this.label);
1280
+ }
1281
+ render() {
1282
+ return d`
1283
+ <div class="qat">
1284
+ <slot></slot>
1285
+ </div>
1286
+ `;
1287
+ }
1288
+ collectItems() {
1289
+ const e = this.renderRoot.querySelector("slot");
1290
+ if (!e) return [];
1291
+ const o = [];
1292
+ for (const r of e.assignedElements()) {
1293
+ const i = r.querySelector(
1294
+ "mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-split-button, mp-ribbon-dropdown-button"
1295
+ ) ?? r;
1296
+ i.tagName.startsWith("MP-RIBBON-") && !i.hasAttribute("disabled") && o.push(i);
1297
+ }
1298
+ return o;
1299
+ }
1300
+ }
1301
+ Z([
1302
+ l({ type: String })
1303
+ ], N.prototype, "label");
1304
+ Z([
1305
+ l({ type: String, attribute: "touch-mode", reflect: !0 })
1306
+ ], N.prototype, "touchMode");
1307
+ typeof customElements < "u" && !customElements.get("mp-quick-access-toolbar") && customElements.define("mp-quick-access-toolbar", N);
1308
+ var le = Object.defineProperty, E = (s, e, o, r) => {
1309
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
1310
+ (n = s[i]) && (t = n(e, o, t) || t);
1311
+ return t && le(e, o, t), t;
1312
+ };
1313
+ const de = "mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-combobox, mp-ribbon-color-picker, mp-ribbon-group-button, mp-ribbon-split-button, mp-ribbon-dropdown-button, mp-ribbon-gallery";
1314
+ class $ extends w {
1315
+ constructor() {
1316
+ super(...arguments), this.tabId = "", this.label = "", this.active = !1, this.idealSizes = {}, this.reduceOrder = [], this.overflowEntries = [], this.overflowOverlay = new G(this, {
1317
+ anchor: () => this.overflowTriggerEl ?? null,
1318
+ panel: () => this.overflowPanelEl ?? null
1319
+ }), this.overflowReflowFrame = 0, this.scheduleOverflowReflow = () => {
1320
+ this.overflowReflowFrame || (this.overflowReflowFrame = requestAnimationFrame(() => {
1321
+ this.overflowReflowFrame = 0, this.reflowSimplifiedOverflow();
1322
+ }));
1323
+ }, this.onOverflowTriggerClick = async (e) => {
1324
+ e.stopPropagation(), await this.overflowOverlay.toggle();
1325
+ };
1326
+ }
1327
+ static {
1328
+ this.styles = g`
1329
+ :host {
1330
+ display: none;
1331
+ width: 100%;
1332
+ }
1333
+ :host([active]) {
1334
+ display: flex;
1335
+ flex-wrap: nowrap;
1336
+ gap: 8px;
1337
+ align-items: stretch;
1338
+ min-width: 0;
1339
+ }
1340
+ ::slotted(*) { flex: 0 0 auto; }
1341
+
1342
+ /* FR-39: Simplified layout. Items overflow horizontally and the user
1343
+ can either scroll them into view OR open the trailing-edge chevron
1344
+ overlay for a flat list of overflowed items (keyboard / SR access
1345
+ path). data-overflow-hidden is still stamped on groups that
1346
+ wouldn't fit at the current width — left visible so horizontal
1347
+ scroll works, but used to compute the chevron's overlay contents. */
1348
+ :host([active][data-ribbon-layout="simplified"]) {
1349
+ overflow-x: auto;
1350
+ scrollbar-width: thin;
1351
+ }
1352
+
1353
+ .overflow-trigger {
1354
+ display: none;
1355
+ align-self: center;
1356
+ flex: 0 0 auto;
1357
+ min-width: 28px;
1358
+ height: 28px;
1359
+ padding: 0 8px;
1360
+ background: var(--bs-ribbon-tabpanel-bg, #fff);
1361
+ border: 1px solid transparent;
1362
+ border-radius: var(--bs-ribbon-item-radius, 3px);
1363
+ color: inherit;
1364
+ font: inherit;
1365
+ font-size: 16px;
1366
+ line-height: 1;
1367
+ cursor: pointer;
1368
+ }
1369
+ :host([data-ribbon-layout="simplified"][data-has-overflow]) .overflow-trigger {
1370
+ display: inline-flex;
1371
+ align-items: center;
1372
+ justify-content: center;
1373
+ /* Pin to the right edge of the scrollable viewport so the chevron
1374
+ is always reachable even while the user has scrolled items past
1375
+ it. inset-inline-end works for both LTR and RTL. */
1376
+ position: sticky;
1377
+ inset-inline-end: 0;
1378
+ margin-inline-start: auto;
1379
+ /* Soft fade so items scrolling past the chevron don't smash
1380
+ straight into its outline. */
1381
+ box-shadow: -8px 0 8px -4px var(--bs-ribbon-tabpanel-bg, #fff);
1382
+ }
1383
+ .overflow-trigger:hover {
1384
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
1385
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
1386
+ }
1387
+ .overflow-trigger:focus-visible {
1388
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
1389
+ outline-offset: -2px;
1390
+ }
1391
+
1392
+ .overflow-panel {
1393
+ position: fixed;
1394
+ z-index: 1050;
1395
+ background: var(--bs-ribbon-tabpanel-bg, #fff);
1396
+ color: inherit;
1397
+ border: 1px solid var(--bs-ribbon-container-border, #d0d0d0);
1398
+ border-radius: 4px;
1399
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
1400
+ padding: 4px 0;
1401
+ display: none;
1402
+ min-width: 200px;
1403
+ max-width: min(360px, calc(100vw - 16px));
1404
+ }
1405
+ :host([data-menu-open]) .overflow-panel { display: block; }
1406
+
1407
+ .overflow-entry {
1408
+ display: flex;
1409
+ align-items: center;
1410
+ gap: 8px;
1411
+ width: 100%;
1412
+ padding: 6px 12px;
1413
+ background: transparent;
1414
+ border: none;
1415
+ cursor: pointer;
1416
+ color: inherit;
1417
+ font: inherit;
1418
+ font-size: 13px;
1419
+ text-align: left;
1420
+ white-space: nowrap;
1421
+ }
1422
+ .overflow-entry:hover,
1423
+ .overflow-entry:focus-visible {
1424
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
1425
+ outline: none;
1426
+ }
1427
+ @media (pointer: coarse) {
1428
+ .overflow-entry { min-height: 44px; }
1429
+ }
1430
+ .overflow-entry-icon {
1431
+ width: 18px;
1432
+ flex: 0 0 auto;
1433
+ text-align: center;
1434
+ }
1435
+ `;
1436
+ }
1437
+ connectedCallback() {
1438
+ super.connectedCallback(), this.setAttribute("role", "tabpanel"), typeof ResizeObserver < "u" && (this.overflowResizeObserver = new ResizeObserver(
1439
+ () => this.scheduleOverflowReflow()
1440
+ ), this.overflowResizeObserver.observe(this));
1441
+ }
1442
+ disconnectedCallback() {
1443
+ super.disconnectedCallback(), this.overflowResizeObserver?.disconnect(), this.overflowResizeObserver = void 0, this.overflowReflowFrame && cancelAnimationFrame(this.overflowReflowFrame);
1444
+ }
1445
+ updated(e) {
1446
+ e.has("tabId") && this.tabId && (this.id = `ribbon-panel-${this.tabId}`, this.setAttribute("aria-labelledby", `ribbon-tab-${this.tabId}`)), (e.has("reduceOrder") || e.has("idealSizes")) && this.validateReduceOrder(), e.has("active") && this.active && this.scheduleOverflowReflow();
1447
+ }
1448
+ /**
1449
+ * Validates the author-declared reduceOrder against the FR-6 rules:
1450
+ * - Every target size must be one of `large | medium | small | popup`.
1451
+ * - For each group, successive steps must be monotonically non-increasing.
1452
+ * - Group IDs must reference real `<mp-ribbon-group>` children (warned but
1453
+ * not blocked — Angular renders children async so a transient false
1454
+ * negative is acceptable).
1455
+ * Violations log a `console.warn` and the step is skipped at reflow time
1456
+ * (handled in `mp-ribbon`).
1457
+ */
1458
+ validateReduceOrder() {
1459
+ if (this.reduceOrder.length === 0) return;
1460
+ const e = {
1461
+ large: 3,
1462
+ medium: 2,
1463
+ small: 1,
1464
+ popup: 0
1465
+ }, o = (t) => this.idealSizes[t] ?? "large", r = /* @__PURE__ */ new Map();
1466
+ for (let t = 0; t < this.reduceOrder.length; t++) {
1467
+ const i = this.reduceOrder[t], [n, b] = i;
1468
+ if (!(b in e)) {
1469
+ console.warn(
1470
+ `[mp-ribbon-tab "${this.tabId}"] reduceOrder[${t}] has invalid size "${b}". Expected large | medium | small | popup.`
1471
+ );
1472
+ continue;
1473
+ }
1474
+ const c = r.get(n) ?? o(n);
1475
+ if (e[b] >= e[c]) {
1476
+ console.warn(
1477
+ `[mp-ribbon-tab "${this.tabId}"] reduceOrder[${t}] for "${n}" goes ${c} → ${b}, which is not a reduction. Steps must monotonically decrease size per group.`
1478
+ );
1479
+ continue;
1480
+ }
1481
+ r.set(n, b);
1482
+ }
1483
+ }
1484
+ render() {
1485
+ return d`
1486
+ <slot @slotchange="${this.scheduleOverflowReflow}"></slot>
1487
+ <button
1488
+ class="overflow-trigger"
1489
+ type="button"
1490
+ aria-haspopup="menu"
1491
+ aria-expanded="${this.overflowOverlay.isOpen}"
1492
+ aria-label="More commands"
1493
+ title="More commands"
1494
+ @click="${this.onOverflowTriggerClick}"
1495
+ >…</button>
1496
+ <div
1497
+ class="overflow-panel"
1498
+ role="menu"
1499
+ aria-label="Overflow commands"
1500
+ >
1501
+ ${this.overflowEntries.map(
1502
+ (e) => d`
1503
+ <button
1504
+ class="overflow-entry"
1505
+ role="menuitem"
1506
+ type="button"
1507
+ @click="${() => this.activateOverflowEntry(e)}"
1508
+ >
1509
+ ${e.icon ? d`<span class="overflow-entry-icon">${e.icon}</span>` : B}
1510
+ <span>${e.label || "(unnamed)"}</span>
1511
+ </button>
1512
+ `
1513
+ )}
1514
+ </div>
1515
+ `;
1516
+ }
1517
+ reflowSimplifiedOverflow() {
1518
+ const e = this.getAttribute("data-ribbon-layout") === "simplified", o = Array.from(
1519
+ this.querySelectorAll("mp-ribbon-group")
1520
+ );
1521
+ if (!e) {
1522
+ for (const a of o) a.removeAttribute("data-overflow-hidden");
1523
+ this.overflowEntries = [], this.removeAttribute("data-has-overflow"), this.overflowOverlay.isOpen && this.overflowOverlay.close(!1);
1524
+ return;
1525
+ }
1526
+ for (const a of o) a.removeAttribute("data-overflow-hidden");
1527
+ const r = this.clientWidth;
1528
+ if (r <= 0 || o.length === 0) {
1529
+ this.overflowEntries = [], this.removeAttribute("data-has-overflow");
1530
+ return;
1531
+ }
1532
+ const t = 40, i = 8;
1533
+ let n = 0;
1534
+ const b = [];
1535
+ for (let a = 0; a < o.length; a++) {
1536
+ const h = o[a];
1537
+ n += h.offsetWidth + (a > 0 ? i : 0), n > r - t && b.push(h);
1538
+ }
1539
+ for (const a of b) a.setAttribute("data-overflow-hidden", "");
1540
+ const c = [];
1541
+ for (const a of b) {
1542
+ const h = a.querySelectorAll(de);
1543
+ for (const u of Array.from(h))
1544
+ u.hasAttribute("disabled") || c.push({
1545
+ label: u.getAttribute("label") ?? "",
1546
+ icon: u.getAttribute("icon") ?? "",
1547
+ target: u
1548
+ });
1549
+ }
1550
+ this.overflowEntries = c, c.length > 0 ? this.setAttribute("data-has-overflow", "") : (this.removeAttribute("data-has-overflow"), this.overflowOverlay.isOpen && this.overflowOverlay.close(!1));
1551
+ }
1552
+ /** Activate an overflow item by forwarding `.click()` to the original element. */
1553
+ activateOverflowEntry(e) {
1554
+ this.overflowOverlay.close(), e.target.click();
1555
+ }
1556
+ }
1557
+ E([
1558
+ l({ type: String, attribute: "tab-id", reflect: !0 })
1559
+ ], $.prototype, "tabId");
1560
+ E([
1561
+ l({ type: String, reflect: !0 })
1562
+ ], $.prototype, "label");
1563
+ E([
1564
+ l({ type: Boolean, reflect: !0 })
1565
+ ], $.prototype, "active");
1566
+ E([
1567
+ l({ attribute: !1 })
1568
+ ], $.prototype, "idealSizes");
1569
+ E([
1570
+ l({ attribute: !1 })
1571
+ ], $.prototype, "reduceOrder");
1572
+ E([
1573
+ _()
1574
+ ], $.prototype, "overflowEntries");
1575
+ E([
1576
+ S(".overflow-trigger")
1577
+ ], $.prototype, "overflowTriggerEl");
1578
+ E([
1579
+ S(".overflow-panel")
1580
+ ], $.prototype, "overflowPanelEl");
1581
+ customElements.define("mp-ribbon-tab", $);
1582
+ var ce = Object.defineProperty, W = (s, e, o, r) => {
1583
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
1584
+ (n = s[i]) && (t = n(e, o, t) || t);
1585
+ return t && ce(e, o, t), t;
1586
+ };
1587
+ class j extends w {
1588
+ constructor() {
1589
+ super(...arguments), this.label = "", this.color = "#F0AF84", this.hidden = !1;
1590
+ }
1591
+ static {
1592
+ this.styles = g`
1593
+ :host { display: contents; }
1594
+ `;
1595
+ }
1596
+ updated(e) {
1597
+ (e.has("hidden") || e.has("label") || e.has("color")) && this.dispatchEvent(
1598
+ new CustomEvent("contextual-visibility-change", {
1599
+ detail: { hidden: this.hidden, label: this.label, color: this.color },
1600
+ bubbles: !0,
1601
+ composed: !0
1602
+ })
1603
+ );
1604
+ }
1605
+ render() {
1606
+ return d`<slot></slot>`;
1607
+ }
1608
+ }
1609
+ W([
1610
+ l({ type: String, reflect: !0 })
1611
+ ], j.prototype, "label");
1612
+ W([
1613
+ l({ type: String, reflect: !0 })
1614
+ ], j.prototype, "color");
1615
+ W([
1616
+ l({ type: Boolean, reflect: !0 })
1617
+ ], j.prototype, "hidden");
1618
+ customElements.define("mp-ribbon-contextual-tab-set", j);
1619
+ var pe = Object.defineProperty, O = (s, e, o, r) => {
1620
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
1621
+ (n = s[i]) && (t = n(e, o, t) || t);
1622
+ return t && pe(e, o, t), t;
1623
+ };
1624
+ const T = class U extends w {
1625
+ constructor() {
1626
+ super(...arguments), this.groupId = "", this.label = "", this.icon = "", this.dialogLauncher = "", this.resolvedSize = "", this.priority = 0, this.autoScale = "true", this.overlay = new G(this, {
1627
+ anchor: () => this.renderRoot.querySelector(".ribbon-popup-trigger"),
1628
+ panel: () => this.renderRoot.querySelector(".ribbon-group"),
1629
+ stickyOnAnchorOffscreen: !0,
1630
+ onOpen: async () => {
1631
+ await this.updateComplete, this.collectItems()[0]?.focus();
1632
+ }
1633
+ }), this.onFocusIn = (e) => {
1634
+ if (!e.target) return;
1635
+ const t = e.composedPath().find(
1636
+ (i) => i instanceof HTMLElement && i.matches(U.ITEM_SELECTOR) && this.contains(i)
1637
+ );
1638
+ if (t)
1639
+ for (const i of this.collectItems())
1640
+ i.setAttribute("tabindex", i === t ? "0" : "-1");
1641
+ }, this.onGroupKeyDown = (e) => {
1642
+ if (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) return;
1643
+ const { key: o } = e;
1644
+ if (o !== "ArrowLeft" && o !== "ArrowRight" && o !== "Home" && o !== "End")
1645
+ return;
1646
+ const r = e.composedPath(), t = r[0];
1647
+ if (t && t instanceof HTMLElement) {
1648
+ const f = t.tagName;
1649
+ if (f === "SELECT" || f === "INPUT" || f === "TEXTAREA") return;
1650
+ }
1651
+ if (r.some((f) => f instanceof HTMLElement && f.tagName === "MP-RIBBON-GALLERY"))
1652
+ return;
1653
+ const i = this.collectItems();
1654
+ if (i.length === 0) return;
1655
+ const n = r.find(
1656
+ (f) => f instanceof HTMLElement && i.includes(f)
1657
+ ), b = n ? i.indexOf(n) : -1, c = getComputedStyle(this).direction === "rtl", a = c ? o === "ArrowLeft" : o === "ArrowRight", h = c ? o === "ArrowRight" : o === "ArrowLeft";
1658
+ let u = b;
1659
+ h ? u = b <= 0 ? i.length - 1 : b - 1 : a ? u = b >= i.length - 1 ? 0 : b + 1 : o === "Home" ? u = 0 : o === "End" && (u = i.length - 1), u !== b && u >= 0 && (i[u].focus(), e.preventDefault());
1660
+ }, this.onTriggerClick = async (e) => {
1661
+ e.stopPropagation(), await this.overlay.toggle();
1662
+ }, this.onTriggerKeyDown = async (e) => {
1663
+ e.key === "ArrowDown" && !this.overlay.isOpen && (e.preventDefault(), await this.overlay.open());
1664
+ };
1665
+ }
1666
+ static {
1667
+ this.styles = g`
1668
+ :host { display: inline-flex; position: relative; }
1669
+ :host::after {
1670
+ content: '';
1671
+ position: absolute;
1672
+ top: var(--bs-ribbon-group-separator-inset, 0px);
1673
+ bottom: var(--bs-ribbon-group-separator-inset, 0px);
1674
+ inset-inline-end: 0;
1675
+ width: 1px;
1676
+ background: var(--bs-ribbon-group-separator, rgba(0, 0, 0, 0.12));
1677
+ pointer-events: none;
1678
+ }
1679
+ :host([data-resolved-size="popup"])::after {
1680
+ top: var(--bs-ribbon-group-separator-inset, 0px);
1681
+ bottom: var(--bs-ribbon-group-separator-inset, 0px);
1682
+ }
1683
+ .ribbon-group {
1684
+ display: flex;
1685
+ flex-direction: column;
1686
+ padding: 2px 6px 0;
1687
+ min-width: 64px;
1688
+ }
1689
+ .ribbon-group-items {
1690
+ display: grid;
1691
+ grid-template-rows: repeat(3, auto);
1692
+ grid-auto-flow: column;
1693
+ column-gap: 4px;
1694
+ row-gap: 0;
1695
+ align-items: center;
1696
+ flex: 1;
1697
+ }
1698
+ ::slotted([size="large"]),
1699
+ ::slotted([size="medium"]) {
1700
+ grid-row: 1 / -1;
1701
+ align-self: stretch;
1702
+ justify-self: center;
1703
+ }
1704
+ ::slotted([size="small"]) {
1705
+ grid-row: span 1;
1706
+ align-self: center;
1707
+ justify-self: stretch;
1708
+ width: 100%;
1709
+ display: flex;
1710
+ }
1711
+ .ribbon-group-footer {
1712
+ display: flex;
1713
+ justify-content: center;
1714
+ align-items: center;
1715
+ gap: 2px;
1716
+ padding: 2px 0;
1717
+ position: relative;
1718
+ }
1719
+ .ribbon-group-label {
1720
+ font-size: 11px;
1721
+ line-height: 1;
1722
+ color: var(--bs-ribbon-group-label-color, #6c757d);
1723
+ }
1724
+ .ribbon-dialog-launcher {
1725
+ position: absolute;
1726
+ inset-inline-end: 0;
1727
+ background: transparent;
1728
+ border: none;
1729
+ cursor: pointer;
1730
+ padding: 0 2px;
1731
+ font-size: 11px;
1732
+ line-height: 1;
1733
+ color: var(--bs-ribbon-group-label-color, #6c757d);
1734
+ }
1735
+ .ribbon-dialog-launcher:hover {
1736
+ color: var(--bs-ribbon-app-accent, #0d6efd);
1737
+ }
1738
+
1739
+ .ribbon-popup-trigger {
1740
+ display: none;
1741
+ flex-direction: column;
1742
+ align-items: center;
1743
+ justify-content: center;
1744
+ gap: 2px;
1745
+ background: transparent;
1746
+ border: 1px solid transparent;
1747
+ border-radius: var(--bs-ribbon-item-radius, 3px);
1748
+ cursor: pointer;
1749
+ padding: 6px 10px;
1750
+ min-width: 56px;
1751
+ font-size: 12px;
1752
+ color: inherit;
1753
+ }
1754
+ .ribbon-popup-trigger:hover {
1755
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
1756
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
1757
+ }
1758
+ .ribbon-popup-trigger:focus-visible {
1759
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
1760
+ outline-offset: -2px;
1761
+ }
1762
+ .ribbon-popup-trigger-icon { font-size: 22px; line-height: 1; }
1763
+ .ribbon-popup-trigger-label {
1764
+ display: flex;
1765
+ align-items: center;
1766
+ gap: 2px;
1767
+ white-space: nowrap;
1768
+ }
1769
+ .ribbon-popup-trigger-chevron { font-size: 9px; opacity: 0.6; }
1770
+
1771
+ :host([data-resolved-size="popup"]) .ribbon-group { display: none; }
1772
+ :host([data-resolved-size="popup"]) .ribbon-popup-trigger { display: flex; }
1773
+ :host([data-resolved-size="popup"][data-menu-open]) .ribbon-group {
1774
+ display: flex;
1775
+ position: fixed;
1776
+ background: var(--bs-ribbon-tabpanel-bg, #fff);
1777
+ border: 1px solid var(--bs-ribbon-container-border, #d0d0d0);
1778
+ border-radius: 4px;
1779
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
1780
+ padding: 4px 6px;
1781
+ z-index: 1050;
1782
+ min-width: 200px;
1783
+ max-width: calc(100vw - 16px);
1784
+ }
1785
+
1786
+ /* ============================================================
1787
+ SIMPLIFIED LAYOUT (FR-39)
1788
+ Groups become flat horizontal flex rows; the 3-row grid is
1789
+ dropped, the label + dialog launcher footer is hidden, and
1790
+ per-group popup-chunk collapse is suppressed (the shared
1791
+ end-of-tab chevron on mp-ribbon-tab takes over). Items handle
1792
+ their own simplified rendering via the same data attribute.
1793
+ The separator hairline is also hidden — Simplified relies on
1794
+ padding alone for visual separation between groups.
1795
+ ============================================================ */
1796
+ :host([data-ribbon-layout="simplified"])::after {
1797
+ display: none;
1798
+ }
1799
+ :host([data-ribbon-layout="simplified"]) .ribbon-group {
1800
+ flex-direction: row;
1801
+ align-items: center;
1802
+ padding: 4px 8px;
1803
+ min-width: 0;
1804
+ min-height: 36px;
1805
+ }
1806
+ :host([data-ribbon-layout="simplified"]) .ribbon-group-items {
1807
+ display: flex;
1808
+ flex-direction: row;
1809
+ align-items: center;
1810
+ gap: 2px;
1811
+ flex: 0 0 auto;
1812
+ }
1813
+ :host([data-ribbon-layout="simplified"]) .ribbon-group-footer {
1814
+ display: none;
1815
+ }
1816
+ /* Override the 3-row grid placement for slotted items. */
1817
+ :host([data-ribbon-layout="simplified"]) ::slotted([size="large"]),
1818
+ :host([data-ribbon-layout="simplified"]) ::slotted([size="medium"]),
1819
+ :host([data-ribbon-layout="simplified"]) ::slotted([size="small"]) {
1820
+ grid-row: auto;
1821
+ grid-column: auto;
1822
+ align-self: center;
1823
+ justify-self: auto;
1824
+ width: auto;
1825
+ display: inline-flex;
1826
+ }
1827
+ /* Suppress per-group popup-chunk in Simplified — the shared end-of-tab
1828
+ chevron is the overflow story. */
1829
+ :host([data-ribbon-layout="simplified"]) .ribbon-popup-trigger {
1830
+ display: none !important;
1831
+ }
1832
+ :host([data-ribbon-layout="simplified"]) .ribbon-group {
1833
+ display: flex !important;
1834
+ }
1835
+ `;
1836
+ }
1837
+ static {
1838
+ this.ITEM_SELECTOR = "mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-combobox, mp-ribbon-color-picker, mp-ribbon-group-button, mp-ribbon-split-button, mp-ribbon-dropdown-button, mp-ribbon-gallery";
1839
+ }
1840
+ connectedCallback() {
1841
+ super.connectedCallback(), this.addEventListener("focusin", this.onFocusIn), this.addEventListener("keydown", this.onGroupKeyDown), this.slotObserver = new MutationObserver(() => this.applyRovingTabindex()), this.slotObserver.observe(this, { childList: !0, subtree: !0 }), Promise.resolve().then(() => this.applyRovingTabindex());
1842
+ }
1843
+ disconnectedCallback() {
1844
+ super.disconnectedCallback(), this.removeEventListener("focusin", this.onFocusIn), this.removeEventListener("keydown", this.onGroupKeyDown), this.slotObserver?.disconnect(), this.slotObserver = void 0;
1845
+ }
1846
+ /**
1847
+ * Roving tabindex (APG toolbar pattern). The first non-disabled item gets
1848
+ * `tabindex="0"`; the rest get `tabindex="-1"`. When focus moves between
1849
+ * items, `onFocusIn` updates which item is currently tabbable so that Tab
1850
+ * away + Tab back returns focus to the last visited item in this group.
1851
+ */
1852
+ applyRovingTabindex() {
1853
+ const e = this.collectItems();
1854
+ if (e.length === 0) return;
1855
+ let o = e.find((r) => r.getAttribute("tabindex") === "0");
1856
+ o || (o = e[0]);
1857
+ for (const r of e)
1858
+ r.setAttribute("tabindex", r === o ? "0" : "-1");
1859
+ }
1860
+ collectItems() {
1861
+ return Array.from(
1862
+ this.querySelectorAll(U.ITEM_SELECTOR)
1863
+ ).filter((e) => !e.hasAttribute("disabled"));
1864
+ }
1865
+ updated(e) {
1866
+ e.has("resolvedSize") && this.resolvedSize !== "popup" && this.overlay.isOpen && this.overlay.close(!1);
1867
+ }
1868
+ render() {
1869
+ return d`
1870
+ <div
1871
+ class="ribbon-group"
1872
+ role="toolbar"
1873
+ aria-label="${this.label}"
1874
+ >
1875
+ <div class="ribbon-group-items">
1876
+ <slot></slot>
1877
+ </div>
1878
+ <div class="ribbon-group-footer">
1879
+ <span class="ribbon-group-label">${this.label}</span>
1880
+ ${this.dialogLauncher ? d`<button
1881
+ class="ribbon-dialog-launcher"
1882
+ title="${this.dialogLauncher}"
1883
+ aria-label="${this.dialogLauncher}"
1884
+ @click="${this.onDialogLauncherClick}"
1885
+ >⬘</button>` : B}
1886
+ </div>
1887
+ </div>
1888
+ <button
1889
+ class="ribbon-popup-trigger"
1890
+ aria-haspopup="true"
1891
+ aria-expanded="${this.overlay.isOpen}"
1892
+ aria-label="${this.label}"
1893
+ title="${this.label}"
1894
+ @click="${this.onTriggerClick}"
1895
+ @keydown="${this.onTriggerKeyDown}"
1896
+ >
1897
+ ${this.icon ? d`<span class="ribbon-popup-trigger-icon">${this.icon}</span>` : B}
1898
+ <span class="ribbon-popup-trigger-label">
1899
+ ${this.label}
1900
+ <span class="ribbon-popup-trigger-chevron">▼</span>
1901
+ </span>
1902
+ </button>
1903
+ `;
1904
+ }
1905
+ onDialogLauncherClick() {
1906
+ this.dispatchEvent(
1907
+ new CustomEvent("dialog-launcher-click", {
1908
+ detail: { groupId: this.groupId },
1909
+ bubbles: !0,
1910
+ composed: !0
1911
+ })
1912
+ );
1913
+ }
1914
+ };
1915
+ O([
1916
+ l({ type: String, attribute: "group-id", reflect: !0 })
1917
+ ], T.prototype, "groupId");
1918
+ O([
1919
+ l({ type: String })
1920
+ ], T.prototype, "label");
1921
+ O([
1922
+ l({ type: String })
1923
+ ], T.prototype, "icon");
1924
+ O([
1925
+ l({ type: String, attribute: "dialog-launcher" })
1926
+ ], T.prototype, "dialogLauncher");
1927
+ O([
1928
+ l({ type: String, attribute: "data-resolved-size", reflect: !0 })
1929
+ ], T.prototype, "resolvedSize");
1930
+ O([
1931
+ l({ type: Number, reflect: !0 })
1932
+ ], T.prototype, "priority");
1933
+ O([
1934
+ l({ type: String, attribute: "auto-scale", reflect: !0 })
1935
+ ], T.prototype, "autoScale");
1936
+ let ue = T;
1937
+ customElements.define("mp-ribbon-group", ue);
1938
+ var he = Object.defineProperty, L = (s, e, o, r) => {
1939
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
1940
+ (n = s[i]) && (t = n(e, o, t) || t);
1941
+ return t && he(e, o, t), t;
1942
+ };
1943
+ const P = g`
1944
+ :host([size="large"]) ::slotted([slot="icon"]) {
1945
+ font-size: 28px;
1946
+ width: 28px;
1947
+ height: 28px;
1948
+ line-height: 1;
1949
+ }
1950
+ :host([size="medium"]) ::slotted([slot="icon"]) {
1951
+ font-size: 16px;
1952
+ width: 16px;
1953
+ height: 16px;
1954
+ line-height: 1;
1955
+ }
1956
+ :host([size="small"]) ::slotted([slot="icon"]) {
1957
+ font-size: 14px;
1958
+ width: 14px;
1959
+ height: 14px;
1960
+ line-height: 1;
1961
+ }
1962
+ ::slotted(.ribbon-icon-large) {
1963
+ font-size: 28px !important;
1964
+ width: 28px !important;
1965
+ height: 28px !important;
1966
+ line-height: 1 !important;
1967
+ }
1968
+ ::slotted(.ribbon-icon-medium) {
1969
+ font-size: 16px !important;
1970
+ width: 16px !important;
1971
+ height: 16px !important;
1972
+ line-height: 1 !important;
1973
+ }
1974
+ ::slotted(.ribbon-icon-small) {
1975
+ font-size: 14px !important;
1976
+ width: 14px !important;
1977
+ height: 14px !important;
1978
+ line-height: 1 !important;
1979
+ }
1980
+ `;
1981
+ class v extends w {
1982
+ constructor() {
1983
+ super(...arguments), this.itemId = "", this.label = "", this.icon = "", this.size = "medium", this.disabled = !1, this.tooltip = "";
1984
+ }
1985
+ static {
1986
+ this.shadowRootOptions = {
1987
+ ...w.shadowRootOptions,
1988
+ delegatesFocus: !0
1989
+ };
1990
+ }
1991
+ /**
1992
+ * Emit the canonical `item-click` event. Subclasses wire this to their
1993
+ * primary activation surface (typically `@click` on the inner button).
1994
+ * Previously the base bound a host-level click listener, which fired on
1995
+ * any bubbled click — clicking a checkbox input, a split-button's
1996
+ * chevron, or a dropdown trigger would all spuriously fire `item-click`
1997
+ * in addition to the kind-specific event. Item kinds now decide
1998
+ * explicitly when an item-click happens.
1999
+ */
2000
+ emitItemClick(e) {
2001
+ this.disabled || this.dispatchEvent(
2002
+ new CustomEvent("item-click", {
2003
+ detail: { itemId: this.itemId },
2004
+ bubbles: !0,
2005
+ composed: !0
2006
+ })
2007
+ );
2008
+ }
2009
+ getSizeClass() {
2010
+ return `ribbon-item-${this.size}`;
2011
+ }
2012
+ getDisabledAttr() {
2013
+ return this.disabled ? "disabled" : null;
2014
+ }
2015
+ /** Mirror `size` → `data-size` for FR-5 consumer-CSS hooks. */
2016
+ updated(e) {
2017
+ super.updated(e), e.has("size") && this.setAttribute("data-size", this.size);
2018
+ }
2019
+ }
2020
+ L([
2021
+ l({ type: String, attribute: "item-id" })
2022
+ ], v.prototype, "itemId");
2023
+ L([
2024
+ l({ type: String })
2025
+ ], v.prototype, "label");
2026
+ L([
2027
+ l({ type: String })
2028
+ ], v.prototype, "icon");
2029
+ L([
2030
+ l({ type: String, reflect: !0 })
2031
+ ], v.prototype, "size");
2032
+ L([
2033
+ l({ type: Boolean })
2034
+ ], v.prototype, "disabled");
2035
+ L([
2036
+ l({ type: String })
2037
+ ], v.prototype, "tooltip");
2038
+ class fe extends v {
2039
+ static {
2040
+ this.styles = [P, g`
2041
+ :host { display: inline-flex; }
2042
+ :host([size="small"]) { display: flex; width: 100%; }
2043
+ .ribbon-button {
2044
+ display: inline-flex;
2045
+ flex-direction: column;
2046
+ align-items: center;
2047
+ justify-content: center;
2048
+ gap: 4px;
2049
+ background: transparent;
2050
+ border: 1px solid transparent;
2051
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2052
+ cursor: pointer;
2053
+ color: inherit;
2054
+ font-size: 12px;
2055
+ padding: 4px 6px;
2056
+ min-width: 28px;
2057
+ }
2058
+ .ribbon-button:hover {
2059
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2060
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2061
+ }
2062
+ .ribbon-button:active {
2063
+ background: var(--bs-ribbon-item-pressed-bg, #dee2e6);
2064
+ }
2065
+ .ribbon-button:focus-visible {
2066
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
2067
+ outline-offset: -2px;
2068
+ }
2069
+ .ribbon-button:disabled {
2070
+ opacity: 0.5;
2071
+ cursor: not-allowed;
2072
+ }
2073
+ .ribbon-button.ribbon-item-large {
2074
+ flex-direction: column;
2075
+ padding: 6px 10px;
2076
+ min-width: 56px;
2077
+ }
2078
+ .ribbon-button.ribbon-item-large .ribbon-button-icon { font-size: 28px; }
2079
+ .ribbon-button.ribbon-item-medium { flex-direction: row; padding: 4px 8px; }
2080
+ .ribbon-button.ribbon-item-small {
2081
+ flex-direction: row;
2082
+ padding: 4px 6px;
2083
+ width: 100%;
2084
+ justify-content: flex-start;
2085
+ }
2086
+ .ribbon-button-icon { line-height: 1; font-size: 16px; }
2087
+ .ribbon-button-label { white-space: nowrap; }
2088
+ `];
2089
+ }
2090
+ render() {
2091
+ return d`
2092
+ <button
2093
+ class="ribbon-button ${this.getSizeClass()}"
2094
+ ?disabled="${this.disabled}"
2095
+ title="${this.tooltip || this.label}"
2096
+ @click="${this.emitItemClick}"
2097
+ >
2098
+ <span class="ribbon-button-icon">
2099
+ <slot name="icon">${this.icon ? this.icon : ""}</slot>
2100
+ </span>
2101
+ ${this.label ? d`<span class="ribbon-button-label">${this.label}</span>` : ""}
2102
+ </button>
2103
+ `;
2104
+ }
2105
+ }
2106
+ customElements.define("mp-ribbon-button", fe);
2107
+ var ge = Object.defineProperty, H = (s, e, o, r) => {
2108
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2109
+ (n = s[i]) && (t = n(e, o, t) || t);
2110
+ return t && ge(e, o, t), t;
2111
+ };
2112
+ class q extends v {
2113
+ constructor() {
2114
+ super(...arguments), this.overlay = new G(this, {
2115
+ anchor: () => this.chevronEl,
2116
+ panel: () => this.panelEl,
2117
+ onOpen: () => this.emitMenuToggle(!0),
2118
+ onClose: () => this.emitMenuToggle(!1)
2119
+ }), this.onMainClick = (e) => {
2120
+ this.disabled || (e.stopPropagation(), this.dispatchEvent(
2121
+ new CustomEvent("main-action", {
2122
+ detail: { itemId: this.itemId },
2123
+ bubbles: !0,
2124
+ composed: !0
2125
+ })
2126
+ ), this.dispatchEvent(
2127
+ new CustomEvent("item-click", {
2128
+ detail: { itemId: this.itemId },
2129
+ bubbles: !0,
2130
+ composed: !0
2131
+ })
2132
+ ));
2133
+ }, this.onChevronClick = async (e) => {
2134
+ this.disabled || (e.stopPropagation(), await this.overlay.toggle());
2135
+ }, this.onChevronKeyDown = async (e) => {
2136
+ this.disabled || e.key === "ArrowDown" && (e.preventDefault(), this.overlay.isOpen || await this.overlay.open());
2137
+ }, this.onMenuClick = (e) => {
2138
+ e.target.closest(
2139
+ 'mp-ribbon-menu-item, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]'
2140
+ ) && this.overlay.close();
2141
+ };
2142
+ }
2143
+ static {
2144
+ this.styles = [P, g`
2145
+ :host { display: inline-flex; position: relative; }
2146
+ .ribbon-split-button {
2147
+ display: inline-flex;
2148
+ align-items: stretch;
2149
+ border: 1px solid transparent;
2150
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2151
+ overflow: hidden;
2152
+ }
2153
+ .ribbon-split-button:hover {
2154
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2155
+ }
2156
+ .ribbon-split-button-main,
2157
+ .ribbon-split-button-dropdown {
2158
+ background: transparent;
2159
+ border: none;
2160
+ cursor: pointer;
2161
+ color: inherit;
2162
+ font-size: 12px;
2163
+ font-family: inherit;
2164
+ }
2165
+ .ribbon-split-button-main {
2166
+ display: inline-flex;
2167
+ flex-direction: column;
2168
+ align-items: center;
2169
+ justify-content: center;
2170
+ gap: 4px;
2171
+ padding: 4px 6px;
2172
+ min-width: 28px;
2173
+ }
2174
+ .ribbon-split-button-dropdown {
2175
+ display: inline-flex;
2176
+ align-items: center;
2177
+ justify-content: center;
2178
+ padding: 0 4px;
2179
+ border-inline-start: 1px solid transparent;
2180
+ min-width: 16px;
2181
+ font-size: 9px;
2182
+ }
2183
+ .ribbon-split-button-main:hover:not(:disabled),
2184
+ .ribbon-split-button-dropdown:hover:not(:disabled) {
2185
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2186
+ }
2187
+ .ribbon-split-button-main:hover:not(:disabled) + .ribbon-split-button-dropdown {
2188
+ border-inline-start-color: var(--bs-ribbon-item-hover-border, #ced4da);
2189
+ }
2190
+ .ribbon-split-button-main:focus-visible,
2191
+ .ribbon-split-button-dropdown:focus-visible {
2192
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
2193
+ outline-offset: -2px;
2194
+ }
2195
+ .ribbon-split-button-main:disabled,
2196
+ .ribbon-split-button-dropdown:disabled {
2197
+ opacity: 0.5;
2198
+ cursor: not-allowed;
2199
+ }
2200
+ .ribbon-button-icon { line-height: 1; font-size: 16px; }
2201
+ .ribbon-button-label { white-space: nowrap; }
2202
+
2203
+ :host(.ribbon-item-large) .ribbon-split-button {
2204
+ flex-direction: column;
2205
+ }
2206
+ :host(.ribbon-item-large) .ribbon-split-button-main {
2207
+ padding: 6px 10px;
2208
+ min-width: 56px;
2209
+ }
2210
+ :host(.ribbon-item-large) .ribbon-split-button-main .ribbon-button-icon {
2211
+ font-size: 28px;
2212
+ }
2213
+ :host(.ribbon-item-large) .ribbon-split-button-dropdown {
2214
+ border-inline-start: none;
2215
+ border-top: 1px solid transparent;
2216
+ padding: 2px 0;
2217
+ min-width: 0;
2218
+ }
2219
+ :host(.ribbon-item-large) .ribbon-split-button-main:hover:not(:disabled) + .ribbon-split-button-dropdown {
2220
+ border-inline-start-color: transparent;
2221
+ border-top-color: var(--bs-ribbon-item-hover-border, #ced4da);
2222
+ }
2223
+
2224
+ .menu-panel {
2225
+ position: fixed;
2226
+ z-index: 1050;
2227
+ background: var(--bs-ribbon-tabpanel-bg, #fff);
2228
+ color: inherit;
2229
+ border: 1px solid var(--bs-ribbon-container-border, #d0d0d0);
2230
+ border-radius: 4px;
2231
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
2232
+ padding: 4px 0;
2233
+ display: none;
2234
+ min-width: 180px;
2235
+ max-width: min(320px, calc(100vw - 16px));
2236
+ }
2237
+ :host([data-menu-open]) .menu-panel { display: block; }
2238
+ `];
2239
+ }
2240
+ render() {
2241
+ return d`
2242
+ <div
2243
+ class="ribbon-split-button ${this.getSizeClass()}"
2244
+ role="group"
2245
+ aria-label="${this.label}"
2246
+ >
2247
+ <button
2248
+ class="ribbon-split-button-main"
2249
+ ?disabled="${this.disabled}"
2250
+ title="${this.tooltip || this.label}"
2251
+ @click="${this.onMainClick}"
2252
+ >
2253
+ <span class="ribbon-button-icon">
2254
+ <slot name="icon">${this.icon ? this.icon : ""}</slot>
2255
+ </span>
2256
+ ${this.label ? d`<span class="ribbon-button-label">${this.label}</span>` : ""}
2257
+ </button>
2258
+ <button
2259
+ class="ribbon-split-button-dropdown"
2260
+ ?disabled="${this.disabled}"
2261
+ aria-label="${this.label} options"
2262
+ aria-haspopup="menu"
2263
+ aria-expanded="${this.overlay.isOpen}"
2264
+ @click="${this.onChevronClick}"
2265
+ @keydown="${this.onChevronKeyDown}"
2266
+ >▼</button>
2267
+ </div>
2268
+ <div class="menu-panel" role="menu" @click="${this.onMenuClick}">
2269
+ <slot name="menu"></slot>
2270
+ </div>
2271
+ `;
2272
+ }
2273
+ emitMenuToggle(e) {
2274
+ this.dispatchEvent(
2275
+ new CustomEvent("menu-toggle", {
2276
+ detail: { itemId: this.itemId, open: e },
2277
+ bubbles: !0,
2278
+ composed: !0
2279
+ })
2280
+ );
2281
+ }
2282
+ }
2283
+ H([
2284
+ S(".ribbon-split-button")
2285
+ ], q.prototype, "groupEl");
2286
+ H([
2287
+ S(".ribbon-split-button-dropdown")
2288
+ ], q.prototype, "chevronEl");
2289
+ H([
2290
+ S(".menu-panel")
2291
+ ], q.prototype, "panelEl");
2292
+ customElements.define("mp-ribbon-split-button", q);
2293
+ var me = Object.defineProperty, X = (s, e, o, r) => {
2294
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2295
+ (n = s[i]) && (t = n(e, o, t) || t);
2296
+ return t && me(e, o, t), t;
2297
+ };
2298
+ class V extends v {
2299
+ constructor() {
2300
+ super(...arguments), this.overlay = new G(this, {
2301
+ anchor: () => this.triggerEl,
2302
+ panel: () => this.panelEl,
2303
+ onOpen: () => {
2304
+ this.dispatchEvent(
2305
+ new CustomEvent("menu-toggle", {
2306
+ detail: { itemId: this.itemId, open: !0 },
2307
+ bubbles: !0,
2308
+ composed: !0
2309
+ })
2310
+ );
2311
+ },
2312
+ onClose: () => {
2313
+ this.dispatchEvent(
2314
+ new CustomEvent("menu-toggle", {
2315
+ detail: { itemId: this.itemId, open: !1 },
2316
+ bubbles: !0,
2317
+ composed: !0
2318
+ })
2319
+ );
2320
+ }
2321
+ }), this.onTriggerClick = async (e) => {
2322
+ this.disabled || (e.stopPropagation(), await this.overlay.toggle());
2323
+ }, this.onTriggerKeyDown = async (e) => {
2324
+ this.disabled || (e.key === "ArrowDown" || e.key === "ArrowDown" && e.altKey) && (e.preventDefault(), this.overlay.isOpen || await this.overlay.open());
2325
+ }, this.onMenuClick = (e) => {
2326
+ e.target.closest('mp-ribbon-menu-item, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]') && this.overlay.close();
2327
+ };
2328
+ }
2329
+ static {
2330
+ this.styles = [P, g`
2331
+ :host { display: inline-flex; position: relative; }
2332
+ :host([size="small"]) { display: flex; width: 100%; }
2333
+ .ribbon-dropdown-button {
2334
+ display: inline-flex;
2335
+ flex-direction: row;
2336
+ align-items: center;
2337
+ justify-content: center;
2338
+ gap: 4px;
2339
+ background: transparent;
2340
+ border: 1px solid transparent;
2341
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2342
+ cursor: pointer;
2343
+ color: inherit;
2344
+ font-size: 12px;
2345
+ font-family: inherit;
2346
+ padding: 4px 6px;
2347
+ min-width: 28px;
2348
+ }
2349
+ .ribbon-dropdown-button.ribbon-item-large {
2350
+ flex-direction: column;
2351
+ padding: 6px 10px;
2352
+ min-width: 56px;
2353
+ }
2354
+ .ribbon-dropdown-button.ribbon-item-large .ribbon-button-icon { font-size: 28px; }
2355
+ .ribbon-dropdown-button.ribbon-item-medium { padding: 4px 8px; }
2356
+ .ribbon-dropdown-button.ribbon-item-small {
2357
+ padding: 4px 6px;
2358
+ width: 100%;
2359
+ justify-content: flex-start;
2360
+ }
2361
+ .ribbon-dropdown-button.ribbon-item-small .ribbon-button-label {
2362
+ flex: 1;
2363
+ justify-content: space-between;
2364
+ }
2365
+ .ribbon-dropdown-button:hover:not(:disabled) {
2366
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2367
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2368
+ }
2369
+ .ribbon-dropdown-button:focus-visible {
2370
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
2371
+ outline-offset: -2px;
2372
+ }
2373
+ .ribbon-dropdown-button:disabled {
2374
+ opacity: 0.5;
2375
+ cursor: not-allowed;
2376
+ }
2377
+ .ribbon-button-icon { line-height: 1; font-size: 16px; }
2378
+ .ribbon-button-label {
2379
+ display: inline-flex;
2380
+ align-items: center;
2381
+ gap: 2px;
2382
+ white-space: nowrap;
2383
+ }
2384
+ .ribbon-dropdown-arrow { font-size: 9px; opacity: 0.6; }
2385
+
2386
+ .menu-panel {
2387
+ position: fixed;
2388
+ z-index: 1050;
2389
+ background: var(--bs-ribbon-tabpanel-bg, #fff);
2390
+ color: inherit;
2391
+ border: 1px solid var(--bs-ribbon-container-border, #d0d0d0);
2392
+ border-radius: 4px;
2393
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
2394
+ padding: 4px 0;
2395
+ display: none;
2396
+ min-width: 180px;
2397
+ max-width: min(320px, calc(100vw - 16px));
2398
+ }
2399
+ :host([data-menu-open]) .menu-panel { display: block; }
2400
+ `];
2401
+ }
2402
+ render() {
2403
+ return d`
2404
+ <button
2405
+ class="ribbon-dropdown-button ${this.getSizeClass()}"
2406
+ ?disabled="${this.disabled}"
2407
+ title="${this.tooltip || this.label}"
2408
+ aria-haspopup="menu"
2409
+ aria-expanded="${this.overlay.isOpen}"
2410
+ @click="${this.onTriggerClick}"
2411
+ @keydown="${this.onTriggerKeyDown}"
2412
+ >
2413
+ <span class="ribbon-button-icon">
2414
+ <slot name="icon">${this.icon ? this.icon : ""}</slot>
2415
+ </span>
2416
+ <span class="ribbon-button-label">
2417
+ ${this.label ? d`<span>${this.label}</span>` : ""}
2418
+ <span class="ribbon-dropdown-arrow">▼</span>
2419
+ </span>
2420
+ </button>
2421
+ <div class="menu-panel" role="menu" @click="${this.onMenuClick}">
2422
+ <slot name="menu"></slot>
2423
+ </div>
2424
+ `;
2425
+ }
2426
+ }
2427
+ X([
2428
+ S(".ribbon-dropdown-button")
2429
+ ], V.prototype, "triggerEl");
2430
+ X([
2431
+ S(".menu-panel")
2432
+ ], V.prototype, "panelEl");
2433
+ customElements.define("mp-ribbon-dropdown-button", V);
2434
+ var ve = Object.defineProperty, xe = (s, e, o, r) => {
2435
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2436
+ (n = s[i]) && (t = n(e, o, t) || t);
2437
+ return t && ve(e, o, t), t;
2438
+ };
2439
+ class J extends v {
2440
+ constructor() {
2441
+ super(...arguments), this.pressed = !1;
2442
+ }
2443
+ static {
2444
+ this.styles = [P, g`
2445
+ :host { display: inline-flex; }
2446
+ :host([size="small"]) { display: flex; width: 100%; }
2447
+ .ribbon-toggle-button {
2448
+ display: inline-flex;
2449
+ flex-direction: column;
2450
+ align-items: center;
2451
+ justify-content: center;
2452
+ gap: 4px;
2453
+ background: transparent;
2454
+ border: 1px solid transparent;
2455
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2456
+ cursor: pointer;
2457
+ color: inherit;
2458
+ font-size: 12px;
2459
+ font-family: inherit;
2460
+ padding: 4px 6px;
2461
+ min-width: 28px;
2462
+ }
2463
+ .ribbon-toggle-button:hover:not(:disabled):not(.pressed) {
2464
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2465
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2466
+ }
2467
+ .ribbon-toggle-button.pressed {
2468
+ background: var(--bs-ribbon-item-pressed-bg, #dee2e6);
2469
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2470
+ }
2471
+ .ribbon-toggle-button:focus-visible {
2472
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
2473
+ outline-offset: -2px;
2474
+ }
2475
+ .ribbon-toggle-button:disabled {
2476
+ opacity: 0.5;
2477
+ cursor: not-allowed;
2478
+ }
2479
+ .ribbon-toggle-button.ribbon-item-large {
2480
+ flex-direction: column;
2481
+ padding: 6px 10px;
2482
+ min-width: 56px;
2483
+ }
2484
+ .ribbon-toggle-button.ribbon-item-large .ribbon-button-icon { font-size: 28px; }
2485
+ .ribbon-toggle-button.ribbon-item-medium { flex-direction: row; padding: 4px 8px; }
2486
+ .ribbon-toggle-button.ribbon-item-small {
2487
+ flex-direction: row;
2488
+ padding: 4px 6px;
2489
+ width: 100%;
2490
+ justify-content: flex-start;
2491
+ }
2492
+ .ribbon-button-icon { line-height: 1; font-size: 16px; }
2493
+ .ribbon-button-label { white-space: nowrap; }
2494
+ `];
2495
+ }
2496
+ render() {
2497
+ return d`
2498
+ <button
2499
+ class="ribbon-toggle-button ${this.getSizeClass()} ${this.pressed ? "pressed" : ""}"
2500
+ ?disabled="${this.disabled}"
2501
+ aria-pressed="${this.pressed}"
2502
+ title="${this.tooltip || this.label}"
2503
+ @click="${this.onToggleClick}"
2504
+ >
2505
+ <span class="ribbon-button-icon">
2506
+ <slot name="icon">${this.icon ? this.icon : ""}</slot>
2507
+ </span>
2508
+ ${this.label ? d`<span class="ribbon-button-label">${this.label}</span>` : ""}
2509
+ </button>
2510
+ `;
2511
+ }
2512
+ onToggleClick() {
2513
+ this.disabled || (this.pressed = !this.pressed, this.dispatchEvent(
2514
+ new CustomEvent("toggle", {
2515
+ detail: { itemId: this.itemId, pressed: this.pressed },
2516
+ bubbles: !0,
2517
+ composed: !0
2518
+ })
2519
+ ));
2520
+ }
2521
+ }
2522
+ xe([
2523
+ l({ type: Boolean, reflect: !0 })
2524
+ ], J.prototype, "pressed");
2525
+ customElements.define("mp-ribbon-toggle-button", J);
2526
+ var ye = Object.defineProperty, we = (s, e, o, r) => {
2527
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2528
+ (n = s[i]) && (t = n(e, o, t) || t);
2529
+ return t && ye(e, o, t), t;
2530
+ };
2531
+ class ee extends v {
2532
+ constructor() {
2533
+ super(...arguments), this.checked = !1;
2534
+ }
2535
+ static {
2536
+ this.styles = g`
2537
+ :host { display: inline-flex; align-items: center; }
2538
+ :host([size="small"]) { display: flex; width: 100%; }
2539
+ .ribbon-checkbox {
2540
+ display: inline-flex;
2541
+ align-items: center;
2542
+ gap: 4px;
2543
+ cursor: pointer;
2544
+ color: inherit;
2545
+ font-size: 12px;
2546
+ font-family: inherit;
2547
+ padding: 4px 6px;
2548
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2549
+ user-select: none;
2550
+ }
2551
+ .ribbon-checkbox:hover:not(.disabled) {
2552
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2553
+ }
2554
+ .ribbon-checkbox.disabled {
2555
+ opacity: 0.5;
2556
+ cursor: not-allowed;
2557
+ }
2558
+ .ribbon-checkbox input {
2559
+ margin: 0;
2560
+ cursor: inherit;
2561
+ accent-color: var(--bs-ribbon-app-accent, #0d6efd);
2562
+ }
2563
+ .ribbon-checkbox.ribbon-item-small {
2564
+ width: 100%;
2565
+ }
2566
+ .ribbon-checkbox-label { white-space: nowrap; }
2567
+ `;
2568
+ }
2569
+ render() {
2570
+ return d`
2571
+ <label
2572
+ class="ribbon-checkbox ${this.getSizeClass()} ${this.disabled ? "disabled" : ""}"
2573
+ title="${this.tooltip || this.label}"
2574
+ >
2575
+ <input
2576
+ type="checkbox"
2577
+ ?checked="${this.checked}"
2578
+ ?disabled="${this.disabled}"
2579
+ @change="${this.onCheckChange}"
2580
+ />
2581
+ <span class="ribbon-checkbox-label">${this.label}</span>
2582
+ </label>
2583
+ `;
2584
+ }
2585
+ onCheckChange(e) {
2586
+ if (this.disabled) return;
2587
+ const o = e.target;
2588
+ this.checked = o.checked, this.dispatchEvent(
2589
+ new CustomEvent("check-change", {
2590
+ detail: { itemId: this.itemId, checked: this.checked },
2591
+ bubbles: !0,
2592
+ composed: !0
2593
+ })
2594
+ );
2595
+ }
2596
+ }
2597
+ we([
2598
+ l({ type: Boolean, reflect: !0 })
2599
+ ], ee.prototype, "checked");
2600
+ customElements.define("mp-ribbon-checkbox", ee);
2601
+ var ke = Object.defineProperty, te = (s, e, o, r) => {
2602
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2603
+ (n = s[i]) && (t = n(e, o, t) || t);
2604
+ return t && ke(e, o, t), t;
2605
+ };
2606
+ class Q extends v {
2607
+ constructor() {
2608
+ super(...arguments), this.value = "", this.options = [];
2609
+ }
2610
+ static {
2611
+ this.styles = g`
2612
+ :host { display: inline-flex; align-items: center; }
2613
+ .ribbon-combobox-select {
2614
+ background: var(--bs-ribbon-tabpanel-bg, #fff);
2615
+ color: inherit;
2616
+ border: 1px solid var(--bs-ribbon-item-hover-border, #ced4da);
2617
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2618
+ padding: 3px 4px;
2619
+ font-size: 12px;
2620
+ font-family: inherit;
2621
+ min-width: 100px;
2622
+ max-width: 200px;
2623
+ }
2624
+ .ribbon-combobox-select:focus-visible {
2625
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
2626
+ outline-offset: -2px;
2627
+ }
2628
+ .ribbon-combobox-select:disabled {
2629
+ opacity: 0.5;
2630
+ cursor: not-allowed;
2631
+ }
2632
+ `;
2633
+ }
2634
+ render() {
2635
+ return d`
2636
+ <select
2637
+ class="ribbon-combobox-select"
2638
+ ?disabled="${this.disabled}"
2639
+ aria-label="${this.label || ""}"
2640
+ title="${this.tooltip || this.label}"
2641
+ @change="${this.onComboChange}"
2642
+ >
2643
+ ${this.options.map(
2644
+ (e) => d`<option
2645
+ value="${e.value}"
2646
+ ?selected="${e.value === this.value}"
2647
+ >${e.label}</option>`
2648
+ )}
2649
+ </select>
2650
+ `;
2651
+ }
2652
+ onComboChange(e) {
2653
+ if (this.disabled) return;
2654
+ const o = e.target;
2655
+ this.value = o.value, this.dispatchEvent(
2656
+ new CustomEvent("value-change", {
2657
+ detail: { itemId: this.itemId, value: this.value },
2658
+ bubbles: !0,
2659
+ composed: !0
2660
+ })
2661
+ );
2662
+ }
2663
+ }
2664
+ te([
2665
+ l({ type: String })
2666
+ ], Q.prototype, "value");
2667
+ te([
2668
+ l({ type: Array })
2669
+ ], Q.prototype, "options");
2670
+ customElements.define("mp-ribbon-combobox", Q);
2671
+ var Ae = Object.defineProperty, Fe = (s, e, o, r) => {
2672
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2673
+ (n = s[i]) && (t = n(e, o, t) || t);
2674
+ return t && Ae(e, o, t), t;
2675
+ };
2676
+ class oe extends v {
2677
+ constructor() {
2678
+ super(...arguments), this.color = "#000000";
2679
+ }
2680
+ static {
2681
+ this.styles = g`
2682
+ :host { display: inline-flex; align-items: center; }
2683
+ :host([size="small"]) { display: flex; width: 100%; }
2684
+ .ribbon-color-picker {
2685
+ display: inline-flex;
2686
+ align-items: center;
2687
+ gap: 4px;
2688
+ padding: 4px 6px;
2689
+ cursor: pointer;
2690
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2691
+ color: inherit;
2692
+ font-size: 12px;
2693
+ font-family: inherit;
2694
+ border: 1px solid transparent;
2695
+ }
2696
+ .ribbon-color-picker.large {
2697
+ flex-direction: column;
2698
+ padding: 6px 10px;
2699
+ }
2700
+ .ribbon-color-picker.small { width: 100%; }
2701
+ .ribbon-color-picker:hover:not(.disabled) {
2702
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2703
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2704
+ }
2705
+ .ribbon-color-picker.disabled {
2706
+ opacity: 0.5;
2707
+ cursor: not-allowed;
2708
+ }
2709
+ .ribbon-color-picker-input {
2710
+ width: 22px;
2711
+ height: 16px;
2712
+ padding: 0;
2713
+ border: 1px solid var(--bs-ribbon-item-hover-border, #ced4da);
2714
+ border-radius: 2px;
2715
+ cursor: inherit;
2716
+ background: transparent;
2717
+ flex: 0 0 auto;
2718
+ }
2719
+ .ribbon-color-picker.large .ribbon-color-picker-input {
2720
+ width: 36px;
2721
+ height: 28px;
2722
+ }
2723
+ .ribbon-color-picker-label { white-space: nowrap; }
2724
+ `;
2725
+ }
2726
+ render() {
2727
+ const e = this.size === "large" ? "large" : this.size === "small" ? "small" : "medium";
2728
+ return d`
2729
+ <label
2730
+ class="ribbon-color-picker ${e} ${this.disabled ? "disabled" : ""}"
2731
+ title="${this.tooltip || this.label}"
2732
+ >
2733
+ <input
2734
+ type="color"
2735
+ class="ribbon-color-picker-input"
2736
+ .value="${this.color}"
2737
+ ?disabled="${this.disabled}"
2738
+ aria-label="${this.label}"
2739
+ @input="${this.onColorChange}"
2740
+ />
2741
+ ${this.label ? d`<span class="ribbon-color-picker-label">${this.label}</span>` : ""}
2742
+ </label>
2743
+ `;
2744
+ }
2745
+ onColorChange(e) {
2746
+ if (this.disabled) return;
2747
+ const o = e.target;
2748
+ this.color = o.value, this.dispatchEvent(
2749
+ new CustomEvent("color-change", {
2750
+ detail: { itemId: this.itemId, color: this.color },
2751
+ bubbles: !0,
2752
+ composed: !0
2753
+ })
2754
+ );
2755
+ }
2756
+ }
2757
+ Fe([
2758
+ l({ type: String, reflect: !0 })
2759
+ ], oe.prototype, "color");
2760
+ customElements.define("mp-ribbon-color-picker", oe);
2761
+ var Ce = Object.defineProperty, ie = (s, e, o, r) => {
2762
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2763
+ (n = s[i]) && (t = n(e, o, t) || t);
2764
+ return t && Ce(e, o, t), t;
2765
+ };
2766
+ class Y extends v {
2767
+ constructor() {
2768
+ super(...arguments), this.selectedValue = "", this.buttons = [];
2769
+ }
2770
+ static {
2771
+ this.styles = g`
2772
+ :host { display: inline-flex; }
2773
+ .ribbon-group-button {
2774
+ display: inline-flex;
2775
+ align-items: stretch;
2776
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2777
+ }
2778
+ .ribbon-group-button-item {
2779
+ background: transparent;
2780
+ border: 1px solid transparent;
2781
+ cursor: pointer;
2782
+ color: inherit;
2783
+ font-size: 12px;
2784
+ font-family: inherit;
2785
+ padding: 4px 8px;
2786
+ display: inline-flex;
2787
+ align-items: center;
2788
+ gap: 4px;
2789
+ }
2790
+ .ribbon-group-button-item:hover:not(:disabled):not(.selected) {
2791
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2792
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2793
+ }
2794
+ .ribbon-group-button-item.selected {
2795
+ background: var(--bs-ribbon-item-pressed-bg, #dee2e6);
2796
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2797
+ }
2798
+ .ribbon-group-button-item:focus-visible {
2799
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
2800
+ outline-offset: -2px;
2801
+ }
2802
+ .ribbon-group-button-item:disabled {
2803
+ opacity: 0.5;
2804
+ cursor: not-allowed;
2805
+ }
2806
+ .ribbon-group-button-icon { line-height: 1; }
2807
+ .ribbon-group-button-label { white-space: nowrap; }
2808
+ `;
2809
+ }
2810
+ render() {
2811
+ return d`
2812
+ <div
2813
+ class="ribbon-group-button"
2814
+ role="radiogroup"
2815
+ aria-label="${this.label}"
2816
+ >
2817
+ ${this.buttons.map(
2818
+ (e) => d`
2819
+ <button
2820
+ class="ribbon-group-button-item ${this.selectedValue === e.value ? "selected" : ""}"
2821
+ ?disabled="${this.disabled}"
2822
+ role="radio"
2823
+ aria-checked="${this.selectedValue === e.value}"
2824
+ title="${e.label}"
2825
+ @click="${(o) => this.onSelect(o, e.value)}"
2826
+ >
2827
+ ${e.icon ? d`<span class="ribbon-group-button-icon">${e.icon}</span>` : ""}
2828
+ ${e.label ? d`<span class="ribbon-group-button-label">${e.label}</span>` : ""}
2829
+ </button>
2830
+ `
2831
+ )}
2832
+ </div>
2833
+ `;
2834
+ }
2835
+ onSelect(e, o) {
2836
+ e.stopPropagation(), !this.disabled && (this.selectedValue = o, this.dispatchEvent(
2837
+ new CustomEvent("group-select", {
2838
+ detail: { itemId: this.itemId, value: this.selectedValue },
2839
+ bubbles: !0,
2840
+ composed: !0
2841
+ })
2842
+ ));
2843
+ }
2844
+ }
2845
+ ie([
2846
+ l({ type: String, attribute: "selected-value", reflect: !0 })
2847
+ ], Y.prototype, "selectedValue");
2848
+ ie([
2849
+ l({ type: Array })
2850
+ ], Y.prototype, "buttons");
2851
+ customElements.define("mp-ribbon-group-button", Y);
2852
+ var $e = Object.defineProperty, Ie = (s, e, o, r) => {
2853
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2854
+ (n = s[i]) && (t = n(e, o, t) || t);
2855
+ return t && $e(e, o, t), t;
2856
+ };
2857
+ class re extends v {
2858
+ constructor() {
2859
+ super(...arguments), this.columns = 4;
2860
+ }
2861
+ static {
2862
+ this.styles = g`
2863
+ :host { display: inline-flex; }
2864
+ .ribbon-gallery {
2865
+ display: grid;
2866
+ gap: 2px;
2867
+ padding: 2px;
2868
+ border: 1px solid var(--bs-ribbon-item-hover-border, #ced4da);
2869
+ border-radius: var(--bs-ribbon-item-radius, 3px);
2870
+ background: var(--bs-ribbon-tabpanel-bg, #fff);
2871
+ }
2872
+ `;
2873
+ }
2874
+ render() {
2875
+ return d`
2876
+ <div
2877
+ class="ribbon-gallery"
2878
+ role="listbox"
2879
+ aria-label="${this.label}"
2880
+ style="grid-template-columns: repeat(${this.columns}, 1fr);"
2881
+ >
2882
+ <slot></slot>
2883
+ </div>
2884
+ `;
2885
+ }
2886
+ }
2887
+ Ie([
2888
+ l({ type: Number })
2889
+ ], re.prototype, "columns");
2890
+ customElements.define("mp-ribbon-gallery", re);
2891
+ var Ee = Object.defineProperty, K = (s, e, o, r) => {
2892
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2893
+ (n = s[i]) && (t = n(e, o, t) || t);
2894
+ return t && Ee(e, o, t), t;
2895
+ };
2896
+ class M extends w {
2897
+ constructor() {
2898
+ super(...arguments), this.itemId = "", this.label = "", this.icon = "", this.selected = !1, this.disabled = !1;
2899
+ }
2900
+ static {
2901
+ this.styles = [P, g`
2902
+ :host { display: inline-flex; }
2903
+ .gallery-item {
2904
+ display: inline-flex;
2905
+ align-items: center;
2906
+ justify-content: center;
2907
+ width: 32px;
2908
+ height: 32px;
2909
+ cursor: pointer;
2910
+ background: transparent;
2911
+ border: 1px solid transparent;
2912
+ border-radius: 2px;
2913
+ color: inherit;
2914
+ font-size: 14px;
2915
+ font-family: inherit;
2916
+ }
2917
+ .gallery-item:hover:not(:disabled):not(.selected) {
2918
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
2919
+ border-color: var(--bs-ribbon-item-hover-border, #ced4da);
2920
+ }
2921
+ .gallery-item.selected {
2922
+ background: var(--bs-ribbon-item-pressed-bg, #dee2e6);
2923
+ border-color: var(--bs-ribbon-app-accent, #0d6efd);
2924
+ }
2925
+ .gallery-item:focus-visible {
2926
+ outline: 2px solid var(--bs-ribbon-app-accent, #0d6efd);
2927
+ outline-offset: -2px;
2928
+ }
2929
+ .gallery-item:disabled {
2930
+ opacity: 0.5;
2931
+ cursor: not-allowed;
2932
+ }
2933
+ `];
2934
+ }
2935
+ render() {
2936
+ return d`
2937
+ <button
2938
+ class="gallery-item ${this.selected ? "selected" : ""}"
2939
+ ?disabled="${this.disabled}"
2940
+ role="option"
2941
+ aria-selected="${this.selected}"
2942
+ aria-label="${this.label}"
2943
+ title="${this.label}"
2944
+ @click="${this.onClick}"
2945
+ >
2946
+ <slot name="icon">
2947
+ ${this.icon ? d`<span>${this.icon}</span>` : d`<span>${this.label}</span>`}
2948
+ </slot>
2949
+ </button>
2950
+ `;
2951
+ }
2952
+ onClick() {
2953
+ this.disabled || this.dispatchEvent(
2954
+ new CustomEvent("gallery-select", {
2955
+ detail: { itemId: this.itemId },
2956
+ bubbles: !0,
2957
+ composed: !0
2958
+ })
2959
+ );
2960
+ }
2961
+ }
2962
+ K([
2963
+ l({ type: String, attribute: "item-id" })
2964
+ ], M.prototype, "itemId");
2965
+ K([
2966
+ l({ type: String })
2967
+ ], M.prototype, "label");
2968
+ K([
2969
+ l({ type: String })
2970
+ ], M.prototype, "icon");
2971
+ K([
2972
+ l({ type: Boolean, reflect: !0 })
2973
+ ], M.prototype, "selected");
2974
+ K([
2975
+ l({ type: Boolean })
2976
+ ], M.prototype, "disabled");
2977
+ customElements.define("mp-ribbon-gallery-item", M);
2978
+ var Te = Object.defineProperty, ze = (s, e, o, r) => {
2979
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
2980
+ (n = s[i]) && (t = n(e, o, t) || t);
2981
+ return t && Te(e, o, t), t;
2982
+ };
2983
+ class ne extends w {
2984
+ constructor() {
2985
+ super(...arguments), this.size = "medium";
2986
+ }
2987
+ static {
2988
+ this.styles = g`
2989
+ :host { display: inline-flex; }
2990
+ :host([size="small"]) { display: flex; width: 100%; }
2991
+ `;
2992
+ }
2993
+ render() {
2994
+ return d`<slot></slot>`;
2995
+ }
2996
+ }
2997
+ ze([
2998
+ l({ type: String, reflect: !0 })
2999
+ ], ne.prototype, "size");
3000
+ customElements.define("mp-ribbon-template-item", ne);
3001
+ var Se = Object.defineProperty, D = (s, e, o, r) => {
3002
+ for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
3003
+ (n = s[i]) && (t = n(e, o, t) || t);
3004
+ return t && Se(e, o, t), t;
3005
+ };
3006
+ class R extends w {
3007
+ constructor() {
3008
+ super(...arguments), this.itemId = "", this.label = "", this.icon = "", this.kind = "action", this.checked = !1, this.disabled = !1;
3009
+ }
3010
+ static {
3011
+ this.shadowRootOptions = {
3012
+ ...w.shadowRootOptions,
3013
+ delegatesFocus: !0
3014
+ };
3015
+ }
3016
+ static {
3017
+ this.styles = g`
3018
+ :host { display: block; }
3019
+ .menu-item {
3020
+ display: flex;
3021
+ align-items: center;
3022
+ gap: 8px;
3023
+ padding: 6px 12px;
3024
+ background: transparent;
3025
+ border: none;
3026
+ cursor: pointer;
3027
+ color: inherit;
3028
+ font-size: 13px;
3029
+ font-family: inherit;
3030
+ width: 100%;
3031
+ text-align: left;
3032
+ white-space: nowrap;
3033
+ }
3034
+ .menu-item:hover:not(:disabled),
3035
+ .menu-item:focus-visible {
3036
+ background: var(--bs-ribbon-item-hover-bg, #e9ecef);
3037
+ outline: none;
3038
+ }
3039
+ .menu-item:disabled {
3040
+ opacity: 0.5;
3041
+ cursor: not-allowed;
3042
+ }
3043
+ @media (pointer: coarse) {
3044
+ .menu-item {
3045
+ min-height: 44px;
3046
+ padding: 10px 14px;
3047
+ }
3048
+ }
3049
+ .menu-item-check {
3050
+ width: 14px;
3051
+ flex: 0 0 auto;
3052
+ text-align: center;
3053
+ font-size: 11px;
3054
+ line-height: 1;
3055
+ }
3056
+ .menu-item-icon {
3057
+ width: 16px;
3058
+ text-align: center;
3059
+ flex: 0 0 auto;
3060
+ line-height: 1;
3061
+ }
3062
+ .menu-item-label { flex: 1; }
3063
+ `;
3064
+ }
3065
+ render() {
3066
+ const e = this.kind === "checkbox" ? "menuitemcheckbox" : this.kind === "radio" ? "menuitemradio" : "menuitem";
3067
+ return d`
3068
+ <button
3069
+ class="menu-item"
3070
+ role="${e}"
3071
+ aria-checked="${this.kind === "action" ? B : String(this.checked)}"
3072
+ ?disabled="${this.disabled}"
3073
+ @click="${this.onActivate}"
3074
+ >
3075
+ ${this.kind !== "action" ? d`<span class="menu-item-check">${this.checked ? "✓" : ""}</span>` : B}
3076
+ <span class="menu-item-icon">
3077
+ <slot name="icon">${this.icon ? this.icon : ""}</slot>
3078
+ </span>
3079
+ <span class="menu-item-label">${this.label}</span>
3080
+ </button>
3081
+ `;
3082
+ }
3083
+ onActivate() {
3084
+ this.disabled || (this.kind === "checkbox" ? this.checked = !this.checked : this.kind === "radio" && (this.checked = !0), this.dispatchEvent(
3085
+ new CustomEvent("menu-select", {
3086
+ detail: { itemId: this.itemId, checked: this.checked },
3087
+ bubbles: !0,
3088
+ composed: !0
3089
+ })
3090
+ ));
3091
+ }
3092
+ }
3093
+ D([
3094
+ l({ type: String, attribute: "item-id" })
3095
+ ], R.prototype, "itemId");
3096
+ D([
3097
+ l({ type: String })
3098
+ ], R.prototype, "label");
3099
+ D([
3100
+ l({ type: String })
3101
+ ], R.prototype, "icon");
3102
+ D([
3103
+ l({ type: String })
3104
+ ], R.prototype, "kind");
3105
+ D([
3106
+ l({ type: Boolean })
3107
+ ], R.prototype, "checked");
3108
+ D([
3109
+ l({ type: Boolean })
3110
+ ], R.prototype, "disabled");
3111
+ customElements.define("mp-ribbon-menu-item", R);
3112
+ class Oe extends w {
3113
+ static {
3114
+ this.styles = g`
3115
+ :host { display: block; }
3116
+ .separator {
3117
+ height: 1px;
3118
+ background: var(--bs-ribbon-group-separator, rgba(0, 0, 0, 0.12));
3119
+ margin: 4px 0;
3120
+ }
3121
+ `;
3122
+ }
3123
+ connectedCallback() {
3124
+ super.connectedCallback(), this.setAttribute("role", "separator");
3125
+ }
3126
+ render() {
3127
+ return d`<div class="separator"></div>`;
3128
+ }
3129
+ }
3130
+ customElements.define("mp-ribbon-menu-separator", Oe);
3131
+ export {
3132
+ N as MpQuickAccessToolbar,
3133
+ k as MpRibbon,
3134
+ fe as MpRibbonButton,
3135
+ ee as MpRibbonCheckBox,
3136
+ oe as MpRibbonColorPicker,
3137
+ Q as MpRibbonComboBox,
3138
+ j as MpRibbonContextualTabSet,
3139
+ V as MpRibbonDropdownButton,
3140
+ re as MpRibbonGallery,
3141
+ M as MpRibbonGalleryItem,
3142
+ ue as MpRibbonGroup,
3143
+ Y as MpRibbonGroupButton,
3144
+ v as MpRibbonItemBase,
3145
+ R as MpRibbonMenuItem,
3146
+ Oe as MpRibbonMenuSeparator,
3147
+ q as MpRibbonSplitButton,
3148
+ $ as MpRibbonTab,
3149
+ ne as MpRibbonTemplateItem,
3150
+ J as MpRibbonToggleButton
3151
+ };