@nordhealth/components
Advanced tools
Comparing version 1.0.0-alpha.37 to 1.0.0-alpha.38
@@ -1,2 +0,2 @@ | ||
import{r as a,D as n,p as t,_ as o,n as e,s as d}from"./DraftComponentMixin-4bb26f5d.js";import{e as r}from"./property-03f59dce.js";const s=a`:host{all:initial;display:block;font-family:var(--n-font-family);line-height:var(--n-line-height);font-feature-settings:var(--n-font-features);font-size:var(--n-font-size-m);color:var(--n-color-text)}*,::after,::before{box-sizing:border-box;margin:0;padding:0}.n-card{background:var(--n-color-surface);border-radius:var(--n-border-radius);box-shadow:var(--n-box-shadow-card)}@media (max-width:1000px){slot:not([name]){overflow-x:auto}}:host([padding="m"]){--n-card-padding:var(--n-space-m);--n-card-slot-padding:var(--n-space-m)}:host([padding="l"]){--n-card-padding:var(--n-space-l);--n-card-slot-padding:var(--n-space-l)}:host([padding=none]){--n-card-padding:0;--n-card-slot-padding:var(--n-space-m)}slot{display:block}slot[hidden]{display:none}slot:not([name]){padding:var(--n-card-padding)}slot[name=header]{border-block-end:1px solid var(--n-color-border);padding:var(--n-space-m) var(--n-card-slot-padding)}slot[name=footer]{padding:var(--n-card-slot-padding);padding-block-start:0;white-space:nowrap}::slotted([slot=header]){font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-heading);margin:0}`;let i=class extends(n(d)){constructor(){super(...arguments),this.padding="m"}render(){return t`<div class="n-card"><slot name="header" @slotchange="${this.handleSlotChange}" ?hidden="${!this.hasSlottedContent("header")}"></slot><slot></slot><slot name="footer" @slotchange="${this.handleSlotChange}" ?hidden="${!this.hasSlottedContent("footer")}"></slot></div>`}handleSlotChange(){this.requestUpdate()}hasSlottedContent(a){return null!=this.querySelector(`[slot="${a}"]`)}};i.styles=s,o([r({reflect:!0})],i.prototype,"padding",void 0),i=o([e("nord-card")],i);var l=i;export{l as default}; | ||
import{r as a,D as o,p as n,_ as d,n as t,s as r}from"./DraftComponentMixin-4bb26f5d.js";import{e}from"./property-03f59dce.js";import{S as s}from"./SlotController-fda28afb.js";const i=a`:host{all:initial;display:block;font-family:var(--n-font-family);line-height:var(--n-line-height);font-feature-settings:var(--n-font-features);font-size:var(--n-font-size-m);color:var(--n-color-text)}*,::after,::before{box-sizing:border-box;margin:0;padding:0}.n-card{background:var(--n-color-surface);border-radius:var(--n-border-radius);box-shadow:var(--n-box-shadow-card)}@media (max-width:1000px){slot:not([name]){overflow-x:auto}}:host([padding="m"]){--n-card-padding:var(--n-space-m);--n-card-slot-padding:var(--n-space-m)}:host([padding="l"]){--n-card-padding:var(--n-space-l);--n-card-slot-padding:var(--n-space-l)}:host([padding=none]){--n-card-padding:0;--n-card-slot-padding:var(--n-space-m)}slot{display:block}slot[hidden]{display:none}slot:not([name]){padding:var(--n-card-padding)}slot[name=header]{border-block-end:1px solid var(--n-color-border);padding:var(--n-space-m) var(--n-card-slot-padding)}slot[name=footer]{padding:var(--n-card-slot-padding);padding-block-start:0;white-space:nowrap}::slotted([slot=header]){font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-heading);margin:0}`;let l=class extends(o(r)){constructor(){super(...arguments),this.slots=new s(this),this.padding="m"}render(){return n`<div class="n-card"><slot name="header" ?hidden="${!this.slots.hasSlottedContent("header")}"></slot><slot></slot><slot name="footer" ?hidden="${!this.slots.hasSlottedContent("footer")}"></slot></div>`}};l.styles=i,d([e({reflect:!0})],l.prototype,"padding",void 0),l=d([t("nord-card")],l);var p=l;export{p as default}; | ||
//# sourceMappingURL=Card.js.map |
@@ -1,2 +0,2 @@ | ||
import{b as e,r as t,D as o,p as s,T as n,_ as i,n as r,s as a}from"./DraftComponentMixin-4bb26f5d.js";import{e as l}from"./property-03f59dce.js";import{I as d,t as c}from"./Icon-f6f1c764.js";import{e as p,i as h,t as m,l as u}from"./directive-40a31ee2.js";import{a as v,c as f,u as b,m as g,s as x,e as y,n as w}from"./ref-857246ae.js";import{o as k}from"./CommandMenuAction-879382c7.js";import{groupBy as C}from"./collection.js";import{wrap as z}from"./number.js";import{NordEvent as $}from"./events.js";import{getFocusedElement as j}from"./focus.js";import{S as I,K as E}from"./KeyboardController-28c7135b.js";import"./VisuallyHidden.js";import{SelectEvent as L}from"./events2.js";import"./unsafe-html-7028f0a1.js"; | ||
import{b as e,r as t,D as o,p as s,T as n,_ as i,n as r,s as a}from"./DraftComponentMixin-4bb26f5d.js";import{e as l}from"./property-03f59dce.js";import{I as d,t as c}from"./Icon-f6f1c764.js";import{e as p,i as h,t as m,l as u}from"./directive-40a31ee2.js";import{a as v,c as f,u as b,m as g,s as x,e as y,n as w}from"./ref-857246ae.js";import{o as k}from"./CommandMenuAction-879382c7.js";import{N as C}from"./events-731d0007.js";import{S as z,K as $}from"./KeyboardController-28c7135b.js";import"./VisuallyHidden.js";import{SelectEvent as E}from"./events.js";import"./unsafe-html-7028f0a1.js"; | ||
/** | ||
@@ -6,3 +6,3 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const _=(e,t,o)=>{const s=new Map;for(let n=t;n<=o;n++)s.set(e[n],n);return s},O=p(class extends h{constructor(e){if(super(e),e.type!==m.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,o){let s;void 0===o?o=t:void 0!==t&&(s=t);const n=[],i=[];let r=0;for(const t of e)n[r]=s?s(t,r):r,i[r]=o(t,r),r++;return{values:i,keys:n}}render(e,t,o){return this.dt(e,t,o).values}update(t,[o,s,n]){var i;const r=v(t),{values:a,keys:l}=this.dt(o,s,n);if(!Array.isArray(r))return this.ct=l,a;const d=null!==(i=this.ct)&&void 0!==i?i:this.ct=[],c=[];let p,h,m=0,u=r.length-1,y=0,w=a.length-1;for(;m<=u&&y<=w;)if(null===r[m])m++;else if(null===r[u])u--;else if(d[m]===l[y])c[y]=f(r[m],a[y]),m++,y++;else if(d[u]===l[w])c[w]=f(r[u],a[w]),u--,w--;else if(d[m]===l[w])c[w]=f(r[m],a[w]),b(t,c[w+1],r[m]),m++,w--;else if(d[u]===l[y])c[y]=f(r[u],a[y]),b(t,r[m],r[u]),u--,y++;else if(void 0===p&&(p=_(l,y,w),h=_(d,m,u)),p.has(d[m]))if(p.has(d[u])){const e=h.get(l[y]),o=void 0!==e?r[e]:null;if(null===o){const e=b(t,r[m]);f(e,a[y]),c[y]=e}else c[y]=f(o,a[y]),b(t,r[m],o),r[e]=null;y++}else g(r[u]),u--;else g(r[m]),m++;for(;y<=w;){const e=b(t,c[w+1]);f(e,a[y]),c[y++]=e}for(;m<=u;){const e=r[m++];null!==e&&g(e)}return this.ct=l,x(t,c),e}});const M="keyboard-arrow-up-down";var S=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:M,tags:"nordicon keyboard keys arrow up down shortcut"});var B=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 A="keyboard-backspace";var R=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:A,tags:"nordicon keyboard backspace back delete key shortcut"});class D{constructor(e,t){this.handleEsc=e=>{this.options.isOpen()&&this.options.onDismiss(e)},this.handleClickOut=e=>{if(!this.options.isOpen())return;const t=e.target;!this.host.contains(t)&&this.options.onDismiss(e)},this.host=e,e.addController(this),this.options=t,this.shortcut=new I(this.host,{Escape:this.handleEsc})}hostConnected(){document.addEventListener("click",this.handleClickOut,!0)}hostDisconnected(){document.removeEventListener("click",this.handleClickOut,!0)}}const H=t`:host{--n-command-menu-width:640px;--n-command-menu-top:16%;--n-command-menu-height:290px;all:initial;font-family:var(--n-font-family);line-height:var(--n-line-height);font-feature-settings:var(--n-font-features)}.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;padding: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)}`;d.registerIcon(S),d.registerIcon(B),d.registerIcon(R);let P=class extends(o(a)){constructor(){super(...arguments),this.inputRef=y(),this.listRef=y(),this.dismissController=new D(this,{isOpen:()=>this.open,onDismiss:()=>this.close()}),this.keyboardController=new E(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 $("open"))}close(){var e;this.open=!1,null===(e=this.previousFocus)||void 0===e||e.focus(),this.previousFocus=void 0,this.dispatchEvent(new $("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=j(document),this.focus(),this.listRef.value&&(this.listRef.value.scrollTop=0))}render(){var e;const t=C(this.filteredCommands,"section"),o=0===this.filteredCommands.length?"no-results":null===(e=this.selected)||void 0===e?void 0:e.id;return s`<div class="${k({"n-visible":this.open,"n-modal":!0})}"><div @animationend="${this.handleAnimationEnd}" class="${k({"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}" ${w(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="${u(o)}" aria-describedby="instructions"></div><div class="n-modal-body"><div id="list" ${w(this.listRef)} role="listbox">${0===this.filteredCommands.length?this.renderNoResults():Array.from(t,(([e,t])=>this.renderSection(e,t)))}</div></div><slot name="footer"><div class="n-modal-footer" slot="footer"><span class="n-help"><nord-icon label="Arrow keys" name="${M}"></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="${A}"></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,t){const o=`section-${e}`;return s`<div role="group" aria-labelledby="${u(e?o:void 0)}">${e?s`<div class="n-group-header" role="presentation" id="${u(o)}">${e}</div>`:n} ${O(t,(e=>e.id),(e=>{var t,o;return s`<nord-command-menu-action id="${e.id}" .command="${e}" ?selected="${e.id===(null===(t=this.selected)||void 0===t?void 0:t.id)}" @click="${()=>this.select(e)}" role="option" aria-selected="${u(e.id===(null===(o=this.selected)||void 0===o?void 0:o.id)||void 0)}"></nord-command-menu-action>`}))}</div>`}handleAnimationEnd(){this.bump=!1}handleBlur(){this.open&&this.focus()}handleInput(e){const t=e.target;this.setSearch(t.value)}select(e=this.selected){var t;this.commands.some((t=>t.parent===e.id))?(this.setParent(e.id),this.bump=!0,this.focus()):this.close(),this.setSearch(""),null===(t=e.handler)||void 0===t||t.call(e,this);const o=new L(e);this.dispatchEvent(o)}start(){this.selectedIndex=0}end(){this.selectedIndex=this.filteredCommands.length-1}next(){this.selectedIndex=z(this.selectedIndex+1,0,this.filteredCommands.length-1)}previous(){this.selectedIndex=z(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:t,keywords:o="",parent:s})=>{const n=`${t} ${o}`.toLocaleLowerCase(),i=e.every((e=>n.includes(e)));return(!this.parent&&this.search||s===this.parent)&&i}))}};P.styles=H,i([l({type:Boolean})],P.prototype,"open",void 0),i([l({type:String})],P.prototype,"placeholder",void 0),i([l({type:Array,attribute:!1})],P.prototype,"commands",void 0),i([c()],P.prototype,"parent",void 0),i([c()],P.prototype,"search",void 0),i([c()],P.prototype,"bump",void 0),i([c()],P.prototype,"selectedIndex",void 0),i([c()],P.prototype,"filteredCommands",void 0),P=i([r("nord-command-menu")],P);var N=P;export{N as default}; | ||
*/const I=(e,t,o)=>{const s=new Map;for(let n=t;n<=o;n++)s.set(e[n],n);return s},j=p(class extends h{constructor(e){if(super(e),e.type!==m.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,o){let s;void 0===o?o=t:void 0!==t&&(s=t);const n=[],i=[];let r=0;for(const t of e)n[r]=s?s(t,r):r,i[r]=o(t,r),r++;return{values:i,keys:n}}render(e,t,o){return this.dt(e,t,o).values}update(t,[o,s,n]){var i;const r=v(t),{values:a,keys:l}=this.dt(o,s,n);if(!Array.isArray(r))return this.ct=l,a;const d=null!==(i=this.ct)&&void 0!==i?i:this.ct=[],c=[];let p,h,m=0,u=r.length-1,y=0,w=a.length-1;for(;m<=u&&y<=w;)if(null===r[m])m++;else if(null===r[u])u--;else if(d[m]===l[y])c[y]=f(r[m],a[y]),m++,y++;else if(d[u]===l[w])c[w]=f(r[u],a[w]),u--,w--;else if(d[m]===l[w])c[w]=f(r[m],a[w]),b(t,c[w+1],r[m]),m++,w--;else if(d[u]===l[y])c[y]=f(r[u],a[y]),b(t,r[m],r[u]),u--,y++;else if(void 0===p&&(p=I(l,y,w),h=I(d,m,u)),p.has(d[m]))if(p.has(d[u])){const e=h.get(l[y]),o=void 0!==e?r[e]:null;if(null===o){const e=b(t,r[m]);f(e,a[y]),c[y]=e}else c[y]=f(o,a[y]),b(t,r[m],o),r[e]=null;y++}else g(r[u]),u--;else g(r[m]),m++;for(;y<=w;){const e=b(t,c[w+1]);f(e,a[y]),c[y++]=e}for(;m<=u;){const e=r[m++];null!==e&&g(e)}return this.ct=l,x(t,c),e}});const L="keyboard-arrow-up-down";var _=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:L,tags:"nordicon keyboard keys arrow up down shortcut"});var M=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 O="keyboard-backspace";var R=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:O,tags:"nordicon keyboard backspace back delete key shortcut"});function S(e,t,o){return e>o?t:e<t?o:e}function B(e){var t;return(null===(t=e.activeElement)||void 0===t?void 0:t.shadowRoot)?B(e.activeElement.shadowRoot):e.activeElement||void 0}class A{constructor(e,t){this.handleEsc=e=>{this.options.isOpen()&&this.options.onDismiss(e)},this.handleClickOut=e=>{if(!this.options.isOpen())return;const t=e.target;!this.host.contains(t)&&this.options.onDismiss(e)},this.host=e,e.addController(this),this.options=t,this.shortcut=new z(this.host,{Escape:this.handleEsc})}hostConnected(){document.addEventListener("click",this.handleClickOut,!0)}hostDisconnected(){document.removeEventListener("click",this.handleClickOut,!0)}}const D=t`:host{--n-command-menu-width:640px;--n-command-menu-top:16%;--n-command-menu-height:290px;all:initial;font-family:var(--n-font-family);line-height:var(--n-line-height);font-feature-settings:var(--n-font-features)}.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;padding: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)}`;d.registerIcon(_),d.registerIcon(M),d.registerIcon(R);let H=class extends(o(a)){constructor(){super(...arguments),this.inputRef=y(),this.listRef=y(),this.dismissController=new A(this,{isOpen:()=>this.open,onDismiss:()=>this.close()}),this.keyboardController=new $(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 C("open"))}close(){var e;this.open=!1,null===(e=this.previousFocus)||void 0===e||e.focus(),this.previousFocus=void 0,this.dispatchEvent(new C("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=B(document),this.focus(),this.listRef.value&&(this.listRef.value.scrollTop=0))}render(){var e;const t=function(e,t){var o;const s=new Map;for(const n of e){const e=n[t],i=null!==(o=s.get(e))&&void 0!==o?o:[];s.has(e)||s.set(e,[]),i.push(n),s.set(e,i)}return s}(this.filteredCommands,"section"),o=0===this.filteredCommands.length?"no-results":null===(e=this.selected)||void 0===e?void 0:e.id;return s`<div class="${k({"n-visible":this.open,"n-modal":!0})}"><div @animationend="${this.handleAnimationEnd}" class="${k({"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}" ${w(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="${u(o)}" aria-describedby="instructions"></div><div class="n-modal-body"><div id="list" ${w(this.listRef)} role="listbox">${0===this.filteredCommands.length?this.renderNoResults():Array.from(t,(([e,t])=>this.renderSection(e,t)))}</div></div><slot name="footer"><div class="n-modal-footer" slot="footer"><span class="n-help"><nord-icon label="Arrow keys" name="${L}"></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="${O}"></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,t){const o=`section-${e}`;return s`<div role="group" aria-labelledby="${u(e?o:void 0)}">${e?s`<div class="n-group-header" role="presentation" id="${u(o)}">${e}</div>`:n} ${j(t,(e=>e.id),(e=>{var t,o;return s`<nord-command-menu-action id="${e.id}" .command="${e}" ?selected="${e.id===(null===(t=this.selected)||void 0===t?void 0:t.id)}" @click="${()=>this.select(e)}" role="option" aria-selected="${u(e.id===(null===(o=this.selected)||void 0===o?void 0:o.id)||void 0)}"></nord-command-menu-action>`}))}</div>`}handleAnimationEnd(){this.bump=!1}handleBlur(){this.open&&this.focus()}handleInput(e){const t=e.target;this.setSearch(t.value)}select(e=this.selected){var t;this.commands.some((t=>t.parent===e.id))?(this.setParent(e.id),this.bump=!0,this.focus()):this.close(),this.setSearch(""),null===(t=e.handler)||void 0===t||t.call(e,this);const o=new E(e);this.dispatchEvent(o)}start(){this.selectedIndex=0}end(){this.selectedIndex=this.filteredCommands.length-1}next(){this.selectedIndex=S(this.selectedIndex+1,0,this.filteredCommands.length-1)}previous(){this.selectedIndex=S(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:t,keywords:o="",parent:s})=>{const n=`${t} ${o}`.toLocaleLowerCase(),i=e.every((e=>n.includes(e)));return(!this.parent&&this.search||s===this.parent)&&i}))}};H.styles=D,i([l({type:Boolean})],H.prototype,"open",void 0),i([l({type:String})],H.prototype,"placeholder",void 0),i([l({type:Array,attribute:!1})],H.prototype,"commands",void 0),i([c()],H.prototype,"parent",void 0),i([c()],H.prototype,"search",void 0),i([c()],H.prototype,"bump",void 0),i([c()],H.prototype,"selectedIndex",void 0),i([c()],H.prototype,"filteredCommands",void 0),H=i([r("nord-command-menu")],H);var N=H;export{N as default}; | ||
//# sourceMappingURL=CommandMenu.js.map |
@@ -1,2 +0,2 @@ | ||
class e extends Event{constructor(e,s){super(e,{bubbles:!0,composed:!0,...s})}}export{e as NordEvent}; | ||
import{N as s}from"./events-731d0007.js";class e extends s{constructor(s){super("n-select"),this.command=s}}export{e as SelectEvent}; | ||
//# sourceMappingURL=events.js.map |
@@ -1,2 +0,2 @@ | ||
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{I as Icon}from"./Icon-f6f1c764.js";export{default as CommandMenu}from"./CommandMenu.js";export{C as CommandMenuAction}from"./CommandMenuAction-879382c7.js";export{default as Select}from"./Select.js";export{default as Stack}from"./Stack.js";export{default as Table}from"./Table.js";export{default as VisuallyHidden}from"./VisuallyHidden.js";import"./DraftComponentMixin-4bb26f5d.js";import"./property-03f59dce.js";import"./directive-40a31ee2.js";import"./ref-857246ae.js";import"./InputMixin-3e737480.js";import"./unsafe-html-7028f0a1.js";import"./FormAssociatedMixin-c9674b41.js";import"./events.js";import"./collection.js";import"./number.js";import"./focus.js";import"./KeyboardController-28c7135b.js";import"./events2.js"; | ||
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{I as Icon}from"./Icon-f6f1c764.js";export{default as CommandMenu}from"./CommandMenu.js";export{C as CommandMenuAction}from"./CommandMenuAction-879382c7.js";export{default as Select}from"./Select.js";export{default as Stack}from"./Stack.js";export{default as Table}from"./Table.js";export{default as VisuallyHidden}from"./VisuallyHidden.js";export{default as Textarea}from"./Textarea.js";import"./DraftComponentMixin-4bb26f5d.js";import"./property-03f59dce.js";import"./directive-40a31ee2.js";import"./ref-857246ae.js";import"./InputMixin-3e737480.js";import"./SlotController-fda28afb.js";import"./unsafe-html-7028f0a1.js";import"./FormField-02dd3b4f.js";import"./events-731d0007.js";import"./TextField-afe4d64f.js";import"./KeyboardController-28c7135b.js";import"./events.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{r as e,D as n,T as r,p as t,_ as o,n as i,s as a}from"./DraftComponentMixin-4bb26f5d.js";import{e as l}from"./property-03f59dce.js";import{l as s}from"./directive-40a31ee2.js";import{n as d}from"./ref-857246ae.js";import{o as c}from"./unsafe-html-7028f0a1.js";import{I as p,F as h}from"./InputMixin-3e737480.js";import{F as v}from"./FormAssociatedMixin-c9674b41.js";import"./VisuallyHidden.js";import"./events.js";const u=e`:host{all:initial;display:block;font-family:var(--n-font-family);line-height:var(--n-line-height);font-feature-settings:var(--n-font-features)}*,::after,::before{box-sizing:border-box;margin:0;padding:0}.n-caption{font-size:var(--n-font-size-s);line-height:1.3}.n-label-container{padding-block-end:calc(var(--n-space-s) * 1.5);display:inline-block}label{display:block;color:var(--n-color-text);font-family:var(--n-font-family);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-heading);line-height:var(--n-line-height-heading)}.n-hint{padding-block-start:calc(var(--n-space-s)/ 2);color:var(--n-color-text-weaker)}.n-input-container{position:relative}input{background:var(--n-color-active);color:var(--n-color-text);padding-block-start:calc(var(--n-space-s) - 1px);padding-block-end:calc(var(--n-space-s) - 1px);padding-inline-start:calc(var(--n-space-s) * 1.6);padding-inline-end:calc(var(--n-space-s) * 1.6);border-radius:var(--n-border-radius-s);border:1px solid var(--n-input-border-color,var(--n-color-border-strong));font-family:var(--n-font-family);font-size:var(--n-font-size-m);line-height:var(--n-line-height-form);min-inline-size:250px;transition:var(--n-transition-slowly)}@media (max-width:480px){input{font-size:var(--n-font-size-l)}}:host([expand]) input{display:block;inline-size:100%}.n-label-container:hover+.n-input-container input,input:hover{--n-input-border-color:var(--n-color-border-hover)}input:focus{--n-input-border-color:var(--n-color-primary);background:var(--n-color-surface);outline:0;box-shadow:0 0 0 1px var(--n-input-border-color)}input::placeholder{color:var(--n-color-text-weaker)}input:focus::placeholder{color:var(--n-color-text-weakest)}input:disabled{--n-input-border-color:var(--n-color-active);color:var(--n-color-text-weakest)}input::-webkit-search-cancel-button,input::-webkit-search-decoration{-webkit-appearance:none;appearance:none}slot[name=before]{display:flex;align-items:center;position:absolute;margin-inline-start:var(--n-space-m);block-size:100%;pointer-events:none;color:var(--n-color-icon)}slot[name=before]+input{padding-inline-start:var(--n-space-xl)}::slotted(svg),svg{block-size:var(--n-size-icon-s);inline-size:var(--n-size-icon-s)}input[aria-invalid=true]{--n-input-border-color:var(--n-color-status-danger)}.n-label-container:hover+.n-input-container input[aria-invalid=true]{--n-input-border-color:var(--n-color-status-danger)}.n-error{margin-block-start:calc(var(--n-space-s));color:var(--n-color-text-error)}`;let b=class extends(v(p(h(n(a))))){constructor(){super(...arguments),this.type="text",this.hideLabel=!1,this.expand=!1}render(){var e;const n=null!=this.hint||this.hasSlottedContent("hint"),o=null!=this.error||this.hasSlottedContent("error"),i="search"===this.type||this.hasSlottedContent("before"),a="number"===this.type,l="search"===this.type?c('<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path d="M7 59.5a52.5 52.5 0 1 0 105 0 52.5 52.5 0 1 0-105 0zM133 133 96.628 96.628" stroke-width="14" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/></svg>'):r;let p;return n&&o?p="hint error":n?p="hint":o&&(p="error"),t`${this.renderLabel(n)}<div class="n-input-container">${i?t`<slot name="before" @slotchange="${this.handleSlotChange}">${l}</slot>`:r} <input ${d(this.focusableRef)} id="input" type="${a?"text":this.type}" inputmode="${s(a?"numeric":void 0)}" pattern="${s(a?"[0-9]*":void 0)}" ?disabled="${this.disabled}" ?required="${this.required}" name="${s(this.name)}" .value="${null!==(e=this.value)&&void 0!==e?e:""}" placeholder="${s(this.placeholder)}" @change="${this.handleChange}" aria-describedby="${s(p)}" aria-invalid="${s(o?"true":void 0)}"></div>${o?this.renderError():r}`}renderLabel(e){const n=t`<label for="input"><slot name="label">${this.label}</slot></label> ${e?this.renderHint():r}`;return this.hideLabel?t`<nord-visually-hidden>${n}</nord-visually-hidden>`:t`<div class="n-label-container">${n}</div>`}renderHint(){return t`<div class="n-caption n-hint" id="hint"><slot name="hint" @slotchange="${this.handleSlotChange}">${this.hint}</slot></div>`}renderError(){return t`<div class="n-caption n-error" id="error" role="alert"><slot name="error" @slotchange="${this.handleSlotChange}">${this.error}</slot></div>`}handleSlotChange(){this.requestUpdate()}hasSlottedContent(e){return null!=this.querySelector(`[slot="${e}"]`)}};b.styles=u,o([l()],b.prototype,"type",void 0),o([l()],b.prototype,"hint",void 0),o([l({type:Boolean,attribute:"hide-label"})],b.prototype,"hideLabel",void 0),o([l()],b.prototype,"placeholder",void 0),o([l()],b.prototype,"error",void 0),o([l({reflect:!0,type:Boolean})],b.prototype,"expand",void 0),b=o([i("nord-input")],b);var f=b;export{f as default}; | ||
import{r as e,D as t,T as i,p as s,_ as r,n,s as o}from"./DraftComponentMixin-4bb26f5d.js";import{e as a}from"./property-03f59dce.js";import{l}from"./directive-40a31ee2.js";import{n as d}from"./ref-857246ae.js";import{o as p}from"./unsafe-html-7028f0a1.js";import{I as c,F as m}from"./InputMixin-3e737480.js";import{F as h,s as u}from"./FormField-02dd3b4f.js";import"./VisuallyHidden.js";import{s as f}from"./TextField-afe4d64f.js";import"./SlotController-fda28afb.js";import"./events-731d0007.js";const v=e`.n-input::-webkit-search-cancel-button,.n-input::-webkit-search-decoration{-webkit-appearance:none;appearance:none}slot[name=before]{display:flex;align-items:center;position:absolute;margin-inline-start:var(--n-space-m);block-size:100%;pointer-events:none;color:var(--n-color-icon)}slot[name=before]+.n-input{padding-inline-start:var(--n-space-xl)}::slotted(svg),svg{block-size:var(--n-size-icon-s);inline-size:var(--n-size-icon-s)}`;let b=class extends(h(c(m(t(o))))){constructor(){super(...arguments),this.type="text"}render(){var e;const t="search"===this.type||this.slots.hasSlottedContent("before"),r="number"===this.type,n="search"===this.type?p('<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path d="M7 59.5a52.5 52.5 0 1 0 105 0 52.5 52.5 0 1 0-105 0zM133 133 96.628 96.628" stroke-width="14" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/></svg>'):i;return s`${this.renderLabel()}<div class="n-input-container">${t?s`<slot name="before">${n}</slot>`:i} <input ${d(this.focusableRef)} id="${this.inputId}" class="n-input" type="${r?"text":this.type}" inputmode="${l(r?"numeric":void 0)}" pattern="${l(r?"[0-9]*":void 0)}" ?disabled="${this.disabled}" ?required="${this.required}" name="${l(this.name)}" .value="${null!==(e=this.value)&&void 0!==e?e:""}" placeholder="${l(this.placeholder)}" @change="${this.handleChange}" aria-describedby="${l(this.getDescribedBy())}" aria-invalid="${l(this.getInvalid())}"></div>${this.renderError()}`}};b.styles=[u,f,v],r([a()],b.prototype,"type",void 0),b=r([n("nord-input")],b);var $=b;export{$ as default}; | ||
//# sourceMappingURL=Input.js.map |
@@ -1,2 +0,2 @@ | ||
import{r as e,D as t,p as n,T as o,_ as r,n as i,s as a}from"./DraftComponentMixin-4bb26f5d.js";import{e as l}from"./property-03f59dce.js";import{l as s}from"./directive-40a31ee2.js";import{n as d}from"./ref-857246ae.js";import{o as c}from"./unsafe-html-7028f0a1.js";import"./Button.js";import"./VisuallyHidden.js";import{I as h,F as p}from"./InputMixin-3e737480.js";import{F as v}from"./FormAssociatedMixin-c9674b41.js";import"./events.js";const b=e`:host{all:initial;display:block;font-family:var(--n-font-family);line-height:var(--n-line-height);font-feature-settings:var(--n-font-features)}*,::after,::before{box-sizing:border-box;margin:0;padding:0}.n-caption{font-size:var(--n-font-size-s);line-height:1.3}.n-label-container{padding-block-end:calc(var(--n-space-s) * 1.5);display:inline-block}label{display:block;color:var(--n-color-text);font-family:var(--n-font-family);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-heading);line-height:var(--n-line-height-heading)}.n-hint{padding-block-start:calc(var(--n-space-s)/ 2);color:var(--n-color-text-weaker)}.n-select-container{position:relative;inline-size:fit-content}:host([expand]) .n-select-container{inline-size:100%}select{-webkit-appearance:none;appearance:none;position:absolute;font-size:var(--n-font-size-m);font-family:var(--n-font-family);color:var(--n-color-text);inline-size:100%;opacity:.0001;cursor:pointer;background:0 0;border:0;block-size:var(--n-space-xl);inset-block-end:0;inset-inline-start:0;z-index:2}nord-button{--n-button-text-align:start}.n-label-container:hover+.n-select-container nord-button,select:hover+nord-button{--n-button-background-color:var(--n-color-button-hover);--n-button-border-color:var(--n-color-border-hover)}.n-label-container:hover+.n-select-container nord-button svg,select:hover+nord-button svg{color:var(--n-color-icon-hover)}select:focus+nord-button{--n-button-border-color:var(--n-color-primary);--n-button-box-shadow:0 0 0 1px var(--n-button-border-color)}:host([disabled]){cursor:auto;pointer-events:none}::slotted(:not([slot])){display:none}[slot=after] svg{color:var(--n-color-icon);margin-inline-start:var(--n-space-m);margin-inline-end:calc(var(--n-space-s)/ -2);min-inline-size:calc(var(--n-space-l)/ 2.2)}::slotted([slot=before]){margin-inline-start:calc(var(--n-space-s) * -1);margin-inline-end:var(--n-space-s)}select[aria-invalid=true]+nord-button{--n-button-border-color:var(--n-color-status-danger)}.n-error{color:var(--n-color-text-error);font-size:var(--n-font-size-s);line-height:1.3;margin-block-start:calc(var(--n-space-s))}`;let u=class extends(v(h(p(t(a))))){constructor(){super(...arguments),this.hideLabel=!1,this.expand=!1}render(){const e=this.options,t=this.getButtonText(e),r=null!=this.hint||this.hasSlottedContent("hint"),i=null!=this.error||this.hasSlottedContent("error");let a;return r&&i?a="hint error":r?a="hint":i&&(a="error"),n`<slot @slotchange="${this.handleSlotChange}"></slot>${this.renderLabel(r)}<div class="n-select-container"><select ${d(this.focusableRef)} id="select" ?disabled="${this.disabled}" ?required="${this.required}" name="${s(this.name)}" @change="${this.handleChange}" aria-describedby="${s(a)}" aria-invalid="${s(i?"true":void 0)}">${this.placeholder&&n`<option value="" disabled="disabled" ?selected="${!this.value}">${this.placeholder}</option>`} ${e.map((e=>this.renderOption(e)))}</select><nord-button tabindex="-1" ?disabled="${this.disabled}" ?expand="${this.expand}" aria-hidden="true" type="button"><slot slot="before" name="before"></slot>${t}<div slot="after">${c('<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M105 56a10.416 10.416 0 0 1-7.42-3.08L72.478 27.818a3.528 3.528 0 0 0-4.956 0L42.42 52.92a10.5 10.5 0 0 1-14.84-14.84l35-35a10.486 10.486 0 0 1 14.84 0l35 35A10.5 10.5 0 0 1 105 56zm-35 84a10.416 10.416 0 0 1-7.42-3.08l-35-35a10.5 10.5 0 0 1 14.84-14.84l25.102 25.102a3.528 3.528 0 0 0 4.956 0L97.58 87.08a10.5 10.5 0 1 1 14.84 14.84l-35 35A10.416 10.416 0 0 1 70 140z"/></svg>')}</div></nord-button></div>${i?this.renderError():o}`}handleSlotChange(){this.requestUpdate()}get options(){return Array.from(this.querySelectorAll("option"))}getButtonText(e){const t=e.find((e=>e.value===this.value));return t?t.text:this.placeholder?this.placeholder:e[0]?e[0].text:""}renderLabel(e){const t=n`<label for="select"><slot name="label">${this.label}</slot></label> ${e?this.renderHint():o}`;return this.hideLabel?n`<nord-visually-hidden>${t}</nord-visually-hidden>`:n`<div class="n-label-container">${t}</div>`}renderHint(){return n`<div class="n-caption n-hint" id="hint"><slot name="hint" @slotchange="${this.handleSlotChange}">${this.hint}</slot></div>`}renderError(){return n`<div class="n-caption n-error" id="error" role="alert"><slot name="error" @slotchange="${this.handleSlotChange}">${this.error}</slot></div>`}renderOption(e){return n`<option value="${s(e.value)}" ?disabled="${e.disabled}" ?selected="${e.value===this.value}">${e.text}</option>`}hasSlottedContent(e){return null!=this.querySelector(`[slot="${e}"]`)}};u.styles=[b],r([l()],u.prototype,"hint",void 0),r([l({type:Boolean,attribute:"hide-label"})],u.prototype,"hideLabel",void 0),r([l()],u.prototype,"placeholder",void 0),r([l()],u.prototype,"error",void 0),r([l({reflect:!0,type:Boolean})],u.prototype,"expand",void 0),u=r([i("nord-select")],u);var f=u;export{f as default}; | ||
import{r as e,D as t,p as o,_ as n,n as r,s as i}from"./DraftComponentMixin-4bb26f5d.js";import{l as s}from"./directive-40a31ee2.js";import{n as a}from"./ref-857246ae.js";import{o as l}from"./unsafe-html-7028f0a1.js";import"./Button.js";import"./VisuallyHidden.js";import{I as d,F as c}from"./InputMixin-3e737480.js";import{F as p,s as u}from"./FormField-02dd3b4f.js";import"./property-03f59dce.js";import"./SlotController-fda28afb.js";import"./events-731d0007.js";const b=e`.n-select-container{position:relative;inline-size:fit-content}:host([expand]) .n-select-container{inline-size:100%}select{-webkit-appearance:none;appearance:none;position:absolute;font-size:var(--n-font-size-m);font-family:var(--n-font-family);color:var(--n-color-text);inline-size:100%;opacity:.0001;cursor:pointer;background:0 0;border:0;block-size:var(--n-space-xl);inset-block-end:0;inset-inline-start:0;z-index:2}nord-button{--n-button-text-align:start}.n-label-container:hover+.n-select-container nord-button,select:hover+nord-button{--n-button-background-color:var(--n-color-button-hover);--n-button-border-color:var(--n-color-border-hover)}.n-label-container:hover+.n-select-container nord-button svg,select:hover+nord-button svg{color:var(--n-color-icon-hover)}select:focus+nord-button{--n-button-border-color:var(--n-color-primary);--n-button-box-shadow:0 0 0 1px var(--n-button-border-color)}:host([disabled]){cursor:auto;pointer-events:none}::slotted(:not([slot])){display:none}[slot=after] svg{color:var(--n-color-icon);margin-inline-start:var(--n-space-m);margin-inline-end:calc(var(--n-space-s)/ -2);min-inline-size:calc(var(--n-space-l)/ 2.2)}::slotted([slot=before]){margin-inline-start:calc(var(--n-space-s) * -1);margin-inline-end:var(--n-space-s)}select[aria-invalid=true]+nord-button{--n-button-border-color:var(--n-color-status-danger)}`;let v=class extends(p(d(c(t(i))))){constructor(){super(...arguments),this.inputId="select"}render(){const e=this.options,t=this.getButtonText(e);return o`<slot></slot>${this.renderLabel()}<div class="n-select-container"><select ${a(this.focusableRef)} id="${this.inputId}" ?disabled="${this.disabled}" ?required="${this.required}" name="${s(this.name)}" @change="${this.handleChange}" aria-describedby="${s(this.getDescribedBy())}" aria-invalid="${s(this.getInvalid())}">${this.placeholder&&o`<option value="" disabled="disabled" ?selected="${!this.value}">${this.placeholder}</option>`} ${e.map((e=>this.renderOption(e)))}</select><nord-button tabindex="-1" ?disabled="${this.disabled}" ?expand="${this.expand}" aria-hidden="true" type="button"><slot slot="before" name="before"></slot>${t}<div slot="after">${l('<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M105 56a10.416 10.416 0 0 1-7.42-3.08L72.478 27.818a3.528 3.528 0 0 0-4.956 0L42.42 52.92a10.5 10.5 0 0 1-14.84-14.84l35-35a10.486 10.486 0 0 1 14.84 0l35 35A10.5 10.5 0 0 1 105 56zm-35 84a10.416 10.416 0 0 1-7.42-3.08l-35-35a10.5 10.5 0 0 1 14.84-14.84l25.102 25.102a3.528 3.528 0 0 0 4.956 0L97.58 87.08a10.5 10.5 0 1 1 14.84 14.84l-35 35A10.416 10.416 0 0 1 70 140z"/></svg>')}</div></nord-button></div>${this.renderError()}`}get options(){return Array.from(this.querySelectorAll("option"))}getButtonText(e){const t=e.find((e=>e.value===this.value));return t?t.text:this.placeholder?this.placeholder:e[0]?e[0].text:""}renderOption(e){return o`<option value="${s(e.value)}" ?disabled="${e.disabled}" ?selected="${e.value===this.value}">${e.text}</option>`}};v.styles=[u,b],v=n([r("nord-select")],v);var h=v;export{h as default}; | ||
//# sourceMappingURL=Select.js.map |
@@ -16,2 +16,3 @@ import { LitElement } from "lit"; | ||
static styles: import("lit").CSSResult; | ||
private slots; | ||
/** | ||
@@ -23,4 +24,2 @@ * Control the padding of the card component. | ||
render(): import("lit").TemplateResult<1>; | ||
private handleSlotChange; | ||
private hasSlottedContent; | ||
} | ||
@@ -27,0 +26,0 @@ declare global { |
@@ -1,2 +0,3 @@ | ||
import { LitElement } from "lit"; | ||
import { LitElement, TemplateResult } from "lit"; | ||
import { SlotController } from "../controllers/SlotController.js"; | ||
import { InputMixinInterface } from "./InputMixin.js"; | ||
@@ -7,5 +8,16 @@ declare type Constructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
required: boolean; | ||
hint?: string; | ||
hideLabel: boolean; | ||
placeholder?: string; | ||
error?: string; | ||
expand: boolean; | ||
protected inputId: string; | ||
protected slots: SlotController; | ||
protected handleChange(e: Event): void; | ||
protected renderLabel(): TemplateResult; | ||
protected renderError(): TemplateResult; | ||
protected getDescribedBy(): string | undefined; | ||
protected getInvalid(): "true" | undefined; | ||
} | ||
export declare function FormAssociatedMixin<T extends Constructor<InputMixinInterface & LitElement>>(superClass: T): Constructor<FormAssociatedMixinInterface> & T; | ||
export {}; |
@@ -12,1 +12,2 @@ export { default as Badge } from "./badge/Badge.js"; | ||
export { default as VisuallyHidden } from "./visually-hidden/VisuallyHidden.js"; | ||
export { default as Textarea } from "./textarea/Textarea.js"; |
@@ -16,3 +16,3 @@ import { LitElement } from "lit"; | ||
export default class Input extends Input_base { | ||
static styles: import("lit").CSSResult; | ||
static styles: import("lit").CSSResult[]; | ||
/** | ||
@@ -22,28 +22,3 @@ * The type of the input. | ||
type: "text" | "email" | "password" | "tel" | "url" | "search" | "number"; | ||
/** | ||
* Optional hint text to be displayed with input. Alternatively use the hint slot. | ||
*/ | ||
hint?: string; | ||
/** | ||
* Visually hide the label, but still show it to assistive technologies like screen readers. | ||
*/ | ||
hideLabel: boolean; | ||
/** | ||
* Placeholder of the input. | ||
*/ | ||
placeholder?: string; | ||
/** | ||
* Optional error to be shown with input. Alternatively use the error slot. | ||
*/ | ||
error?: string; | ||
/** | ||
* Controls whether the input expands to fill the width of its container. | ||
*/ | ||
expand: boolean; | ||
render(): import("lit").TemplateResult<1>; | ||
private renderLabel; | ||
private renderHint; | ||
private renderError; | ||
private handleSlotChange; | ||
private hasSlottedContent; | ||
} | ||
@@ -50,0 +25,0 @@ declare global { |
@@ -18,31 +18,7 @@ import { LitElement } from "lit"; | ||
static styles: import("lit").CSSResult[]; | ||
/** | ||
* Optional hint text to be displayed with select. Alternatively use the hint slot. | ||
*/ | ||
hint?: string; | ||
/** | ||
* Visually hide the label, but still show it to assistive technologies like screen readers. | ||
*/ | ||
hideLabel: boolean; | ||
/** | ||
* Hint text to display as the first option of the select element. | ||
*/ | ||
placeholder?: string; | ||
/** | ||
* Optional error to be shown with the select. Alternatively use the error slot. | ||
*/ | ||
error?: string; | ||
/** | ||
* Controls whether the select expands to fill the width of its container. | ||
*/ | ||
expand: boolean; | ||
protected inputId: string; | ||
render(): import("lit").TemplateResult<1>; | ||
private handleSlotChange; | ||
private get options(); | ||
private getButtonText; | ||
private renderLabel; | ||
private renderHint; | ||
private renderError; | ||
private renderOption; | ||
private hasSlottedContent; | ||
} | ||
@@ -49,0 +25,0 @@ declare global { |
{ | ||
"name": "@nordhealth/components", | ||
"version": "1.0.0-alpha.37", | ||
"version": "1.0.0-alpha.38", | ||
"description": "This package includes Nord Design System web components", | ||
@@ -140,3 +140,3 @@ "author": "Nordhealth <info@nordhealth.com>", | ||
}, | ||
"gitHead": "6fed149e7490b085733544197e3ca603b9427b53" | ||
"gitHead": "585a654eca3e91569e1093181f9791b65f32eb19" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
408151
102
5591