@warp-ds/elements 2.10.0-next.12 → 2.10.0-next.14
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/dist/custom-elements.json +12 -0
- package/dist/packages/affix/affix.js +8 -8
- package/dist/packages/affix/affix.js.map +3 -3
- package/dist/packages/alert/alert.js +7 -7
- package/dist/packages/alert/alert.js.map +3 -3
- package/dist/packages/attention/attention.js +42 -21
- package/dist/packages/attention/attention.js.map +3 -3
- package/dist/packages/badge/badge.js +6 -6
- package/dist/packages/badge/badge.js.map +3 -3
- package/dist/packages/box/box.js +6 -6
- package/dist/packages/box/box.js.map +3 -3
- package/dist/packages/breadcrumbs/breadcrumbs.js +7 -7
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
- package/dist/packages/button/button.js +37 -16
- package/dist/packages/button/button.js.map +3 -3
- package/dist/packages/button/styles.js +18 -2
- package/dist/packages/card/card.js +8 -8
- package/dist/packages/card/card.js.map +3 -3
- package/dist/packages/checkbox/checkbox.js +9 -9
- package/dist/packages/checkbox/checkbox.js.map +3 -3
- package/dist/packages/combobox/combobox.js +9 -9
- package/dist/packages/combobox/combobox.js.map +3 -3
- package/dist/packages/datepicker/DatePicker.test.js +5 -3
- package/dist/packages/datepicker/datepicker.js +51 -50
- package/dist/packages/datepicker/datepicker.js.map +3 -3
- package/dist/packages/datepicker/datepicker.test.js +1 -1
- package/dist/packages/datepicker/utils.d.ts +3 -0
- package/dist/packages/datepicker/utils.js +33 -0
- package/dist/packages/datepicker/utils.test.d.ts +1 -0
- package/dist/packages/datepicker/utils.test.js +29 -0
- package/dist/packages/expandable/expandable.js +14 -14
- package/dist/packages/expandable/expandable.js.map +3 -3
- package/dist/packages/link/link.js +40 -19
- package/dist/packages/link/link.js.map +3 -3
- package/dist/packages/link/styles.js +5 -0
- package/dist/packages/modal/modal.js +7 -7
- package/dist/packages/modal/modal.js.map +3 -3
- package/dist/packages/modal-footer/modal-footer.js +7 -7
- package/dist/packages/modal-footer/modal-footer.js.map +3 -3
- package/dist/packages/modal-header/modal-header.js +10 -10
- package/dist/packages/modal-header/modal-header.js.map +3 -3
- package/dist/packages/pagination/pagination.js +8 -8
- package/dist/packages/pagination/pagination.js.map +3 -3
- package/dist/packages/pill/pill.js +9 -9
- package/dist/packages/pill/pill.js.map +3 -3
- package/dist/packages/radio/radio.js +8 -8
- package/dist/packages/radio/radio.js.map +3 -3
- package/dist/packages/radio-group/radio-group.js +11 -11
- package/dist/packages/radio-group/radio-group.js.map +3 -3
- package/dist/packages/select/select.js +13 -13
- package/dist/packages/select/select.js.map +3 -3
- package/dist/packages/slider/slider.js +13 -13
- package/dist/packages/slider/slider.js.map +3 -3
- package/dist/packages/slider/styles.js +2 -2
- package/dist/packages/slider-thumb/slider-thumb.js +11 -11
- package/dist/packages/slider-thumb/slider-thumb.js.map +3 -3
- package/dist/packages/step/step.js +10 -10
- package/dist/packages/step/step.js.map +3 -3
- package/dist/packages/step-indicator/step-indicator.js +6 -6
- package/dist/packages/step-indicator/step-indicator.js.map +3 -3
- package/dist/packages/styles.js +4 -2
- package/dist/packages/switch/switch.js +6 -6
- package/dist/packages/switch/switch.js.map +3 -3
- package/dist/packages/tab/tab.js +7 -7
- package/dist/packages/tab/tab.js.map +3 -3
- package/dist/packages/tab-panel/tab-panel.js +5 -5
- package/dist/packages/tab-panel/tab-panel.js.map +3 -3
- package/dist/packages/tabs/tabs.js +6 -6
- package/dist/packages/tabs/tabs.js.map +3 -3
- package/dist/packages/textarea/textarea.js +10 -10
- package/dist/packages/textarea/textarea.js.map +3 -3
- package/dist/packages/textfield/textfield.js +10 -10
- package/dist/packages/textfield/textfield.js.map +3 -3
- package/dist/packages/toast/styles.js +2 -2
- package/dist/packages/toast/toast.js +12 -12
- package/dist/packages/toast/toast.js.map +3 -3
- package/dist/packages/toast-container/toast-container.js +8 -8
- package/dist/packages/toast-container/toast-container.js.map +3 -3
- package/dist/web-types.json +1 -1
- package/eik/index.js +16 -2455
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Le=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var de=o=>{throw TypeError(o)};var p=(o,r,e,t)=>{for(var a=t>1?void 0:t?Ie(r,e):r,i=o.length-1,n;i>=0;i--)(n=o[i])&&(a=(t?n(r,e,a):n(a))||a);return t&&a&&Le(r,e,a),a};var Q=(o,r,e)=>r.has(o)||de("Cannot "+e);var B=(o,r,e)=>(Q(o,r,"read from private field"),e?e.call(o):r.get(o)),X=(o,r,e)=>r.has(o)?de("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),ee=(o,r,e,t)=>(Q(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e),Z=(o,r,e)=>(Q(o,r,"access private method"),e);var Y=function(){for(var o=[],r=arguments.length;r--;)o[r]=arguments[r];return o.reduce(function(e,t){return e.concat(typeof t=="string"?t:Array.isArray(t)?Y.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(a){return t[a]?a:""}):"")},[]).join(" ")};var M=o=>typeof o=="string",De=o=>typeof o=="function",ue=new Map,pe="en";function ae(o){return[...Array.isArray(o)?o:[o],pe]}function ie(o,r,e){let t=ae(o);e||(e="default");let a;if(typeof e=="string")switch(a={day:"numeric",month:"short",year:"numeric"},e){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=e;return q(()=>K("date",t,e),()=>new Intl.DateTimeFormat(t,a)).format(M(r)?new Date(r):r)}function $e(o,r,e){let t;if(e||(e="default"),typeof e=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},e){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=e;return ie(o,r,t)}function re(o,r,e){let t=ae(o);return q(()=>K("number",t,e),()=>new Intl.NumberFormat(t,e)).format(r)}function he(o,r,e,{offset:t=0,...a}){let i=ae(o),n=r?q(()=>K("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):q(()=>K("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return a[e]??a[n.select(e-t)]??a.other}function q(o,r){let e=o(),t=ue.get(e);return t||(t=r(),ue.set(e,t)),t}function K(o,r,e){let t=r.join("-");return`${o}-${t}-${JSON.stringify(e)}`}var be=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,ge=o=>o.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(r,e,t)=>{if(e){let a=parseInt(e,16);return String.fromCharCode(a)}else{let a=parseInt(t,16);return String.fromCharCode(a)}}),ve="%__lingui_octothorpe__%",Te=(o,r,e={})=>{let t=r||o,a=n=>typeof n=="object"?n:e[n],i=(n,s)=>{let u=Object.keys(e).length?a("number"):void 0,f=re(t,n,u);return s.replace(new RegExp(ve,"g"),f)};return{plural:(n,s)=>{let{offset:u=0}=s,f=he(t,!1,n,s);return i(n-u,f)},selectordinal:(n,s)=>{let{offset:u=0}=s,f=he(t,!0,n,s);return i(n-u,f)},select:Ne,number:(n,s)=>re(t,n,a(s)||{style:s}),date:(n,s)=>ie(t,n,a(s)||s),time:(n,s)=>$e(t,n,a(s)||s)}},Ne=(o,r)=>r[o]??r.other;function Pe(o,r,e){return(t={},a)=>{let i=Te(r,e,a),n=(u,f=!1)=>Array.isArray(u)?u.reduce((O,C)=>{if(C==="#"&&f)return O+ve;if(M(C))return O+C;let[L,x,z]=C,E={};x==="plural"||x==="selectordinal"||x==="select"?Object.entries(z).forEach(([F,T])=>{E[F]=n(T,x==="plural"||x==="selectordinal")}):E=z;let w;if(x){let F=i[x];w=F(t[L],E)}else w=t[L];return w==null?O:O+w},""):u,s=n(o);return M(s)&&be.test(s)?ge(s):M(s)?s:s?String(s):""}}var Re=Object.defineProperty,je=(o,r,e)=>r in o?Re(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,Ye=(o,r,e)=>(je(o,typeof r!="symbol"?r+"":r,e),e),te=class{constructor(){Ye(this,"_events",{})}on(r,e){var t;return(t=this._events)[r]??(t[r]=[]),this._events[r].push(e),()=>this.removeListener(r,e)}removeListener(r,e){let t=this._getListeners(r);if(!t)return;let a=t.indexOf(e);~a&&t.splice(a,1)}emit(r,...e){let t=this._getListeners(r);t&&t.map(a=>a.apply(this,e))}_getListeners(r){let e=this._events[r];return Array.isArray(e)?e:!1}},Ue=Object.defineProperty,Be=(o,r,e)=>r in o?Ue(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,A=(o,r,e)=>(Be(o,typeof r!="symbol"?r+"":r,e),e),oe=class extends te{constructor(r){super(),A(this,"_locale",""),A(this,"_locales"),A(this,"_localeData",{}),A(this,"_messages",{}),A(this,"_missing"),A(this,"_messageCompiler"),A(this,"t",this._.bind(this)),r.missing!=null&&(this._missing=r.missing),r.messages!=null&&this.load(r.messages),r.localeData!=null&&this.loadLocaleData(r.localeData),(typeof r.locale=="string"||r.locales)&&this.activate(r.locale??pe,r.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(r,e){let t=this._localeData[r];t?Object.assign(t,e):this._localeData[r]=e}setMessagesCompiler(r){return this._messageCompiler=r,this}loadLocaleData(r,e){typeof r=="string"?this._loadLocaleData(r,e):Object.keys(r).forEach(t=>this._loadLocaleData(t,r[t])),this.emit("change")}_load(r,e){let t=this._messages[r];t?Object.assign(t,e):this._messages[r]=e}load(r,e){typeof r=="string"&&typeof e=="object"?this._load(r,e):Object.entries(r).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:r,locales:e,messages:t}){this._locale=r,this._locales=e||void 0,this._messages[this._locale]=t,this.emit("change")}activate(r,e){this._locale=r,this._locales=e,this.emit("change")}_(r,e,t){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=t?.message;r||(r=""),M(r)||(e=r.values||e,a=r.message,r=r.id);let i=this.messages[r],n=i===void 0,s=this._missing;if(s&&n)return De(s)?s(this._locale,r):s;n&&this.emit("missing",{id:r,locale:this._locale});let u=i||a||r;return M(u)&&(this._messageCompiler?u=this._messageCompiler(u):console.warn(`Uncompiled message detected! Message:
|
|
2
2
|
|
|
3
3
|
> ${u}
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
6
6
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
7
7
|
|
|
8
8
|
Please compile your catalog first.
|
|
9
|
-
`)),M(u)&&be.test(u)?ge(u):M(u)?u:
|
|
9
|
+
`)),M(u)&&be.test(u)?ge(u):M(u)?u:Pe(u,this._locale,this._locales)(e,t?.formats)}date(r,e){return ie(this._locales||this._locale,r,e)}number(r,e){return re(this._locales||this._locale,r,e)}};function Xe(o={}){return new oe(o)}var y=Xe();var d=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},g=function(o,r,e,t,a){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!a:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(o,e):a?a.value=e:r.set(o,e),e};function me(o){var r,e,t,a,i,n,s,u,f,O,C,L,x,z,E,w,F,T,H;class Ve extends o{constructor(...l){var c,b,v;super(...l),r.add(this),this.internals=this.attachInternals(),e.set(this,!1),t.set(this,!1),a.set(this,!1),i.set(this,void 0),n.set(this,void 0),s.set(this,!0),f.set(this,""),O.set(this,()=>{g(this,a,!0,"f"),g(this,e,!0,"f"),d(this,r,"m",w).call(this)}),C.set(this,()=>{g(this,e,!1,"f"),d(this,r,"m",F).call(this,this.shouldFormValueUpdate()?d(this,f,"f"):""),!this.validity.valid&&d(this,a,"f")&&g(this,t,!0,"f");let _=d(this,r,"m",w).call(this);this.validationMessageCallback&&this.validationMessageCallback(_?this.internals.validationMessage:"")}),L.set(this,()=>{var _;d(this,s,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),g(this,s,!1,"f")),g(this,a,!0,"f"),g(this,t,!0,"f"),d(this,r,"m",w).call(this),(_=this===null||this===void 0?void 0:this.validationMessageCallback)===null||_===void 0||_.call(this,this.showError?this.internals.validationMessage:"")}),x.set(this,void 0),z.set(this,!1),E.set(this,Promise.resolve()),(c=this.addEventListener)===null||c===void 0||c.call(this,"focus",d(this,O,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"blur",d(this,C,"f")),(v=this.addEventListener)===null||v===void 0||v.call(this,"invalid",d(this,L,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let l=this.validators.map(v=>v.attribute).flat(),c=super.observedAttributes||[];return[...new Set([...c,...l])]}static getValidator(l){return this.validators.find(c=>c.attribute===l)||null}static getValidators(l){return this.validators.filter(c=>{var b;if(c.attribute===l||!((b=c.attribute)===null||b===void 0)&&b.includes(l))return!0})}get form(){return this.internals.form}get showError(){return d(this,r,"m",w).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(l,c,b){var v;(v=super.attributeChangedCallback)===null||v===void 0||v.call(this,l,c,b);let P=this.constructor.getValidators(l);P?.length&&this.validationTarget&&this.setValue(d(this,f,"f"))}setValue(l){var c;g(this,t,!1,"f"),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,""),g(this,f,l,"f");let v=this.shouldFormValueUpdate()?l:null;this.internals.setFormValue(v),d(this,r,"m",F).call(this,v),this.valueChangedCallback&&this.valueChangedCallback(v),d(this,r,"m",w).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(l=>l(d(this,E,"f")))}formResetCallback(){var l,c;g(this,a,!1,"f"),g(this,t,!1,"f"),d(this,r,"m",w).call(this),(l=this.resetFormControl)===null||l===void 0||l.call(this),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,d(this,r,"m",w).call(this)?this.validationMessage:"")}}return e=new WeakMap,t=new WeakMap,a=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,f=new WeakMap,O=new WeakMap,C=new WeakMap,L=new WeakMap,x=new WeakMap,z=new WeakMap,E=new WeakMap,r=new WeakSet,u=function(){let l=this.getRootNode(),c=`${this.localName}[name="${this.getAttribute("name")}"]`;return l.querySelectorAll(c)},w=function(){if(this.hasAttribute("disabled"))return!1;let l=d(this,t,"f")||d(this,a,"f")&&!this.validity.valid&&!d(this,e,"f");return l&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),l},F=function(l){let c=this.constructor,b={},v=c.validators,_=[],P=v.some(k=>k.isValid instanceof Promise);d(this,z,"f")||(g(this,E,new Promise(k=>{g(this,x,k,"f")}),"f"),g(this,z,!0,"f")),d(this,i,"f")&&(d(this,i,"f").abort(),g(this,n,d(this,i,"f"),"f"));let R=new AbortController;g(this,i,R,"f");let j,ce=!1;v.length&&(v.forEach(k=>{let J=k.key||"customError",I=k.isValid(this,l,R.signal);I instanceof Promise?(_.push(I),I.then(W=>{W!=null&&(b[J]=!W,j=d(this,r,"m",H).call(this,k,l),d(this,r,"m",T).call(this,b,j))})):(b[J]=!I,this.validity[J]!==!I&&(ce=!0),!I&&!j&&(j=d(this,r,"m",H).call(this,k,l)))}),Promise.allSettled(_).then(()=>{var k;R?.signal.aborted||(g(this,z,!1,"f"),(k=d(this,x,"f"))===null||k===void 0||k.call(this))}),(ce||!P)&&d(this,r,"m",T).call(this,b,j))},T=function(l,c){if(this.validationTarget)this.internals.setValidity(l,c,this.validationTarget),g(this,s,!1,"f");else{if(this.internals.setValidity(l,c),this.internals.validity.valid)return;g(this,s,!0,"f")}},H=function(l,c){if(this.validityCallback){let b=this.validityCallback(l.key||"customError");if(b)return b}return l.message instanceof Function?l.message(this,c):l.message},Ve}import{html as se,LitElement as er}from"lit";import{property as m,state as D}from"lit/decorators.js";import{repeat as rr}from"lit/directives/repeat.js";import{ifDefined as tr}from"lit/directives/if-defined.js";var Ze=["en","nb","fi","da","sv"],ne="en",G=o=>Ze.find(r=>o===r||o.toLowerCase().includes(r))||ne;function xe(){if(typeof window>"u"){let o=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return G(o)}try{let o=we(document);if(o)return G(o);let r=He();if(r)return G(r);let e=we(_e());return e?G(e):ne}catch(o){return console.warn("could not detect locale, falling back to source locale",o),ne}}var ke=(o,r,e,t,a)=>{y.load("en",o),y.load("nb",r),y.load("fi",e),y.load("da",t),y.load("sv",a);let i=xe();y.activate(i),ye(),Ke()},qe="warp-i18n-change";function ye(){typeof window>"u"||window.dispatchEvent(new Event(qe))}var fe=!1;function Ke(){if(fe||typeof window>"u"||!document?.documentElement)return;fe=!0;let o=()=>{let a=xe();y.locale!==a&&(y.activate(a),ye())},r=new MutationObserver(a=>{for(let i of a)if(i.type==="attributes"&&i.attributeName==="lang"){o();break}});r.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let e=_e();e&&e.documentElement&&e!==document&&r.observe(e.documentElement,{attributes:!0,attributeFilter:["lang"]});let t=Ge();t&&r.observe(t,{attributes:!0,attributeFilter:["lang"]})}function _e(){try{return window.parent?.document??null}catch{return null}}function we(o){try{return o?.documentElement?.lang??""}catch{return""}}function Ge(){try{return window.frameElement??null}catch{return null}}function He(){try{return window.frameElement?.getAttribute?.("lang")??""}catch{return""}}import{css as Je}from"lit";import{unsafeCSS as We}from"lit";var Oe=Je`
|
|
10
10
|
*,
|
|
11
11
|
:before,
|
|
12
12
|
:after {
|
|
@@ -279,7 +279,7 @@ Please compile your catalog first.
|
|
|
279
279
|
svg {
|
|
280
280
|
pointer-events: none;
|
|
281
281
|
}
|
|
282
|
-
`,
|
|
282
|
+
`,pr=We(`*, :before, :after {
|
|
283
283
|
--w-rotate: 0;
|
|
284
284
|
--w-rotate-x: 0;
|
|
285
285
|
--w-rotate-y: 0;
|
|
@@ -2144,8 +2144,8 @@ Please compile your catalog first.
|
|
|
2144
2144
|
overflow-wrap: break-word
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
|
-
.before\\:content-\\[\\"
|
|
2148
|
-
content: "
|
|
2147
|
+
.before\\:content-\\[\\"\xE2\u20AC\u201C\\"\\]:before {
|
|
2148
|
+
content: "\xE2\u20AC\u201C"
|
|
2149
2149
|
}
|
|
2150
2150
|
|
|
2151
2151
|
.before\\:content-\\[\\"\\"\\]:before {
|
|
@@ -2445,7 +2445,7 @@ Please compile your catalog first.
|
|
|
2445
2445
|
display: none
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
|
-
|
|
2448
|
+
`);var Ce=JSON.parse('{"combobox.aria.noResults":["Ingen resultater"],"combobox.aria.noSuggestions":["Ingen forslag"],"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.pluralSuggestions":[["numSuggestions","plural",{"one":["#"," forslag"],"other":["#"," forslag"]}]]}');var ze=JSON.parse('{"combobox.aria.noResults":["No results"],"combobox.aria.noSuggestions":["No suggestions"],"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," result"],"other":["#"," results"]}]],"combobox.aria.pluralSuggestions":[["numSuggestions","plural",{"one":["#"," suggestion"],"other":["#"," suggestions"]}]]}');var Ee=JSON.parse('{"combobox.aria.noResults":["Ei tuloksia"],"combobox.aria.noSuggestions":["Ei ehdotuksia"],"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," tulos"],"other":["#"," tulosta"]}]],"combobox.aria.pluralSuggestions":[["numSuggestions","plural",{"one":["#"," ehdotus"],"other":["#"," ehdotusta"]}]]}');var Me=JSON.parse('{"combobox.aria.noResults":["Ingen resultater"],"combobox.aria.noSuggestions":["Ingen forslag"],"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.pluralSuggestions":[["numSuggestions","plural",{"one":["#"," forslag"],"other":["#"," forslag"]}]]}');var Se=JSON.parse('{"combobox.aria.noResults":["Inga resultat"],"combobox.aria.noSuggestions":["Inga f\xF6rslag"],"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultat"]}]],"combobox.aria.pluralSuggestions":[["numSuggestions","plural",{"one":["#"," f\xF6rslag"],"other":["#"," f\xF6rslag"]}]]}');import{unsafeCSS as Qe}from"lit";var Fe=Qe("*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.rounded-8{border-radius:8px}.block{display:block}.overflow-hidden{overflow:hidden}.list-none{list-style-type:none}.left-0{left:0}.right-0{right:0}.absolute{position:absolute}.relative{position:relative}.static{position:static}.z-0{z-index:0}.z-20{z-index:20}.s-bg{background-color:var(--w-s-color-background)}.s-bg-selected{background-color:var(--w-s-color-background-selected)}.hover\\:s-bg-hover:hover{background-color:var(--w-s-color-background-hover)}.hover\\:s-bg-selected-hover:hover{background-color:var(--w-s-color-background-selected-hover)}.shadow-m{box-shadow:var(--w-shadow-m)}.m-0{margin:0}.p-0{padding:0}.p-8{padding:.8rem}.pb-4{padding-bottom:.4rem}.visible{visibility:visible}.cursor-pointer{cursor:pointer}.font-bold{font-weight:700}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.select-none{-webkit-user-select:none;user-select:none}");var S={wrapper:"relative z-0",base:"absolute z-20 left-0 right-0 s-bg pb-4 rounded-8 overflow-hidden shadow-m",listbox:"m-0 p-0 select-none list-none",option:"block cursor-pointer p-8",optionUnselected:"hover:s-bg-hover",optionSelected:"s-bg-selected hover:s-bg-selected-hover",textMatch:"font-bold",a11y:"sr-only"},U,$,V,Ae,le,h=class extends me(er){constructor(){super();X(this,V);this.options=[];this.label="";this.placeholder="";this.value="";this.openOnFocus=!1;this.selectOnBlur=!0;this.matchTextSegments=!1;this.disableStaticFiltering=!1;this.invalid=!1;this.helpText="";this.disabled=!1;this.required=!1;this.optional=!1;this.name="";this.autocomplete="off";this._isOpen=!1;this._navigationOption=null;this._currentOptions=[];this._lightDomOptions=[];this._optionIdCounter=0;this._displayValue="";X(this,U,"");X(this,$);ke(ze,Me,Ee,Ce,Se)}firstUpdated(e){ee(this,U,this.value)}updated(e){e.has("value")&&this.setValue(this.value)}resetFormControl(){this.value=B(this,U)}connectedCallback(){super.connectedCallback(),Z(this,V,le).call(this),ee(this,$,new MutationObserver(()=>{Z(this,V,le).call(this)})),B(this,$).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["label","value"]})}disconnectedCallback(){super.disconnectedCallback(),B(this,$)?.disconnect()}get _listboxId(){return`${this._id}-listbox`}get _id(){return"combobox"}get _helpId(){return this.helpText?`${this._id}__hint`:void 0}get _sourceOptions(){return Array.isArray(this.options)&&this.options.length?this.options:this._lightDomOptions}get _navigationLabelOrDisplayValue(){return this._navigationOption?this._navigationOption.label||this._navigationOption.value:this._displayValue}get _navigationValueOrInputValue(){return this._navigationOption?.value||this.value}_createOptionsWithIdAndMatch(e,t){return e.map((a,i)=>({...a,id:`${this._id}-option-${this._optionIdCounter+i}`,key:a.key||a.value,currentInputValue:t}))}_getAriaText(e,t,a){if(!e||!a)return"";let i=e.filter(u=>(u.label||u.value).toLowerCase().includes(t.toLowerCase())),n=y._({id:"combobox.aria.pluralSuggestions",message:"{numSuggestions, plural, one {# suggestion} other {# suggestions}}",comment:"Aria text for combobox when there are one or more suggestions",values:{numSuggestions:i.length}}),s=y._({id:"combobox.aria.noSuggestions",message:"No suggestions",comment:"Aria text for combobox when no suggestions"});return i.length?n:s}_getOptionClasses(e){return Y(S.option,this._navigationOption?.id===e?.id?S.optionSelected:S.optionUnselected)}_handleKeyDown(e){let t=["ArrowDown","ArrowUp","PageUp","PageDown","Home","End"].includes(e.key),a=["ArrowDown","ArrowLeft","ArrowUp","ArrowRight"];if(t&&!this._isOpen){this._isOpen=!0;return}if(t&&this._isOpen){this._findAndSetActiveOption(e);return}if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.key){case"Enter":this._navigationOption&&(e.preventDefault(),this._handleSelect(this._navigationOption),requestAnimationFrame(()=>{let n=this.shadowRoot?.querySelector("w-textfield")?.shadowRoot?.querySelector("input");n&&(n.value=this._displayValue)})),this._isOpen=!1;break;case"Tab":case"Delete":this._isOpen=!1;break;case"Escape":this._isOpen?this._isOpen=!1:this._handleChange(""),this._navigationOption=null;break;case"Backspace":this._handleChange(this._navigationLabelOrDisplayValue),this._navigationOption=null,this._isOpen=!0;break;default:if(a.includes(e.key))break;this._isOpen=!0,this._navigationOption?(this._handleChange(this._navigationOption.value),this._navigationOption=null):this._handleChange(this.value);break}}_findAndSetActiveOption(e){e.preventDefault();let t=this._currentOptions.findIndex(n=>n.id===this._navigationOption?.id),a=t+1,i=t-1;switch(e.key){case"ArrowDown":this._navigationOption=a>this._currentOptions.length-1?null:this._currentOptions[a];break;case"ArrowUp":this._navigationOption=i===-2?this._currentOptions[this._currentOptions.length-1]:i<0?null:this._currentOptions[i];break;case"PageUp":this._navigationOption=t-10<0?this._currentOptions[0]:this._currentOptions[t-10];break;case"PageDown":this._navigationOption=t+10>this._currentOptions.length-1?this._currentOptions[this._currentOptions.length-1]:this._currentOptions[t+10];break;case"Home":this._navigationOption=this._currentOptions[0];break;case"End":this._navigationOption=this._currentOptions[this._currentOptions.length-1];break}}_handleSelect(e){this.value=e.value,this._displayValue=e.label||e.value,this.setValue(this.value);let t=new CustomEvent("select",{detail:{value:e.value},bubbles:!0,composed:!0});this.dispatchEvent(t),this._isOpen=!1,this._navigationOption=null,this.disableStaticFiltering&&(this._currentOptions=[])}_handleChange(e){if(e===void 0)return;this.value=e,this._displayValue=e;let t=new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}_handleFocus(){if(!this.openOnFocus)return;let e=new CustomEvent("focus",{bubbles:!0,composed:!0});this.dispatchEvent(e),this._isOpen=!0}_handleBlur(e){let t=e.relatedTarget;if(t&&this.shadowRoot?.contains(t))return;if(this._isOpen=!1,this.selectOnBlur&&(this._navigationOption||!this._navigationOption&&this._currentOptions.findIndex(i=>i.value===this.value)!==-1)){let i=this._navigationOption?.value||this.value;this.value=i;let n=new CustomEvent("select",{detail:{value:i},bubbles:!0,composed:!0});this.dispatchEvent(n)}this._navigationOption=null;let a=new CustomEvent("blur",{detail:{value:this._navigationValueOrInputValue},bubbles:!0,composed:!0});this.dispatchEvent(a)}_handleOptionClick(e,t){this._handleSelect(t),requestAnimationFrame(()=>{let i=this.shadowRoot?.querySelector("w-textfield")?.shadowRoot?.querySelector("input");i&&(i.value=t.label||t.value)})}_handleContainerBlur(e){(!e.currentTarget||!e.currentTarget.contains(e.relatedTarget))&&(this._isOpen=!1)}_renderTextMatch(e,t){if(!this.matchTextSegments)return e;let a=e.toLowerCase().indexOf(t.currentInputValue.toLowerCase());if(a!==-1){let i=a+t.currentInputValue.length;return se`${e.substring(0,a)}<span
|
|
2449
2449
|
class="${S.textMatch}"
|
|
2450
2450
|
>${e.substring(a,i)}</span
|
|
2451
2451
|
>${e.substring(i)}`}return e}willUpdate(e){let t=this._sourceOptions,a=e.has("_lightDomOptions");if(e.has("value")||e.has("options")||a){let i=t.find(s=>s.value===this.value),n=i?i.label||i.value:this.value;this._displayValue!==n&&this._displayValue!==this.value&&(this._displayValue=n),!this._displayValue&&this.value&&(this._displayValue=n)}(e.has("options")||a||e.has("value")||e.has("disableStaticFiltering")||e.has("_displayValue"))&&(this._optionIdCounter+=t.length,this._currentOptions=this._createOptionsWithIdAndMatch(t,this._displayValue).filter(i=>this.disableStaticFiltering?!0:(i.label||i.value).toLowerCase().includes(this._displayValue.toLowerCase()))),this.disableStaticFiltering&&this._currentOptions.length&&this._currentOptions.length===1&&!this._currentOptions.some(i=>i.value===this.value)&&!this._isOpen&&(this._isOpen=!0)}render(){return se`
|
|
@@ -2468,7 +2468,7 @@ Please compile your catalog first.
|
|
|
2468
2468
|
role="combobox"
|
|
2469
2469
|
aria-autocomplete="list"
|
|
2470
2470
|
aria-expanded=${this._isOpen&&this._currentOptions.length!==0}
|
|
2471
|
-
aria-activedescendant=${
|
|
2471
|
+
aria-activedescendant=${tr(this._isOpen?this._navigationOption?.id:void 0)}
|
|
2472
2472
|
aria-controls=${this._listboxId}
|
|
2473
2473
|
@input=${e=>this._handleChange(e?.detail?.value)}
|
|
2474
2474
|
@focus=${this._handleFocus}
|
|
@@ -2489,7 +2489,7 @@ Please compile your catalog first.
|
|
|
2489
2489
|
role="listbox"
|
|
2490
2490
|
class="${S.listbox}"
|
|
2491
2491
|
>
|
|
2492
|
-
${
|
|
2492
|
+
${rr(this._currentOptions,e=>e.key,e=>{let t=e.label||e.value;return se`
|
|
2493
2493
|
<li
|
|
2494
2494
|
id=${e.id}
|
|
2495
2495
|
role="option"
|
|
@@ -2504,5 +2504,5 @@ Please compile your catalog first.
|
|
|
2504
2504
|
</ul>
|
|
2505
2505
|
</div>
|
|
2506
2506
|
</div>
|
|
2507
|
-
`}};U=new WeakMap,$=new WeakMap,V=new WeakSet,
|
|
2507
|
+
`}};U=new WeakMap,$=new WeakMap,V=new WeakSet,Ae=function(){return Array.from(this.children).filter(e=>e.tagName.toLowerCase()==="option")},le=function(){this._lightDomOptions=Z(this,V,Ae).call(this).map(e=>{let t=e.getAttribute("value")??"",a=e.hasAttribute("label")?e.getAttribute("label")??"":e.textContent??"";return{value:t,label:a,key:t}})},h.styles=[Oe,Fe],p([m({type:Array})],h.prototype,"options",2),p([m({type:String,reflect:!0,useDefault:!0})],h.prototype,"label",2),p([m({type:String,reflect:!0,useDefault:!0})],h.prototype,"placeholder",2),p([m({type:String,reflect:!0,useDefault:!0})],h.prototype,"value",2),p([m({type:Boolean,attribute:"open-on-focus",reflect:!0})],h.prototype,"openOnFocus",2),p([m({type:Boolean,attribute:"select-on-blur",reflect:!0,useDefault:!0})],h.prototype,"selectOnBlur",2),p([m({type:Boolean,attribute:"match-text-segments",reflect:!0})],h.prototype,"matchTextSegments",2),p([m({type:Boolean,attribute:"disable-static-filtering",reflect:!0})],h.prototype,"disableStaticFiltering",2),p([m({type:Boolean,reflect:!0})],h.prototype,"invalid",2),p([m({type:String,attribute:"help-text",reflect:!0,useDefault:!0})],h.prototype,"helpText",2),p([m({type:Boolean,reflect:!0})],h.prototype,"disabled",2),p([m({type:Boolean,reflect:!0})],h.prototype,"required",2),p([m({type:Boolean,reflect:!0})],h.prototype,"optional",2),p([m({type:String,reflect:!0,useDefault:!0})],h.prototype,"name",2),p([m({type:String,reflect:!0,useDefault:!0})],h.prototype,"autocomplete",2),p([D()],h.prototype,"_isOpen",2),p([D()],h.prototype,"_navigationOption",2),p([D()],h.prototype,"_currentOptions",2),p([D()],h.prototype,"_lightDomOptions",2),p([D()],h.prototype,"_optionIdCounter",2),p([D()],h.prototype,"_displayValue",2);customElements.get("w-combobox")||customElements.define("w-combobox",h);export{h as WarpCombobox};
|
|
2508
2508
|
//# sourceMappingURL=combobox.js.map
|