@warp-ds/elements 2.8.1 → 2.8.2-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +37 -60
- package/dist/index.d.ts +3 -25
- package/dist/packages/affix/affix.js +5 -5
- package/dist/packages/affix/affix.js.map +3 -3
- package/dist/packages/alert/alert.d.ts +1 -0
- package/dist/packages/alert/alert.js +7 -7
- package/dist/packages/alert/alert.js.map +3 -3
- package/dist/packages/alert/alert.test.js +21 -0
- package/dist/packages/attention/attention.js +9 -9
- package/dist/packages/attention/attention.js.map +3 -3
- package/dist/packages/badge/badge.js +2 -2
- package/dist/packages/badge/badge.js.map +3 -3
- package/dist/packages/badge/badge.test.js +14 -0
- package/dist/packages/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.js +7 -7
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
- package/dist/packages/breadcrumbs/breadcrumbs.test.js +3 -1
- package/dist/packages/button/button.js +7 -7
- package/dist/packages/button/button.js.map +3 -3
- package/dist/packages/combobox/combobox.js +2 -2
- package/dist/packages/combobox/combobox.js.map +2 -2
- package/dist/packages/combobox/combobox.test.js +5 -2
- package/dist/packages/datepicker/datepicker.js +5 -5
- package/dist/packages/datepicker/datepicker.js.map +3 -3
- package/dist/packages/expandable/expandable.js +11 -11
- package/dist/packages/expandable/expandable.js.map +3 -3
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +3 -3
- package/dist/packages/icon/icon.test.d.ts +1 -0
- package/dist/packages/icon/icon.test.js +51 -0
- package/dist/packages/link/link.js +4 -4
- package/dist/packages/link/link.js.map +3 -3
- package/dist/packages/link/link.test.js +14 -0
- package/dist/packages/modal-header/modal-header.js +1 -1
- package/dist/packages/modal-header/modal-header.js.map +3 -3
- package/dist/packages/page-indicator/page-indicator.js +7 -7
- package/dist/packages/page-indicator/page-indicator.js.map +3 -3
- package/dist/packages/page-indicator/page-indicator.test.js +23 -0
- package/dist/packages/pagination/pagination.d.ts +4 -0
- package/dist/packages/pagination/pagination.js +14 -14
- package/dist/packages/pagination/pagination.js.map +3 -3
- package/dist/packages/pagination/pagination.react.stories.d.ts +1 -1
- package/dist/packages/pagination/pagination.test.js +18 -0
- package/dist/packages/pill/pill.js +5 -5
- package/dist/packages/pill/pill.js.map +3 -3
- package/dist/packages/radio/radio.a11y.test.js +15 -6
- package/dist/packages/radio/radio.js +2 -2
- package/dist/packages/radio/radio.js.map +2 -2
- package/dist/packages/radio/radio.test.js +7 -7
- package/dist/packages/radio-group/radio-group.js +9 -9
- package/dist/packages/radio-group/radio-group.js.map +2 -2
- package/dist/packages/radio-group/radio-group.test.js +3 -2
- package/dist/packages/select/select.js +13 -13
- package/dist/packages/select/select.js.map +3 -3
- package/dist/packages/slider/slider.test.js +41 -0
- package/dist/packages/slider-thumb/slider-thumb.js +1 -1
- package/dist/packages/slider-thumb/slider-thumb.js.map +2 -2
- package/dist/packages/step/step.d.ts +1 -0
- package/dist/packages/step/step.js +4 -4
- package/dist/packages/step/step.js.map +3 -3
- package/dist/packages/step-indicator/step-indicator.a11y.test.js +3 -1
- package/dist/packages/switch/switch.a11y.test.js +10 -6
- package/dist/packages/switch/switch.js +2 -2
- package/dist/packages/switch/switch.js.map +3 -3
- package/dist/packages/switch/switch.test.js +0 -5
- package/dist/packages/tab/tab.d.ts +2 -0
- package/dist/packages/tab/tab.js +5 -5
- package/dist/packages/tab/tab.js.map +3 -3
- package/dist/packages/tab-panel/tab-panel.d.ts +2 -1
- package/dist/packages/tab-panel/tab-panel.js +7 -3
- package/dist/packages/tab-panel/tab-panel.js.map +3 -3
- package/dist/packages/tabs/tabs.a11y.test.js +16 -7
- package/dist/packages/tabs/tabs.js +1 -1
- package/dist/packages/tabs/tabs.js.map +2 -2
- package/dist/packages/tabs/tabs.test.js +45 -1
- package/dist/packages/textfield/textfield.js +2 -2
- package/dist/packages/textfield/textfield.js.map +2 -2
- package/dist/packages/textfield/textfield.test.js +26 -0
- package/dist/packages/toast/toast.js +3 -3
- package/dist/packages/toast/toast.js.map +3 -3
- package/dist/packages/toast/toast.test.d.ts +1 -0
- package/dist/packages/toast/toast.test.js +58 -0
- package/dist/web-types.json +18 -52
- package/package.json +4 -3
|
@@ -411,3 +411,44 @@ test('required slider passes required state to thumb', async () => {
|
|
|
411
411
|
// Verify the slider has required attribute in HTML
|
|
412
412
|
expect(slider.hasAttribute('required')).toBe(true);
|
|
413
413
|
});
|
|
414
|
+
// Hydration mismatch prevention tests
|
|
415
|
+
test('aria-label is not set as host attribute (to avoid hydration mismatch)', async () => {
|
|
416
|
+
const component = html `
|
|
417
|
+
<w-slider label="Slider label" min="0" max="100">
|
|
418
|
+
<w-slider-thumb name="value"></w-slider-thumb>
|
|
419
|
+
</w-slider>
|
|
420
|
+
`;
|
|
421
|
+
render(component);
|
|
422
|
+
const slider = document.querySelector('w-slider');
|
|
423
|
+
await slider.updateComplete;
|
|
424
|
+
const thumb = document.querySelector('w-slider-thumb');
|
|
425
|
+
await thumb.updateComplete;
|
|
426
|
+
// aria-label should NOT be a host attribute (to avoid hydration mismatch)
|
|
427
|
+
expect(thumb.hasAttribute('aria-label')).toBe(false);
|
|
428
|
+
// But the property should be set by the parent
|
|
429
|
+
expect(thumb.ariaLabel).toBe('Slider label');
|
|
430
|
+
// And the internal input should have the aria-label
|
|
431
|
+
const rangeInput = thumb.shadowRoot.querySelector('input[type="range"]');
|
|
432
|
+
expect(rangeInput.getAttribute('aria-label')).toBe('Slider label');
|
|
433
|
+
});
|
|
434
|
+
test('aria-description is not set as host attribute (to avoid hydration mismatch)', async () => {
|
|
435
|
+
const component = html `
|
|
436
|
+
<w-slider label="Range" min="0" max="100">
|
|
437
|
+
<w-slider-thumb slot="from" name="from"></w-slider-thumb>
|
|
438
|
+
<w-slider-thumb slot="to" name="to"></w-slider-thumb>
|
|
439
|
+
</w-slider>
|
|
440
|
+
`;
|
|
441
|
+
render(component);
|
|
442
|
+
const slider = document.querySelector('w-slider');
|
|
443
|
+
await slider.updateComplete;
|
|
444
|
+
const fromThumb = document.querySelector('w-slider-thumb[slot="from"]');
|
|
445
|
+
const toThumb = document.querySelector('w-slider-thumb[slot="to"]');
|
|
446
|
+
await fromThumb.updateComplete;
|
|
447
|
+
await toThumb.updateComplete;
|
|
448
|
+
// aria-description should NOT be a host attribute (to avoid hydration mismatch)
|
|
449
|
+
expect(fromThumb.hasAttribute('aria-description')).toBe(false);
|
|
450
|
+
expect(toThumb.hasAttribute('aria-description')).toBe(false);
|
|
451
|
+
// But the properties should be set
|
|
452
|
+
expect(fromThumb.ariaDescription).toBeTruthy();
|
|
453
|
+
expect(toThumb.ariaDescription).toBeTruthy();
|
|
454
|
+
});
|
|
@@ -2770,5 +2770,5 @@ Please compile your catalog first.
|
|
|
2770
2770
|
${this.ariaDescriptionText}
|
|
2771
2771
|
</span>
|
|
2772
2772
|
</div>
|
|
2773
|
-
`}};B=new WeakMap,b=new WeakSet,W=function(){this._showTooltip=!0,this.shadowRoot.querySelector("w-attention").handleDone()},ee=function(){this._showTooltip=!1},pe=function(){this.range&&(this.value===""?this.range.value=this.boundaryValue:this.value&&(this.range.value=this.value))},Y=function(r){this.dispatchEvent(new CustomEvent("slidervalidity",{bubbles:!0,detail:{invalid:r,slot:this.slot}}))},re=async function(r,t){let a=Number.parseInt(r);if(this.openEnded&&!t&&this.step&&!(this.slot==="to"&&a>=Number(this.max)-1||this.slot==="from"&&a<=Number(this.min)+1)){let k=1/this.step;a=Math.round(a*k)/k,r=a.toString()}let s=Number.parseInt(this.max),n=Number.parseInt(this.min);if(!this.openEnded&&(a>s||a<n))return g(this,b,Y).call(this,z.t({id:"slider.error.out_of_bounds",message:"Value must be between {min} and {max}",values:{min:`${this.min} ${this.suffix}`.trim(),max:`${this.max} ${this.suffix}`.trim()}})),{shouldCancel:!0};r===""&&this.required&&g(this,b,Y).call(this,z.t({id:"slider.error.required",message:"This field is required"})),this.value=r;let i=r===this.max||r===this.min,d=!1;if(this.slot){let m=this.parentElement.querySelector('w-slider-thumb[slot="to"]'),k=this.parentElement.querySelector('w-slider-thumb[slot="from"]'),E=m.textfield.value||this.max,$=k.textfield.value||this.min,y=Number.parseInt(E),M=Number.parseInt($),F=z.t({id:"slider.error.overlap",message:"The maximum value cannot be less than the minimum"});if(this.slot==="from"){let f=this.openEnded&&y>s?y:Math.min(y,this.openEnded?s-1:s);a>f&&(d=!0,this.openEnded&&i?this.value=String(f):this.value=E,t&&(g(this,b,Y).call(this,F),await this.updateComplete,this.textfield.value=r))}else{let f=this.openEnded&&M<n?M:Math.max(Number.parseInt($),this.openEnded?n+1:n);a<f&&(d=!0,this.openEnded&&i?this.value=String(f):this.value=$,t&&(g(this,b,Y).call(this,F),await this.updateComplete,this.textfield.value=r))}}return d?{shouldCancel:!0}:(g(this,b,Y).call(this,""),this.range.value=Math.min(Math.max(Number(r),Number(this.min)),Number(this.max)).toString(),this.value=this.openEnded&&!t&&i?"":r,this.shadowRoot.querySelector("w-attention").handleDone(),{shouldCancel:!1})},me=async function(r){let t=r.currentTarget.tagName==="W-TEXTFIELD";if(r instanceof CustomEvent)return;let a=r.currentTarget.value;return(await g(this,b,re).call(this,a,t)).shouldCancel?(r.preventDefault(),!1):!0},Ie=async function(r){if(r.key!=="ArrowLeft"&&r.key!=="ArrowRight")return;let t=Number(this.range.value),a=this.step||1,s;r.key==="ArrowLeft"?s=t-a:s=t+a,s=Math.min(Math.max(s,Number(this.min)),Number(this.max)),(await g(this,b,re).call(this,s.toString(),!1)).shouldCancel&&r.preventDefault()},u.shadowRootOptions={...Ae.shadowRootOptions,delegatesFocus:!0},u.styles=[De,Pe,Le],p([S({attribute:"aria-label"
|
|
2773
|
+
`}};B=new WeakMap,b=new WeakSet,W=function(){this._showTooltip=!0,this.shadowRoot.querySelector("w-attention").handleDone()},ee=function(){this._showTooltip=!1},pe=function(){this.range&&(this.value===""?this.range.value=this.boundaryValue:this.value&&(this.range.value=this.value))},Y=function(r){this.dispatchEvent(new CustomEvent("slidervalidity",{bubbles:!0,detail:{invalid:r,slot:this.slot}}))},re=async function(r,t){let a=Number.parseInt(r);if(this.openEnded&&!t&&this.step&&!(this.slot==="to"&&a>=Number(this.max)-1||this.slot==="from"&&a<=Number(this.min)+1)){let k=1/this.step;a=Math.round(a*k)/k,r=a.toString()}let s=Number.parseInt(this.max),n=Number.parseInt(this.min);if(!this.openEnded&&(a>s||a<n))return g(this,b,Y).call(this,z.t({id:"slider.error.out_of_bounds",message:"Value must be between {min} and {max}",values:{min:`${this.min} ${this.suffix}`.trim(),max:`${this.max} ${this.suffix}`.trim()}})),{shouldCancel:!0};r===""&&this.required&&g(this,b,Y).call(this,z.t({id:"slider.error.required",message:"This field is required"})),this.value=r;let i=r===this.max||r===this.min,d=!1;if(this.slot){let m=this.parentElement.querySelector('w-slider-thumb[slot="to"]'),k=this.parentElement.querySelector('w-slider-thumb[slot="from"]'),E=m.textfield.value||this.max,$=k.textfield.value||this.min,y=Number.parseInt(E),M=Number.parseInt($),F=z.t({id:"slider.error.overlap",message:"The maximum value cannot be less than the minimum"});if(this.slot==="from"){let f=this.openEnded&&y>s?y:Math.min(y,this.openEnded?s-1:s);a>f&&(d=!0,this.openEnded&&i?this.value=String(f):this.value=E,t&&(g(this,b,Y).call(this,F),await this.updateComplete,this.textfield.value=r))}else{let f=this.openEnded&&M<n?M:Math.max(Number.parseInt($),this.openEnded?n+1:n);a<f&&(d=!0,this.openEnded&&i?this.value=String(f):this.value=$,t&&(g(this,b,Y).call(this,F),await this.updateComplete,this.textfield.value=r))}}return d?{shouldCancel:!0}:(g(this,b,Y).call(this,""),this.range.value=Math.min(Math.max(Number(r),Number(this.min)),Number(this.max)).toString(),this.value=this.openEnded&&!t&&i?"":r,this.shadowRoot.querySelector("w-attention").handleDone(),{shouldCancel:!1})},me=async function(r){let t=r.currentTarget.tagName==="W-TEXTFIELD";if(r instanceof CustomEvent)return;let a=r.currentTarget.value;return(await g(this,b,re).call(this,a,t)).shouldCancel?(r.preventDefault(),!1):!0},Ie=async function(r){if(r.key!=="ArrowLeft"&&r.key!=="ArrowRight")return;let t=Number(this.range.value),a=this.step||1,s;r.key==="ArrowLeft"?s=t-a:s=t+a,s=Math.min(Math.max(s,Number(this.min)),Number(this.max)),(await g(this,b,re).call(this,s.toString(),!1)).shouldCancel&&r.preventDefault()},u.shadowRootOptions={...Ae.shadowRootOptions,delegatesFocus:!0},u.styles=[De,Pe,Le],p([S({attribute:"aria-label"})],u.prototype,"ariaLabel",2),p([S({attribute:"aria-description"})],u.prototype,"ariaDescription",2),p([S({reflect:!0})],u.prototype,"name",2),p([S({reflect:!0})],u.prototype,"value",2),p([S({type:Boolean,reflect:!0})],u.prototype,"disabled",2),p([S({type:Boolean,reflect:!0})],u.prototype,"invalid",2),p([S({attribute:!1,reflect:!1})],u.prototype,"openEnded",2),p([S({reflect:!0})],u.prototype,"placeholder",2),p([N()],u.prototype,"markers",2),p([N()],u.prototype,"required",2),p([N()],u.prototype,"step",2),p([N()],u.prototype,"min",2),p([N()],u.prototype,"max",2),p([N()],u.prototype,"suffix",2),p([S({attribute:!1})],u.prototype,"valueFormatter",2),p([S({attribute:!1})],u.prototype,"tooltipFormatter",2),p([S({attribute:!1})],u.prototype,"labelFormatter",2),p([be('input[type="range"]')],u.prototype,"range",2),p([be(".w-slider-thumb__tooltip-target")],u.prototype,"tooltipTarget",2),p([be("w-textfield")],u.prototype,"textfield",2),p([N()],u.prototype,"_showTooltip",2),p([N()],u.prototype,"_inputHasFocus",2),p([N()],u.prototype,"_hiddenTextfield",2);customElements.get("w-slider-thumb")||customElements.define("w-slider-thumb",u);export{u as WarpSliderThumb};
|
|
2774
2774
|
//# sourceMappingURL=slider-thumb.js.map
|