@nordhealth/components 1.0.0-alpha.53 → 1.0.0-alpha.56
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/README.md +1 -1
- package/custom-elements.json +12 -3
- package/lib/CommandMenu.js +1 -1
- package/lib/CommandMenu.js.map +1 -1
- package/lib/Icon.js +1 -1
- package/lib/SelectEvent.js +2 -0
- package/lib/SelectEvent.js.map +1 -0
- package/lib/Tooltip.js +1 -1
- package/lib/Tooltip.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/src/command-menu/CommandMenu.d.ts +1 -1
- package/lib/src/command-menu/{events.d.ts → SelectEvent.d.ts} +1 -0
- package/package.json +11 -9
- package/lib/events.js +0 -2
- package/lib/events.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ The following are the most commonly used commands during development:
|
|
|
9
9
|
- `npm start` - Compile components, start watching for changes, start local development server on port 3333.
|
|
10
10
|
- `npm run build` - Builds the project.
|
|
11
11
|
- `npm test` - Run all tests once.
|
|
12
|
-
- `npm test -- [path/glob for test file]` - Run specific tests file.
|
|
12
|
+
- `npm test -- [path/glob for test file]` - Run specific tests file. e.g. `npm test -- **/Button.test.ts`
|
|
13
13
|
- `npm run test:watch` - Run all tests and watch for changes.
|
|
14
14
|
- `INCLUDE_VISUAL_REGRESSION=true npm test` - Run all tests and including visual regression.
|
|
15
15
|
- `INCLUDE_VISUAL_REGRESSION=true npm test -- --update-visual-baseline` - Updates all failing screenshot snapshots. I sure hope you know what you’re doing. ;-)
|
package/custom-elements.json
CHANGED
|
@@ -2214,7 +2214,7 @@
|
|
|
2214
2214
|
"text": "SelectEvent"
|
|
2215
2215
|
},
|
|
2216
2216
|
"description": "User selected a command from the menu.",
|
|
2217
|
-
"name": "
|
|
2217
|
+
"name": "nord-select"
|
|
2218
2218
|
}
|
|
2219
2219
|
],
|
|
2220
2220
|
"attributes": [
|
|
@@ -2431,13 +2431,22 @@
|
|
|
2431
2431
|
},
|
|
2432
2432
|
{
|
|
2433
2433
|
"kind": "javascript-module",
|
|
2434
|
-
"path": "src/command-menu/
|
|
2434
|
+
"path": "src/command-menu/SelectEvent.ts",
|
|
2435
2435
|
"declarations": [
|
|
2436
2436
|
{
|
|
2437
2437
|
"kind": "class",
|
|
2438
2438
|
"description": "",
|
|
2439
2439
|
"name": "SelectEvent",
|
|
2440
2440
|
"members": [
|
|
2441
|
+
{
|
|
2442
|
+
"kind": "field",
|
|
2443
|
+
"name": "eventName",
|
|
2444
|
+
"type": {
|
|
2445
|
+
"text": "string"
|
|
2446
|
+
},
|
|
2447
|
+
"static": true,
|
|
2448
|
+
"default": "\"nord-select\""
|
|
2449
|
+
},
|
|
2441
2450
|
{
|
|
2442
2451
|
"kind": "field",
|
|
2443
2452
|
"name": "command",
|
|
@@ -2459,7 +2468,7 @@
|
|
|
2459
2468
|
"name": "SelectEvent",
|
|
2460
2469
|
"declaration": {
|
|
2461
2470
|
"name": "SelectEvent",
|
|
2462
|
-
"module": "src/command-menu/
|
|
2471
|
+
"module": "src/command-menu/SelectEvent.ts"
|
|
2463
2472
|
}
|
|
2464
2473
|
}
|
|
2465
2474
|
],
|
package/lib/CommandMenu.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as e,_ as o,n as t}from"./DraftComponentMixin-30345acf.js";import{r as n,$ as s,w as r,s as i}from"./lit-element-9646ab7e.js";import{e as a}from"./property-03f59dce.js";import{t as l}from"./state-70f38ceb.js";import{c as d,w as c}from"./number-e7cd246c.js";import{e as p,n as m}from"./ref-eb5cfa10.js";import{o as h}from"./class-map-61e9e8c1.js";import{l as v}from"./if-defined-2a4c6dbc.js";import{g as u}from"./collection-f3631dc8.js";import{N as f}from"./events-731d0007.js";import{L as b}from"./LightDismissController-cc5b4bf2.js";import{KeyboardController as g}from"./KeyboardController.js";import x from"./Icon.js";import"./VisuallyHidden.js";import"./CommandMenuAction.js";import{SelectEvent as w}from"./events.js";import{s as y}from"./Component-a19be7c9.js";import"./directive-de55b00a.js";import"./directive-helpers-e7b6bf4b.js";import"./ShortcutController-93173ff4.js";import"./tinykeys.module-84e6cc41.js";import"./unsafe-html-4da54dd2.js";const k="keyboard-arrow-up-down";var z=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path d="M105.833 24v93m0-93L80 49.833M105.833 24l25.834 25.833M34.167 117V24m0 93L60 91.167M34.167 117 8.333 91.167" fill="none" stroke="currentColor" stroke-width="14" stroke-linecap="round" stroke-linejoin="round"/></svg>',title:k,tags:"nordicon keyboard keys arrow up down shortcut"});var C=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="14"><path d="M35 133 7 105l28-28"/><path d="M7 105h112a14 14 0 0 0 14-14V21a14 14 0 0 0-14-14H77"/></g></svg>',title:"keyboard-return",tags:"nordicon keyboard return key shortcut"});const $="keyboard-backspace";var j=Object.freeze({__proto__:null,default:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="currentColor" fill-rule="evenodd" d="M6.707 4.879A3 3 0 0 1 8.828 4H15a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H8.828a3 3 0 0 1-2.12-.879l-4.415-4.414a1 1 0 0 1 0-1.414l4.414-4.414zm4 2.414a1 1 0 0 0-1.414 1.414L10.586 10l-1.293 1.293a1 1 0 1 0 1.414 1.414L12 11.414l1.293 1.293a1 1 0 0 0 1.414-1.414L13.414 10l1.293-1.293a1 1 0 0 0-1.414-1.414L12 8.586l-1.293-1.293z" clip-rule="evenodd"/></svg>',title:$,tags:"nordicon keyboard backspace back delete key shortcut"});function I(e){var o;return(null===(o=e.activeElement)||void 0===o?void 0:o.shadowRoot)?I(e.activeElement.shadowRoot):e.activeElement||void 0}const _=n`:host{--n-command-menu-width:640px;--n-command-menu-top:16%;--n-command-menu-height:290px}.n-modal{display:none;position:fixed;pointer-events:none;z-index:var(--n-index-modal);inset-inline-start:0;inset-block-start:0;inline-size:100%;block-size:100%;overflow:auto}.n-modal.n-visible{display:block}.n-modal-content{position:relative;pointer-events:all;inset-block-start:var(--n-command-menu-top);margin:auto;display:flex;flex-direction:column;min-inline-size:0;background:var(--n-color-surface);border-radius:var(--n-border-radius);box-shadow:var(--n-box-shadow-modal);max-inline-size:var(--n-command-menu-width);overflow:hidden}.n-bump{animation:zoom-in-zoom-out var(--n-transition-slowly)}@keyframes zoom-in-zoom-out{0%{transform:translateY(-10px) scale(.97);opacity:0}100%{transform:translateY(0) scale(1.0001);opacity:1}}.n-modal-footer{display:flex;gap:var(--n-space-s);padding:var(--n-space-s) var(--n-space-m);font-size:calc(var(--n-font-size-s) - 1px);color:var(--n-color-text-weaker)}.n-help{display:flex;align-items:center;gap:2px}.n-help+.n-help{padding-inline-start:var(--n-space-s);border-inline-start:1px solid var(--n-color-border-strong)}.n-help nord-icon{--n-icon-size:10px;color:currentColor;margin:3px 4px}.n-help.n-backspace nord-icon{--n-icon-size:12px}.n-search-wrapper{display:flex;border-block-end:1px solid var(--n-color-border)}[role=combobox]{flex:1;font-size:var(--n-font-size-l);font-weight:var(--n-font-weight);font-family:inherit;background:0 0;color:var(--n-color-text);border:none;border-radius:0;appearance:none;outline:0;margin:0;padding:var(--n-space-m)}[role=combobox]::-webkit-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-moz-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-ms-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=listbox]{max-block-size:var(--n-command-menu-height);overflow:auto;margin:0;padding:0}.n-group-header{line-height:var(--n-line-height);border-block-end:1px solid var(--n-color-border);padding:calc(var(--n-space-s)/ 1.4) var(--n-space-m);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;font-size:var(--n-font-size-s);background:var(--n-color-surface-raised);font-weight:var(--n-font-weight-active);color:var(--n-color-text-weaker)}.n-command-empty{display:flex;flex:1;flex-direction:column;border-inline-start:2px solid transparent;align-items:flex-start;color:var(--n-color-text);border-block-end:1px solid var(--n-color-border);padding:calc(var(--n-space-m)/ 1.5) var(--n-space-m)}.n-command-empty .n-title{flex:1;margin-block-start:var(--n-space-s);margin-inline-end:calc(var(--n-space-s)/ 2);max-inline-size:100%;font-size:var(--n-font-size-m);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.n-command-empty .n-tip{flex:1;margin-block-start:var(--n-space-s);margin-block-end:var(--n-space-m);font-size:var(--n-font-size-s);color:var(--n-color-text-weaker)}`;x.registerIcon(z),x.registerIcon(C),x.registerIcon(j);let E=class extends(e(i)){constructor(){super(...arguments),this.inputRef=p(),this.listRef=p(),this.dismissController=new b(this,{isOpen:()=>this.open,onDismiss:()=>this.close()}),this.keyboardController=new g(this,{trigger:()=>this.select(),goBack:()=>this.goBack(),end:()=>this.end(),start:()=>this.start(),next:()=>this.next(),previous:()=>this.previous(),toggleOpen:()=>this.toggleOpen()}),this.open=!1,this.placeholder="Type a command or search...",this.commands=[],this.search="",this.bump=!0,this.selectedIndex=0,this.filteredCommands=[]}get selected(){return this.filteredCommands[this.selectedIndex]}show(e={}){this.open=!0,this.setParent(e.parent),this.dispatchEvent(new f("open"))}close(){var e;this.open=!1,null===(e=this.previousFocus)||void 0===e||e.focus(),this.previousFocus=void 0,this.dispatchEvent(new f("close"))}toggleOpen(){this.open?this.close():this.show()}focus(){var e;null===(e=this.inputRef.value)||void 0===e||e.focus()}willUpdate(e){e.has("commands")&&this.keyboardController.registerCommandShortcuts(),e.has("open")&&this.open&&(this.bump=!0),(e.has("search")||e.has("parent")||e.has("commands"))&&this.filterCommands()}updated(e){e.has("open")&&this.open&&(this.previousFocus=I(document),this.focus(),this.listRef.value&&(this.listRef.value.scrollTop=0))}render(){var e;const o=u(this.filteredCommands,"section"),t=0===this.filteredCommands.length?"no-results":null===(e=this.selected)||void 0===e?void 0:e.id;return s`<div class="${h({"n-visible":this.open,"n-modal":!0})}"><div @animationend="${this.handleAnimationEnd}" class="${h({"n-bump":this.bump,"n-modal-content":!0})}"><div class="n-search-wrapper"><nord-visually-hidden id="instructions">Press 'Enter' to confirm your input or 'Escape' to cancel</nord-visually-hidden><input type="text" id="search" @input="${this.handleInput}" @blur="${this.handleBlur}" ${m(this.inputRef)} placeholder="${this.placeholder}" .value="${this.search}" spellcheck="false" autocomplete="off" autocapitalize="off" aria-label="Type the name of a command to run." aria-autocomplete="list" aria-haspopup="listbox" role="combobox" aria-controls="list" aria-expanded="true" aria-activedescendant="${v(t)}" aria-describedby="instructions"></div><div class="n-modal-body"><div id="list" ${m(this.listRef)} role="listbox">${0===this.filteredCommands.length?this.renderNoResults():Array.from(o,(([e,o])=>this.renderSection(e,o)))}</div></div><slot name="footer"><div class="n-modal-footer" slot="footer"><span class="n-help"><nord-icon label="Arrow keys" name="${k}"></nord-icon>Navigate</span> <span class="n-help"><nord-icon label="Enter key" name="${"keyboard-return"}"></nord-icon>Select</span> <span class="n-help">Esc to dismiss</span> <span class="n-help n-backspace"><nord-icon label="Backspace key" name="${$}"></nord-icon>Move to parent</span></div></slot></div></div>`}renderNoResults(){return s`<div id="no-results" class="n-command-empty" role="option" aria-selected="true"><div class="n-title">No results for “${this.search}”</div><div class="n-tip">Search tips: some search terms require exact match. Try typing the entire command name, or use a different word or phrase.</div></div>`}renderSection(e,o){const t=`section-${e}`;return s`<div role="group" aria-labelledby="${v(e?t:void 0)}">${e?s`<div class="n-group-header" role="presentation" id="${v(t)}">${e}</div>`:r} ${d(o,(e=>e.id),(e=>{var o,t;return s`<nord-command-menu-action id="${e.id}" .command="${e}" ?selected="${e.id===(null===(o=this.selected)||void 0===o?void 0:o.id)}" @click="${()=>this.select(e)}" role="option" aria-selected="${v(e.id===(null===(t=this.selected)||void 0===t?void 0:t.id)||void 0)}"></nord-command-menu-action>`}))}</div>`}handleAnimationEnd(){this.bump=!1}handleBlur(){this.open&&this.focus()}handleInput(e){const o=e.target;this.setSearch(o.value)}select(e=this.selected){var o;this.commands.some((o=>o.parent===e.id))?(this.setParent(e.id),this.bump=!0,this.focus()):this.close(),this.setSearch(""),null===(o=e.handler)||void 0===o||o.call(e,this);const t=new w(e);this.dispatchEvent(t)}start(){this.selectedIndex=0}end(){this.selectedIndex=this.filteredCommands.length-1}next(){this.selectedIndex=c(this.selectedIndex+1,0,this.filteredCommands.length-1)}previous(){this.selectedIndex=c(this.selectedIndex-1,0,this.filteredCommands.length-1)}goBack(){if(!this.search&&this.parent){const e=this.commands.find((e=>e.id===this.parent));this.setParent(null==e?void 0:e.parent)}}setParent(e){this.parent=e,this.setSearch("")}setSearch(e){this.search=e,this.selectedIndex=0}filterCommands(){const e=this.search.toLocaleLowerCase().split(/\s+/);this.filteredCommands=this.commands.filter((({title:o,keywords:t="",parent:n})=>{const s=`${o} ${t}`.toLocaleLowerCase(),r=e.every((e=>s.includes(e)));return(!this.parent&&this.search||n===this.parent)&&r}))}};E.styles=[y,_],o([a({type:Boolean})],E.prototype,"open",void 0),o([a({type:String})],E.prototype,"placeholder",void 0),o([a({type:Array,attribute:!1})],E.prototype,"commands",void 0),o([l()],E.prototype,"parent",void 0),o([l()],E.prototype,"search",void 0),o([l()],E.prototype,"bump",void 0),o([l()],E.prototype,"selectedIndex",void 0),o([l()],E.prototype,"filteredCommands",void 0),E=o([t("nord-command-menu")],E);var L=E;export{L as default};
|
|
1
|
+
import{D as e,_ as o,n as t}from"./DraftComponentMixin-30345acf.js";import{r as n,$ as s,w as r,s as i}from"./lit-element-9646ab7e.js";import{e as a}from"./property-03f59dce.js";import{t as l}from"./state-70f38ceb.js";import{c as d,w as c}from"./number-e7cd246c.js";import{e as p,n as m}from"./ref-eb5cfa10.js";import{o as h}from"./class-map-61e9e8c1.js";import{l as v}from"./if-defined-2a4c6dbc.js";import{g as u}from"./collection-f3631dc8.js";import{N as f}from"./events-731d0007.js";import{L as b}from"./LightDismissController-cc5b4bf2.js";import{KeyboardController as g}from"./KeyboardController.js";import x from"./Icon.js";import"./VisuallyHidden.js";import"./CommandMenuAction.js";import{SelectEvent as w}from"./SelectEvent.js";import{s as y}from"./Component-a19be7c9.js";import"./directive-de55b00a.js";import"./directive-helpers-e7b6bf4b.js";import"./ShortcutController-93173ff4.js";import"./tinykeys.module-84e6cc41.js";import"./unsafe-html-4da54dd2.js";const k="keyboard-arrow-up-down";var z=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path d="M105.833 24v93m0-93L80 49.833M105.833 24l25.834 25.833M34.167 117V24m0 93L60 91.167M34.167 117 8.333 91.167" fill="none" stroke="currentColor" stroke-width="14" stroke-linecap="round" stroke-linejoin="round"/></svg>',title:k,tags:"nordicon keyboard keys arrow up down shortcut"});var C=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="14"><path d="M35 133 7 105l28-28"/><path d="M7 105h112a14 14 0 0 0 14-14V21a14 14 0 0 0-14-14H77"/></g></svg>',title:"keyboard-return",tags:"nordicon keyboard return key shortcut"});const $="keyboard-backspace";var j=Object.freeze({__proto__:null,default:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="currentColor" fill-rule="evenodd" d="M6.707 4.879A3 3 0 0 1 8.828 4H15a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H8.828a3 3 0 0 1-2.12-.879l-4.415-4.414a1 1 0 0 1 0-1.414l4.414-4.414zm4 2.414a1 1 0 0 0-1.414 1.414L10.586 10l-1.293 1.293a1 1 0 1 0 1.414 1.414L12 11.414l1.293 1.293a1 1 0 0 0 1.414-1.414L13.414 10l1.293-1.293a1 1 0 0 0-1.414-1.414L12 8.586l-1.293-1.293z" clip-rule="evenodd"/></svg>',title:$,tags:"nordicon keyboard backspace back delete key shortcut"});function I(e){var o;return(null===(o=e.activeElement)||void 0===o?void 0:o.shadowRoot)?I(e.activeElement.shadowRoot):e.activeElement||void 0}const E=n`:host{--n-command-menu-width:640px;--n-command-menu-top:16%;--n-command-menu-height:290px}.n-modal{display:none;position:fixed;pointer-events:none;z-index:var(--n-index-modal);inset-inline-start:0;inset-block-start:0;inline-size:100%;block-size:100%;overflow:auto}.n-modal.n-visible{display:block}.n-modal-content{position:relative;pointer-events:all;inset-block-start:var(--n-command-menu-top);margin:auto;display:flex;flex-direction:column;min-inline-size:0;background:var(--n-color-surface);border-radius:var(--n-border-radius);box-shadow:var(--n-box-shadow-modal);max-inline-size:var(--n-command-menu-width);overflow:hidden}.n-bump{animation:zoom-in-zoom-out var(--n-transition-slowly)}@keyframes zoom-in-zoom-out{0%{transform:translateY(-10px) scale(.97);opacity:0}100%{transform:translateY(0) scale(1.0001);opacity:1}}.n-modal-footer{display:flex;gap:var(--n-space-s);padding:var(--n-space-s) var(--n-space-m);font-size:calc(var(--n-font-size-s) - 1px);color:var(--n-color-text-weaker)}.n-help{display:flex;align-items:center;gap:2px}.n-help+.n-help{padding-inline-start:var(--n-space-s);border-inline-start:1px solid var(--n-color-border-strong)}.n-help nord-icon{--n-icon-size:10px;color:currentColor;margin:3px 4px}.n-help.n-backspace nord-icon{--n-icon-size:12px}.n-search-wrapper{display:flex;border-block-end:1px solid var(--n-color-border)}[role=combobox]{flex:1;font-size:var(--n-font-size-l);font-weight:var(--n-font-weight);font-family:inherit;background:0 0;color:var(--n-color-text);border:none;border-radius:0;appearance:none;outline:0;margin:0;padding:var(--n-space-m)}[role=combobox]::-webkit-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-moz-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-ms-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=listbox]{max-block-size:var(--n-command-menu-height);overflow:auto;margin:0;padding:0}.n-group-header{line-height:var(--n-line-height);border-block-end:1px solid var(--n-color-border);padding:calc(var(--n-space-s)/ 1.4) var(--n-space-m);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;font-size:var(--n-font-size-s);background:var(--n-color-surface-raised);font-weight:var(--n-font-weight-active);color:var(--n-color-text-weaker)}.n-command-empty{display:flex;flex:1;flex-direction:column;border-inline-start:2px solid transparent;align-items:flex-start;color:var(--n-color-text);border-block-end:1px solid var(--n-color-border);padding:calc(var(--n-space-m)/ 1.5) var(--n-space-m)}.n-command-empty .n-title{flex:1;margin-block-start:var(--n-space-s);margin-inline-end:calc(var(--n-space-s)/ 2);max-inline-size:100%;font-size:var(--n-font-size-m);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.n-command-empty .n-tip{flex:1;margin-block-start:var(--n-space-s);margin-block-end:var(--n-space-m);font-size:var(--n-font-size-s);color:var(--n-color-text-weaker)}`;x.registerIcon(z),x.registerIcon(C),x.registerIcon(j);let _=class extends(e(i)){constructor(){super(...arguments),this.inputRef=p(),this.listRef=p(),this.dismissController=new b(this,{isOpen:()=>this.open,onDismiss:()=>this.close()}),this.keyboardController=new g(this,{trigger:()=>this.select(),goBack:()=>this.goBack(),end:()=>this.end(),start:()=>this.start(),next:()=>this.next(),previous:()=>this.previous(),toggleOpen:()=>this.toggleOpen()}),this.open=!1,this.placeholder="Type a command or search...",this.commands=[],this.search="",this.bump=!0,this.selectedIndex=0,this.filteredCommands=[]}get selected(){return this.filteredCommands[this.selectedIndex]}show(e={}){this.open=!0,this.setParent(e.parent),this.dispatchEvent(new f("open"))}close(){var e;this.open=!1,null===(e=this.previousFocus)||void 0===e||e.focus(),this.previousFocus=void 0,this.dispatchEvent(new f("close"))}toggleOpen(){this.open?this.close():this.show()}focus(){var e;null===(e=this.inputRef.value)||void 0===e||e.focus()}willUpdate(e){e.has("commands")&&this.keyboardController.registerCommandShortcuts(),e.has("open")&&this.open&&(this.bump=!0),(e.has("search")||e.has("parent")||e.has("commands"))&&this.filterCommands()}updated(e){e.has("open")&&this.open&&(this.previousFocus=I(document),this.focus(),this.listRef.value&&(this.listRef.value.scrollTop=0))}render(){var e;const o=u(this.filteredCommands,"section"),t=0===this.filteredCommands.length?"no-results":null===(e=this.selected)||void 0===e?void 0:e.id;return s`<div class="${h({"n-visible":this.open,"n-modal":!0})}"><div @animationend="${this.handleAnimationEnd}" class="${h({"n-bump":this.bump,"n-modal-content":!0})}"><div class="n-search-wrapper"><nord-visually-hidden id="instructions">Press 'Enter' to confirm your input or 'Escape' to cancel</nord-visually-hidden><input type="text" id="search" @input="${this.handleInput}" @blur="${this.handleBlur}" ${m(this.inputRef)} placeholder="${this.placeholder}" .value="${this.search}" spellcheck="false" autocomplete="off" autocapitalize="off" aria-label="Type the name of a command to run." aria-autocomplete="list" aria-haspopup="listbox" role="combobox" aria-controls="list" aria-expanded="true" aria-activedescendant="${v(t)}" aria-describedby="instructions"></div><div class="n-modal-body"><div id="list" ${m(this.listRef)} role="listbox">${0===this.filteredCommands.length?this.renderNoResults():Array.from(o,(([e,o])=>this.renderSection(e,o)))}</div></div><slot name="footer"><div class="n-modal-footer" slot="footer"><span class="n-help"><nord-icon label="Arrow keys" name="${k}"></nord-icon>Navigate</span> <span class="n-help"><nord-icon label="Enter key" name="${"keyboard-return"}"></nord-icon>Select</span> <span class="n-help">Esc to dismiss</span> <span class="n-help n-backspace"><nord-icon label="Backspace key" name="${$}"></nord-icon>Move to parent</span></div></slot></div></div>`}renderNoResults(){return s`<div id="no-results" class="n-command-empty" role="option" aria-selected="true"><div class="n-title">No results for “${this.search}”</div><div class="n-tip">Search tips: some search terms require exact match. Try typing the entire command name, or use a different word or phrase.</div></div>`}renderSection(e,o){const t=`section-${e}`;return s`<div role="group" aria-labelledby="${v(e?t:void 0)}">${e?s`<div class="n-group-header" role="presentation" id="${v(t)}">${e}</div>`:r} ${d(o,(e=>e.id),(e=>{var o,t;return s`<nord-command-menu-action id="${e.id}" .command="${e}" ?selected="${e.id===(null===(o=this.selected)||void 0===o?void 0:o.id)}" @click="${()=>this.select(e)}" role="option" aria-selected="${v(e.id===(null===(t=this.selected)||void 0===t?void 0:t.id)||void 0)}"></nord-command-menu-action>`}))}</div>`}handleAnimationEnd(){this.bump=!1}handleBlur(){this.open&&this.focus()}handleInput(e){const o=e.target;this.setSearch(o.value)}select(e=this.selected){var o;this.commands.some((o=>o.parent===e.id))?(this.setParent(e.id),this.bump=!0,this.focus()):this.close(),this.setSearch(""),null===(o=e.handler)||void 0===o||o.call(e,this);const t=new w(e);this.dispatchEvent(t)}start(){this.selectedIndex=0}end(){this.selectedIndex=this.filteredCommands.length-1}next(){this.selectedIndex=c(this.selectedIndex+1,0,this.filteredCommands.length-1)}previous(){this.selectedIndex=c(this.selectedIndex-1,0,this.filteredCommands.length-1)}goBack(){if(!this.search&&this.parent){const e=this.commands.find((e=>e.id===this.parent));this.setParent(null==e?void 0:e.parent)}}setParent(e){this.parent=e,this.setSearch("")}setSearch(e){this.search=e,this.selectedIndex=0}filterCommands(){const e=this.search.toLocaleLowerCase().split(/\s+/);this.filteredCommands=this.commands.filter((({title:o,keywords:t="",parent:n})=>{const s=`${o} ${t}`.toLocaleLowerCase(),r=e.every((e=>s.includes(e)));return(!this.parent&&this.search||n===this.parent)&&r}))}};_.styles=[y,E],o([a({type:Boolean})],_.prototype,"open",void 0),o([a({type:String})],_.prototype,"placeholder",void 0),o([a({type:Array,attribute:!1})],_.prototype,"commands",void 0),o([l()],_.prototype,"parent",void 0),o([l()],_.prototype,"search",void 0),o([l()],_.prototype,"bump",void 0),o([l()],_.prototype,"selectedIndex",void 0),o([l()],_.prototype,"filteredCommands",void 0),_=o([t("nord-command-menu")],_);var L=_;export{L as default};
|
|
2
2
|
//# sourceMappingURL=CommandMenu.js.map
|
package/lib/CommandMenu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandMenu.js","sources":["../../icons/lib/assets/keyboard-arrow-up-down.js","../../icons/lib/assets/keyboard-return.js","../../icons/lib/assets/keyboard-backspace.js","../src/common/focus.ts","../src/command-menu/CommandMenu.ts"],"sourcesContent":["export default '<svg viewBox=\"0 0 140 140\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M105.833 24v93m0-93L80 49.833M105.833 24l25.834 25.833M34.167 117V24m0 93L60 91.167M34.167 117 8.333 91.167\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"14\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\nexport const title = \"keyboard-arrow-up-down\"\nexport const tags = \"nordicon keyboard keys arrow up down shortcut\"\n","export default '<svg viewBox=\"0 0 140 140\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"14\"><path d=\"M35 133 7 105l28-28\"/><path d=\"M7 105h112a14 14 0 0 0 14-14V21a14 14 0 0 0-14-14H77\"/></g></svg>'\nexport const title = \"keyboard-return\"\nexport const tags = \"nordicon keyboard return key shortcut\"\n","export default '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M6.707 4.879A3 3 0 0 1 8.828 4H15a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H8.828a3 3 0 0 1-2.12-.879l-4.415-4.414a1 1 0 0 1 0-1.414l4.414-4.414zm4 2.414a1 1 0 0 0-1.414 1.414L10.586 10l-1.293 1.293a1 1 0 1 0 1.414 1.414L12 11.414l1.293 1.293a1 1 0 0 0 1.414-1.414L13.414 10l1.293-1.293a1 1 0 0 0-1.414-1.414L12 8.586l-1.293-1.293z\" clip-rule=\"evenodd\"/></svg>'\nexport const title = \"keyboard-backspace\"\nexport const tags = \"nordicon keyboard backspace back delete key shortcut\"\n","/**\n * Gets the currently focused element, taking shadow roots into account.\n */\nexport function getFocusedElement(root: Document | ShadowRoot): Element | undefined {\n if (root.activeElement?.shadowRoot) {\n return getFocusedElement(root.activeElement.shadowRoot)\n }\n\n return root.activeElement || undefined\n}\n","import { LitElement, html, PropertyValues, nothing } from \"lit\"\nimport { customElement, property, state } from \"lit/decorators.js\"\nimport { repeat } from \"lit/directives/repeat.js\"\nimport { createRef, ref } from \"lit/directives/ref.js\"\nimport { classMap } from \"lit/directives/class-map.js\"\nimport { ifDefined } from \"lit/directives/if-defined.js\"\n\nimport * as navigateIcon from \"@nordhealth/icons/lib/assets/keyboard-arrow-up-down.js\"\nimport * as enterIcon from \"@nordhealth/icons/lib/assets/keyboard-return.js\"\nimport * as backspaceIcon from \"@nordhealth/icons/lib/assets/keyboard-backspace.js\"\n\nimport { groupBy } from \"../common/collection.js\"\nimport { wrap } from \"../common/number.js\"\nimport { NordEvent } from \"../common/events.js\"\nimport { getFocusedElement } from \"../common/focus.js\"\nimport { DraftComponentMixin } from \"../common/mixins/DraftComponentMixin.js\"\nimport { LightDismissController } from \"../common/controllers/LightDismissController.js\"\nimport { KeyboardController } from \"./KeyboardController.js\"\n\nimport Icon from \"../icon/Icon.js\"\nimport \"../visually-hidden/VisuallyHidden.js\"\nimport \"./CommandMenuAction.js\"\nimport { ICommandMenuAction } from \"./ICommandMenuAction.js\"\nimport { SelectEvent } from \"./events.js\"\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./CommandMenu.css\"\n\nIcon.registerIcon(navigateIcon)\nIcon.registerIcon(enterIcon)\nIcon.registerIcon(backspaceIcon)\n\n/**\n * Command Menu allows users to navigate and use an app without\n * touching the mouse and helps them transform into “power users”\n * who can harness more advanced features far faster.\n *\n * @status draft\n * @category action\n * @slot footer - Used to replace the default footer contents.\n * @fires open - The command menu was opened.\n * @fires close - The command menu was closed.\n * @fires {SelectEvent} n-select - User selected a command from the menu.\n */\n@customElement(\"nord-command-menu\")\nexport default class CommandMenu extends DraftComponentMixin(LitElement) {\n static styles = [componentStyle, style]\n\n private inputRef = createRef<HTMLInputElement>()\n private listRef = createRef<HTMLElement>()\n private previousFocus?: HTMLElement\n\n private dismissController = new LightDismissController(this, {\n isOpen: () => this.open,\n onDismiss: () => this.close(),\n })\n\n private keyboardController = new KeyboardController(this, {\n trigger: () => this.select(),\n goBack: () => this.goBack(),\n end: () => this.end(),\n start: () => this.start(),\n next: () => this.next(),\n previous: () => this.previous(),\n toggleOpen: () => this.toggleOpen(),\n })\n\n /**\n * Show or hide the command menu.\n */\n @property({ type: Boolean }) open = false\n\n /**\n * Hint text to display in the Command Menu search field.\n */\n @property({ type: String }) placeholder = \"Type a command or search...\"\n\n /**\n * Array of commands to be included in the menu.\n * Please see “Commands data” section for more documentation.\n */\n @property({ type: Array, attribute: false }) commands: Array<ICommandMenuAction> = []\n\n @state() private parent?: string\n @state() private search: string = \"\"\n @state() private bump = true\n @state() private selectedIndex = 0\n @state() private filteredCommands: Array<ICommandMenuAction> = []\n\n private get selected(): ICommandMenuAction {\n return this.filteredCommands[this.selectedIndex]\n }\n\n /**\n * Show the command menu programmatically.\n * @param options allows you to open the menu filtered to a specific parent command.\n */\n show(options: { parent?: string } = {}) {\n this.open = true\n this.setParent(options.parent)\n\n this.dispatchEvent(new NordEvent(\"open\"))\n }\n\n /**\n * Close the command menu programmatically.\n */\n close() {\n this.open = false\n this.previousFocus?.focus()\n this.previousFocus = undefined\n\n this.dispatchEvent(new NordEvent(\"close\"))\n }\n\n /**\n * Toggle the open state programmatically.\n */\n toggleOpen() {\n if (this.open) {\n this.close()\n } else {\n this.show()\n }\n }\n\n /**\n * Focus the command menu's input.\n */\n focus() {\n this.inputRef.value?.focus()\n }\n\n override willUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"commands\")) {\n this.keyboardController.registerCommandShortcuts()\n }\n\n if (changedProperties.has(\"open\") && this.open) {\n this.bump = true\n }\n\n if (\n // @ts-expect-error this is a private property so it errors, but it's fine here\n changedProperties.has(\"search\") ||\n // @ts-expect-error this is a private property so it errors, but it's fine here\n changedProperties.has(\"parent\") ||\n changedProperties.has(\"commands\")\n ) {\n this.filterCommands()\n }\n }\n\n override updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"open\") && this.open) {\n this.previousFocus = getFocusedElement(document) as HTMLElement\n this.focus()\n\n if (this.listRef.value) {\n this.listRef.value.scrollTop = 0\n }\n }\n }\n\n override render() {\n const sections = groupBy(this.filteredCommands, \"section\")\n const activeDescendant = this.filteredCommands.length === 0 ? \"no-results\" : this.selected?.id\n\n return html`\n <div\n class=${classMap({\n \"n-visible\": this.open,\n \"n-modal\": true,\n })}\n >\n <div\n @animationend=${this.handleAnimationEnd}\n class=${classMap({\n \"n-bump\": this.bump,\n \"n-modal-content\": true,\n })}\n >\n <div class=\"n-search-wrapper\">\n <nord-visually-hidden id=\"instructions\">\n Press 'Enter' to confirm your input or 'Escape' to cancel\n </nord-visually-hidden>\n <input\n type=\"text\"\n id=\"search\"\n @input=${this.handleInput}\n @blur=${this.handleBlur}\n ${ref(this.inputRef)}\n placeholder=${this.placeholder}\n .value=${this.search}\n spellcheck=\"false\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n aria-label=\"Type the name of a command to run.\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n aria-controls=\"list\"\n aria-expanded=\"true\"\n aria-activedescendant=${ifDefined(activeDescendant)}\n aria-describedby=\"instructions\"\n />\n </div>\n\n <div class=\"n-modal-body\">\n <div id=\"list\" ${ref(this.listRef)} role=\"listbox\">\n ${this.filteredCommands.length === 0\n ? this.renderNoResults()\n : Array.from(sections, ([section, commands]) => this.renderSection(section, commands))}\n </div>\n </div>\n <slot name=\"footer\">\n <div class=\"n-modal-footer\" slot=\"footer\">\n <span class=\"n-help\"><nord-icon label=\"Arrow keys\" name=${navigateIcon.title}></nord-icon> Navigate</span>\n <span class=\"n-help\"><nord-icon label=\"Enter key\" name=${enterIcon.title}></nord-icon> Select</span>\n <span class=\"n-help\">Esc to dismiss</span>\n <span class=\"n-help n-backspace\"\n ><nord-icon label=\"Backspace key\" name=${backspaceIcon.title}></nord-icon> Move to parent</span\n >\n </div>\n </slot>\n </div>\n </div>\n `\n }\n\n private renderNoResults() {\n return html`\n <div id=\"no-results\" class=\"n-command-empty\" role=\"option\" aria-selected=\"true\">\n <div class=\"n-title\">No results for “${this.search}”</div>\n <div class=\"n-tip\">\n Search tips: some search terms require exact match. Try typing the entire command name, or use\n a different word or phrase.\n </div>\n </div>\n `\n }\n\n private renderSection(section: string | undefined, commands: ICommandMenuAction[]) {\n const sectionId = `section-${section}`\n\n // TODO: test on latest safari, since it seems to have issues with grouped options\n return html`\n <div role=\"group\" aria-labelledby=${ifDefined(section ? sectionId : undefined)}>\n ${section\n ? html`<div class=\"n-group-header\" role=\"presentation\" id=${ifDefined(sectionId)}>${section}</div>`\n : nothing}\n ${repeat(\n commands,\n command => command.id,\n command => html`\n <nord-command-menu-action\n id=${command.id}\n .command=${command}\n ?selected=${command.id === this.selected?.id}\n @click=${() => this.select(command)}\n role=\"option\"\n aria-selected=${ifDefined(command.id === this.selected?.id || undefined)}\n ></nord-command-menu-action>\n `\n )}\n </div>\n `\n }\n\n private handleAnimationEnd() {\n this.bump = false\n }\n\n private handleBlur() {\n if (this.open) {\n this.focus()\n }\n }\n\n private handleInput(event: KeyboardEvent) {\n const input = event.target as HTMLInputElement\n this.setSearch(input.value)\n }\n\n private select(command: ICommandMenuAction = this.selected) {\n const isParent = this.commands.some(item => item.parent === command.id)\n\n if (isParent) {\n this.setParent(command.id)\n this.bump = true\n this.focus()\n } else {\n this.close()\n }\n\n this.setSearch(\"\")\n command.handler?.(this)\n\n // this is separated into two parts because of a bug in Custom Elements Analyzer, where it gets the event name wrong.\n // TODO: cleanup when bug is fixed.\n const event = new SelectEvent(command)\n this.dispatchEvent(event)\n }\n\n private start() {\n this.selectedIndex = 0\n }\n\n private end() {\n this.selectedIndex = this.filteredCommands.length - 1\n }\n\n private next() {\n this.selectedIndex = wrap(this.selectedIndex + 1, 0, this.filteredCommands.length - 1)\n }\n\n private previous() {\n this.selectedIndex = wrap(this.selectedIndex - 1, 0, this.filteredCommands.length - 1)\n }\n\n private goBack() {\n if (this.search) {\n return\n }\n\n if (this.parent) {\n const parentCommand = this.commands.find(command => command.id === this.parent)\n this.setParent(parentCommand?.parent)\n }\n }\n\n private setParent(parent?: string) {\n this.parent = parent\n this.setSearch(\"\")\n }\n\n private setSearch(str: string) {\n this.search = str\n this.selectedIndex = 0\n }\n\n private filterCommands() {\n const searchTerms = this.search.toLocaleLowerCase().split(/\\s+/)\n\n this.filteredCommands = this.commands.filter(({ title, keywords = \"\", parent }) => {\n const searchSpace = `${title} ${keywords}`.toLocaleLowerCase()\n const matcher = searchTerms.every(term => searchSpace.includes(term))\n\n if (!this.parent && this.search) {\n // global search for items on root\n return matcher\n }\n\n return parent === this.parent && matcher\n })\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-command-menu\": CommandMenu\n }\n}\n"],"names":["title","getFocusedElement","root","activeElement","shadowRoot","undefined","Icon","registerIcon","navigateIcon","enterIcon","backspaceIcon","CommandMenu","DraftComponentMixin","LitElement","constructor","this","createRef","LightDismissController","isOpen","open","onDismiss","close","KeyboardController","trigger","select","goBack","end","start","next","previous","toggleOpen","selected","filteredCommands","selectedIndex","show","options","setParent","parent","dispatchEvent","NordEvent","previousFocus","focus","inputRef","value","willUpdate","changedProperties","has","keyboardController","registerCommandShortcuts","bump","filterCommands","updated","document","listRef","scrollTop","render","sections","groupBy","activeDescendant","length","id","html","classMap","handleAnimationEnd","handleInput","handleBlur","ref","placeholder","search","ifDefined","renderNoResults","Array","from","section","commands","renderSection","navigateIcon.title","backspaceIcon.title","sectionId","nothing","repeat","command","event","input","target","setSearch","some","item","handler","SelectEvent","wrap","parentCommand","find","str","searchTerms","toLocaleLowerCase","split","filter","keywords","searchSpace","matcher","every","term","includes","componentStyle","style","__decorate","property","type","Boolean","String","attribute","state","customElement"],"mappings":"+7BACO,MAAMA,EAAQ,qEADN,8SAEK,8FCFL,sRACM,uBACD,0CCDb,MAAMA,EAAQ,iEADN,ydAEK,kECCJC,EAAkBC,SAChC,iBAAIA,EAAKC,oCAAeC,YACfH,EAAkBC,EAAKC,cA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+D,OAhTNzF,SAAS,CAAC6F,EAAgBC,GAwBJC,GAA5BC,EAAS,CAAEC,KAAMC,sCAKUH,GAA3BC,EAAS,CAAEC,KAAME,4CAM2BJ,GAA5CC,EAAS,CAAEC,KAAMrC,MAAOwC,WAAW,oCAE3BL,GAARM,kCACQN,GAARM,kCACQN,GAARM,gCACQN,GAARM,yCACQN,GAARM,4CA1CkBrG,KADpBsG,EAAc,sBACMtG,SAAAA"}
|
|
1
|
+
{"version":3,"file":"CommandMenu.js","sources":["../../icons/lib/assets/keyboard-arrow-up-down.js","../../icons/lib/assets/keyboard-return.js","../../icons/lib/assets/keyboard-backspace.js","../src/common/focus.ts","../src/command-menu/CommandMenu.ts"],"sourcesContent":["export default '<svg viewBox=\"0 0 140 140\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M105.833 24v93m0-93L80 49.833M105.833 24l25.834 25.833M34.167 117V24m0 93L60 91.167M34.167 117 8.333 91.167\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"14\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\nexport const title = \"keyboard-arrow-up-down\"\nexport const tags = \"nordicon keyboard keys arrow up down shortcut\"\n","export default '<svg viewBox=\"0 0 140 140\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"14\"><path d=\"M35 133 7 105l28-28\"/><path d=\"M7 105h112a14 14 0 0 0 14-14V21a14 14 0 0 0-14-14H77\"/></g></svg>'\nexport const title = \"keyboard-return\"\nexport const tags = \"nordicon keyboard return key shortcut\"\n","export default '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M6.707 4.879A3 3 0 0 1 8.828 4H15a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H8.828a3 3 0 0 1-2.12-.879l-4.415-4.414a1 1 0 0 1 0-1.414l4.414-4.414zm4 2.414a1 1 0 0 0-1.414 1.414L10.586 10l-1.293 1.293a1 1 0 1 0 1.414 1.414L12 11.414l1.293 1.293a1 1 0 0 0 1.414-1.414L13.414 10l1.293-1.293a1 1 0 0 0-1.414-1.414L12 8.586l-1.293-1.293z\" clip-rule=\"evenodd\"/></svg>'\nexport const title = \"keyboard-backspace\"\nexport const tags = \"nordicon keyboard backspace back delete key shortcut\"\n","/**\n * Gets the currently focused element, taking shadow roots into account.\n */\nexport function getFocusedElement(root: Document | ShadowRoot): Element | undefined {\n if (root.activeElement?.shadowRoot) {\n return getFocusedElement(root.activeElement.shadowRoot)\n }\n\n return root.activeElement || undefined\n}\n","import { LitElement, html, PropertyValues, nothing } from \"lit\"\nimport { customElement, property, state } from \"lit/decorators.js\"\nimport { repeat } from \"lit/directives/repeat.js\"\nimport { createRef, ref } from \"lit/directives/ref.js\"\nimport { classMap } from \"lit/directives/class-map.js\"\nimport { ifDefined } from \"lit/directives/if-defined.js\"\n\nimport * as navigateIcon from \"@nordhealth/icons/lib/assets/keyboard-arrow-up-down.js\"\nimport * as enterIcon from \"@nordhealth/icons/lib/assets/keyboard-return.js\"\nimport * as backspaceIcon from \"@nordhealth/icons/lib/assets/keyboard-backspace.js\"\n\nimport { groupBy } from \"../common/collection.js\"\nimport { wrap } from \"../common/number.js\"\nimport { NordEvent } from \"../common/events.js\"\nimport { getFocusedElement } from \"../common/focus.js\"\nimport { DraftComponentMixin } from \"../common/mixins/DraftComponentMixin.js\"\nimport { LightDismissController } from \"../common/controllers/LightDismissController.js\"\nimport { KeyboardController } from \"./KeyboardController.js\"\n\nimport Icon from \"../icon/Icon.js\"\nimport \"../visually-hidden/VisuallyHidden.js\"\nimport \"./CommandMenuAction.js\"\nimport { ICommandMenuAction } from \"./ICommandMenuAction.js\"\nimport { SelectEvent } from \"./SelectEvent.js\"\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./CommandMenu.css\"\n\nIcon.registerIcon(navigateIcon)\nIcon.registerIcon(enterIcon)\nIcon.registerIcon(backspaceIcon)\n\n/**\n * Command Menu allows users to navigate and use an app without\n * touching the mouse and helps them transform into “power users”\n * who can harness more advanced features far faster.\n *\n * @status draft\n * @category action\n * @slot footer - Used to replace the default footer contents.\n * @fires open - The command menu was opened.\n * @fires close - The command menu was closed.\n * @fires {SelectEvent} nord-select - User selected a command from the menu.\n */\n@customElement(\"nord-command-menu\")\nexport default class CommandMenu extends DraftComponentMixin(LitElement) {\n static styles = [componentStyle, style]\n\n private inputRef = createRef<HTMLInputElement>()\n private listRef = createRef<HTMLElement>()\n private previousFocus?: HTMLElement\n\n private dismissController = new LightDismissController(this, {\n isOpen: () => this.open,\n onDismiss: () => this.close(),\n })\n\n private keyboardController = new KeyboardController(this, {\n trigger: () => this.select(),\n goBack: () => this.goBack(),\n end: () => this.end(),\n start: () => this.start(),\n next: () => this.next(),\n previous: () => this.previous(),\n toggleOpen: () => this.toggleOpen(),\n })\n\n /**\n * Show or hide the command menu.\n */\n @property({ type: Boolean }) open = false\n\n /**\n * Hint text to display in the Command Menu search field.\n */\n @property({ type: String }) placeholder = \"Type a command or search...\"\n\n /**\n * Array of commands to be included in the menu.\n * Please see “Commands data” section for more documentation.\n */\n @property({ type: Array, attribute: false }) commands: Array<ICommandMenuAction> = []\n\n @state() private parent?: string\n @state() private search: string = \"\"\n @state() private bump = true\n @state() private selectedIndex = 0\n @state() private filteredCommands: Array<ICommandMenuAction> = []\n\n private get selected(): ICommandMenuAction {\n return this.filteredCommands[this.selectedIndex]\n }\n\n /**\n * Show the command menu programmatically.\n * @param options allows you to open the menu filtered to a specific parent command.\n */\n show(options: { parent?: string } = {}) {\n this.open = true\n this.setParent(options.parent)\n\n this.dispatchEvent(new NordEvent(\"open\"))\n }\n\n /**\n * Close the command menu programmatically.\n */\n close() {\n this.open = false\n this.previousFocus?.focus()\n this.previousFocus = undefined\n\n this.dispatchEvent(new NordEvent(\"close\"))\n }\n\n /**\n * Toggle the open state programmatically.\n */\n toggleOpen() {\n if (this.open) {\n this.close()\n } else {\n this.show()\n }\n }\n\n /**\n * Focus the command menu's input.\n */\n focus() {\n this.inputRef.value?.focus()\n }\n\n override willUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"commands\")) {\n this.keyboardController.registerCommandShortcuts()\n }\n\n if (changedProperties.has(\"open\") && this.open) {\n this.bump = true\n }\n\n if (\n // @ts-expect-error this is a private property so it errors, but it's fine here\n changedProperties.has(\"search\") ||\n // @ts-expect-error this is a private property so it errors, but it's fine here\n changedProperties.has(\"parent\") ||\n changedProperties.has(\"commands\")\n ) {\n this.filterCommands()\n }\n }\n\n override updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"open\") && this.open) {\n this.previousFocus = getFocusedElement(document) as HTMLElement\n this.focus()\n\n if (this.listRef.value) {\n this.listRef.value.scrollTop = 0\n }\n }\n }\n\n override render() {\n const sections = groupBy(this.filteredCommands, \"section\")\n const activeDescendant = this.filteredCommands.length === 0 ? \"no-results\" : this.selected?.id\n\n return html`\n <div\n class=${classMap({\n \"n-visible\": this.open,\n \"n-modal\": true,\n })}\n >\n <div\n @animationend=${this.handleAnimationEnd}\n class=${classMap({\n \"n-bump\": this.bump,\n \"n-modal-content\": true,\n })}\n >\n <div class=\"n-search-wrapper\">\n <nord-visually-hidden id=\"instructions\">\n Press 'Enter' to confirm your input or 'Escape' to cancel\n </nord-visually-hidden>\n <input\n type=\"text\"\n id=\"search\"\n @input=${this.handleInput}\n @blur=${this.handleBlur}\n ${ref(this.inputRef)}\n placeholder=${this.placeholder}\n .value=${this.search}\n spellcheck=\"false\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n aria-label=\"Type the name of a command to run.\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n aria-controls=\"list\"\n aria-expanded=\"true\"\n aria-activedescendant=${ifDefined(activeDescendant)}\n aria-describedby=\"instructions\"\n />\n </div>\n\n <div class=\"n-modal-body\">\n <div id=\"list\" ${ref(this.listRef)} role=\"listbox\">\n ${this.filteredCommands.length === 0\n ? this.renderNoResults()\n : Array.from(sections, ([section, commands]) => this.renderSection(section, commands))}\n </div>\n </div>\n <slot name=\"footer\">\n <div class=\"n-modal-footer\" slot=\"footer\">\n <span class=\"n-help\"><nord-icon label=\"Arrow keys\" name=${navigateIcon.title}></nord-icon> Navigate</span>\n <span class=\"n-help\"><nord-icon label=\"Enter key\" name=${enterIcon.title}></nord-icon> Select</span>\n <span class=\"n-help\">Esc to dismiss</span>\n <span class=\"n-help n-backspace\"\n ><nord-icon label=\"Backspace key\" name=${backspaceIcon.title}></nord-icon> Move to parent</span\n >\n </div>\n </slot>\n </div>\n </div>\n `\n }\n\n private renderNoResults() {\n return html`\n <div id=\"no-results\" class=\"n-command-empty\" role=\"option\" aria-selected=\"true\">\n <div class=\"n-title\">No results for “${this.search}”</div>\n <div class=\"n-tip\">\n Search tips: some search terms require exact match. Try typing the entire command name, or use\n a different word or phrase.\n </div>\n </div>\n `\n }\n\n private renderSection(section: string | undefined, commands: ICommandMenuAction[]) {\n const sectionId = `section-${section}`\n\n // TODO: test on latest safari, since it seems to have issues with grouped options\n return html`\n <div role=\"group\" aria-labelledby=${ifDefined(section ? sectionId : undefined)}>\n ${section\n ? html`<div class=\"n-group-header\" role=\"presentation\" id=${ifDefined(sectionId)}>${section}</div>`\n : nothing}\n ${repeat(\n commands,\n command => command.id,\n command => html`\n <nord-command-menu-action\n id=${command.id}\n .command=${command}\n ?selected=${command.id === this.selected?.id}\n @click=${() => this.select(command)}\n role=\"option\"\n aria-selected=${ifDefined(command.id === this.selected?.id || undefined)}\n ></nord-command-menu-action>\n `\n )}\n </div>\n `\n }\n\n private handleAnimationEnd() {\n this.bump = false\n }\n\n private handleBlur() {\n if (this.open) {\n this.focus()\n }\n }\n\n private handleInput(event: KeyboardEvent) {\n const input = event.target as HTMLInputElement\n this.setSearch(input.value)\n }\n\n private select(command: ICommandMenuAction = this.selected) {\n const isParent = this.commands.some(item => item.parent === command.id)\n\n if (isParent) {\n this.setParent(command.id)\n this.bump = true\n this.focus()\n } else {\n this.close()\n }\n\n this.setSearch(\"\")\n command.handler?.(this)\n\n // this is separated into two parts because of a bug in Custom Elements Analyzer, where it gets the event name wrong.\n // TODO: cleanup when bug is fixed.\n const event = new SelectEvent(command)\n this.dispatchEvent(event)\n }\n\n private start() {\n this.selectedIndex = 0\n }\n\n private end() {\n this.selectedIndex = this.filteredCommands.length - 1\n }\n\n private next() {\n this.selectedIndex = wrap(this.selectedIndex + 1, 0, this.filteredCommands.length - 1)\n }\n\n private previous() {\n this.selectedIndex = wrap(this.selectedIndex - 1, 0, this.filteredCommands.length - 1)\n }\n\n private goBack() {\n if (this.search) {\n return\n }\n\n if (this.parent) {\n const parentCommand = this.commands.find(command => command.id === this.parent)\n this.setParent(parentCommand?.parent)\n }\n }\n\n private setParent(parent?: string) {\n this.parent = parent\n this.setSearch(\"\")\n }\n\n private setSearch(str: string) {\n this.search = str\n this.selectedIndex = 0\n }\n\n private filterCommands() {\n const searchTerms = this.search.toLocaleLowerCase().split(/\\s+/)\n\n this.filteredCommands = this.commands.filter(({ title, keywords = \"\", parent }) => {\n const searchSpace = `${title} ${keywords}`.toLocaleLowerCase()\n const matcher = searchTerms.every(term => searchSpace.includes(term))\n\n if (!this.parent && this.search) {\n // global search for items on root\n return matcher\n }\n\n return parent === this.parent && matcher\n })\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-command-menu\": CommandMenu\n }\n}\n"],"names":["title","getFocusedElement","root","activeElement","shadowRoot","undefined","Icon","registerIcon","navigateIcon","enterIcon","backspaceIcon","CommandMenu","DraftComponentMixin","LitElement","constructor","this","createRef","LightDismissController","isOpen","open","onDismiss","close","KeyboardController","trigger","select","goBack","end","start","next","previous","toggleOpen","selected","filteredCommands","selectedIndex","show","options","setParent","parent","dispatchEvent","NordEvent","previousFocus","focus","inputRef","value","willUpdate","changedProperties","has","keyboardController","registerCommandShortcuts","bump","filterCommands","updated","document","listRef","scrollTop","render","sections","groupBy","activeDescendant","length","id","html","classMap","handleAnimationEnd","handleInput","handleBlur","ref","placeholder","search","ifDefined","renderNoResults","Array","from","section","commands","renderSection","navigateIcon.title","backspaceIcon.title","sectionId","nothing","repeat","command","event","input","target","setSearch","some","item","handler","SelectEvent","wrap","parentCommand","find","str","searchTerms","toLocaleLowerCase","split","filter","keywords","searchSpace","matcher","every","term","includes","componentStyle","style","__decorate","property","type","Boolean","String","attribute","state","customElement"],"mappings":"o8BACO,MAAMA,EAAQ,qEADN,8SAEK,8FCFL,sRACM,uBACD,0CCDb,MAAMA,EAAQ,iEADN,ydAEK,kECCJC,EAAkBC,SAChC,iBAAIA,EAAKC,oCAAeC,YACfH,EAAkBC,EAAKC,cAAcC,YAGvCF,EAAKC,oBAAiBE,u5FCmB/BC,EAAKC,aAAaC,GAClBF,EAAKC,aAAaE,GAClBH,EAAKC,aAAaG,GAelB,IAAqBC,EAArB,cAAyCC,EAAoBC,IAA7DC,kCAGUC,cAAWC,IACXD,aAAUC,IAGVD,uBAAoB,IAAIE,EAAuBF,KAAM,CAC3DG,OAAQ,IAAMH,KAAKI,KACnBC,UAAW,IAAML,KAAKM,UAGhBN,wBAAqB,IAAIO,EAAmBP,KAAM,CACxDQ,QAAS,IAAMR,KAAKS,SACpBC,OAAQ,IAAMV,KAAKU,SACnBC,IAAK,IAAMX,KAAKW,MAChBC,MAAO,IAAMZ,KAAKY,QAClBC,KAAM,IAAMb,KAAKa,OACjBC,SAAU,IAAMd,KAAKc,WACrBC,WAAY,IAAMf,KAAKe,eAMIf,WAAO,EAKRA,iBAAc,8BAMGA,cAAsC,GAGlEA,YAAiB,GACjBA,WAAO,EACPA,mBAAgB,EAChBA,sBAA8C,GAEnDgB,eACV,OAAOhB,KAAKiB,iBAAiBjB,KAAKkB,eAOpCC,KAAKC,EAA+B,IAClCpB,KAAKI,MAAO,EACZJ,KAAKqB,UAAUD,EAAQE,QAEvBtB,KAAKuB,cAAc,IAAIC,EAAU,SAMnClB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SAI1BD,UAAUC,GAChBtB,KAAKsB,OAASA,EACdtB,KAAKsE,UAAU,IAGTA,UAAUQ,GAChB9E,KAAKqD,OAASyB,EACd9E,KAAKkB,cAAgB,EAGfiB,iBACN,MAAM4C,EAAc/E,KAAKqD,OAAO2B,oBAAoBC,MAAM,OAE1DjF,KAAKiB,iBAAmBjB,KAAK2D,SAASuB,QAAO,EAAGjG,MAAAA,EAAOkG,SAAAA,EAAW,GAAI7D,OAAAA,MACpE,MAAM8D,EAAc,GAAGnG,KAASkG,IAAWH,oBACrCK,EAAUN,EAAYO,OAAMC,GAAQH,EAAYI,SAASD,KAE/D,QAAKvF,KAAKsB,QAAUtB,KAAKqD,QAKlB/B,IAAWtB,KAAKsB,SAHd+D,OAhTNzF,SAAS,CAAC6F,EAAgBC,GAwBJC,GAA5BC,EAAS,CAAEC,KAAMC,sCAKUH,GAA3BC,EAAS,CAAEC,KAAME,4CAM2BJ,GAA5CC,EAAS,CAAEC,KAAMrC,MAAOwC,WAAW,oCAE3BL,GAARM,kCACQN,GAARM,kCACQN,GAARM,gCACQN,GAARM,yCACQN,GAARM,4CA1CkBrG,KADpBsG,EAAc,sBACMtG,SAAAA"}
|
package/lib/Icon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as e,_ as s,n as i}from"./DraftComponentMixin-30345acf.js";import{r as t,$ as o,s as r}from"./lit-element-9646ab7e.js";import{e as n}from"./property-03f59dce.js";import{t as a}from"./state-70f38ceb.js";import{l as c}from"./if-defined-2a4c6dbc.js";import{o as l}from"./unsafe-html-4da54dd2.js";import{s as d}from"./Component-a19be7c9.js";import"./directive-de55b00a.js";const h=t`:host{--n-icon-size:var(--n-size-icon-m);display:inline-block;block-size:var(--n-icon-size);inline-size:var(--n-icon-size)}:host([size=xs]){--n-icon-size:var(--n-size-icon-xs)}:host([size="s"]){--n-icon-size:var(--n-size-icon-s)}:host([size="l"]){--n-icon-size:var(--n-size-icon-l)}:host([size=xl]){--n-icon-size:var(--n-size-icon-xl)}:host([size=xxl]){--n-icon-size:var(--n-size-icon-xxl)}.n-icon{display:block}svg{display:block}`;var v;let p=v=class extends(e(r)){constructor(){super(...arguments),this.name="",this.size="m",this.svg=""}static registerResolver(e){v.resolver=e}static registerIcon(e,s){let i,t;if("string"==typeof e?(i=e,t=s):(i=e.title,t=e.default),!i)throw new Error("name is required when registering an icon");if(!t)throw new Error("icon must not be empty");v.registeredIcons.has(i)||v.registeredIcons.set(i,t)}willUpdate(e){if(!e.has("name"))return;const s=this.resolve();"string"==typeof s?this.svg=s:s.then((e=>{this.svg=e})).catch((()=>{this.svg=""}))}render(){return o`<div role="${c(this.label?"img":void 0)}" aria-label="${c(this.label)}"><slot style="${c(this.color?`color:${this.color}`:void 0)}" aria-hidden="true">${l(this.svg)}</slot></div>`}resolve(){return this.name?v.registeredIcons.has(this.name)?v.registeredIcons.get(this.name):v.resolver(this.name):""}};p.styles=[d,h],p.resolver=e=>fetch(`https://nordcdn.net/ds/icons/1.3.
|
|
1
|
+
import{D as e,_ as s,n as i}from"./DraftComponentMixin-30345acf.js";import{r as t,$ as o,s as r}from"./lit-element-9646ab7e.js";import{e as n}from"./property-03f59dce.js";import{t as a}from"./state-70f38ceb.js";import{l as c}from"./if-defined-2a4c6dbc.js";import{o as l}from"./unsafe-html-4da54dd2.js";import{s as d}from"./Component-a19be7c9.js";import"./directive-de55b00a.js";const h=t`:host{--n-icon-size:var(--n-size-icon-m);display:inline-block;block-size:var(--n-icon-size);inline-size:var(--n-icon-size)}:host([size=xs]){--n-icon-size:var(--n-size-icon-xs)}:host([size="s"]){--n-icon-size:var(--n-size-icon-s)}:host([size="l"]){--n-icon-size:var(--n-size-icon-l)}:host([size=xl]){--n-icon-size:var(--n-size-icon-xl)}:host([size=xxl]){--n-icon-size:var(--n-size-icon-xxl)}.n-icon{display:block}svg{display:block}`;var v;let p=v=class extends(e(r)){constructor(){super(...arguments),this.name="",this.size="m",this.svg=""}static registerResolver(e){v.resolver=e}static registerIcon(e,s){let i,t;if("string"==typeof e?(i=e,t=s):(i=e.title,t=e.default),!i)throw new Error("name is required when registering an icon");if(!t)throw new Error("icon must not be empty");v.registeredIcons.has(i)||v.registeredIcons.set(i,t)}willUpdate(e){if(!e.has("name"))return;const s=this.resolve();"string"==typeof s?this.svg=s:s.then((e=>{this.svg=e})).catch((()=>{this.svg=""}))}render(){return o`<div role="${c(this.label?"img":void 0)}" aria-label="${c(this.label)}"><slot style="${c(this.color?`color:${this.color}`:void 0)}" aria-hidden="true">${l(this.svg)}</slot></div>`}resolve(){return this.name?v.registeredIcons.has(this.name)?v.registeredIcons.get(this.name):v.resolver(this.name):""}};p.styles=[d,h],p.resolver=e=>fetch(`https://nordcdn.net/ds/icons/1.3.2/assets/${e}.svg`).then((e=>e.text())),p.registeredIcons=new Map,s([n({reflect:!0})],p.prototype,"name",void 0),s([n({reflect:!0})],p.prototype,"size",void 0),s([n({reflect:!0})],p.prototype,"color",void 0),s([n({reflect:!0})],p.prototype,"label",void 0),s([a()],p.prototype,"svg",void 0),p=v=s([i("nord-icon")],p);var m=p;export{m as default};
|
|
2
2
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectEvent.js","sources":["../src/command-menu/SelectEvent.ts"],"sourcesContent":["import { NordEvent } from \"../common/events.js\"\nimport { ICommandMenuAction } from \"./ICommandMenuAction.js\"\n\nexport class SelectEvent extends NordEvent {\n static eventName = \"nord-select\"\n command: ICommandMenuAction\n\n constructor(command: ICommandMenuAction) {\n super(SelectEvent.eventName)\n this.command = command\n }\n}\n"],"names":["SelectEvent","NordEvent","constructor","command","super","eventName","this"],"mappings":"+CAGaA,UAAoBC,EAI/BC,YAAYC,GACVC,MAAMJ,EAAYK,WAClBC,KAAKH,QAAUA,GALVH,YAAY"}
|
package/lib/Tooltip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as t,_ as e,n}from"./DraftComponentMixin-30345acf.js";import{r as o,$ as i,s as r}from"./lit-element-9646ab7e.js";import{e as s}from"./property-03f59dce.js";import{t as l}from"./state-70f38ceb.js";import{S as a}from"./SlotController-5bfc47d1.js";import{s as c}from"./Component-a19be7c9.js";function d(t){return t.split("-")[0]}function f(t){return t.split("-")[1]}function h(t){return["top","bottom"].includes(d(t))?"x":"y"}function u(t){return"y"===t?"height":"width"}function p(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(d(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=h(o),a=u(l);switch(f(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 m(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function y(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),p=s[f?"floating"===d?"reference":"floating":d],y=await i.getClippingClientRect({element:await i.isElement(p)?p:p.contextElement||await i.getDocumentElement({element:s.floating}),boundary:a,rootBoundary:c}),g=m(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:y.top-g.top+u.top,bottom:g.bottom-y.bottom+u.bottom,left:y.left-g.left+u.left,right:g.right-y.right+u.right}}const g=Math.min,v=Math.max;function b(t,e,n){return v(t,g(e,n))}const x={left:"right",right:"left",bottom:"top",top:"bottom"};function w(t){return t.replace(/left|right|bottom|top/g,(t=>x[t]))}const E={start:"end",end:"start"};function k(t){return t.replace(/start|end/g,(t=>E[t]))}const L=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:c=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",flipAlignment:g=!0,...v}=t,b=d(i),x=p||(b===l||!g?[w(l)]:function(t){const e=w(t);return[k(t),e,k(e)]}(l)),E=[l,...x],L=await y(e,v),T=[];let C=(null==(o=r.flip)?void 0:o.overflows)||[];if(a&&T.push(L[b]),c){const{main:t,cross:e}=function(t,e){const n="start"===f(t),o=h(t),i=u(o);let r="x"===o?n?"right":"left":n?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=w(r)),{main:r,cross:w(r)}}(i,s);T.push(L[t],L[e])}if(C=[...C,{placement:i,overflows:T}],!T.every((t=>t<=0))){var R,D;const t=(null!=(R=null==(D=r.flip)?void 0:D.index)?R:0)+1,e=E[t];if(e)return{data:{index:t,overflows:C},reset:{placement:e}};let n="bottom";switch(m){case"bestFit":{var S;const t=null==(S=C.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 T=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=d(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"===h(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 C(t){return"[object Window]"===(null==t?void 0:t.toString())}function R(t){if(null==t)return window;if(!C(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function D(t){return R(t).getComputedStyle(t)}function S(t){return C(t)?"":t?(t.nodeName||"").toLowerCase():""}function P(t){return t instanceof R(t).HTMLElement}function A(t){return t instanceof R(t).Element}function W(t){return t instanceof R(t).ShadowRoot||t instanceof ShadowRoot}function O(t){const{overflow:e,overflowX:n,overflowY:o}=D(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function z(t){return["table","td","th"].includes(S(t))}function H(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=D(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 N=Math.min,j=Math.max,B=Math.round;function M(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&P(t)&&(o=t.offsetWidth>0&&B(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&B(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 V(t){return(e=t,(e instanceof R(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function $(t){return C(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function q(t){return M(V(t)).left+$(t).scrollLeft}function F(t,e,n){const o=P(e),i=V(e),r=M(t,o&&function(t){const e=M(t);return B(e.width)!==t.offsetWidth||B(e.height)!==t.offsetHeight}(e));let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==S(e)||O(i))&&(s=$(e)),P(e)){const t=M(e,!0);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=q(i));return{x:r.left+s.scrollLeft-l.x,y:r.top+s.scrollTop-l.y,width:r.width,height:r.height}}function X(t){return"html"===S(t)?t:t.assignedSlot||t.parentNode||(W(t)?t.host:null)||V(t)}function Y(t){return P(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function I(t){const e=R(t);let n=Y(t);for(;n&&z(n)&&"static"===getComputedStyle(n).position;)n=Y(n);return n&&("html"===S(n)||"body"===S(n)&&"static"===getComputedStyle(n).position&&!H(n))?e:n||function(t){let e=X(t);for(;P(e)&&!["html","body"].includes(S(e));){if(H(e))return e;e=e.parentNode}return null}(t)||e}function U(t){return{width:t.offsetWidth,height:t.offsetHeight}}function _(t){return["html","body","#document"].includes(S(t))?t.ownerDocument.body:P(t)&&O(t)?t:_(X(t))}function G(t,e){var n;void 0===e&&(e=[]);const o=_(t),i=o===(null==(n=t.ownerDocument)?void 0:n.body),r=R(o),s=i?[r].concat(r.visualViewport||[],O(o)?o:[]):o,l=e.concat(s);return i?l:l.concat(G(X(s)))}function J(t,e){return"viewport"===e?m(function(t){const e=R(t),n=V(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)):A(e)?function(t){const e=M(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):m(function(t){var e;const n=V(t),o=$(t),i=null==(e=t.ownerDocument)?void 0:e.body,r=j(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=j(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let l=-o.scrollLeft+q(t);const a=-o.scrollTop;return"rtl"===D(i||n).direction&&(l+=j(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:s,x:l,y:a}}(V(t)))}function K(t){const e=G(X(t)),n=["absolute","fixed"].includes(D(t).position)&&P(t)?I(t):t;return A(n)?e.filter((t=>A(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&W(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==S(t))):[]}const Q={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:F(e,I(n),o),floating:{...U(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=P(n),r=V(n);if(n===r)return e;let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==S(n)||O(r))&&(s=$(n)),P(n))){const t=M(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 I(e)},isElement:t=>A(t),getDocumentElement:t=>{let{element:e}=t;return V(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?K(e):[].concat(n),o],r=i[0],s=i.reduce(((t,n)=>{const o=J(e,n);return t.top=j(o.top,t.top),t.right=N(o.right,t.right),t.bottom=N(o.bottom,t.bottom),t.left=j(o.left,t.left),t}),J(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 U(e)},getClientRects:t=>{let{element:e}=t;return e.getClientRects()}},Z=(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}=p({...l,placement:o}),d=o,f={};for(let n=0;n<r.length;n++){const{name:h,fn:u}=r[n],{x:m,y,data:g,reset:v}=await u({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!=y?y:c,f={...f,[h]:null!=g?g:{}},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}=p({...l,placement:d}))),n=-1)}return{x:a,y:c,placement:d,strategy:i,middlewareData:f}})(t,e,{platform:Q,...n});function tt(t,e){const n=t.getAttribute(e);return n?n.split(/\s+/):[]}function et(t,e,n){t.setAttribute(e,n.join(" "))}const nt=o`:host{--n-tooltip-background:rgba(20, 20, 20, 0.95);--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-color-text-inverse);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;flex-wrap:wrap;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);padding:1px;text-align:center;font-size:var(--n-font-size-xs);line-height:var(--n-line-height-tight);letter-spacing:-.5px;background-color:var(--n-tooltip-key-background)}`;var ot;let it=ot=class extends(t(r)){constructor(){super(...arguments),this.shortcutSlot=new a(this,"shortcut"),this.proxy=document.createElement("span"),this.visible=!1,this.position="top",this.role="tooltip",this.id="",this.delay=300,this.updatePosition=()=>{return Z(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,c={x:n,y:o},f=await y(e,a),u=h(d(i)),p="x"===u?"y":"x";let m=c[u],g=c[p];if(r){const t="y"===u?"bottom":"right";m=b(m+f["y"===u?"top":"left"],m,m-f[t])}if(s){const t="y"===p?"bottom":"right";g=b(g+f["y"===p?"top":"left"],g,g-f[t])}const v=l.fn({...e,[u]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-o}}}}),T(8),L()]}).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=ot.lastOpened)||void 0===t||t.hideTooltip(),ot.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=tt(t,e);o.includes(n)||et(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=tt(t,e);o.includes(n)&&et(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>`}};it.styles=[c,nt],e([l()],it.prototype,"visible",void 0),e([s({reflect:!0})],it.prototype,"position",void 0),e([s({reflect:!0})],it.prototype,"role",void 0),e([s({reflect:!0})],it.prototype,"id",void 0),e([s({reflect:!0,type:Number})],it.prototype,"delay",void 0),it=ot=e([n("nord-tooltip")],it);var rt=it;export{rt as default};
|
|
1
|
+
import{D as t,_ as e,n}from"./DraftComponentMixin-30345acf.js";import{r as o,$ as i,s as r}from"./lit-element-9646ab7e.js";import{e as s}from"./property-03f59dce.js";import{t as l}from"./state-70f38ceb.js";import{S as a}from"./SlotController-5bfc47d1.js";import{s as c}from"./Component-a19be7c9.js";function d(t){return t.split("-")[0]}function f(t){return t.split("-")[1]}function h(t){return["top","bottom"].includes(d(t))?"x":"y"}function u(t){return"y"===t?"height":"width"}function p(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(d(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=h(o),a=u(l);switch(f(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 m(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function g(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),p=s[f?"floating"===d?"reference":"floating":d],g=await i.getClippingClientRect({element:await i.isElement(p)?p:p.contextElement||await i.getDocumentElement({element:s.floating}),boundary:a,rootBoundary:c}),y=m(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 y=Math.min,v=Math.max;function b(t,e,n){return v(t,y(e,n))}const x={left:"right",right:"left",bottom:"top",top:"bottom"};function w(t){return t.replace(/left|right|bottom|top/g,(t=>x[t]))}const E={start:"end",end:"start"};function k(t){return t.replace(/start|end/g,(t=>E[t]))}const L=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:c=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",flipAlignment:y=!0,...v}=t,b=d(i),x=p||(b===l||!y?[w(l)]:function(t){const e=w(t);return[k(t),e,k(e)]}(l)),E=[l,...x],L=await g(e,v),T=[];let C=(null==(o=r.flip)?void 0:o.overflows)||[];if(a&&T.push(L[b]),c){const{main:t,cross:e}=function(t,e){const n="start"===f(t),o=h(t),i=u(o);let r="x"===o?n?"right":"left":n?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=w(r)),{main:r,cross:w(r)}}(i,s);T.push(L[t],L[e])}if(C=[...C,{placement:i,overflows:T}],!T.every((t=>t<=0))){var R,D;const t=(null!=(R=null==(D=r.flip)?void 0:D.index)?R:0)+1,e=E[t];if(e)return{data:{index:t,overflows:C},reset:{placement:e}};let n="bottom";switch(m){case"bestFit":{var S;const t=null==(S=C.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 T=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=d(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"===h(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 C(t){return"[object Window]"===(null==t?void 0:t.toString())}function R(t){if(null==t)return window;if(!C(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function D(t){return R(t).getComputedStyle(t)}function S(t){return C(t)?"":t?(t.nodeName||"").toLowerCase():""}function P(t){return t instanceof R(t).HTMLElement}function A(t){return t instanceof R(t).Element}function W(t){return t instanceof R(t).ShadowRoot||t instanceof ShadowRoot}function O(t){const{overflow:e,overflowX:n,overflowY:o}=D(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function z(t){return["table","td","th"].includes(S(t))}function H(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=D(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 N=Math.min,j=Math.max,B=Math.round;function M(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&P(t)&&(o=t.offsetWidth>0&&B(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&B(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 V(t){return(e=t,(e instanceof R(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function $(t){return C(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function q(t){return M(V(t)).left+$(t).scrollLeft}function F(t,e,n){const o=P(e),i=V(e),r=M(t,o&&function(t){const e=M(t);return B(e.width)!==t.offsetWidth||B(e.height)!==t.offsetHeight}(e));let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==S(e)||O(i))&&(s=$(e)),P(e)){const t=M(e,!0);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=q(i));return{x:r.left+s.scrollLeft-l.x,y:r.top+s.scrollTop-l.y,width:r.width,height:r.height}}function X(t){return"html"===S(t)?t:t.assignedSlot||t.parentNode||(W(t)?t.host:null)||V(t)}function Y(t){return P(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function I(t){const e=R(t);let n=Y(t);for(;n&&z(n)&&"static"===getComputedStyle(n).position;)n=Y(n);return n&&("html"===S(n)||"body"===S(n)&&"static"===getComputedStyle(n).position&&!H(n))?e:n||function(t){let e=X(t);for(;P(e)&&!["html","body"].includes(S(e));){if(H(e))return e;e=e.parentNode}return null}(t)||e}function U(t){return{width:t.offsetWidth,height:t.offsetHeight}}function _(t){return["html","body","#document"].includes(S(t))?t.ownerDocument.body:P(t)&&O(t)?t:_(X(t))}function G(t,e){var n;void 0===e&&(e=[]);const o=_(t),i=o===(null==(n=t.ownerDocument)?void 0:n.body),r=R(o),s=i?[r].concat(r.visualViewport||[],O(o)?o:[]):o,l=e.concat(s);return i?l:l.concat(G(X(s)))}function J(t,e){return"viewport"===e?m(function(t){const e=R(t),n=V(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)):A(e)?function(t){const e=M(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):m(function(t){var e;const n=V(t),o=$(t),i=null==(e=t.ownerDocument)?void 0:e.body,r=j(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=j(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let l=-o.scrollLeft+q(t);const a=-o.scrollTop;return"rtl"===D(i||n).direction&&(l+=j(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:s,x:l,y:a}}(V(t)))}function K(t){const e=G(X(t)),n=["absolute","fixed"].includes(D(t).position)&&P(t)?I(t):t;return A(n)?e.filter((t=>A(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&W(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==S(t))):[]}const Q={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:F(e,I(n),o),floating:{...U(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=P(n),r=V(n);if(n===r)return e;let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==S(n)||O(r))&&(s=$(n)),P(n))){const t=M(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 I(e)},isElement:t=>A(t),getDocumentElement:t=>{let{element:e}=t;return V(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?K(e):[].concat(n),o],r=i[0],s=i.reduce(((t,n)=>{const o=J(e,n);return t.top=j(o.top,t.top),t.right=N(o.right,t.right),t.bottom=N(o.bottom,t.bottom),t.left=j(o.left,t.left),t}),J(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 U(e)},getClientRects:t=>{let{element:e}=t;return e.getClientRects()}},Z=(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}=p({...l,placement:o}),d=o,f={};for(let n=0;n<r.length;n++){const{name:h,fn:u}=r[n],{x:m,y:g,data:y,reset:v}=await u({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}=p({...l,placement:d}))),n=-1)}return{x:a,y:c,placement:d,strategy:i,middlewareData:f}})(t,e,{platform:Q,...n});function tt(t,e){const n=t.getAttribute(e);return n?n.split(/\s+/):[]}function et(t,e,n){t.setAttribute(e,n.join(" "))}const nt=o`:host{--n-tooltip-background:rgba(20, 20, 20, 0.95);--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-color-text-inverse);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 ot;let it=ot=class extends(t(r)){constructor(){super(...arguments),this.shortcutSlot=new a(this,"shortcut"),this.proxy=document.createElement("span"),this.visible=!1,this.position="top",this.role="tooltip",this.id="",this.delay=300,this.updatePosition=()=>{return Z(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,c={x:n,y:o},f=await g(e,a),u=h(d(i)),p="x"===u?"y":"x";let m=c[u],y=c[p];if(r){const t="y"===u?"bottom":"right";m=b(m+f["y"===u?"top":"left"],m,m-f[t])}if(s){const t="y"===p?"bottom":"right";y=b(y+f["y"===p?"top":"left"],y,y-f[t])}const v=l.fn({...e,[u]:m,[p]:y});return{...v,data:{x:v.x-n,y:v.y-o}}}}),T(8),L()]}).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=ot.lastOpened)||void 0===t||t.hideTooltip(),ot.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=tt(t,e);o.includes(n)||et(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=tt(t,e);o.includes(n)&&et(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>`}};it.styles=[c,nt],e([l()],it.prototype,"visible",void 0),e([s({reflect:!0})],it.prototype,"position",void 0),e([s({reflect:!0})],it.prototype,"role",void 0),e([s({reflect:!0})],it.prototype,"id",void 0),e([s({reflect:!0,type:Number})],it.prototype,"delay",void 0),it=ot=e([n("nord-tooltip")],it);var rt=it;export{rt as default};
|
|
2
2
|
//# sourceMappingURL=Tooltip.js.map
|
package/lib/Tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../node_modules/@floating-ui/core/dist/floating-ui.core.esm.js","../node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js","../src/common/attribute.ts","../src/tooltip/Tooltip.ts"],"sourcesContent":["function getBasePlacement(placement) {\n return placement.split('-')[0];\n}\n\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\n\nfunction getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].includes(getBasePlacement(placement)) ? 'x' : 'y';\n}\n\nfunction getLengthFromAxis(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\n\nfunction computeCoordsFromPlacement(_ref) {\n let {\n reference,\n floating,\n placement\n } = _ref;\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n let coords;\n\n switch (getBasePlacement(placement)) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n\n const mainAxis = getMainAxisFromPlacement(placement);\n const length = getLengthFromAxis(mainAxis);\n\n switch (getAlignment(placement)) {\n case 'start':\n coords[mainAxis] = coords[mainAxis] - (reference[length] / 2 - floating[length] / 2);\n break;\n\n case 'end':\n coords[mainAxis] = coords[mainAxis] + (reference[length] / 2 - floating[length] / 2);\n break;\n }\n\n return coords;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a reference element when it is given a certain positioning strategy.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\n\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n\n if (process.env.NODE_ENV !== \"production\") {\n if (platform == null) {\n console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));\n }\n\n if (middleware.filter(_ref => {\n let {\n name\n } = _ref;\n return name === 'autoPlacement' || name === 'flip';\n }).length > 1) {\n throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));\n }\n }\n\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement({ ...rects,\n placement\n });\n let statefulPlacement = placement;\n let middlewareData = {};\n let _debug_loop_count_ = 0;\n\n for (let i = 0; i < middleware.length; i++) {\n if (process.env.NODE_ENV !== \"production\") {\n _debug_loop_count_++;\n\n if (_debug_loop_count_ > 100) {\n throw new Error(['Floating UI: The middleware lifecycle appears to be', 'running in an infinite loop. This is usually caused by a `reset`', 'continually being returned without a break condition.'].join(' '));\n }\n }\n\n const {\n name,\n fn\n } = middleware[i];\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData = { ...middlewareData,\n [name]: data != null ? data : {}\n };\n\n if (reset) {\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n\n ({\n x,\n y\n } = computeCoordsFromPlacement({ ...rects,\n placement: statefulPlacement\n }));\n }\n\n i = -1;\n continue;\n }\n }\n\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\n\nfunction getSideObjectFromPadding(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\n\nfunction rectToClientRect(rect) {\n return { ...rect,\n top: rect.y,\n left: rect.x,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n */\nasync function detectOverflow(middlewareArguments, options) {\n if (options === void 0) {\n options = {};\n }\n\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = middlewareArguments;\n const {\n boundary = 'clippingParents',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = options;\n const paddingObject = getSideObjectFromPadding(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = await platform.getClippingClientRect({\n element: (await platform.isElement(element)) ? element : element.contextElement || (await platform.getDocumentElement({\n element: elements.floating\n })),\n boundary,\n rootBoundary\n });\n const elementClientRect = rectToClientRect(await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n rect: elementContext === 'floating' ? { ...rects.floating,\n x,\n y\n } : rects.reference,\n offsetParent: await platform.getOffsetParent({\n element: elements.floating\n }),\n strategy\n })); // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n return {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n}\n\nconst min = Math.min;\nconst max = Math.max;\n\nfunction within(min$1, value, max$1) {\n return max(min$1, min(value, max$1));\n}\n\n/**\n * Positions an inner element of the floating element such that it is centered\n * to the reference element.\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n\n async fn(middlewareArguments) {\n // Since `element` is required, we don't Partial<> the type\n const {\n element,\n padding = 0\n } = options != null ? options : {};\n const {\n x,\n y,\n placement,\n rects,\n platform\n } = middlewareArguments;\n\n if (element == null) {\n if (process.env.NODE_ENV !== \"production\") {\n console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');\n }\n\n return {};\n }\n\n const paddingObject = getSideObjectFromPadding(padding);\n const coords = {\n x,\n y\n };\n const basePlacement = getBasePlacement(placement);\n const axis = getMainAxisFromPlacement(basePlacement);\n const length = getLengthFromAxis(axis);\n const arrowDimensions = await platform.getDimensions({\n element\n });\n const minProp = axis === 'y' ? 'top' : 'left';\n const maxProp = axis === 'y' ? 'bottom' : 'right';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await platform.getOffsetParent({\n element\n });\n const clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside of the floating element's bounds\n\n const min = paddingObject[minProp];\n const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = within(min, center, max);\n return {\n data: {\n [axis]: offset,\n centerOffset: center - offset\n }\n };\n }\n\n});\n\nconst hash$1 = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nfunction getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);\n}\n\nfunction getAlignmentSides(placement, rects) {\n const isStart = getAlignment(placement) === 'start';\n const mainAxis = getMainAxisFromPlacement(placement);\n const length = getLengthFromAxis(mainAxis);\n let mainAlignmentSide = mainAxis === 'x' ? isStart ? 'right' : 'left' : isStart ? 'bottom' : 'top';\n\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n\n return {\n main: mainAlignmentSide,\n cross: getOppositePlacement(mainAlignmentSide)\n };\n}\n\nconst hash = {\n start: 'end',\n end: 'start'\n};\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.replace(/start|end/g, matched => hash[matched]);\n}\n\nconst basePlacements = ['top', 'right', 'bottom', 'left'];\nconst allPlacements = /*#__PURE__*/basePlacements.reduce((acc, basePlacement) => acc.concat(basePlacement, basePlacement + \"-start\", basePlacement + \"-end\"), []);\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getBasePlacement(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n\n return true;\n });\n}\n\n/**\n * Automatically chooses the `placement` which has the most space available.\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'autoPlacement',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _middlewareData$autoP5, _placementsSortedByLe;\n\n const {\n x,\n y,\n rects,\n middlewareData,\n placement\n } = middlewareArguments;\n const {\n alignment = null,\n allowedPlacements = allPlacements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = options;\n\n if ((_middlewareData$autoP = middlewareData.autoPlacement) != null && _middlewareData$autoP.skip) {\n return {};\n }\n\n const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const currentIndex = (_middlewareData$autoP2 = (_middlewareData$autoP3 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP3.index) != null ? _middlewareData$autoP2 : 0;\n const currentPlacement = placements[currentIndex];\n const {\n main,\n cross\n } = getAlignmentSides(currentPlacement, rects); // Make `computeCoords` start from the right place\n\n if (placement !== currentPlacement) {\n return {\n x,\n y,\n reset: {\n placement: placements[0]\n }\n };\n }\n\n const currentOverflows = [overflow[getBasePlacement(currentPlacement)], overflow[main], overflow[cross]];\n const allOverflows = [...((_middlewareData$autoP4 = (_middlewareData$autoP5 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP5.overflows) != null ? _middlewareData$autoP4 : []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements[currentIndex + 1]; // There are more placements to check\n\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n\n const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);\n const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {\n let {\n overflows\n } = _ref;\n return overflows.every(overflow => overflow <= 0);\n })) == null ? void 0 : _placementsSortedByLe.placement;\n return {\n data: {\n skip: true\n },\n reset: {\n placement: placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement\n }\n };\n }\n\n };\n};\n\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\n\n/**\n * Changes the placement of the floating element to one that will fit if the\n * initially specified `placement` does not.\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'flip',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$flip, _middlewareData$flip2;\n\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement\n } = middlewareArguments;\n\n if ((_middlewareData$flip = middlewareData.flip) != null && _middlewareData$flip.skip) {\n return {};\n }\n\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n flipAlignment = true,\n ...detectOverflowOptions\n } = options;\n const basePlacement = getBasePlacement(placement);\n const isBasePlacement = basePlacement === initialPlacement;\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.overflows) || [];\n\n if (checkMainAxis) {\n overflows.push(overflow[basePlacement]);\n }\n\n if (checkCrossAxis) {\n const {\n main,\n cross\n } = getAlignmentSides(placement, rects);\n overflows.push(overflow[main], overflow[cross]);\n }\n\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }]; // One or more sides is overflowing\n\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip$, _middlewareData$flip3;\n\n const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip3 = middlewareData.flip) == null ? void 0 : _middlewareData$flip3.index) != null ? _middlewareData$flip$ : 0) + 1;\n const nextPlacement = placements[nextIndex];\n\n if (nextPlacement) {\n // Try next placement and re-run the lifecycle\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n\n let resetPlacement = 'bottom';\n\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$slice$;\n\n const placement = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0) - b.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;\n\n if (placement) {\n resetPlacement = placement;\n }\n\n break;\n }\n\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n\n return {\n data: {\n skip: true\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n\n return {};\n }\n\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return basePlacements.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n */\n\n\nconst hide = () => ({\n name: 'hide',\n\n async fn(modifierArguments) {\n const referenceOverflow = await detectOverflow(modifierArguments, {\n elementContext: 'reference'\n });\n const floatingAltOverflow = await detectOverflow(modifierArguments, {\n altBoundary: true\n });\n const referenceHiddenOffsets = getSideOffsets(referenceOverflow, modifierArguments.rects.reference);\n const escapedOffsets = getSideOffsets(floatingAltOverflow, modifierArguments.rects.floating);\n const referenceHidden = isAnySideFullyClipped(referenceHiddenOffsets);\n const escaped = isAnySideFullyClipped(escapedOffsets);\n return {\n data: {\n referenceHidden,\n referenceHiddenOffsets,\n escaped,\n escapedOffsets\n }\n };\n }\n\n});\n\nfunction convertValueToCoords(_ref) {\n let {\n placement,\n rects,\n value\n } = _ref;\n const basePlacement = getBasePlacement(placement);\n const multiplier = ['left', 'top'].includes(basePlacement) ? -1 : 1;\n const rawValue = typeof value === 'function' ? value({ ...rects,\n placement\n }) : value;\n const {\n mainAxis,\n crossAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawValue\n };\n return getMainAxisFromPlacement(basePlacement) === 'x' ? {\n x: crossAxis,\n y: mainAxis * multiplier\n } : {\n x: mainAxis * multiplier,\n y: crossAxis\n };\n}\n/**\n * Displaces the floating element from its reference element.\n */\n\nconst offset = function (value) {\n if (value === void 0) {\n value = 0;\n }\n\n return {\n name: 'offset',\n options: value,\n\n fn(middlewareArguments) {\n const {\n x,\n y,\n placement,\n rects\n } = middlewareArguments;\n const diffCoords = convertValueToCoords({\n placement,\n rects,\n value\n });\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords\n };\n }\n\n };\n};\n\nfunction getCrossAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\n\n/**\n * Shifts the floating element in order to keep it in view when it will overflow\n * a clipping boundary.\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'shift',\n options,\n\n async fn(middlewareArguments) {\n const {\n x,\n y,\n placement\n } = middlewareArguments;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = options;\n const coords = {\n x,\n y\n };\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const mainAxis = getMainAxisFromPlacement(getBasePlacement(placement));\n const crossAxis = getCrossAxis(mainAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n\n if (checkMainAxis) {\n const minSide = mainAxis === 'y' ? 'top' : 'left';\n const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n const min = mainAxisCoord + overflow[minSide];\n const max = mainAxisCoord - overflow[maxSide];\n mainAxisCoord = within(min, mainAxisCoord, max);\n }\n\n if (checkCrossAxis) {\n const minSide = crossAxis === 'y' ? 'top' : 'left';\n const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n const min = crossAxisCoord + overflow[minSide];\n const max = crossAxisCoord - overflow[maxSide];\n crossAxisCoord = within(min, crossAxisCoord, max);\n }\n\n const limitedCoords = limiter.fn({ ...middlewareArguments,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return { ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y\n }\n };\n }\n\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n options,\n\n fn(middlewareArguments) {\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = middlewareArguments;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = options;\n const coords = {\n x,\n y\n };\n const mainAxis = getMainAxisFromPlacement(placement);\n const crossAxis = getCrossAxis(mainAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = typeof offset === 'function' ? offset({ ...rects,\n placement\n }) : offset;\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawOffset\n };\n\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2, _middlewareData$offse3, _middlewareData$offse4;\n\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = ['top', 'left'].includes(getBasePlacement(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? (_middlewareData$offse = (_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) != null ? _middlewareData$offse : 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : (_middlewareData$offse3 = (_middlewareData$offse4 = middlewareData.offset) == null ? void 0 : _middlewareData$offse4[crossAxis]) != null ? _middlewareData$offse3 : 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n\n };\n};\n\n/**\n * Provides data to change the size of the floating element. For instance,\n * prevent it from overflowing its clipping boundary or match the width of the\n * reference element.\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'size',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$size;\n\n const {\n placement,\n rects,\n middlewareData\n } = middlewareArguments;\n const {\n apply,\n ...detectOverflowOptions\n } = options;\n\n if ((_middlewareData$size = middlewareData.size) != null && _middlewareData$size.skip) {\n return {};\n }\n\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const basePlacement = getBasePlacement(placement);\n const isEnd = getAlignment(placement) === 'end';\n let heightSide;\n let widthSide;\n\n if (basePlacement === 'top' || basePlacement === 'bottom') {\n heightSide = basePlacement;\n widthSide = isEnd ? 'left' : 'right';\n } else {\n widthSide = basePlacement;\n heightSide = isEnd ? 'top' : 'bottom';\n }\n\n const xMin = max(overflow.left, 0);\n const xMax = max(overflow.right, 0);\n const yMin = max(overflow.top, 0);\n const yMax = max(overflow.bottom, 0);\n const dimensions = {\n height: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)) : overflow[heightSide]),\n width: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)) : overflow[widthSide])\n };\n apply == null ? void 0 : apply({ ...dimensions,\n ...rects\n });\n return {\n data: {\n skip: true\n },\n reset: {\n rects: true\n }\n };\n }\n\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'inline',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$inlin, _await$platform$getCl;\n\n const {\n placement,\n elements,\n rects,\n platform,\n strategy,\n middlewareData\n } = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n\n const {\n padding = 2,\n x,\n y\n } = options;\n\n if ((_middlewareData$inlin = middlewareData.inline) != null && _middlewareData$inlin.skip) {\n return {};\n }\n\n const fallback = rectToClientRect(await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n rect: rects.reference,\n offsetParent: await platform.getOffsetParent({\n element: elements.floating\n }),\n strategy\n }));\n const clientRects = Array.from((_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects({\n element: elements.reference\n }))) != null ? _await$platform$getCl : []);\n const paddingObject = getSideObjectFromPadding(padding);\n\n function getBoundingClientRect() {\n // There are two rects and they are disjoined\n if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n var _clientRects$find;\n\n // Find the first rect in which the point is fully inside\n return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;\n } // There are 2 or more connected rects\n\n\n if (clientRects.length >= 2) {\n if (getMainAxisFromPlacement(placement) === 'x') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getBasePlacement(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n\n const isLeftPlacement = getBasePlacement(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftPlacement ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n\n return fallback;\n }\n\n return {\n data: {\n skip: true\n },\n reset: {\n rects: await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n })\n }\n };\n }\n\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, rectToClientRect, shift, size };\n","import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core';\nexport { arrow, autoPlacement, detectOverflow, flip, hide, inline, limitShift, offset, shift, size } from '@floating-ui/core';\n\nfunction isWindow(value) {\n return (value == null ? void 0 : value.toString()) === '[object Window]';\n}\nfunction getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (!isWindow(node)) {\n const ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}\n\nfunction getComputedStyle$1(element) {\n return getWindow(element).getComputedStyle(element);\n}\n\nfunction getNodeName(node) {\n return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';\n}\n\nfunction isHTMLElement(value) {\n return value instanceof getWindow(value).HTMLElement;\n}\nfunction isElement(value) {\n return value instanceof getWindow(value).Element;\n}\nfunction isNode(value) {\n return value instanceof getWindow(value).Node;\n}\nfunction isShadowRoot(node) {\n const OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\nfunction isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n const {\n overflow,\n overflowX,\n overflowY\n } = getComputedStyle$1(element);\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}\nfunction isTableElement(element) {\n return ['table', 'td', 'th'].includes(getNodeName(element));\n}\nfunction isContainingBlock(element) {\n // TODO: Try and use feature detection here instead\n const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');\n const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);\n}\n\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\n\nfunction getBoundingClientRect(element, includeScale) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n const clientRect = element.getBoundingClientRect();\n let scaleX = 1;\n let scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n return {\n width: clientRect.width / scaleX,\n height: clientRect.height / scaleY,\n top: clientRect.top / scaleY,\n right: clientRect.right / scaleX,\n bottom: clientRect.bottom / scaleY,\n left: clientRect.left / scaleX,\n x: clientRect.left / scaleX,\n y: clientRect.top / scaleY\n };\n}\n\nfunction getDocumentElement(node) {\n return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;\n}\n\nfunction getNodeScroll(element) {\n if (isWindow(element)) {\n return {\n scrollLeft: element.pageXOffset,\n scrollTop: element.pageYOffset\n };\n }\n\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}\n\nfunction getWindowScrollBarX(element) {\n // If <html> has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;\n}\n\nfunction isScaled(element) {\n const rect = getBoundingClientRect(element);\n return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent));\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {\n if (getNodeName(offsetParent) !== 'body' || isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n const offsetRect = getBoundingClientRect(offsetParent, true);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // @ts-ignore\n node.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n node.parentNode || ( // DOM Element detected\n isShadowRoot(node) ? node.host : null) || // ShadowRoot detected\n getDocumentElement(node) // fallback\n\n );\n}\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n}\n\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n\n while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nfunction getOffsetParent(element) {\n const window = getWindow(element);\n let offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}\n\nfunction getDimensions(element) {\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n\n if (offsetParent === documentElement) {\n return rect;\n }\n\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {\n if (getNodeName(offsetParent) !== 'body' || isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n const offsetRect = getBoundingClientRect(offsetParent, true);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } // This doesn't appear to be need to be negated.\n // else if (documentElement) {\n // offsets.x = getWindowScrollBarX(documentElement);\n // }\n\n }\n\n return { ...rect,\n x: rect.x - scroll.scrollLeft + offsets.x,\n y: rect.y - scroll.scrollTop + offsets.y\n };\n}\n\nfunction getViewportRect(element) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)\n // In Chrome, it returns a value very close to 0 (+/-) but contains rounding\n // errors due to floating point numbers, so we need to check precision.\n // Safari returns a number <= 0, usually < -1 when pinch-zoomed\n\n if (Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 0.01) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable\n\nfunction getDocumentRect(element) {\n var _element$ownerDocumen;\n\n const html = getDocumentElement(element);\n const scroll = getNodeScroll(element);\n const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n const y = -scroll.scrollTop;\n\n if (getComputedStyle$1(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width,\n height,\n x,\n y\n };\n}\n\nfunction getScrollParent(node) {\n if (['html', 'body', '#document'].includes(getNodeName(node))) {\n // @ts-ignore assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}\n\nfunction getScrollParents(node, list) {\n var _node$ownerDocument;\n\n if (list === void 0) {\n list = [];\n }\n\n const scrollParent = getScrollParent(node);\n const isBody = scrollParent === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);\n const win = getWindow(scrollParent);\n const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n const updatedList = list.concat(target);\n return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here\n updatedList.concat(getScrollParents(getParentNode(target)));\n}\n\nfunction contains(parent, child) {\n const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n let next = child;\n\n do {\n // use `===` replace node.isSameNode()\n if (next && parent === next) {\n return true;\n } // @ts-ignore: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n }\n\n return false;\n}\n\nfunction getInnerBoundingClientRect(element) {\n const clientRect = getBoundingClientRect(element);\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n return {\n top,\n left,\n x: left,\n y: top,\n right: left + element.clientWidth,\n bottom: top + element.clientHeight,\n width: element.clientWidth,\n height: element.clientHeight\n };\n}\n\nfunction getClientRectFromClippingParent(element, clippingParent) {\n if (clippingParent === 'viewport') {\n return rectToClientRect(getViewportRect(element));\n }\n\n if (isElement(clippingParent)) {\n return getInnerBoundingClientRect(clippingParent);\n }\n\n return rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n const clippingParents = getScrollParents(getParentNode(element));\n const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);\n const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // @ts-ignore isElement check ensures we return Array<Element>\n\n\n return clippingParents.filter(clippingParent => isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body');\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nfunction getClippingClientRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary\n } = _ref;\n const mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n const clippingParents = [...mainClippingParents, rootBoundary];\n const firstClippingParent = clippingParents[0];\n const clippingRect = clippingParents.reduce((accRect, clippingParent) => {\n const rect = getClientRectFromClippingParent(element, clippingParent);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromClippingParent(element, firstClippingParent));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}\n\nconst platform = {\n getElementRects: _ref => {\n let {\n reference,\n floating,\n strategy\n } = _ref;\n return {\n reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),\n floating: { ...getDimensions(floating),\n x: 0,\n y: 0\n }\n };\n },\n convertOffsetParentRelativeRectToViewportRelativeRect: args => convertOffsetParentRelativeRectToViewportRelativeRect(args),\n getOffsetParent: _ref2 => {\n let {\n element\n } = _ref2;\n return getOffsetParent(element);\n },\n isElement: value => isElement(value),\n getDocumentElement: _ref3 => {\n let {\n element\n } = _ref3;\n return getDocumentElement(element);\n },\n getClippingClientRect: args => getClippingClientRect(args),\n getDimensions: _ref4 => {\n let {\n element\n } = _ref4;\n return getDimensions(element);\n },\n getClientRects: _ref5 => {\n let {\n element\n } = _ref5;\n return element.getClientRects();\n }\n};\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a reference element when it is given a certain CSS positioning\n * strategy.\n */\n\nconst computePosition = (reference, floating, options) => computePosition$1(reference, floating, {\n platform,\n ...options\n});\n\nexport { computePosition, getScrollParents };\n","function getTokens(element: Element, attr: string) {\n const value = element.getAttribute(attr)\n return value ? value.split(/\\s+/) : []\n}\n\nfunction setTokens(element: Element, attr: string, tokens: string[]) {\n element.setAttribute(attr, tokens.join(\" \"))\n}\n\n/**\n * Carefully adds a token to a space-separated attribute\n * Similar to classList, but for any attribute.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add\n */\nexport function add(element: Element, attr: string, token: string) {\n const tokens = getTokens(element, attr)\n\n if (!tokens.includes(token)) {\n setTokens(element, attr, tokens.concat(token))\n }\n}\n\n/**\n * Carefully removes a token from a space-separated attribute.\n * Similar to classList, but for any attribute.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove\n */\nexport function remove(element: Element, attr: string, token: string) {\n const tokens = getTokens(element, attr)\n\n if (tokens.includes(token)) {\n setTokens(\n element,\n attr,\n tokens.filter(t => t !== token)\n )\n }\n}\n","import { LitElement, html, PropertyValues } from \"lit\"\nimport { customElement, property, state } from \"lit/decorators.js\"\nimport { computePosition, flip, shift, offset } from \"@floating-ui/dom\"\nimport type { Ref } from \"lit/directives/ref.js\"\n\nimport * as attr from \"../common/attribute.js\"\nimport { DraftComponentMixin } from \"../common/mixins/DraftComponentMixin.js\"\nimport { SlotController } from \"../common/controllers/SlotController.js\"\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./Tooltip.css\"\n\ntype FocusableElement = HTMLElement & { focusableRef?: Ref<Element> }\n\n/**\n * Tooltips are floating containers for displaying additional information\n * for the currently focused element. A tooltip can be useful when you want\n * to e.g. give a hint about an existing Command Menu shortcut.\n *\n * @status draft\n * @category overlay\n * @slot - The tooltip content\n * @slot shortcut - Optional slot that holds shortcut keys to access the subject\n */\n@customElement(\"nord-tooltip\")\nexport default class Tooltip extends DraftComponentMixin(LitElement) {\n static styles = [componentStyle, style]\n\n // tracks the last tooltip opened, so we can enforce only one is ever open at a time\n static lastOpened?: Tooltip\n\n private shortcutSlot = new SlotController(this, \"shortcut\")\n private targetElement!: FocusableElement\n\n /**\n * the proxy element is for cases where the targetElement is a web component,\n * and the WC has a focusable child in its shadow root e.g. a button component.\n * in this case, when the tooltip is shown, we inject the proxy into targetElement's shadow root\n * and wire up aria-describedby from the focusable element to the proxy.\n * when the tooltip is hidden, we remove the proxy and remove the aria-describedby relationship.\n */\n private proxy = document.createElement(\"span\")\n\n /**\n * Determines whether the tooltip is visible or not.\n */\n @state() visible: boolean = false\n\n /**\n * Control the position of the tooltip component.\n * When set to \"none\", the tooltip will be shown above\n * but accommodate for browser boundaries.\n */\n @property({ reflect: true }) position?: \"bottom\" | \"top\" | \"left\" | \"right\" = \"top\"\n\n /**\n * The tooltip role, set on the component by default.\n */\n @property({ reflect: true }) role = \"tooltip\"\n\n /**\n * The id for the active element to reference via aria-describedby.\n */\n @property({ reflect: true }) id: string = \"\"\n\n /**\n * The delay in milliseconds before the tooltip is opened.\n */\n @property({ reflect: true, type: Number }) delay: number = 300\n\n /**\n * Setting and updating the position of the tooltip\n */\n private updatePosition = () =>\n computePosition(this.targetElement, this, {\n placement: this.position,\n middleware: [\n shift({\n padding: 8,\n }),\n offset(8),\n flip(),\n ],\n }).then(({ x, y }) => {\n this.style.insetInlineStart = `${x}px`\n this.style.insetBlockStart = `${y}px`\n })\n\n private handleScroll = () => {\n if (this.visible) this.updatePosition()\n }\n\n /**\n * Show and hide the tooltip using inline styles\n */\n private showTooltip = () => {\n if (this.visible) {\n return\n }\n\n Tooltip.lastOpened?.hideTooltip()\n Tooltip.lastOpened = this\n\n this.updatePosition().then(() => {\n this.visible = true\n })\n }\n\n private hideTooltip = () => {\n this.visible = false\n }\n\n /**\n * Apply all event listeners\n */\n connectedCallback() {\n super.connectedCallback()\n\n const rootNode = this.getRootNode() as Document | ShadowRoot\n const selector = `[aria-describedby='${this.id}']`\n const target = rootNode.querySelector<FocusableElement>(selector)\n\n if (!target) {\n // eslint-disable-next-line no-console\n console.warn(\"NORD: tooltip found no element matching selector:\", selector)\n return\n }\n\n this.targetElement = target\n\n target.addEventListener(\"keydown\", this.hideOnEscape)\n target.addEventListener(\"mouseenter\", this.showTooltip)\n target.addEventListener(\"mouseleave\", this.hideTooltip)\n target.addEventListener(\"focus\", this.showTooltip)\n target.addEventListener(\"blur\", this.hideTooltip)\n\n window.addEventListener(\"resize\", this.updatePosition, { passive: true })\n window.addEventListener(\"scroll\", this.handleScroll, { passive: true })\n }\n\n /**\n * Remove all the event listeners\n */\n disconnectedCallback() {\n super.disconnectedCallback()\n\n if (!this.targetElement) {\n return\n }\n\n this.targetElement.removeEventListener(\"keydown\", this.hideOnEscape)\n this.targetElement.removeEventListener(\"mouseenter\", this.showTooltip)\n this.targetElement.removeEventListener(\"mouseleave\", this.hideTooltip)\n this.targetElement.removeEventListener(\"focus\", this.showTooltip)\n this.targetElement.removeEventListener(\"blur\", this.hideTooltip)\n window.removeEventListener(\"resize\", this.updatePosition)\n window.removeEventListener(\"scroll\", this.handleScroll)\n }\n\n /**\n * Check if the tooltip has an id, warn them if not\n */\n willUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"id\") && !this.id) {\n // eslint-disable-next-line no-console\n console.warn(\"NORD: The tooltip requires an id attribute and value\")\n }\n\n if (changedProperties.has(\"visible\")) {\n if (this.visible) {\n this.addDescribedBy()\n\n this.style.transitionDelay = `${this.delay}ms`\n this.style.visibility = \"visible\"\n this.style.opacity = \"1\"\n } else {\n this.removeDescribedBy()\n\n this.style.transitionDelay = `0ms`\n this.style.visibility = \"hidden\"\n this.style.opacity = \"0\"\n }\n }\n }\n\n render() {\n return html`\n <div class=\"n-tooltip\">\n <slot></slot>\n <div class=\"n-tooltip-shortcut\" ?hidden=${this.shortcutSlot.isEmpty}>\n <slot class=\"n-tooltip-key\" name=\"shortcut\"></slot>\n </div>\n </div>\n `\n }\n\n private hideOnEscape = (e: KeyboardEvent) => {\n if (this.visible && e.key === \"Escape\") {\n this.hideTooltip()\n }\n }\n\n private addDescribedBy = () => {\n const focusable = this.targetElement?.focusableRef?.value\n\n if (focusable) {\n this.proxy.hidden = true\n this.proxy.id = this.id\n this.proxy.textContent = this.textContent\n\n focusable.insertAdjacentElement(\"afterend\", this.proxy)\n attr.add(focusable, \"aria-describedby\", this.id)\n }\n }\n\n private removeDescribedBy = () => {\n const focusable = this.targetElement?.focusableRef?.value\n\n if (focusable) {\n this.proxy.remove()\n attr.remove(focusable, \"aria-describedby\", this.id)\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-tooltip\": Tooltip\n }\n}\n"],"names":["getBasePlacement","placement","split","getAlignment","getMainAxisFromPlacement","includes","getLengthFromAxis","axis","computeCoordsFromPlacement","_ref","reference","floating","commonX","x","width","commonY","y","height","coords","mainAxis","length","rectToClientRect","rect","top","left","right","bottom","async","detectOverflow","middlewareArguments","options","platform","rects","elements","strategy","boundary","rootBoundary","elementContext","altBoundary","padding","paddingObject","expandPaddingObject","getSideObjectFromPadding","element","clippingClientRect","getClippingClientRect","isElement","contextElement","getDocumentElement","elementClientRect","convertOffsetParentRelativeRectToViewportRelativeRect","offsetParent","getOffsetParent","min","Math","max","within","min$1","value","max$1","hash$1","getOppositePlacement","replace","matched","hash","start","end","getOppositeAlignmentPlacement","flip","name","_middlewareData$flip","_middlewareData$flip2","middlewareData","initialPlacement","skip","checkMainAxis","crossAxis","checkCrossAxis","fallbackPlacements","specifiedFallbackPlacements","fallbackStrategy","flipAlignment","detectOverflowOptions","basePlacement","oppositePlacement","getExpandedPlacements","placements","overflow","overflows","overflowsData","push","main","cross","isStart","mainAlignmentSide","getAlignmentSides","every","side","_middlewareData$flip$","_middlewareData$flip3","nextIndex","index","nextPlacement","data","reset","resetPlacement","_overflowsData$slice$","slice","sort","a","b","filter","reduce","acc","offset","fn","diffCoords","multiplier","rawValue","convertValueToCoords","isWindow","toString","getWindow","node","window","ownerDocument","defaultView","getComputedStyle$1","getComputedStyle","getNodeName","nodeName","toLowerCase","isHTMLElement","HTMLElement","Element","isShadowRoot","ShadowRoot","isScrollParent","overflowX","overflowY","test","isTableElement","isContainingBlock","isFirefox","navigator","userAgent","css","transform","perspective","contain","willChange","round","getBoundingClientRect","includeScale","clientRect","scaleX","scaleY","offsetWidth","offsetHeight","Node","document","documentElement","getNodeScroll","scrollLeft","pageXOffset","scrollTop","pageYOffset","getWindowScrollBarX","getRectRelativeToOffsetParent","isOffsetParentAnElement","isScaled","scroll","offsets","offsetRect","clientLeft","clientTop","getParentNode","assignedSlot","parentNode","host","getTrueOffsetParent","position","currentNode","getContainingBlock","getDimensions","getScrollParent","body","getScrollParents","list","_node$ownerDocument","scrollParent","isBody","win","target","concat","visualViewport","updatedList","getClientRectFromClippingParent","clippingParent","html","clientWidth","clientHeight","abs","innerWidth","scale","offsetLeft","offsetTop","getViewportRect","getInnerBoundingClientRect","_element$ownerDocumen","scrollWidth","scrollHeight","direction","getDocumentRect","getClippingParents","clippingParents","clipperElement","parent","child","rootNode","getRootNode","contains","next","getElementRects","args","_ref2","_ref3","firstClippingParent","clippingRect","accRect","_ref4","getClientRects","_ref5","computePosition","config","middleware","statefulPlacement","i","nextX","nextY","computePosition$1","getTokens","attr","getAttribute","setTokens","tokens","setAttribute","join","Tooltip","DraftComponentMixin","LitElement","constructor","this","SlotController","createElement","targetElement","limiter","mainAxisCoord","crossAxisCoord","maxSide","limitedCoords","then","style","insetInlineStart","insetBlockStart","visible","updatePosition","Tooltip_1","lastOpened","hideTooltip","e","key","focusable","focusableRef","proxy","hidden","id","textContent","insertAdjacentElement","token","attr.add","remove","t","attr.remove","connectedCallback","super","selector","querySelector","addEventListener","hideOnEscape","showTooltip","passive","handleScroll","console","warn","disconnectedCallback","removeEventListener","willUpdate","changedProperties","has","addDescribedBy","transitionDelay","delay","visibility","opacity","removeDescribedBy","render","shortcutSlot","isEmpty","componentStyle","__decorate","state","property","reflect","type","Number","customElement"],"mappings":"2SAAA,SAASA,EAAiBC,GACxB,OAAOA,EAAUC,MAAM,KAAK,GAG9B,SAASC,EAAaF,GACpB,OAAOA,EAAUC,MAAM,KAAK,GAG9B,SAASE,EAAyBH,GAChC,MAAO,CAAC,MAAO,UAAUI,SAASL,EAAiBC,IAAc,IAAM,IAGzE,SAASK,EAAkBC,GACzB,MAAgB,MAATA,EAAe,SAAW,QAGnC,SAASC,EAA2BC,GAClC,IAAIC,UACFA,EAASC,SACTA,EAAQV,UACRA,GACEQ,EACJ,MAAMG,EAAUF,EAAUG,EAAIH,EAAUI,MAAQ,EAAIH,EAASG,MAAQ,EAC/DC,EAAUL,EAAUM,EAAIN,EAAUO,OAAS,EAAIN,EAASM,OAAS,EACvE,IAAIC,EAEJ,OAAQlB,EAAiBC,IACvB,IAAK,MACHiB,EAAS,CACPL,EAAGD,EACHI,EAAGN,EAAUM,EAAIL,EAASM,QAE5B,MAEF,IAAK,SACHC,EAAS,CACPL,EAAGD,EACHI,EAAGN,EAAUM,EAAIN,EAAUO,QAE7B,MAEF,IAAK,QACHC,EAAS,CACPL,EAAGH,EAAUG,EAAIH,EAAUI,MAC3BE,EAAGD,GAEL,MAEF,IAAK,OACHG,EAAS,CACPL,EAAGH,EAAUG,EAAIF,EAASG,MAC1BE,EAAGD,GAEL,MAEF,QACEG,EAAS,CACPL,EAAGH,EAAUG,EACbG,EAAGN,EAAUM,GAInB,MAAMG,EAAWf,EAAyBH,GACpCmB,EAASd,EAAkBa,GAEj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,SACxBnD,KAAKU,MAAM0C,QAAU,MAK3BE,SACE,OAAO3G,CAAI,gFAGmCqD,KAAKuD,aAAaC,6EAnK3D5D,UAAS,CAAC6D,EAAgB/C,IAoBxBgD,GAARC,oCAO4BD,GAA5BE,EAAS,CAAEC,SAAS,qCAKQH,GAA5BE,EAAS,CAAEC,SAAS,iCAKQH,GAA5BE,EAAS,CAAEC,SAAS,+BAKsBH,GAA1CE,EAAS,CAAEC,SAAS,EAAMC,KAAMC,uCA3CdnE,SADpBoE,EAAc,iBACMpE,WAAAA"}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../node_modules/@floating-ui/core/dist/floating-ui.core.esm.js","../node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js","../src/common/attribute.ts","../src/tooltip/Tooltip.ts"],"sourcesContent":["function getBasePlacement(placement) {\n return placement.split('-')[0];\n}\n\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\n\nfunction getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].includes(getBasePlacement(placement)) ? 'x' : 'y';\n}\n\nfunction getLengthFromAxis(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\n\nfunction computeCoordsFromPlacement(_ref) {\n let {\n reference,\n floating,\n placement\n } = _ref;\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n let coords;\n\n switch (getBasePlacement(placement)) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n\n const mainAxis = getMainAxisFromPlacement(placement);\n const length = getLengthFromAxis(mainAxis);\n\n switch (getAlignment(placement)) {\n case 'start':\n coords[mainAxis] = coords[mainAxis] - (reference[length] / 2 - floating[length] / 2);\n break;\n\n case 'end':\n coords[mainAxis] = coords[mainAxis] + (reference[length] / 2 - floating[length] / 2);\n break;\n }\n\n return coords;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a reference element when it is given a certain positioning strategy.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\n\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n\n if (process.env.NODE_ENV !== \"production\") {\n if (platform == null) {\n console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));\n }\n\n if (middleware.filter(_ref => {\n let {\n name\n } = _ref;\n return name === 'autoPlacement' || name === 'flip';\n }).length > 1) {\n throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));\n }\n }\n\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement({ ...rects,\n placement\n });\n let statefulPlacement = placement;\n let middlewareData = {};\n let _debug_loop_count_ = 0;\n\n for (let i = 0; i < middleware.length; i++) {\n if (process.env.NODE_ENV !== \"production\") {\n _debug_loop_count_++;\n\n if (_debug_loop_count_ > 100) {\n throw new Error(['Floating UI: The middleware lifecycle appears to be', 'running in an infinite loop. This is usually caused by a `reset`', 'continually being returned without a break condition.'].join(' '));\n }\n }\n\n const {\n name,\n fn\n } = middleware[i];\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData = { ...middlewareData,\n [name]: data != null ? data : {}\n };\n\n if (reset) {\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n\n ({\n x,\n y\n } = computeCoordsFromPlacement({ ...rects,\n placement: statefulPlacement\n }));\n }\n\n i = -1;\n continue;\n }\n }\n\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\n\nfunction getSideObjectFromPadding(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\n\nfunction rectToClientRect(rect) {\n return { ...rect,\n top: rect.y,\n left: rect.x,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n */\nasync function detectOverflow(middlewareArguments, options) {\n if (options === void 0) {\n options = {};\n }\n\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = middlewareArguments;\n const {\n boundary = 'clippingParents',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = options;\n const paddingObject = getSideObjectFromPadding(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = await platform.getClippingClientRect({\n element: (await platform.isElement(element)) ? element : element.contextElement || (await platform.getDocumentElement({\n element: elements.floating\n })),\n boundary,\n rootBoundary\n });\n const elementClientRect = rectToClientRect(await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n rect: elementContext === 'floating' ? { ...rects.floating,\n x,\n y\n } : rects.reference,\n offsetParent: await platform.getOffsetParent({\n element: elements.floating\n }),\n strategy\n })); // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n return {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n}\n\nconst min = Math.min;\nconst max = Math.max;\n\nfunction within(min$1, value, max$1) {\n return max(min$1, min(value, max$1));\n}\n\n/**\n * Positions an inner element of the floating element such that it is centered\n * to the reference element.\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n\n async fn(middlewareArguments) {\n // Since `element` is required, we don't Partial<> the type\n const {\n element,\n padding = 0\n } = options != null ? options : {};\n const {\n x,\n y,\n placement,\n rects,\n platform\n } = middlewareArguments;\n\n if (element == null) {\n if (process.env.NODE_ENV !== \"production\") {\n console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');\n }\n\n return {};\n }\n\n const paddingObject = getSideObjectFromPadding(padding);\n const coords = {\n x,\n y\n };\n const basePlacement = getBasePlacement(placement);\n const axis = getMainAxisFromPlacement(basePlacement);\n const length = getLengthFromAxis(axis);\n const arrowDimensions = await platform.getDimensions({\n element\n });\n const minProp = axis === 'y' ? 'top' : 'left';\n const maxProp = axis === 'y' ? 'bottom' : 'right';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await platform.getOffsetParent({\n element\n });\n const clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside of the floating element's bounds\n\n const min = paddingObject[minProp];\n const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = within(min, center, max);\n return {\n data: {\n [axis]: offset,\n centerOffset: center - offset\n }\n };\n }\n\n});\n\nconst hash$1 = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nfunction getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);\n}\n\nfunction getAlignmentSides(placement, rects) {\n const isStart = getAlignment(placement) === 'start';\n const mainAxis = getMainAxisFromPlacement(placement);\n const length = getLengthFromAxis(mainAxis);\n let mainAlignmentSide = mainAxis === 'x' ? isStart ? 'right' : 'left' : isStart ? 'bottom' : 'top';\n\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n\n return {\n main: mainAlignmentSide,\n cross: getOppositePlacement(mainAlignmentSide)\n };\n}\n\nconst hash = {\n start: 'end',\n end: 'start'\n};\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.replace(/start|end/g, matched => hash[matched]);\n}\n\nconst basePlacements = ['top', 'right', 'bottom', 'left'];\nconst allPlacements = /*#__PURE__*/basePlacements.reduce((acc, basePlacement) => acc.concat(basePlacement, basePlacement + \"-start\", basePlacement + \"-end\"), []);\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getBasePlacement(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n\n return true;\n });\n}\n\n/**\n * Automatically chooses the `placement` which has the most space available.\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'autoPlacement',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _middlewareData$autoP5, _placementsSortedByLe;\n\n const {\n x,\n y,\n rects,\n middlewareData,\n placement\n } = middlewareArguments;\n const {\n alignment = null,\n allowedPlacements = allPlacements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = options;\n\n if ((_middlewareData$autoP = middlewareData.autoPlacement) != null && _middlewareData$autoP.skip) {\n return {};\n }\n\n const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const currentIndex = (_middlewareData$autoP2 = (_middlewareData$autoP3 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP3.index) != null ? _middlewareData$autoP2 : 0;\n const currentPlacement = placements[currentIndex];\n const {\n main,\n cross\n } = getAlignmentSides(currentPlacement, rects); // Make `computeCoords` start from the right place\n\n if (placement !== currentPlacement) {\n return {\n x,\n y,\n reset: {\n placement: placements[0]\n }\n };\n }\n\n const currentOverflows = [overflow[getBasePlacement(currentPlacement)], overflow[main], overflow[cross]];\n const allOverflows = [...((_middlewareData$autoP4 = (_middlewareData$autoP5 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP5.overflows) != null ? _middlewareData$autoP4 : []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements[currentIndex + 1]; // There are more placements to check\n\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n\n const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);\n const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {\n let {\n overflows\n } = _ref;\n return overflows.every(overflow => overflow <= 0);\n })) == null ? void 0 : _placementsSortedByLe.placement;\n return {\n data: {\n skip: true\n },\n reset: {\n placement: placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement\n }\n };\n }\n\n };\n};\n\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\n\n/**\n * Changes the placement of the floating element to one that will fit if the\n * initially specified `placement` does not.\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'flip',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$flip, _middlewareData$flip2;\n\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement\n } = middlewareArguments;\n\n if ((_middlewareData$flip = middlewareData.flip) != null && _middlewareData$flip.skip) {\n return {};\n }\n\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n flipAlignment = true,\n ...detectOverflowOptions\n } = options;\n const basePlacement = getBasePlacement(placement);\n const isBasePlacement = basePlacement === initialPlacement;\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.overflows) || [];\n\n if (checkMainAxis) {\n overflows.push(overflow[basePlacement]);\n }\n\n if (checkCrossAxis) {\n const {\n main,\n cross\n } = getAlignmentSides(placement, rects);\n overflows.push(overflow[main], overflow[cross]);\n }\n\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }]; // One or more sides is overflowing\n\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip$, _middlewareData$flip3;\n\n const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip3 = middlewareData.flip) == null ? void 0 : _middlewareData$flip3.index) != null ? _middlewareData$flip$ : 0) + 1;\n const nextPlacement = placements[nextIndex];\n\n if (nextPlacement) {\n // Try next placement and re-run the lifecycle\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n\n let resetPlacement = 'bottom';\n\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$slice$;\n\n const placement = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0) - b.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;\n\n if (placement) {\n resetPlacement = placement;\n }\n\n break;\n }\n\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n\n return {\n data: {\n skip: true\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n\n return {};\n }\n\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return basePlacements.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n */\n\n\nconst hide = () => ({\n name: 'hide',\n\n async fn(modifierArguments) {\n const referenceOverflow = await detectOverflow(modifierArguments, {\n elementContext: 'reference'\n });\n const floatingAltOverflow = await detectOverflow(modifierArguments, {\n altBoundary: true\n });\n const referenceHiddenOffsets = getSideOffsets(referenceOverflow, modifierArguments.rects.reference);\n const escapedOffsets = getSideOffsets(floatingAltOverflow, modifierArguments.rects.floating);\n const referenceHidden = isAnySideFullyClipped(referenceHiddenOffsets);\n const escaped = isAnySideFullyClipped(escapedOffsets);\n return {\n data: {\n referenceHidden,\n referenceHiddenOffsets,\n escaped,\n escapedOffsets\n }\n };\n }\n\n});\n\nfunction convertValueToCoords(_ref) {\n let {\n placement,\n rects,\n value\n } = _ref;\n const basePlacement = getBasePlacement(placement);\n const multiplier = ['left', 'top'].includes(basePlacement) ? -1 : 1;\n const rawValue = typeof value === 'function' ? value({ ...rects,\n placement\n }) : value;\n const {\n mainAxis,\n crossAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawValue\n };\n return getMainAxisFromPlacement(basePlacement) === 'x' ? {\n x: crossAxis,\n y: mainAxis * multiplier\n } : {\n x: mainAxis * multiplier,\n y: crossAxis\n };\n}\n/**\n * Displaces the floating element from its reference element.\n */\n\nconst offset = function (value) {\n if (value === void 0) {\n value = 0;\n }\n\n return {\n name: 'offset',\n options: value,\n\n fn(middlewareArguments) {\n const {\n x,\n y,\n placement,\n rects\n } = middlewareArguments;\n const diffCoords = convertValueToCoords({\n placement,\n rects,\n value\n });\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords\n };\n }\n\n };\n};\n\nfunction getCrossAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\n\n/**\n * Shifts the floating element in order to keep it in view when it will overflow\n * a clipping boundary.\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'shift',\n options,\n\n async fn(middlewareArguments) {\n const {\n x,\n y,\n placement\n } = middlewareArguments;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = options;\n const coords = {\n x,\n y\n };\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const mainAxis = getMainAxisFromPlacement(getBasePlacement(placement));\n const crossAxis = getCrossAxis(mainAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n\n if (checkMainAxis) {\n const minSide = mainAxis === 'y' ? 'top' : 'left';\n const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n const min = mainAxisCoord + overflow[minSide];\n const max = mainAxisCoord - overflow[maxSide];\n mainAxisCoord = within(min, mainAxisCoord, max);\n }\n\n if (checkCrossAxis) {\n const minSide = crossAxis === 'y' ? 'top' : 'left';\n const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n const min = crossAxisCoord + overflow[minSide];\n const max = crossAxisCoord - overflow[maxSide];\n crossAxisCoord = within(min, crossAxisCoord, max);\n }\n\n const limitedCoords = limiter.fn({ ...middlewareArguments,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return { ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y\n }\n };\n }\n\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n options,\n\n fn(middlewareArguments) {\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = middlewareArguments;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = options;\n const coords = {\n x,\n y\n };\n const mainAxis = getMainAxisFromPlacement(placement);\n const crossAxis = getCrossAxis(mainAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = typeof offset === 'function' ? offset({ ...rects,\n placement\n }) : offset;\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawOffset\n };\n\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2, _middlewareData$offse3, _middlewareData$offse4;\n\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = ['top', 'left'].includes(getBasePlacement(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? (_middlewareData$offse = (_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) != null ? _middlewareData$offse : 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : (_middlewareData$offse3 = (_middlewareData$offse4 = middlewareData.offset) == null ? void 0 : _middlewareData$offse4[crossAxis]) != null ? _middlewareData$offse3 : 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n\n };\n};\n\n/**\n * Provides data to change the size of the floating element. For instance,\n * prevent it from overflowing its clipping boundary or match the width of the\n * reference element.\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'size',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$size;\n\n const {\n placement,\n rects,\n middlewareData\n } = middlewareArguments;\n const {\n apply,\n ...detectOverflowOptions\n } = options;\n\n if ((_middlewareData$size = middlewareData.size) != null && _middlewareData$size.skip) {\n return {};\n }\n\n const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);\n const basePlacement = getBasePlacement(placement);\n const isEnd = getAlignment(placement) === 'end';\n let heightSide;\n let widthSide;\n\n if (basePlacement === 'top' || basePlacement === 'bottom') {\n heightSide = basePlacement;\n widthSide = isEnd ? 'left' : 'right';\n } else {\n widthSide = basePlacement;\n heightSide = isEnd ? 'top' : 'bottom';\n }\n\n const xMin = max(overflow.left, 0);\n const xMax = max(overflow.right, 0);\n const yMin = max(overflow.top, 0);\n const yMax = max(overflow.bottom, 0);\n const dimensions = {\n height: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)) : overflow[heightSide]),\n width: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)) : overflow[widthSide])\n };\n apply == null ? void 0 : apply({ ...dimensions,\n ...rects\n });\n return {\n data: {\n skip: true\n },\n reset: {\n rects: true\n }\n };\n }\n\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n return {\n name: 'inline',\n options,\n\n async fn(middlewareArguments) {\n var _middlewareData$inlin, _await$platform$getCl;\n\n const {\n placement,\n elements,\n rects,\n platform,\n strategy,\n middlewareData\n } = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n\n const {\n padding = 2,\n x,\n y\n } = options;\n\n if ((_middlewareData$inlin = middlewareData.inline) != null && _middlewareData$inlin.skip) {\n return {};\n }\n\n const fallback = rectToClientRect(await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n rect: rects.reference,\n offsetParent: await platform.getOffsetParent({\n element: elements.floating\n }),\n strategy\n }));\n const clientRects = Array.from((_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects({\n element: elements.reference\n }))) != null ? _await$platform$getCl : []);\n const paddingObject = getSideObjectFromPadding(padding);\n\n function getBoundingClientRect() {\n // There are two rects and they are disjoined\n if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n var _clientRects$find;\n\n // Find the first rect in which the point is fully inside\n return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;\n } // There are 2 or more connected rects\n\n\n if (clientRects.length >= 2) {\n if (getMainAxisFromPlacement(placement) === 'x') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getBasePlacement(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n\n const isLeftPlacement = getBasePlacement(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftPlacement ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n\n return fallback;\n }\n\n return {\n data: {\n skip: true\n },\n reset: {\n rects: await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n })\n }\n };\n }\n\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, rectToClientRect, shift, size };\n","import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core';\nexport { arrow, autoPlacement, detectOverflow, flip, hide, inline, limitShift, offset, shift, size } from '@floating-ui/core';\n\nfunction isWindow(value) {\n return (value == null ? void 0 : value.toString()) === '[object Window]';\n}\nfunction getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (!isWindow(node)) {\n const ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}\n\nfunction getComputedStyle$1(element) {\n return getWindow(element).getComputedStyle(element);\n}\n\nfunction getNodeName(node) {\n return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';\n}\n\nfunction isHTMLElement(value) {\n return value instanceof getWindow(value).HTMLElement;\n}\nfunction isElement(value) {\n return value instanceof getWindow(value).Element;\n}\nfunction isNode(value) {\n return value instanceof getWindow(value).Node;\n}\nfunction isShadowRoot(node) {\n const OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\nfunction isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n const {\n overflow,\n overflowX,\n overflowY\n } = getComputedStyle$1(element);\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}\nfunction isTableElement(element) {\n return ['table', 'td', 'th'].includes(getNodeName(element));\n}\nfunction isContainingBlock(element) {\n // TODO: Try and use feature detection here instead\n const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');\n const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);\n}\n\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\n\nfunction getBoundingClientRect(element, includeScale) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n const clientRect = element.getBoundingClientRect();\n let scaleX = 1;\n let scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n return {\n width: clientRect.width / scaleX,\n height: clientRect.height / scaleY,\n top: clientRect.top / scaleY,\n right: clientRect.right / scaleX,\n bottom: clientRect.bottom / scaleY,\n left: clientRect.left / scaleX,\n x: clientRect.left / scaleX,\n y: clientRect.top / scaleY\n };\n}\n\nfunction getDocumentElement(node) {\n return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;\n}\n\nfunction getNodeScroll(element) {\n if (isWindow(element)) {\n return {\n scrollLeft: element.pageXOffset,\n scrollTop: element.pageYOffset\n };\n }\n\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}\n\nfunction getWindowScrollBarX(element) {\n // If <html> has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;\n}\n\nfunction isScaled(element) {\n const rect = getBoundingClientRect(element);\n return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent));\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {\n if (getNodeName(offsetParent) !== 'body' || isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n const offsetRect = getBoundingClientRect(offsetParent, true);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // @ts-ignore\n node.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n node.parentNode || ( // DOM Element detected\n isShadowRoot(node) ? node.host : null) || // ShadowRoot detected\n getDocumentElement(node) // fallback\n\n );\n}\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n}\n\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n\n while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nfunction getOffsetParent(element) {\n const window = getWindow(element);\n let offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}\n\nfunction getDimensions(element) {\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n\n if (offsetParent === documentElement) {\n return rect;\n }\n\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {\n if (getNodeName(offsetParent) !== 'body' || isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n const offsetRect = getBoundingClientRect(offsetParent, true);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } // This doesn't appear to be need to be negated.\n // else if (documentElement) {\n // offsets.x = getWindowScrollBarX(documentElement);\n // }\n\n }\n\n return { ...rect,\n x: rect.x - scroll.scrollLeft + offsets.x,\n y: rect.y - scroll.scrollTop + offsets.y\n };\n}\n\nfunction getViewportRect(element) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)\n // In Chrome, it returns a value very close to 0 (+/-) but contains rounding\n // errors due to floating point numbers, so we need to check precision.\n // Safari returns a number <= 0, usually < -1 when pinch-zoomed\n\n if (Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 0.01) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable\n\nfunction getDocumentRect(element) {\n var _element$ownerDocumen;\n\n const html = getDocumentElement(element);\n const scroll = getNodeScroll(element);\n const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n const y = -scroll.scrollTop;\n\n if (getComputedStyle$1(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width,\n height,\n x,\n y\n };\n}\n\nfunction getScrollParent(node) {\n if (['html', 'body', '#document'].includes(getNodeName(node))) {\n // @ts-ignore assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}\n\nfunction getScrollParents(node, list) {\n var _node$ownerDocument;\n\n if (list === void 0) {\n list = [];\n }\n\n const scrollParent = getScrollParent(node);\n const isBody = scrollParent === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);\n const win = getWindow(scrollParent);\n const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n const updatedList = list.concat(target);\n return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here\n updatedList.concat(getScrollParents(getParentNode(target)));\n}\n\nfunction contains(parent, child) {\n const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n let next = child;\n\n do {\n // use `===` replace node.isSameNode()\n if (next && parent === next) {\n return true;\n } // @ts-ignore: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n }\n\n return false;\n}\n\nfunction getInnerBoundingClientRect(element) {\n const clientRect = getBoundingClientRect(element);\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n return {\n top,\n left,\n x: left,\n y: top,\n right: left + element.clientWidth,\n bottom: top + element.clientHeight,\n width: element.clientWidth,\n height: element.clientHeight\n };\n}\n\nfunction getClientRectFromClippingParent(element, clippingParent) {\n if (clippingParent === 'viewport') {\n return rectToClientRect(getViewportRect(element));\n }\n\n if (isElement(clippingParent)) {\n return getInnerBoundingClientRect(clippingParent);\n }\n\n return rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n const clippingParents = getScrollParents(getParentNode(element));\n const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);\n const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // @ts-ignore isElement check ensures we return Array<Element>\n\n\n return clippingParents.filter(clippingParent => isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body');\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nfunction getClippingClientRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary\n } = _ref;\n const mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n const clippingParents = [...mainClippingParents, rootBoundary];\n const firstClippingParent = clippingParents[0];\n const clippingRect = clippingParents.reduce((accRect, clippingParent) => {\n const rect = getClientRectFromClippingParent(element, clippingParent);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromClippingParent(element, firstClippingParent));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}\n\nconst platform = {\n getElementRects: _ref => {\n let {\n reference,\n floating,\n strategy\n } = _ref;\n return {\n reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),\n floating: { ...getDimensions(floating),\n x: 0,\n y: 0\n }\n };\n },\n convertOffsetParentRelativeRectToViewportRelativeRect: args => convertOffsetParentRelativeRectToViewportRelativeRect(args),\n getOffsetParent: _ref2 => {\n let {\n element\n } = _ref2;\n return getOffsetParent(element);\n },\n isElement: value => isElement(value),\n getDocumentElement: _ref3 => {\n let {\n element\n } = _ref3;\n return getDocumentElement(element);\n },\n getClippingClientRect: args => getClippingClientRect(args),\n getDimensions: _ref4 => {\n let {\n element\n } = _ref4;\n return getDimensions(element);\n },\n getClientRects: _ref5 => {\n let {\n element\n } = _ref5;\n return element.getClientRects();\n }\n};\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a reference element when it is given a certain CSS positioning\n * strategy.\n */\n\nconst computePosition = (reference, floating, options) => computePosition$1(reference, floating, {\n platform,\n ...options\n});\n\nexport { computePosition, getScrollParents };\n","function getTokens(element: Element, attr: string) {\n const value = element.getAttribute(attr)\n return value ? value.split(/\\s+/) : []\n}\n\nfunction setTokens(element: Element, attr: string, tokens: string[]) {\n element.setAttribute(attr, tokens.join(\" \"))\n}\n\n/**\n * Carefully adds a token to a space-separated attribute\n * Similar to classList, but for any attribute.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add\n */\nexport function add(element: Element, attr: string, token: string) {\n const tokens = getTokens(element, attr)\n\n if (!tokens.includes(token)) {\n setTokens(element, attr, tokens.concat(token))\n }\n}\n\n/**\n * Carefully removes a token from a space-separated attribute.\n * Similar to classList, but for any attribute.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove\n */\nexport function remove(element: Element, attr: string, token: string) {\n const tokens = getTokens(element, attr)\n\n if (tokens.includes(token)) {\n setTokens(\n element,\n attr,\n tokens.filter(t => t !== token)\n )\n }\n}\n","import { LitElement, html, PropertyValues } from \"lit\"\nimport { customElement, property, state } from \"lit/decorators.js\"\nimport { computePosition, flip, shift, offset } from \"@floating-ui/dom\"\nimport type { Ref } from \"lit/directives/ref.js\"\n\nimport * as attr from \"../common/attribute.js\"\nimport { DraftComponentMixin } from \"../common/mixins/DraftComponentMixin.js\"\nimport { SlotController } from \"../common/controllers/SlotController.js\"\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./Tooltip.css\"\n\ntype FocusableElement = HTMLElement & { focusableRef?: Ref<Element> }\n\n/**\n * Tooltips are floating containers for displaying additional information\n * for the currently focused element. A tooltip can be useful when you want\n * to e.g. give a hint about an existing Command Menu shortcut.\n *\n * @status draft\n * @category overlay\n * @slot - The tooltip content\n * @slot shortcut - Optional slot that holds shortcut keys to access the subject\n */\n@customElement(\"nord-tooltip\")\nexport default class Tooltip extends DraftComponentMixin(LitElement) {\n static styles = [componentStyle, style]\n\n // tracks the last tooltip opened, so we can enforce only one is ever open at a time\n static lastOpened?: Tooltip\n\n private shortcutSlot = new SlotController(this, \"shortcut\")\n private targetElement!: FocusableElement\n\n /**\n * the proxy element is for cases where the targetElement is a web component,\n * and the WC has a focusable child in its shadow root e.g. a button component.\n * in this case, when the tooltip is shown, we inject the proxy into targetElement's shadow root\n * and wire up aria-describedby from the focusable element to the proxy.\n * when the tooltip is hidden, we remove the proxy and remove the aria-describedby relationship.\n */\n private proxy = document.createElement(\"span\")\n\n /**\n * Determines whether the tooltip is visible or not.\n */\n @state() visible: boolean = false\n\n /**\n * Control the position of the tooltip component.\n * When set to \"none\", the tooltip will be shown above\n * but accommodate for browser boundaries.\n */\n @property({ reflect: true }) position?: \"bottom\" | \"top\" | \"left\" | \"right\" = \"top\"\n\n /**\n * The tooltip role, set on the component by default.\n */\n @property({ reflect: true }) role = \"tooltip\"\n\n /**\n * The id for the active element to reference via aria-describedby.\n */\n @property({ reflect: true }) id: string = \"\"\n\n /**\n * The delay in milliseconds before the tooltip is opened.\n */\n @property({ reflect: true, type: Number }) delay: number = 300\n\n /**\n * Setting and updating the position of the tooltip\n */\n private updatePosition = () =>\n computePosition(this.targetElement, this, {\n placement: this.position,\n middleware: [\n shift({\n padding: 8,\n }),\n offset(8),\n flip(),\n ],\n }).then(({ x, y }) => {\n this.style.insetInlineStart = `${x}px`\n this.style.insetBlockStart = `${y}px`\n })\n\n private handleScroll = () => {\n if (this.visible) this.updatePosition()\n }\n\n /**\n * Show and hide the tooltip using inline styles\n */\n private showTooltip = () => {\n if (this.visible) {\n return\n }\n\n Tooltip.lastOpened?.hideTooltip()\n Tooltip.lastOpened = this\n\n this.updatePosition().then(() => {\n this.visible = true\n })\n }\n\n private hideTooltip = () => {\n this.visible = false\n }\n\n /**\n * Apply all event listeners\n */\n connectedCallback() {\n super.connectedCallback()\n\n const rootNode = this.getRootNode() as Document | ShadowRoot\n const selector = `[aria-describedby='${this.id}']`\n const target = rootNode.querySelector<FocusableElement>(selector)\n\n if (!target) {\n // eslint-disable-next-line no-console\n console.warn(\"NORD: tooltip found no element matching selector:\", selector)\n return\n }\n\n this.targetElement = target\n\n target.addEventListener(\"keydown\", this.hideOnEscape)\n target.addEventListener(\"mouseenter\", this.showTooltip)\n target.addEventListener(\"mouseleave\", this.hideTooltip)\n target.addEventListener(\"focus\", this.showTooltip)\n target.addEventListener(\"blur\", this.hideTooltip)\n\n window.addEventListener(\"resize\", this.updatePosition, { passive: true })\n window.addEventListener(\"scroll\", this.handleScroll, { passive: true })\n }\n\n /**\n * Remove all the event listeners\n */\n disconnectedCallback() {\n super.disconnectedCallback()\n\n if (!this.targetElement) {\n return\n }\n\n this.targetElement.removeEventListener(\"keydown\", this.hideOnEscape)\n this.targetElement.removeEventListener(\"mouseenter\", this.showTooltip)\n this.targetElement.removeEventListener(\"mouseleave\", this.hideTooltip)\n this.targetElement.removeEventListener(\"focus\", this.showTooltip)\n this.targetElement.removeEventListener(\"blur\", this.hideTooltip)\n window.removeEventListener(\"resize\", this.updatePosition)\n window.removeEventListener(\"scroll\", this.handleScroll)\n }\n\n /**\n * Check if the tooltip has an id, warn them if not\n */\n willUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"id\") && !this.id) {\n // eslint-disable-next-line no-console\n console.warn(\"NORD: The tooltip requires an id attribute and value\")\n }\n\n if (changedProperties.has(\"visible\")) {\n if (this.visible) {\n this.addDescribedBy()\n\n this.style.transitionDelay = `${this.delay}ms`\n this.style.visibility = \"visible\"\n this.style.opacity = \"1\"\n } else {\n this.removeDescribedBy()\n\n this.style.transitionDelay = `0ms`\n this.style.visibility = \"hidden\"\n this.style.opacity = \"0\"\n }\n }\n }\n\n render() {\n return html`\n <div class=\"n-tooltip\">\n <slot></slot>\n <div class=\"n-tooltip-shortcut\" ?hidden=${this.shortcutSlot.isEmpty}>\n <slot class=\"n-tooltip-key\" name=\"shortcut\"></slot>\n </div>\n </div>\n `\n }\n\n private hideOnEscape = (e: KeyboardEvent) => {\n if (this.visible && e.key === \"Escape\") {\n this.hideTooltip()\n }\n }\n\n private addDescribedBy = () => {\n const focusable = this.targetElement?.focusableRef?.value\n\n if (focusable) {\n this.proxy.hidden = true\n this.proxy.id = this.id\n this.proxy.textContent = this.textContent\n\n focusable.insertAdjacentElement(\"afterend\", this.proxy)\n attr.add(focusable, \"aria-describedby\", this.id)\n }\n }\n\n private removeDescribedBy = () => {\n const focusable = this.targetElement?.focusableRef?.value\n\n if (focusable) {\n this.proxy.remove()\n attr.remove(focusable, \"aria-describedby\", this.id)\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-tooltip\": Tooltip\n }\n}\n"],"names":["getBasePlacement","placement","split","getAlignment","getMainAxisFromPlacement","includes","getLengthFromAxis","axis","computeCoordsFromPlacement","_ref","reference","floating","commonX","x","width","commonY","y","height","coords","mainAxis","length","rectToClientRect","rect","top","left","right","bottom","async","detectOverflow","middlewareArguments","options","platform","rects","elements","strategy","boundary","rootBoundary","elementContext","altBoundary","padding","paddingObject","expandPaddingObject","getSideObjectFromPadding","element","clippingClientRect","getClippingClientRect","isElement","contextElement","getDocumentElement","elementClientRect","convertOffsetParentRelativeRectToViewportRelativeRect","offsetParent","getOffsetParent","min","Math","max","within","min$1","value","max$1","hash$1","getOppositePlacement","replace","matched","hash","start","end","getOppositeAlignmentPlacement","flip","name","_middlewareData$flip","_middlewareData$flip2","middlewareData","initialPlacement","skip","checkMainAxis","crossAxis","checkCrossAxis","fallbackPlacements","specifiedFallbackPlacements","fallbackStrategy","flipAlignment","detectOverflowOptions","basePlacement","oppositePlacement","getExpandedPlacements","placements","overflow","overflows","overflowsData","push","main","cross","isStart","mainAlignmentSide","getAlignmentSides","every","side","_middlewareData$flip$","_middlewareData$flip3","nextIndex","index","nextPlacement","data","reset","resetPlacement","_overflowsData$slice$","slice","sort","a","b","filter","reduce","acc","offset","fn","diffCoords","multiplier","rawValue","convertValueToCoords","isWindow","toString","getWindow","node","window","ownerDocument","defaultView","getComputedStyle$1","getComputedStyle","getNodeName","nodeName","toLowerCase","isHTMLElement","HTMLElement","Element","isShadowRoot","ShadowRoot","isScrollParent","overflowX","overflowY","test","isTableElement","isContainingBlock","isFirefox","navigator","userAgent","css","transform","perspective","contain","willChange","round","getBoundingClientRect","includeScale","clientRect","scaleX","scaleY","offsetWidth","offsetHeight","Node","document","documentElement","getNodeScroll","scrollLeft","pageXOffset","scrollTop","pageYOffset","getWindowScrollBarX","getRectRelativeToOffsetParent","isOffsetParentAnElement","isScaled","scroll","offsets","offsetRect","clientLeft","clientTop","getParentNode","assignedSlot","parentNode","host","getTrueOffsetParent","position","currentNode","getContainingBlock","getDimensions","getScrollParent","body","getScrollParents","list","_node$ownerDocument","scrollParent","isBody","win","target","concat","visualViewport","updatedList","getClientRectFromClippingParent","clippingParent","html","clientWidth","clientHeight","abs","innerWidth","scale","offsetLeft","offsetTop","getViewportRect","getInnerBoundingClientRect","_element$ownerDocumen","scrollWidth","scrollHeight","direction","getDocumentRect","getClippingParents","clippingParents","clipperElement","parent","child","rootNode","getRootNode","contains","next","getElementRects","args","_ref2","_ref3","firstClippingParent","clippingRect","accRect","_ref4","getClientRects","_ref5","computePosition","config","middleware","statefulPlacement","i","nextX","nextY","computePosition$1","getTokens","attr","getAttribute","setTokens","tokens","setAttribute","join","Tooltip","DraftComponentMixin","LitElement","constructor","this","SlotController","createElement","targetElement","limiter","mainAxisCoord","crossAxisCoord","maxSide","limitedCoords","then","style","insetInlineStart","insetBlockStart","visible","updatePosition","Tooltip_1","lastOpened","hideTooltip","e","key","focusable","focusableRef","proxy","hidden","id","textContent","insertAdjacentElement","token","attr.add","remove","t","attr.remove","connectedCallback","super","selector","querySelector","addEventListener","hideOnEscape","showTooltip","passive","handleScroll","console","warn","disconnectedCallback","removeEventListener","willUpdate","changedProperties","has","addDescribedBy","transitionDelay","delay","visibility","opacity","removeDescribedBy","render","shortcutSlot","isEmpty","componentStyle","__decorate","state","property","reflect","type","Number","customElement"],"mappings":"2SAAA,S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BoE,EAAc,iBACMpE,WAAAA"}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as Badge}from"./Badge.js";export{default as Button}from"./Button.js";export{default as Card}from"./Card.js";export{default as Input}from"./Input.js";export{default as Icon}from"./Icon.js";export{default as CommandMenu}from"./CommandMenu.js";export{default as CommandMenuAction}from"./CommandMenuAction.js";export{default as Select}from"./Select.js";export{default as Stack}from"./Stack.js";export{default as Spinner}from"./Spinner.js";export{default as Table}from"./Table.js";export{default as VisuallyHidden}from"./VisuallyHidden.js";export{default as Textarea}from"./Textarea.js";export{C as Calendar}from"./Calendar-55a0b169.js";export{default as DatePicker}from"./DatePicker.js";export{default as Checkbox}from"./Checkbox.js";export{default as Tooltip}from"./Tooltip.js";export{default as Fieldset}from"./Fieldset.js";export{default as Radio}from"./Radio.js";export{default as Header}from"./Header.js";export{default as NavGroup}from"./NavGroup.js";export{default as NavItem}from"./NavItem.js";export{default as Navigation}from"./Navigation.js";import"./DraftComponentMixin-30345acf.js";import"./lit-element-9646ab7e.js";import"./property-03f59dce.js";import"./Component-a19be7c9.js";import"./if-defined-2a4c6dbc.js";import"./ref-eb5cfa10.js";import"./directive-helpers-e7b6bf4b.js";import"./directive-de55b00a.js";import"./LightDomController-f56fa1a4.js";import"./FocusableMixin-98e13999.js";import"./InputMixin-33bc2df5.js";import"./SlotController-5bfc47d1.js";import"./unsafe-html-4da54dd2.js";import"./FormAssociatedMixin-e146e0ab.js";import"./events-731d0007.js";import"./FormField-926a0dda.js";import"./TextField-b4155167.js";import"./state-70f38ceb.js";import"./number-e7cd246c.js";import"./class-map-61e9e8c1.js";import"./collection-f3631dc8.js";import"./LightDismissController-cc5b4bf2.js";import"./ShortcutController-93173ff4.js";import"./tinykeys.module-84e6cc41.js";import"./KeyboardController.js";import"./
|
|
1
|
+
export{default as Badge}from"./Badge.js";export{default as Button}from"./Button.js";export{default as Card}from"./Card.js";export{default as Input}from"./Input.js";export{default as Icon}from"./Icon.js";export{default as CommandMenu}from"./CommandMenu.js";export{default as CommandMenuAction}from"./CommandMenuAction.js";export{default as Select}from"./Select.js";export{default as Stack}from"./Stack.js";export{default as Spinner}from"./Spinner.js";export{default as Table}from"./Table.js";export{default as VisuallyHidden}from"./VisuallyHidden.js";export{default as Textarea}from"./Textarea.js";export{C as Calendar}from"./Calendar-55a0b169.js";export{default as DatePicker}from"./DatePicker.js";export{default as Checkbox}from"./Checkbox.js";export{default as Tooltip}from"./Tooltip.js";export{default as Fieldset}from"./Fieldset.js";export{default as Radio}from"./Radio.js";export{default as Header}from"./Header.js";export{default as NavGroup}from"./NavGroup.js";export{default as NavItem}from"./NavItem.js";export{default as Navigation}from"./Navigation.js";import"./DraftComponentMixin-30345acf.js";import"./lit-element-9646ab7e.js";import"./property-03f59dce.js";import"./Component-a19be7c9.js";import"./if-defined-2a4c6dbc.js";import"./ref-eb5cfa10.js";import"./directive-helpers-e7b6bf4b.js";import"./directive-de55b00a.js";import"./LightDomController-f56fa1a4.js";import"./FocusableMixin-98e13999.js";import"./InputMixin-33bc2df5.js";import"./SlotController-5bfc47d1.js";import"./unsafe-html-4da54dd2.js";import"./FormAssociatedMixin-e146e0ab.js";import"./events-731d0007.js";import"./FormField-926a0dda.js";import"./TextField-b4155167.js";import"./state-70f38ceb.js";import"./number-e7cd246c.js";import"./class-map-61e9e8c1.js";import"./collection-f3631dc8.js";import"./LightDismissController-cc5b4bf2.js";import"./ShortcutController-93173ff4.js";import"./tinykeys.module-84e6cc41.js";import"./KeyboardController.js";import"./SelectEvent.js";import"./DirectionController-82794ee9.js";import"./dates-ccf5a897.js";import"./calendar-localization.js";import"./month-view.js";import"./DateSelectEvent.js";import"./date-adapter.js";import"./date-localization.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -13,7 +13,7 @@ declare const CommandMenu_base: typeof LitElement;
|
|
|
13
13
|
* @slot footer - Used to replace the default footer contents.
|
|
14
14
|
* @fires open - The command menu was opened.
|
|
15
15
|
* @fires close - The command menu was closed.
|
|
16
|
-
* @fires {SelectEvent}
|
|
16
|
+
* @fires {SelectEvent} nord-select - User selected a command from the menu.
|
|
17
17
|
*/
|
|
18
18
|
export default class CommandMenu extends CommandMenu_base {
|
|
19
19
|
static styles: import("lit").CSSResult[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NordEvent } from "../common/events.js";
|
|
2
2
|
import { ICommandMenuAction } from "./ICommandMenuAction.js";
|
|
3
3
|
export declare class SelectEvent extends NordEvent {
|
|
4
|
+
static eventName: string;
|
|
4
5
|
command: ICommandMenuAction;
|
|
5
6
|
constructor(command: ICommandMenuAction);
|
|
6
7
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhealth/components",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.56",
|
|
4
4
|
"description": "This package includes Nord Design System web components",
|
|
5
|
-
"author": "Nordhealth <
|
|
5
|
+
"author": "Nordhealth <support@nordhealth.design>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"module": "lib/index.js",
|
|
@@ -30,22 +30,23 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@floating-ui/dom": "0.2.0",
|
|
33
|
-
"@nordhealth/icons": "^1.3.
|
|
33
|
+
"@nordhealth/icons": "^1.3.2",
|
|
34
34
|
"lit": "2.2.0",
|
|
35
35
|
"tinykeys": "1.4.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "^0.5.5",
|
|
39
|
-
"@nordhealth/css": "^1.0.0-alpha.
|
|
40
|
-
"@nordhealth/fonts": "^2.0.
|
|
41
|
-
"@nordhealth/themes": "^3.0.
|
|
42
|
-
"@nordhealth/tokens": "^2.0.
|
|
39
|
+
"@nordhealth/css": "^1.0.0-alpha.19",
|
|
40
|
+
"@nordhealth/fonts": "^2.0.13",
|
|
41
|
+
"@nordhealth/themes": "^3.0.7",
|
|
42
|
+
"@nordhealth/tokens": "^2.0.5",
|
|
43
43
|
"@open-wc/eslint-config": "^7.0.0",
|
|
44
44
|
"@open-wc/testing": "3.0.4",
|
|
45
45
|
"@rollup/plugin-node-resolve": "13.1.3",
|
|
46
46
|
"@rollup/plugin-replace": "3.0.1",
|
|
47
47
|
"@rollup/plugin-typescript": "^8.2.5",
|
|
48
48
|
"@types/mocha": "9.1.0",
|
|
49
|
+
"@types/prettier": "2.4.4",
|
|
49
50
|
"@typescript-eslint/eslint-plugin": "5.11.0",
|
|
50
51
|
"@typescript-eslint/parser": "5.11.0",
|
|
51
52
|
"@web/dev-server": "0.1.29",
|
|
@@ -123,7 +124,8 @@
|
|
|
123
124
|
"**/src/**/*.test.{js,mjs,ts}",
|
|
124
125
|
"**/demo/**/*.{html,js,mjs,ts}",
|
|
125
126
|
"**/*.config.{html,js,mjs,ts}",
|
|
126
|
-
"**/*.conf.{html,js,mjs,ts}"
|
|
127
|
+
"**/*.conf.{html,js,mjs,ts}",
|
|
128
|
+
"**/utils/*.{js,mjs}"
|
|
127
129
|
]
|
|
128
130
|
}
|
|
129
131
|
],
|
|
@@ -157,5 +159,5 @@
|
|
|
157
159
|
}
|
|
158
160
|
]
|
|
159
161
|
},
|
|
160
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "cb270a4b86ccf3f427b80de33e8be51a46ac3f9f"
|
|
161
163
|
}
|
package/lib/events.js
DELETED
package/lib/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["../src/command-menu/events.ts"],"sourcesContent":["import { NordEvent } from \"../common/events.js\"\nimport { ICommandMenuAction } from \"./ICommandMenuAction.js\"\n\nexport class SelectEvent extends NordEvent {\n command: ICommandMenuAction\n\n constructor(command: ICommandMenuAction) {\n super(\"n-select\")\n this.command = command\n }\n}\n"],"names":["SelectEvent","NordEvent","constructor","command","super","this"],"mappings":"+CAGaA,UAAoBC,EAG/BC,YAAYC,GACVC,MAAM,YACNC,KAAKF,QAAUA"}
|