@aquera/nile-visualization 1.0.0 → 1.2.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.
@@ -36,4 +36,6 @@ export interface NileExecutiveSummaryConfig {
36
36
  closeOnEscape?: boolean;
37
37
  /** Prevent the drawer from closing when the overlay is clicked. Default: false */
38
38
  preventOverlayClose?: boolean;
39
+ zIndex?: number;
40
+ hideOverlay?: boolean;
39
41
  }
@@ -11,8 +11,7 @@ export const styles = css `
11
11
  -webkit-font-smoothing: antialiased;
12
12
  -moz-osx-font-smoothing: grayscale;
13
13
  text-rendering: optimizeLegibility;
14
- display: inline-block;
15
- position: relative;
14
+ display: contents;
16
15
  }
17
16
 
18
17
  :host *,
@@ -186,6 +185,14 @@ export const styles = css `
186
185
  word-break: break-word;
187
186
  }
188
187
 
188
+ /* ─── Skeleton loading state ───────────────────────────────────────────── */
189
+
190
+ .es-skeleton {
191
+ display: flex;
192
+ flex-direction: column;
193
+ gap: 12px;
194
+ }
195
+
189
196
  @media (forced-colors: active) {
190
197
  .es-panel {
191
198
  border: 1px solid ButtonText;
@@ -71,6 +71,15 @@ export declare class NileExecutiveSummary extends NileElement {
71
71
  * Can be set programmatically; use `show()` / `hide()` for animated transitions.
72
72
  */
73
73
  open: boolean;
74
+ /**
75
+ * Whether the drawer body is in a loading state. When `true`, the body renders
76
+ * `nile-skeleton-loader` placeholders instead of the typed summary. Toggle it
77
+ * off (set to `false`) once data arrives from the API — at which point the
78
+ * typewriter animation begins if the drawer is already open.
79
+ */
80
+ loading: boolean;
81
+ zIndex: number | null;
82
+ hideOverlay: boolean;
74
83
  /** @internal Characters revealed so far during typing. */
75
84
  private displayedText;
76
85
  /** @internal Whether typing is still in progress (drives cursor visibility). */
@@ -84,12 +93,14 @@ export declare class NileExecutiveSummary extends NileElement {
84
93
  private lockScroll;
85
94
  private unlockScroll;
86
95
  private animatePanel;
96
+ private get overlayHidden();
87
97
  private animateOverlay;
88
98
  private requestClose;
89
99
  private startTyping;
90
100
  private stopTyping;
91
101
  /** Opens the drawer with animation. Resolves when the animation completes. */
92
102
  show(): Promise<void>;
103
+ updated(changed: Map<string, unknown>): void;
93
104
  /** Closes the drawer with animation. Resolves when the animation completes. */
94
105
  hide(): Promise<void>;
95
106
  render(): TemplateResult;
@@ -7,6 +7,7 @@
7
7
  import { __decorate } from "tslib";
8
8
  import { customElement, property, query, state } from 'lit/decorators.js';
9
9
  import { classMap } from 'lit/directives/class-map.js';
10
+ import { styleMap } from 'lit/directives/style-map.js';
10
11
  import { html } from 'lit';
11
12
  import { unsafeHTML } from 'lit/directives/unsafe-html.js';
12
13
  import NileElement from '../internal/nile-element.js';
@@ -72,6 +73,15 @@ let NileExecutiveSummary = class NileExecutiveSummary extends NileElement {
72
73
  * Can be set programmatically; use `show()` / `hide()` for animated transitions.
73
74
  */
74
75
  this.open = false;
76
+ /**
77
+ * Whether the drawer body is in a loading state. When `true`, the body renders
78
+ * `nile-skeleton-loader` placeholders instead of the typed summary. Toggle it
79
+ * off (set to `false`) once data arrives from the API — at which point the
80
+ * typewriter animation begins if the drawer is already open.
81
+ */
82
+ this.loading = false;
83
+ this.zIndex = null;
84
+ this.hideOverlay = false;
75
85
  /** @internal Characters revealed so far during typing. */
76
86
  this.displayedText = '';
77
87
  /** @internal Whether typing is still in progress (drives cursor visibility). */
@@ -126,7 +136,12 @@ let NileExecutiveSummary = class NileExecutiveSummary extends NileElement {
126
136
  const to = show ? { opacity: '1', translate: '0' } : { opacity: '0', translate: '100%' };
127
137
  await this.panel.animate([from, to], { duration: 250, easing: 'ease', fill: 'forwards' }).finished;
128
138
  }
139
+ get overlayHidden() {
140
+ return this.hideOverlay || (this.config?.hideOverlay ?? false);
141
+ }
129
142
  async animateOverlay(show) {
143
+ if (!this.overlay)
144
+ return;
130
145
  const from = show ? { opacity: '0' } : { opacity: '1' };
131
146
  const to = show ? { opacity: '1' } : { opacity: '0' };
132
147
  await this.overlay.animate([from, to], { duration: 250, fill: 'forwards' }).finished;
@@ -185,7 +200,13 @@ let NileExecutiveSummary = class NileExecutiveSummary extends NileElement {
185
200
  await Promise.all([this.animatePanel(true), this.animateOverlay(true)]);
186
201
  requestAnimationFrame(() => this.panel.focus({ preventScroll: true }));
187
202
  this.emit('nile-after-show');
188
- this.startTyping();
203
+ if (!this.loading)
204
+ this.startTyping();
205
+ }
206
+ updated(changed) {
207
+ if (changed.has('loading') && changed.get('loading') === true && !this.loading && this.open) {
208
+ this.startTyping();
209
+ }
189
210
  }
190
211
  /** Closes the drawer with animation. Resolves when the animation completes. */
191
212
  async hide() {
@@ -213,6 +234,10 @@ let NileExecutiveSummary = class NileExecutiveSummary extends NileElement {
213
234
  const buttonLabel = this.config?.buttonLabel ?? 'Executive Summary';
214
235
  const buttonVariant = this.config?.buttonVariant ?? 'primary';
215
236
  const drawerLabel = this.config?.drawerLabel ?? 'Executive Summary';
237
+ const resolvedZ = this.zIndex ?? this.config?.zIndex;
238
+ const backdropStyles = resolvedZ != null
239
+ ? { '--executive-summary-z-index': String(resolvedZ), zIndex: String(resolvedZ) }
240
+ : {};
216
241
  return html `
217
242
  <div part="base">
218
243
 
@@ -227,14 +252,18 @@ let NileExecutiveSummary = class NileExecutiveSummary extends NileElement {
227
252
  >${buttonLabel}</nile-button>
228
253
 
229
254
  <!-- Fixed backdrop: overlay + panel -->
230
- <div class="es-backdrop">
255
+ <div class="es-backdrop" style=${styleMap(backdropStyles)}>
231
256
 
232
- <div
233
- part="overlay"
234
- class="es-overlay"
235
- @click=${() => this.requestClose('overlay')}
236
- tabindex="-1"
237
- ></div>
257
+ ${this.overlayHidden
258
+ ? ''
259
+ : html `
260
+ <div
261
+ part="overlay"
262
+ class="es-overlay"
263
+ @click=${() => this.requestClose('overlay')}
264
+ tabindex="-1"
265
+ ></div>
266
+ `}
238
267
 
239
268
  <div
240
269
  part="panel"
@@ -264,12 +293,24 @@ let NileExecutiveSummary = class NileExecutiveSummary extends NileElement {
264
293
  </header>
265
294
 
266
295
  <div part="body" class="es-body">
267
- <div
268
- class=${classMap({
269
- 'es-typed-text': true,
270
- 'es-typed-text--typing': this.isTyping,
271
- })}
272
- >${unsafeHTML(this.displayedText)}</div>
296
+ ${this.loading
297
+ ? html `
298
+ <div part="skeleton" class="es-skeleton" aria-busy="true" aria-live="polite">
299
+ <nile-skeleton-loader variant="text" width="90%"></nile-skeleton-loader>
300
+ <nile-skeleton-loader variant="text" width="95%"></nile-skeleton-loader>
301
+ <nile-skeleton-loader variant="text" width="80%"></nile-skeleton-loader>
302
+ <nile-skeleton-loader variant="text" width="70%"></nile-skeleton-loader>
303
+ <nile-skeleton-loader variant="text" width="85%"></nile-skeleton-loader>
304
+ </div>
305
+ `
306
+ : html `
307
+ <div
308
+ class=${classMap({
309
+ 'es-typed-text': true,
310
+ 'es-typed-text--typing': this.isTyping,
311
+ })}
312
+ >${unsafeHTML(this.displayedText)}</div>
313
+ `}
273
314
  <slot></slot>
274
315
  </div>
275
316
 
@@ -295,6 +336,15 @@ __decorate([
295
336
  __decorate([
296
337
  property({ type: Boolean, reflect: true })
297
338
  ], NileExecutiveSummary.prototype, "open", void 0);
339
+ __decorate([
340
+ property({ type: Boolean, reflect: true })
341
+ ], NileExecutiveSummary.prototype, "loading", void 0);
342
+ __decorate([
343
+ property({ type: Number, reflect: true, attribute: 'z-index' })
344
+ ], NileExecutiveSummary.prototype, "zIndex", void 0);
345
+ __decorate([
346
+ property({ type: Boolean, reflect: true, attribute: 'hide-overlay' })
347
+ ], NileExecutiveSummary.prototype, "hideOverlay", void 0);
298
348
  __decorate([
299
349
  state()
300
350
  ], NileExecutiveSummary.prototype, "displayedText", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/nile-visualization",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "A visualization Library for the Nile Design System",
5
5
  "license": "MIT",
6
6
  "author": "Aquera Inc",