@ncino/web-components 13.9.1 → 13.9.2
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/dist/components/tooltip/gator/tooltip.gator.js +4 -3
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/packages/web-components/src/components/modal/gator/modal.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/tooltip/tooltip.scss.js +1 -1
- package/dist/types/components/tooltip/gator/tooltip.gator.d.ts +6 -0
- package/dist/types/components/tooltip/tooltip.d.ts +9 -0
- package/package.json +3 -3
- package/web-types.json +3 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import{NjcTooltip as
|
|
2
|
-
<div ${
|
|
1
|
+
import{NjcTooltip as c}from"../tooltip.js";import"../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";import{html as d}from"../../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.js";import{LitElement as f}from"../../../node_modules/.pnpm/lit-element@4.2.2/node_modules/lit-element/lit-element.js";import{ref as m}from"../../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/ref.js";import{customElement as h}from"../../../utils/decorators/custom-element-decorator.js";import a from"../../../packages/web-components/src/components/tooltip/gator/tooltip.gator.scss.js";import u from"../../../packages/web-components/src/components/tooltip/tooltip.scss.js";import b from"../../../packages/styles/dist/tokens/primitive.tokens.css.js";import g from"../../../packages/styles/dist/tokens/semantic.tokens.css.js";import{autoUpdate as y,computePosition as P}from"../../../node_modules/.pnpm/@floating-ui_dom@1.7.5/node_modules/@floating-ui/dom/dist/floating-ui.dom.js";import{unsafeCSS as p}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";var _=Object.getOwnPropertyDescriptor,v=(t,i,e,r)=>{for(var s=r>1?void 0:r?_(i,e):i,n=t.length-1,l;n>=0;n--)(l=t[n])&&(s=l(s)||s);return s};let o=class extends c{constructor(){super(...arguments),this._portaledPopup=null}render(){return d`
|
|
2
|
+
<div ${m(this._tooltipRef)} class="gator-tooltip ${this.nubbinPositionClass}" role="tooltip" id="${this.tooltipId}">
|
|
3
3
|
<div class="gator-tooltip-body">
|
|
4
4
|
<slot></slot>
|
|
5
5
|
</div>
|
|
6
6
|
</div>
|
|
7
|
-
`}get xPositionOffset(){return this.placement.includes("left")?-12+this.xOffset:this.placement.includes("right")?12+this.xOffset:0}get yPositionOffset(){return this.placement.includes("top")?-12+this.yOffset:this.placement.includes("bottom")?12+this.yOffset:0}get nubbinPositionClass(){switch(this.placement){case"top":return"gator-tooltip-nubbin_bottom";case"right":return"gator-tooltip-nubbin_left";case"bottom":return"gator-tooltip-nubbin_top";case"left":return"gator-tooltip-nubbin_right"}return""}
|
|
7
|
+
`}get xPositionOffset(){return this.placement.includes("left")?-12+this.xOffset:this.placement.includes("right")?12+this.xOffset:0}get yPositionOffset(){return this.placement.includes("top")?-12+this.yOffset:this.placement.includes("bottom")?12+this.yOffset:0}get nubbinPositionClass(){switch(this.placement){case"top":return"gator-tooltip-nubbin_bottom";case"right":return"gator-tooltip-nubbin_left";case"bottom":return"gator-tooltip-nubbin_top";case"left":return"gator-tooltip-nubbin_right"}return""}getActivePopup(){return this._portaledPopup??this._tooltipRef.value??null}preparePopupForShow(){const t=this._tooltipRef.value;if(!t)return;if(!o.portalStylesInjected){const e=document.createElement("style");e.setAttribute("data-ngc-tooltip-portal",""),e.textContent=`${a}
|
|
8
|
+
${u}`,document.head.appendChild(e),o.portalStylesInjected=!0}t.parentElement!==document.body&&document.body.appendChild(t),this._portaledPopup=t,t.style.width="max-content",t.querySelector(".gator-tooltip-body")?.replaceChildren(...Array.from(this.childNodes).map(e=>e.cloneNode(!0)))}cleanupPopupAfterHide(){this._cleanup&&(this._cleanup(),this._cleanup=void 0);const t=this._portaledPopup;t?.parentElement===document.body&&this.renderRoot.appendChild(t),this._portaledPopup=null}disconnectedCallback(){this._portaledPopup?.remove(),this._portaledPopup=null,super.disconnectedCallback()}assignPosition(){const t=this.referenceElement,i=this.getActivePopup();!t||!i||(this._cleanup?.(),this._cleanup=y(t,i,async()=>{const e=this.referenceElement,r=this.getActivePopup();if(!e||!r)return;const{x:s,y:n}=await P(e,r,{placement:this.placement,strategy:"fixed"});Object.assign(r.style,{position:"fixed",left:`${s+this.xPositionOffset}px`,top:`${n+this.yPositionOffset}px`,right:"auto",bottom:"auto"})}))}};o.portalStylesInjected=!1;o.shadowRootOptions={...f.shadowRootOptions,delegatesFocus:!0,mode:"open"};o.styles=[p(a),p(u),p(b),p(g)];o=v([h("ngc-tooltip")],o);export{o as NgcTooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{property as
|
|
1
|
+
import{property as n}from"../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";import{createRef as c}from"../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/ref.js";import{KEY_CONSTANTS as u}from"../../consts/key-constants.js";import{generateRandomId as f}from"../../utils/string-utils.js";import{TestableLitElement as p}from"../../utils/components/testable-lit-element/testable-lit-element.js";import{handleDataTestid as h}from"../../utils/datatestid-utils.js";import{getFirstFocusableElement as _}from"../../utils/accessibility-utils.js";var v=Object.defineProperty,o=(l,e,t,i)=>{for(var s=void 0,r=l.length-1,a;r>=0;r--)(a=l[r])&&(s=a(e,t,s)||s);return s&&v(e,t,s),s};const m=100;class d extends p{constructor(){super(...arguments),this.referenceId="",this.placement="top-end",this.xOffset=0,this.yOffset=0,this.isLabel=!1,this._tooltipRef=c(),this._forceOpen=!1,this._initialized=!1,this._boundReferenceElement=null,this.elementListeners=new WeakMap,this.tooltipId=f()}firstUpdated(){this.hideTooltip(),this._tryInitialize(),this._observeReferenceAvailability()}updated(e){super.updated(e),(e.has("referenceId")||e.has("isLabel"))&&(this._disconnectReferenceObserver(),this._teardown()),this._initialized||(this._tryInitialize(),this._observeReferenceAvailability())}get referenceElement(){if(!this.referenceId)return null;const e=this.previousElementSibling;if(e?.id===this.referenceId)return e;const t=`[id="${CSS.escape(this.referenceId)}"]`;let i=this.parentElement?.querySelector(t);return i||(i=document.getElementById(this.referenceId)),i||(i=document.querySelector(`[data-id="${CSS.escape(this.referenceId)}"]`)?.shadowRoot?.querySelector(t)),i||(i=this.getRootNode().querySelector?.(t)),i}_observeReferenceAvailability(){if(this._initialized||!this.referenceId||this._initObserver)return;const e=this.parentElement??document.body;this._initObserver=new MutationObserver(()=>{if(this._initialized){this._disconnectReferenceObserver();return}this._tryInitialize()}),this._initObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0,subtree:!0})}_disconnectReferenceObserver(){this._initObserver?.disconnect(),this._initObserver=void 0}_tryInitialize(){if(this._initialized||!this.referenceId)return;const e=this.referenceElement,t=this._tooltipRef.value;!e||!t||(h(e,this.dataTestid,"trigger"),h(t,this.dataTestid,"tooltip"),this._updateAriaAssociation(e,!0),this._addInteractionEvents(e,t),this._initialized=!0,this._boundReferenceElement=e,this._disconnectReferenceObserver())}_teardown(){if(!this._initialized)return;this._clearScheduledHide();const e=this._boundReferenceElement,t=this._tooltipRef.value;e&&(this._updateAriaAssociation(e,!1),this.removeAllTrackedEventListeners(e)),t&&this.removeAllTrackedEventListeners(t),this.removeAllTrackedEventListeners(document),this._initialized=!1,this._boundReferenceElement=null}_getAriaTargetElement(e){return e.shadowRoot?.delegatesFocus?_(e):e}_updateAriaAssociation(e,t){const i=this._getAriaTargetElement(e);if(!i)return;if(this.isLabel){const r=i.ariaLabelledByElements??[];i.ariaLabelledByElements=t?[...r,this]:r.filter(a=>a!==this);return}const s=i.ariaDescribedByElements??[];i.ariaDescribedByElements=t?[...s,this]:s.filter(r=>r!==this)}_addInteractionEvents(e,t){const i=()=>{this._clearScheduledHide(),this.showTooltip()};this.addTrackedEventListener(e,"mouseenter",i),this.addTrackedEventListener(e,"mouseleave",()=>this._scheduleHide()),this.addTrackedEventListener(e,"focusin",()=>this.showTooltip()),this.addTrackedEventListener(e,"focusout",()=>this.hideTooltip()),this.addTrackedEventListener(t,"mouseenter",i),this.addTrackedEventListener(t,"mouseleave",()=>this._scheduleHide()),this.addTrackedEventListener(document,"keydown",s=>{s instanceof KeyboardEvent&&s.key===u.ESCAPE&&(this._forceOpen=!1,this.hideTooltip())})}_scheduleHide(){this._clearScheduledHide(),this._hideTimeoutId=setTimeout(()=>this.hideTooltip(),m)}_clearScheduledHide(){this._hideTimeoutId!==void 0&&(clearTimeout(this._hideTimeoutId),this._hideTimeoutId=void 0)}addTrackedEventListener(e,t,i,s={}){this.elementListeners.has(e)||this.elementListeners.set(e,[]),this.elementListeners.get(e).push({eventType:t,listener:i,options:s}),e.addEventListener(t,i,s)}removeAllTrackedEventListeners(e){if(!this.elementListeners.has(e))return;const t=this.elementListeners.get(e);for(const{eventType:i,listener:s,options:r}of t)e.removeEventListener(i,s,r);this.elementListeners.delete(e)}toggleTooltip(){this._forceOpen=!this._forceOpen,this._forceOpen?this.showTooltip():this.hideTooltip()}disconnectedCallback(){this._disconnectReferenceObserver(),this._teardown(),this._cleanup&&this._cleanup(),super.disconnectedCallback()}getActivePopup(){return this._tooltipRef.value??null}preparePopupForShow(){}cleanupPopupAfterHide(){}showTooltip(){this.preparePopupForShow(),this.assignPosition();const e=this.getActivePopup();e&&(e.style.visibility="visible",e.style.opacity="1")}hideTooltip(){if(this._forceOpen)return;this._clearScheduledHide();const e=this.getActivePopup();e&&(e.style.visibility="hidden",e.style.opacity="0"),this.cleanupPopupAfterHide()}assignPosition(){}}o([n({attribute:"reference-id"})],d.prototype,"referenceId");o([n()],d.prototype,"placement");o([n({type:Number,attribute:"x-offset"})],d.prototype,"xOffset");o([n({type:Number,attribute:"y-offset"})],d.prototype,"yOffset");o([n({type:Boolean,attribute:"is-label"})],d.prototype,"isLabel");export{d as NjcTooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a=".gator-modal-dialog{border:none;padding:0;background:transparent;inset:0;display:grid;place-items:center}.gator-modal-dialog::backdrop{background-color:var(--color-overlay-secondary)}.gator-modal{--ngc-card-position: static;--ngc-card-top: auto;--ngc-card-left: auto;--ngc-card-max-width: none;--ngc-card-transform: none}.gator-modal-wrapper{display:flex;flex-direction:column;max-height:90vh;
|
|
1
|
+
const a=".gator-modal-dialog{border:none;padding:0;background:transparent;inset:0;display:grid;place-items:center;overflow:hidden}.gator-modal-dialog::backdrop{background-color:var(--color-overlay-secondary)}.gator-modal{--ngc-card-position: static;--ngc-card-top: auto;--ngc-card-left: auto;--ngc-card-max-width: none;--ngc-card-transform: none}.gator-modal-wrapper{display:flex;flex-direction:column;max-height:90vh;min-height:0;overflow-y:hidden}.gator-modal-header{flex-shrink:0;display:flex;flex-direction:row;justify-content:space-between;align-items:center;background:var(--color-surface-secondary)}.gator-modal-header .gator-modal-close-button{--ngc-icon-button-hover-box-shadow: none}.gator-modal-content{flex-grow:1;min-height:0;padding:var(--spacing-10) var(--spacing-10) var(--spacing-11) var(--spacing-10);overflow-y:var(--ngc-modal-overflow-y, auto)}.gator-modal-content ngc-skeleton-loader:first-child{--ngc-skeleton-loader-margin: 0 0 var(--spacing-5) 0}.gator-modal-footer{flex-shrink:0;display:flex;padding:var(--spacing-10)}.gator-modal-warning{display:flex;flex-direction:row;align-items:center}.gator-modal-warning ngc-icon{--ngc-icon-color: var(--color-text-error);--ngc-icon-margin: 0 var(--spacing-5) 0 0}.gator-modal-warning ngc-input-label{--ngc-input-label-color: var(--color-text-error);--ngc-input-label-font-size: var(--font-size-body-2);--ngc-input-label-line-height: var(--line-height-body-2)}.gator-modal-action-buttons{display:flex;gap:var(--spacing-5)}.gator-modal ngc-card-header{width:100%}.gator-modal--small{--ngc-card-width: var(--ngc-modal-width, 375px);--ngc-card-border-radius: var(--border-radius-medium)}.gator-modal--small .gator-modal-header{border-radius:var(--border-radius-medium) var(--border-radius-medium) 0 0}.gator-modal--small .gator-modal-content{padding:var(--spacing-8) var(--spacing-8) 56px var(--spacing-8)}.gator-modal--small .gator-modal-footer{flex-direction:column-reverse;align-items:center;padding:var(--spacing-8)}.gator-modal--small .gator-modal-warning{margin-top:var(--spacing-10)}.gator-modal--small .gator-modal-action-buttons{flex-direction:column-reverse;width:100%}.gator-modal--small .gator-modal-action-buttons ngc-button{--ngc-button-width: 100% }.gator-modal--standard{--ngc-card-width: var(--ngc-modal-width, 600px)}.gator-modal--standard .gator-modal-header{--ngc-card-header-padding: var(--spacing-10);border-radius:var(--border-radius-x-large) var(--border-radius-x-large) 0 0}.gator-modal--standard .gator-modal-footer{flex-direction:row}.gator-modal--standard .gator-modal-warning{margin-right:auto}.gator-modal--standard .gator-modal-action-buttons{margin-left:auto}.gator-modal--standard .gator-modal-action-buttons ngc-skeleton-loader:first-child{--ngc-skeleton-loader-margin: 0 var(--spacing-5) 0 0}.gator-modal--fullscreen{--ngc-card-border-radius: var(--border-radius-no-radius)}.gator-modal--fullscreen .gator-modal-wrapper{height:100vh;width:100vw;max-height:100vh}.gator-modal--fullscreen .gator-modal-header{--ngc-card-header-padding: var(--spacing-10);padding-left:48px}.gator-modal--fullscreen .gator-modal-header ngc-card-header{justify-content:center;--ngc-text-detail-content-alignment: center}.gator-modal--fullscreen .gator-modal-content{background:var(--color-surface-secondary)}.gator-modal--fullscreen .gator-modal-footer{flex-direction:column-reverse;justify-content:center;align-items:center;border-top:1px solid var(--color-border-tertiary)}.gator-modal--fullscreen .gator-modal-warning{margin-top:var(--spacing-5)}.gator-dialog--fullscreen{max-height:100%;max-width:100%;margin:0}";export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t="div[role=tooltip]{position:
|
|
1
|
+
const t="div[role=tooltip]{position:fixed;width:max-content;top:0;left:0;z-index:9999;visibility:hidden;opacity:0;transition:opacity .2s}#floating{position:absolute;width:max-content;top:0;left:0;z-index:9999}";export{t as default};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { NjcTooltip } from '../tooltip.ts';
|
|
2
2
|
export declare class NgcTooltip extends NjcTooltip {
|
|
3
|
+
private static portalStylesInjected;
|
|
4
|
+
private _portaledPopup;
|
|
3
5
|
static shadowRootOptions: {
|
|
4
6
|
delegatesFocus: boolean;
|
|
5
7
|
mode: ShadowRootMode;
|
|
@@ -13,5 +15,9 @@ export declare class NgcTooltip extends NjcTooltip {
|
|
|
13
15
|
get xPositionOffset(): number;
|
|
14
16
|
get yPositionOffset(): number;
|
|
15
17
|
get nubbinPositionClass(): "" | "gator-tooltip-nubbin_bottom" | "gator-tooltip-nubbin_left" | "gator-tooltip-nubbin_top" | "gator-tooltip-nubbin_right";
|
|
18
|
+
protected getActivePopup(): HTMLElement | null;
|
|
19
|
+
protected preparePopupForShow(): void;
|
|
20
|
+
protected cleanupPopupAfterHide(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
16
22
|
assignPosition(): void;
|
|
17
23
|
}
|
|
@@ -12,6 +12,7 @@ export declare class NjcTooltip extends TestableLitElement {
|
|
|
12
12
|
_cleanup: (() => void) | undefined;
|
|
13
13
|
private _forceOpen;
|
|
14
14
|
private _hideTimeoutId;
|
|
15
|
+
private _initObserver;
|
|
15
16
|
private _initialized;
|
|
16
17
|
private _boundReferenceElement;
|
|
17
18
|
private elementListeners;
|
|
@@ -19,6 +20,8 @@ export declare class NjcTooltip extends TestableLitElement {
|
|
|
19
20
|
firstUpdated(): void;
|
|
20
21
|
updated(changedProperties: PropertyValues): void;
|
|
21
22
|
get referenceElement(): HTMLElement | null;
|
|
23
|
+
private _observeReferenceAvailability;
|
|
24
|
+
private _disconnectReferenceObserver;
|
|
22
25
|
private _tryInitialize;
|
|
23
26
|
private _teardown;
|
|
24
27
|
private _getAriaTargetElement;
|
|
@@ -30,6 +33,12 @@ export declare class NjcTooltip extends TestableLitElement {
|
|
|
30
33
|
removeAllTrackedEventListeners(element: HTMLElement | Document): void;
|
|
31
34
|
toggleTooltip(): void;
|
|
32
35
|
disconnectedCallback(): void;
|
|
36
|
+
/** Popup element used for positioning and visibility. Gator overrides when portaling. */
|
|
37
|
+
protected getActivePopup(): HTMLElement | null;
|
|
38
|
+
/** Called before positioning when the popup is shown. */
|
|
39
|
+
protected preparePopupForShow(): void;
|
|
40
|
+
/** Called after the popup is hidden. */
|
|
41
|
+
protected cleanupPopupAfterHide(): void;
|
|
33
42
|
showTooltip(): void;
|
|
34
43
|
hideTooltip(): void;
|
|
35
44
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ncino/web-components",
|
|
3
3
|
"author": "nCino",
|
|
4
|
-
"version": "13.9.
|
|
4
|
+
"version": "13.9.2",
|
|
5
5
|
"license": "(c) Copyright 2023 nCino, Inc., all rights reserved",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"vite-plugin-static-copy": "^3.3.0",
|
|
101
101
|
"vitest": "^4.1.0",
|
|
102
102
|
"yaml-eslint-parser": "^2.0.0",
|
|
103
|
-
"@ncino/styles": "13.9.
|
|
103
|
+
"@ncino/styles": "13.9.2"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@ncino/styles": "13.9.
|
|
106
|
+
"@ncino/styles": "13.9.2"
|
|
107
107
|
},
|
|
108
108
|
"bugs": {
|
|
109
109
|
"url": "https://github.com/ncino/force-sdk-web-components/issues"
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@ncino/web-components",
|
|
4
|
-
"version": "13.9.
|
|
4
|
+
"version": "13.9.1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -1995,7 +1995,7 @@
|
|
|
1995
1995
|
},
|
|
1996
1996
|
{
|
|
1997
1997
|
"name": "ngc-tooltip",
|
|
1998
|
-
"description": "\n---\n\n\n### **Methods:**\n - **assignPosition()** - Override this function to use floating UI autoUpdate and computePosition",
|
|
1998
|
+
"description": "\n---\n\n\n### **Methods:**\n \n\n\n- **assignPosition()** - Override this function to use floating UI autoUpdate and computePosition",
|
|
1999
1999
|
"doc-url": "",
|
|
2000
2000
|
"attributes": [
|
|
2001
2001
|
{
|
|
@@ -7553,7 +7553,7 @@
|
|
|
7553
7553
|
},
|
|
7554
7554
|
{
|
|
7555
7555
|
"name": "nsc-tooltip",
|
|
7556
|
-
"description": "\n---\n\n\n### **Methods:**\n - **assignPosition()** - Override this function to use floating UI autoUpdate and computePosition",
|
|
7556
|
+
"description": "\n---\n\n\n### **Methods:**\n - **assignPosition()** - Override this function to use floating UI autoUpdate and computePosition\n\n\n",
|
|
7557
7557
|
"doc-url": "",
|
|
7558
7558
|
"attributes": [
|
|
7559
7559
|
{
|