@orangelogic/design-system 3.1.0 → 3.3.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 (112) hide show
  1. package/library/chunks/{asset-link-format.Ds5nq4mo.js → asset-link-format.BnIUG_vO.js} +19 -18
  2. package/library/chunks/{button.BnkkUqiI.js → button.CpY4FCwE.js} +1 -1
  3. package/library/chunks/{color-swatch-group.d5e1sYos.js → color-swatch-group.CTcv62MK.js} +11 -10
  4. package/library/chunks/{color-swatch.D6Gg5bpz.js → color-swatch.Caved2kL.js} +1 -1
  5. package/library/chunks/{confirm-popover.tftDINBg.js → confirm-popover.BSS1VhB2.js} +3 -3
  6. package/library/chunks/content-builder.BX4pHujE.js +60 -0
  7. package/library/chunks/{dialog.CzSaiGBF.js → dialog.ICoCAj6Z.js} +4 -4
  8. package/library/chunks/{document-viewer.B1EEIvUY.js → document-viewer.D6PxGcEL.js} +8 -7
  9. package/library/chunks/{dot-pagination.BqGFeFXK.js → dot-pagination.CzVpiv00.js} +1 -1
  10. package/library/chunks/{folder-select.CIqVGGFl.js → folder-select.DN-JomDt.js} +4 -4
  11. package/library/chunks/{header.CWlWNree.js → header.BQg_JjHw.js} +1 -1
  12. package/library/chunks/{i18n.DbXTTLXx.js → i18n.BA19xtyU.js} +6 -3
  13. package/library/chunks/{icon-button.BHC52xvk.js → icon-button.BWJ1Vqn5.js} +1 -1
  14. package/library/chunks/{iframe.-GCTFas1.js → iframe.Dm-nXSBv.js} +1 -1
  15. package/library/chunks/{image.CTMzUqCC.js → image.B-4cVbol.js} +187 -188
  16. package/library/chunks/{input.33UmFGqR.js → input.xgeLCG8I.js} +1 -1
  17. package/library/chunks/{markdown.Dga4_SbU.js → markdown.bkEjjjS9.js} +2 -2
  18. package/library/chunks/menu-item.DgUMVYe5.js +493 -0
  19. package/library/chunks/{option.B6odSlS2.js → option.jeaj7_Lr.js} +1 -1
  20. package/library/chunks/{pagination.D50ned8_.js → pagination.CSPKsj4y.js} +5 -5
  21. package/library/chunks/{tab-group.DE0RsMX4.js → tab-group.BSl6GdIO.js} +4 -4
  22. package/library/chunks/{toast.CXEAfCvN.js → toast.C5Ir5yKA.js} +1 -1
  23. package/library/chunks/transformation.CWKaoGaY.js +254 -0
  24. package/library/chunks/{tree.CmEdKtzK.js → tree.DYFFjW1-.js} +1 -1
  25. package/library/components/alert.js +2 -2
  26. package/library/components/asset-link-format.js +4 -4
  27. package/library/components/atoms.js +31 -31
  28. package/library/components/audio.js +2 -2
  29. package/library/components/border-input-group.js +2 -2
  30. package/library/components/breadcrumb.js +1 -1
  31. package/library/components/button.js +2 -2
  32. package/library/components/color-picker.js +3 -3
  33. package/library/components/color-swatch-group.js +5 -5
  34. package/library/components/color-swatch.js +2 -2
  35. package/library/components/confirm-popover.js +4 -4
  36. package/library/components/copy-button.js +1 -1
  37. package/library/components/corner-position-input-group.js +3 -3
  38. package/library/components/date-calendar.js +1 -1
  39. package/library/components/details.js +1 -1
  40. package/library/components/dialog.js +3 -3
  41. package/library/components/document-viewer.js +3 -3
  42. package/library/components/dot-pagination.js +2 -2
  43. package/library/components/drawer.js +4 -4
  44. package/library/components/dropdown.js +2 -2
  45. package/library/components/dynamic-select.js +4 -4
  46. package/library/components/e-chart.js +1 -1
  47. package/library/components/element-clamp.js +2 -2
  48. package/library/components/file-on-demand.js +9 -9
  49. package/library/components/folder-select.js +4 -4
  50. package/library/components/format-bytes.js +1 -1
  51. package/library/components/format-date.js +1 -1
  52. package/library/components/format-number.js +1 -1
  53. package/library/components/format-time.js +1 -1
  54. package/library/components/header.js +2 -2
  55. package/library/components/icon-button.js +2 -2
  56. package/library/components/iframe.js +2 -2
  57. package/library/components/image-comparer.js +1 -1
  58. package/library/components/image.js +3 -4
  59. package/library/components/input.js +2 -2
  60. package/library/components/line-clamp.js +1 -1
  61. package/library/components/markdown.js +3 -3
  62. package/library/components/masonry.js +113 -100
  63. package/library/components/menu-item.js +15 -486
  64. package/library/components/menu.js +20 -20
  65. package/library/components/molecules.js +3 -3
  66. package/library/components/option.js +2 -2
  67. package/library/components/organisms.js +2 -2
  68. package/library/components/padding-input-group.js +1 -1
  69. package/library/components/pagination.js +6 -6
  70. package/library/components/popup.js +101 -98
  71. package/library/components/position-picker.js +1 -1
  72. package/library/components/progress-bar.js +1 -1
  73. package/library/components/progress-ring.js +1 -1
  74. package/library/components/range.js +1 -1
  75. package/library/components/rating.js +1 -1
  76. package/library/components/relative-time.js +1 -1
  77. package/library/components/select.js +18 -13
  78. package/library/components/shadow-input-group.js +1 -1
  79. package/library/components/share-option-list.js +1 -1
  80. package/library/components/sidebar.js +1 -1
  81. package/library/components/size-input-group.js +3 -3
  82. package/library/components/spinner.js +1 -1
  83. package/library/components/split-panel.js +1 -1
  84. package/library/components/tab-group.js +5 -5
  85. package/library/components/tab.js +2 -2
  86. package/library/components/tag.js +2 -2
  87. package/library/components/tooltip.js +1 -1
  88. package/library/components/tree-item.js +2 -2
  89. package/library/components/tree.js +2 -2
  90. package/library/components/typeface.js +2 -2
  91. package/library/components/types.js +16288 -16094
  92. package/library/components/video.js +2 -2
  93. package/library/package.json +1 -1
  94. package/library/packages/atoms/src/components/image/image.d.ts +30 -4
  95. package/library/packages/atoms/src/components/menu-item/menu-item.d.ts +5 -2
  96. package/library/packages/atoms/src/components/popup/popup.d.ts +11 -0
  97. package/library/packages/atoms/src/components/select/select.d.ts +8 -0
  98. package/library/packages/molecules/src/gallery-item/gallery-item.d.ts +10 -0
  99. package/library/packages/molecules/src/icon-picker/icon-picker.d.ts +1 -0
  100. package/library/packages/molecules/src/masonry/masonry.d.ts +9 -0
  101. package/library/packages/molecules/src/view-and-sort/view-and-sort.d.ts +8 -0
  102. package/library/packages/organisms/src/bento-grid/bento-grid.d.ts +88 -0
  103. package/library/packages/organisms/src/carousel/carousel.d.ts +13 -0
  104. package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +11 -1
  105. package/library/packages/organisms/src/content-builder/content-builder.d.ts +31 -6
  106. package/library/packages/types/src/menu-item.d.ts +12 -1
  107. package/library/packages/utils/src/custom-element/i18n.d.ts +3 -0
  108. package/library/packages/utils/src/transformation/transformation.d.ts +52 -0
  109. package/library/react-web-component.d.ts +17 -1
  110. package/library/utils.js +173 -167
  111. package/package.json +1 -1
  112. package/library/chunks/transformation.8uLv6uwG.js +0 -264
