@nordhealth/components 3.18.1 → 3.18.2-alpha.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/README.md +1 -1
- package/custom-elements.json +5497 -5497
- 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.5.
|
|
1
|
+
const e=e=>fetch(`https://nordcdn.net/ds/icons/3.5.2-alpha.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
|
@@ -87,7 +87,7 @@ const ft=t=>(e,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(t,e)
|
|
|
87
87
|
* Copyright 2017 Google LLC
|
|
88
88
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
89
89
|
*/
|
|
90
|
-
class Oe extends Mt{constructor(t){if(super(t),this.it=J,t.type!==Lt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===J||null==t)return this._t=void 0,this.it=t;if(t===Q)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:[]}}}Oe.directiveName="unsafeHTML",Oe.resultType=1;const Ne=Bt(Oe),Le=t=>fetch(`https://nordcdn.net/ds/icons/3.5.
|
|
90
|
+
class Oe extends Mt{constructor(t){if(super(t),this.it=J,t.type!==Lt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===J||null==t)return this._t=void 0,this.it=t;if(t===Q)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:[]}}}Oe.directiveName="unsafeHTML",Oe.resultType=1;const Ne=Bt(Oe),Le=t=>fetch(`https://nordcdn.net/ds/icons/3.5.2-alpha.0/assets/${t}.svg`).then((e=>{if(!e.ok)throw new TypeError(`NORD: unknown icon: '${t}'`);return e.text()}));const Be=u`: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 Ie(t,e="update"){return function(n,o){n.constructor.addInitializer((n=>{const r=n[o];n.addController(new Me(n,t,r,e))}))}}var Pe;let Fe=Pe=class extends bt{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 G`<div role="${Qt(this.label,"img")}" style="${Qt(this.color,`color:${this.color}`)}" aria-label="${Jt(this.label)}"><slot aria-hidden="true"></slot><div aria-hidden="true">${Ne(this.svg)}</div></div>`}handleNameChange(){this.name?Pe.manager.resolve(this.name,(t=>{this.svg=t})):this.svg=""}};Fe.styles=[zt,Be],Fe.manager=new class{constructor(){this.cache=new Map,this.resolver=Le}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()}},s([xt({reflect:!0})],Fe.prototype,"name",void 0),s([xt({reflect:!0})],Fe.prototype,"size",void 0),s([xt({reflect:!0})],Fe.prototype,"color",void 0),s([xt({reflect:!0})],Fe.prototype,"label",void 0),s([wt()],Fe.prototype,"svg",void 0),s([Ie("name")],Fe.prototype,"handleNameChange",null),Fe=Pe=s([ft("nord-icon")],Fe);var Ue=Fe;Ue.registerIcon(be);const qe=t=>t?`${t}px`:void 0;let He=class extends(Ce(_e($e(ze(Se(oe(ne(bt)))))))){constructor(){super(...arguments),this.startObserver=new Re(this,(()=>this.startSlot)),this.endObserver=new Re(this,(()=>this.endSlot)),this.direction=new Te(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 G`${this.renderLabel()}<div class="${he({"n-input-container":!0,"is-rtl":"rtl"===this.direction.dir})}" style="${ve({"--_n-input-start-inline-size":qe(this.startObserver.inlineSize),"--_n-input-end-inline-size":qe(this.endObserver.inlineSize)})}"><slot name="start">${"search"===this.type?G`<nord-icon name="navigation-search"></nord-icon>`:J}</slot><input ${Xt(this.textSelectableRef)} ${Xt(this.focusableRef)} id="${this.inputId}" class="n-input" type="${e||"unit"===this.type?"text":this.type}" inputmode="${Qt(e,"numeric")}" pattern="${Qt(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=[zt,Ee,Ae,De],s([_t("slot[name='start']")],He.prototype,"startSlot",void 0),s([_t("slot[name='end']")],He.prototype,"endSlot",void 0),s([xt({reflect:!0})],He.prototype,"type",void 0),s([xt({reflect:!0,type:Boolean})],He.prototype,"expand",void 0),s([xt({reflect:!0,attribute:"disallow-pattern"})],He.prototype,"disallowPattern",void 0),He=s([ft("nord-input")],He);var je=He;
|
|
91
91
|
/**
|
|
92
92
|
* @license
|
|
93
93
|
* Copyright 2017 Google LLC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhealth/components",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.2-alpha.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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/dom": "^1.6.11",
|
|
37
|
-
"@nordhealth/icons": "^3.5.
|
|
37
|
+
"@nordhealth/icons": "^3.5.2-alpha.0",
|
|
38
38
|
"lit": "^3.2.0",
|
|
39
39
|
"qr-creator": "^1.0.0",
|
|
40
40
|
"tinykeys": "^1.4.0"
|
|
@@ -175,5 +175,5 @@
|
|
|
175
175
|
}
|
|
176
176
|
]
|
|
177
177
|
},
|
|
178
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "952fe995c2d89ffa3ab9a81f4db1abe8d35dc76f"
|
|
179
179
|
}
|