@nordhealth/components 1.0.0-beta.19 → 1.0.0-beta.21
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/custom-elements.json +2816 -2676
- package/lib/Avatar.js +1 -1
- package/lib/Badge.js +1 -1
- package/lib/Banner.js +1 -1
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/{Calendar-0fdddc93.js → Calendar-600fd148.js} +2 -2
- package/lib/{Calendar-0fdddc93.js.map → Calendar-600fd148.js.map} +1 -1
- package/lib/Calendar.js +1 -1
- package/lib/Card.js +1 -1
- package/lib/Checkbox.js +1 -1
- package/lib/CommandMenu.js +1 -1
- package/lib/CommandMenuAction.js +1 -1
- package/lib/{Component-6762b5eb.js → Component-9d373ef3.js} +2 -2
- package/lib/Component-9d373ef3.js.map +1 -0
- package/lib/DatePicker.js +1 -1
- package/lib/EmptyState.js +1 -1
- package/lib/Fieldset.js +1 -1
- package/lib/FocusableMixin-ebb67709.js +2 -0
- package/lib/{FocusableMixin-ca9d30fa.js.map → FocusableMixin-ebb67709.js.map} +1 -1
- package/lib/{FormAssociatedMixin-bfbbe389.js → FormAssociatedMixin-ccae91fd.js} +2 -2
- package/lib/{FormAssociatedMixin-bfbbe389.js.map → FormAssociatedMixin-ccae91fd.js.map} +1 -1
- package/lib/{FormField-e021be01.js → FormField-50bd73d5.js} +2 -2
- package/lib/FormField-50bd73d5.js.map +1 -0
- package/lib/Header.js +1 -1
- package/lib/Icon.js +1 -1
- package/lib/Icon.js.map +1 -1
- package/lib/Input.js +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/Layout.js +1 -1
- package/lib/{LightDomController-f56fa1a4.js → LightDomController-011334da.js} +2 -2
- package/lib/{LightDomController-f56fa1a4.js.map → LightDomController-011334da.js.map} +1 -1
- package/lib/NavGroup.js +1 -1
- package/lib/NavItem.js +1 -1
- package/lib/Navigation.js +1 -1
- package/lib/ProgressBar.js +2 -0
- package/lib/ProgressBar.js.map +1 -0
- package/lib/Radio.js +1 -1
- package/lib/Radio.js.map +1 -1
- package/lib/Select.js +1 -1
- package/lib/Select.js.map +1 -1
- package/lib/Spinner.js +1 -1
- package/lib/Spinner.js.map +1 -1
- package/lib/Stack.js +1 -1
- package/lib/Table.js +1 -1
- package/lib/{TextField-d799db1a.js → TextField-ece1c786.js} +2 -2
- package/lib/TextField-ece1c786.js.map +1 -0
- package/lib/Textarea.js +1 -1
- package/lib/Tooltip.js +1 -1
- package/lib/VisuallyHidden.js +1 -1
- package/lib/bundle.js +9 -9
- package/lib/bundle.js.map +1 -1
- package/lib/{class-map-61e9e8c1.js → class-map-87423405.js} +2 -2
- package/lib/{class-map-61e9e8c1.js.map → class-map-87423405.js.map} +1 -1
- package/lib/if-defined-fe657a02.js +7 -0
- package/lib/{if-defined-2a4c6dbc.js.map → if-defined-fe657a02.js.map} +1 -1
- package/lib/index.js +1 -1
- package/lib/{lit-element-9646ab7e.js → lit-element-74b6bb4b.js} +3 -3
- package/lib/{lit-element-9646ab7e.js.map → lit-element-74b6bb4b.js.map} +1 -1
- package/lib/month-view.js +1 -1
- package/lib/number-3a8ef88a.js +7 -0
- package/lib/{number-02c91604.js.map → number-3a8ef88a.js.map} +1 -1
- package/lib/{ref-82d2502a.js → ref-7d028e3a.js} +3 -3
- package/lib/{ref-82d2502a.js.map → ref-7d028e3a.js.map} +1 -1
- package/lib/src/avatar/Avatar.test.d.ts +1 -1
- package/lib/src/banner/Banner.test.d.ts +3 -0
- package/lib/src/button/Button.d.ts +2 -2
- package/lib/src/header/Header.test.d.ts +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/input/Input.d.ts +2 -2
- package/lib/src/layout/Layout.test.d.ts +2 -0
- package/lib/src/progress-bar/ProgressBar.d.ts +38 -0
- package/lib/src/progress-bar/ProgressBar.test.d.ts +3 -0
- package/lib/src/spinner/Spinner.d.ts +2 -4
- package/lib/src/stack/Stack.test.d.ts +2 -0
- package/lib/unsafe-html-989a642b.js +7 -0
- package/lib/{unsafe-html-4da54dd2.js.map → unsafe-html-989a642b.js.map} +1 -1
- package/package.json +3 -3
- package/lib/Component-6762b5eb.js.map +0 -1
- package/lib/FocusableMixin-ca9d30fa.js +0 -2
- package/lib/FormField-e021be01.js.map +0 -1
- package/lib/TextField-d799db1a.js.map +0 -1
- package/lib/if-defined-2a4c6dbc.js +0 -7
- package/lib/number-02c91604.js +0 -7
- package/lib/unsafe-html-4da54dd2.js +0 -7
package/lib/Table.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t,n as e}from"./query-assigned-elements-37b095c4.js";import{r as a,s as n,x as o,$ as r}from"./lit-element-
|
|
1
|
+
import{_ as t,n as e}from"./query-assigned-elements-37b095c4.js";import{r as a,s as n,x as o,$ as r}from"./lit-element-74b6bb4b.js";import{e as d}from"./property-03f59dce.js";const l=a`nord-table{all:initial;color:var(--n-color-text)}nord-table[density=condensed]{--n-table-td-padding:calc(var(--n-space-m) * 0.7)}nord-table[density=default]{--n-table-td-padding:calc(var(--n-space-m) * 0.95)}nord-table[density=relaxed]{--n-table-td-padding:calc(var(--n-space-m) * 1.2);--n-table-th-padding:var(--n-space-m)}nord-table table{inline-size:100%;font-size:var(--n-font-size-m);font-family:var(--n-font-family);font-feature-settings:var(--n-font-features);line-height:var(--n-line-height-tight);text-align:start;border-spacing:0;border-collapse:separate;color:var(--n-color-text);font-variant-numeric:tabular-nums}nord-table th{border-block-end:1px solid var(--n-color-border);font-weight:var(--n-font-weight-active);font-size:var(--n-font-size-s);color:var(--n-color-text-weaker);padding:calc(var(--n-table-th-padding,var(--n-table-td-padding))/ 1.1) var(--n-space-m);text-align:start;background:var(--n-color-surface-raised);position:-webkit-sticky;position:sticky;inset-block-start:0;z-index:3}nord-table td{border-block-end:1px solid var(--n-color-border);padding:var(--n-table-td-padding) var(--n-space-m);white-space:nowrap}@media (max-width:1000px){nord-table td,nord-table th{padding:var(--n-table-td-padding) var(--n-space-s)}}nord-table tbody tr:hover{background:var(--n-color-active)}nord-table tbody .active,nord-table tbody .active:hover{background:var(--n-color-active);color:var(--n-color-text);opacity:1;cursor:default}nord-table tbody .active td,nord-table tbody tr:hover td{color:var(--n-color-text)}nord-table tbody .active nord-badge,nord-table tbody tr:hover nord-badge{--n-badge-color:var(--n-color-text)}nord-card nord-table tbody tr:last-child td{border-block-end-color:transparent}nord-table .n-table-ellipsis{max-inline-size:0;inline-size:90%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}nord-table .n-table-align-right{text-align:end}nord-table .n-table-actions{display:flex;justify-content:center}nord-table .n-table-actions nord-button{margin-block:-10px}`;let i=class extends n{constructor(){super(...arguments),this.density="default"}connectedCallback(){super.connectedCallback(),this.renderStyles()}renderStyles(){const t=this.getRootNode(),e=t.nodeType===Node.DOCUMENT_NODE?t.head:t;const a=this.localName;t.querySelector(`style[data-component=${a}]`)||o(r`<style data-component="${a}">${l}</style>`,e)}createRenderRoot(){return this}};i.styles=l,t([d({reflect:!0})],i.prototype,"density",void 0),i=t([e("nord-table")],i);var c=i;export{c as default};
|
|
2
2
|
//# sourceMappingURL=Table.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as n}from"./lit-element-
|
|
2
|
-
//# sourceMappingURL=TextField-
|
|
1
|
+
import{r as n}from"./lit-element-74b6bb4b.js";const r=n`.n-input-container{position:relative}.n-input{background:var(--n-color-active);color:var(--n-color-text);padding-block-start:calc(var(--n-space-s) - 1px);padding-block-end:calc(var(--n-space-s) - 1px);padding-inline-start:calc(var(--n-space-s) * 1.6);padding-inline-end:calc(var(--n-space-s) * 1.6);border-radius:var(--n-border-radius-s);border:1px solid var(--n-input-border-color,var(--n-color-border-strong));font-family:var(--n-font-family);font-size:var(--n-font-size-m);line-height:var(--n-line-height-form);min-inline-size:240px;transition:border var(--n-transition-slowly),box-shadow var(--n-transition-slowly),background var(--n-transition-slowly)}@media (max-width:480px){.n-input{font-size:var(--n-font-size-l)}}:host([expand]){inline-size:100%}:host([expand]) .n-input{display:block;min-inline-size:0;inline-size:100%}.n-input:hover,.n-label-container:hover+.n-input-container .n-input{--n-input-border-color:var(--n-color-border-hover)}.n-input:focus{--n-input-border-color:var(--n-color-accent);background:var(--n-color-surface);outline:0;box-shadow:0 0 0 1px var(--n-input-border-color)}.n-input::placeholder{color:var(--n-color-text-weakest)}.n-input:disabled{--n-input-border-color:var(--n-color-active);color:var(--n-color-text-weakest)}.n-input[aria-invalid=true]{--n-input-border-color:var(--n-color-status-danger)!important}`;export{r as s};
|
|
2
|
+
//# sourceMappingURL=TextField-ece1c786.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField-ece1c786.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/lib/Textarea.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,n as t}from"./query-assigned-elements-37b095c4.js";import{r as i,$ as s,s as r}from"./lit-element-
|
|
1
|
+
import{_ as e,n as t}from"./query-assigned-elements-37b095c4.js";import{r as i,$ as s,s as r}from"./lit-element-74b6bb4b.js";import{e as o}from"./property-03f59dce.js";import{l as a}from"./if-defined-fe657a02.js";import{n}from"./ref-7d028e3a.js";import{F as l}from"./FocusableMixin-ebb67709.js";import{F as d}from"./FormAssociatedMixin-ccae91fd.js";import{I as h}from"./InputMixin-94d15730.js";import{s as p}from"./Component-9d373ef3.js";import{s as m}from"./FormField-50bd73d5.js";import{s as c}from"./TextField-ece1c786.js";import"./directive-de55b00a.js";import"./SlotController-5bfc47d1.js";import"./events-731d0007.js";import"./VisuallyHidden.js";const u=i`.n-input{min-block-size:var(--n-textarea-height,76px);transition:border var(--n-transition-slowly),box-shadow var(--n-transition-slowly),background var(--n-transition-slowly);display:block;resize:vertical}:host([resize=auto]) .n-input{resize:none;overflow:hidden}`;let f=class extends(d(h(l(r)))){constructor(){super(...arguments),this.inputId="textarea",this.resize="vertical"}updated(e){(e.has("resize")||e.has("value"))&&this.resizeToFitContent()}render(){var e;return s`${this.renderLabel()}<div class="n-input-container"><textarea ${n(this.focusableRef)} id="${this.inputId}" class="n-input" ?disabled="${this.disabled}" ?required="${this.required}" name="${a(this.name)}" .value="${null!==(e=this.value)&&void 0!==e?e:""}" placeholder="${a(this.placeholder)}" @change="${this.handleChange}" @input="${this.handleInput}" aria-describedby="${a(this.getDescribedBy())}" aria-invalid="${a(this.getInvalid())}"></textarea></div>${this.renderError()}`}resizeToFitContent(){const e=this.focusableRef.value;e&&("auto"===this.resize?(e.style.height="auto",e.style.height=`${e.scrollHeight}px`):e.style.height=null)}};f.styles=[p,m,c,u],e([o({reflect:!0})],f.prototype,"resize",void 0),f=e([t("nord-textarea")],f);var b=f;export{b as default};
|
|
2
2
|
//# sourceMappingURL=Textarea.js.map
|
package/lib/Tooltip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t,n as e}from"./query-assigned-elements-37b095c4.js";import{r as n,s as o,$ as i}from"./lit-element-9646ab7e.js";import{e as r}from"./property-03f59dce.js";import{t as s}from"./state-70f38ceb.js";import{S as l}from"./SlotController-5bfc47d1.js";import{s as a}from"./Component-6762b5eb.js";function c(t){return t.split("-")[0]}function d(t){return t.split("-")[1]}function f(t){return["top","bottom"].includes(c(t))?"x":"y"}function h(t){return"y"===t?"height":"width"}function u(t){let{reference:e,floating:n,placement:o}=t;const i=e.x+e.width/2-n.width/2,r=e.y+e.height/2-n.height/2;let s;switch(c(o)){case"top":s={x:i,y:e.y-n.height};break;case"bottom":s={x:i,y:e.y+e.height};break;case"right":s={x:e.x+e.width,y:r};break;case"left":s={x:e.x-n.width,y:r};break;default:s={x:e.x,y:e.y}}const l=f(o),a=h(l);switch(d(o)){case"start":s[l]=s[l]-(e[a]/2-n[a]/2);break;case"end":s[l]=s[l]+(e[a]/2-n[a]/2)}return s}function p(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function m(t,e){void 0===e&&(e={});const{x:n,y:o,platform:i,rects:r,elements:s,strategy:l}=t,{boundary:a="clippingParents",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=e,u=function(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}(h),m=s[f?"floating"===d?"reference":"floating":d],g=await i.getClippingClientRect({element:await i.isElement(m)?m:m.contextElement||await i.getDocumentElement({element:s.floating}),boundary:a,rootBoundary:c}),y=p(await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===d?{...r.floating,x:n,y:o}:r.reference,offsetParent:await i.getOffsetParent({element:s.floating}),strategy:l}));return{top:g.top-y.top+u.top,bottom:y.bottom-g.bottom+u.bottom,left:g.left-y.left+u.left,right:y.right-g.right+u.right}}const g=Math.min,y=Math.max;function v(t,e,n){return y(t,g(e,n))}const b={left:"right",right:"left",bottom:"top",top:"bottom"};function x(t){return t.replace(/left|right|bottom|top/g,(t=>b[t]))}const w={start:"end",end:"start"};function E(t){return t.replace(/start|end/g,(t=>w[t]))}const k=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:l}=e;if(null!=(n=r.flip)&&n.skip)return{};const{mainAxis:a=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",flipAlignment:y=!0,...v}=t,b=c(i),w=p||(b===l||!y?[x(l)]:function(t){const e=x(t);return[E(t),e,E(e)]}(l)),k=[l,...w],L=await m(e,v),T=[];let R=(null==(o=r.flip)?void 0:o.overflows)||[];if(a&&T.push(L[b]),u){const{main:t,cross:e}=function(t,e){const n="start"===d(t),o=f(t),i=h(o);let r="x"===o?n?"right":"left":n?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=x(r)),{main:r,cross:x(r)}}(i,s);T.push(L[t],L[e])}if(R=[...R,{placement:i,overflows:T}],!T.every((t=>t<=0))){var C,D;const t=(null!=(C=null==(D=r.flip)?void 0:D.index)?C:0)+1,e=k[t];if(e)return{data:{index:t,overflows:R},reset:{placement:e}};let n="bottom";switch(g){case"bestFit":{var S;const t=null==(S=R.slice().sort(((t,e)=>t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)-e.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)))[0])?void 0:S.placement;t&&(n=t);break}case"initialPlacement":n=l}return{data:{skip:!0},reset:{placement:n}}}return{}}}};const L=function(t){return void 0===t&&(t=0),{name:"offset",options:t,fn(e){const{x:n,y:o,placement:i,rects:r}=e,s=function(t){let{placement:e,rects:n,value:o}=t;const i=c(e),r=["left","top"].includes(i)?-1:1,s="function"==typeof o?o({...n,placement:e}):o,{mainAxis:l,crossAxis:a}="number"==typeof s?{mainAxis:s,crossAxis:0}:{mainAxis:0,crossAxis:0,...s};return"x"===f(i)?{x:a,y:l*r}:{x:l*r,y:a}}({placement:i,rects:r,value:t});return{x:n+s.x,y:o+s.y,data:s}}}};function T(t){return"[object Window]"===(null==t?void 0:t.toString())}function R(t){if(null==t)return window;if(!T(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function C(t){return R(t).getComputedStyle(t)}function D(t){return T(t)?"":t?(t.nodeName||"").toLowerCase():""}function S(t){return t instanceof R(t).HTMLElement}function P(t){return t instanceof R(t).Element}function A(t){return t instanceof R(t).ShadowRoot||t instanceof ShadowRoot}function W(t){const{overflow:e,overflowX:n,overflowY:o}=C(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function O(t){return["table","td","th"].includes(D(t))}function z(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=C(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}const H=Math.min,N=Math.max,j=Math.round;function B(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&S(t)&&(o=t.offsetWidth>0&&j(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&j(n.height)/t.offsetHeight||1),{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function M(t){return(e=t,(e instanceof R(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function V(t){return T(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function $(t){return B(M(t)).left+V(t).scrollLeft}function q(t,e,n){const o=S(e),i=M(e),r=B(t,o&&function(t){const e=B(t);return j(e.width)!==t.offsetWidth||j(e.height)!==t.offsetHeight}(e));let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==D(e)||W(i))&&(s=V(e)),S(e)){const t=B(e,!0);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=$(i));return{x:r.left+s.scrollLeft-l.x,y:r.top+s.scrollTop-l.y,width:r.width,height:r.height}}function F(t){return"html"===D(t)?t:t.assignedSlot||t.parentNode||(A(t)?t.host:null)||M(t)}function X(t){return S(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function Y(t){const e=R(t);let n=X(t);for(;n&&O(n)&&"static"===getComputedStyle(n).position;)n=X(n);return n&&("html"===D(n)||"body"===D(n)&&"static"===getComputedStyle(n).position&&!z(n))?e:n||function(t){let e=F(t);for(;S(e)&&!["html","body"].includes(D(e));){if(z(e))return e;e=e.parentNode}return null}(t)||e}function I(t){return{width:t.offsetWidth,height:t.offsetHeight}}function U(t){return["html","body","#document"].includes(D(t))?t.ownerDocument.body:S(t)&&W(t)?t:U(F(t))}function _(t,e){var n;void 0===e&&(e=[]);const o=U(t),i=o===(null==(n=t.ownerDocument)?void 0:n.body),r=R(o),s=i?[r].concat(r.visualViewport||[],W(o)?o:[]):o,l=e.concat(s);return i?l:l.concat(_(F(s)))}function G(t,e){return"viewport"===e?p(function(t){const e=R(t),n=M(t),o=e.visualViewport;let i=n.clientWidth,r=n.clientHeight,s=0,l=0;return o&&(i=o.width,r=o.height,Math.abs(e.innerWidth/o.scale-o.width)<.01&&(s=o.offsetLeft,l=o.offsetTop)),{width:i,height:r,x:s,y:l}}(t)):P(e)?function(t){const e=B(t),n=e.top+t.clientTop,o=e.left+t.clientLeft;return{top:n,left:o,x:o,y:n,right:o+t.clientWidth,bottom:n+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(e):p(function(t){var e;const n=M(t),o=V(t),i=null==(e=t.ownerDocument)?void 0:e.body,r=N(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=N(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let l=-o.scrollLeft+$(t);const a=-o.scrollTop;return"rtl"===C(i||n).direction&&(l+=N(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:s,x:l,y:a}}(M(t)))}function J(t){const e=_(F(t)),n=["absolute","fixed"].includes(C(t).position)&&S(t)?Y(t):t;return P(n)?e.filter((t=>P(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&A(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==D(t))):[]}const K={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:q(e,Y(n),o),floating:{...I(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=S(n),r=M(n);if(n===r)return e;let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==D(n)||W(r))&&(s=V(n)),S(n))){const t=B(n,!0);l.x=t.x+n.clientLeft,l.y=t.y+n.clientTop}return{...e,x:e.x-s.scrollLeft+l.x,y:e.y-s.scrollTop+l.y}}(t),getOffsetParent:t=>{let{element:e}=t;return Y(e)},isElement:t=>P(t),getDocumentElement:t=>{let{element:e}=t;return M(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?J(e):[].concat(n),o],r=i[0],s=i.reduce(((t,n)=>{const o=G(e,n);return t.top=N(o.top,t.top),t.right=H(o.right,t.right),t.bottom=H(o.bottom,t.bottom),t.left=N(o.left,t.left),t}),G(e,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}(t),getDimensions:t=>{let{element:e}=t;return I(e)},getClientRects:t=>{let{element:e}=t;return e.getClientRects()}},Q=(t,e,n)=>(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n;let l=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:a,y:c}=u({...l,placement:o}),d=o,f={};for(let n=0;n<r.length;n++){const{name:h,fn:p}=r[n],{x:m,y:g,data:y,reset:v}=await p({x:a,y:c,initialPlacement:o,placement:d,strategy:i,middlewareData:f,rects:l,platform:s,elements:{reference:t,floating:e}});a=null!=m?m:a,c=null!=g?g:c,f={...f,[h]:null!=y?y:{}},v&&("object"==typeof v&&(v.placement&&(d=v.placement),v.rects&&(l=!0===v.rects?await s.getElementRects({reference:t,floating:e,strategy:i}):v.rects),({x:a,y:c}=u({...l,placement:d}))),n=-1)}return{x:a,y:c,placement:d,strategy:i,middlewareData:f}})(t,e,{platform:K,...n});function Z(t,e){const n=t.getAttribute(e);return n?n.split(/\s+/):[]}function tt(t,e,n){t.setAttribute(e,n.join(" "))}const et=n`:host{--n-tooltip-background:rgba(20, 20, 20, 0.95);--n-tooltip-color:#fff;--n-tooltip-key-border:rgba(255, 255, 255, 0.03);--n-tooltip-key-background:rgba(255, 255, 255, 0.1);position:absolute;pointer-events:none;visibility:hidden;opacity:0;transition:opacity .4s ease,visibility .4s ease;z-index:var(--n-index-popout)}.n-tooltip{gap:var(--n-space-s);font-family:var(--n-font-family);font-size:var(--n-font-size-xs);line-height:var(--n-line-height);color:var(--n-tooltip-color);padding:calc(var(--n-space-s)/ 1.5) var(--n-space-s);background-color:var(--n-tooltip-background);border-radius:var(--n-border-radius-s)}.n-tooltip,.n-tooltip-shortcut{display:flex;align-items:center}.n-tooltip-shortcut{gap:2px}::slotted([slot=shortcut]){box-sizing:border-box;margin:0;inline-size:var(--n-size-icon-m);block-size:var(--n-size-icon-m);border-radius:var(--n-border-radius-s);border:1px solid var(--n-tooltip-key-border)!important;padding:1px!important;text-align:center;font-size:var(--n-font-size-xs);line-height:var(--n-line-height-tight);letter-spacing:-.5px;vertical-align:middle!important;background-color:var(--n-tooltip-key-background)}`;var nt;let ot=nt=class extends o{constructor(){super(...arguments),this.shortcutSlot=new l(this,"shortcut"),this.proxy=document.createElement("span"),this.visible=!1,this.position="top",this.role="tooltip",this.id="",this.delay=300,this.updatePosition=()=>{return Q(this.targetElement,this,{placement:this.position,middleware:[(t={padding:8},void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...a}=t,d={x:n,y:o},h=await m(e,a),u=f(c(i)),p="x"===u?"y":"x";let g=d[u],y=d[p];if(r){const t="y"===u?"bottom":"right";g=v(g+h["y"===u?"top":"left"],g,g-h[t])}if(s){const t="y"===p?"bottom":"right";y=v(y+h["y"===p?"top":"left"],y,y-h[t])}const b=l.fn({...e,[u]:g,[p]:y});return{...b,data:{x:b.x-n,y:b.y-o}}}}),L(8),k()]}).then((({x:t,y:e})=>{this.style.insetInlineStart=`${t}px`,this.style.insetBlockStart=`${e}px`}));var t},this.handleScroll=()=>{this.visible&&this.updatePosition()},this.showTooltip=()=>{var t;this.visible||(null===(t=nt.lastOpened)||void 0===t||t.hideTooltip(),nt.lastOpened=this,this.updatePosition().then((()=>{this.visible=!0})))},this.hideTooltip=()=>{this.visible=!1},this.hideOnEscape=t=>{this.visible&&"Escape"===t.key&&this.hideTooltip()},this.addDescribedBy=()=>{var t,e;const n=null===(e=null===(t=this.targetElement)||void 0===t?void 0:t.focusableRef)||void 0===e?void 0:e.value;n&&(this.proxy.hidden=!0,this.proxy.id=this.id,this.proxy.textContent=this.textContent,n.insertAdjacentElement("afterend",this.proxy),function(t,e,n){const o=Z(t,e);o.includes(n)||tt(t,e,o.concat(n))}(n,"aria-describedby",this.id))},this.removeDescribedBy=()=>{var t,e;const n=null===(e=null===(t=this.targetElement)||void 0===t?void 0:t.focusableRef)||void 0===e?void 0:e.value;n&&(this.proxy.remove(),function(t,e,n){const o=Z(t,e);o.includes(n)&&tt(t,e,o.filter((t=>t!==n)))}(n,"aria-describedby",this.id))}}connectedCallback(){super.connectedCallback();const t=this.getRootNode(),e=`[aria-describedby='${this.id}']`,n=t.querySelector(e);n?(this.targetElement=n,n.addEventListener("keydown",this.hideOnEscape),n.addEventListener("mouseenter",this.showTooltip),n.addEventListener("mouseleave",this.hideTooltip),n.addEventListener("focus",this.showTooltip),n.addEventListener("blur",this.hideTooltip),window.addEventListener("resize",this.updatePosition,{passive:!0}),window.addEventListener("scroll",this.handleScroll,{passive:!0})):console.warn("NORD: tooltip found no element matching selector:",e)}disconnectedCallback(){super.disconnectedCallback(),this.targetElement&&(this.targetElement.removeEventListener("keydown",this.hideOnEscape),this.targetElement.removeEventListener("mouseenter",this.showTooltip),this.targetElement.removeEventListener("mouseleave",this.hideTooltip),this.targetElement.removeEventListener("focus",this.showTooltip),this.targetElement.removeEventListener("blur",this.hideTooltip),window.removeEventListener("resize",this.updatePosition),window.removeEventListener("scroll",this.handleScroll))}willUpdate(t){t.has("id")&&!this.id&&console.warn("NORD: The tooltip requires an id attribute and value"),t.has("visible")&&(this.visible?(this.addDescribedBy(),this.style.transitionDelay=`${this.delay}ms`,this.style.visibility="visible",this.style.opacity="1"):(this.removeDescribedBy(),this.style.transitionDelay="0ms",this.style.visibility="hidden",this.style.opacity="0"))}render(){return i`<div class="n-tooltip"><slot></slot><div class="n-tooltip-shortcut" ?hidden="${this.shortcutSlot.isEmpty}"><slot class="n-tooltip-key" name="shortcut"></slot></div></div>`}};ot.styles=[a,et],t([s()],ot.prototype,"visible",void 0),t([r({reflect:!0})],ot.prototype,"position",void 0),t([r({reflect:!0})],ot.prototype,"role",void 0),t([r({reflect:!0})],ot.prototype,"id",void 0),t([r({reflect:!0,type:Number})],ot.prototype,"delay",void 0),ot=nt=t([e("nord-tooltip")],ot);var it=ot;export{it as default};
|
|
1
|
+
import{_ as t,n as e}from"./query-assigned-elements-37b095c4.js";import{r as n,s as o,$ as i}from"./lit-element-74b6bb4b.js";import{e as r}from"./property-03f59dce.js";import{t as s}from"./state-70f38ceb.js";import{S as l}from"./SlotController-5bfc47d1.js";import{s as c}from"./Component-9d373ef3.js";function a(t){return t.split("-")[0]}function d(t){return t.split("-")[1]}function f(t){return["top","bottom"].includes(a(t))?"x":"y"}function h(t){return"y"===t?"height":"width"}function u(t){let{reference:e,floating:n,placement:o}=t;const i=e.x+e.width/2-n.width/2,r=e.y+e.height/2-n.height/2;let s;switch(a(o)){case"top":s={x:i,y:e.y-n.height};break;case"bottom":s={x:i,y:e.y+e.height};break;case"right":s={x:e.x+e.width,y:r};break;case"left":s={x:e.x-n.width,y:r};break;default:s={x:e.x,y:e.y}}const l=f(o),c=h(l);switch(d(o)){case"start":s[l]=s[l]-(e[c]/2-n[c]/2);break;case"end":s[l]=s[l]+(e[c]/2-n[c]/2)}return s}function p(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function m(t,e){void 0===e&&(e={});const{x:n,y:o,platform:i,rects:r,elements:s,strategy:l}=t,{boundary:c="clippingParents",rootBoundary:a="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=e,u=function(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}(h),m=s[f?"floating"===d?"reference":"floating":d],g=await i.getClippingClientRect({element:await i.isElement(m)?m:m.contextElement||await i.getDocumentElement({element:s.floating}),boundary:c,rootBoundary:a}),y=p(await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===d?{...r.floating,x:n,y:o}:r.reference,offsetParent:await i.getOffsetParent({element:s.floating}),strategy:l}));return{top:g.top-y.top+u.top,bottom:y.bottom-g.bottom+u.bottom,left:g.left-y.left+u.left,right:y.right-g.right+u.right}}const g=Math.min,y=Math.max;function v(t,e,n){return y(t,g(e,n))}const b={left:"right",right:"left",bottom:"top",top:"bottom"};function x(t){return t.replace(/left|right|bottom|top/g,(t=>b[t]))}const w={start:"end",end:"start"};function E(t){return t.replace(/start|end/g,(t=>w[t]))}const k=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:l}=e;if(null!=(n=r.flip)&&n.skip)return{};const{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",flipAlignment:y=!0,...v}=t,b=a(i),w=p||(b===l||!y?[x(l)]:function(t){const e=x(t);return[E(t),e,E(e)]}(l)),k=[l,...w],L=await m(e,v),T=[];let R=(null==(o=r.flip)?void 0:o.overflows)||[];if(c&&T.push(L[b]),u){const{main:t,cross:e}=function(t,e){const n="start"===d(t),o=f(t),i=h(o);let r="x"===o?n?"right":"left":n?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=x(r)),{main:r,cross:x(r)}}(i,s);T.push(L[t],L[e])}if(R=[...R,{placement:i,overflows:T}],!T.every((t=>t<=0))){var C,D;const t=(null!=(C=null==(D=r.flip)?void 0:D.index)?C:0)+1,e=k[t];if(e)return{data:{index:t,overflows:R},reset:{placement:e}};let n="bottom";switch(g){case"bestFit":{var S;const t=null==(S=R.slice().sort(((t,e)=>t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)-e.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)))[0])?void 0:S.placement;t&&(n=t);break}case"initialPlacement":n=l}return{data:{skip:!0},reset:{placement:n}}}return{}}}};const L=function(t){return void 0===t&&(t=0),{name:"offset",options:t,fn(e){const{x:n,y:o,placement:i,rects:r}=e,s=function(t){let{placement:e,rects:n,value:o}=t;const i=a(e),r=["left","top"].includes(i)?-1:1,s="function"==typeof o?o({...n,placement:e}):o,{mainAxis:l,crossAxis:c}="number"==typeof s?{mainAxis:s,crossAxis:0}:{mainAxis:0,crossAxis:0,...s};return"x"===f(i)?{x:c,y:l*r}:{x:l*r,y:c}}({placement:i,rects:r,value:t});return{x:n+s.x,y:o+s.y,data:s}}}};function T(t){return"[object Window]"===(null==t?void 0:t.toString())}function R(t){if(null==t)return window;if(!T(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function C(t){return R(t).getComputedStyle(t)}function D(t){return T(t)?"":t?(t.nodeName||"").toLowerCase():""}function S(t){return t instanceof R(t).HTMLElement}function P(t){return t instanceof R(t).Element}function A(t){return t instanceof R(t).ShadowRoot||t instanceof ShadowRoot}function W(t){const{overflow:e,overflowX:n,overflowY:o}=C(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function O(t){return["table","td","th"].includes(D(t))}function z(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=C(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}const H=Math.min,N=Math.max,j=Math.round;function B(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&S(t)&&(o=t.offsetWidth>0&&j(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&j(n.height)/t.offsetHeight||1),{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function M(t){return(e=t,(e instanceof R(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function V(t){return T(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function $(t){return B(M(t)).left+V(t).scrollLeft}function q(t,e,n){const o=S(e),i=M(e),r=B(t,o&&function(t){const e=B(t);return j(e.width)!==t.offsetWidth||j(e.height)!==t.offsetHeight}(e));let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==D(e)||W(i))&&(s=V(e)),S(e)){const t=B(e,!0);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=$(i));return{x:r.left+s.scrollLeft-l.x,y:r.top+s.scrollTop-l.y,width:r.width,height:r.height}}function F(t){return"html"===D(t)?t:t.assignedSlot||t.parentNode||(A(t)?t.host:null)||M(t)}function X(t){return S(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function Y(t){const e=R(t);let n=X(t);for(;n&&O(n)&&"static"===getComputedStyle(n).position;)n=X(n);return n&&("html"===D(n)||"body"===D(n)&&"static"===getComputedStyle(n).position&&!z(n))?e:n||function(t){let e=F(t);for(;S(e)&&!["html","body"].includes(D(e));){if(z(e))return e;e=e.parentNode}return null}(t)||e}function I(t){return{width:t.offsetWidth,height:t.offsetHeight}}function U(t){return["html","body","#document"].includes(D(t))?t.ownerDocument.body:S(t)&&W(t)?t:U(F(t))}function _(t,e){var n;void 0===e&&(e=[]);const o=U(t),i=o===(null==(n=t.ownerDocument)?void 0:n.body),r=R(o),s=i?[r].concat(r.visualViewport||[],W(o)?o:[]):o,l=e.concat(s);return i?l:l.concat(_(F(s)))}function G(t,e){return"viewport"===e?p(function(t){const e=R(t),n=M(t),o=e.visualViewport;let i=n.clientWidth,r=n.clientHeight,s=0,l=0;return o&&(i=o.width,r=o.height,Math.abs(e.innerWidth/o.scale-o.width)<.01&&(s=o.offsetLeft,l=o.offsetTop)),{width:i,height:r,x:s,y:l}}(t)):P(e)?function(t){const e=B(t),n=e.top+t.clientTop,o=e.left+t.clientLeft;return{top:n,left:o,x:o,y:n,right:o+t.clientWidth,bottom:n+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(e):p(function(t){var e;const n=M(t),o=V(t),i=null==(e=t.ownerDocument)?void 0:e.body,r=N(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=N(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let l=-o.scrollLeft+$(t);const c=-o.scrollTop;return"rtl"===C(i||n).direction&&(l+=N(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:s,x:l,y:c}}(M(t)))}function J(t){const e=_(F(t)),n=["absolute","fixed"].includes(C(t).position)&&S(t)?Y(t):t;return P(n)?e.filter((t=>P(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&A(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==D(t))):[]}const K={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:q(e,Y(n),o),floating:{...I(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=S(n),r=M(n);if(n===r)return e;let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==D(n)||W(r))&&(s=V(n)),S(n))){const t=B(n,!0);l.x=t.x+n.clientLeft,l.y=t.y+n.clientTop}return{...e,x:e.x-s.scrollLeft+l.x,y:e.y-s.scrollTop+l.y}}(t),getOffsetParent:t=>{let{element:e}=t;return Y(e)},isElement:t=>P(t),getDocumentElement:t=>{let{element:e}=t;return M(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?J(e):[].concat(n),o],r=i[0],s=i.reduce(((t,n)=>{const o=G(e,n);return t.top=N(o.top,t.top),t.right=H(o.right,t.right),t.bottom=H(o.bottom,t.bottom),t.left=N(o.left,t.left),t}),G(e,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}(t),getDimensions:t=>{let{element:e}=t;return I(e)},getClientRects:t=>{let{element:e}=t;return e.getClientRects()}},Q=(t,e,n)=>(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n;let l=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:a}=u({...l,placement:o}),d=o,f={};for(let n=0;n<r.length;n++){const{name:h,fn:p}=r[n],{x:m,y:g,data:y,reset:v}=await p({x:c,y:a,initialPlacement:o,placement:d,strategy:i,middlewareData:f,rects:l,platform:s,elements:{reference:t,floating:e}});c=null!=m?m:c,a=null!=g?g:a,f={...f,[h]:null!=y?y:{}},v&&("object"==typeof v&&(v.placement&&(d=v.placement),v.rects&&(l=!0===v.rects?await s.getElementRects({reference:t,floating:e,strategy:i}):v.rects),({x:c,y:a}=u({...l,placement:d}))),n=-1)}return{x:c,y:a,placement:d,strategy:i,middlewareData:f}})(t,e,{platform:K,...n});function Z(t,e){const n=t.getAttribute(e);return n?n.split(/\s+/):[]}function tt(t,e,n){t.setAttribute(e,n.join(" "))}const et=n`:host{--n-tooltip-background:rgba(20, 20, 20, 0.95);--n-tooltip-color:#fff;--n-tooltip-key-border:rgba(255, 255, 255, 0.03);--n-tooltip-key-background:rgba(255, 255, 255, 0.1);position:absolute;pointer-events:none;visibility:hidden;opacity:0;transition:opacity .4s ease,visibility .4s ease;z-index:var(--n-index-popout)}.n-tooltip{gap:var(--n-space-s);font-family:var(--n-font-family);font-size:var(--n-font-size-xs);line-height:var(--n-line-height);color:var(--n-tooltip-color);padding:calc(var(--n-space-s)/ 1.5) var(--n-space-s);background-color:var(--n-tooltip-background);border-radius:var(--n-border-radius-s)}.n-tooltip,.n-tooltip-shortcut{display:flex;align-items:center}.n-tooltip-shortcut{gap:2px}::slotted([slot=shortcut]){box-sizing:border-box;margin:0;inline-size:var(--n-size-icon-m);block-size:var(--n-size-icon-m);border-radius:var(--n-border-radius-s);border:1px solid var(--n-tooltip-key-border)!important;padding:1px!important;text-align:center;font-size:var(--n-font-size-xs);line-height:var(--n-line-height-tight);letter-spacing:-.5px;vertical-align:middle!important;background-color:var(--n-tooltip-key-background)}`;var nt;let ot=nt=class extends o{constructor(){super(...arguments),this.shortcutSlot=new l(this,"shortcut"),this.proxy=document.createElement("span"),this.visible=!1,this.position="top",this.role="tooltip",this.id="",this.delay=300,this.updatePosition=()=>{return Q(this.targetElement,this,{placement:this.position,middleware:[(t={padding:8},void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...c}=t,d={x:n,y:o},h=await m(e,c),u=f(a(i)),p="x"===u?"y":"x";let g=d[u],y=d[p];if(r){const t="y"===u?"bottom":"right";g=v(g+h["y"===u?"top":"left"],g,g-h[t])}if(s){const t="y"===p?"bottom":"right";y=v(y+h["y"===p?"top":"left"],y,y-h[t])}const b=l.fn({...e,[u]:g,[p]:y});return{...b,data:{x:b.x-n,y:b.y-o}}}}),L(8),k()]}).then((({x:t,y:e})=>{this.style.insetInlineStart=`${t}px`,this.style.insetBlockStart=`${e}px`}));var t},this.handleScroll=()=>{this.visible&&this.updatePosition()},this.showTooltip=()=>{var t;this.visible||(null===(t=nt.lastOpened)||void 0===t||t.hideTooltip(),nt.lastOpened=this,this.updatePosition().then((()=>{this.visible=!0})))},this.hideTooltip=()=>{this.visible=!1},this.hideOnEscape=t=>{this.visible&&"Escape"===t.key&&this.hideTooltip()},this.addDescribedBy=()=>{var t,e;const n=null===(e=null===(t=this.targetElement)||void 0===t?void 0:t.focusableRef)||void 0===e?void 0:e.value;n&&(this.proxy.hidden=!0,this.proxy.id=this.id,this.proxy.textContent=this.textContent,n.insertAdjacentElement("afterend",this.proxy),function(t,e,n){const o=Z(t,e);o.includes(n)||tt(t,e,o.concat(n))}(n,"aria-describedby",this.id))},this.removeDescribedBy=()=>{var t,e;const n=null===(e=null===(t=this.targetElement)||void 0===t?void 0:t.focusableRef)||void 0===e?void 0:e.value;n&&(this.proxy.remove(),function(t,e,n){const o=Z(t,e);o.includes(n)&&tt(t,e,o.filter((t=>t!==n)))}(n,"aria-describedby",this.id))}}connectedCallback(){super.connectedCallback();const t=this.getRootNode(),e=`[aria-describedby='${this.id}']`,n=t.querySelector(e);n?(this.targetElement=n,n.addEventListener("keydown",this.hideOnEscape),n.addEventListener("mouseenter",this.showTooltip),n.addEventListener("mouseleave",this.hideTooltip),n.addEventListener("focus",this.showTooltip),n.addEventListener("blur",this.hideTooltip),window.addEventListener("resize",this.updatePosition,{passive:!0}),window.addEventListener("scroll",this.handleScroll,{passive:!0})):console.warn("NORD: tooltip found no element matching selector:",e)}disconnectedCallback(){super.disconnectedCallback(),this.targetElement&&(this.targetElement.removeEventListener("keydown",this.hideOnEscape),this.targetElement.removeEventListener("mouseenter",this.showTooltip),this.targetElement.removeEventListener("mouseleave",this.hideTooltip),this.targetElement.removeEventListener("focus",this.showTooltip),this.targetElement.removeEventListener("blur",this.hideTooltip),window.removeEventListener("resize",this.updatePosition),window.removeEventListener("scroll",this.handleScroll))}willUpdate(t){t.has("id")&&!this.id&&console.warn("NORD: The tooltip requires an id attribute and value"),t.has("visible")&&(this.visible?(this.addDescribedBy(),this.style.transitionDelay=`${this.delay}ms`,this.style.visibility="visible",this.style.opacity="1"):(this.removeDescribedBy(),this.style.transitionDelay="0ms",this.style.visibility="hidden",this.style.opacity="0"))}render(){return i`<div class="n-tooltip"><slot></slot><div class="n-tooltip-shortcut" ?hidden="${this.shortcutSlot.isEmpty}"><slot class="n-tooltip-key" name="shortcut"></slot></div></div>`}};ot.styles=[c,et],t([s()],ot.prototype,"visible",void 0),t([r({reflect:!0})],ot.prototype,"position",void 0),t([r({reflect:!0})],ot.prototype,"role",void 0),t([r({reflect:!0})],ot.prototype,"id",void 0),t([r({reflect:!0,type:Number})],ot.prototype,"delay",void 0),ot=nt=t([e("nord-tooltip")],ot);var it=ot;export{it as default};
|
|
2
2
|
//# sourceMappingURL=Tooltip.js.map
|
package/lib/VisuallyHidden.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t,n as e}from"./query-assigned-elements-37b095c4.js";import{r as i,s as o,$ as r}from"./lit-element-
|
|
1
|
+
import{_ as t,n as e}from"./query-assigned-elements-37b095c4.js";import{r as i,s as o,$ as r}from"./lit-element-74b6bb4b.js";const n=i`:host{all:initial;border:0!important;clip:rect(1px,1px,1px,1px)!important;block-size:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;inset-block-start:0;inline-size:1px!important}`;let s=class extends o{render(){return r`<slot></slot>`}};s.styles=n,s=t([e("nord-visually-hidden")],s);var l=s;export{l as default};
|
|
2
2
|
//# sourceMappingURL=VisuallyHidden.js.map
|