@nordhealth/components 4.9.0 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +2726 -2726
- package/lib/IconManager.js +1 -1
- package/lib/bundle.js +1 -1
- package/package.json +3 -3
package/lib/IconManager.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=e=>fetch(`https://nordcdn.net/ds/icons/3.
|
|
1
|
+
const e=e=>fetch(`https://nordcdn.net/ds/icons/3.13.0/assets/${e}.svg`).then((t=>{if(!t.ok)throw new TypeError(`NORD: unknown icon: '${e}'`);return t.text()}));class t{constructor(){this.cache=new Map,this.resolver=e}resolve(e,t){let r=this.cache.get(e);"string"!=typeof r?(r||(r=this.resolver(e).catch((()=>"")).then((t=>(this.cache.set(e,t),t))),this.cache.set(e,r)),r.then(t)):t(r)}registerIcon(e,t){let r,s;if("string"==typeof e?(r=e,s=t):(r=e.title,s=e.default),!r)throw new Error("name is required when registering an icon");if(!s)throw new Error("icon must not be empty");this.cache.set(r,s)}clear(){this.cache.clear()}}export{t as IconManager};
|
|
2
2
|
//# sourceMappingURL=IconManager.js.map
|
package/lib/bundle.js
CHANGED
|
@@ -86,7 +86,7 @@ const ft=t=>(e,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(t,e)
|
|
|
86
86
|
* Copyright 2017 Google LLC
|
|
87
87
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
88
88
|
*/
|
|
89
|
-
let Be=class extends Mt{constructor(t){if(super(t),this.it=H,t.type!==Nt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===H||null==t)return this._t=void 0,this.it=t;if(t===j)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Be.directiveName="unsafeHTML",Be.resultType=1;const Ie=Lt(Be),Ne=t=>fetch(`https://nordcdn.net/ds/icons/3.
|
|
89
|
+
let Be=class extends Mt{constructor(t){if(super(t),this.it=H,t.type!==Nt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===H||null==t)return this._t=void 0,this.it=t;if(t===j)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Be.directiveName="unsafeHTML",Be.resultType=1;const Ie=Lt(Be),Ne=t=>fetch(`https://nordcdn.net/ds/icons/3.13.0/assets/${t}.svg`).then((e=>{if(!e.ok)throw new TypeError(`NORD: unknown icon: '${t}'`);return e.text()}));const Le=i`:host{--_n-icon-size:var(--n-icon-size, var(--n-size-icon-m));display:inline-block;block-size:var(--_n-icon-size);inline-size:var(--_n-icon-size);min-inline-size:var(--_n-icon-size)}:host([size=xxs]){--_n-icon-size:var(--n-size-icon-xxs)}: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}`;class Me{constructor(t,e,n,o){this.host=t,this.key=e,this.cb=n,this.lifecycle=o,t.addController(this)}hostUpdate(){"update"===this.lifecycle&&this.handle()}hostUpdated(){"updated"===this.lifecycle&&this.handle()}handle(){const{key:t,_value:e,host:n}=this,o=n[t];e!==o&&(this._value=o,this.cb.call(n,e,o,t))}}function Pe(t,e="update"){return function(n,o){n.constructor.addInitializer((n=>{const r=n[o];n.addController(new Me(n,t,r,e))}))}}var Fe;let Ue=Fe=class extends lt{constructor(){super(...arguments),this.name="",this.svg=""}static registerResolver(t){this.manager.resolver=t}static registerIcon(t,e){return this.manager.registerIcon(t,e)}render(){return q`<div role="${Zt(this.label,"img")}" style="${Zt(this.color,`color:${this.color}`)}" aria-label="${Jt(this.label)}"><slot aria-hidden="true"></slot><div aria-hidden="true">${Ie(this.svg)}</div></div>`}handleNameChange(){this.name?Fe.manager.resolve(this.name,(t=>{this.svg=t})):this.svg=""}};Ue.styles=[$t,Le],Ue.manager=new class{constructor(){this.cache=new Map,this.resolver=Ne}resolve(t,e){let n=this.cache.get(t);"string"!=typeof n?(n||(n=this.resolver(t).catch((()=>"")).then((e=>(this.cache.set(t,e),e))),this.cache.set(t,n)),n.then(e)):e(n)}registerIcon(t,e){let n,o;if("string"==typeof t?(n=t,o=e):(n=t.title,o=t.default),!n)throw new Error("name is required when registering an icon");if(!o)throw new Error("icon must not be empty");this.cache.set(n,o)}clear(){this.cache.clear()}},mt([wt({reflect:!0})],Ue.prototype,"name",void 0),mt([wt({reflect:!0})],Ue.prototype,"size",void 0),mt([wt({reflect:!0})],Ue.prototype,"color",void 0),mt([wt({reflect:!0})],Ue.prototype,"label",void 0),mt([kt()],Ue.prototype,"svg",void 0),mt([Pe("name")],Ue.prototype,"handleNameChange",null),Ue=Fe=mt([ft("nord-icon")],Ue);var qe=Ue;qe.registerIcon(ge);const je=t=>t?`${t}px`:void 0;let He=class extends(Ee(ze(Se($e(Ce(re(oe(lt)))))))){constructor(){super(...arguments),this.startObserver=new Oe(this,(()=>this.startSlot)),this.endObserver=new Oe(this,(()=>this.endSlot)),this.direction=new Re(this),this.type="text",this.expand=!1,this.disallowPattern=void 0,this.handleInputChange=t=>{const e=t.target;this.disallowPattern&&function(t,e){const{value:n}=t,o=t.selectionStart,r=n.slice(0,o),i=n.slice(o,n.length),a=r.replace(e,""),s=a+i.replace(e,""),l=a.length;t.value=s,t.selectionStart=l,t.selectionEnd=l}(e,new RegExp(this.disallowPattern,"g")),this.handleInput(t)}}render(){var t;const e="number"===this.type;return q`${this.renderLabel()}<div class="${pe({"n-input-container":!0,"is-rtl":"rtl"===this.direction.dir})}" style="${be({"--_n-input-start-inline-size":je(this.startObserver.inlineSize),"--_n-input-end-inline-size":je(this.endObserver.inlineSize)})}"><slot name="start">${"search"===this.type?q`<nord-icon name="navigation-search"></nord-icon>`:H}</slot><input ${Xt(this.textSelectableRef)} ${Xt(this.focusableRef)} id="${this.inputId}" class="n-input" type="${e||"unit"===this.type?"text":this.type}" inputmode="${Zt(e,"numeric")}" pattern="${Zt(e,"[0-9]*")}" ?disabled="${this.disabled}" ?required="${this.required}" ?readonly="${this.readonly}" name="${Jt(this.name)}" .value="${null!==(t=this.value)&&void 0!==t?t:""}" placeholder="${Jt(this.placeholder)}" @input="${this.handleInputChange}" @change="${this.handleChange}" @keydown="${this.handleKeydown}" @select="${this.handleSelect}" aria-describedby="${Jt(this.getDescribedBy())}" aria-invalid="${Jt(this.getInvalid())}" spellcheck="false" autocomplete="${this.autocomplete}"><slot name="end"></slot></div>${this.renderError()}`}handleKeydown(t){if("Enter"!==t.key)return;const{form:e}=this;if(e){const t=function(t){let e=t.querySelector('button[type="submit"]');!e&&t.id&&(e=t.getRootNode().querySelector(`button[form=${t.id}]`));return e}(e);setTimeout((()=>null==t?void 0:t.click()),0)}}handleSelect(t){t.stopPropagation(),this.dispatchEvent(new fe("select"))}};He.styles=[$t,Ae,De,Te],mt([zt("slot[name='start']")],He.prototype,"startSlot",void 0),mt([zt("slot[name='end']")],He.prototype,"endSlot",void 0),mt([wt({reflect:!0})],He.prototype,"type",void 0),mt([wt({reflect:!0,type:Boolean})],He.prototype,"expand",void 0),mt([wt({reflect:!0,attribute:"disallow-pattern"})],He.prototype,"disallowPattern",void 0),He=mt([ft("nord-input")],He);var We=He;
|
|
90
90
|
/**
|
|
91
91
|
* @license
|
|
92
92
|
* Copyright 2017 Google LLC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhealth/components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "This package includes Nord Design System Web Components",
|
|
5
5
|
"author": "Nordhealth <support@nordhealth.design>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/dom": "^1.6.13",
|
|
39
|
-
"@nordhealth/icons": "^3.
|
|
39
|
+
"@nordhealth/icons": "^3.13.0",
|
|
40
40
|
"lit": "^3.3.0",
|
|
41
41
|
"qr": "^0.4.2",
|
|
42
42
|
"tinykeys": "^1.4.0"
|
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
}
|
|
180
180
|
]
|
|
181
181
|
},
|
|
182
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "7b03dd2a87fd5d38211f2511da1ac5d7cf854282"
|
|
183
183
|
}
|