@warp-ds/elements 2.8.2-next.2 → 2.8.2-next.3
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/pagination.hydration.test.d.ts +1 -0
- package/dist/packages/pagination/pagination.hydration.test.js +38 -0
- package/dist/packages/pagination/pagination.js +11 -11
- 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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './pill.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, test, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { setupHydrationWarningCapture, testHydration } from '../../tests/react-hydration';
|
|
3
|
+
import './pill.js';
|
|
4
|
+
describe('w-pill React SSR hydration', () => {
|
|
5
|
+
beforeEach(() => setupHydrationWarningCapture());
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
window.__HYDRATION_WARNINGS__ = [];
|
|
8
|
+
});
|
|
9
|
+
test('default (no attributes) hydrates without warnings', async () => {
|
|
10
|
+
const warnings = await testHydration('w-pill', {});
|
|
11
|
+
expect(warnings).toEqual([]);
|
|
12
|
+
});
|
|
13
|
+
test('suggestion pill hydrates without warnings', async () => {
|
|
14
|
+
const warnings = await testHydration('w-pill', {
|
|
15
|
+
suggestion: true,
|
|
16
|
+
});
|
|
17
|
+
expect(warnings).toEqual([]);
|
|
18
|
+
});
|
|
19
|
+
test('with can-close hydrates without warnings', async () => {
|
|
20
|
+
const warnings = await testHydration('w-pill', {
|
|
21
|
+
'can-close': true,
|
|
22
|
+
});
|
|
23
|
+
expect(warnings).toEqual([]);
|
|
24
|
+
});
|
|
25
|
+
test('suggestion with can-close hydrates without warnings', async () => {
|
|
26
|
+
const warnings = await testHydration('w-pill', {
|
|
27
|
+
suggestion: true,
|
|
28
|
+
'can-close': true,
|
|
29
|
+
});
|
|
30
|
+
expect(warnings).toEqual([]);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -24,7 +24,7 @@ var we=Object.create;var j=Object.defineProperty;var Z=Object.getOwnPropertyDesc
|
|
|
24
24
|
--w-icon-size: 32px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
`;var A=new Map,Fe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function Oe(o,e={}){var t;let r=(t=e.responseParser)!=null?t:(a=>a.text());return A.has(o)||A.set(o,fetch(o).then(r)),A.get(o)}var h=class extends Me{constructor(){super(...arguments);this.
|
|
27
|
+
`;var A=new Map,Fe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function Oe(o,e={}){var t;let r=(t=e.responseParser)!=null?t:(a=>a.text());return A.has(o)||A.set(o,fetch(o).then(r)),A.get(o)}var h=class extends Me{constructor(){super(...arguments);this.svg=null}async fetchIcon(r){let a=`https://assets.finn.no/pkg/eikons/v1/${this.locale||"en"}/${r}.svg`;try{let s=await Oe(a);return new DOMParser().parseFromString(s,"text/html").body.querySelector("svg")}catch(s){return null}}firstUpdated(){this.loadIcon()}updated(r){(r.has("name")||r.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let r=await this.fetchIcon(this.name);r||(r=new DOMParser().parseFromString(Fe,"text/html").body.firstElementChild),this.svg=r}render(){let r=this.size||"medium",t=this.name||"",a={"w-icon":!0,"w-icon--s":r==="small","w-icon--m":r==="medium","w-icon--l":r==="large"},s=typeof r=="string"&&r.endsWith("px")?`--w-icon-size: ${r};`:"";return Ce`<div class="${Se(a)}" style="${s}" part="w-${t.toLowerCase()}">${this.svg}</div>`}};h.styles=[G],p([D({type:String,reflect:!0})],h.prototype,"name",2),p([D({type:String,reflect:!0})],h.prototype,"size",2),p([D({type:String,reflect:!0})],h.prototype,"locale",2),p([Le()],h.prototype,"svg",2);customElements.get("w-icon")||customElements.define("w-icon",h);var C=function(){for(var o=[],e=arguments.length;e--;)o[e]=arguments[e];return o.reduce(function(r,t){return r.concat(typeof t=="string"?t:Array.isArray(t)?C.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(a){return t[a]?a:""}):"")},[]).join(" ")};var ee=ze(K(),1);var v=o=>typeof o=="string",Ie=o=>typeof o=="function",Q=new Map,re="en";function I(o){return[...Array.isArray(o)?o:[o],re]}function R(o,e,r){let t=I(o);r||(r="default");let a;if(typeof r=="string")switch(a={day:"numeric",month:"short",year:"numeric"},r){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=r;return L(()=>S("date",t,r),()=>new Intl.DateTimeFormat(t,a)).format(v(e)?new Date(e):e)}function Re(o,e,r){let t;if(r||(r="default"),typeof r=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},r){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=r;return R(o,e,t)}function $(o,e,r){let t=I(o);return L(()=>S("number",t,r),()=>new Intl.NumberFormat(t,r)).format(e)}function W(o,e,r,{offset:t=0,...a}){var i,l;let s=I(o),n=e?L(()=>S("plural-ordinal",s),()=>new Intl.PluralRules(s,{type:"ordinal"})):L(()=>S("plural-cardinal",s),()=>new Intl.PluralRules(s,{type:"cardinal"}));return(l=(i=a[r])!=null?i:a[n.select(r-t)])!=null?l:a.other}function L(o,e){let r=o(),t=Q.get(r);return t||(t=e(),Q.set(r,t)),t}function S(o,e,r){let t=e.join("-");return`${o}-${t}-${JSON.stringify(r)}`}var oe=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,te="%__lingui_octothorpe__%",Ue=(o,e,r={})=>{let t=e||o,a=n=>typeof n=="object"?n:r[n],s=(n,i)=>{let l=Object.keys(r).length?a("number"):void 0,g=$(t,n,l);return i.replace(new RegExp(te,"g"),g)};return{plural:(n,i)=>{let{offset:l=0}=i,g=W(t,!1,n,i);return s(n-l,g)},selectordinal:(n,i)=>{let{offset:l=0}=i,g=W(t,!0,n,i);return s(n-l,g)},select:Xe,number:(n,i)=>$(t,n,a(i)||{style:i}),date:(n,i)=>R(t,n,a(i)||i),time:(n,i)=>Re(t,n,a(i)||i)}},Xe=(o,e)=>{var r;return(r=e[o])!=null?r:e.other};function He(o,e,r){return(t={},a)=>{let s=Ue(e,r,a),n=(l,g=!1)=>Array.isArray(l)?l.reduce((f,z)=>{if(z==="#"&&g)return f+te;if(v(z))return f+z;let[X,w,H]=z,T={};w==="plural"||w==="selectordinal"||w==="select"?Object.entries(H).forEach(([N,fe])=>{T[N]=n(fe,w==="plural"||w==="selectordinal")}):T=H;let E;if(w){let N=s[w];E=N(t[X],T)}else E=t[X];return E==null?f:f+E},""):l,i=n(o);return v(i)&&oe.test(i)?(0,ee.unraw)(i):v(i)?i:i?String(i):""}}var Ze=Object.defineProperty,qe=(o,e,r)=>e in o?Ze(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,Ge=(o,e,r)=>(qe(o,typeof e!="symbol"?e+"":e,r),r),P=class{constructor(){Ge(this,"_events",{})}on(e,r){var a;var t;return(a=(t=this._events)[e])!=null||(t[e]=[]),this._events[e].push(r),()=>this.removeListener(e,r)}removeListener(e,r){let t=this._getListeners(e);if(!t)return;let a=t.indexOf(r);~a&&t.splice(a,1)}emit(e,...r){let t=this._getListeners(e);t&&t.map(a=>a.apply(this,r))}_getListeners(e){let r=this._events[e];return Array.isArray(r)?r:!1}},Je=Object.defineProperty,Ve=(o,e,r)=>e in o?Je(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,k=(o,e,r)=>(Ve(o,typeof e!="symbol"?e+"":e,r),r),Y=class extends P{constructor(e){var r;super(),k(this,"_locale",""),k(this,"_locales"),k(this,"_localeData",{}),k(this,"_messages",{}),k(this,"_missing"),k(this,"_messageCompiler"),k(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate((r=e.locale)!=null?r:re,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var e;return(e=this._messages[this._locale])!=null?e:{}}get localeData(){var e;return(e=this._localeData[this._locale])!=null?e:{}}_loadLocaleData(e,r){let t=this._localeData[e];t?Object.assign(t,r):this._localeData[e]=r}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,r){typeof e=="string"?this._loadLocaleData(e,r):Object.keys(e).forEach(t=>this._loadLocaleData(t,e[t])),this.emit("change")}_load(e,r){let t=this._messages[e];t?Object.assign(t,r):this._messages[e]=r}load(e,r){typeof e=="string"&&typeof r=="object"?this._load(e,r):Object.entries(e).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:e,locales:r,messages:t}){this._locale=e,this._locales=r||void 0,this._messages[this._locale]=t,this.emit("change")}activate(e,r){this._locale=e,this._locales=r,this.emit("change")}_(e,r,t){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=t==null?void 0:t.message;e||(e=""),v(e)||(r=e.values||r,a=e.message,e=e.id);let s=this.messages[e],n=s===void 0,i=this._missing;if(i&&n)return Ie(i)?i(this._locale,e):i;n&&this.emit("missing",{id:e,locale:this._locale});let l=s||a||e;return v(l)&&(this._messageCompiler?l=this._messageCompiler(l):console.warn(`Uncompiled message detected! Message:
|
|
28
28
|
|
|
29
29
|
> ${l}
|
|
30
30
|
|