@warp-ds/elements 2.10.0-next.20 → 2.10.0-next.21
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 +38 -0
- package/dist/docs/slider/api.md +16 -0
- package/dist/docs/slider/slider.md +16 -0
- package/dist/index.d.ts +8 -0
- package/dist/packages/checkbox-group/checkbox-group.js +6 -6
- package/dist/packages/checkbox-group/checkbox-group.js.map +2 -2
- package/dist/packages/checkbox-group/checkbox-group.test.js +93 -6
- package/dist/packages/combobox/combobox.test.js +101 -0
- package/dist/packages/radio-group/radio-group.js +1 -1
- package/dist/packages/radio-group/radio-group.js.map +2 -2
- package/dist/packages/radio-group/radio-group.test.js +78 -9
- package/dist/packages/select/locales/da/messages.mjs +1 -1
- package/dist/packages/select/locales/en/messages.mjs +1 -1
- package/dist/packages/select/locales/fi/messages.mjs +1 -1
- package/dist/packages/select/locales/nb/messages.mjs +1 -1
- package/dist/packages/select/locales/sv/messages.mjs +1 -1
- package/dist/packages/select/select.js +5 -5
- package/dist/packages/select/select.js.map +2 -2
- package/dist/packages/select/select.test.js +52 -0
- package/dist/packages/slider/locales/da/messages.mjs +1 -1
- package/dist/packages/slider/locales/en/messages.mjs +1 -1
- package/dist/packages/slider/locales/fi/messages.mjs +1 -1
- package/dist/packages/slider/locales/nb/messages.mjs +1 -1
- package/dist/packages/slider/locales/sv/messages.mjs +1 -1
- package/dist/packages/slider/react.d.ts +1 -1
- package/dist/packages/slider/slider.d.ts +8 -0
- package/dist/packages/slider/slider.js +52 -13
- package/dist/packages/slider/slider.js.map +3 -3
- package/dist/packages/slider/slider.react.stories.d.ts +1 -1
- package/dist/packages/slider/slider.stories.d.ts +2 -0
- package/dist/packages/slider/slider.stories.js +36 -0
- package/dist/packages/slider/slider.test.js +107 -0
- package/dist/packages/textarea/locales/da/messages.mjs +1 -1
- package/dist/packages/textarea/locales/en/messages.mjs +1 -1
- package/dist/packages/textarea/locales/fi/messages.mjs +1 -1
- package/dist/packages/textarea/locales/nb/messages.mjs +1 -1
- package/dist/packages/textarea/locales/sv/messages.mjs +1 -1
- package/dist/packages/textarea/textarea.d.ts +1 -0
- package/dist/packages/textarea/textarea.js +20 -20
- package/dist/packages/textarea/textarea.js.map +4 -4
- package/dist/packages/textarea/textarea.test.js +73 -0
- package/dist/packages/textfield/locales/da/messages.mjs +1 -1
- package/dist/packages/textfield/locales/en/messages.mjs +1 -1
- package/dist/packages/textfield/locales/fi/messages.mjs +1 -1
- package/dist/packages/textfield/locales/nb/messages.mjs +1 -1
- package/dist/packages/textfield/locales/sv/messages.mjs +1 -1
- package/dist/packages/textfield/textfield.js +11 -11
- package/dist/packages/textfield/textfield.js.map +2 -2
- package/dist/packages/textfield/textfield.test.js +71 -0
- package/dist/web-types.json +13 -2
- package/eik/index.js +11 -11
- package/package.json +1 -1
|
@@ -7245,6 +7245,17 @@
|
|
|
7245
7245
|
"attribute": "required",
|
|
7246
7246
|
"reflects": true
|
|
7247
7247
|
},
|
|
7248
|
+
{
|
|
7249
|
+
"kind": "field",
|
|
7250
|
+
"name": "optional",
|
|
7251
|
+
"type": {
|
|
7252
|
+
"text": "boolean"
|
|
7253
|
+
},
|
|
7254
|
+
"default": "false",
|
|
7255
|
+
"description": "Whether to show the optional indicator after the label.",
|
|
7256
|
+
"attribute": "optional",
|
|
7257
|
+
"reflects": true
|
|
7258
|
+
},
|
|
7248
7259
|
{
|
|
7249
7260
|
"kind": "field",
|
|
7250
7261
|
"name": "min",
|
|
@@ -7441,6 +7452,24 @@
|
|
|
7441
7452
|
}
|
|
7442
7453
|
],
|
|
7443
7454
|
"description": "We use CSS variables to fill the active track with a background color."
|
|
7455
|
+
},
|
|
7456
|
+
{
|
|
7457
|
+
"kind": "method",
|
|
7458
|
+
"name": "_handleLabelSlotChange",
|
|
7459
|
+
"privacy": "private",
|
|
7460
|
+
"parameters": [
|
|
7461
|
+
{
|
|
7462
|
+
"name": "e",
|
|
7463
|
+
"type": {
|
|
7464
|
+
"text": "Event"
|
|
7465
|
+
}
|
|
7466
|
+
}
|
|
7467
|
+
]
|
|
7468
|
+
},
|
|
7469
|
+
{
|
|
7470
|
+
"kind": "field",
|
|
7471
|
+
"name": "_label",
|
|
7472
|
+
"readonly": true
|
|
7444
7473
|
}
|
|
7445
7474
|
],
|
|
7446
7475
|
"attributes": [
|
|
@@ -7503,6 +7532,15 @@
|
|
|
7503
7532
|
"description": "Ensures a child slider thumb has a value before allowing the containing form to submit",
|
|
7504
7533
|
"fieldName": "required"
|
|
7505
7534
|
},
|
|
7535
|
+
{
|
|
7536
|
+
"name": "optional",
|
|
7537
|
+
"type": {
|
|
7538
|
+
"text": "boolean"
|
|
7539
|
+
},
|
|
7540
|
+
"default": "false",
|
|
7541
|
+
"description": "Whether to show the optional indicator after the label.",
|
|
7542
|
+
"fieldName": "optional"
|
|
7543
|
+
},
|
|
7506
7544
|
{
|
|
7507
7545
|
"name": "min",
|
|
7508
7546
|
"type": {
|
package/dist/docs/slider/api.md
CHANGED
|
@@ -6,6 +6,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
6
6
|
|
|
7
7
|
| Name | Type | Default | Summary |
|
|
8
8
|
|-|-|-|-|
|
|
9
|
+
| _label (JS only) | `unknown` | `-` | - |
|
|
9
10
|
| disabled | `boolean` | `false` | - |
|
|
10
11
|
| error | `string \| undefined` | `-` | Validation error text, if any |
|
|
11
12
|
| help-text | `string \| undefined` | `-` | Additional description to show below the fieldset |
|
|
@@ -17,6 +18,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
17
18
|
| max | `string \| undefined` | `100` | The maximum allowed value in the range inputs |
|
|
18
19
|
| min | `string \| undefined` | `0` | The minimum allowed value in the range inputs |
|
|
19
20
|
| open-ended | `boolean` | `false` | Whether or not to allow values outside the range such as "Before 1950" and "2025+". |
|
|
21
|
+
| optional | `boolean` | `false` | Whether to show the optional indicator after the label. |
|
|
20
22
|
| required | `boolean` | `false` | Ensures a child slider thumb has a value before allowing the containing form to submit |
|
|
21
23
|
| step | `number \| undefined` | `-` | ets step on the range input to jump between values when dragging |
|
|
22
24
|
| suffix | `string \| undefined` | `-` | Suffix used in text input fields and for the min and max values of the slider |
|
|
@@ -25,6 +27,13 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
25
27
|
|
|
26
28
|
### Property Details
|
|
27
29
|
|
|
30
|
+
#### _label (JS only)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
- Type: `unknown`
|
|
35
|
+
- Default: `-`
|
|
36
|
+
|
|
28
37
|
#### disabled
|
|
29
38
|
|
|
30
39
|
|
|
@@ -104,6 +113,13 @@ Whether or not to allow values outside the range such as "Before 1950" and "2025
|
|
|
104
113
|
- Type: `boolean`
|
|
105
114
|
- Default: `false`
|
|
106
115
|
|
|
116
|
+
#### optional
|
|
117
|
+
|
|
118
|
+
Whether to show the optional indicator after the label.
|
|
119
|
+
|
|
120
|
+
- Type: `boolean`
|
|
121
|
+
- Default: `false`
|
|
122
|
+
|
|
107
123
|
#### required
|
|
108
124
|
|
|
109
125
|
Ensures a child slider thumb has a value before allowing the containing form to submit
|
|
@@ -316,6 +316,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
316
316
|
|
|
317
317
|
| Name | Type | Default | Summary |
|
|
318
318
|
|-|-|-|-|
|
|
319
|
+
| _label (JS only) | `unknown` | `-` | - |
|
|
319
320
|
| disabled | `boolean` | `false` | - |
|
|
320
321
|
| error | `string \| undefined` | `-` | Validation error text, if any |
|
|
321
322
|
| help-text | `string \| undefined` | `-` | Additional description to show below the fieldset |
|
|
@@ -327,6 +328,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
327
328
|
| max | `string \| undefined` | `100` | The maximum allowed value in the range inputs |
|
|
328
329
|
| min | `string \| undefined` | `0` | The minimum allowed value in the range inputs |
|
|
329
330
|
| open-ended | `boolean` | `false` | Whether or not to allow values outside the range such as "Before 1950" and "2025+". |
|
|
331
|
+
| optional | `boolean` | `false` | Whether to show the optional indicator after the label. |
|
|
330
332
|
| required | `boolean` | `false` | Ensures a child slider thumb has a value before allowing the containing form to submit |
|
|
331
333
|
| step | `number \| undefined` | `-` | ets step on the range input to jump between values when dragging |
|
|
332
334
|
| suffix | `string \| undefined` | `-` | Suffix used in text input fields and for the min and max values of the slider |
|
|
@@ -335,6 +337,13 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
335
337
|
|
|
336
338
|
### Property Details
|
|
337
339
|
|
|
340
|
+
#### _label (JS only)
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
- Type: `unknown`
|
|
345
|
+
- Default: `-`
|
|
346
|
+
|
|
338
347
|
#### disabled
|
|
339
348
|
|
|
340
349
|
|
|
@@ -414,6 +423,13 @@ Whether or not to allow values outside the range such as "Before 1950" and "2025
|
|
|
414
423
|
- Type: `boolean`
|
|
415
424
|
- Default: `false`
|
|
416
425
|
|
|
426
|
+
#### optional
|
|
427
|
+
|
|
428
|
+
Whether to show the optional indicator after the label.
|
|
429
|
+
|
|
430
|
+
- Type: `boolean`
|
|
431
|
+
- Default: `false`
|
|
432
|
+
|
|
417
433
|
#### required
|
|
418
434
|
|
|
419
435
|
Ensures a child slider thumb has a value before allowing the containing form to submit
|
package/dist/index.d.ts
CHANGED
|
@@ -1962,6 +1962,8 @@ If you need to display HTML, use the `label` slot instead (f. ex. `<legend class
|
|
|
1962
1962
|
invalid?: WarpSlider["invalid"];
|
|
1963
1963
|
/** Ensures a child slider thumb has a value before allowing the containing form to submit */
|
|
1964
1964
|
required?: WarpSlider["required"];
|
|
1965
|
+
/** Whether to show the optional indicator after the label. */
|
|
1966
|
+
optional?: WarpSlider["optional"];
|
|
1965
1967
|
/** The minimum allowed value in the range inputs */
|
|
1966
1968
|
min?: WarpSlider["min"];
|
|
1967
1969
|
/** The maximum allowed value in the range inputs */
|
|
@@ -2007,6 +2009,8 @@ If you need to display HTML, use the `label` slot instead (f. ex. `<legend class
|
|
|
2007
2009
|
"prop:invalid"?: WarpSlider["invalid"];
|
|
2008
2010
|
/** Ensures a child slider thumb has a value before allowing the containing form to submit */
|
|
2009
2011
|
"prop:required"?: WarpSlider["required"];
|
|
2012
|
+
/** Whether to show the optional indicator after the label. */
|
|
2013
|
+
"prop:optional"?: WarpSlider["optional"];
|
|
2010
2014
|
/** The minimum allowed value in the range inputs */
|
|
2011
2015
|
"prop:min"?: WarpSlider["min"];
|
|
2012
2016
|
/** The maximum allowed value in the range inputs */
|
|
@@ -3205,6 +3209,7 @@ export type CustomElements = {
|
|
|
3205
3209
|
* - `help-text`/`helpText`: Additional description to show below the fieldset
|
|
3206
3210
|
* - `invalid`: Sets the form fields and fieldset in an invalid state
|
|
3207
3211
|
* - `required`: Ensures a child slider thumb has a value before allowing the containing form to submit
|
|
3212
|
+
* - `optional`: Whether to show the optional indicator after the label.
|
|
3208
3213
|
* - `min`: The minimum allowed value in the range inputs
|
|
3209
3214
|
* - `max`: The maximum allowed value in the range inputs
|
|
3210
3215
|
* - `markers`: Pass a value similar to step to create visual markers at that interval
|
|
@@ -3216,6 +3221,7 @@ export type CustomElements = {
|
|
|
3216
3221
|
*
|
|
3217
3222
|
* Use in open-ended sliders to show for example "300+ hk" instead of "Max" in the tooltip. (property only)
|
|
3218
3223
|
* - `labelFormatter`: Formatter for the min and max labels below the range. (property only)
|
|
3224
|
+
* - `_label`: undefined (property only) (readonly)
|
|
3219
3225
|
*
|
|
3220
3226
|
* ## Slots
|
|
3221
3227
|
*
|
|
@@ -4567,6 +4573,7 @@ export type CustomElementsSolidJs = {
|
|
|
4567
4573
|
* - `help-text`/`helpText`: Additional description to show below the fieldset
|
|
4568
4574
|
* - `invalid`: Sets the form fields and fieldset in an invalid state
|
|
4569
4575
|
* - `required`: Ensures a child slider thumb has a value before allowing the containing form to submit
|
|
4576
|
+
* - `optional`: Whether to show the optional indicator after the label.
|
|
4570
4577
|
* - `min`: The minimum allowed value in the range inputs
|
|
4571
4578
|
* - `max`: The maximum allowed value in the range inputs
|
|
4572
4579
|
* - `markers`: Pass a value similar to step to create visual markers at that interval
|
|
@@ -4578,6 +4585,7 @@ export type CustomElementsSolidJs = {
|
|
|
4578
4585
|
*
|
|
4579
4586
|
* Use in open-ended sliders to show for example "300+ hk" instead of "Max" in the tooltip. (property only)
|
|
4580
4587
|
* - `labelFormatter`: Formatter for the min and max labels below the range. (property only)
|
|
4588
|
+
* - `_label`: undefined (property only) (readonly)
|
|
4581
4589
|
*
|
|
4582
4590
|
* ## Slots
|
|
4583
4591
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Jt=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Ct=i=>{throw TypeError(i)};var S=(i,t,e,s)=>{for(var n=s>1?void 0:s?Bt(t,e):t,c=i.length-1,
|
|
1
|
+
var Jt=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Ct=i=>{throw TypeError(i)};var S=(i,t,e,s)=>{for(var n=s>1?void 0:s?Bt(t,e):t,c=i.length-1,a;c>=0;c--)(a=i[c])&&(n=(s?a(t,e,n):a(n))||n);return s&&n&&Jt(t,e,n),n};var ot=(i,t,e)=>t.has(i)||Ct("Cannot "+e);var M=(i,t,e)=>(ot(i,t,"read from private field"),e?e.call(i):t.get(i)),x=(i,t,e)=>t.has(i)?Ct("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),z=(i,t,e,s)=>(ot(i,t,"write to private field"),s?s.call(i,e):t.set(i,e),e),h=(i,t,e)=>(ot(i,t,"access private method"),e);var I=i=>typeof i=="string",Gt=i=>typeof i=="function",Et=new Map,xt="en";function ut(i){return[...Array.isArray(i)?i:[i],xt]}function dt(i,t,e){let s=ut(i);e||(e="default");let n;if(typeof e=="string")switch(n={day:"numeric",month:"short",year:"numeric"},e){case"full":n.weekday="long";case"long":n.month="long";break;case"short":n.month="numeric";break}else n=e;return G(()=>K("date",s,e),()=>new Intl.DateTimeFormat(s,n)).format(I(t)?new Date(t):t)}function Kt(i,t,e){let s;if(e||(e="default"),typeof e=="string")switch(s={second:"numeric",minute:"numeric",hour:"numeric"},e){case"full":case"long":s.timeZoneName="short";break;case"short":delete s.second}else s=e;return dt(i,t,s)}function lt(i,t,e){let s=ut(i);return G(()=>K("number",s,e),()=>new Intl.NumberFormat(s,e)).format(t)}function Mt(i,t,e,{offset:s=0,...n}){let c=ut(i),a=t?G(()=>K("plural-ordinal",c),()=>new Intl.PluralRules(c,{type:"ordinal"})):G(()=>K("plural-cardinal",c),()=>new Intl.PluralRules(c,{type:"cardinal"}));return n[e]??n[a.select(e-s)]??n.other}function G(i,t){let e=i(),s=Et.get(e);return s||(s=t(),Et.set(e,s)),s}function K(i,t,e){let s=t.join("-");return`${i}-${s}-${JSON.stringify(e)}`}var Ft=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,kt=i=>i.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(t,e,s)=>{if(e){let n=parseInt(e,16);return String.fromCharCode(n)}else{let n=parseInt(s,16);return String.fromCharCode(n)}}),Vt="%__lingui_octothorpe__%",Qt=(i,t,e={})=>{let s=t||i,n=a=>typeof a=="object"?a:e[a],c=(a,o)=>{let f=Object.keys(e).length?n("number"):void 0,v=lt(s,a,f);return o.replace(new RegExp(Vt,"g"),v)};return{plural:(a,o)=>{let{offset:f=0}=o,v=Mt(s,!1,a,o);return c(a-f,v)},selectordinal:(a,o)=>{let{offset:f=0}=o,v=Mt(s,!0,a,o);return c(a-f,v)},select:Xt,number:(a,o)=>lt(s,a,n(o)||{style:o}),date:(a,o)=>dt(s,a,n(o)||o),time:(a,o)=>Kt(s,a,n(o)||o)}},Xt=(i,t)=>t[i]??t.other;function Zt(i,t,e){return(s={},n)=>{let c=Qt(t,e,n),a=(f,v=!1)=>Array.isArray(f)?f.reduce((F,k)=>{if(k==="#"&&v)return F+Vt;if(I(k))return F+k;let[q,w,V]=k,L={};w==="plural"||w==="selectordinal"||w==="select"?Object.entries(V).forEach(([T,U])=>{L[T]=a(U,w==="plural"||w==="selectordinal")}):L=V;let _;if(w){let T=c[w];_=T(s[q],L)}else _=s[q];return _==null?F:F+_},""):f,o=a(i);return I(o)&&Ft.test(o)?kt(o):I(o)?o:o?String(o):""}}var Yt=Object.defineProperty,te=(i,t,e)=>t in i?Yt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e)=>(te(i,typeof t!="symbol"?t+"":t,e),e),ct=class{constructor(){ee(this,"_events",{})}on(t,e){var s;return(s=this._events)[t]??(s[t]=[]),this._events[t].push(e),()=>this.removeListener(t,e)}removeListener(t,e){let s=this._getListeners(t);if(!s)return;let n=s.indexOf(e);~n&&s.splice(n,1)}emit(t,...e){let s=this._getListeners(t);s&&s.map(n=>n.apply(this,e))}_getListeners(t){let e=this._events[t];return Array.isArray(e)?e:!1}},se=Object.defineProperty,ie=(i,t,e)=>t in i?se(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,A=(i,t,e)=>(ie(i,typeof t!="symbol"?t+"":t,e),e),ht=class extends ct{constructor(t){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)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate(t.locale??xt,t.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(t,e){let s=this._localeData[t];s?Object.assign(s,e):this._localeData[t]=e}setMessagesCompiler(t){return this._messageCompiler=t,this}loadLocaleData(t,e){typeof t=="string"?this._loadLocaleData(t,e):Object.keys(t).forEach(s=>this._loadLocaleData(s,t[s])),this.emit("change")}_load(t,e){let s=this._messages[t];s?Object.assign(s,e):this._messages[t]=e}load(t,e){typeof t=="string"&&typeof e=="object"?this._load(t,e):Object.entries(t).forEach(([s,n])=>this._load(s,n)),this.emit("change")}loadAndActivate({locale:t,locales:e,messages:s}){this._locale=t,this._locales=e||void 0,this._messages[this._locale]=s,this.emit("change")}activate(t,e){this._locale=t,this._locales=e,this.emit("change")}_(t,e,s){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 n=s?.message;t||(t=""),I(t)||(e=t.values||e,n=t.message,t=t.id);let c=this.messages[t],a=c===void 0,o=this._missing;if(o&&a)return Gt(o)?o(this._locale,t):o;a&&this.emit("missing",{id:t,locale:this._locale});let f=c||n||t;return I(f)&&(this._messageCompiler?f=this._messageCompiler(f):console.warn(`Uncompiled message detected! Message:
|
|
2
2
|
|
|
3
3
|
> ${f}
|
|
4
4
|
|
|
@@ -6,12 +6,12 @@ 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
|
-
`)),I(f)&&Ft.test(f)?kt(f):I(f)?f:Zt(f,this._locale,this._locales)(e,s?.formats)}date(t,e){return dt(this._locales||this._locale,t,e)}number(t,e){return lt(this._locales||this._locale,t,e)}};function ne(i={}){return new ht(i)}var b=ne();var d=function(i,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(i):s?s.value:t.get(i)},g=function(i,t,e,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!n:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(i,e):n?n.value=e:t.set(i,e),e};function Lt(i){var t,e,s,n,c,
|
|
9
|
+
`)),I(f)&&Ft.test(f)?kt(f):I(f)?f:Zt(f,this._locale,this._locales)(e,s?.formats)}date(t,e){return dt(this._locales||this._locale,t,e)}number(t,e){return lt(this._locales||this._locale,t,e)}};function ne(i={}){return new ht(i)}var b=ne();var d=function(i,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(i):s?s.value:t.get(i)},g=function(i,t,e,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!n:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(i,e):n?n.value=e:t.set(i,e),e};function Lt(i){var t,e,s,n,c,a,o,f,v,F,k,q,w,V,L,_,T,U,nt;class zt extends i{constructor(...l){var u,m,p;super(...l),t.add(this),this.internals=this.attachInternals(),e.set(this,!1),s.set(this,!1),n.set(this,!1),c.set(this,void 0),a.set(this,void 0),o.set(this,!0),v.set(this,""),F.set(this,()=>{g(this,n,!0,"f"),g(this,e,!0,"f"),d(this,t,"m",_).call(this)}),k.set(this,()=>{g(this,e,!1,"f"),d(this,t,"m",T).call(this,this.shouldFormValueUpdate()?d(this,v,"f"):""),!this.validity.valid&&d(this,n,"f")&&g(this,s,!0,"f");let E=d(this,t,"m",_).call(this);this.validationMessageCallback&&this.validationMessageCallback(E?this.internals.validationMessage:"")}),q.set(this,()=>{var E;d(this,o,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),g(this,o,!1,"f")),g(this,n,!0,"f"),g(this,s,!0,"f"),d(this,t,"m",_).call(this),(E=this===null||this===void 0?void 0:this.validationMessageCallback)===null||E===void 0||E.call(this,this.showError?this.internals.validationMessage:"")}),w.set(this,void 0),V.set(this,!1),L.set(this,Promise.resolve()),(u=this.addEventListener)===null||u===void 0||u.call(this,"focus",d(this,F,"f")),(m=this.addEventListener)===null||m===void 0||m.call(this,"blur",d(this,k,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",d(this,q,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let l=this.validators.map(p=>p.attribute).flat(),u=super.observedAttributes||[];return[...new Set([...u,...l])]}static getValidator(l){return this.validators.find(u=>u.attribute===l)||null}static getValidators(l){return this.validators.filter(u=>{var m;if(u.attribute===l||!((m=u.attribute)===null||m===void 0)&&m.includes(l))return!0})}get form(){return this.internals.form}get showError(){return d(this,t,"m",_).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(l,u,m){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,l,u,m);let j=this.constructor.getValidators(l);j?.length&&this.validationTarget&&this.setValue(d(this,v,"f"))}setValue(l){var u;g(this,s,!1,"f"),(u=this.validationMessageCallback)===null||u===void 0||u.call(this,""),g(this,v,l,"f");let p=this.shouldFormValueUpdate()?l:null;this.internals.setFormValue(p),d(this,t,"m",T).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),d(this,t,"m",_).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(l=>l(d(this,L,"f")))}formResetCallback(){var l,u;g(this,n,!1,"f"),g(this,s,!1,"f"),d(this,t,"m",_).call(this),(l=this.resetFormControl)===null||l===void 0||l.call(this),(u=this.validationMessageCallback)===null||u===void 0||u.call(this,d(this,t,"m",_).call(this)?this.validationMessage:"")}}return e=new WeakMap,s=new WeakMap,n=new WeakMap,c=new WeakMap,a=new WeakMap,o=new WeakMap,v=new WeakMap,F=new WeakMap,k=new WeakMap,q=new WeakMap,w=new WeakMap,V=new WeakMap,L=new WeakMap,t=new WeakSet,f=function(){let l=this.getRootNode(),u=`${this.localName}[name="${this.getAttribute("name")}"]`;return l.querySelectorAll(u)},_=function(){if(this.hasAttribute("disabled"))return!1;let l=d(this,s,"f")||d(this,n,"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},T=function(l){let u=this.constructor,m={},p=u.validators,E=[],j=p.some(C=>C.isValid instanceof Promise);d(this,V,"f")||(g(this,L,new Promise(C=>{g(this,w,C,"f")}),"f"),g(this,V,!0,"f")),d(this,c,"f")&&(d(this,c,"f").abort(),g(this,a,d(this,c,"f"),"f"));let H=new AbortController;g(this,c,H,"f");let W,wt=!1;p.length&&(p.forEach(C=>{let rt=C.key||"customError",P=C.isValid(this,l,H.signal);P instanceof Promise?(E.push(P),P.then(at=>{at!=null&&(m[rt]=!at,W=d(this,t,"m",nt).call(this,C,l),d(this,t,"m",U).call(this,m,W))})):(m[rt]=!P,this.validity[rt]!==!P&&(wt=!0),!P&&!W&&(W=d(this,t,"m",nt).call(this,C,l)))}),Promise.allSettled(E).then(()=>{var C;H?.signal.aborted||(g(this,V,!1,"f"),(C=d(this,w,"f"))===null||C===void 0||C.call(this))}),(wt||!j)&&d(this,t,"m",U).call(this,m,W))},U=function(l,u){if(this.validationTarget)this.internals.setValidity(l,u,this.validationTarget),g(this,o,!1,"f");else{if(this.internals.setValidity(l,u),this.internals.validity.valid)return;g(this,o,!0,"f")}},nt=function(l,u){if(this.validityCallback){let m=this.validityCallback(l.key||"customError");if(m)return m}return l.message instanceof Function?l.message(this,u):l.message},zt}import{css as he,html as X,LitElement as Rt,nothing as mt}from"lit";import{property as O,state as ue}from"lit/decorators.js";import{ifDefined as gt}from"lit/directives/if-defined.js";var re=["en","nb","fi","da","sv"],ft="en",Q=i=>re.find(t=>i===t||i.toLowerCase().includes(t))||ft;function Tt(){if(typeof window>"u"){let i=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return Q(i)}try{let i=It(document);if(i)return Q(i);let t=ce();if(t)return Q(t);let e=It(qt());return e?Q(e):ft}catch(i){return console.warn("could not detect locale, falling back to source locale",i),ft}}var At=(i,t,e,s,n)=>{b.load("en",i),b.load("nb",t),b.load("fi",e),b.load("da",s),b.load("sv",n);let c=Tt();b.activate(c),Nt(),oe()},ae="warp-i18n-change";function Nt(){typeof window>"u"||window.dispatchEvent(new Event(ae))}var St=!1;function oe(){if(St||typeof window>"u"||!document?.documentElement)return;St=!0;let i=()=>{let n=Tt();b.locale!==n&&(b.activate(n),Nt())},t=new MutationObserver(n=>{for(let c of n)if(c.type==="attributes"&&c.attributeName==="lang"){i();break}});t.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let e=qt();e&&e.documentElement&&e!==document&&t.observe(e.documentElement,{attributes:!0,attributeFilter:["lang"]});let s=le();s&&t.observe(s,{attributes:!0,attributeFilter:["lang"]})}function qt(){try{return window.parent?.document??null}catch{return null}}function It(i){try{return i?.documentElement?.lang??""}catch{return""}}function le(){try{return window.frameElement??null}catch{return null}}function ce(){try{return window.frameElement?.getAttribute?.("lang")??""}catch{return""}}var Pt=JSON.parse('{"checkbox-group.label.optional":["Valgfri"],"checkbox-group.validation.required":["Mindst \xE9n valgt mulighed er p\xE5kr\xE6vet."]}');var Ot=JSON.parse('{"checkbox-group.label.optional":["Optional"],"checkbox-group.validation.required":["At least one selection is required."]}');var $t=JSON.parse('{"checkbox-group.label.optional":["Valinnainen"],"checkbox-group.validation.required":["V\xE4hint\xE4\xE4n yksi valinta vaaditaan."]}');var Dt=JSON.parse('{"checkbox-group.label.optional":["Valgfri"],"checkbox-group.validation.required":["Minst ett valg er p\xE5krevd."]}');var Ut=JSON.parse('{"checkbox-group.label.optional":["Valfritt"],"checkbox-group.validation.required":["Minst ett val kr\xE4vs."]}');At(Ot,Dt,$t,Pt,Ut);var de=()=>b._({id:"checkbox-group.validation.required",message:"At least one selection is required.",comment:"Shown when required checkbox group has no selections"}),$,B,D,tt,et,st,r,Z,it,pt,vt,Y,_t,J,jt,Ht,bt,Wt,N,yt,y=class extends Lt(Rt){constructor(){super(...arguments);x(this,r);this.optional=!1;this.required=!1;this.invalid=!1;x(this,$,!1);x(this,B,!1);this._internalTabIndex=-1;x(this,D);x(this,tt,()=>{h(this,r,Z).call(this),h(this,r,N).call(this),this.requestUpdate()});x(this,et,()=>{h(this,r,Z).call(this),h(this,r,N).call(this),this.requestUpdate()});x(this,st,()=>{h(this,r,vt).call(this),h(this,r,N).call(this),this.requestUpdate()});x(this,it,()=>{this.requestUpdate()})}render(){let e=h(this,r,pt).call(this)>0,n=this.required&&!e&&M(this,$),c=this.invalid||n,a=c?h(this,r,jt).call(this):this.helpText,o=a?"checkbox-group__help":void 0,f=this.label?"checkbox-group__label":void 0,v=c?"true":void 0;return X`
|
|
10
10
|
<div class="wrapper" tabindex="${this._internalTabIndex}">
|
|
11
11
|
${this.label?X`
|
|
12
12
|
<div class="label" id="${f}">
|
|
13
13
|
<span>${this.label}</span>
|
|
14
|
-
${this.optional?X`
|
|
14
|
+
${this.optional&&!this.required?X`
|
|
15
15
|
<span class="optional">
|
|
16
16
|
${b._({id:"checkbox-group.label.optional",message:"Optional",comment:"Shown behind label when marked as optional"})}
|
|
17
17
|
</span>
|
|
@@ -27,14 +27,14 @@ Please compile your catalog first.
|
|
|
27
27
|
>
|
|
28
28
|
<slot></slot>
|
|
29
29
|
</div>
|
|
30
|
-
${
|
|
30
|
+
${a?X`<div
|
|
31
31
|
class="${c?"help-text error":"help-text"}"
|
|
32
32
|
id="${o}"
|
|
33
33
|
>
|
|
34
|
-
${
|
|
34
|
+
${a}
|
|
35
35
|
</div>`:mt}
|
|
36
36
|
</div>
|
|
37
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener("change",M(this,tt)),this.addEventListener("invalid",M(this,et)),this.addEventListener("slotchange",M(this,st)),z(this,D,b.on("change",M(this,it))),this.setValue(null),h(this,
|
|
37
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener("change",M(this,tt)),this.addEventListener("invalid",M(this,et)),this.addEventListener("slotchange",M(this,st)),z(this,D,b.on("change",M(this,it))),this.setValue(null),h(this,r,yt).call(this)}disconnectedCallback(){var e;(e=M(this,D))==null||e.call(this),z(this,D,void 0),super.disconnectedCallback()}checkValidity(){return h(this,r,N).call(this),this.internals.checkValidity()}reportValidity(){return h(this,r,Z).call(this),h(this,r,N).call(this),this.internals.checkValidity()}focus(e){let s=h(this,r,_t).call(this);if(s?.focus){s.focus(e);return}HTMLElement.prototype.focus.call(this,e)}updated(e){super.updated(e),h(this,r,Ht).call(this,e)&&(e.has("name")&&h(this,r,vt).call(this),h(this,r,N).call(this))}};$=new WeakMap,B=new WeakMap,D=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,r=new WeakSet,Z=function(){z(this,$,!0)},it=new WeakMap,pt=function(){return h(this,r,J).call(this).filter(e=>e.checked).length},vt=function(){if(this.name)for(let e of h(this,r,J).call(this)){let s=e;s&&typeof s=="object"&&!s.name&&(s._groupName=this.name)}},Y=function(e){for(let s of h(this,r,J).call(this))"_groupInvalid"in s&&(s._groupInvalid=e)},_t=function(){return h(this,r,J).call(this)[0]},J=function(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??[]},jt=function(){return de()},Ht=function(e){return e.has("invalid")||e.has("required")||e.has("helpText")||e.has("name")},bt=function(e){let s=h(this,r,_t).call(this);this.internals.setValidity(e," ",s??void 0)},Wt=function(e){this._internalTabIndex=e?0:-1},N=function(){h(this,r,yt).call(this);let e=h(this,r,pt).call(this)>0,s=this.required&&!e,n=this.invalid,c=s&&M(this,$),a=n||c;if(h(this,r,Wt).call(this,a),s){h(this,r,bt).call(this,{valueMissing:!0}),h(this,r,Y).call(this,a);return}if(n){h(this,r,bt).call(this,{customError:!0}),h(this,r,Y).call(this,!0);return}this.internals.setValidity({}),h(this,r,Y).call(this,!1)},yt=function(){M(this,B)||this.internals.form&&(this.name&&this.name.trim().length>0||(console.warn('w-checkbox-group: "name" is required for form submission.'),z(this,B,!0)))},y.shadowRootOptions={...Rt.shadowRootOptions,delegatesFocus:!0},y.styles=he`
|
|
38
38
|
.wrapper {
|
|
39
39
|
display: inline-flex;
|
|
40
40
|
flex-direction: column;
|