@@ -4,7 +4,7 @@ import { f as ot } from "./form-control.styles.CaGWmeAS.js";
4
4
  import { c as lt } from "./custom-element.L4WJXn1j.js";
5
5
  import { d as ht } from "./default-value.COZopaet.js";
6
6
  import { F as pt } from "./form.DSsy3Fcy.js";
7
- import { L as ct } from "./i18n.DbXTTLXx.js";
7
+ import { L as ct } from "./i18n.BA19xtyU.js";
8
8
  import { H as dt } from "./slot.j5oheLJC.js";
9
9
  import { w as V } from "./watch.DJF5K-8U.js";
10
10
  import { i as ft, x as E } from "./lit-element.jLBm65_O.js";
@@ -1,7 +1,7 @@
1
- import { C as jn, I as Yn } from "./icon-button.BHC52xvk.js";
1
+ import { C as jn, I as Yn } from "./icon-button.BWJ1Vqn5.js";
2
2
  import { C as Un, n as me } from "./lib-cortex-element.CVMmyPMC.js";
3
3
  import { c as Gn } from "./custom-element.L4WJXn1j.js";
4
- import { L as Hn } from "./i18n.DbXTTLXx.js";
4
+ import { L as Hn } from "./i18n.BA19xtyU.js";
5
5
  import { w as Ne } from "./watch.DJF5K-8U.js";
6
6
  import { s as Kn } from "./string.CfI2ejyR.js";
7
7
  import { i as mt, x as Wn } from "./lit-element.jLBm65_O.js";
