@aquera/nile-elements 1.3.1-beta-1.2 → 1.3.1-beta-1.4

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.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "1.3.1-beta-1.2",
6
+ "version": "1.3.1-beta-1.4",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { html, CSSResultArray, TemplateResult } from 'lit';
8
+ import { html, CSSResultArray, TemplateResult, PropertyValues } from 'lit';
9
9
  import { customElement, property, query } from 'lit/decorators.js';
10
10
  import { classMap } from 'lit/directives/class-map.js';
11
11
  import { styles } from './nile-side-bar-action.css';
@@ -22,6 +22,7 @@ import type NileIconButton from '../nile-icon-button/nile-icon-button';
22
22
  import type { NileMenu } from '../nile-menu';
23
23
  import type { NilePopup } from '../nile-popup';
24
24
  import '../nile-popup';
25
+ import { VisibilityManager } from '../utilities/visibility-manager.js';
25
26
 
26
27
  /**
27
28
  * Nile side-bar-action component.
@@ -85,6 +86,12 @@ export class NileSideBarAction extends NileElement {
85
86
  @property({ reflect: true }) triggerDropdown: 'click' | 'hover' = 'click';
86
87
  private hoverTimeout: number | undefined;
87
88
 
89
+ @property({ type: Boolean, reflect: true }) enableVisibilityEffect = false;
90
+
91
+ @property({ type: Boolean, reflect: true }) enableTabClose = false;
92
+
93
+ private visibilityManager?: VisibilityManager;
94
+
88
95
  connectedCallback() {
89
96
  super.connectedCallback();
90
97
  this.handlePanelSelect = this.handlePanelSelect.bind(this);
@@ -102,7 +109,7 @@ export class NileSideBarAction extends NileElement {
102
109
 
103
110
 
104
111
 
105
- firstUpdated() {
112
+ protected async firstUpdated(_changed: PropertyValues) {
106
113
  this.panel.hidden = !this.open;
107
114
 
108
115
  if (this.triggerDropdown === 'hover') {
@@ -122,6 +129,31 @@ export class NileSideBarAction extends NileElement {
122
129
  this.addOpenListeners();
123
130
  this.popup.active = true;
124
131
  }
132
+ await this.updateComplete;
133
+ const triggerNode = this.trigger.assignedElements({ flatten: true })[0] as HTMLElement | undefined;
134
+
135
+ this.visibilityManager = new VisibilityManager({
136
+ host: this,
137
+ target: triggerNode || null,
138
+ enableVisibilityEffect: this.enableVisibilityEffect,
139
+ enableTabClose: this.enableTabClose,
140
+ isOpen: () => this.open,
141
+ onAnchorOutOfView: () => {
142
+ this.hide();
143
+ this.emit('nile-visibility-change', {
144
+ visible: false,
145
+ reason: 'anchor-out-of-view',
146
+ });
147
+ },
148
+ onDocumentHidden: () => {
149
+ this.hide();
150
+ this.emit('nile-visibility-change', {
151
+ visible: false,
152
+ reason: 'document-hidden',
153
+ });
154
+ },
155
+ emit: (event, detail) => this.emit(`nile-${event}`, detail),
156
+ });
125
157
  }
126
158
 
127
159
  handleTriggerMouseEnter() {
@@ -137,6 +169,7 @@ export class NileSideBarAction extends NileElement {
137
169
  disconnectedCallback() {
138
170
  super.disconnectedCallback();
139
171
  this.removeOpenListeners();
172
+ this.visibilityManager?.cleanup();
140
173
  this.hide();
141
174
  this.emit('nile-destroy');
142
175
  }
@@ -302,6 +335,7 @@ export class NileSideBarAction extends NileElement {
302
335
 
303
336
  @watch('open', { waitUntilFirstUpdate: true })
304
337
  async handleOpenChange() {
338
+ this.visibilityManager?.setup();
305
339
  if (this.disabled) {
306
340
  this.open = false;
307
341
  return;
@@ -321,7 +355,7 @@ export class NileSideBarAction extends NileElement {
321
355
  } else {
322
356
  this.emit('nile-hide');
323
357
  this.removeOpenListeners();
324
-
358
+ this.visibilityManager?.cleanup();
325
359
  await stopAnimations(this);
326
360
  const { keyframes, options } = getAnimation(this, 'dropdown.hide', { dir: '' });
327
361
  await animateTo(this.popup.popup, keyframes, options);
@@ -58,6 +58,10 @@ export const styles = css`
58
58
  background: var(--nile-colors-neutral-400);
59
59
  height: 38px;
60
60
  }
61
+ :host([type='support']) .footer-item:hover{
62
+ background: var(--nile-colors-neutral-500);
63
+ }
64
+
61
65
  :host([type='support'][active]) .footer-item {
62
66
  background: var(--nile-colors-neutral-500);
63
67
  }
@@ -4145,7 +4145,7 @@
4145
4145
  },
4146
4146
  {
4147
4147
  "name": "nile-side-bar-action",
4148
- "description": "Nile side-bar-action component.\n\nEvents:\n\n * `nile-show` {} - Fired when dropdown opens.\n\n * `nile-after-show` {} - Fired after dropdown + animations.\n\n * `nile-hide` {} - Fired when dropdown closes.\n\n * `nile-after-hide` {} - Fired after dropdown closes + animations.\n\nSlots:\n\n * `trigger` {} - The clickable trigger (icon/button).\n\n * ` ` {} - The dropdown panel content (menu, custom content).\n\nAttributes:\n\n * `open` {`boolean`} - Whether the dropdown is open\n\n * `placement` {`TooltipPosition`} - Preferred placement relative to trigger\n\n * `disabled` {`boolean`} - Disable interaction\n\n * `stay-open-on-select` {`boolean`} - Keep open on select\n\n * `distance` {`number`} - Offsets\n\n * `skidding` {`number`} - \n\n * `sync` {`\"width\" | \"height\" | \"both\"`} - Sync size with trigger\n\n * `hoist` {`boolean`} - Hoist above scroll containers\n\n * `triggerDropdown` {`\"click\" | \"hover\"`} - \n\nProperties:\n\n * `styles` {`CSSResultArray`} - \n\n * `popup` - \n\n * `trigger` {`HTMLSlotElement`} - \n\n * `panel` {`HTMLSlotElement`} - \n\n * `open` {`boolean`} - Whether the dropdown is open\n\n * `placement` {`TooltipPosition`} - Preferred placement relative to trigger\n\n * `disabled` {`boolean`} - Disable interaction\n\n * `stayOpenOnSelect` {`boolean`} - Keep open on select\n\n * `containingElement` {`HTMLElement | undefined`} - External containing element (default: self)\n\n * `distance` {`number`} - Offsets\n\n * `skidding` {`number`} - \n\n * `sync` {`\"width\" | \"height\" | \"both\"`} - Sync size with trigger\n\n * `hoist` {`boolean`} - Hoist above scroll containers\n\n * `triggerDropdown` {`\"click\" | \"hover\"`} - \n\n * `hoverTimeout` {`number | undefined`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
4148
+ "description": "Nile side-bar-action component.\n\nEvents:\n\n * `nile-show` {} - Fired when dropdown opens.\n\n * `nile-after-show` {} - Fired after dropdown + animations.\n\n * `nile-hide` {} - Fired when dropdown closes.\n\n * `nile-after-hide` {} - Fired after dropdown closes + animations.\n\nSlots:\n\n * `trigger` {} - The clickable trigger (icon/button).\n\n * ` ` {} - The dropdown panel content (menu, custom content).\n\nAttributes:\n\n * `open` {`boolean`} - Whether the dropdown is open\n\n * `placement` {`TooltipPosition`} - Preferred placement relative to trigger\n\n * `disabled` {`boolean`} - Disable interaction\n\n * `stay-open-on-select` {`boolean`} - Keep open on select\n\n * `distance` {`number`} - Offsets\n\n * `skidding` {`number`} - \n\n * `sync` {`\"width\" | \"height\" | \"both\"`} - Sync size with trigger\n\n * `hoist` {`boolean`} - Hoist above scroll containers\n\n * `triggerDropdown` {`\"click\" | \"hover\"`} - \n\n * `enableVisibilityEffect` {`boolean`} - \n\n * `enableTabClose` {`boolean`} - \n\nProperties:\n\n * `styles` {`CSSResultArray`} - \n\n * `popup` - \n\n * `trigger` {`HTMLSlotElement`} - \n\n * `panel` {`HTMLSlotElement`} - \n\n * `open` {`boolean`} - Whether the dropdown is open\n\n * `placement` {`TooltipPosition`} - Preferred placement relative to trigger\n\n * `disabled` {`boolean`} - Disable interaction\n\n * `stayOpenOnSelect` {`boolean`} - Keep open on select\n\n * `containingElement` {`HTMLElement | undefined`} - External containing element (default: self)\n\n * `distance` {`number`} - Offsets\n\n * `skidding` {`number`} - \n\n * `sync` {`\"width\" | \"height\" | \"both\"`} - Sync size with trigger\n\n * `hoist` {`boolean`} - Hoist above scroll containers\n\n * `triggerDropdown` {`\"click\" | \"hover\"`} - \n\n * `hoverTimeout` {`number | undefined`} - \n\n * `enableVisibilityEffect` {`boolean`} - \n\n * `enableTabClose` {`boolean`} - \n\n * `visibilityManager` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
4149
4149
  "attributes": [
4150
4150
  {
4151
4151
  "name": "open",
@@ -4244,6 +4244,16 @@
4244
4244
  }
4245
4245
  ]
4246
4246
  },
4247
+ {
4248
+ "name": "enableVisibilityEffect",
4249
+ "description": "`enableVisibilityEffect` {`boolean`} - \n\nProperty: enableVisibilityEffect\n\nDefault: false",
4250
+ "valueSet": "v"
4251
+ },
4252
+ {
4253
+ "name": "enableTabClose",
4254
+ "description": "`enableTabClose` {`boolean`} - \n\nProperty: enableTabClose\n\nDefault: false",
4255
+ "valueSet": "v"
4256
+ },
4247
4257
  {
4248
4258
  "name": "onnile-show",
4249
4259
  "description": "`nile-show` {} - Fired when dropdown opens."