@warp-ds/elements 2.8.2-next.2 → 2.8.2-next.4
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 +166 -69
- package/dist/index.d.ts +63 -11
- package/dist/packages/affix/affix.hydration.test.d.ts +1 -0
- package/dist/packages/affix/affix.hydration.test.js +33 -0
- package/dist/packages/affix/affix.js +3 -3
- package/dist/packages/affix/affix.js.map +3 -3
- package/dist/packages/alert/alert.hydration.test.d.ts +1 -0
- package/dist/packages/alert/alert.hydration.test.js +47 -0
- package/dist/packages/alert/alert.js +5 -5
- package/dist/packages/alert/alert.js.map +3 -3
- package/dist/packages/attention/attention.hydration.test.d.ts +1 -0
- package/dist/packages/attention/attention.hydration.test.js +66 -0
- package/dist/packages/attention/attention.js +11 -11
- package/dist/packages/attention/attention.js.map +3 -3
- package/dist/packages/badge/badge.hydration.test.d.ts +1 -0
- package/dist/packages/badge/badge.hydration.test.js +50 -0
- package/dist/packages/box/box.hydration.test.d.ts +1 -0
- package/dist/packages/box/box.hydration.test.js +37 -0
- package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.d.ts +1 -0
- package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +141 -0
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +2 -2
- package/dist/packages/button/button.hydration.test.d.ts +1 -0
- package/dist/packages/button/button.hydration.test.js +43 -0
- package/dist/packages/button/button.js +3 -3
- package/dist/packages/button/button.js.map +3 -3
- package/dist/packages/button/button.react.stories.d.ts +1 -1
- package/dist/packages/card/card.hydration.test.d.ts +1 -0
- package/dist/packages/card/card.hydration.test.js +38 -0
- package/dist/packages/card/card.react.stories.d.ts +1 -1
- package/dist/packages/checkbox/checkbox.d.ts +17 -1
- package/dist/packages/checkbox/checkbox.hydration.test.d.ts +1 -0
- package/dist/packages/checkbox/checkbox.hydration.test.js +47 -0
- package/dist/packages/checkbox/checkbox.js +20 -19
- package/dist/packages/checkbox/checkbox.js.map +3 -3
- package/dist/packages/checkbox/styles.js +10 -9
- package/dist/packages/checkbox-group/checkbox-group.d.ts +7 -0
- package/dist/packages/checkbox-group/checkbox-group.hydration.test.d.ts +2 -0
- package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +40 -0
- package/dist/packages/checkbox-group/checkbox-group.js +14 -14
- package/dist/packages/checkbox-group/checkbox-group.js.map +3 -3
- package/dist/packages/checkbox-group/checkbox-group.test.js +10 -0
- package/dist/packages/combobox/combobox.hydration.test.d.ts +1 -0
- package/dist/packages/combobox/combobox.hydration.test.js +43 -0
- package/dist/packages/combobox/combobox.react.stories.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.hydration.test.d.ts +1 -0
- package/dist/packages/datepicker/datepicker.hydration.test.js +40 -0
- package/dist/packages/datepicker/datepicker.js +1 -1
- package/dist/packages/datepicker/datepicker.js.map +3 -3
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +1 -1
- package/dist/packages/expandable/expandable.hydration.test.d.ts +1 -0
- package/dist/packages/expandable/expandable.hydration.test.js +47 -0
- package/dist/packages/expandable/expandable.js +3 -3
- package/dist/packages/expandable/expandable.js.map +3 -3
- package/dist/packages/icon/icon.hydration.test.d.ts +1 -0
- package/dist/packages/icon/icon.hydration.test.js +47 -0
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +3 -3
- package/dist/packages/link/link.hydration.test.d.ts +1 -0
- package/dist/packages/link/link.hydration.test.js +54 -0
- package/dist/packages/modal/modal.hydration.test.d.ts +1 -0
- package/dist/packages/modal/modal.hydration.test.js +25 -0
- package/dist/packages/modal-header/modal-header.js +6 -6
- package/dist/packages/modal-header/modal-header.js.map +3 -3
- package/dist/packages/page-indicator/page-indicator.hydration.test.d.ts +1 -0
- package/dist/packages/page-indicator/page-indicator.hydration.test.js +41 -0
- package/dist/packages/pagination/locales/da/messages.mjs +1 -1
- package/dist/packages/pagination/locales/en/messages.mjs +1 -1
- package/dist/packages/pagination/locales/fi/messages.mjs +1 -1
- package/dist/packages/pagination/locales/nb/messages.mjs +1 -1
- package/dist/packages/pagination/locales/sv/messages.mjs +1 -1
- package/dist/packages/pagination/pagination.hydration.test.d.ts +1 -0
- package/dist/packages/pagination/pagination.hydration.test.js +38 -0
- package/dist/packages/pagination/pagination.js +13 -13
- package/dist/packages/pagination/pagination.js.map +3 -3
- package/dist/packages/pill/pill.hydration.test.d.ts +1 -0
- package/dist/packages/pill/pill.hydration.test.js +32 -0
- package/dist/packages/pill/pill.js +1 -1
- package/dist/packages/pill/pill.js.map +3 -3
- package/dist/packages/radio/radio.d.ts +33 -1
- package/dist/packages/radio/radio.hydration.test.d.ts +1 -0
- package/dist/packages/radio/radio.hydration.test.js +29 -0
- package/dist/packages/radio/radio.js +7 -7
- package/dist/packages/radio/radio.js.map +3 -3
- package/dist/packages/radio/radio.test.js +15 -8
- package/dist/packages/radio-group/locales/da/messages.mjs +1 -1
- package/dist/packages/radio-group/locales/en/messages.mjs +1 -1
- package/dist/packages/radio-group/locales/fi/messages.mjs +1 -1
- package/dist/packages/radio-group/locales/nb/messages.mjs +1 -1
- package/dist/packages/radio-group/locales/sv/messages.mjs +1 -1
- package/dist/packages/radio-group/radio-group.a11y.test.js +4 -0
- package/dist/packages/radio-group/radio-group.hydration.test.d.ts +2 -0
- package/dist/packages/radio-group/radio-group.hydration.test.js +32 -0
- package/dist/packages/radio-group/radio-group.js +17 -17
- package/dist/packages/radio-group/radio-group.js.map +3 -3
- package/dist/packages/select/select.hydration.test.d.ts +1 -0
- package/dist/packages/select/select.hydration.test.js +37 -0
- package/dist/packages/select/select.js +1 -1
- package/dist/packages/select/select.js.map +3 -3
- package/dist/packages/select/select.react.stories.d.ts +1 -1
- package/dist/packages/slider/slider.hydration.test.d.ts +1 -0
- package/dist/packages/slider/slider.hydration.test.js +33 -0
- package/dist/packages/slider/slider.js +9 -9
- package/dist/packages/slider/slider.js.map +3 -3
- package/dist/packages/slider/slider.test.js +13 -0
- package/dist/packages/slider-thumb/slider-thumb.hydration.test.d.ts +1 -0
- package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +35 -0
- package/dist/packages/slider-thumb/slider-thumb.js +16 -16
- package/dist/packages/slider-thumb/slider-thumb.js.map +3 -3
- package/dist/packages/step/step.hydration.test.d.ts +1 -0
- package/dist/packages/step/step.hydration.test.js +25 -0
- package/dist/packages/step/step.js +1 -1
- package/dist/packages/step/step.js.map +3 -3
- package/dist/packages/step-indicator/step-indicator.hydration.test.d.ts +1 -0
- package/dist/packages/step-indicator/step-indicator.hydration.test.js +25 -0
- package/dist/packages/switch/switch.a11y.test.js +13 -3
- package/dist/packages/switch/switch.d.ts +6 -0
- package/dist/packages/switch/switch.hydration.test.d.ts +1 -0
- package/dist/packages/switch/switch.hydration.test.js +54 -0
- package/dist/packages/switch/switch.js +7 -13
- package/dist/packages/switch/switch.js.map +2 -2
- package/dist/packages/tab/tab.d.ts +37 -2
- package/dist/packages/tab/tab.hydration.test.d.ts +1 -0
- package/dist/packages/tab/tab.hydration.test.js +25 -0
- package/dist/packages/tab/tab.js +22 -12
- package/dist/packages/tab/tab.js.map +3 -3
- package/dist/packages/tab-panel/tab-panel.d.ts +21 -0
- package/dist/packages/tab-panel/tab-panel.hydration.test.d.ts +1 -0
- package/dist/packages/tab-panel/tab-panel.hydration.test.js +21 -0
- package/dist/packages/tab-panel/tab-panel.js +16 -5
- package/dist/packages/tab-panel/tab-panel.js.map +3 -3
- package/dist/packages/tabs/tabs.a11y.test.js +45 -3
- package/dist/packages/tabs/tabs.hydration.test.d.ts +1 -0
- package/dist/packages/tabs/tabs.hydration.test.js +20 -0
- package/dist/packages/tabs/tabs.js +6 -6
- package/dist/packages/tabs/tabs.js.map +3 -3
- package/dist/packages/tabs/tabs.test.js +52 -4
- package/dist/packages/textarea/textarea.hydration.test.d.ts +1 -0
- package/dist/packages/textarea/textarea.hydration.test.js +43 -0
- package/dist/packages/textarea/textarea.react.stories.d.ts +1 -1
- package/dist/packages/textfield/textfield.hydration.test.d.ts +1 -0
- package/dist/packages/textfield/textfield.hydration.test.js +43 -0
- package/dist/packages/textfield/textfield.react.stories.d.ts +1 -1
- package/dist/packages/toast/toast.js +4 -4
- package/dist/packages/toast/toast.js.map +3 -3
- package/dist/setup-tests.d.ts +2 -1
- package/dist/setup-tests.js +4 -3
- package/dist/tests/react-hydration.d.ts +20 -0
- package/dist/tests/react-hydration.js +138 -0
- package/dist/web-types.json +59 -21
- package/package.json +1 -1
|
@@ -44,15 +44,6 @@ export const styles = css `
|
|
|
44
44
|
--_border-color: var(--_border-checked);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
:host([invalid]) {
|
|
48
|
-
--_border-color: var(--_border-invalid);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
:host([invalid][checked]),
|
|
52
|
-
:host([invalid][indeterminate]) {
|
|
53
|
-
--_bg: var(--_bg-invalid-checked);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
47
|
:host([disabled]) {
|
|
57
48
|
--_bg: var(--_bg-disabled);
|
|
58
49
|
--_border-color: var(--_border-disabled);
|
|
@@ -112,6 +103,16 @@ export const styles = css `
|
|
|
112
103
|
font-size: var(--w-font-size-m);
|
|
113
104
|
}
|
|
114
105
|
|
|
106
|
+
/* Invalid visuals are driven by the actual control state instead of host attributes.
|
|
107
|
+
* This preserves group-driven invalid styling without mutating host attributes. */
|
|
108
|
+
[part='control']:has(> [part='input'][aria-invalid='true']:not(:disabled)) {
|
|
109
|
+
border-color: var(--_border-invalid);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[part='control']:has(> [part='input'][aria-invalid='true']:is(:checked, :indeterminate):not(:disabled)) {
|
|
113
|
+
background-color: var(--_bg-invalid-checked);
|
|
114
|
+
}
|
|
115
|
+
|
|
115
116
|
:host(:focus-visible) {
|
|
116
117
|
outline: none;
|
|
117
118
|
}
|
|
@@ -2,6 +2,12 @@ import { LitElement, PropertyValues } from 'lit';
|
|
|
2
2
|
declare const WCheckboxGroup_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & typeof LitElement;
|
|
3
3
|
export declare class WCheckboxGroup extends WCheckboxGroup_base {
|
|
4
4
|
#private;
|
|
5
|
+
static shadowRootOptions: {
|
|
6
|
+
delegatesFocus: boolean;
|
|
7
|
+
mode: ShadowRootMode;
|
|
8
|
+
serializable?: boolean;
|
|
9
|
+
slotAssignment?: SlotAssignmentMode;
|
|
10
|
+
};
|
|
5
11
|
/** The group label displayed above the checkboxes. */
|
|
6
12
|
label: string;
|
|
7
13
|
/** The name applied to child checkboxes when they do not provide one. */
|
|
@@ -13,6 +19,7 @@ export declare class WCheckboxGroup extends WCheckboxGroup_base {
|
|
|
13
19
|
required: boolean;
|
|
14
20
|
/** Marks the checkbox group as invalid. */
|
|
15
21
|
invalid: boolean;
|
|
22
|
+
private _internalTabIndex;
|
|
16
23
|
static styles: import("lit").CSSResult;
|
|
17
24
|
render(): import("lit").TemplateResult<1>;
|
|
18
25
|
connectedCallback(): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, test, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { setupHydrationWarningCapture, testHydration } from '../../tests/react-hydration';
|
|
3
|
+
import '../checkbox/checkbox.js';
|
|
4
|
+
import './checkbox-group.js';
|
|
5
|
+
describe('w-checkbox-group React SSR hydration', () => {
|
|
6
|
+
beforeEach(() => setupHydrationWarningCapture());
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
window.__HYDRATION_WARNINGS__ = [];
|
|
9
|
+
});
|
|
10
|
+
// Note: w-checkbox-group requires w-checkbox children to function properly.
|
|
11
|
+
// Testing the parent element alone to verify its own attributes don't cause mismatch.
|
|
12
|
+
test('default (no attributes) hydrates without warnings', async () => {
|
|
13
|
+
const warnings = await testHydration('w-checkbox-group', {});
|
|
14
|
+
expect(warnings).toEqual([]);
|
|
15
|
+
});
|
|
16
|
+
test('with label hydrates without warnings', async () => {
|
|
17
|
+
const warnings = await testHydration('w-checkbox-group', { label: 'Options' });
|
|
18
|
+
expect(warnings).toEqual([]);
|
|
19
|
+
});
|
|
20
|
+
test('with name hydrates without warnings', async () => {
|
|
21
|
+
const warnings = await testHydration('w-checkbox-group', { label: 'Options', name: 'options' });
|
|
22
|
+
expect(warnings).toEqual([]);
|
|
23
|
+
});
|
|
24
|
+
test('with optional hydrates without warnings', async () => {
|
|
25
|
+
const warnings = await testHydration('w-checkbox-group', { label: 'Options', optional: true });
|
|
26
|
+
expect(warnings).toEqual([]);
|
|
27
|
+
});
|
|
28
|
+
test('with help-text hydrates without warnings', async () => {
|
|
29
|
+
const warnings = await testHydration('w-checkbox-group', { label: 'Options', 'help-text': 'Select one or more' });
|
|
30
|
+
expect(warnings).toEqual([]);
|
|
31
|
+
});
|
|
32
|
+
test('invalid checkbox-group hydrates without warnings', async () => {
|
|
33
|
+
const warnings = await testHydration('w-checkbox-group', { label: 'Options', invalid: true });
|
|
34
|
+
expect(warnings).toEqual([]);
|
|
35
|
+
});
|
|
36
|
+
test('required checkbox-group hydrates without warnings', async () => {
|
|
37
|
+
const warnings = await testHydration('w-checkbox-group', { label: 'Options', required: true });
|
|
38
|
+
expect(warnings).toEqual([]);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var it=Object.create;var
|
|
2
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function
|
|
1
|
+
var it=Object.create;var he=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var at=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty;var ke=s=>{throw TypeError(s)};var Te=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var lt=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nt(e))!ot.call(s,i)&&i!==t&&he(s,i,{get:()=>e[i],enumerable:!(r=Le(e,i))||r.enumerable});return s};var ct=(s,e,t)=>(t=s!=null?it(at(s)):{},lt(e||!s||!s.__esModule?he(t,"default",{value:s,enumerable:!0}):t,s));var I=(s,e,t,r)=>{for(var i=r>1?void 0:r?Le(e,t):e,l=s.length-1,a;l>=0;l--)(a=s[l])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&he(e,t,i),i};var fe=(s,e,t)=>e.has(s)||ke("Cannot "+t);var F=(s,e,t)=>(fe(s,e,"read from private field"),t?t.call(s):e.get(s)),S=(s,e,t)=>e.has(s)?ke("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),K=(s,e,t,r)=>(fe(s,e,"write to private field"),r?r.call(s,t):e.set(s,t),t),d=(s,e,t)=>(fe(s,e,"access private method"),t);var Ve=Te(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.errorMessages=A.ErrorType=void 0;var $;(function(s){s.MalformedUnicode="MALFORMED_UNICODE",s.MalformedHexadecimal="MALFORMED_HEXADECIMAL",s.CodePointLimit="CODE_POINT_LIMIT",s.OctalDeprecation="OCTAL_DEPRECATION",s.EndOfString="END_OF_STRING"})($=A.ErrorType||(A.ErrorType={}));A.errorMessages=new Map([[$.MalformedUnicode,"malformed Unicode character escape sequence"],[$.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[$.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[$.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[$.EndOfString,"malformed escape sequence at end of string"]])});var Ne=Te(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.unraw=L.errorMessages=L.ErrorType=void 0;var _=Ve();Object.defineProperty(L,"ErrorType",{enumerable:!0,get:function(){return _.ErrorType}});Object.defineProperty(L,"errorMessages",{enumerable:!0,get:function(){return _.errorMessages}});function ut(s){return!s.match(/[^a-f0-9]/i)?parseInt(s,16):NaN}function Z(s,e,t){let r=ut(s);if(Number.isNaN(r)||t!==void 0&&t!==s.length)throw new SyntaxError(_.errorMessages.get(e));return r}function dt(s){let e=Z(s,_.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(e)}function Ie(s,e){let t=Z(s,_.ErrorType.MalformedUnicode,4);if(e!==void 0){let r=Z(e,_.ErrorType.MalformedUnicode,4);return String.fromCharCode(t,r)}return String.fromCharCode(t)}function ht(s){return s.charAt(0)==="{"&&s.charAt(s.length-1)==="}"}function ft(s){if(!ht(s))throw new SyntaxError(_.errorMessages.get(_.ErrorType.MalformedUnicode));let e=s.slice(1,-1),t=Z(e,_.ErrorType.MalformedUnicode);try{return String.fromCodePoint(t)}catch(r){throw r instanceof RangeError?new SyntaxError(_.errorMessages.get(_.ErrorType.CodePointLimit)):r}}function mt(s,e=!1){if(e)throw new SyntaxError(_.errorMessages.get(_.ErrorType.OctalDeprecation));let t=parseInt(s,8);return String.fromCharCode(t)}var gt=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function pt(s){return gt.get(s)||s}var vt=/\\(?:(\\)|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 Oe(s,e=!1){return s.replace(vt,function(t,r,i,l,a,n,u,m,E){if(r!==void 0)return"\\";if(i!==void 0)return dt(i);if(l!==void 0)return ft(l);if(a!==void 0)return Ie(a,n);if(u!==void 0)return Ie(u);if(m==="0")return"\0";if(m!==void 0)return mt(m,!e);if(E!==void 0)return pt(E);throw new SyntaxError(_.errorMessages.get(_.ErrorType.EndOfString))})}L.unraw=Oe;L.default=Oe});var De=ct(Ne(),1);var O=s=>typeof s=="string",_t=s=>typeof s=="function",Ae=new Map,qe="en";function ve(s){return[...Array.isArray(s)?s:[s],qe]}function _e(s,e,t){let r=ve(s);t||(t="default");let i;if(typeof t=="string")switch(i={day:"numeric",month:"short",year:"numeric"},t){case"full":i.weekday="long";case"long":i.month="long";break;case"short":i.month="numeric";break}else i=t;return Y(()=>ee("date",r,t),()=>new Intl.DateTimeFormat(r,i)).format(O(e)?new Date(e):e)}function bt(s,e,t){let r;if(t||(t="default"),typeof t=="string")switch(r={second:"numeric",minute:"numeric",hour:"numeric"},t){case"full":case"long":r.timeZoneName="short";break;case"short":delete r.second}else r=t;return _e(s,e,r)}function me(s,e,t){let r=ve(s);return Y(()=>ee("number",r,t),()=>new Intl.NumberFormat(r,t)).format(e)}function Pe(s,e,t,{offset:r=0,...i}){var n,u;let l=ve(s),a=e?Y(()=>ee("plural-ordinal",l),()=>new Intl.PluralRules(l,{type:"ordinal"})):Y(()=>ee("plural-cardinal",l),()=>new Intl.PluralRules(l,{type:"cardinal"}));return(u=(n=i[t])!=null?n:i[a.select(t-r)])!=null?u:i.other}function Y(s,e){let t=s(),r=Ae.get(t);return r||(r=e(),Ae.set(t,r)),r}function ee(s,e,t){let r=e.join("-");return`${s}-${r}-${JSON.stringify(t)}`}var Ue=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,$e="%__lingui_octothorpe__%",yt=(s,e,t={})=>{let r=e||s,i=a=>typeof a=="object"?a:t[a],l=(a,n)=>{let u=Object.keys(t).length?i("number"):void 0,m=me(r,a,u);return n.replace(new RegExp($e,"g"),m)};return{plural:(a,n)=>{let{offset:u=0}=n,m=Pe(r,!1,a,n);return l(a-u,m)},selectordinal:(a,n)=>{let{offset:u=0}=n,m=Pe(r,!0,a,n);return l(a-u,m)},select:wt,number:(a,n)=>me(r,a,i(n)||{style:n}),date:(a,n)=>_e(r,a,i(n)||n),time:(a,n)=>bt(r,a,i(n)||n)}},wt=(s,e)=>{var t;return(t=e[s])!=null?t:e.other};function Mt(s,e,t){return(r={},i)=>{let l=yt(e,t,i),a=(u,m=!1)=>Array.isArray(u)?u.reduce((E,k)=>{if(k==="#"&&m)return E+$e;if(O(k))return E+k;let[q,w,T]=k,V={};w==="plural"||w==="selectordinal"||w==="select"?Object.entries(T).forEach(([N,z])=>{V[N]=a(z,w==="plural"||w==="selectordinal")}):V=T;let b;if(w){let N=l[w];b=N(r[q],V)}else b=r[q];return b==null?E:E+b},""):u,n=a(s);return O(n)&&Ue.test(n)?(0,De.unraw)(n):O(n)?n:n?String(n):""}}var Ct=Object.defineProperty,Et=(s,e,t)=>e in s?Ct(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,xt=(s,e,t)=>(Et(s,typeof e!="symbol"?e+"":e,t),t),ge=class{constructor(){xt(this,"_events",{})}on(e,t){var i;var r;return(i=(r=this._events)[e])!=null||(r[e]=[]),this._events[e].push(t),()=>this.removeListener(e,t)}removeListener(e,t){let r=this._getListeners(e);if(!r)return;let i=r.indexOf(t);~i&&r.splice(i,1)}emit(e,...t){let r=this._getListeners(e);r&&r.map(i=>i.apply(this,t))}_getListeners(e){let t=this._events[e];return Array.isArray(t)?t:!1}},Ft=Object.defineProperty,St=(s,e,t)=>e in s?Ft(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,P=(s,e,t)=>(St(s,typeof e!="symbol"?e+"":e,t),t),pe=class extends ge{constructor(e){var t;super(),P(this,"_locale",""),P(this,"_locales"),P(this,"_localeData",{}),P(this,"_messages",{}),P(this,"_missing"),P(this,"_messageCompiler"),P(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((t=e.locale)!=null?t:qe,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,t){let r=this._localeData[e];r?Object.assign(r,t):this._localeData[e]=t}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,t){typeof e=="string"?this._loadLocaleData(e,t):Object.keys(e).forEach(r=>this._loadLocaleData(r,e[r])),this.emit("change")}_load(e,t){let r=this._messages[e];r?Object.assign(r,t):this._messages[e]=t}load(e,t){typeof e=="string"&&typeof t=="object"?this._load(e,t):Object.entries(e).forEach(([r,i])=>this._load(r,i)),this.emit("change")}loadAndActivate({locale:e,locales:t,messages:r}){this._locale=e,this._locales=t||void 0,this._messages[this._locale]=r,this.emit("change")}activate(e,t){this._locale=e,this._locales=t,this.emit("change")}_(e,t,r){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 i=r==null?void 0:r.message;e||(e=""),O(e)||(t=e.values||t,i=e.message,e=e.id);let l=this.messages[e],a=l===void 0,n=this._missing;if(n&&a)return _t(n)?n(this._locale,e):n;a&&this.emit("missing",{id:e,locale:this._locale});let u=l||i||e;return O(u)&&(this._messageCompiler?u=this._messageCompiler(u):console.warn(`Uncompiled message detected! Message:
|
|
3
3
|
|
|
4
4
|
> ${u}
|
|
5
5
|
|
|
@@ -7,30 +7,30 @@ 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
|
-
`)),O(u)
|
|
11
|
-
<div class="wrapper">
|
|
12
|
-
${this.label?
|
|
10
|
+
`)),O(u)&&Ue.test(u)?JSON.parse(`"${u}"`):O(u)?u:Mt(u,this._locale,this._locales)(t,r==null?void 0:r.formats)}date(e,t){return _e(this._locales||this._locale,e,t)}number(e,t){return me(this._locales||this._locale,e,t)}};function Lt(s={}){return new pe(s)}var y=Lt();var f=function(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)},p=function(s,e,t,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!i:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(s,t):i?i.value=t:e.set(s,t),t};function Re(s){var e,t,r,i,l,a,n,u,m,E,k,q,w,T,V,b,N,z,ce;class rt extends s{constructor(...c){var h,g,v;super(...c),e.add(this),this.internals=this.attachInternals(),t.set(this,!1),r.set(this,!1),i.set(this,!1),l.set(this,void 0),a.set(this,void 0),n.set(this,!0),m.set(this,""),E.set(this,()=>{p(this,i,!0,"f"),p(this,t,!0,"f"),f(this,e,"m",b).call(this)}),k.set(this,()=>{p(this,t,!1,"f"),f(this,e,"m",N).call(this,this.shouldFormValueUpdate()?f(this,m,"f"):""),!this.validity.valid&&f(this,i,"f")&&p(this,r,!0,"f");let x=f(this,e,"m",b).call(this);this.validationMessageCallback&&this.validationMessageCallback(x?this.internals.validationMessage:"")}),q.set(this,()=>{var x;f(this,n,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),p(this,n,!1,"f")),p(this,i,!0,"f"),p(this,r,!0,"f"),f(this,e,"m",b).call(this),(x=this===null||this===void 0?void 0:this.validationMessageCallback)===null||x===void 0||x.call(this,this.showError?this.internals.validationMessage:"")}),w.set(this,void 0),T.set(this,!1),V.set(this,Promise.resolve()),(h=this.addEventListener)===null||h===void 0||h.call(this,"focus",f(this,E,"f")),(g=this.addEventListener)===null||g===void 0||g.call(this,"blur",f(this,k,"f")),(v=this.addEventListener)===null||v===void 0||v.call(this,"invalid",f(this,q,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let c=this.validators.map(v=>v.attribute).flat(),h=super.observedAttributes||[];return[...new Set([...h,...c])]}static getValidator(c){return this.validators.find(h=>h.attribute===c)||null}static getValidators(c){return this.validators.filter(h=>{var g;if(h.attribute===c||!((g=h.attribute)===null||g===void 0)&&g.includes(c))return!0})}get form(){return this.internals.form}get showError(){return f(this,e,"m",b).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(c,h,g){var v;(v=super.attributeChangedCallback)===null||v===void 0||v.call(this,c,h,g);let W=this.constructor.getValidators(c);W!=null&&W.length&&this.validationTarget&&this.setValue(f(this,m,"f"))}setValue(c){var h;p(this,r,!1,"f"),(h=this.validationMessageCallback)===null||h===void 0||h.call(this,""),p(this,m,c,"f");let v=this.shouldFormValueUpdate()?c:null;this.internals.setFormValue(v),f(this,e,"m",N).call(this,v),this.valueChangedCallback&&this.valueChangedCallback(v),f(this,e,"m",b).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(c=>c(f(this,V,"f")))}formResetCallback(){var c,h;p(this,i,!1,"f"),p(this,r,!1,"f"),f(this,e,"m",b).call(this),(c=this.resetFormControl)===null||c===void 0||c.call(this),(h=this.validationMessageCallback)===null||h===void 0||h.call(this,f(this,e,"m",b).call(this)?this.validationMessage:"")}}return t=new WeakMap,r=new WeakMap,i=new WeakMap,l=new WeakMap,a=new WeakMap,n=new WeakMap,m=new WeakMap,E=new WeakMap,k=new WeakMap,q=new WeakMap,w=new WeakMap,T=new WeakMap,V=new WeakMap,e=new WeakSet,u=function(){let c=this.getRootNode(),h=`${this.localName}[name="${this.getAttribute("name")}"]`;return c.querySelectorAll(h)},b=function(){if(this.hasAttribute("disabled"))return!1;let c=f(this,r,"f")||f(this,i,"f")&&!this.validity.valid&&!f(this,t,"f");return c&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),c},N=function(c){let h=this.constructor,g={},v=h.validators,x=[],W=v.some(M=>M.isValid instanceof Promise);f(this,T,"f")||(p(this,V,new Promise(M=>{p(this,w,M,"f")}),"f"),p(this,T,!0,"f")),f(this,l,"f")&&(f(this,l,"f").abort(),p(this,a,f(this,l,"f"),"f"));let B=new AbortController;p(this,l,B,"f");let G,Se=!1;v.length&&(v.forEach(M=>{let ue=M.key||"customError",U=M.isValid(this,c,B.signal);U instanceof Promise?(x.push(U),U.then(de=>{de!=null&&(g[ue]=!de,G=f(this,e,"m",ce).call(this,M,c),f(this,e,"m",z).call(this,g,G))})):(g[ue]=!U,this.validity[ue]!==!U&&(Se=!0),!U&&!G&&(G=f(this,e,"m",ce).call(this,M,c)))}),Promise.allSettled(x).then(()=>{var M;B!=null&&B.signal.aborted||(p(this,T,!1,"f"),(M=f(this,w,"f"))===null||M===void 0||M.call(this))}),(Se||!W)&&f(this,e,"m",z).call(this,g,G))},z=function(c,h){if(this.validationTarget)this.internals.setValidity(c,h,this.validationTarget),p(this,n,!1,"f");else{if(this.internals.setValidity(c,h),this.internals.validity.valid)return;p(this,n,!0,"f")}},ce=function(c,h){if(this.validityCallback){let g=this.validityCallback(c.key||"customError");if(g)return g}return c.message instanceof Function?c.message(this,h):c.message},rt}import{css as Nt,html as se,LitElement as Ye,nothing as ye}from"lit";import{property as R,state as At}from"lit/decorators.js";import{ifDefined as we}from"lit/directives/if-defined.js";var kt=["en","nb","fi","da","sv"],be="en",te=s=>kt.find(e=>s===e||s.toLowerCase().includes(e))||be;function ze(){if(typeof window=="undefined"){let s=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return te(s)}try{let s=je(document);if(s)return te(s);let e=Ot();if(e)return te(e);let t=je(Be());return t?te(t):be}catch(s){return console.warn("could not detect locale, falling back to source locale",s),be}}var Je=(s,e,t,r,i)=>{y.load("en",s),y.load("nb",e),y.load("fi",t),y.load("da",r),y.load("sv",i);let l=ze();y.activate(l),We(),Vt()},Tt="warp-i18n-change";function We(){typeof window!="undefined"&&window.dispatchEvent(new Event(Tt))}var He=!1;function Vt(){if(He||typeof window=="undefined"||!(document!=null&&document.documentElement))return;He=!0;let s=()=>{let i=ze();y.locale!==i&&(y.activate(i),We())},e=new MutationObserver(i=>{for(let l of i)if(l.type==="attributes"&&l.attributeName==="lang"){s();break}});e.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let t=Be();t&&t.documentElement&&t!==document&&e.observe(t.documentElement,{attributes:!0,attributeFilter:["lang"]});let r=It();r&&e.observe(r,{attributes:!0,attributeFilter:["lang"]})}function Be(){var s,e;try{return(e=(s=window.parent)==null?void 0:s.document)!=null?e:null}catch(t){return null}}function je(s){var e,t;try{return(t=(e=s==null?void 0:s.documentElement)==null?void 0:e.lang)!=null?t:""}catch(r){return""}}function It(){var s;try{return(s=window.frameElement)!=null?s:null}catch(e){return null}}function Ot(){var s,e,t;try{return(t=(e=(s=window.frameElement)==null?void 0:s.getAttribute)==null?void 0:e.call(s,"lang"))!=null?t:""}catch(r){return""}}var Ge=JSON.parse('{"checkbox-group.validation.required":["Mindst \xE9n valgt mulighed er p\xE5kr\xE6vet."],"checkbox-group.label.optional":["Valgfri"]}');var Ke=JSON.parse('{"checkbox-group.validation.required":["At least one selection is required."],"checkbox-group.label.optional":["Optional"]}');var Xe=JSON.parse('{"checkbox-group.validation.required":["V\xE4hint\xE4\xE4n yksi valinta vaaditaan."],"checkbox-group.label.optional":["Valinnainen"]}');var Qe=JSON.parse('{"checkbox-group.validation.required":["Minst ett valg er p\xE5krevd."],"checkbox-group.label.optional":["Valgfri"]}');var Ze=JSON.parse('{"checkbox-group.validation.required":["Minst ett val kr\xE4vs."],"checkbox-group.label.optional":["Valfritt"]}');Je(Ke,Qe,Xe,Ge,Ze);var Pt=()=>y._({id:"checkbox-group.validation.required",message:"At least one selection is required.",comment:"Shown when required checkbox group has no selections"}),H,Q,j,ne,ae,oe,o,re,le,Me,Ce,ie,Ee,X,et,tt,xe,st,D,Fe,C=class extends Re(Ye){constructor(){super(...arguments);S(this,o);this.optional=!1;this.required=!1;this.invalid=!1;S(this,H,!1);S(this,Q,!1);this._internalTabIndex=-1;S(this,j);S(this,ne,()=>{d(this,o,re).call(this),d(this,o,D).call(this),this.requestUpdate()});S(this,ae,()=>{d(this,o,re).call(this),d(this,o,D).call(this),this.requestUpdate()});S(this,oe,()=>{d(this,o,Ce).call(this),d(this,o,D).call(this),this.requestUpdate()});S(this,le,()=>{this.requestUpdate()})}render(){let t=d(this,o,Me).call(this)>0,i=this.required&&!t&&F(this,H),l=this.invalid||i,a=l?d(this,o,et).call(this):this.helpText,n=a?"checkbox-group__help":void 0,u=this.label?"checkbox-group__label":void 0,m=l?"true":void 0;return se`
|
|
11
|
+
<div class="wrapper" tabindex="${this._internalTabIndex}">
|
|
12
|
+
${this.label?se`
|
|
13
13
|
<div class="label" id="${u}">
|
|
14
14
|
<span>${this.label}</span>
|
|
15
|
-
${this.optional?
|
|
15
|
+
${this.optional?se`
|
|
16
16
|
<span class="optional">
|
|
17
17
|
${y._({id:"checkbox-group.label.optional",message:"Optional",comment:"Shown behind label when marked as optional"})}
|
|
18
18
|
</span>
|
|
19
|
-
`:
|
|
19
|
+
`:ye}
|
|
20
20
|
</div>
|
|
21
|
-
`:
|
|
21
|
+
`:ye}
|
|
22
22
|
<div
|
|
23
23
|
class="checkbox-group"
|
|
24
24
|
role="group"
|
|
25
|
-
aria-labelledby=${
|
|
26
|
-
aria-describedby=${
|
|
27
|
-
aria-invalid=${
|
|
25
|
+
aria-labelledby=${we(u)}
|
|
26
|
+
aria-describedby=${we(n)}
|
|
27
|
+
aria-invalid=${we(m)}
|
|
28
28
|
>
|
|
29
29
|
<slot></slot>
|
|
30
30
|
</div>
|
|
31
|
-
${a?
|
|
31
|
+
${a?se`<div class="${l?"help-text error":"help-text"}" id="${n}">${a}</div>`:ye}
|
|
32
32
|
</div>
|
|
33
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener("change",
|
|
33
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener("change",F(this,ne)),this.addEventListener("invalid",F(this,ae)),this.addEventListener("slotchange",F(this,oe)),K(this,j,y.on("change",F(this,le))),this.setValue(null),d(this,o,Fe).call(this)}disconnectedCallback(){var t;(t=F(this,j))==null||t.call(this),K(this,j,void 0),super.disconnectedCallback()}checkValidity(){return d(this,o,D).call(this),this.internals.checkValidity()}reportValidity(){return d(this,o,re).call(this),d(this,o,D).call(this),this.internals.checkValidity()}focus(t){let r=d(this,o,Ee).call(this);if(r!=null&&r.focus){r.focus(t);return}HTMLElement.prototype.focus.call(this,t)}updated(t){super.updated(t),d(this,o,tt).call(this,t)&&(t.has("name")&&d(this,o,Ce).call(this),d(this,o,D).call(this))}};H=new WeakMap,Q=new WeakMap,j=new WeakMap,ne=new WeakMap,ae=new WeakMap,oe=new WeakMap,o=new WeakSet,re=function(){K(this,H,!0)},le=new WeakMap,Me=function(){return d(this,o,X).call(this).filter(t=>t.checked).length},Ce=function(){if(this.name)for(let t of d(this,o,X).call(this)){let r=t;r&&typeof r=="object"&&!r.name&&(r._groupName=this.name)}},ie=function(t){for(let r of d(this,o,X).call(this))"_groupInvalid"in r&&(r._groupInvalid=t)},Ee=function(){return d(this,o,X).call(this)[0]},X=function(){var r,i;let t=(r=this.shadowRoot)==null?void 0:r.querySelector("slot");return(i=t==null?void 0:t.assignedElements({flatten:!0}))!=null?i:[]},et=function(){return Pt()},tt=function(t){return t.has("invalid")||t.has("required")||t.has("helpText")||t.has("name")},xe=function(t){let r=d(this,o,Ee).call(this);this.internals.setValidity(t," ",r!=null?r:void 0)},st=function(t){this._internalTabIndex=t?0:-1},D=function(){d(this,o,Fe).call(this);let t=d(this,o,Me).call(this)>0,r=this.required&&!t,i=this.invalid,l=r&&F(this,H),a=i||l;if(d(this,o,st).call(this,a),r){d(this,o,xe).call(this,{valueMissing:!0}),d(this,o,ie).call(this,a);return}if(i){d(this,o,xe).call(this,{customError:!0}),d(this,o,ie).call(this,!0);return}this.internals.setValidity({}),d(this,o,ie).call(this,!1)},Fe=function(){F(this,Q)||this.internals.form&&(this.name&&this.name.trim().length>0||(console.warn('w-checkbox-group: "name" is required for form submission.'),K(this,Q,!0)))},C.shadowRootOptions={...Ye.shadowRootOptions,delegatesFocus:!0},C.styles=Nt`
|
|
34
34
|
.wrapper {
|
|
35
35
|
display: inline-flex;
|
|
36
36
|
flex-direction: column;
|
|
@@ -67,5 +67,5 @@ Please compile your catalog first.
|
|
|
67
67
|
.error {
|
|
68
68
|
color: var(--w-s-color-text-negative);
|
|
69
69
|
}
|
|
70
|
-
`,
|
|
70
|
+
`,I([R({type:String,reflect:!0})],C.prototype,"label",2),I([R({type:String,reflect:!0})],C.prototype,"name",2),I([R({type:Boolean,reflect:!0})],C.prototype,"optional",2),I([R({type:String,reflect:!0,attribute:"help-text"})],C.prototype,"helpText",2),I([R({type:Boolean,reflect:!0})],C.prototype,"required",2),I([R({type:Boolean,reflect:!0})],C.prototype,"invalid",2),I([At()],C.prototype,"_internalTabIndex",2);customElements.get("w-checkbox-group")||customElements.define("w-checkbox-group",C);export{C as WCheckboxGroup};
|
|
71
71
|
//# sourceMappingURL=checkbox-group.js.map
|