@@ -0,0 +1,493 @@
1
+ import { n as r, C as L } from "./lib-cortex-element.CVMmyPMC.js";
2
+ import { c as M } from "./component.styles.CRO4Odto.js";
3
+ import { c as z } from "./custom-element.L4WJXn1j.js";
4
+ import { d as k, L as E } from "./i18n.BA19xtyU.js";
5
+ import { H as P, g as R } from "./slot.j5oheLJC.js";
6
+ import { w as b } from "./watch.DJF5K-8U.js";
7
+ import { i as T, x as h, E as S } from "./lit-element.jLBm65_O.js";
8
+ import { e as f } from "./query.BBf1UFkC.js";
9
+ import { e as x } from "./class-map.BiVq-cVR.js";
10
+ import { o as d } from "./if-defined.BRoBj_Rp.js";
11
+ import { C as $ } from "./icon.CpHbi8tH.js";
12
+ import D from "../components/popup.js";
13
+ import O from "../components/spinner.js";
14
+ import { f as C } from "./focus-when-visible.jWSw9ks0.js";
15
+ import { e as I, n as A } from "./ref.DktKp7fP.js";
16
+ var p = /* @__PURE__ */ ((i) => (i.Prefix = "prefix", i.Suffix = "suffix", i))(p || {}), g = /* @__PURE__ */ ((i) => (i.Checkbox = "menuitemcheckbox", i.Item = "menuitem", i.Radio = "menuitemradio", i))(g || {}), c = /* @__PURE__ */ ((i) => (i.Checkbox = "checkbox", i.Normal = "normal", i))(c || {});
17
+ const B = T`:host{--submenu-offset:0px;--prefix-font-size:var(--cx-font-size-small);--prefix-color:var(--cx-color-neutral-500);--label-color:var(--cx-color-neutral);--suffix-color:var(--cx-color-neutral);--font-weight:var(--cx-font-weight-regular);display:block}:host([inert]){display:none}.menu-item{font-family:var(--cx-font-sans);font-size:var(--cx-font-size-small);font-weight:var(--font-weight,var(--cx-font-weight-regular));line-height:var(--cx-line-height-large);letter-spacing:var(--cx-letter-spacing-normal);color:var(--cx-color-neutral);padding:var(--cx-spacing-x-small) var(--cx-spacing-small);transition:var(--cx-transition-fast) fill;background-color:var(--cx-menu-item-background-color,unset);-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer;align-items:stretch;text-decoration:none;display:flex;position:relative}.menu-item.menu-item--disabled{cursor:default;outline:none}.menu-item.menu-item--disabled .menu-item__label,.menu-item.menu-item--disabled .menu-item__prefix,.menu-item.menu-item--disabled .menu-item__chevron,.menu-item.menu-item--disabled .menu-item__check{opacity:.5}.menu-item.menu-item--disabled .menu-item__suffix:not(:slotted(cx-tooltip)){opacity:.5}.menu-item.menu-item--loading{cursor:wait;outline:none}.menu-item.menu-item--loading :not(cx-spinner){opacity:.5}.menu-item--loading cx-spinner{--indicator-color:currentColor;--track-width:1px;opacity:1;font-size:.75em;position:absolute;top:calc(50% - .5em);left:.65rem}.menu-item .menu-item__label{color:var(--label-color,var(--cx-color-neutral));text-overflow:ellipsis;flex:auto;margin:auto;display:inline-block;overflow:hidden}.menu-item--checked .menu-item__label{color:var(--checked-label-color,var(--cx-color-primary))}.menu-item .menu-item__prefix{color:var(--prefix-color,var(--cx-color-neutral-500));font-size:var(--prefix-font-size,var(--cx-font-size-small));flex:none;align-items:center;display:flex}.menu-item--checked{--prefix-color:var(--cx-color-primary);--suffix-color:var(--cx-color-primary)}.menu-item--checked .menu-item__check{color:var(--checked-icon-color,var(--cx-color-primary))}.menu-item .menu-item__prefix::slotted(*){margin-inline-end:var(--cx-spacing-x-small)}.menu-item .menu-item__suffix{color:var(--suffix-color);flex:none;align-items:center;display:flex}.menu-item .menu-item__suffix::slotted(*){margin-inline-start:var(--cx-spacing-medium)}.menu-item--submenu-expanded:after{content:"";z-index:calc(var(--cx-z-index-dropdown) - 1);clip-path:polygon(var(--safe-triangle-cursor-x,0) var(--safe-triangle-cursor-y,0), var(--safe-triangle-submenu-start-x,0) var(--safe-triangle-submenu-start-y,0), var(--safe-triangle-submenu-end-x,0) var(--safe-triangle-submenu-end-y,0));position:fixed;inset:0}@media (pointer:none),(pointer:coarse){.menu-item--submenu-expanded:after{display:none}}:host(:focus-visible){outline:var(--cx-focus-ring);outline-offset:calc(-1 * var(--cx-focus-ring-width))}:host(:hover:not([aria-disabled=true],:focus-visible,.disable-hover)) .menu-item,.menu-item--submenu-expanded{background-color:var(--cx-menu-item-background-color-hover);color:var(--cx-color-neutral-1000)}:host(:not([aria-disabled=true])) .menu-item--active{background-color:var(--cx-menu-item-background-color-active,var(--cx-menu-item-background-color-hover));color:var(--cx-color-neutral-1000)}:host(:hover:not([aria-disabled=true],:focus-visible,.disable-hover)) .menu-item--active{background-color:var(--cx-menu-item-background-color-active-hover,var(--cx-menu-item-background-color-active,var(--cx-menu-item-background-color-hover)))}:host(:focus-visible) .menu-item{outline:var(--cx-focus-ring);outline-offset:calc(-1 * var(--cx-focus-ring-width));background-color:var(--cx-menu-item-background-color-hover);opacity:1}.menu-item .menu-item__check,.menu-item .menu-item__chevron{width:var(--checked-icon-size,1.5em);visibility:hidden;flex:none;justify-content:center;align-items:center}.menu-item .menu-item__check{display:var(--checked-icon-display,flex);margin-inline-end:var(--cx-spacing-2x-small)}.menu-item .menu-item__check--suffix{margin-inline:auto 0;padding-inline-start:var(--cx-spacing-2x-small)}.menu-item .menu-item__check--always-show{visibility:visible}.menu-item .menu-item__chevron{display:var(--submenu-icon-display,flex)}.menu-item--checked .menu-item__check,.menu-item--has-submenu .menu-item__chevron{visibility:visible}cx-popup::part(popup){border:var(--cx-panel-border-width) solid var(--cx-popup-border-color);border-radius:var(--cx-border-radius-large);box-shadow:var(--cx-shadow-large);z-index:var(--cx-z-index-dropdown);margin-left:var(--submenu-offset,0px);overflow:hidden}.menu-item--rtl cx-popup::part(popup){margin-left:calc(-1 * var(--submenu-offset))}@media (forced-colors:active){:host(:hover:not([aria-disabled=true])) .menu-item,:host(:focus-visible) .menu-item{outline-offset:-1px;outline:1px dashed selecteditem}}::slotted(cx-menu){max-width:var(--auto-size-available-width)!important;max-height:var(--auto-size-available-height)!important}`;
18
+ class H {
19
+ constructor(e, t) {
20
+ this.popupRef = I(), this.parent = null, this.enableSubmenuTimer = -1, this.isHorizontalMenu = !1, this.isConnected = !1, this.isPopupConnected = !1, this.skidding = 0, this.submenuOpenDelay = 100, this.focusVisibilityTimeoutMs = 1e4, this.lazyLoadObserver = null, this.pendingFocusCancel = null, (this.host = e).addController(this), this.hasSlotController = t, this.handleMouseMove = this.handleMouseMove.bind(this), this.handleMouseOver = this.handleMouseOver.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleClick = this.handleClick.bind(this), this.handleSubmenuIconClick = this.handleSubmenuIconClick.bind(this), this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this), this.handleMouseLeave = this.handleMouseLeave.bind(this), this.handlePopupMouseover = this.handlePopupMouseover.bind(this), this.handlePopupReposition = this.handlePopupReposition.bind(this);
21
+ }
22
+ get popup() {
23
+ return this.popupRef.value;
24
+ }
25
+ hostConnected() {
26
+ this.parent = this.host.closest("cx-menu"), this.hasSlotController.test("submenu") && !this.host.disabled && (this.addListeners(), this.updateSkidding()), this.parent && (this.syncIsHorizontalMenu(), this.parentObserver = new MutationObserver(() => {
27
+ this.syncIsHorizontalMenu();
28
+ }), this.parentObserver.observe(this.parent, {
29
+ attributeFilter: ["horizontal"]
30
+ }));
31
+ }
32
+ hostDisconnected() {
33
+ this.removeListeners(), this.parentObserver && this.parentObserver.disconnect(), this.cancelPendingFocus();
34
+ }
35
+ hostUpdated() {
36
+ this.removeListeners(), this.hasSlotController.test("submenu") && !this.host.disabled && (this.addListeners(), this.updateSkidding(), this.syncIsHorizontalMenu(), this.syncAriaExpanded());
37
+ }
38
+ syncAriaExpanded() {
39
+ this.host.setAttribute("aria-expanded", this.isExpanded() ? "true" : "false");
40
+ }
41
+ addListeners() {
42
+ this.isConnected || (this.host.addEventListener("mousemove", this.handleMouseMove), (this.host.submenuTrigger === "both" || this.host.submenuTrigger === "hover") && (this.host.addEventListener("mouseover", this.handleMouseOver), this.host.addEventListener("mouseleave", this.handleMouseLeave)), (this.host.submenuTrigger === "both" || this.host.submenuTrigger === "click") && (this.host.addEventListener("click", this.handleClick), this.host.submenuIcon?.addEventListener(
43
+ "click",
44
+ this.handleSubmenuIconClick
45
+ ), document.addEventListener("mousedown", this.handleDocumentMouseDown)), this.host.addEventListener("keydown", this.handleKeyDown), this.isConnected = !0), this.isPopupConnected || this.popupRef.value && (this.popupRef.value.addEventListener(
46
+ "mouseover",
47
+ this.handlePopupMouseover
48
+ ), this.popupRef.value.addEventListener(
49
+ "cx-reposition",
50
+ this.handlePopupReposition
51
+ ), this.isPopupConnected = !0);
52
+ }
53
+ removeListeners() {
54
+ this.isConnected && (this.host.removeEventListener("mousemove", this.handleMouseMove), this.host.removeEventListener("mouseover", this.handleMouseOver), this.host.removeEventListener("mouseleave", this.handleMouseLeave), this.host.removeEventListener("click", this.handleClick), this.host.submenuIcon?.removeEventListener(
55
+ "click",
56
+ this.handleSubmenuIconClick
57
+ ), document.removeEventListener("mousedown", this.handleDocumentMouseDown), this.host.removeEventListener("keydown", this.handleKeyDown), this.isConnected = !1), this.isPopupConnected && this.popupRef.value && (this.popupRef.value.removeEventListener(
58
+ "mouseover",
59
+ this.handlePopupMouseover
60
+ ), this.popupRef.value.removeEventListener(
61
+ "cx-reposition",
62
+ this.handlePopupReposition
63
+ ), this.isPopupConnected = !1);
64
+ }
65
+ syncIsHorizontalMenu() {
66
+ this.parent && (this.isHorizontalMenu = this.parent.hasAttribute("horizontal"));
67
+ }
68
+ // Set the safe triangle cursor position
69
+ handleMouseMove(e) {
70
+ const t = getComputedStyle(this.host).direction === "rtl" || this.popupRef.value?.dataset.currentPlacement?.startsWith("left");
71
+ this.host.style.setProperty(
72
+ "--safe-triangle-cursor-x",
73
+ `${e.clientX + (t ? 1 : 0)}px`
74
+ ), this.host.style.setProperty(
75
+ "--safe-triangle-cursor-y",
76
+ `${e.clientY}px`
77
+ );
78
+ }
79
+ handleMouseOver() {
80
+ this.hasSlotController.test("submenu") && this.enableSubmenu();
81
+ }
82
+ handleSubmenuEntry(e) {
83
+ const t = this.host.renderRoot.querySelector("slot[name='submenu']");
84
+ if (!t) {
85
+ console.error(
86
+ "Cannot activate a submenu if no corresponding menuitem can be found.",
87
+ this
88
+ );
89
+ return;
90
+ }
91
+ const n = this.queryMenuItems(t);
92
+ if (!n || n.length === 0) {
93
+ this.host.lazy && (e.preventDefault(), e.stopPropagation(), this.focusFirstMenuItemAfterLazyLoad(t));
94
+ return;
95
+ }
96
+ this.setRovingTabIndex(n), this.popupRef.value && (e.preventDefault(), e.stopPropagation(), this.popupRef.value.active || this.enableSubmenu(!1), n[0] instanceof HTMLElement && (this.pendingFocusCancel?.(), this.pendingFocusCancel = C(
97
+ n[0],
98
+ this.focusVisibilityTimeoutMs
99
+ )));
100
+ }
101
+ // Sets up the roving tabindex for a freshly revealed set of submenu items: first item tabbable, rest not.
102
+ setRovingTabIndex(e) {
103
+ e[0].setAttribute("tabindex", "0");
104
+ for (let t = 1; t !== e.length; ++t)
105
+ e[t].setAttribute("tabindex", "-1");
106
+ }
107
+ // Find the first menu-item (or menuitem-role element) assigned to the submenu slot, if any exist yet.
108
+ queryMenuItems(e) {
109
+ let t = null;
110
+ for (const n of e.assignedElements())
111
+ if (t = n.querySelectorAll("cx-menu-item, [role^='menuitem']"), t.length !== 0)
112
+ break;
113
+ return t;
114
+ }
115
+ // Disconnect any pending lazy-load item watch and cancel any pending focus attempt (submenu closed, host
116
+ // disconnected, or the item was already found/focused).
117
+ cancelPendingFocus() {
118
+ this.lazyLoadObserver?.disconnect(), this.lazyLoadObserver = null, this.pendingFocusCancel?.(), this.pendingFocusCancel = null;
119
+ }
120
+ /**
121
+ * Enables the submenu and, once its content finishes loading and the first menu-item appears, focuses it.
122
+ * focusWhenVisible already tolerates the popup not being visually ready yet, so this only needs to wait for
123
+ * the item itself to exist.
124
+ */
125
+ focusFirstMenuItemAfterLazyLoad(e) {
126
+ this.lazyLoadObserver?.disconnect(), this.lazyLoadObserver = new MutationObserver(() => {
127
+ const t = this.queryMenuItems(e), n = t?.[0];
128
+ !(n instanceof HTMLElement) || !t || (this.setRovingTabIndex(t), this.lazyLoadObserver?.disconnect(), this.lazyLoadObserver = null, this.pendingFocusCancel?.(), this.pendingFocusCancel = C(
129
+ n,
130
+ this.focusVisibilityTimeoutMs
131
+ ));
132
+ });
133
+ for (const t of e.assignedElements())
134
+ this.lazyLoadObserver.observe(t, { childList: !0, subtree: !0 });
135
+ this.enableSubmenu(!1);
136
+ }
137
+ // Focus on the first menu-item of a submenu.
138
+ handleKeyDown(e) {
139
+ const t = () => {
140
+ e.preventDefault(), e.stopPropagation(), this.host.focus(), this.disableSubmenu();
141
+ };
142
+ switch (e.key) {
143
+ case "Tab": {
144
+ this.disableSubmenu();
145
+ break;
146
+ }
147
+ case "Escape": {
148
+ this.host.focus(), this.disableSubmenu();
149
+ break;
150
+ }
151
+ case "ArrowLeft": {
152
+ e.target !== this.host && !this.isHorizontalMenu && t();
153
+ break;
154
+ }
155
+ case "ArrowUp": {
156
+ e.target !== this.host && this.isHorizontalMenu && t();
157
+ break;
158
+ }
159
+ case "ArrowRight": {
160
+ this.isHorizontalMenu || this.handleSubmenuEntry(e);
161
+ break;
162
+ }
163
+ case "ArrowDown": {
164
+ this.isHorizontalMenu && this.handleSubmenuEntry(e);
165
+ break;
166
+ }
167
+ case "Enter":
168
+ case " ": {
169
+ this.host.href || this.handleSubmenuEntry(e);
170
+ break;
171
+ }
172
+ }
173
+ }
174
+ handleClick(e) {
175
+ e.target !== this.host && e.target instanceof Element && (e.target.localName === "cx-menu-item" || e.target.role?.startsWith("menuitem")) || (e.preventDefault(), e.stopPropagation(), this.isExpanded() ? this.disableSubmenu() : e.isTrusted && this.enableSubmenu());
176
+ }
177
+ handleSubmenuIconClick(e) {
178
+ e.preventDefault(), e.stopPropagation(), this.isExpanded() ? this.disableSubmenu() : this.enableSubmenu();
179
+ }
180
+ handleDocumentMouseDown(e) {
181
+ const t = e.composedPath();
182
+ this.host && !t.includes(this.host) && this.disableSubmenu();
183
+ }
184
+ // Close this submenu on focus outside of the parent or any descendants.
185
+ handleMouseLeave(e) {
186
+ e.relatedTarget && e.relatedTarget instanceof Element && this.host.contains(e.relatedTarget) || this.disableSubmenu();
187
+ }
188
+ // Prevent the parent menu-item from getting focus on mouse movement on the submenu
189
+ handlePopupMouseover(e) {
190
+ e.stopPropagation();
191
+ }
192
+ // Set the safe triangle values for the submenu when the position changes
193
+ handlePopupReposition() {
194
+ const t = this.host.renderRoot.querySelector("slot[name='submenu']")?.assignedElements({ flatten: !0 }).filter((v) => v.localName === "cx-menu")[0], n = getComputedStyle(this.host).direction === "rtl" || this.popupRef.value?.dataset.currentPlacement?.startsWith("left");
195
+ if (!t)
196
+ return;
197
+ const { height: l, left: a, top: u, width: m } = t.getBoundingClientRect();
198
+ this.host.style.setProperty(
199
+ "--safe-triangle-submenu-start-x",
200
+ `${n ? a + m : a}px`
201
+ ), this.host.style.setProperty("--safe-triangle-submenu-start-y", `${u}px`), this.host.style.setProperty(
202
+ "--safe-triangle-submenu-end-x",
203
+ `${n ? a + m : a}px`
204
+ ), this.host.style.setProperty(
205
+ "--safe-triangle-submenu-end-y",
206
+ `${u + l}px`
207
+ );
208
+ }
209
+ setSubmenuState(e) {
210
+ this.popupRef.value && this.popupRef.value.active !== e && (this.popupRef.value.active = e, this.host.requestUpdate());
211
+ }
212
+ // Shows the submenu. Supports disabling the opening delay, e.g. for keyboard events that want to set the focus to the
213
+ // newly opened menu.
214
+ enableSubmenu(e = !0) {
215
+ this.host.lazy && this.host.emit("cx-lazy-load"), e ? (window.clearTimeout(this.enableSubmenuTimer), this.enableSubmenuTimer = window.setTimeout(() => {
216
+ this.setSubmenuState(!0);
217
+ }, this.submenuOpenDelay)) : this.setSubmenuState(!0);
218
+ }
219
+ disableSubmenu() {
220
+ window.clearTimeout(this.enableSubmenuTimer), this.cancelPendingFocus(), this.setSubmenuState(!1), this.disableNestedSubmenus();
221
+ }
222
+ /**
223
+ * Closing this submenu hides nested submenus visually (via the parent popup's own hidden state) without
224
+ * resetting their own `active` flag, since they never receive a property change to react to. Left stale,
225
+ * reopening a nested submenu later hits the "already active" fast path and skips the re-sync a fresh open
226
+ * would normally do. Cascade the close so every nested submenu starts clean the next time it's opened.
227
+ */
228
+ disableNestedSubmenus() {
229
+ if (!this.hasSlotController.test("submenu"))
230
+ return;
231
+ const e = this.host.renderRoot.querySelector("slot[name='submenu']");
232
+ if (e)
233
+ for (const t of e.assignedElements({ flatten: !0 }))
234
+ t.querySelectorAll("cx-menu-item").forEach((n) => {
235
+ n.closeSubmenu?.();
236
+ });
237
+ }
238
+ // Schedule a recalculation of the skidding value
239
+ updateSkidding() {
240
+ requestAnimationFrame(() => {
241
+ this.calculateSkidding();
242
+ });
243
+ }
244
+ // Calculate the space the top of a menu takes-up, for aligning the popup menu-item with the activating element.
245
+ calculateSkidding() {
246
+ if (!this.host.parentElement?.computedStyleMap)
247
+ return;
248
+ const e = this.host.parentElement.computedStyleMap(), t = k(this.host) === "rtl", n = this.host.submenuPlacement ?? (t ? "left-start" : "right-start"), l = n.startsWith("left") || n.startsWith("right");
249
+ let a = [];
250
+ l && (n.endsWith("-start") ? a = ["padding-top", "border-top-width", "margin-top"] : n.endsWith("-end") && (a = ["padding-bottom", "border-bottom-width", "margin-bottom"]));
251
+ const u = a.reduce((m, v) => {
252
+ const y = e.get(v) ?? new CSSUnitValue(0, "px"), w = (y instanceof CSSUnitValue ? y : new CSSUnitValue(0, "px")).to("px"), _ = n.endsWith("-end") ? 1 : -1;
253
+ return m + w.value * _;
254
+ }, 0);
255
+ this.skidding = u;
256
+ }
257
+ isExpanded() {
258
+ return this.popupRef.value ? this.popupRef.value.active : !1;
259
+ }
260
+ renderSubmenu() {
261
+ const e = k(this.host) === "rtl";
262
+ if (!this.hasSlotController.test("submenu"))
263
+ return null;
264
+ const t = this.host.submenuPlacement ?? (e ? "left-start" : "right-start");
265
+ return h`<cx-popup ${A(this.popupRef)} placement=${t} anchor="anchor" part="submenu-popup" flip flip-fallback-strategy="best-fit" skidding=${this.skidding} strategy="overlay" auto-size="both" auto-size-padding="10" ?shift=${!!this.host.shiftBoundary} .flipBoundary=${this.host.flipBoundary} .shiftBoundary=${this.host.shiftBoundary} .autoSizeBoundary=${this.host.autoSizeBoundary}><slot name="submenu"></slot></cx-popup>`;
266
+ }
267
+ }
268
+ var F = Object.defineProperty, W = Object.getOwnPropertyDescriptor, o = (i, e, t, n) => {
269
+ for (var l = n > 1 ? void 0 : n ? W(e, t) : e, a = i.length - 1, u; a >= 0; a--)
270
+ (u = i[a]) && (l = (n ? u(e, t, l) : u(l)) || l);
271
+ return n && l && F(e, t, l), l;
272
+ };
273
+ let s = class extends L {
274
+ constructor() {
275
+ super(), this.type = c.Normal, this.submenuTrigger = "both", this.checked = !1, this.noUncheck = !1, this.value = "", this.href = "", this.rel = "noreferrer noopener", this.loading = !1, this.disabled = !1, this.active = !1, this.current = void 0, this.readonly = !1, this.menu = "", this.alwaysShowCheckedIcon = !1, this.checkPlacement = p.Suffix, this.lazy = !1, this.localize = new E(this), this.hasSlotController = new P(
276
+ this,
277
+ "submenu",
278
+ "submenu-icon"
279
+ ), this.submenuController = new H(
280
+ this,
281
+ this.hasSlotController
282
+ ), this.handleDocumentWheel = (i) => {
283
+ const e = i.composedPath();
284
+ this.submenuController.isExpanded() && (!this.submenuController.popup || !e.includes(this.submenuController.popup)) && (i.preventDefault(), this.submenuController.disableSubmenu());
285
+ }, this.handleHostClick = this.handleHostClick.bind(this), this.handleMouseOver = this.handleMouseOver.bind(this);
286
+ }
287
+ runConnectedCallback() {
288
+ this.addEventListener("click", this.handleHostClick), this.addEventListener("mouseover", this.handleMouseOver), document.addEventListener("wheel", this.handleDocumentWheel, {
289
+ passive: !1
290
+ });
291
+ }
292
+ disconnectedCallback() {
293
+ super.disconnectedCallback(), this.removeEventListener("click", this.handleHostClick), this.removeEventListener("mouseover", this.handleMouseOver), document.removeEventListener("wheel", this.handleDocumentWheel);
294
+ }
295
+ handleDefaultSlotChange() {
296
+ const i = this.getTextLabel();
297
+ if (typeof this.cachedTextLabel > "u") {
298
+ this.cachedTextLabel = i;
299
+ return;
300
+ }
301
+ i !== this.cachedTextLabel && (this.cachedTextLabel = i, this.emit("slotchange", {
302
+ bubbles: !0,
303
+ cancelable: !1,
304
+ composed: !1
305
+ }));
306
+ }
307
+ handleHostClick(i) {
308
+ (this.disabled || this.readonly) && (i.target === this && i.preventDefault(), i.stopImmediatePropagation()), this.href && this.anchor && this.anchor.click();
309
+ }
310
+ handleMouseOver(i) {
311
+ i.stopPropagation();
312
+ }
313
+ handleAnchorClick(i) {
314
+ i.stopPropagation();
315
+ }
316
+ handleCheckedChange() {
317
+ if (this.checked && this.type !== c.Checkbox) {
318
+ this.checked = !1, console.error(
319
+ 'The checked attribute can only be used on menu items with type="checkbox"',
320
+ this
321
+ );
322
+ return;
323
+ }
324
+ this.type === c.Checkbox ? this.setAttribute("aria-checked", this.checked ? "true" : "false") : this.removeAttribute("aria-checked");
325
+ }
326
+ handleDisabledChange() {
327
+ this.setAttribute("aria-disabled", this.disabled ? "true" : "false");
328
+ }
329
+ handleCurrentChange() {
330
+ this.current ? this.setAttribute("aria-current", this.current) : this.removeAttribute("aria-current");
331
+ }
332
+ handleTypeChange() {
333
+ this.type === "checkbox" ? (this.setAttribute("role", this.itemRole ?? g.Checkbox), this.setAttribute("aria-checked", this.checked ? "true" : "false")) : (this.setAttribute("role", this.itemRole ?? g.Item), this.removeAttribute("aria-checked"));
334
+ }
335
+ /** Returns a text label based on the contents of the menu item's default slot. */
336
+ getTextLabel() {
337
+ return R(this.defaultSlot);
338
+ }
339
+ isSubmenu() {
340
+ return this.hasSlotController.test("submenu") || !!this.menu.trim();
341
+ }
342
+ /** Closes this menu item's own submenu, if it has one open. Used to cascade-close nested submenus. */
343
+ closeSubmenu() {
344
+ this.submenuController.disableSubmenu();
345
+ }
346
+ renderBase(i) {
347
+ const e = !!this.href, t = this.localize.dir() === "rtl", n = this.submenuController.isExpanded();
348
+ return e ? h`<a id="anchor" part="base" class=${x({
349
+ "menu-item": !0,
350
+ "menu-item--active": this.active,
351
+ "menu-item--checkbox": this.type === c.Checkbox,
352
+ "menu-item--checked": this.checked,
353
+ "menu-item--disabled": this.disabled,
354
+ "menu-item--has-submenu": this.isSubmenu(),
355
+ "menu-item--loading": this.loading,
356
+ "menu-item--rtl": t,
357
+ "menu-item--submenu-expanded": n
358
+ })} aria-haspopup=${this.isSubmenu()} href=${d(this.href)} target=${d(this.target)} download=${d(this.download)} rel=${d(this.rel)} aria-label=${this.getTextLabel()} ?inert=${this.disabled} @click=${this.handleAnchorClick}>${i}</a>` : h`<div id="anchor" part="base" class=${x({
359
+ "menu-item": !0,
360
+ "menu-item--active": this.active,
361
+ "menu-item--checkbox": this.type === c.Checkbox,
362
+ "menu-item--checked": this.checked,
363
+ "menu-item--disabled": this.disabled,
364
+ "menu-item--has-submenu": this.isSubmenu(),
365
+ "menu-item--loading": this.loading,
366
+ "menu-item--rtl": t,
367
+ "menu-item--submenu-expanded": n
368
+ })} aria-haspopup=${this.isSubmenu()} aria-label=${this.getTextLabel()}>${i}</div>`;
369
+ }
370
+ render() {
371
+ const i = this.localize.dir() === "rtl";
372
+ let e;
373
+ this.submenuPlacement && (this.submenuPlacement.startsWith("top") || this.submenuPlacement.startsWith("bottom")) ? e = "keyboard_arrow_down" : e = i ? "chevron_left" : "chevron_right";
374
+ const t = h`<slot part="checked-icon" name="checked-icon" class=${x({
375
+ "menu-item__check": !0,
376
+ "menu-item__check--always-show": this.alwaysShowCheckedIcon,
377
+ "menu-item__check--suffix": this.checkPlacement === p.Suffix
378
+ })}><cx-icon name="check"></cx-icon></slot>`, n = this.checkPlacement === p.Suffix;
379
+ return this.renderBase(h`
380
+ ${n ? S : t}<slot name="prefix" part="prefix" class="menu-item__prefix"></slot><slot part="label" class="menu-item__label" @slotchange=${this.handleDefaultSlotChange}></slot><slot name="suffix" part="suffix" class="menu-item__suffix"></slot><slot name="submenu-icon" part="submenu-icon" class="menu-item__chevron"><cx-icon name=${e} aria-hidden="true"></cx-icon></slot>${n ? t : S}
381
+
382
+ ${this.submenuController.renderSubmenu()}
383
+ ${this.loading ? h`<cx-spinner part="spinner" exportparts="base:spinner__base"></cx-spinner>` : ""}
384
+ `);
385
+ }
386
+ };
387
+ s.styles = [M, B];
388
+ s.dependencies = {
389
+ "cx-icon": $,
390
+ "cx-popup": D,
391
+ "cx-spinner": O
392
+ };
393
+ o([
394
+ f("slot:not([name])")
395
+ ], s.prototype, "defaultSlot", 2);
396
+ o([
397
+ f("a#anchor", !0)
398
+ ], s.prototype, "anchor", 2);
399
+ o([
400
+ f(".menu-item")
401
+ ], s.prototype, "menuItem", 2);
402
+ o([
403
+ f(".menu-item__chevron")
404
+ ], s.prototype, "submenuIcon", 2);
405
+ o([
406
+ r()
407
+ ], s.prototype, "type", 2);
408
+ o([
409
+ r({ attribute: "item-role", type: String })
410
+ ], s.prototype, "itemRole", 2);
411
+ o([
412
+ r({ attribute: "submenu-trigger", type: String })
413
+ ], s.prototype, "submenuTrigger", 2);
414
+ o([
415
+ r({ reflect: !0, type: Boolean })
416
+ ], s.prototype, "checked", 2);
417
+ o([
418
+ r({ attribute: "no-uncheck", reflect: !0, type: Boolean })
419
+ ], s.prototype, "noUncheck", 2);
420
+ o([
421
+ r()
422
+ ], s.prototype, "value", 2);
423
+ o([
424
+ r()
425
+ ], s.prototype, "href", 2);
426
+ o([
427
+ r()
428
+ ], s.prototype, "target", 2);
429
+ o([
430
+ r()
431
+ ], s.prototype, "rel", 2);
432
+ o([
433
+ r()
434
+ ], s.prototype, "download", 2);
435
+ o([
436
+ r({ reflect: !0, type: Boolean })
437
+ ], s.prototype, "loading", 2);
438
+ o([
439
+ r({ reflect: !0, type: Boolean })
440
+ ], s.prototype, "disabled", 2);
441
+ o([
442
+ r({ reflect: !0, type: Boolean })
443
+ ], s.prototype, "active", 2);
444
+ o([
445
+ r({ reflect: !0, type: String })
446
+ ], s.prototype, "current", 2);
447
+ o([
448
+ r({ reflect: !0, type: Boolean })
449
+ ], s.prototype, "readonly", 2);
450
+ o([
451
+ r({ attribute: "flip-boundary", type: Object })
452
+ ], s.prototype, "flipBoundary", 2);
453
+ o([
454
+ r({ attribute: "shift-boundary", type: Object })
455
+ ], s.prototype, "shiftBoundary", 2);
456
+ o([
457
+ r({ attribute: "auto-size-boundary", type: Object })
458
+ ], s.prototype, "autoSizeBoundary", 2);
459
+ o([
460
+ r({ reflect: !0 })
461
+ ], s.prototype, "menu", 2);
462
+ o([
463
+ r({ attribute: "always-show-checked-icon", reflect: !0, type: Boolean })
464
+ ], s.prototype, "alwaysShowCheckedIcon", 2);
465
+ o([
466
+ r({ attribute: "check-placement", reflect: !0, type: String })
467
+ ], s.prototype, "checkPlacement", 2);
468
+ o([
469
+ r({ attribute: "submenu-placement" })
470
+ ], s.prototype, "submenuPlacement", 2);
471
+ o([
472
+ r({ reflect: !0, type: Boolean })
473
+ ], s.prototype, "lazy", 2);
474
+ o([
475
+ b("checked")
476
+ ], s.prototype, "handleCheckedChange", 1);
477
+ o([
478
+ b("disabled")
479
+ ], s.prototype, "handleDisabledChange", 1);
480
+ o([
481
+ b("current")
482
+ ], s.prototype, "handleCurrentChange", 1);
483
+ o([
484
+ b(["type", "itemRole"])
485
+ ], s.prototype, "handleTypeChange", 1);
486
+ s = o([
487
+ z("cx-menu-item")
488
+ ], s);
489
+ export {
490
+ s as C,
491
+ c as M,
492
+ g as a
493
+ };
@@ -1,7 +1,7 @@
1
1
  import { n as s, C as x } from "./lib-cortex-element.CVMmyPMC.js";
