@warp-ds/elements 2.3.0-next.28 → 2.3.0-next.29
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 +75 -2
- package/dist/packages/combobox/index.js +6 -5
- package/dist/packages/combobox/index.js.map +2 -2
- package/dist/packages/combobox/styles.js +2 -1
- package/dist/packages/radio/radio.stories.d.ts +14 -7
- package/dist/packages/radio/radio.stories.js +1062 -13
- package/dist/packages/radio/radio.stories.js.map +4 -4
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
|
@@ -5219,13 +5219,53 @@
|
|
|
5219
5219
|
"kind": "javascript-module",
|
|
5220
5220
|
"path": "packages/radio/radio.stories.ts",
|
|
5221
5221
|
"declarations": [
|
|
5222
|
+
{
|
|
5223
|
+
"kind": "variable",
|
|
5224
|
+
"name": "meta",
|
|
5225
|
+
"type": {
|
|
5226
|
+
"text": "Meta<typeof args>"
|
|
5227
|
+
},
|
|
5228
|
+
"default": "{ title: 'Forms/Radio', render: (args) => { return html` <w-radio-group ${spread(prespread(args))}> <w-radio value=\"foo\">foo</w-radio> <w-radio value=\"bar\">bar</w-radio> </w-radio-group> `; }, } satisfies Meta"
|
|
5229
|
+
},
|
|
5222
5230
|
{
|
|
5223
5231
|
"kind": "variable",
|
|
5224
5232
|
"name": "Default",
|
|
5225
5233
|
"type": {
|
|
5226
|
-
"text": "
|
|
5234
|
+
"text": "Story"
|
|
5235
|
+
},
|
|
5236
|
+
"default": "{ args: { label: 'Group', name: 'foobar', value: 'foo', }, }"
|
|
5237
|
+
},
|
|
5238
|
+
{
|
|
5239
|
+
"kind": "variable",
|
|
5240
|
+
"name": "Disabled",
|
|
5241
|
+
"type": {
|
|
5242
|
+
"text": "Story"
|
|
5243
|
+
},
|
|
5244
|
+
"default": "{ args: { label: 'Disabled', disabled: true, }, }"
|
|
5245
|
+
},
|
|
5246
|
+
{
|
|
5247
|
+
"kind": "variable",
|
|
5248
|
+
"name": "Required",
|
|
5249
|
+
"type": {
|
|
5250
|
+
"text": "Story"
|
|
5251
|
+
},
|
|
5252
|
+
"default": "{ args: {}, render() { return html` <form> <w-radio-group required> <w-radio value=\"foo\">foo</w-radio> <w-radio value=\"bar\">bar</w-radio> </w-radio-group> <button>click me</button> </form> `; }, }"
|
|
5253
|
+
},
|
|
5254
|
+
{
|
|
5255
|
+
"kind": "variable",
|
|
5256
|
+
"name": "DisabledGroup",
|
|
5257
|
+
"type": {
|
|
5258
|
+
"text": "Story"
|
|
5259
|
+
},
|
|
5260
|
+
"default": "{ args: { disabled: true }, }"
|
|
5261
|
+
},
|
|
5262
|
+
{
|
|
5263
|
+
"kind": "variable",
|
|
5264
|
+
"name": "DisabledRadio",
|
|
5265
|
+
"type": {
|
|
5266
|
+
"text": "Story"
|
|
5227
5267
|
},
|
|
5228
|
-
"default": "{}"
|
|
5268
|
+
"default": "{ args: {}, render() { return html` <w-radio-group> <w-radio value=\"foo\" disabled appearance=\"button\">disabled</w-radio> <w-radio value=\"bar\" appearance=\"clickable\">not disabled</w-radio> </w-radio-group> `; }, }"
|
|
5229
5269
|
}
|
|
5230
5270
|
],
|
|
5231
5271
|
"exports": [
|
|
@@ -5233,6 +5273,7 @@
|
|
|
5233
5273
|
"kind": "js",
|
|
5234
5274
|
"name": "default",
|
|
5235
5275
|
"declaration": {
|
|
5276
|
+
"name": "meta",
|
|
5236
5277
|
"module": "packages/radio/radio.stories.ts"
|
|
5237
5278
|
}
|
|
5238
5279
|
},
|
|
@@ -5243,6 +5284,38 @@
|
|
|
5243
5284
|
"name": "Default",
|
|
5244
5285
|
"module": "packages/radio/radio.stories.ts"
|
|
5245
5286
|
}
|
|
5287
|
+
},
|
|
5288
|
+
{
|
|
5289
|
+
"kind": "js",
|
|
5290
|
+
"name": "Disabled",
|
|
5291
|
+
"declaration": {
|
|
5292
|
+
"name": "Disabled",
|
|
5293
|
+
"module": "packages/radio/radio.stories.ts"
|
|
5294
|
+
}
|
|
5295
|
+
},
|
|
5296
|
+
{
|
|
5297
|
+
"kind": "js",
|
|
5298
|
+
"name": "Required",
|
|
5299
|
+
"declaration": {
|
|
5300
|
+
"name": "Required",
|
|
5301
|
+
"module": "packages/radio/radio.stories.ts"
|
|
5302
|
+
}
|
|
5303
|
+
},
|
|
5304
|
+
{
|
|
5305
|
+
"kind": "js",
|
|
5306
|
+
"name": "DisabledGroup",
|
|
5307
|
+
"declaration": {
|
|
5308
|
+
"name": "DisabledGroup",
|
|
5309
|
+
"module": "packages/radio/radio.stories.ts"
|
|
5310
|
+
}
|
|
5311
|
+
},
|
|
5312
|
+
{
|
|
5313
|
+
"kind": "js",
|
|
5314
|
+
"name": "DisabledRadio",
|
|
5315
|
+
"declaration": {
|
|
5316
|
+
"name": "DisabledRadio",
|
|
5317
|
+
"module": "packages/radio/radio.stories.ts"
|
|
5318
|
+
}
|
|
5246
5319
|
}
|
|
5247
5320
|
]
|
|
5248
5321
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Ve=Object.create;var W=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Pe=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var se=o=>{throw TypeError(o)};var le=(o,r)=>()=>(r||o((r={exports:{}}).exports,r),r.exports);var De=(o,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ne(r))!Re.call(o,a)&&a!==e&&W(o,a,{get:()=>r[a],enumerable:!(t=ne(r,a))||t.enumerable});return o};var je=(o,r,e)=>(e=o!=null?Ve(Pe(o)):{},De(r||!o||!o.__esModule?W(e,"default",{value:o,enumerable:!0}):e,o));var p=(o,r,e,t)=>{for(var a=t>1?void 0:t?ne(r,e):r,i=o.length-1,s;i>=0;i--)(s=o[i])&&(a=(t?s(r,e,a):s(a))||a);return t&&a&&W(r,e,a),a};var ce=(o,r,e)=>r.has(o)||se("Cannot "+e);var de=(o,r,e)=>(ce(o,r,"read from private field"),e?e.call(o):r.get(o)),ue=(o,r,e)=>r.has(o)?se("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),he=(o,r,e,t)=>(ce(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e);var pe=le(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.errorMessages=I.ErrorType=void 0;var V;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(V=I.ErrorType||(I.ErrorType={}));I.errorMessages=new Map([[V.MalformedUnicode,"malformed Unicode character escape sequence"],[V.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[V.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[V.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[V.EndOfString,"malformed escape sequence at end of string"]])});var ve=le(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.unraw=C.errorMessages=C.ErrorType=void 0;var w=pe();Object.defineProperty(C,"ErrorType",{enumerable:!0,get:function(){return w.ErrorType}});Object.defineProperty(C,"errorMessages",{enumerable:!0,get:function(){return w.errorMessages}});function Ue(o){return!o.match(/[^a-f0-9]/i)?parseInt(o,16):NaN}function q(o,r,e){let t=Ue(o);if(Number.isNaN(t)||e!==void 0&&e!==o.length)throw new SyntaxError(w.errorMessages.get(r));return t}function Ye(o){let r=q(o,w.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(r)}function be(o,r){let e=q(o,w.ErrorType.MalformedUnicode,4);if(r!==void 0){let t=q(r,w.ErrorType.MalformedUnicode,4);return String.fromCharCode(e,t)}return String.fromCharCode(e)}function Be(o){return o.charAt(0)==="{"&&o.charAt(o.length-1)==="}"}function qe(o){if(!Be(o))throw new SyntaxError(w.errorMessages.get(w.ErrorType.MalformedUnicode));let r=o.slice(1,-1),e=q(r,w.ErrorType.MalformedUnicode);try{return String.fromCodePoint(e)}catch(t){throw t instanceof RangeError?new SyntaxError(w.errorMessages.get(w.ErrorType.CodePointLimit)):t}}function Xe(o,r=!1){if(r)throw new SyntaxError(w.errorMessages.get(w.ErrorType.OctalDeprecation));let e=parseInt(o,8);return String.fromCharCode(e)}var He=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function Ze(o){return He.get(o)||o}var Ke=/\\(?:(\\)|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 ge(o,r=!1){return o.replace(Ke,function(e,t,a,i,s,n,c,v,_){if(t!==void 0)return"\\";if(a!==void 0)return Ye(a);if(i!==void 0)return qe(i);if(s!==void 0)return be(s,n);if(c!==void 0)return be(c);if(v==="0")return"\0";if(v!==void 0)return Xe(v,!r);if(_!==void 0)return Ze(_);throw new SyntaxError(w.errorMessages.get(w.ErrorType.EndOfString))})}C.unraw=ge;C.default=ge});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 we=je(ve(),1);var F=o=>typeof o=="string",Ge=o=>typeof o=="function",me=new Map,xe="en";function te(o){return[...Array.isArray(o)?o:[o],xe]}function oe(o,r,e){let t=te(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 X(()=>H("date",t,e),()=>new Intl.DateTimeFormat(t,a)).format(F(r)?new Date(r):r)}function Je(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 oe(o,r,t)}function Q(o,r,e){let t=te(o);return X(()=>H("number",t,e),()=>new Intl.NumberFormat(t,e)).format(r)}function fe(o,r,e,{offset:t=0,...a}){var n,c;let i=te(o),s=r?X(()=>H("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):X(()=>H("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return(c=(n=a[e])!=null?n:a[s.select(e-t)])!=null?c:a.other}function X(o,r){let e=o(),t=me.get(e);return t||(t=r(),me.set(e,t)),t}function H(o,r,e){let t=r.join("-");return`${o}-${t}-${JSON.stringify(e)}`}var ke=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,ye="%__lingui_octothorpe__%",We=(o,r,e={})=>{let t=r||o,a=s=>typeof s=="object"?s:e[s],i=(s,n)=>{let c=Object.keys(e).length?a("number"):void 0,v=Q(t,s,c);return n.replace(new RegExp(ye,"g"),v)};return{plural:(s,n)=>{let{offset:c=0}=n,v=fe(t,!1,s,n);return i(s-c,v)},selectordinal:(s,n)=>{let{offset:c=0}=n,v=fe(t,!0,s,n);return i(s-c,v)},select:Qe,number:(s,n)=>Q(t,s,a(n)||{style:n}),date:(s,n)=>oe(t,s,a(n)||n),time:(s,n)=>Je(t,s,a(n)||n)}},Qe=(o,r)=>{var e;return(e=r[o])!=null?e:r.other};function er(o,r,e){return(t={},a)=>{let i=We(r,e,a),s=(c,v=!1)=>Array.isArray(c)?c.reduce((_,M)=>{if(M==="#"&&v)return _+ye;if(F(M))return _+M;let[L,k,
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function Ze(o){return He.get(o)||o}var Ke=/\\(?:(\\)|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 ge(o,r=!1){return o.replace(Ke,function(e,t,a,i,s,n,c,v,_){if(t!==void 0)return"\\";if(a!==void 0)return Ye(a);if(i!==void 0)return qe(i);if(s!==void 0)return be(s,n);if(c!==void 0)return be(c);if(v==="0")return"\0";if(v!==void 0)return Xe(v,!r);if(_!==void 0)return Ze(_);throw new SyntaxError(w.errorMessages.get(w.ErrorType.EndOfString))})}C.unraw=ge;C.default=ge});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 we=je(ve(),1);var F=o=>typeof o=="string",Ge=o=>typeof o=="function",me=new Map,xe="en";function te(o){return[...Array.isArray(o)?o:[o],xe]}function oe(o,r,e){let t=te(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 X(()=>H("date",t,e),()=>new Intl.DateTimeFormat(t,a)).format(F(r)?new Date(r):r)}function Je(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 oe(o,r,t)}function Q(o,r,e){let t=te(o);return X(()=>H("number",t,e),()=>new Intl.NumberFormat(t,e)).format(r)}function fe(o,r,e,{offset:t=0,...a}){var n,c;let i=te(o),s=r?X(()=>H("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):X(()=>H("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return(c=(n=a[e])!=null?n:a[s.select(e-t)])!=null?c:a.other}function X(o,r){let e=o(),t=me.get(e);return t||(t=r(),me.set(e,t)),t}function H(o,r,e){let t=r.join("-");return`${o}-${t}-${JSON.stringify(e)}`}var ke=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,ye="%__lingui_octothorpe__%",We=(o,r,e={})=>{let t=r||o,a=s=>typeof s=="object"?s:e[s],i=(s,n)=>{let c=Object.keys(e).length?a("number"):void 0,v=Q(t,s,c);return n.replace(new RegExp(ye,"g"),v)};return{plural:(s,n)=>{let{offset:c=0}=n,v=fe(t,!1,s,n);return i(s-c,v)},selectordinal:(s,n)=>{let{offset:c=0}=n,v=fe(t,!0,s,n);return i(s-c,v)},select:Qe,number:(s,n)=>Q(t,s,a(n)||{style:n}),date:(s,n)=>oe(t,s,a(n)||n),time:(s,n)=>Je(t,s,a(n)||n)}},Qe=(o,r)=>{var e;return(e=r[o])!=null?e:r.other};function er(o,r,e){return(t={},a)=>{let i=We(r,e,a),s=(c,v=!1)=>Array.isArray(c)?c.reduce((_,M)=>{if(M==="#"&&v)return _+ye;if(F(M))return _+M;let[L,k,z]=M,E={};k==="plural"||k==="selectordinal"||k==="select"?Object.entries(z).forEach(([A,P])=>{E[A]=s(P,k==="plural"||k==="selectordinal")}):E=z;let x;if(k){let A=i[k];x=A(t[L],E)}else x=t[L];return x==null?_:_+x},""):c,n=s(o);return F(n)&&ke.test(n)?(0,we.unraw)(n):F(n)?n:n?String(n):""}}var rr=Object.defineProperty,tr=(o,r,e)=>r in o?rr(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,or=(o,r,e)=>(tr(o,typeof r!="symbol"?r+"":r,e),e),ee=class{constructor(){or(this,"_events",{})}on(r,e){var a;var t;return(a=(t=this._events)[r])!=null||(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}},ar=Object.defineProperty,ir=(o,r,e)=>r in o?ar(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,T=(o,r,e)=>(ir(o,typeof r!="symbol"?r+"":r,e),e),re=class extends ee{constructor(r){var e;super(),T(this,"_locale",""),T(this,"_locales"),T(this,"_localeData",{}),T(this,"_messages",{}),T(this,"_missing"),T(this,"_messageCompiler"),T(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((e=r.locale)!=null?e:xe,r.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var r;return(r=this._messages[this._locale])!=null?r:{}}get localeData(){var r;return(r=this._localeData[this._locale])!=null?r:{}}_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==null?void 0:t.message;r||(r=""),F(r)||(e=r.values||e,a=r.message,r=r.id);let i=this.messages[r],s=i===void 0,n=this._missing;if(n&&s)return Ge(n)?n(this._locale,r):n;s&&this.emit("missing",{id:r,locale:this._locale});let c=i||a||r;return F(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
|
-
`)),F(c)&&ke.test(c)?JSON.parse(`"${c}"`):F(c)?c:er(c,this._locale,this._locales)(e,t==null?void 0:t.formats)}date(r,e){return oe(this._locales||this._locale,r,e)}number(r,e){return Q(this._locales||this._locale,r,e)}};function nr(o={}){return new re(o)}var N=nr();var u=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 _e(o){var r,e,t,a,i,s,n,c,v,_,M,L,k,E,
|
|
10
|
+
`)),F(c)&&ke.test(c)?JSON.parse(`"${c}"`):F(c)?c:er(c,this._locale,this._locales)(e,t==null?void 0:t.formats)}date(r,e){return oe(this._locales||this._locale,r,e)}number(r,e){return Q(this._locales||this._locale,r,e)}};function nr(o={}){return new re(o)}var N=nr();var u=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 _e(o){var r,e,t,a,i,s,n,c,v,_,M,L,k,z,E,x,A,P,K;class $e extends o{constructor(...l){var d,b,m;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),s.set(this,void 0),n.set(this,!0),v.set(this,""),_.set(this,()=>{g(this,a,!0,"f"),g(this,e,!0,"f"),u(this,r,"m",x).call(this)}),M.set(this,()=>{g(this,e,!1,"f"),u(this,r,"m",A).call(this,this.shouldFormValueUpdate()?u(this,v,"f"):""),!this.validity.valid&&u(this,a,"f")&&g(this,t,!0,"f");let O=u(this,r,"m",x).call(this);this.validationMessageCallback&&this.validationMessageCallback(O?this.internals.validationMessage:"")}),L.set(this,()=>{var O;u(this,n,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),g(this,n,!1,"f")),g(this,a,!0,"f"),g(this,t,!0,"f"),u(this,r,"m",x).call(this),(O=this===null||this===void 0?void 0:this.validationMessageCallback)===null||O===void 0||O.call(this,this.showError?this.internals.validationMessage:"")}),k.set(this,void 0),z.set(this,!1),E.set(this,Promise.resolve()),(d=this.addEventListener)===null||d===void 0||d.call(this,"focus",u(this,_,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"blur",u(this,M,"f")),(m=this.addEventListener)===null||m===void 0||m.call(this,"invalid",u(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(m=>m.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 b;if(d.attribute===l||!((b=d.attribute)===null||b===void 0)&&b.includes(l))return!0})}get form(){return this.internals.form}get showError(){return u(this,r,"m",x).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(l,d,b){var m;(m=super.attributeChangedCallback)===null||m===void 0||m.call(this,l,d,b);let D=this.constructor.getValidators(l);D!=null&&D.length&&this.validationTarget&&this.setValue(u(this,v,"f"))}setValue(l){var d;g(this,t,!1,"f"),(d=this.validationMessageCallback)===null||d===void 0||d.call(this,""),g(this,v,l,"f");let m=this.shouldFormValueUpdate()?l:null;this.internals.setFormValue(m),u(this,r,"m",A).call(this,m),this.valueChangedCallback&&this.valueChangedCallback(m),u(this,r,"m",x).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(l=>l(u(this,E,"f")))}formResetCallback(){var l,d;g(this,a,!1,"f"),g(this,t,!1,"f"),u(this,r,"m",x).call(this),(l=this.resetFormControl)===null||l===void 0||l.call(this),(d=this.validationMessageCallback)===null||d===void 0||d.call(this,u(this,r,"m",x).call(this)?this.validationMessage:"")}}return e=new WeakMap,t=new WeakMap,a=new WeakMap,i=new WeakMap,s=new WeakMap,n=new WeakMap,v=new WeakMap,_=new WeakMap,M=new WeakMap,L=new WeakMap,k=new WeakMap,z=new WeakMap,E=new WeakMap,r=new WeakSet,c=function(){let l=this.getRootNode(),d=`${this.localName}[name="${this.getAttribute("name")}"]`;return l.querySelectorAll(d)},x=function(){if(this.hasAttribute("disabled"))return!1;let l=u(this,t,"f")||u(this,a,"f")&&!this.validity.valid&&!u(this,e,"f");return l&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),l},A=function(l){let d=this.constructor,b={},m=d.validators,O=[],D=m.some(y=>y.isValid instanceof Promise);u(this,z,"f")||(g(this,E,new Promise(y=>{g(this,k,y,"f")}),"f"),g(this,z,!0,"f")),u(this,i,"f")&&(u(this,i,"f").abort(),g(this,s,u(this,i,"f"),"f"));let j=new AbortController;g(this,i,j,"f");let U,ie=!1;m.length&&(m.forEach(y=>{let G=y.key||"customError",$=y.isValid(this,l,j.signal);$ instanceof Promise?(O.push($),$.then(J=>{J!=null&&(b[G]=!J,U=u(this,r,"m",K).call(this,y,l),u(this,r,"m",P).call(this,b,U))})):(b[G]=!$,this.validity[G]!==!$&&(ie=!0),!$&&!U&&(U=u(this,r,"m",K).call(this,y,l)))}),Promise.allSettled(O).then(()=>{var y;j!=null&&j.signal.aborted||(g(this,z,!1,"f"),(y=u(this,k,"f"))===null||y===void 0||y.call(this))}),(ie||!D)&&u(this,r,"m",P).call(this,b,U))},P=function(l,d){if(this.validationTarget)this.internals.setValidity(l,d,this.validationTarget),g(this,n,!1,"f");else{if(this.internals.setValidity(l,d),this.internals.validity.valid)return;g(this,n,!0,"f")}},K=function(l,d){if(this.validityCallback){let b=this.validityCallback(l.key||"customError");if(b)return b}return l.message instanceof Function?l.message(this,d):l.message},$e}import{html as ae,LitElement as ur}from"lit";import{property as f,state as Z}from"lit/decorators.js";import{repeat as hr}from"lit/directives/repeat.js";var sr=["en","nb","fi","da","sv"],Ce="en",Oe=o=>sr.find(r=>o===r||o.toLowerCase().includes(r))||Ce;function lr(){if(typeof window=="undefined"){let o=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return Oe(o)}try{let o=document.documentElement.lang;return Oe(o)}catch(o){return console.warn("could not detect locale, falling back to source locale",o),Ce}}var cr=(o,r,e,t,a,i)=>o==="nb"?e:o==="fi"?t:o==="da"?a:o==="sv"?i:r,Me=(o,r,e,t,a)=>{let i=lr(),s=cr(i,o,r,e,t,a);N.load(i,s),N.activate(i)};import{css as ze}from"lit";var Ee=ze`
|
|
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
|
-
`,Or=
|
|
283
|
+
`,Or=ze`*, :before, :after {
|
|
284
284
|
--w-rotate: 0;
|
|
285
285
|
--w-rotate-x: 0;
|
|
286
286
|
--w-rotate-y: 0;
|
|
@@ -2446,7 +2446,8 @@ Please compile your catalog first.
|
|
|
2446
2446
|
display: none
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
`;var Fe=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.noResults":["Ingen resultater"]}');var Se=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," result"],"other":["#"," results"]}]],"combobox.aria.noResults":["No results"]}');var Ae=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," tulos"],"other":["#"," tulosta"]}]],"combobox.aria.noResults":["Ei tuloksia"]}');var Ie=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.noResults":["Ingen resultater"]}');var Te=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultat"]}]],"combobox.aria.noResults":["Inga resultat"]}');import{css as dr}from"lit";var Le=dr`*,: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}.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}.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}
|
|
2449
|
+
`;var Fe=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.noResults":["Ingen resultater"]}');var Se=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," result"],"other":["#"," results"]}]],"combobox.aria.noResults":["No results"]}');var Ae=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," tulos"],"other":["#"," tulosta"]}]],"combobox.aria.noResults":["Ei tuloksia"]}');var Ie=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.noResults":["Ingen resultater"]}');var Te=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultat"]}]],"combobox.aria.noResults":["Inga resultat"]}');import{css as dr}from"lit";var Le=dr`*,: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}.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}.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};
|
|
2450
|
+
.z-0{z-index:0;}.z-20{z-index:20;}`;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"},B,h=class extends _e(ur){constructor(){super();this.options=[];this.value="";this.openOnFocus=!1;this.selectOnBlur=!0;this.matchTextSegments=!1;this.disableStaticFiltering=!1;this.invalid=!1;this.disabled=!1;this.required=!1;this.optional=!1;this._isOpen=!1;this._navigationOption=null;this._currentOptions=[];this._optionIdCounter=0;ue(this,B,null);Me(Se,Ie,Ae,Fe,Te)}firstUpdated(e){he(this,B,this.value)}updated(e){e.has("value")&&this.setValue(this.value)}resetFormControl(){this.value=de(this,B)}get _listboxId(){return`${this._id}-listbox`}get _id(){return"combobox"}get _helpId(){return this.helpText?`${this._id}__hint`:void 0}get _navigationValueOrInputValue(){var e;return((e=this._navigationOption)==null?void 0:e.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){if(!e||!t)return"";let a=e.filter(n=>n.value.toLowerCase().includes(t.toLowerCase())),i=N._({id:"combobox.aria.pluralResults",message:"{numResults, plural, one {# result} other {# results}}",comment:"Aria text for combobox when one or more results",values:{numResults:a.length}}),s=N._({id:"combobox.aria.noResults",message:"No results",comment:"Aria text for combobox when no results"});return a.length?i:s}_getOptionClasses(e){var t;return Y(S.option,((t=this._navigationOption)==null?void 0:t.id)===(e==null?void 0: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(()=>{var n,c;let i=(n=this.shadowRoot)==null?void 0:n.querySelector("w-textfield"),s=(c=i==null?void 0:i.shadowRoot)==null?void 0:c.querySelector("input");s&&(s.value=this.value)})),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._navigationValueOrInputValue),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(s=>{var n;return s.id===((n=this._navigationOption)==null?void 0:n.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.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;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){var i,s;let t=e.relatedTarget;if(t&&((i=this.shadowRoot)!=null&&i.contains(t)))return;if(this._isOpen=!1,this.selectOnBlur&&(this._navigationOption||!this._navigationOption&&this._currentOptions.findIndex(n=>n.value===this.value)!==-1)){let n=((s=this._navigationOption)==null?void 0:s.value)||this.value;this.value=n;let c=new CustomEvent("select",{detail:{value:n},bubbles:!0,composed:!0});this.dispatchEvent(c)}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(()=>{var s,n;let a=(s=this.shadowRoot)==null?void 0:s.querySelector("w-textfield"),i=(n=a==null?void 0:a.shadowRoot)==null?void 0:n.querySelector("input");i&&(i.value=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 ae`${e.substring(0,a)}<span class="${S.textMatch}">${e.substring(a,i)}</span
|
|
2450
2451
|
>${e.substring(i)}`}return e}willUpdate(e){(e.has("options")||e.has("value")||e.has("disableStaticFiltering"))&&(this._optionIdCounter+=this.options.length,this._currentOptions=this._createOptionsWithIdAndMatch(this.options,this.value).filter(t=>this.disableStaticFiltering?!0:t.value.toLowerCase().includes(this.value.toLowerCase()))),this.disableStaticFiltering&&this._currentOptions.length&&this._currentOptions.length===1&&!this._currentOptions.some(t=>t.value===this.value)&&!this._isOpen&&(this._isOpen=!0)}render(){var e;return ae`
|
|
2451
2452
|
<div class=${Y(S.wrapper,this.containerClassName)} @blur=${this._handleContainerBlur}>
|
|
2452
2453
|
<w-textfield
|
|
@@ -2488,5 +2489,5 @@ Please compile your catalog first.
|
|
|
2488
2489
|
</ul>
|
|
2489
2490
|
</div>
|
|
2490
2491
|
</div>
|
|
2491
|
-
`}};B=new WeakMap,h.styles=[
|
|
2492
|
+
`}};B=new WeakMap,h.styles=[Ee,Le],p([f({type:Array})],h.prototype,"options",2),p([f({type:String,reflect:!0})],h.prototype,"label",2),p([f({type:String,reflect:!0})],h.prototype,"placeholder",2),p([f({type:String,reflect:!0})],h.prototype,"value",2),p([f({type:Boolean,attribute:"open-on-focus"})],h.prototype,"openOnFocus",2),p([f({type:Boolean,attribute:"select-on-blur"})],h.prototype,"selectOnBlur",2),p([f({type:Boolean,attribute:"match-text-segments"})],h.prototype,"matchTextSegments",2),p([f({type:Boolean,attribute:"disable-static-filtering"})],h.prototype,"disableStaticFiltering",2),p([f({type:Boolean,reflect:!0})],h.prototype,"invalid",2),p([f({type:String,attribute:"help-text",reflect:!0})],h.prototype,"helpText",2),p([f({type:Boolean,reflect:!0})],h.prototype,"disabled",2),p([f({type:Boolean,reflect:!0})],h.prototype,"required",2),p([f({type:Boolean,reflect:!0})],h.prototype,"optional",2),p([f({type:String,reflect:!0,attribute:"class-name"})],h.prototype,"containerClassName",2),p([f({type:String,attribute:"list-class-name",reflect:!0})],h.prototype,"listClassName",2),p([f({type:String,reflect:!0})],h.prototype,"name",2),p([Z()],h.prototype,"_isOpen",2),p([Z()],h.prototype,"_navigationOption",2),p([Z()],h.prototype,"_currentOptions",2),p([Z()],h.prototype,"_optionIdCounter",2);customElements.get("w-combobox")||customElements.define("w-combobox",h);export{h as WarpCombobox};
|
|
2492
2493
|
//# sourceMappingURL=index.js.map
|