@warp-ds/elements 2.6.0 → 2.7.0-next.2
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 +1552 -0
- package/dist/index.d.ts +561 -0
- package/dist/packages/affix/affix.js +11 -11
- 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 +22 -22
- package/dist/packages/attention/attention.js.map +3 -3
- package/dist/packages/breadcrumbs/breadcrumbs.js +9 -9
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
- package/dist/packages/button/button.js +11 -11
- package/dist/packages/button/button.js.map +3 -3
- package/dist/packages/card/card.js +8 -8
- package/dist/packages/card/card.js.map +3 -3
- package/dist/packages/checkbox/checkbox.a11y.test.d.ts +1 -0
- package/dist/packages/checkbox/checkbox.a11y.test.js +73 -0
- package/dist/packages/checkbox/checkbox.d.ts +49 -0
- package/dist/packages/checkbox/checkbox.js +2594 -0
- package/dist/packages/checkbox/checkbox.js.map +7 -0
- package/dist/packages/checkbox/checkbox.react.stories.d.ts +12 -0
- package/dist/packages/checkbox/checkbox.react.stories.js +10 -0
- package/dist/packages/checkbox/checkbox.stories.d.ts +25 -0
- package/dist/packages/checkbox/checkbox.stories.js +183 -0
- package/dist/packages/checkbox/checkbox.test.d.ts +1 -0
- package/dist/packages/checkbox/checkbox.test.js +142 -0
- package/dist/packages/checkbox/react.d.ts +5 -0
- package/dist/packages/checkbox/react.js +15 -0
- package/dist/packages/checkbox/styles.d.ts +1 -0
- package/dist/packages/checkbox/styles.js +134 -0
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.d.ts +2 -0
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +109 -0
- package/dist/packages/checkbox-group/checkbox-group.d.ts +33 -0
- package/dist/packages/checkbox-group/checkbox-group.js +71 -0
- package/dist/packages/checkbox-group/checkbox-group.js.map +7 -0
- package/dist/packages/checkbox-group/checkbox-group.test.d.ts +2 -0
- package/dist/packages/checkbox-group/checkbox-group.test.js +112 -0
- package/dist/packages/checkbox-group/locales/da/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/da/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/en/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/en/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/fi/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/fi/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/nb/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/nb/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/sv/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/sv/messages.mjs +1 -0
- package/dist/packages/checkbox-group/react.d.ts +2 -0
- package/dist/packages/checkbox-group/react.js +11 -0
- package/dist/packages/combobox/combobox.js +11 -11
- package/dist/packages/combobox/combobox.js.map +3 -3
- package/dist/packages/datepicker/datepicker.js +42 -42
- package/dist/packages/datepicker/datepicker.js.map +3 -3
- package/dist/packages/expandable/expandable.js +11 -11
- package/dist/packages/expandable/expandable.js.map +3 -3
- package/dist/packages/i18n.d.ts +2 -0
- package/dist/packages/i18n.js +87 -2
- package/dist/packages/modal-header/modal-header.js +15 -15
- package/dist/packages/modal-header/modal-header.js.map +3 -3
- package/dist/packages/page-indicator/page-indicator.js +7 -7
- package/dist/packages/page-indicator/page-indicator.js.map +3 -3
- package/dist/packages/pagination/pagination.js +24 -24
- package/dist/packages/pagination/pagination.js.map +3 -3
- package/dist/packages/pill/pill.js +10 -10
- package/dist/packages/pill/pill.js.map +3 -3
- package/dist/packages/select/select.js +20 -20
- package/dist/packages/select/select.js.map +3 -3
- package/dist/packages/slider/Slider.d.ts +2 -0
- package/dist/packages/slider/Slider.js +8 -0
- package/dist/packages/slider/index.d.ts +2 -0
- package/dist/packages/slider/index.js +2 -0
- package/dist/packages/slider/locales/da/messages.d.mts +1 -0
- package/dist/packages/slider/locales/da/messages.mjs +1 -0
- package/dist/packages/slider/locales/en/messages.d.mts +1 -0
- package/dist/packages/slider/locales/en/messages.mjs +1 -0
- package/dist/packages/slider/locales/fi/messages.d.mts +1 -0
- package/dist/packages/slider/locales/fi/messages.mjs +1 -0
- package/dist/packages/slider/locales/nb/messages.d.mts +1 -0
- package/dist/packages/slider/locales/nb/messages.mjs +1 -0
- package/dist/packages/slider/locales/sv/messages.d.mts +1 -0
- package/dist/packages/slider/locales/sv/messages.mjs +1 -0
- package/dist/packages/slider/react.d.ts +3 -0
- package/dist/packages/slider/react.js +13 -0
- package/dist/packages/slider/slider.d.ts +64 -0
- package/dist/packages/slider/slider.js +2641 -0
- package/dist/packages/slider/slider.js.map +7 -0
- package/dist/packages/slider/slider.react.stories.d.ts +19 -0
- package/dist/packages/slider/slider.react.stories.js +161 -0
- package/dist/packages/slider/slider.stories.d.ts +26 -0
- package/dist/packages/slider/slider.stories.js +464 -0
- package/dist/packages/slider/slider.test.d.ts +5 -0
- package/dist/packages/slider/slider.test.js +380 -0
- package/dist/packages/slider/styles/w-slider.styles.d.ts +1 -0
- package/dist/packages/slider/styles/w-slider.styles.js +154 -0
- package/dist/packages/slider/styles.d.ts +1 -0
- package/dist/packages/slider/styles.js +2 -0
- package/dist/packages/slider-thumb/SliderThumb.d.ts +2 -0
- package/dist/packages/slider-thumb/SliderThumb.js +8 -0
- package/dist/packages/slider-thumb/oddbird-css-anchor-positioning.d.ts +2 -0
- package/dist/packages/slider-thumb/oddbird-css-anchor-positioning.js +3 -0
- package/dist/packages/slider-thumb/react.d.ts +6 -0
- package/dist/packages/slider-thumb/react.js +15 -0
- package/dist/packages/slider-thumb/slider-thumb.d.ts +72 -0
- package/dist/packages/slider-thumb/slider-thumb.js +2774 -0
- package/dist/packages/slider-thumb/slider-thumb.js.map +7 -0
- package/dist/packages/slider-thumb/styles/w-slider-thumb.styles.d.ts +1 -0
- package/dist/packages/slider-thumb/styles/w-slider-thumb.styles.js +194 -0
- package/dist/packages/step/step.js +13 -13
- package/dist/packages/step/step.js.map +3 -3
- package/dist/packages/step-indicator/step-indicator.a11y.test.js +6 -2
- package/dist/packages/textarea/textarea.a11y.test.js +1 -1
- package/dist/packages/textarea/textarea.test.js +2 -1
- package/dist/packages/textfield/styles/w-textfield.styles.js +6 -0
- package/dist/packages/textfield/textfield.js +7 -1
- package/dist/packages/textfield/textfield.js.map +2 -2
- package/dist/packages/toast/toast.js +13 -13
- package/dist/packages/toast/toast.js.map +3 -3
- package/dist/setup-tests.js +1 -1
- package/dist/web-types.json +328 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function
|
|
1
|
+
var er=Object.create;var ie=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var rr=Object.getOwnPropertyNames;var or=Object.getPrototypeOf,tr=Object.prototype.hasOwnProperty;var xe=o=>{throw TypeError(o)};var ye=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var ar=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of rr(e))!tr.call(o,a)&&a!==r&&ie(o,a,{get:()=>e[a],enumerable:!(t=we(e,a))||t.enumerable});return o};var ir=(o,e,r)=>(r=o!=null?er(or(o)):{},ar(e||!o||!o.__esModule?ie(r,"default",{value:o,enumerable:!0}):r,o));var h=(o,e,r,t)=>{for(var a=t>1?void 0:t?we(e,r):e,n=o.length-1,s;n>=0;n--)(s=o[n])&&(a=(t?s(e,r,a):s(a))||a);return t&&a&&ie(e,r,a),a};var ke=(o,e,r)=>e.has(o)||xe("Cannot "+r);var M=(o,e,r)=>(ke(o,e,"read from private field"),r?r.call(o):e.get(o)),se=(o,e,r)=>e.has(o)?xe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,r),_e=(o,e,r,t)=>(ke(o,e,"write to private field"),t?t.call(o,r):e.set(o,r),r);var Ce=ye(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.errorMessages=V.ErrorType=void 0;var I;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(I=V.ErrorType||(V.ErrorType={}));V.errorMessages=new Map([[I.MalformedUnicode,"malformed Unicode character escape sequence"],[I.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[I.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[I.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[I.EndOfString,"malformed escape sequence at end of string"]])});var Ee=ye(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.unraw=T.errorMessages=T.ErrorType=void 0;var x=Ce();Object.defineProperty(T,"ErrorType",{enumerable:!0,get:function(){return x.ErrorType}});Object.defineProperty(T,"errorMessages",{enumerable:!0,get:function(){return x.errorMessages}});function sr(o){return!o.match(/[^a-f0-9]/i)?parseInt(o,16):NaN}function q(o,e,r){let t=sr(o);if(Number.isNaN(t)||r!==void 0&&r!==o.length)throw new SyntaxError(x.errorMessages.get(e));return t}function nr(o){let e=q(o,x.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(e)}function ze(o,e){let r=q(o,x.ErrorType.MalformedUnicode,4);if(e!==void 0){let t=q(e,x.ErrorType.MalformedUnicode,4);return String.fromCharCode(r,t)}return String.fromCharCode(r)}function lr(o){return o.charAt(0)==="{"&&o.charAt(o.length-1)==="}"}function cr(o){if(!lr(o))throw new SyntaxError(x.errorMessages.get(x.ErrorType.MalformedUnicode));let e=o.slice(1,-1),r=q(e,x.ErrorType.MalformedUnicode);try{return String.fromCodePoint(r)}catch(t){throw t instanceof RangeError?new SyntaxError(x.errorMessages.get(x.ErrorType.CodePointLimit)):t}}function dr(o,e=!1){if(e)throw new SyntaxError(x.errorMessages.get(x.ErrorType.OctalDeprecation));let r=parseInt(o,8);return String.fromCharCode(r)}var br=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function ur(o){return br.get(o)||o}var hr=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function Me(o,e=!1){return o.replace(hr,function(r,t,a,n,s,i,c,u,f){if(t!==void 0)return"\\";if(a!==void 0)return nr(a);if(n!==void 0)return cr(n);if(s!==void 0)return ze(s,i);if(c!==void 0)return ze(c);if(u==="0")return"\0";if(u!==void 0)return dr(u,!e);if(f!==void 0)return ur(f);throw new SyntaxError(x.errorMessages.get(x.ErrorType.EndOfString))})}T.unraw=Me;T.default=Me});var G=function(){for(var o=[],e=arguments.length;e--;)o[e]=arguments[e];return o.reduce(function(r,t){return r.concat(typeof t=="string"?t:Array.isArray(t)?G.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(a){return t[a]?a:""}):"")},[]).join(" ")};var Te=ir(Ee(),1);var A=o=>typeof o=="string",pr=o=>typeof o=="function",Fe=new Map,Oe="en";function de(o){return[...Array.isArray(o)?o:[o],Oe]}function be(o,e,r){let t=de(o);r||(r="default");let a;if(typeof r=="string")switch(a={day:"numeric",month:"short",year:"numeric"},r){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=r;return J(()=>K("date",t,r),()=>new Intl.DateTimeFormat(t,a)).format(A(e)?new Date(e):e)}function gr(o,e,r){let t;if(r||(r="default"),typeof r=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},r){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=r;return be(o,e,t)}function ne(o,e,r){let t=de(o);return J(()=>K("number",t,r),()=>new Intl.NumberFormat(t,r)).format(e)}function Le(o,e,r,{offset:t=0,...a}){var i,c;let n=de(o),s=e?J(()=>K("plural-ordinal",n),()=>new Intl.PluralRules(n,{type:"ordinal"})):J(()=>K("plural-cardinal",n),()=>new Intl.PluralRules(n,{type:"cardinal"}));return(c=(i=a[r])!=null?i:a[s.select(r-t)])!=null?c:a.other}function J(o,e){let r=o(),t=Fe.get(r);return t||(t=e(),Fe.set(r,t)),t}function K(o,e,r){let t=e.join("-");return`${o}-${t}-${JSON.stringify(r)}`}var $e=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Pe="%__lingui_octothorpe__%",mr=(o,e,r={})=>{let t=e||o,a=s=>typeof s=="object"?s:r[s],n=(s,i)=>{let c=Object.keys(r).length?a("number"):void 0,u=ne(t,s,c);return i.replace(new RegExp(Pe,"g"),u)};return{plural:(s,i)=>{let{offset:c=0}=i,u=Le(t,!1,s,i);return n(s-c,u)},selectordinal:(s,i)=>{let{offset:c=0}=i,u=Le(t,!0,s,i);return n(s-c,u)},select:vr,number:(s,i)=>ne(t,s,a(i)||{style:i}),date:(s,i)=>be(t,s,a(i)||i),time:(s,i)=>gr(t,s,a(i)||i)}},vr=(o,e)=>{var r;return(r=e[o])!=null?r:e.other};function fr(o,e,r){return(t={},a)=>{let n=mr(e,r,a),s=(c,u=!1)=>Array.isArray(c)?c.reduce((f,z)=>{if(z==="#"&&u)return f+Pe;if(A(z))return f+z;let[F,_,$]=z,P={};_==="plural"||_==="selectordinal"||_==="select"?Object.entries($).forEach(([S,R])=>{P[S]=s(R,_==="plural"||_==="selectordinal")}):P=$;let k;if(_){let S=n[_];k=S(t[F],P)}else k=t[F];return k==null?f:f+k},""):c,i=s(o);return A(i)&&$e.test(i)?(0,Te.unraw)(i):A(i)?i:i?String(i):""}}var wr=Object.defineProperty,xr=(o,e,r)=>e in o?wr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,yr=(o,e,r)=>(xr(o,typeof e!="symbol"?e+"":e,r),r),le=class{constructor(){yr(this,"_events",{})}on(e,r){var a;var t;return(a=(t=this._events)[e])!=null||(t[e]=[]),this._events[e].push(r),()=>this.removeListener(e,r)}removeListener(e,r){let t=this._getListeners(e);if(!t)return;let a=t.indexOf(r);~a&&t.splice(a,1)}emit(e,...r){let t=this._getListeners(e);t&&t.map(a=>a.apply(this,r))}_getListeners(e){let r=this._events[e];return Array.isArray(r)?r:!1}},kr=Object.defineProperty,_r=(o,e,r)=>e in o?kr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,D=(o,e,r)=>(_r(o,typeof e!="symbol"?e+"":e,r),r),ce=class extends le{constructor(e){var r;super(),D(this,"_locale",""),D(this,"_locales"),D(this,"_localeData",{}),D(this,"_messages",{}),D(this,"_missing"),D(this,"_messageCompiler"),D(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate((r=e.locale)!=null?r:Oe,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var e;return(e=this._messages[this._locale])!=null?e:{}}get localeData(){var e;return(e=this._localeData[this._locale])!=null?e:{}}_loadLocaleData(e,r){let t=this._localeData[e];t?Object.assign(t,r):this._localeData[e]=r}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,r){typeof e=="string"?this._loadLocaleData(e,r):Object.keys(e).forEach(t=>this._loadLocaleData(t,e[t])),this.emit("change")}_load(e,r){let t=this._messages[e];t?Object.assign(t,r):this._messages[e]=r}load(e,r){typeof e=="string"&&typeof r=="object"?this._load(e,r):Object.entries(e).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:e,locales:r,messages:t}){this._locale=e,this._locales=r||void 0,this._messages[this._locale]=t,this.emit("change")}activate(e,r){this._locale=e,this._locales=r,this.emit("change")}_(e,r,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==null?void 0:t.message;e||(e=""),A(e)||(r=e.values||r,a=e.message,e=e.id);let n=this.messages[e],s=n===void 0,i=this._missing;if(i&&s)return pr(i)?i(this._locale,e):i;s&&this.emit("missing",{id:e,locale:this._locale});let c=n||a||e;return A(c)&&(this._messageCompiler?c=this._messageCompiler(c):console.warn(`Uncompiled message detected! Message:
|
|
3
3
|
|
|
4
4
|
> ${c}
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
7
7
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
8
8
|
|
|
9
9
|
Please compile your catalog first.
|
|
10
|
-
`)),
|
|
10
|
+
`)),A(c)&&$e.test(c)?JSON.parse(`"${c}"`):A(c)?c:fr(c,this._locale,this._locales)(r,t==null?void 0:t.formats)}date(e,r){return be(this._locales||this._locale,e,r)}number(e,r){return ne(this._locales||this._locale,e,r)}};function Cr(o={}){return new ce(o)}var E=Cr();var b=function(o,e,r,t){if(r==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?o!==e||!t:!e.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?t:r==="a"?t.call(o):t?t.value:e.get(o)},g=function(o,e,r,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 e=="function"?o!==e||!a:!e.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(o,r):a?a.value=r:e.set(o,r),r};function Ae(o){var e,r,t,a,n,s,i,c,u,f,z,F,_,$,P,k,S,R,oe;class We extends o{constructor(...l){var d,p,v;super(...l),e.add(this),this.internals=this.attachInternals(),r.set(this,!1),t.set(this,!1),a.set(this,!1),n.set(this,void 0),s.set(this,void 0),i.set(this,!0),u.set(this,""),f.set(this,()=>{g(this,a,!0,"f"),g(this,r,!0,"f"),b(this,e,"m",k).call(this)}),z.set(this,()=>{g(this,r,!1,"f"),b(this,e,"m",S).call(this,this.shouldFormValueUpdate()?b(this,u,"f"):""),!this.validity.valid&&b(this,a,"f")&&g(this,t,!0,"f");let L=b(this,e,"m",k).call(this);this.validationMessageCallback&&this.validationMessageCallback(L?this.internals.validationMessage:"")}),F.set(this,()=>{var L;b(this,i,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),g(this,i,!1,"f")),g(this,a,!0,"f"),g(this,t,!0,"f"),b(this,e,"m",k).call(this),(L=this===null||this===void 0?void 0:this.validationMessageCallback)===null||L===void 0||L.call(this,this.showError?this.internals.validationMessage:"")}),_.set(this,void 0),$.set(this,!1),P.set(this,Promise.resolve()),(d=this.addEventListener)===null||d===void 0||d.call(this,"focus",b(this,f,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"blur",b(this,z,"f")),(v=this.addEventListener)===null||v===void 0||v.call(this,"invalid",b(this,F,"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(),d=super.observedAttributes||[];return[...new Set([...d,...l])]}static getValidator(l){return this.validators.find(d=>d.attribute===l)||null}static getValidators(l){return this.validators.filter(d=>{var p;if(d.attribute===l||!((p=d.attribute)===null||p===void 0)&&p.includes(l))return!0})}get form(){return this.internals.form}get showError(){return b(this,e,"m",k).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(l,d,p){var v;(v=super.attributeChangedCallback)===null||v===void 0||v.call(this,l,d,p);let H=this.constructor.getValidators(l);H!=null&&H.length&&this.validationTarget&&this.setValue(b(this,u,"f"))}setValue(l){var d;g(this,t,!1,"f"),(d=this.validationMessageCallback)===null||d===void 0||d.call(this,""),g(this,u,l,"f");let v=this.shouldFormValueUpdate()?l:null;this.internals.setFormValue(v),b(this,e,"m",S).call(this,v),this.valueChangedCallback&&this.valueChangedCallback(v),b(this,e,"m",k).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(l=>l(b(this,P,"f")))}formResetCallback(){var l,d;g(this,a,!1,"f"),g(this,t,!1,"f"),b(this,e,"m",k).call(this),(l=this.resetFormControl)===null||l===void 0||l.call(this),(d=this.validationMessageCallback)===null||d===void 0||d.call(this,b(this,e,"m",k).call(this)?this.validationMessage:"")}}return r=new WeakMap,t=new WeakMap,a=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,u=new WeakMap,f=new WeakMap,z=new WeakMap,F=new WeakMap,_=new WeakMap,$=new WeakMap,P=new WeakMap,e=new WeakSet,c=function(){let l=this.getRootNode(),d=`${this.localName}[name="${this.getAttribute("name")}"]`;return l.querySelectorAll(d)},k=function(){if(this.hasAttribute("disabled"))return!1;let l=b(this,t,"f")||b(this,a,"f")&&!this.validity.valid&&!b(this,r,"f");return l&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),l},S=function(l){let d=this.constructor,p={},v=d.validators,L=[],H=v.some(C=>C.isValid instanceof Promise);b(this,$,"f")||(g(this,P,new Promise(C=>{g(this,_,C,"f")}),"f"),g(this,$,!0,"f")),b(this,n,"f")&&(b(this,n,"f").abort(),g(this,s,b(this,n,"f"),"f"));let X=new AbortController;g(this,n,X,"f");let Z,fe=!1;v.length&&(v.forEach(C=>{let te=C.key||"customError",j=C.isValid(this,l,X.signal);j instanceof Promise?(L.push(j),j.then(ae=>{ae!=null&&(p[te]=!ae,Z=b(this,e,"m",oe).call(this,C,l),b(this,e,"m",R).call(this,p,Z))})):(p[te]=!j,this.validity[te]!==!j&&(fe=!0),!j&&!Z&&(Z=b(this,e,"m",oe).call(this,C,l)))}),Promise.allSettled(L).then(()=>{var C;X!=null&&X.signal.aborted||(g(this,$,!1,"f"),(C=b(this,_,"f"))===null||C===void 0||C.call(this))}),(fe||!H)&&b(this,e,"m",R).call(this,p,Z))},R=function(l,d){if(this.validationTarget)this.internals.setValidity(l,d,this.validationTarget),g(this,i,!1,"f");else{if(this.internals.setValidity(l,d),this.internals.validity.valid)return;g(this,i,!0,"f")}},oe=function(l,d){if(this.validityCallback){let p=this.validityCallback(l.key||"customError");if(p)return p}return l.message instanceof Function?l.message(this,d):l.message},We}import{css as Dr,html as Y,LitElement as jr}from"lit";import{property as y}from"lit/decorators.js";import{ifDefined as ge}from"lit/directives/if-defined.js";import{when as me}from"lit/directives/when.js";var zr=["en","nb","fi","da","sv"],ue="en",Q=o=>zr.find(e=>o===e||o.toLowerCase().includes(e))||ue;function W(){if(typeof window=="undefined"){let o=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return Q(o)}try{let o=Se(document);if(o)return Q(o);let e=Lr();if(e)return Q(e);let r=Se(je());return r?Q(r):ue}catch(o){return console.warn("could not detect locale, falling back to source locale",o),ue}}var Ve=(o,e,r,t,a)=>{E.load("en",o),E.load("nb",e),E.load("fi",r),E.load("da",t),E.load("sv",a);let n=W();E.activate(n),De(),Er()},Mr="warp-i18n-change";function De(){typeof window!="undefined"&&window.dispatchEvent(new Event(Mr))}var Ne=!1;function Er(){if(Ne||typeof window=="undefined"||!(document!=null&&document.documentElement))return;Ne=!0;let o=()=>{let a=W();E.locale!==a&&(E.activate(a),De())},e=new MutationObserver(a=>{for(let n of a)if(n.type==="attributes"&&n.attributeName==="lang"){o();break}});e.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let r=je();r&&r.documentElement&&r!==document&&e.observe(r.documentElement,{attributes:!0,attributeFilter:["lang"]});let t=Fr();t&&e.observe(t,{attributes:!0,attributeFilter:["lang"]})}function je(){var o,e;try{return(e=(o=window.parent)==null?void 0:o.document)!=null?e:null}catch(r){return null}}function Se(o){var e,r;try{return(r=(e=o==null?void 0:o.documentElement)==null?void 0:e.lang)!=null?r:""}catch(t){return""}}function Fr(){var o;try{return(o=window.frameElement)!=null?o:null}catch(e){return null}}function Lr(){var o,e,r;try{return(r=(e=(o=window.frameElement)==null?void 0:o.getAttribute)==null?void 0:e.call(o,"lang"))!=null?r:""}catch(t){return""}}import{css as Ie}from"lit";var Ye=Ie`
|
|
11
11
|
*,
|
|
12
12
|
:before,
|
|
13
13
|
:after {
|
|
@@ -280,7 +280,7 @@ Please compile your catalog first.
|
|
|
280
280
|
svg {
|
|
281
281
|
pointer-events: none;
|
|
282
282
|
}
|
|
283
|
-
`,
|
|
283
|
+
`,Kr=Ie`*, :before, :after {
|
|
284
284
|
--w-rotate: 0;
|
|
285
285
|
--w-rotate-x: 0;
|
|
286
286
|
--w-rotate-y: 0;
|
|
@@ -2446,7 +2446,7 @@ Please compile your catalog first.
|
|
|
2446
2446
|
display: none
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
`;var
|
|
2449
|
+
`;var Re=JSON.parse('{"select.label.optional":["(valgfrit)"]}');var Ue=JSON.parse('{"select.label.optional":["(optional)"]}');var He=JSON.parse('{"select.label.optional":["(vapaaehtoinen)"]}');var Xe=JSON.parse('{"select.label.optional":["(valgfritt)"]}');var Ze=JSON.parse('{"select.label.optional":["(valfritt)"]}');import{css as Tr}from"lit";var Ge=Tr`*,: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}.focus\\:\\[--w-outline-offset\\:-2px\\]:focus{--w-outline-offset:-2px}.bg-transparent{background-color:#0000}.appearance-none{-webkit-appearance:none;appearance:none}.border-0{border-width:0}.border-1{border-width:1px}.rounded-4{border-radius:4px}.caret-current{caret-color:currentColor}.opacity-25{opacity:.25}.block,.before\\:block:before{display:block}.before\\:hidden:before{display:none}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.outline-\\[--w-s-color-border-negative\\]\\!{outline-color:var(--w-s-color-border-negative)!important}.bottom-0{bottom:0}.right-0{right:0}.before\\:bottom-0:before{bottom:0}.before\\:right-0:before{right:0}.top-\\[30\\%\\]{top:30%}.absolute{position:absolute}.relative{position:relative}.static{position:static}.before\\:absolute:before{position:absolute}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled-subtle{background-color:var(--w-s-color-background-disabled-subtle)}.s-text{color:var(--w-s-color-text)}.s-text-disabled{color:var(--w-s-color-text-disabled)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-text-subtle{color:var(--w-s-color-text-subtle)}.s-icon{color:var(--w-s-color-icon)}.s-border-disabled{border-color:var(--w-s-color-border-disabled)}.s-border-negative{border-color:var(--w-s-color-border-negative)}.s-border-strong{border-color:var(--w-s-color-border-strong)}.hover\\:s-border-disabled:hover{border-color:var(--w-s-color-border-disabled)}.hover\\:s-border-negative-hover:hover{border-color:var(--w-s-color-border-negative-hover)}.hover\\:s-border-strong-hover:hover{border-color:var(--w-s-color-border-strong-hover)}.active\\:s-border-active:active{border-color:var(--w-s-color-border-active)}.active\\:s-border-disabled:active{border-color:var(--w-s-color-border-disabled)}.h-full{height:100%}.w-32{width:3.2rem}.w-full{width:100%}.before\\:h-full:before{height:100%}.before\\:w-32:before{width:3.2rem}.mb-0{margin-bottom:0}.mt-4{margin-top:.4rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.pb-4{padding-bottom:.4rem}.pl-0{padding-left:0}.pl-8{padding-left:.8rem}.pr-32{padding-right:3.2rem}.cursor-pointer{cursor:pointer}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:grayscale}.font-bold{font-weight:700}.font-normal{font-weight:400}.pointer-events-none,.before\\:pointer-events-none:before{pointer-events:none}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}`;import{html as $r,LitElement as Pr}from"lit";import{property as he,state as Ar}from"lit/decorators.js";import{classMap as Nr}from"lit/directives/class-map.js";import{css as Or}from"lit";var Be=Or`
|
|
2450
2450
|
:host {
|
|
2451
2451
|
display: inline-block;
|
|
2452
2452
|
}
|
|
@@ -2471,37 +2471,37 @@ Please compile your catalog first.
|
|
|
2471
2471
|
--w-icon-size: 32px;
|
|
2472
2472
|
}
|
|
2473
2473
|
|
|
2474
|
-
`;var
|
|
2475
|
-
${
|
|
2474
|
+
`;var pe=new Map,Sr='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function Vr(o,e={}){var t;let r=(t=e.responseParser)!=null?t:(a=>a.text());return pe.has(o)||pe.set(o,fetch(o).then(r)),pe.get(o)}var N=class extends Pr{constructor(){super(...arguments);this.name="";this.size="medium";this.locale="en";this.svg=null}async fetchIcon(r){let t=`https://assets.finn.no/pkg/eikons/v1/${this.locale}/${r}.svg`;try{let a=await Vr(t);return new DOMParser().parseFromString(a,"text/html").body.querySelector("svg")}catch(a){return null}}firstUpdated(){this.loadIcon()}updated(r){(r.has("name")||r.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let r=await this.fetchIcon(this.name);r||(r=new DOMParser().parseFromString(Sr,"text/html").body.firstElementChild),this.svg=r}render(){let r={"w-icon":!0,"w-icon--s":this.size==="small","w-icon--m":this.size==="medium","w-icon--l":this.size==="large"},t=typeof this.size=="string"&&this.size.endsWith("px")?`--w-icon-size: ${this.size};`:"";return $r`<div class="${Nr(r)}" style="${t}" part="w-${this.name.toLowerCase()}">${this.svg}</div>`}};N.styles=[Be],h([he({type:String,reflect:!0})],N.prototype,"name",2),h([he({type:String,reflect:!0})],N.prototype,"size",2),h([he({type:String,reflect:!0})],N.prototype,"locale",2),h([Ar()],N.prototype,"svg",2);customElements.get("w-icon")||customElements.define("w-icon",N);var O={base:"block text-m mb-0 py-12 pr-32 rounded-4 w-full focusable focus:[--w-outline-offset:-2px] appearance-none cursor-pointer caret-current",default:"s-text s-bg pl-8 border-1 s-border-strong hover:s-border-strong-hover active:s-border-active",disabled:"s-text-disabled s-bg-disabled-subtle pl-8 border-1 s-border-disabled hover:s-border-disabled active:s-border-disabled pointer-events-none",invalid:"s-text s-bg pl-8 border-1 s-border-negative hover:s-border-negative-hover active:s-border-active outline-[--w-s-color-border-negative]!",readOnly:"s-text bg-transparent pl-0 border-0 pointer-events-none before:hidden",wrapper:"relative",selectWrapper:"relative before:block before:absolute before:right-0 before:bottom-0 before:w-32 before:h-full before:pointer-events-none ",chevron:"block absolute top-[30%] right-0 bottom-0 w-32 h-full s-icon pointer-events-none cursor-pointer",chevronDisabled:"opacity-25"},qe={base:"antialiased block relative text-s font-bold pb-4 cursor-pointer s-text",optional:"pl-8 font-normal text-s s-text-subtle"},ve={base:"text-xs mt-4 block",color:"s-text-subtle",colorInvalid:"s-text-negative"},B,w,Je,Ke,Qe,ee,re,m=class extends Ae(jr){constructor(){super();se(this,w);se(this,B,null);this._setValue=r=>{this.value=r,this.setValue(r)};Ve(Ue,Xe,He,Re,Ze)}resetFormControl(){this.value=M(this,B)}connectedCallback(){super.connectedCallback(),_e(this,B,this.value),(this.autofocus||this.autoFocus)&&this.shadowRoot.querySelector("select").focus();let t=Array.from(this.children).filter(a=>a.tagName.toLowerCase()==="option"||a.tagName.toLowerCase()==="w-option").map(a=>{var u,f;let n=(u=a.getAttribute("value"))!=null?u:"",s=(f=a.textContent)!=null?f:"",i=a.hasAttribute("selected"),c=a.hasAttribute("disabled");return i&&this._setValue(n),Y`<option value="${n}" ?selected=${i} ?disabled=${c}>${s}</option>`});this._options=t}handleKeyDown(r){(this.readonly||this.readOnly)&&(r.key===" "||r.key==="ArrowDown"||r.key==="ArrowUp")&&r.preventDefault()}onChange({target:r}){this._setValue(r.value);let t=new CustomEvent("change",{detail:r.value}),n=Array.from(this.children).filter(s=>s.tagName.toLowerCase()==="option"||s.tagName.toLowerCase()==="w-option").map(s=>{var z,F;let i=(z=s.getAttribute("value"))!=null?z:"",c=i===r.value,u=(F=s.textContent)!=null?F:"",f=s.hasAttribute("disabled");return Y`<option value="${i}" ?selected=${c} ?disabled=${f}>${u}</option>`});this._options=n,this.dispatchEvent(t)}render(){return Y`<div class="${O.wrapper}">
|
|
2475
|
+
${me(this.label,()=>Y`<label class="${qe.base}" for="${M(this,w,ee)}">
|
|
2476
2476
|
${this.label}
|
|
2477
|
-
${
|
|
2478
|
-
>${
|
|
2477
|
+
${me(this.optional,()=>Y`<span class="${qe.optional}"
|
|
2478
|
+
>${E._({id:"select.label.optional",message:"(optional)",comment:"Shown behind label when marked as optional"})}</span
|
|
2479
2479
|
>`)}</label
|
|
2480
2480
|
>`)}
|
|
2481
|
-
<div class="${
|
|
2481
|
+
<div class="${O.selectWrapper}">
|
|
2482
2482
|
<select
|
|
2483
|
-
class="${M(this,w,
|
|
2484
|
-
id="${M(this,w,
|
|
2483
|
+
class="${M(this,w,Je)}"
|
|
2484
|
+
id="${M(this,w,ee)}"
|
|
2485
2485
|
?disabled=${this.disabled}
|
|
2486
2486
|
aria-readonly="${this.readonly}"
|
|
2487
|
-
aria-describedby="${
|
|
2488
|
-
aria-invalid="${
|
|
2489
|
-
aria-errormessage="${
|
|
2487
|
+
aria-describedby="${ge(M(this,w,re))}"
|
|
2488
|
+
aria-invalid="${ge(this.invalid)}"
|
|
2489
|
+
aria-errormessage="${ge(this.invalid&&M(this,w,re))}"
|
|
2490
2490
|
@keydown=${this.handleKeyDown}
|
|
2491
2491
|
@change=${this.onChange}>
|
|
2492
2492
|
${this._options}
|
|
2493
2493
|
</select>
|
|
2494
|
-
<div class="${M(this,w,
|
|
2495
|
-
<w-icon name="ChevronDown" size="small" locale="${
|
|
2494
|
+
<div class="${M(this,w,Qe)}">
|
|
2495
|
+
<w-icon name="ChevronDown" size="small" locale="${W()}" class="flex"></w-icon>
|
|
2496
2496
|
</div>
|
|
2497
2497
|
</div>
|
|
2498
|
-
${
|
|
2499
|
-
</div>`}};
|
|
2498
|
+
${me(this.helpText||this.always||this.invalid,()=>Y`<div id="${M(this,w,re)}" class="${M(this,w,Ke)}">${this.helpText||this.hint}</div>`)}
|
|
2499
|
+
</div>`}};B=new WeakMap,w=new WeakSet,Je=function(){return G([O.base,!this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&O.default,this.invalid&&O.invalid,this.disabled&&O.disabled,(this.readonly||this.readOnly)&&O.readOnly])},Ke=function(){return G([ve.base,this.invalid?ve.colorInvalid:ve.color])},Qe=function(){return G([O.chevron,this.disabled&&O.chevronDisabled])},ee=function(){return"select_id"},re=function(){return this.hint?`${M(this,w,ee)}__hint`:void 0},m.styles=[Ye,Ge,Dr`
|
|
2500
2500
|
/* if there is an option with an empty value and it is selected */
|
|
2501
2501
|
select:has(option[value=""][selected]),
|
|
2502
2502
|
/* if there is an option with an empty value, and no other options are selected */
|
|
2503
2503
|
select:has(option[value=""]):not(:has(option[selected])) {
|
|
2504
2504
|
color: var(--w-s-color-text-placeholder);
|
|
2505
2505
|
}
|
|
2506
|
-
`],
|
|
2506
|
+
`],h([y({attribute:"auto-focus",type:Boolean,reflect:!0})],m.prototype,"autoFocus",2),h([y({type:Boolean,reflect:!0})],m.prototype,"autofocus",2),h([y({attribute:"help-text",reflect:!0})],m.prototype,"helpText",2),h([y({type:Boolean,reflect:!0})],m.prototype,"invalid",2),h([y({type:Boolean,reflect:!0})],m.prototype,"always",2),h([y({reflect:!0})],m.prototype,"hint",2),h([y({reflect:!0})],m.prototype,"label",2),h([y({type:Boolean,reflect:!0})],m.prototype,"optional",2),h([y({type:Boolean,reflect:!0})],m.prototype,"disabled",2),h([y({attribute:"read-only",type:Boolean,reflect:!0})],m.prototype,"readOnly",2),h([y({type:Boolean,reflect:!0})],m.prototype,"readonly",2),h([y({attribute:!1,state:!0})],m.prototype,"_options",2),h([y({reflect:!0})],m.prototype,"name",2),h([y({reflect:!0})],m.prototype,"value",2);customElements.get("w-select")||customElements.define("w-select",m);export{m as WarpSelect};
|
|
2507
2507
|
//# sourceMappingURL=select.js.map
|