2
2
  import { c as m } from "./component.styles.CRO4Odto.js";
3
3
  import { c as v } from "./custom-element.L4WJXn1j.js";
4
- import { L as g } from "./i18n.DbXTTLXx.js";
4
+ import { L as g } from "./i18n.BA19xtyU.js";
5
5
  import { w as d } from "./watch.DJF5K-8U.js";
6
6
  import { i as _, x as h } from "./lit-element.jLBm65_O.js";
7
7
  import { r as f } from "./state.CSDxrqLd.js";
@@ -1,8 +1,8 @@
1
1
  import b from "../components/space.js";
2
2
  import { n as o, C as _ } from "./lib-cortex-element.CVMmyPMC.js";
3
- import { C as P, I as y } from "./icon-button.BHC52xvk.js";
3
+ import { C as P, I as y } from "./icon-button.BWJ1Vqn5.js";
4
4
  import { c as f } from "./custom-element.L4WJXn1j.js";
5
- import { L as z } from "./i18n.DbXTTLXx.js";
5
+ import { L as z } from "./i18n.BA19xtyU.js";
6
6
  import { c as m } from "./math.DuKzLacZ.js";
7
7
  import { w as d } from "./watch.DJF5K-8U.js";
8
8
  import { i as C, x as s } from "./lit-element.jLBm65_O.js";
