@umbraco-ui/uui-menu-item 1.15.0-rc.0 → 1.16.0-rc.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.
@@ -151,6 +151,11 @@
151
151
  "type": "string",
152
152
  "default": "\"'Reveal the underlying items'\""
153
153
  },
154
+ {
155
+ "name": "renderExpandSymbol",
156
+ "description": "Overwrite the expand symbol rendering, this replaces the Expand Symbol from UI Library.",
157
+ "type": "(() => Element | TemplateResult<1> | undefined) | undefined"
158
+ },
154
159
  {
155
160
  "name": "styles",
156
161
  "type": "CSSResult[]",
package/lib/index.js CHANGED
@@ -35,7 +35,7 @@ var __decorateClass = (decorators, target, key, kind) => {
35
35
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
36
36
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
37
37
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
38
- var _UUIMenuItemElement_instances, onLabelClicked_fn;
38
+ var _UUIMenuItemElement_instances, onLabelClicked_fn, renderExpandSymbol_fn;
39
39
  let UUIMenuItemElement = class extends SelectOnlyMixin(
40
40
  SelectableMixin(ActiveMixin(LabelMixin("label", LitElement)))
41
41
  ) {
@@ -116,17 +116,15 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(
116
116
  render() {
117
117
  return html`
118
118
  <div id="menu-item" aria-label="menuitem" role="menuitem">
119
+ <div id="label-button-background"></div>
119
120
  ${this.hasChildren ? html`<button
120
121
  id="caret-button"
121
122
  aria-label=${this.caretLabel}
122
123
  @click=${this._onCaretClicked}>
123
- <uui-symbol-expand
124
- aria-hidden="true"
125
- ?open=${this.showChildren}></uui-symbol-expand>
124
+ ${__privateMethod(this, _UUIMenuItemElement_instances, renderExpandSymbol_fn).call(this)}
126
125
  </button>` : ""}
127
126
  ${this.href && this.selectOnly !== true && this.selectable !== true ? this._renderLabelAsAnchor() : this._renderLabelAsButton()}
128
127
 
129
- <div id="label-button-background"></div>
130
128
  <slot id="actions-container" name="actions"></slot>
131
129
  ${this.loading ? html`<uui-loader-bar id="loader"></uui-loader-bar>` : ""}
132
130
  </div>
@@ -140,6 +138,17 @@ onLabelClicked_fn = function() {
140
138
  const event = new UUIMenuItemEvent(UUIMenuItemEvent.CLICK_LABEL);
141
139
  this.dispatchEvent(event);
142
140
  };
141
+ renderExpandSymbol_fn = function() {
142
+ if (this.renderExpandSymbol) {
143
+ const result = this.renderExpandSymbol();
144
+ if (result) {
145
+ return result;
146
+ }
147
+ }
148
+ return html`<uui-symbol-expand
149
+ aria-hidden="true"
150
+ ?open=${this.showChildren}></uui-symbol-expand>`;
151
+ };
143
152
  UUIMenuItemElement.styles = [
144
153
  css`
145
154
  :host {
@@ -165,12 +174,8 @@ UUIMenuItemElement.styles = [
165
174
 
166
175
  /** Not active, not selected, not disabled: */
167
176
  :host(:not([active], [selected], [disabled], [select-mode='highlight']))
168
- #menu-item
169
- #label-button:hover
170
- ~ #label-button-background,
171
- :host(:not([active], [selected], [disabled]))
172
- #menu-item
173
- #caret-button:hover {
177
+ #menu-item:has(#label-button:hover)
178
+ #label-button-background {
174
179
  background-color: var(
175
180
  --uui-menu-item-background-color-hover,
176
181
  var(--uui-color-surface-emphasis,rgb(
@@ -204,7 +209,9 @@ UUIMenuItemElement.styles = [
204
209
  var(--uui-color-current,#f5c1bc)
205
210
  );
206
211
  }
207
- :host([active]) #label-button:hover ~ #label-button-background,
212
+ :host([active])
213
+ #menu-item:has(#label-button:hover)
214
+ #label-button-background,
208
215
  :host([active]) #caret-button:hover {
209
216
  background-color: var(
210
217
  --uui-menu-item-background-color-active-hover,
@@ -243,8 +250,8 @@ UUIMenuItemElement.styles = [
243
250
  }
244
251
  /** Selected, not highlight mode */
245
252
  :host([selected]:not([select-mode='highlight'], [disabled]))
246
- #label-button:hover
247
- ~ #label-button-background,
253
+ #menu-item:has(#label-button:hover)
254
+ #label-button-background,
248
255
  :host([selected]:not([select-mode='highlight'], [disabled]))
249
256
  #caret-button:hover {
250
257
  background-color: var(
@@ -259,9 +266,8 @@ UUIMenuItemElement.styles = [
259
266
 
260
267
  /** highlight mode, default */
261
268
  :host([select-mode='highlight']:not([disabled], [active], [selectable]))
262
- #menu-item
263
- #label-button:hover
264
- ~ #label-button-background {
269
+ #menu-item:has(#label-button:hover)
270
+ #label-button-background {
265
271
  border-radius: var(--uui-border-radius,3px);
266
272
  background-color: var(
267
273
  --uui-menu-item-background-color-highlight,
@@ -282,9 +288,8 @@ UUIMenuItemElement.styles = [
282
288
 
283
289
  /** highlight mode, active & selected */
284
290
  :host([select-mode='highlight'][active][selected]:not([disabled]))
285
- #menu-item
286
- #label-button:hover
287
- ~ #label-button-background {
291
+ #menu-item:has(#label-button:hover)
292
+ #label-button-background {
288
293
  border-radius: var(--uui-border-radius,3px);
289
294
  background-color: var(
290
295
  --uui-menu-item-background-color-highlight-active-selected,
@@ -370,15 +375,13 @@ UUIMenuItemElement.styles = [
370
375
  }
371
376
 
372
377
  :host([select-mode='highlight'][selectable]:not([disabled]))
373
- #menu-item
374
- #label-button:hover
375
- ~ #label-button-background::after {
378
+ #menu-item:has(#label-button:hover)
379
+ #label-button-background::after {
376
380
  opacity: 0.33;
377
381
  }
378
382
  :host([select-mode='highlight'][selected]:not([disabled]))
379
- #menu-item
380
- #label-button:hover
381
- ~ #label-button-background::after {
383
+ #menu-item:has(#label-button:hover)
384
+ #label-button-background::after {
382
385
  opacity: 0.66;
383
386
  }
384
387
 
@@ -403,7 +406,6 @@ UUIMenuItemElement.styles = [
403
406
  background-color: transparent;
404
407
  cursor: pointer;
405
408
  min-height: var(--uui-size-12,36px);
406
- z-index: 1;
407
409
  }
408
410
 
409
411
  #label-button {
@@ -421,7 +423,6 @@ UUIMenuItemElement.styles = [
421
423
  text-decoration: none;
422
424
  color: currentColor;
423
425
  min-height: var(--uui-size-12,36px);
424
- z-index: 1;
425
426
  font-weight: inherit;
426
427
  }
427
428
 
@@ -560,6 +561,9 @@ __decorateClass([
560
561
  __decorateClass([
561
562
  property({ type: String, attribute: "caret-label" })
562
563
  ], UUIMenuItemElement.prototype, "caretLabel", 2);
564
+ __decorateClass([
565
+ property({ attribute: false })
566
+ ], UUIMenuItemElement.prototype, "renderExpandSymbol", 2);
563
567
  __decorateClass([
564
568
  state()
565
569
  ], UUIMenuItemElement.prototype, "iconSlotHasContent", 2);
@@ -1,4 +1,4 @@
1
- import { LitElement } from 'lit';
1
+ import { LitElement, TemplateResult } from 'lit';
2
2
  declare const UUIMenuItemElement_base: (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").SelectOnlyMixinInterface) & (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").SelectableMixinInterface) & (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").ActiveMixinInterface) & (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").LabelMixinInterface) & typeof LitElement;
3
3
  /**
4
4
  * @element uui-menu-item
@@ -88,6 +88,10 @@ export declare class UUIMenuItemElement extends UUIMenuItemElement_base {
88
88
  * @default 'Reveal the underlying items'
89
89
  */
90
90
  caretLabel: string;
91
+ /**
92
+ * Overwrite the expand symbol rendering, this replaces the Expand Symbol from UI Library.
93
+ */
94
+ renderExpandSymbol?: () => Element | TemplateResult<1> | undefined;
91
95
  private iconSlotHasContent;
92
96
  connectedCallback(): void;
93
97
  focus(): Promise<void>;
@@ -97,7 +101,7 @@ export declare class UUIMenuItemElement extends UUIMenuItemElement_base {
97
101
  private _renderLabelInside;
98
102
  private _renderLabelAsAnchor;
99
103
  private _renderLabelAsButton;
100
- render(): import("lit-html").TemplateResult<1>;
104
+ render(): TemplateResult<1>;
101
105
  static styles: import("lit").CSSResult[];
102
106
  }
103
107
  declare global {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-menu-item",
3
- "version": "1.15.0-rc.0",
3
+ "version": "1.16.0-rc.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,9 +30,9 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "1.15.0-rc.0",
34
- "@umbraco-ui/uui-loader-bar": "1.15.0-rc.0",
35
- "@umbraco-ui/uui-symbol-expand": "1.15.0-rc.0"
33
+ "@umbraco-ui/uui-base": "1.16.0-rc.0",
34
+ "@umbraco-ui/uui-loader-bar": "1.16.0-rc.0",
35
+ "@umbraco-ui/uui-symbol-expand": "1.16.0-rc.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "npm run analyze && tsc --build && rollup -c rollup.config.js",
@@ -43,5 +43,5 @@
43
43
  "access": "public"
44
44
  },
45
45
  "homepage": "https://uui.umbraco.com/?path=/story/uui-menu-item",
46
- "gitHead": "7bc6ab964ec6b9ba1a628dce605c62f958bf8385"
46
+ "gitHead": "7bf1acd40b60feb81d82067ba2342d2b3e33c057"
47
47
  }