@@ -10,9 +10,9 @@ import { r as S } from "./state.CSDxrqLd.js";
10
10
  import { e as $ } from "./class-map.BiVq-cVR.js";
11
11
  import { c as x } from "./repeat.CFjcER6_.js";
12
12
  import { n as g } from "./when.Dr1es41R.js";
13
- import { C as w } from "./button.BnkkUqiI.js";
14
- import { C as v } from "./input.33UmFGqR.js";
15
- import { C as I } from "./option.B6odSlS2.js";
13
+ import { C as w } from "./button.CpY4FCwE.js";
14
+ import { C as v } from "./input.xgeLCG8I.js";
15
+ import { C as I } from "./option.jeaj7_Lr.js";
16
16
  import B from "../components/select.js";
17
17
  import N from "../components/tooltip.js";
18
18
  import { C as k } from "./typography.IqHbnd3C.js";
@@ -2,7 +2,7 @@ import zn from "../components/resize-observer.js";
2
2
  import { n as wt, C as Bn } from "./lib-cortex-element.CVMmyPMC.js";
3
3
  import { c as Fn } from "./component.styles.CRO4Odto.js";
4
4
  import { c as Nn } from "./custom-element.L4WJXn1j.js";
5
- import { L as Ln } from "./i18n.DbXTTLXx.js";
5
+ import { L as Ln } from "./i18n.BA19xtyU.js";
6
6
  import { s as Zi } from "./scroll.xtO5yojm.js";
7
7
  import { w as ft } from "./watch.DJF5K-8U.js";
8
8
  import { i as $n } from "./dom.gRV2cDjL.js";
@@ -17,11 +17,11 @@ import { i as Ji } from "./guard.D4axKaMo.js";
17
17
  import { o as tr } from "./map.D8heArFD.js";
18
18
  import { o as Ve } from "./style-map.llVFPd__.js";
19
19
  import { n as Pe } from "./when.Dr1es41R.js";
20
- import { C as Yn } from "./button.BnkkUqiI.js";
20
+ import { C as Yn } from "./button.CpY4FCwE.js";
21
21
  import Xn from "../components/dropdown.js";
22
- import { C as qn } from "./icon-button.BHC52xvk.js";
22
+ import { C as qn } from "./icon-button.BWJ1Vqn5.js";
23
23
  import Gn from "../components/menu.js";
24
- import Kn from "../components/menu-item.js";
24
+ import { C as Kn } from "./menu-item.DgUMVYe5.js";
25
25
  import jn from "../components/tab.js";
26
26
  var bi = /* @__PURE__ */ ((o) => (o.Bottom = "bottom", o.End = "end", o.Start = "start", o.Top = "top", o))(bi || {}), Ke = /* @__PURE__ */ ((o) => (o.Center = "center", o.End = "flex-end", o.Start = "flex-start", o))(Ke || {}), wr = /* @__PURE__ */ ((o) => (o.Auto = "auto", o.Manual = "manual", o))(wr || {}), ue = /* @__PURE__ */ ((o) => (o.Button = "button", o.Default = "default", o.Timeline = "timeline", o))(ue || {}), Tt = /* @__PURE__ */ ((o) => (o.Dropdown = "dropdown", o.Pagination = "pagination", o.Scroll = "scroll", o))(Tt || {}), Ut = /* @__PURE__ */ ((o) => (o.Absolute = "absolute", o.DisplayNone = "display-none", o))(Ut || {});
27
27
  function Dt(o) {
@@ -1,4 +1,4 @@
1
- import { D as f } from "./transformation.8uLv6uwG.js";
1
+ import { D as f } from "./content-builder.BX4pHujE.js";
2
2
  function h(n, e) {
3
3
  return n.filter((r, t) => t !== e);
4
4
  }