@warp-ds/elements 2.2.0-next.20 → 2.2.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/api.js.map +1 -1
- package/dist/custom-elements.json +1219 -1078
- package/dist/index.d.ts +194 -173
- package/dist/packages/affix/affix.react.stories.d.ts +9 -0
- package/dist/packages/affix/affix.react.stories.js +10 -0
- package/dist/packages/affix/affix.stories.js +1 -1
- package/dist/packages/affix/index.js +1 -1
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/affix/react.d.ts +1 -1
- package/dist/packages/affix/react.js +10 -3
- package/dist/packages/alert/alert.react.stories.d.ts +13 -0
- package/dist/packages/alert/alert.react.stories.js +44 -0
- package/dist/packages/alert/alert.stories.js +1 -1
- package/dist/packages/alert/alert.test.js +3 -1
- package/dist/packages/alert/index.d.ts +1 -1
- package/dist/packages/alert/index.js +1 -1
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/alert/react.d.ts +1 -1
- package/dist/packages/alert/react.js +6 -3
- package/dist/packages/attention/attention.react.stories.d.ts +15 -0
- package/dist/packages/attention/attention.react.stories.js +92 -0
- package/dist/packages/attention/attention.stories.js +17 -32
- package/dist/packages/attention/attention.test.js +1 -1
- package/dist/packages/attention/index.d.ts +3 -2
- package/dist/packages/attention/index.js +238 -17
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/attention/react.d.ts +15 -1
- package/dist/packages/attention/react.js +13 -5
- package/dist/packages/badge/badge.react.stories.d.ts +18 -0
- package/dist/packages/badge/badge.react.stories.js +60 -0
- package/dist/packages/badge/badge.stories.js +1 -1
- package/dist/packages/badge/index.js +1 -1
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/badge/react.d.ts +1 -1
- package/dist/packages/badge/react.js +6 -3
- package/dist/packages/box/box.react.stories.d.ts +15 -0
- package/dist/packages/box/box.react.stories.js +45 -0
- package/dist/packages/box/box.stories.js +1 -1
- package/dist/packages/box/index.js +3 -3
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/box/react.d.ts +1 -1
- package/dist/packages/box/react.js +6 -3
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +13 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.js +40 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/dist/packages/breadcrumbs/index.js +6 -6
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/breadcrumbs/react.d.ts +1 -1
- package/dist/packages/breadcrumbs/react.js +6 -3
- package/dist/packages/button/button.react.stories.d.ts +22 -0
- package/dist/packages/button/button.react.stories.js +102 -0
- package/dist/packages/button/button.stories.js +1 -1
- package/dist/packages/button/index.js +2 -2
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/button/react.js +6 -3
- package/dist/packages/card/card.react.stories.d.ts +16 -0
- package/dist/packages/card/card.react.stories.js +63 -0
- package/dist/packages/card/card.stories.js +2 -2
- package/dist/packages/card/index.d.ts +1 -1
- package/dist/packages/card/index.js +2 -2
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/card/react.d.ts +1 -1
- package/dist/packages/card/react.js +6 -3
- package/dist/packages/combobox/combobox.react.stories.d.ts +28 -0
- package/dist/packages/combobox/combobox.react.stories.js +90 -0
- package/dist/packages/combobox/combobox.stories.d.ts +5 -1
- package/dist/packages/combobox/combobox.stories.js +47 -25
- package/dist/packages/combobox/index.d.ts +1 -1
- package/dist/packages/combobox/index.js +4 -4
- package/dist/packages/combobox/index.js.map +4 -4
- package/dist/packages/combobox/react.d.ts +7 -0
- package/dist/packages/combobox/react.js +17 -0
- package/dist/packages/datepicker/DatePicker.test.d.ts +1 -0
- package/dist/packages/datepicker/DatePicker.test.js +3 -2
- package/dist/packages/datepicker/datepicker.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.js +105 -105
- package/dist/packages/datepicker/datepicker.js.map +4 -4
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +18 -0
- package/dist/packages/datepicker/datepicker.react.stories.js +26 -0
- package/dist/packages/datepicker/datepicker.stories.js +1 -1
- package/dist/packages/datepicker/datepicker.test.js +1 -1
- package/dist/packages/datepicker/index.js +105 -105
- package/dist/packages/datepicker/index.js.map +4 -4
- package/dist/packages/datepicker/react.d.ts +5 -2
- package/dist/packages/datepicker/react.js +10 -3
- package/dist/packages/dead-toggle/dead-toggle.react.stories.d.ts +15 -0
- package/dist/packages/dead-toggle/dead-toggle.react.stories.js +34 -0
- package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +5 -1
- package/dist/packages/dead-toggle/dead-toggle.stories.js +25 -3
- package/dist/packages/dead-toggle/index.js +1 -1
- package/dist/packages/dead-toggle/index.js.map +2 -2
- package/dist/packages/dead-toggle/react.d.ts +1 -1
- package/dist/packages/dead-toggle/react.js +6 -3
- package/dist/packages/expandable/expandable.react.stories.d.ts +18 -0
- package/dist/packages/expandable/expandable.react.stories.js +103 -0
- package/dist/packages/expandable/expandable.stories.js +1 -1
- package/dist/packages/expandable/index.js +2 -2
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/expandable/react.d.ts +1 -1
- package/dist/packages/expandable/react.js +6 -3
- package/dist/packages/i18n.js +2 -1
- package/dist/packages/link/index.js +1 -1
- package/dist/packages/link/index.js.map +4 -4
- package/dist/packages/link/link.react.stories.d.ts +21 -0
- package/dist/packages/link/link.react.stories.js +96 -0
- package/dist/packages/link/link.stories.js +1 -12
- package/dist/packages/link/link.test.js +1 -1
- package/dist/packages/link/react.d.ts +1 -1
- package/dist/packages/link/react.js +6 -3
- package/dist/packages/modal/index.js +8 -8
- package/dist/packages/modal/index.js.map +4 -4
- package/dist/packages/modal/modal-footer.js +3 -3
- package/dist/packages/modal/modal-footer.js.map +3 -3
- package/dist/packages/modal/modal-header.js +4 -4
- package/dist/packages/modal/modal-header.js.map +4 -4
- package/dist/packages/modal/modal-main.js.map +1 -1
- package/dist/packages/modal/modal.react.stories.d.ts +14 -0
- package/dist/packages/modal/modal.react.stories.js +27 -0
- package/dist/packages/modal/modal.stories.d.ts +1 -1
- package/dist/packages/modal/modal.stories.js +1 -1
- package/dist/packages/modal/react.d.ts +11 -3
- package/dist/packages/modal/react.js +19 -6
- package/dist/packages/pageindicator/pageindicator.react.stories.d.ts +19 -0
- package/dist/packages/pageindicator/pageindicator.react.stories.js +20 -0
- package/dist/packages/pageindicator/pageindicator.stories.d.ts +1 -1
- package/dist/packages/pageindicator/pageindicator.stories.js +1 -1
- package/dist/packages/pageindicator/react.d.ts +1 -1
- package/dist/packages/pageindicator/react.js +6 -3
- package/dist/packages/pagination/index.js +9 -3
- package/dist/packages/pagination/index.js.map +3 -3
- package/dist/packages/pagination/pagination.react.stories.d.ts +21 -0
- package/dist/packages/pagination/pagination.react.stories.js +45 -0
- package/dist/packages/pagination/pagination.stories.js +6 -6
- package/dist/packages/pagination/pagination.test.js +1 -1
- package/dist/packages/pagination/react.d.ts +5 -2
- package/dist/packages/pagination/react.js +10 -3
- package/dist/packages/pill/index.js.map +2 -2
- package/dist/packages/pill/pill.react.stories.d.ts +23 -0
- package/dist/packages/pill/pill.react.stories.js +22 -0
- package/dist/packages/pill/pill.stories.js +1 -1
- package/dist/packages/pill/pill.test.js +3 -1
- package/dist/packages/pill/react.d.ts +7 -0
- package/dist/packages/pill/react.js +17 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.js +5 -5
- package/dist/packages/rip-and-tear-checkbox/checkbox.js.map +3 -3
- package/dist/packages/rip-and-tear-checkbox/checkbox.stories.d.ts +8 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.stories.js +11 -0
- package/dist/packages/rip-and-tear-checkbox/index.js +5 -5
- package/dist/packages/rip-and-tear-checkbox/index.js.map +3 -3
- package/dist/packages/rip-and-tear-checkbox/react.d.ts +5 -0
- package/dist/packages/rip-and-tear-checkbox/react.js +15 -0
- package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.d.ts +12 -0
- package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.js +10 -0
- package/dist/packages/rip-and-tear-radio/index.js +8 -8
- package/dist/packages/rip-and-tear-radio/index.js.map +3 -3
- package/dist/packages/rip-and-tear-radio/radio-group.js +8 -8
- package/dist/packages/rip-and-tear-radio/radio-group.js.map +3 -3
- package/dist/packages/rip-and-tear-radio/radio.js.map +2 -2
- package/dist/packages/rip-and-tear-radio/radio.stories.js +9 -9
- package/dist/packages/rip-and-tear-radio/radio.stories.js.map +3 -3
- package/dist/packages/rip-and-tear-radio/react.d.ts +9 -0
- package/dist/packages/rip-and-tear-radio/react.js +22 -0
- package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.d.ts +9 -0
- package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.js +10 -0
- package/dist/packages/rip-and-tear-radio/slot.js +3 -3
- package/dist/packages/select/index.d.ts +4 -4
- package/dist/packages/select/index.js +12 -12
- package/dist/packages/select/index.js.map +3 -3
- package/dist/packages/select/react.d.ts +6 -2
- package/dist/packages/select/react.js +15 -3
- package/dist/packages/select/select.react.stories.d.ts +18 -0
- package/dist/packages/select/select.react.stories.js +28 -0
- package/dist/packages/select/select.stories.js +2 -2
- package/dist/packages/select/select.test.js +1 -1
- package/dist/packages/slider/Slider.js +1 -1
- package/dist/packages/slider/SliderThumb.js +1 -1
- package/dist/packages/slider/index.js +6 -6
- package/dist/packages/slider/index.js.map +4 -4
- package/dist/packages/slider/react.d.ts +8 -0
- package/dist/packages/slider/react.js +20 -0
- package/dist/packages/slider/slider-thumb.js +2 -2
- package/dist/packages/slider/slider-thumb.js.map +4 -4
- package/dist/packages/slider/slider.js +2 -2
- package/dist/packages/slider/slider.js.map +4 -4
- package/dist/packages/slider/slider.react.stories.d.ts +18 -0
- package/dist/packages/slider/slider.react.stories.js +119 -0
- package/dist/packages/slider/slider.stories.js +2 -2
- package/dist/packages/slider/slider.test.js +1 -1
- package/dist/packages/steps/index.js +2 -2
- package/dist/packages/steps/index.js.map +4 -4
- package/dist/packages/steps/react.d.ts +1 -1
- package/dist/packages/steps/react.js +7 -4
- package/dist/packages/steps/steps.react.stories.d.ts +15 -0
- package/dist/packages/steps/steps.react.stories.js +112 -0
- package/dist/packages/switch/index.js +1 -1
- package/dist/packages/switch/index.js.map +4 -4
- package/dist/packages/switch/react.d.ts +5 -2
- package/dist/packages/switch/react.js +10 -3
- package/dist/packages/switch/switch.react.stories.d.ts +15 -0
- package/dist/packages/switch/switch.react.stories.js +29 -0
- package/dist/packages/tabs/index.d.ts +1 -1
- package/dist/packages/tabs/index.js +12 -12
- package/dist/packages/tabs/index.js.map +4 -4
- package/dist/packages/tabs/react.d.ts +11 -3
- package/dist/packages/tabs/react.js +18 -5
- package/dist/packages/tabs/tab-panel.js.map +2 -2
- package/dist/packages/tabs/tab.js +1 -1
- package/dist/packages/tabs/tab.js.map +4 -4
- package/dist/packages/tabs/tabs.d.ts +2 -0
- package/dist/packages/tabs/tabs.js +4 -4
- package/dist/packages/tabs/tabs.js.map +4 -4
- package/dist/packages/tabs/tabs.react.stories.d.ts +15 -0
- package/dist/packages/tabs/tabs.react.stories.js +51 -0
- package/dist/packages/tabs/tabs.stories.js +12 -12
- package/dist/packages/tabs/tabs.stories.js.map +4 -4
- package/dist/packages/textfield/index.js +1 -1
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/textfield/react.d.ts +11 -2
- package/dist/packages/textfield/react.js +16 -3
- package/dist/packages/textfield/textfield.react.stories.d.ts +37 -0
- package/dist/packages/textfield/textfield.react.stories.js +88 -0
- package/dist/packages/textfield/textfield.stories.js +1 -1
- package/dist/packages/textfield/textfield.test.js +1 -1
- package/dist/packages/toast/api.d.ts +1 -1
- package/dist/packages/toast/index.d.ts +1 -1
- package/dist/packages/toast/index.js +14 -14
- package/dist/packages/toast/index.js.map +4 -4
- package/dist/packages/toast/toast-container.d.ts +1 -1
- package/dist/packages/toast/toast-container.js +2454 -149
- package/dist/packages/toast/toast-container.js.map +7 -0
- package/dist/packages/toast/toast.js +2459 -193
- package/dist/packages/toast/toast.js.map +7 -0
- package/dist/packages/toast/toast.stories.js +1 -1
- package/dist/packages/utils/expand-transition.js +1 -1
- package/dist/vscode.html-custom-data.json +90 -85
- package/dist/web-types.json +147 -139
- package/package.json +22 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var C=s=>{throw TypeError(s)};var l=(s,r,t,e)=>{for(var a=e>1?void 0:e?$(r,t):r,i=s.length-1,o;i>=0;i--)(o=s[i])&&(a=(e?o(r,t,a):o(a))||a);return e&&a&&P(r,t,a),a};var S=(s,r,t)=>r.has(s)||C("Cannot "+t);var A=(s,r,t)=>(S(s,r,"read from private field"),t?t.call(s):r.get(s)),R=(s,r,t)=>r.has(s)?C("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,t),L=(s,r,t,e)=>(S(s,r,"write to private field"),e?e.call(s,t):r.set(s,t),t);import{html as G}from"lit";import{html as J}from"lit";import{property as y,state as D}from"lit/decorators.js";import{isServer as V}from"lit";import{property as b}from"lit/decorators.js";import{LitElement as j,unsafeCSS as K}from"lit";import{property as I}from"lit/decorators.js";import{css as _}from"lit";var T=_`
|
|
2
2
|
:host {
|
|
3
3
|
box-sizing: border-box !important;
|
|
4
4
|
}
|
|
@@ -8,7 +8,7 @@ var U=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var V=s=>{thro
|
|
|
8
8
|
:host *::after {
|
|
9
9
|
box-sizing: inherit !important;
|
|
10
10
|
}
|
|
11
|
-
`;var g,p=class extends
|
|
11
|
+
`;var g,p=class extends j{constructor(){super();R(this,g,!1);this.initialReflectedProperties=new Map;this.customStates={set:(t,e)=>{var a;(a=this.internals)!=null&&a.states&&(e?this.internals.states.add(t):this.internals.states.delete(t))},has:t=>{var e;return(e=this.internals)!=null&&e.states?this.internals.states.has(t):!1}};try{this.internals=this.attachInternals()}catch(e){console.error("Element internals are not supported in your browser. Consider using a polyfill")}this.customStates.set("wa-defined",!0);let t=this.constructor;for(let[e,a]of t.elementProperties)a.default==="inherit"&&a.initial!==void 0&&typeof e=="string"&&this.customStates.set(`initial-${e}-${a.initial}`,!0)}static get styles(){let t=Array.isArray(this.css)?this.css:this.css?[this.css]:[];return[T,...t].map(e=>typeof e=="string"?K(e):e)}attributeChangedCallback(t,e,a){A(this,g)||(this.constructor.elementProperties.forEach((i,o)=>{i.reflect&&this[o]!=null&&this.initialReflectedProperties.set(o,this[o])}),L(this,g,!0)),super.attributeChangedCallback(t,e,a)}willUpdate(t){super.willUpdate(t),this.initialReflectedProperties.forEach((e,a)=>{t.has(a)&&this[a]==null&&(this[a]=e)})}relayNativeEvent(t,e){t.stopImmediatePropagation(),this.dispatchEvent(new t.constructor(t.type,{...t,...e}))}};g=new WeakMap,l([I()],p.prototype,"dir",2),l([I()],p.prototype,"lang",2);var M=()=>({observedAttributes:["custom-error"],checkValidity(s){let r={message:"",isValid:!0,invalidKeys:[]};return s.customError&&(r.message=s.customError,r.isValid=!1,r.invalidKeys=["customError"]),r}});var E=class extends Event{constructor(){super("w-invalid",{bubbles:!0,cancelable:!1,composed:!0})}};var c=class extends p{constructor(){super();this.name=null;this.disabled=!1;this.required=!1;this.assumeInteractionOn=["input"];this.validators=[];this.valueHasChanged=!1;this.hasInteracted=!1;this.customError=null;this.emittedEvents=[];this.emitInvalid=t=>{t.target===this&&(this.hasInteracted=!0,this.dispatchEvent(new E))};this.handleInteraction=t=>{var a;let e=this.emittedEvents;e.includes(t.type)||e.push(t.type),e.length===((a=this.assumeInteractionOn)==null?void 0:a.length)&&(this.hasInteracted=!0)};V||this.addEventListener("invalid",this.emitInvalid)}static get validators(){return[M()]}static get observedAttributes(){let t=new Set(super.observedAttributes||[]);for(let e of this.validators)if(e.observedAttributes)for(let a of e.observedAttributes)t.add(a);return[...t]}connectedCallback(){super.connectedCallback(),this.updateValidity(),this.assumeInteractionOn.forEach(t=>{this.addEventListener(t,this.handleInteraction)})}firstUpdated(...t){super.firstUpdated(...t),this.updateValidity()}willUpdate(t){if(!V&&t.has("customError")&&(this.customError||(this.customError=null),this.setCustomValidity(this.customError||"")),t.has("value")||t.has("disabled")){let e=this.value;if(Array.isArray(e)){if(this.name){let a=new FormData;for(let i of e)a.append(this.name,i);this.setValue(a,a)}}else this.setValue(e,e)}t.has("disabled")&&(this.customStates.set("disabled",this.disabled),(this.hasAttribute("disabled")||!V&&!this.matches(":disabled"))&&this.toggleAttribute("disabled",this.disabled)),this.updateValidity(),super.willUpdate(t)}get labels(){return this.internals.labels}getForm(){return this.internals.form}get validity(){return this.internals.validity}get willValidate(){return this.internals.willValidate}get validationMessage(){return this.internals.validationMessage}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.updateValidity(),this.hasInteracted=!0,this.internals.reportValidity()}get validationTarget(){return this.input||void 0}setValidity(...t){let e=t[0],a=t[1],i=t[2];i||(i=this.validationTarget),this.internals.setValidity(e,a,i||void 0),this.requestUpdate("validity"),this.setCustomStates()}setCustomStates(){let t=!!this.required,e=this.internals.validity.valid,a=this.hasInteracted;this.customStates.set("required",t),this.customStates.set("optional",!t),this.customStates.set("invalid",!e),this.customStates.set("valid",e),this.customStates.set("user-invalid",!e&&a),this.customStates.set("user-valid",e&&a)}setCustomValidity(t){if(!t){this.customError=null,this.setValidity({});return}this.customError=t,this.setValidity({customError:!0},t,this.validationTarget)}formResetCallback(){this.resetValidity(),this.hasInteracted=!1,this.valueHasChanged=!1,this.emittedEvents=[],this.updateValidity()}formDisabledCallback(t){this.disabled=t,this.updateValidity()}formStateRestoreCallback(t,e){this.value=t,e==="restore"&&this.resetValidity(),this.updateValidity()}setValue(...t){let[e,a]=t;this.internals.setFormValue(e,a)}get allValidators(){let t=this.constructor.validators||[],e=this.validators||[];return[...t,...e]}resetValidity(){this.setCustomValidity(""),this.setValidity({})}updateValidity(){if(this.disabled||this.hasAttribute("disabled")||!this.willValidate){this.resetValidity();return}let t=this.allValidators;if(!(t!=null&&t.length))return;let e={customError:!!this.customError},a=this.validationTarget||this.input||void 0,i="";for(let o of t){let{isValid:n,message:v,invalidKeys:h}=o.checkValidity(this);n||(i||(i=v),(h==null?void 0:h.length)>=0&&h.forEach(w=>e[w]=!0))}i||(i=this.validationMessage),this.setValidity(e,i,a)}};c.formAssociated=!0,l([b({reflect:!0})],c.prototype,"name",2),l([b({type:Boolean})],c.prototype,"disabled",2),l([b({state:!0,attribute:!1})],c.prototype,"valueHasChanged",2),l([b({state:!0,attribute:!1})],c.prototype,"hasInteracted",2),l([b({attribute:"custom-error",reflect:!0})],c.prototype,"customError",2),l([b({attribute:!1,state:!0,type:Object})],c.prototype,"validity",1);import{css as X}from"lit";var H=X`
|
|
12
12
|
:host {
|
|
13
13
|
color: var(--wa-form-control-value-color);
|
|
14
14
|
display: inline-flex;
|
|
@@ -176,10 +176,10 @@ var U=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var V=s=>{thro
|
|
|
176
176
|
:host([appearance='button']:focus-visible) {
|
|
177
177
|
z-index: 2;
|
|
178
178
|
}
|
|
179
|
-
`;var u=class extends c{constructor(){super();this.checked=!1;this.forceDisabled=!1;this.form=null;this.appearance="default";this.size="medium";this.disabled=!1;this.handleClick=()=>{!this.disabled&&!this.forceDisabled&&(this.checked=!0)};this.addEventListener("click",this.handleClick)}connectedCallback(){super.connectedCallback(),this.setInitialAttributes()}setInitialAttributes(){this.setAttribute("role","radio"),this.tabIndex=0,this.setAttribute("aria-disabled",this.disabled||this.forceDisabled?"true":"false")}updated(t){if(super.updated(t),t.has("checked")&&(this.customStates.set("checked",this.checked),this.setAttribute("aria-checked",this.checked?"true":"false"),!this.disabled&&!this.forceDisabled&&(this.tabIndex=this.checked?0:-1)),t.has("disabled")||t.has("forceDisabled")){let e=this.disabled||this.forceDisabled;this.customStates.set("disabled",e),this.setAttribute("aria-disabled",e?"true":"false"),e?this.tabIndex=-1:this.tabIndex=this.checked?0:-1}}setValue(){}render(){return
|
|
179
|
+
`;var u=class extends c{constructor(){super();this.checked=!1;this.forceDisabled=!1;this.form=null;this.appearance="default";this.size="medium";this.disabled=!1;this.handleClick=()=>{!this.disabled&&!this.forceDisabled&&(this.checked=!0)};this.addEventListener("click",this.handleClick)}connectedCallback(){super.connectedCallback(),this.setInitialAttributes()}setInitialAttributes(){this.setAttribute("role","radio"),this.tabIndex=0,this.setAttribute("aria-disabled",this.disabled||this.forceDisabled?"true":"false")}updated(t){if(super.updated(t),t.has("checked")&&(this.customStates.set("checked",this.checked),this.setAttribute("aria-checked",this.checked?"true":"false"),!this.disabled&&!this.forceDisabled&&(this.tabIndex=this.checked?0:-1)),t.has("disabled")||t.has("forceDisabled")){let e=this.disabled||this.forceDisabled;this.customStates.set("disabled",e),this.setAttribute("aria-disabled",e?"true":"false"),e?this.tabIndex=-1:this.tabIndex=this.checked?0:-1}}setValue(){}render(){return J`
|
|
180
180
|
<span part="control" class="control"></span>
|
|
181
181
|
<slot part="label" class="label"></slot>
|
|
182
|
-
`}};u.css=[
|
|
182
|
+
`}};u.css=[H],l([D()],u.prototype,"checked",2),l([D()],u.prototype,"forceDisabled",2),l([y({reflect:!0})],u.prototype,"form",2),l([y({reflect:!0})],u.prototype,"value",2),l([y({reflect:!0})],u.prototype,"appearance",2),l([y({reflect:!0})],u.prototype,"size",2),l([y({type:Boolean})],u.prototype,"disabled",2);import{html as Y}from"lit";import{property as f,query as Z,state as U}from"lit/decorators.js";import{classMap as B}from"lit/directives/class-map.js";var q="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var N=(s=21)=>{let r="",t=crypto.getRandomValues(new Uint8Array(s|=0));for(;s--;)r+=q[t[s]&63];return r};function z(s=""){return`${s}${N()}`}import{css as Q}from"lit";var O=Q`
|
|
183
183
|
:host {
|
|
184
184
|
display: block;
|
|
185
185
|
}
|
|
@@ -237,10 +237,10 @@ var U=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var V=s=>{thro
|
|
|
237
237
|
gap: 0;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
`;var
|
|
240
|
+
`;var F=(s={})=>{let{validationElement:r,validationProperty:t}=s;r||(r=Object.assign(document.createElement("input"),{required:!0})),t||(t="value");let e={observedAttributes:["required"],message:r.validationMessage,checkValidity(a){var h;let i={message:"",isValid:!0,invalidKeys:[]};return((h=a.required)!=null?h:a.hasAttribute("required"))&&!a[t]&&(i.message=typeof e.message=="function"?e.message(a):e.message||"",i.isValid=!1,i.invalidKeys.push("valueMissing")),i}};return e};var k=class{constructor(r,...t){this.slotNames=[];this.handleSlotChange=r=>{let t=r.target;(this.slotNames.includes("[default]")&&!t.name||t.name&&this.slotNames.includes(t.name))&&this.host.requestUpdate()};(this.host=r).addController(this),this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some(r=>{var t;if(r.nodeType===Node.TEXT_NODE&&((t=r.textContent)==null?void 0:t.trim())!=="")return!0;if(r.nodeType===Node.ELEMENT_NODE){let e=r;if(e.tagName.toLowerCase()==="w-visually-hidden")return!1;if(!e.hasAttribute("slot"))return!0}return!1})}hasNamedSlot(r){return this.host.querySelector(`:scope > [slot="${r}"]`)!==null}test(r){return r==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(r)}hostConnected(){var r;(r=this.host.shadowRoot)==null||r.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){var r;(r=this.host.shadowRoot)==null||r.removeEventListener("slotchange",this.handleSlotChange)}};var d=class extends c{constructor(){super();this.hasSlotController=new k(this,"hint","label");this.hasRadioButtons=!1;this.label="";this.hint="";this.name=null;this.disabled=!1;this.orientation="vertical";this._value=null;this.defaultValue=this.getAttribute("value")||null;this.size="medium";this.required=!1;this.withLabel=!1;this.withHint=!1;this.handleRadioClick=t=>{let e=t.target.closest("w-radio");if(!e||e.disabled||e.forceDisabled||this.disabled)return;let a=this.value;this.value=e.value,e.checked=!0;let i=this.getAllRadios();for(let o of i)e!==o&&(o.checked=!1,o.setAttribute("tabindex","-1"));this.value!==a&&this.updateComplete.then(()=>{this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})};this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("click",this.handleRadioClick)}static get validators(){let t=[F({validationElement:Object.assign(document.createElement("input"),{required:!0,type:"radio",name:z("__w-radio")})})];return[...super.validators,...t]}get value(){var t;return this.valueHasChanged?this._value:(t=this._value)!=null?t:this.defaultValue}set value(t){typeof t=="number"&&(t=String(t)),this.valueHasChanged=!0,this._value=t}get validationTarget(){let t=this.querySelector(":is(w-radio):not([disabled])");if(t)return t}updated(t){(t.has("disabled")||t.has("value"))&&this.syncRadioElements()}formResetCallback(...t){this.value=this.defaultValue,super.formResetCallback(...t),this.syncRadioElements()}getAllRadios(){return[...this.querySelectorAll("w-radio")]}handleLabelClick(){this.focus()}async syncRadioElements(){let t=this.getAllRadios(),e=!1;if(t.forEach((a,i)=>{a.appearance==="button"&&(e=!0),a.setAttribute("size",this.size),a.toggleAttribute("data-w-radio-horizontal",this.orientation!=="vertical"),a.toggleAttribute("data-w-radio-vertical",this.orientation==="vertical"),a.toggleAttribute("data-w-radio-first",i===0),a.toggleAttribute("data-w-radio-inner",i!==0&&i!==t.length-1),a.toggleAttribute("data-w-radio-last",i===t.length-1),a.forceDisabled=this.disabled}),this.hasRadioButtons=e,await Promise.all(t.map(async a=>{await a.updateComplete,!a.disabled&&a.value===this.value?a.checked=!0:a.checked=!1})),this.disabled)t.forEach(a=>{a.tabIndex=-1});else{let a=t.filter(o=>!o.disabled),i=a.find(o=>o.checked);a.length>0&&(i?a.forEach(o=>{o.tabIndex=o.checked?0:-1}):a.forEach((o,n)=>{o.tabIndex=n===0?0:-1})),t.filter(o=>o.disabled).forEach(o=>{o.tabIndex=-1})}}handleKeyDown(t){var h,w,x;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key)||this.disabled)return;let e=this.getAllRadios().filter(m=>!m.disabled);if(e.length<=0)return;t.preventDefault();let a=this.value,i=(h=e.find(m=>m.checked))!=null?h:e[0],o=t.key===" "?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,n=e.indexOf(i)+o;n||(n=0),n<0&&(n=e.length-1),n>e.length-1&&(n=0);let v=e.some(m=>m.tagName.toLowerCase()==="w-radio-button");this.getAllRadios().forEach(m=>{m.checked=!1,v||m.setAttribute("tabindex","-1")}),this.value=e[n].value,e[n].checked=!0,v?(x=(w=e[n].shadowRoot)==null?void 0:w.querySelector("button"))==null||x.focus():(e[n].setAttribute("tabindex","0"),e[n].focus()),this.value!==a&&this.updateComplete.then(()=>{this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),t.preventDefault()}focus(t){if(this.disabled)return;let e=this.getAllRadios(),a=e.find(n=>n.checked),i=e.find(n=>!n.disabled),o=a||i;o&&o.focus(t)}render(){let t=this.hasUpdated?this.hasSlotController.test("label"):this.withLabel,e=this.hasUpdated?this.hasSlotController.test("hint"):this.withHint,a=this.label?!0:!!t,i=this.hint?!0:!!e;return Y`
|
|
241
241
|
<fieldset
|
|
242
242
|
part="form-control"
|
|
243
|
-
class=${
|
|
243
|
+
class=${B({"form-control":!0,"form-control-radio-group":!0,"form-control-has-label":a,"has-radio-buttons":this.hasRadioButtons})}
|
|
244
244
|
role="radiogroup"
|
|
245
245
|
aria-labelledby="label"
|
|
246
246
|
aria-describedby="hint"
|
|
@@ -261,15 +261,15 @@ var U=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var V=s=>{thro
|
|
|
261
261
|
id="hint"
|
|
262
262
|
name="hint"
|
|
263
263
|
part="hint"
|
|
264
|
-
class=${
|
|
264
|
+
class=${B({"has-slotted":i})}
|
|
265
265
|
aria-hidden=${i?"false":"true"}
|
|
266
266
|
>${this.hint}</slot
|
|
267
267
|
>
|
|
268
268
|
</fieldset>
|
|
269
|
-
`}};d.css=[
|
|
269
|
+
`}};d.css=[O],d.shadowRootOptions={...c.shadowRootOptions,delegatesFocus:!0},l([U()],d.prototype,"hasRadioButtons",2),l([Z("slot:not([name])")],d.prototype,"defaultSlot",2),l([f()],d.prototype,"label",2),l([f({attribute:"hint"})],d.prototype,"hint",2),l([f({reflect:!0})],d.prototype,"name",2),l([f({type:Boolean,reflect:!0})],d.prototype,"disabled",2),l([f({reflect:!0})],d.prototype,"orientation",2),l([U()],d.prototype,"value",1),l([f({attribute:"value",reflect:!0})],d.prototype,"defaultValue",2),l([f({reflect:!0})],d.prototype,"size",2),l([f({type:Boolean,reflect:!0})],d.prototype,"required",2),l([f({type:Boolean,attribute:"with-label"})],d.prototype,"withLabel",2),l([f({type:Boolean,attribute:"with-hint"})],d.prototype,"withHint",2);customElements.get("w-radio")||(customElements.define("w-radio",u),customElements.define("w-radio-group",d));var Qt={title:"Forms/Radio",render:()=>G`
|
|
270
270
|
<w-radio-group label="Group" name="foobar" value="foo">
|
|
271
271
|
<w-radio value="foo">foo</w-radio>
|
|
272
272
|
<w-radio value="bar">bar</w-radio>
|
|
273
273
|
</w-radio-group>
|
|
274
|
-
`},
|
|
274
|
+
`},Yt={};export{Yt as Default,Qt as default};
|
|
275
275
|
//# sourceMappingURL=radio.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/rip-and-tear-radio/radio.stories.ts", "../../../packages/rip-and-tear-radio/radio.ts", "../../../packages/rip-and-tear-radio/form-associated-element.ts", "../../../packages/rip-and-tear-radio/base-element.ts", "../../../packages/rip-and-tear-radio/host-styles.ts", "../../../packages/rip-and-tear-radio/custom-error-validator.ts", "../../../packages/rip-and-tear-radio/invalid.ts", "../../../packages/rip-and-tear-radio/radio-styles.ts", "../../../packages/rip-and-tear-radio/radio-group.ts", "../../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js", "../../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.browser.js", "../../../packages/rip-and-tear-radio/math.ts", "../../../packages/rip-and-tear-radio/radio-group-styles.ts", "../../../packages/rip-and-tear-radio/required-validator.ts", "../../../packages/rip-and-tear-radio/slot.ts", "../../../packages/rip-and-tear-radio/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { html } from 'lit';\n\nimport type { Meta, StoryObj } from '@storybook/web-components-vite';\nimport './index';\n\nexport default {\n title: 'Forms/Radio',\n render: () => {\n return html`\n <w-radio-group label=\"Group\" name=\"foobar\" value=\"foo\">\n <w-radio value=\"foo\">foo</w-radio>\n <w-radio value=\"bar\">bar</w-radio>\n </w-radio-group>\n `;\n },\n} satisfies Meta;\n\nexport const Default: StoryObj = {};\n", "import type { PropertyValues } from 'lit';\nimport { html } from 'lit';\n\nimport { property, state } from 'lit/decorators.js';\n\nimport { BaseFormAssociatedElement } from './form-associated-element';\n// eslint-disable-next-line\n// @ts-ignore\nimport { styles } from './radio-styles';\n\nexport class WRadio extends BaseFormAssociatedElement {\n static css = [styles];\n\n @state() checked = false;\n\n /** @internal Used by radio group to force disable radios while preserving their original disabled state. */\n @state() forceDisabled = false;\n\n /**\n * The string pointing to a form's id.\n */\n @property({ reflect: true }) form: string | null = null;\n\n /** The radio's value. When selected, the radio group will receive this value. */\n @property({ reflect: true }) value: string;\n\n /** The radio's value. When selected, the radio group will receive this value. */\n @property({ reflect: true }) appearance: 'default' | 'button' | 'clickable' = 'default';\n\n /**\n * The radio's size. When used inside a radio group, the size will be determined by the radio group's size so this\n * attribute can typically be omitted.\n */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Disables the radio. */\n @property({ type: Boolean }) disabled = false;\n\n constructor() {\n super();\n this.addEventListener('click', this.handleClick);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setInitialAttributes();\n }\n\n private setInitialAttributes() {\n this.setAttribute('role', 'radio');\n this.tabIndex = 0;\n this.setAttribute('aria-disabled', this.disabled || this.forceDisabled ? 'true' : 'false');\n }\n\n updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('checked')) {\n this.customStates.set('checked', this.checked);\n this.setAttribute('aria-checked', this.checked ? 'true' : 'false');\n // Only set tabIndex if not disabled\n if (!this.disabled && !this.forceDisabled) {\n this.tabIndex = this.checked ? 0 : -1;\n }\n }\n\n if (changedProperties.has('disabled') || changedProperties.has('forceDisabled')) {\n const effectivelyDisabled = this.disabled || this.forceDisabled;\n this.customStates.set('disabled', effectivelyDisabled);\n this.setAttribute('aria-disabled', effectivelyDisabled ? 'true' : 'false');\n\n // Set tabIndex based on disabled state\n if (effectivelyDisabled) {\n this.tabIndex = -1;\n } else {\n // Restore proper tabIndex - this will be managed by the radio group\n this.tabIndex = this.checked ? 0 : -1;\n }\n }\n }\n\n /**\n * @override\n */\n setValue(): void {\n // We override `setValue` because we don't want to set form values from here. We want to do that in \"RadioGroup\" itself.\n }\n\n // Update the handleClick method (around line 75)\n private handleClick = () => {\n if (!this.disabled && !this.forceDisabled) {\n this.checked = true;\n }\n };\n\n render() {\n return html`\n <span part=\"control\" class=\"control\"></span>\n <slot part=\"label\" class=\"label\"></slot>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'w-radio': WRadio;\n }\n}\n", "import { LitElement, isServer } from 'lit';\n\nimport { property } from 'lit/decorators.js';\n\nimport BaseElement from './base-element.js';\nimport { CustomErrorValidator } from './custom-error-validator.js';\nimport { WInvalidEvent } from './invalid';\n\nexport interface Validator<T extends BaseFormAssociatedElement = BaseFormAssociatedElement> {\n observedAttributes?: string[];\n checkValidity: (element: T) => {\n message: string;\n isValid: boolean;\n invalidKeys: Exclude<keyof ValidityState, 'valid'>[];\n };\n message?: string | ((element: T) => string);\n}\n\nexport interface BaseFormControl extends BaseElement {\n // Form attributes\n name: null | string;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n checked?: boolean;\n defaultSelected?: boolean;\n selected?: boolean;\n form?: string | null;\n\n value?: unknown;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | 'any';\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n\n // Form validation properties\n readonly validity: ValidityState;\n readonly validationMessage: string;\n\n // Form validation methods\n checkValidity: () => boolean;\n getForm: () => HTMLFormElement | null;\n reportValidity: () => boolean;\n setCustomValidity: (message: string) => void;\n\n // Form properties\n hasInteracted: boolean;\n valueHasChanged?: boolean;\n\n /** Convenience API for `setCustomValidity()` */\n customError: null | string;\n}\n\n// setFormValue omitted so that we can use `setValue`\nexport class BaseFormAssociatedElement extends BaseElement implements Omit<ElementInternals, 'form' | 'setFormValue'>, BaseFormControl {\n static formAssociated = true;\n\n /**\n * Validators are static because they have `observedAttributes`, essentially attributes to \"watch\"\n * for changes. Whenever these attributes change, we want to be notified and update the validator.\n */\n static get validators(): Validator[] {\n return [CustomErrorValidator()];\n }\n\n // Append all Validator \"observedAttributes\" into the \"observedAttributes\" so they can run.\n static get observedAttributes() {\n const parentAttrs = new Set(super.observedAttributes || []);\n\n for (const validator of this.validators) {\n if (!validator.observedAttributes) {\n continue;\n }\n\n for (const attr of validator.observedAttributes) {\n parentAttrs.add(attr);\n }\n }\n\n return [...parentAttrs];\n }\n\n // Form attributes\n /** The name of the input, submitted as a name/value pair with form data. */\n @property({ reflect: true }) name: string | null = null;\n\n /** Disables the form control. */\n @property({ type: Boolean }) disabled = false;\n\n required: boolean = false;\n\n assumeInteractionOn: string[] = ['input'];\n\n // Additional\n input?: (HTMLElement & { value: unknown }) | HTMLInputElement | HTMLTextAreaElement;\n\n validators: Validator[] = [];\n\n // Should these be private?\n @property({ state: true, attribute: false }) valueHasChanged: boolean = false;\n @property({ state: true, attribute: false }) hasInteracted: boolean = false;\n\n // This works around a limitation in Safari. It is a hacky way for us to preserve custom errors generated by the user.\n @property({ attribute: 'custom-error', reflect: true }) customError: string | null = null;\n\n private emittedEvents: string[] = [];\n\n constructor() {\n super();\n\n if (!isServer) {\n this.addEventListener('invalid', this.emitInvalid);\n }\n }\n // this bullshit makes no sense but tsc is angry about it\n // this needs both 'private' and 'typeof' or it will be angry and we don't know why\n // eslint-disable-next-line\n // @ts-ignore\n private states: typeof CustomStateSet;\n\n connectedCallback() {\n super.connectedCallback();\n this.updateValidity();\n\n // Lazily evaluate after the constructor to allow people to override the `assumeInteractionOn`\n this.assumeInteractionOn.forEach((event) => {\n this.addEventListener(event, this.handleInteraction);\n });\n }\n\n firstUpdated(...args: Parameters<LitElement['firstUpdated']>) {\n super.firstUpdated(...args);\n this.updateValidity();\n }\n\n emitInvalid = (e: Event) => {\n if (e.target !== this) return;\n\n // An \"invalid\" event counts as interacted, this is usually triggered by a button \"submitting\"\n this.hasInteracted = true;\n this.dispatchEvent(new WInvalidEvent());\n };\n\n protected willUpdate(changedProperties: Parameters<LitElement['willUpdate']>[0]) {\n if (!isServer && changedProperties.has('customError')) {\n // We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect\n if (!this.customError) {\n this.customError = null;\n }\n this.setCustomValidity(this.customError || '');\n }\n\n if (changedProperties.has('value') || changedProperties.has('disabled')) {\n // @ts-expect-error Some components will use an accessors, other use a property, so we don't want to limit them.\n const value = this.value as unknown;\n\n // Accounts for the snowflake case on `<wa-select>`\n if (Array.isArray(value)) {\n if (this.name) {\n const formData = new FormData();\n for (const val of value) {\n formData.append(this.name, val as string);\n }\n this.setValue(formData, formData);\n }\n } else {\n this.setValue(value as FormData | string | File | null, value as FormData | string | File | null);\n }\n }\n\n if (changedProperties.has('disabled')) {\n this.customStates.set('disabled', this.disabled);\n\n if (this.hasAttribute('disabled') || (!isServer && !this.matches(':disabled'))) {\n this.toggleAttribute('disabled', this.disabled);\n }\n }\n\n this.updateValidity();\n super.willUpdate(changedProperties);\n }\n\n private handleInteraction = (event: Event) => {\n const emittedEvents = this.emittedEvents;\n if (!emittedEvents.includes(event.type)) {\n emittedEvents.push(event.type);\n }\n\n // Mark it as user-interacted as soon as all associated events have been emitted\n if (emittedEvents.length === this.assumeInteractionOn?.length) {\n this.hasInteracted = true;\n }\n };\n\n get labels() {\n return this.internals.labels;\n }\n\n getForm() {\n return this.internals.form;\n }\n\n @property({ attribute: false, state: true, type: Object })\n get validity() {\n return this.internals.validity;\n }\n\n // Not sure if this supports `novalidate`. Will need to test.\n get willValidate() {\n return this.internals.willValidate;\n }\n\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n checkValidity() {\n this.updateValidity();\n return this.internals.checkValidity();\n }\n\n reportValidity() {\n this.updateValidity();\n // This seems reasonable. `reportValidity()` is kind of like \"we expect you to have interacted\"\n this.hasInteracted = true;\n return this.internals.reportValidity();\n }\n\n /**\n * Override this to change where constraint validation popups are anchored.\n */\n get validationTarget(): undefined | HTMLElement {\n return (this.input || undefined) as undefined | HTMLElement;\n }\n\n setValidity(...args: Parameters<typeof this.internals.setValidity>) {\n const flags = args[0];\n const message = args[1];\n let anchor = args[2];\n\n if (!anchor) {\n anchor = this.validationTarget;\n }\n\n this.internals.setValidity(flags, message, anchor || undefined);\n this.requestUpdate('validity');\n this.setCustomStates();\n }\n\n setCustomStates() {\n const required = Boolean(this.required);\n const isValid = this.internals.validity.valid;\n const hasInteracted = this.hasInteracted;\n\n this.customStates.set('required', required);\n this.customStates.set('optional', !required);\n this.customStates.set('invalid', !isValid);\n this.customStates.set('valid', isValid);\n this.customStates.set('user-invalid', !isValid && hasInteracted);\n this.customStates.set('user-valid', isValid && hasInteracted);\n }\n\n /**\n * Do not use this when creating a \"Validator\". This is intended for end users of components.\n * We track manually defined custom errors so we don't clear them on accident in our validators.\n *\n */\n setCustomValidity(message: string) {\n if (!message) {\n // We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect\n this.customError = null;\n this.setValidity({});\n return;\n }\n\n this.customError = message;\n this.setValidity({ customError: true }, message, this.validationTarget);\n }\n\n formResetCallback() {\n this.resetValidity();\n this.hasInteracted = false;\n this.valueHasChanged = false;\n this.emittedEvents = [];\n this.updateValidity();\n }\n\n formDisabledCallback(isDisabled: boolean) {\n this.disabled = isDisabled;\n\n this.updateValidity();\n }\n\n /**\n * Called when the browser is trying to restore element\u2019s state to state in which case reason is \"restore\", or when\n * the browser is trying to fulfill autofill on behalf of user in which case reason is \"autocomplete\". In the case of\n * \"restore\", state is a string, File, or FormData object previously set as the second argument to setFormValue.\n */\n formStateRestoreCallback(state: string | File | FormData | null, reason: 'autocomplete' | 'restore') {\n // @ts-expect-error We purposely do not have a value property. It makes things hard to extend.\n this.value = state;\n\n if (reason === 'restore') {\n this.resetValidity();\n }\n\n this.updateValidity();\n }\n\n setValue(...args: Parameters<typeof this.internals.setFormValue>) {\n const [value, state] = args;\n\n this.internals.setFormValue(value, state);\n }\n\n get allValidators() {\n const staticValidators = (this.constructor as typeof BaseFormAssociatedElement).validators || [];\n\n const validators = this.validators || [];\n return [...staticValidators, ...validators];\n }\n\n /**\n * Reset validity is a way of removing manual custom errors and native validation.\n */\n resetValidity() {\n this.setCustomValidity('');\n this.setValidity({});\n }\n\n updateValidity() {\n if (\n this.disabled ||\n this.hasAttribute('disabled') ||\n !this.willValidate //\n ) {\n this.resetValidity();\n\n return;\n }\n\n const validators = this.allValidators;\n\n if (!validators?.length) {\n // If there's no validators, we do nothing. We also don't want to mess with custom errors, so we just stop here.\n return;\n }\n\n type ValidityKey = { -readonly [P in keyof ValidityState]: ValidityState[P] };\n\n const flags: Partial<ValidityKey> = {\n // Don't trust custom errors from the Browser. Safari breaks the spec.\n customError: Boolean(this.customError),\n };\n\n const formControl = this.validationTarget || this.input || undefined;\n\n let finalMessage = '';\n\n for (const validator of validators) {\n const { isValid, message, invalidKeys } = validator.checkValidity(this);\n\n if (isValid) {\n continue;\n }\n\n if (!finalMessage) {\n finalMessage = message;\n }\n\n if (invalidKeys?.length >= 0) {\n (invalidKeys as (keyof ValidityState)[]).forEach((str) => (flags[str] = true));\n }\n }\n\n // This is a workaround for preserving custom errors\n if (!finalMessage) {\n finalMessage = this.validationMessage;\n }\n\n this.setValidity(flags, finalMessage, formControl);\n }\n}\n", "// eslint-disable-next-line\n// @ts-nocheck\nimport type { CSSResult, CSSResultGroup } from 'lit';\nimport { LitElement, unsafeCSS } from 'lit';\n\nimport { property } from 'lit/decorators.js';\n\nimport { styles as hostStyles } from './host-styles';\n\n// Augment Lit's module\ndeclare module 'lit' {\n interface PropertyDeclaration {\n /**\n * Specifies the property\u2019s default value\n */\n /* eslint-disable */\n default?: any;\n /* eslint-disable */\n initial?: any;\n }\n}\n\nexport default class BaseElement extends LitElement {\n /**\n * One or more CSS files to include in the component's shadow root. Host styles are automatically prepended. We use\n * this instead of Lit's styles property because we're importing CSS files as strings and need to convert them using\n * unsafeCSS.\n */\n static css?: CSSResultGroup | CSSResult | string | (CSSResult | string)[];\n\n /**\n * Override the default styles property to fetch and convert string CSS files. Components can override this behavior\n * by setting their own `static styles = []` property.\n */\n static get styles(): CSSResultGroup {\n const styles = Array.isArray(this.css) ? this.css : this.css ? [this.css] : [];\n return [hostStyles, ...styles].map((style) => (typeof style === 'string' ? unsafeCSS(style) : style));\n }\n\n #hasRecordedInitialProperties = false;\n initialReflectedProperties: Map<string, unknown> = new Map();\n internals: ElementInternals;\n\n // Make localization attributes reactive\n @property() dir: string;\n @property() lang: string;\n\n constructor() {\n super();\n\n try {\n this.internals = this.attachInternals();\n } catch {\n /* Need to tell people if they need a polyfill. */\n\n console.error('Element internals are not supported in your browser. Consider using a polyfill');\n }\n\n this.customStates.set('wa-defined', true);\n\n const Self = this.constructor as typeof BaseElement;\n for (const [property, spec] of Self.elementProperties) {\n if (spec.default === 'inherit' && spec.initial !== undefined && typeof property === 'string') {\n this.customStates.set(`initial-${property}-${spec.initial}`, true);\n }\n }\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n if (!this.#hasRecordedInitialProperties) {\n (this.constructor as typeof BaseElement).elementProperties.forEach((obj, prop: keyof typeof this & string) => {\n\n if (obj.reflect && this[prop] != null) {\n this.initialReflectedProperties.set(prop, this[prop]);\n }\n });\n\n this.#hasRecordedInitialProperties = true;\n }\n\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n protected willUpdate(changedProperties: Parameters<LitElement['willUpdate']>[0]): void {\n super.willUpdate(changedProperties);\n\n // Run the morph fixing *after* willUpdate.\n this.initialReflectedProperties.forEach((value, prop: string & keyof typeof this) => {\n // If a prop changes to `null`, we assume this happens via an attribute changing to `null`.\n\n if (changedProperties.has(prop) && this[prop] == null) {\n // Silly type gymnastics to appease the compiler.\n (this as Record<string, unknown>)[prop] = value;\n }\n });\n }\n\n /**\n * Methods for setting and checking custom states.\n */\n public customStates = {\n /** Adds or removes the specified custom state. */\n set: (customState: string, active: boolean) => {\n if (!this.internals?.states) return;\n if (active) {\n this.internals.states.add(customState);\n } else {\n this.internals.states.delete(customState);\n }\n },\n\n /** Determines whether or not the element currently has the specified state. */\n has: (customState: string) => {\n if (!this.internals?.states) return false;\n return this.internals.states.has(customState);\n },\n };\n\n /**\n * Given a native event, this function cancels it and dispatches it again from the host element using the desired\n * event options.\n */\n relayNativeEvent(event: Event, eventOptions?: EventInit) {\n event.stopImmediatePropagation();\n\n this.dispatchEvent(\n new (event.constructor as typeof Event)(event.type, {\n ...event,\n ...eventOptions,\n }),\n );\n }\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n :host {\n box-sizing: border-box !important;\n }\n\n :host *,\n :host *::before,\n :host *::after {\n box-sizing: inherit !important;\n }\n`;\n", "import type { Validator } from './form-associated-element';\n\n/**\n * This validator is for if you have an exact copy of your element in the shadow DOM. Rather than needing\n * custom translations and error messages, you can simply rely on the element \"formControl\" in your shadow dom.\n */\nexport const CustomErrorValidator = (): Validator => {\n return {\n observedAttributes: ['custom-error'],\n checkValidity(element) {\n const validity: ReturnType<Validator['checkValidity']> = {\n message: '',\n isValid: true,\n invalidKeys: [],\n };\n\n if (element.customError) {\n validity.message = element.customError;\n validity.isValid = false;\n validity.invalidKeys = ['customError'];\n }\n\n return validity;\n },\n };\n};\n", "export class WInvalidEvent extends Event {\n constructor() {\n super('w-invalid', { bubbles: true, cancelable: false, composed: true });\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'wa-invalid': WInvalidEvent;\n }\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n :host {\n color: var(--wa-form-control-value-color);\n display: inline-flex;\n flex-direction: row;\n align-items: top;\n font-family: inherit;\n font-weight: var(--wa-form-control-value-font-weight);\n line-height: var(--wa-form-control-value-line-height);\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n }\n\n :host(:focus) {\n outline: none;\n }\n\n [part~='label'] {\n display: inline;\n }\n\n [part~='hint'] {\n margin-block-start: 0.5em;\n }\n\n /* Default appearance */\n :host([appearance='default']) .control {\n flex: 0 0 auto;\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--wa-form-control-toggle-size, 2rem);\n height: var(--wa-form-control-toggle-size, 2rem);\n border-color: var(--wa-form-control-border-color, gray);\n border-radius: 50%;\n border-style: var(--wa-form-control-border-style, solid);\n border-width: var(--wa-form-control-border-width, 1px);\n background-color: var(--wa-form-control-background-color, white);\n color: transparent;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n\n margin-inline-end: 0.5em;\n }\n\n :host([appearance='clickable']) .control {\n position: absolute;\n inset: 0;\n height: 100%;\n width: 100%;\n cursor: pointer;\n }\n\n /* Checked */\n :host(:state(checked)):not(:host([appearance='clickable'])) .control {\n /* color: var(--checked-icon-color, white); */\n border-color: var(--wa-form-control-activated-color, blue);\n background-color: var(--wa-form-control-background-color, white);\n border-width: 0.6rem;\n }\n\n /* Focus */\n :host(:focus-visible) .control {\n outline: 2px solid var(--w-s-color-border-focus);\n outline-offset: var(--w-outline-offset, 1px);\n }\n\n :host([appearance='clickable']:focus-visible) .control {\n outline-offset: -4px;\n border-radius: 8px;\n }\n\n /* Disabled */\n :host(:state(disabled)) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Button appearance */\n :host([appearance='button']) {\n align-items: center;\n min-height: var(--wa-form-control-height);\n background-color: var(--wa-color-surface-default);\n border: var(--wa-form-control-border-width) var(--wa-form-control-border-style) var(--wa-form-control-border-color);\n border-radius: var(--wa-border-radius-m);\n padding: 0 var(--wa-form-control-padding-inline);\n transition:\n background-color var(--wa-transition-fast),\n border-color var(--wa-transition-fast);\n }\n\n :host([appearance='button']) .control {\n display: none;\n }\n\n /* Horizontal grouping - remove inner border radius */\n :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-inner]) {\n border-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-first]) {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-last]) {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n\n /* Vertical grouping - remove inner border radius */\n :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-inner]) {\n border-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-first]) {\n border-end-start-radius: 0;\n border-end-end-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-last]) {\n border-start-start-radius: 0;\n border-start-end-radius: 0;\n }\n\n @media (hover: hover) {\n :host([appearance='button']:hover:not(:state(disabled), :state(checked))) {\n background-color: color-mix(in srgb, var(--wa-color-surface-default) 95%, var(--wa-color-mix-hover));\n }\n }\n\n :host([appearance='button']:focus-visible) {\n outline: var(--wa-focus-ring);\n outline-offset: var(--wa-focus-ring-offset);\n }\n\n :host([appearance='button']:state(checked)) {\n border-color: var(--wa-form-control-activated-color);\n background-color: var(--wa-color-brand-fill-quiet);\n }\n\n :host([appearance='button']:state(checked):focus-visible) {\n outline: var(--wa-focus-ring-style) var(--wa-focus-ring-width) var(--wa-color-brand-border-loud);\n outline-offset: var(--wa-focus-ring-offset);\n }\n\n /* Remove inner borders and handle overlap */\n :host([appearance='button'][data-wa-radio-horizontal]:not([data-wa-radio-first])) {\n margin-inline-start: calc(-1 * var(--wa-form-control-border-width));\n }\n\n :host([appearance='button'][data-wa-radio-vertical]:not([data-wa-radio-first])) {\n margin-block-start: calc(-1 * var(--wa-form-control-border-width));\n }\n\n /* Ensure interactive states are visible above adjacent buttons */\n :host([appearance='button']:hover),\n :host([appearance='button']:state(checked)) {\n position: relative;\n z-index: 1;\n }\n\n :host([appearance='button']:focus-visible) {\n z-index: 2;\n }\n`;\n", "import type { PropertyValues } from 'lit';\nimport { html } from 'lit';\n\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { BaseFormAssociatedElement } from './form-associated-element';\nimport { uniqueId } from './math';\nimport './radio';\nimport type { WRadio } from './radio';\n// eslint-disable-next-line\n// @ts-ignore\nimport { styles } from './radio-group-styles';\nimport { RequiredValidator } from './required-validator';\nimport { HasSlotController } from './slot';\n\n/**\n * @slot label - Alternative to the `label` attribute should you need custom HTML.\n */\nexport class WRadioGroup extends BaseFormAssociatedElement {\n static css = [styles];\n\n static get validators() {\n const validators = [\n RequiredValidator({\n validationElement: Object.assign(document.createElement('input'), {\n required: true,\n type: 'radio',\n // we need an id that's guaranteed to be unique; users will never see this\n name: uniqueId('__w-radio'),\n }),\n }),\n ];\n return [...super.validators, ...validators];\n }\n\n private readonly hasSlotController = new HasSlotController(this, 'hint', 'label');\n\n @state() hasRadioButtons = false;\n\n @query('slot:not([name])') defaultSlot: HTMLSlotElement;\n\n /**\n * The radio group's label. Required for proper accessibility. If you need to display HTML, use the `label` slot\n * instead.\n */\n @property() label = '';\n\n /** The radio groups's hint. If you need to display HTML, use the `hint` slot instead. */\n @property({ attribute: 'hint' }) hint = '';\n\n /** The name of the radio group, submitted as a name/value pair with form data. */\n @property({ reflect: true }) name: string | null = null;\n\n /** Disables the radio group and all child radios. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** The orientation in which to show radio items. */\n @property({ reflect: true }) orientation: 'horizontal' | 'vertical' = 'vertical';\n\n private _value: string | null = null;\n\n get value() {\n if (this.valueHasChanged) {\n return this._value;\n }\n\n return this._value ?? this.defaultValue;\n }\n\n /** The current value of the radio group, submitted as a name/value pair with form data. */\n @state()\n set value(val: string | number | null) {\n if (typeof val === 'number') val = String(val);\n this.valueHasChanged = true;\n this._value = val;\n }\n\n /** The default value of the form control. Primarily used for resetting the form control. */\n @property({ attribute: 'value', reflect: true }) defaultValue: string | null = this.getAttribute('value') || null;\n\n /** The radio group's size. This size will be applied to all child radios and radio buttons, except when explicitly overridden. */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Ensures a child radio is checked before allowing the containing form to submit. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /**\n * Used for SSR. if true, will show slotted label on initial render.\n */\n @property({ type: Boolean, attribute: 'with-label' }) withLabel = false;\n\n /**\n * Used for SSR. if true, will show slotted hint on initial render.\n */\n @property({ type: Boolean, attribute: 'with-hint' }) withHint = false;\n\n //\n // We need this because if we don't have it, FormValidation yells at us that it's \"not focusable\".\n // If we use `this.tabIndex = -1` we can't focus the radio inside.\n //\n static shadowRootOptions = { ...BaseFormAssociatedElement.shadowRootOptions, delegatesFocus: true };\n\n constructor() {\n super();\n this.addEventListener('keydown', this.handleKeyDown);\n this.addEventListener('click', this.handleRadioClick);\n }\n\n /**\n * We use the first available radio as the validationTarget similar to native HTML that shows the validation popup on\n * the first radio element.\n */\n get validationTarget() {\n const radio = this.querySelector<WRadio>(':is(w-radio):not([disabled])');\n if (!radio) return undefined;\n\n return radio;\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('disabled') || changedProperties.has('value')) {\n this.syncRadioElements();\n }\n }\n\n formResetCallback(...args: Parameters<BaseFormAssociatedElement['formResetCallback']>) {\n this.value = this.defaultValue;\n\n super.formResetCallback(...args);\n\n this.syncRadioElements();\n }\n\n private handleRadioClick = (e: Event) => {\n const clickedRadio = (e.target as HTMLElement).closest<WRadio>('w-radio');\n /* eslint-disable */\n if (!clickedRadio || clickedRadio.disabled || (clickedRadio as any).forceDisabled || this.disabled) {\n return;\n }\n\n const oldValue = this.value;\n this.value = clickedRadio.value;\n clickedRadio.checked = true;\n\n const radios = this.getAllRadios();\n for (const radio of radios) {\n if (clickedRadio === radio) {\n continue;\n }\n\n radio.checked = false;\n radio.setAttribute('tabindex', '-1');\n }\n\n if (this.value !== oldValue) {\n this.updateComplete.then(() => {\n this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n });\n }\n };\n\n private getAllRadios() {\n return [...this.querySelectorAll<WRadio>('w-radio')];\n }\n\n private handleLabelClick() {\n this.focus();\n }\n\n private async syncRadioElements() {\n const radios = this.getAllRadios();\n let hasRadioButtons = false;\n\n // Add data attributes to support styling\n radios.forEach((radio, index) => {\n if (radio.appearance === 'button') hasRadioButtons = true;\n radio.setAttribute('size', this.size);\n radio.toggleAttribute('data-w-radio-horizontal', this.orientation !== 'vertical');\n radio.toggleAttribute('data-w-radio-vertical', this.orientation === 'vertical');\n radio.toggleAttribute('data-w-radio-first', index === 0);\n radio.toggleAttribute('data-w-radio-inner', index !== 0 && index !== radios.length - 1);\n radio.toggleAttribute('data-w-radio-last', index === radios.length - 1);\n\n // Set forceDisabled state based on radio group's disabled state\n (radio as WRadio).forceDisabled = this.disabled;\n });\n\n // If at least one radio button exists, we assume it's a radio button group\n this.hasRadioButtons = hasRadioButtons;\n\n await Promise.all(\n radios.map(async (radio) => {\n await radio.updateComplete;\n\n if (!radio.disabled && radio.value === this.value) {\n radio.checked = true;\n } else {\n radio.checked = false;\n }\n }),\n );\n\n // Manage tabIndex based on disabled state and checked status\n if (this.disabled) {\n // If radio group is disabled, all radios should not be tabbable\n radios.forEach((radio) => {\n radio.tabIndex = -1;\n });\n } else {\n // Normal tabbing behavior\n const enabledRadios = radios.filter((radio) => !radio.disabled);\n const checkedRadio = enabledRadios.find((radio) => radio.checked);\n\n if (enabledRadios.length > 0) {\n if (checkedRadio) {\n // If there's a checked radio, it should be tabbable\n enabledRadios.forEach((radio) => {\n radio.tabIndex = radio.checked ? 0 : -1;\n });\n } else {\n // If no radio is checked, first enabled radio should be tabbable\n enabledRadios.forEach((radio, index) => {\n radio.tabIndex = index === 0 ? 0 : -1;\n });\n }\n }\n\n // Disabled radios should never be tabbable\n radios\n .filter((radio) => radio.disabled)\n .forEach((radio) => {\n radio.tabIndex = -1;\n });\n }\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', ' '].includes(event.key) || this.disabled) {\n return;\n }\n\n const radios = this.getAllRadios().filter((radio) => !radio.disabled);\n\n if (radios.length <= 0) {\n return;\n }\n\n event.preventDefault();\n\n const oldValue = this.value;\n\n const checkedRadio = radios.find((radio) => radio.checked) ?? radios[0];\n const incr = event.key === ' ' ? 0 : ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1;\n let index = radios.indexOf(checkedRadio) + incr;\n\n if (!index) index = 0;\n\n if (index < 0) {\n index = radios.length - 1;\n }\n\n if (index > radios.length - 1) {\n index = 0;\n }\n\n const hasRadioButtons = radios.some((radio) => radio.tagName.toLowerCase() === 'w-radio-button');\n\n this.getAllRadios().forEach((radio) => {\n radio.checked = false;\n\n if (!hasRadioButtons) {\n radio.setAttribute('tabindex', '-1');\n }\n });\n\n this.value = radios[index].value;\n radios[index].checked = true;\n\n if (!hasRadioButtons) {\n radios[index].setAttribute('tabindex', '0');\n radios[index].focus();\n } else {\n radios[index].shadowRoot!.querySelector('button')!.focus();\n }\n\n if (this.value !== oldValue) {\n this.updateComplete.then(() => {\n this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n });\n }\n\n event.preventDefault();\n }\n\n /** Sets focus on the radio group. */\n public focus(options?: FocusOptions) {\n if (this.disabled) return;\n\n const radios = this.getAllRadios();\n const checked = radios.find((radio) => radio.checked);\n const firstEnabledRadio = radios.find((radio) => !radio.disabled);\n const radioToFocus = checked || firstEnabledRadio;\n\n // Call focus for the checked radio. If no radio is checked, focus the first one that isn't disabled.\n if (radioToFocus) {\n radioToFocus.focus(options);\n }\n }\n\n render() {\n const hasLabelSlot = this.hasUpdated ? this.hasSlotController.test('label') : this.withLabel;\n const hasHintSlot = this.hasUpdated ? this.hasSlotController.test('hint') : this.withHint;\n const hasLabel = this.label ? true : !!hasLabelSlot;\n const hasHint = this.hint ? true : !!hasHintSlot;\n\n return html`\n <fieldset\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control-radio-group': true,\n 'form-control-has-label': hasLabel,\n 'has-radio-buttons': this.hasRadioButtons,\n })}\n role=\"radiogroup\"\n aria-labelledby=\"label\"\n aria-describedby=\"hint\"\n aria-errormessage=\"error-message\"\n aria-orientation=${this.orientation}>\n <label\n part=\"form-control-label\"\n id=\"label\"\n class=\"label\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n @click=${this.handleLabelClick}>\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <slot part=\"form-control-input\" @slotchange=${this.syncRadioElements}></slot>\n\n <slot\n id=\"hint\"\n name=\"hint\"\n part=\"hint\"\n class=${classMap({\n 'has-slotted': hasHint,\n })}\n aria-hidden=${hasHint ? 'false' : 'true'}\n >${this.hint}</slot\n >\n </fieldset>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'w-radio-group': WRadioGroup;\n }\n}\n", "export const urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n", "/* @ts-self-types=\"./index.d.ts\" */\nimport { urlAlphabet as scopedUrlAlphabet } from './url-alphabet/index.js'\nexport { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << Math.log2(alphabet.length - 1)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step | 0\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length >= size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size | 0, random)\nexport let nanoid = (size = 21) => {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))\n while (size--) {\n id += scopedUrlAlphabet[bytes[size] & 63]\n }\n return id\n}\n", "import { nanoid } from 'nanoid';\n\nexport function uniqueId(prefix = '') {\n return `${prefix}${nanoid()}`;\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n :host {\n display: block;\n }\n\n .form-control {\n position: relative;\n border: none;\n padding: 0;\n margin: 0;\n }\n\n .label {\n font-size: var(--w-font-size-s);\n line-height: var(--w-line-height-s);\n font-weight: 700;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n font-smoothing: grayscale;\n cursor: pointer;\n padding-bottom: 0.4rem;\n color: var(--w-s-color-text);\n display: block;\n }\n\n .radio-group-required .label::after {\n content: var(--wa-form-control-required-content);\n margin-inline-start: var(--wa-form-control-required-content-offset);\n }\n\n .button-group {\n display: flex;\n }\n\n [part~='form-control-input'] {\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n gap: 0.75em;\n }\n\n /* Horizontal */\n :host([orientation='horizontal']) [part~='form-control-input'] {\n flex-direction: row;\n gap: 1em;\n }\n\n /* Help text */\n [part~='hint'] {\n margin-block-start: 0.5em;\n }\n\n /* Radios have the \"button\" appearance */\n :host fieldset.has-radio-buttons {\n [part~='form-control-input'] {\n gap: 0;\n }\n }\n`;\n", "import type { Validator } from './form-associated-element';\n\nexport interface RequiredValidatorOptions {\n /** This is a cheap way for us to get translation strings for the user without having proper translations. */\n validationElement?: HTMLSelectElement | HTMLInputElement;\n\n /**\n * The property to check if its not null-ish. For most elements this will be \"value\".\n * For \"checkbox\" for example it will be \"checked\"\n */\n validationProperty?: string;\n}\n\nexport const RequiredValidator = (options: RequiredValidatorOptions = {}): Validator => {\n let { validationElement, validationProperty } = options;\n\n if (!validationElement) {\n validationElement = Object.assign(document.createElement('input'), { required: true });\n }\n\n if (!validationProperty) {\n validationProperty = 'value';\n }\n\n const obj: Validator = {\n observedAttributes: ['required'],\n message: validationElement.validationMessage, // @TODO: Add a translation.\n checkValidity(element) {\n const validity: ReturnType<Validator['checkValidity']> = {\n message: '',\n isValid: true,\n invalidKeys: [],\n };\n\n const isRequired = element.required ?? element.hasAttribute('required');\n\n // Always true if the element isn't required.\n if (!isRequired) {\n return validity;\n }\n\n const value = element[validationProperty as keyof typeof element];\n\n const isEmpty = !value;\n\n if (isEmpty) {\n validity.message = typeof obj.message === 'function' ? obj.message(element) : obj.message || '';\n validity.isValid = false;\n validity.invalidKeys.push('valueMissing');\n }\n\n return validity;\n },\n };\n\n return obj;\n};\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/** A reactive controller that determines when slots exist. */\nexport class HasSlotController implements ReactiveController {\n host: ReactiveControllerHost & Element;\n slotNames: string[] = [];\n\n constructor(host: ReactiveControllerHost & Element, ...slotNames: string[]) {\n (this.host = host).addController(this);\n this.slotNames = slotNames;\n }\n\n private hasDefaultSlot() {\n return [...this.host.childNodes].some((node) => {\n if (node.nodeType === Node.TEXT_NODE && node.textContent!.trim() !== '') {\n return true;\n }\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n const el = node as HTMLElement;\n const tagName = el.tagName.toLowerCase();\n\n // Ignore visually hidden elements since they aren't rendered\n if (tagName === 'w-visually-hidden') {\n return false;\n }\n\n // If it doesn't have a slot attribute, it's part of the default slot\n if (!el.hasAttribute('slot')) {\n return true;\n }\n }\n\n return false;\n });\n }\n\n private hasNamedSlot(name: string) {\n return this.host.querySelector(`:scope > [slot=\"${name}\"]`) !== null;\n }\n\n test(slotName: string) {\n return slotName === '[default]' ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);\n }\n\n hostConnected() {\n this.host.shadowRoot!.addEventListener('slotchange', this.handleSlotChange);\n }\n\n hostDisconnected() {\n this.host.shadowRoot!.removeEventListener('slotchange', this.handleSlotChange);\n }\n\n private handleSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n\n if ((this.slotNames.includes('[default]') && !slot.name) || (slot.name && this.slotNames.includes(slot.name))) {\n this.host.requestUpdate();\n }\n };\n}\n\n/**\n * Given a list of nodes, this function iterates over all of them and returns the concatenated\n * HTML as a string. This is useful for getting the HTML that corresponds to a slot\u2019s assigned nodes (since we can't use slot.innerHTML as an alternative).\n * @param nodes - The list of nodes to iterate over.\n * @param callback - A function that can be used to customize the HTML output for specific types of nodes. If the function returns undefined, the default HTML output will be used.\n */\nexport function getInnerHTML(nodes: Iterable<Node>, callback?: (node: Node) => string | undefined): string {\n let html = '';\n\n for (const node of nodes) {\n if (callback) {\n const customHTML = callback(node);\n\n if (customHTML !== undefined) {\n html += customHTML;\n continue;\n }\n }\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n html += (node as HTMLElement).outerHTML;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n html += node.textContent;\n }\n }\n\n return html;\n}\n", "import { WRadio } from './radio';\nimport { WRadioGroup } from './radio-group';\n\nif (!customElements.get('w-radio')) {\n customElements.define('w-radio', WRadio);\n customElements.define('w-radio-group', WRadioGroup);\n}\n"],
|
|
5
|
-
"mappings": "mhBAAA,OAAS,QAAAA,MAAY,MCCrB,OAAS,QAAAC,MAAY,MAErB,OAAS,YAAAC,EAAU,SAAAC,MAAa,oBCHhC,OAAqB,YAAAC,MAAgB,MAErC,OAAS,YAAAC,MAAgB,oBCCzB,OAAS,cAAAC,EAAY,aAAAC,MAAiB,MAEtC,OAAS,YAAAC,MAAgB,oBCLzB,OAAS,OAAAC,MAAW,MAEb,IAAM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names": ["html", "html", "property", "state", "isServer", "property", "LitElement", "unsafeCSS", "property", "css", "styles", "_hasRecordedInitialProperties", "BaseElement", "LitElement", "__privateAdd", "customState", "active", "_a", "Self", "property", "spec", "styles", "style", "unsafeCSS", "name", "oldValue", "newValue", "__privateGet", "obj", "prop", "__privateSet", "changedProperties", "value", "event", "eventOptions", "__decorateClass", "CustomErrorValidator", "element", "validity", "WInvalidEvent", "BaseFormAssociatedElement", "BaseElement", "e", "WInvalidEvent", "event", "_a", "emittedEvents", "isServer", "CustomErrorValidator", "parentAttrs", "validator", "attr", "args", "changedProperties", "value", "formData", "val", "flags", "message", "anchor", "required", "isValid", "hasInteracted", "isDisabled", "state", "reason", "staticValidators", "validators", "formControl", "finalMessage", "invalidKeys", "str", "__decorateClass", "property", "css", "styles", "WRadio", "BaseFormAssociatedElement", "changedProperties", "effectivelyDisabled", "html", "styles", "__decorateClass", "state", "property", "html", "property", "query", "state", "classMap", "urlAlphabet", "nanoid", "size", "id", "bytes", "urlAlphabet", "uniqueId", "prefix", "nanoid", "css", "styles", "RequiredValidator", "options", "validationElement", "validationProperty", "obj", "element", "_a", "validity", "HasSlotController", "host", "slotNames", "event", "slot", "node", "el", "name", "slotName", "WRadioGroup", "BaseFormAssociatedElement", "HasSlotController", "e", "clickedRadio", "oldValue", "radios", "radio", "validators", "RequiredValidator", "uniqueId", "_a", "val", "changedProperties", "args", "hasRadioButtons", "index", "enabledRadios", "checkedRadio", "event", "incr", "options", "checked", "firstEnabledRadio", "radioToFocus", "hasLabelSlot", "hasHintSlot", "hasLabel", "hasHint", "html", "classMap", "styles", "__decorateClass", "state", "query", "property", "WRadio", "WRadioGroup", "radio_stories_default", "html", "Default"]
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/web-components-vite';\nimport { html } from 'lit';\nimport './index';\n\nexport default {\n title: 'Forms/Radio',\n render: () => {\n return html`\n <w-radio-group label=\"Group\" name=\"foobar\" value=\"foo\">\n <w-radio value=\"foo\">foo</w-radio>\n <w-radio value=\"bar\">bar</w-radio>\n </w-radio-group>\n `;\n },\n} satisfies Meta;\n\nexport const Default: StoryObj = {};\n", "import type { PropertyValues } from 'lit';\nimport { html } from 'lit';\n\nimport { property, state } from 'lit/decorators.js';\n\nimport { BaseFormAssociatedElement } from './form-associated-element';\n// eslint-disable-next-line\n// @ts-ignore\nimport { styles } from './radio-styles';\n\nexport class WRadio extends BaseFormAssociatedElement {\n static css = [styles];\n\n @state() checked = false;\n\n /** @internal Used by radio group to force disable radios while preserving their original disabled state. */\n @state() forceDisabled = false;\n\n /**\n * The string pointing to a form's id.\n */\n @property({ reflect: true }) form: string | null = null;\n\n /** The radio's value. When selected, the radio group will receive this value. */\n @property({ reflect: true }) value: string;\n\n /** The radio's value. When selected, the radio group will receive this value. */\n @property({ reflect: true }) appearance: 'default' | 'button' | 'clickable' = 'default';\n\n /**\n * The radio's size. When used inside a radio group, the size will be determined by the radio group's size so this\n * attribute can typically be omitted.\n */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Disables the radio. */\n @property({ type: Boolean }) disabled = false;\n\n constructor() {\n super();\n this.addEventListener('click', this.handleClick);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setInitialAttributes();\n }\n\n private setInitialAttributes() {\n this.setAttribute('role', 'radio');\n this.tabIndex = 0;\n this.setAttribute('aria-disabled', this.disabled || this.forceDisabled ? 'true' : 'false');\n }\n\n updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('checked')) {\n this.customStates.set('checked', this.checked);\n this.setAttribute('aria-checked', this.checked ? 'true' : 'false');\n // Only set tabIndex if not disabled\n if (!this.disabled && !this.forceDisabled) {\n this.tabIndex = this.checked ? 0 : -1;\n }\n }\n\n if (changedProperties.has('disabled') || changedProperties.has('forceDisabled')) {\n const effectivelyDisabled = this.disabled || this.forceDisabled;\n this.customStates.set('disabled', effectivelyDisabled);\n this.setAttribute('aria-disabled', effectivelyDisabled ? 'true' : 'false');\n\n // Set tabIndex based on disabled state\n if (effectivelyDisabled) {\n this.tabIndex = -1;\n } else {\n // Restore proper tabIndex - this will be managed by the radio group\n this.tabIndex = this.checked ? 0 : -1;\n }\n }\n }\n\n /**\n * @override\n */\n setValue(): void {\n // We override `setValue` because we don't want to set form values from here. We want to do that in \"RadioGroup\" itself.\n }\n\n // Update the handleClick method (around line 75)\n private handleClick = () => {\n if (!this.disabled && !this.forceDisabled) {\n this.checked = true;\n }\n };\n\n render() {\n return html`\n <span part=\"control\" class=\"control\"></span>\n <slot part=\"label\" class=\"label\"></slot>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'w-radio': WRadio;\n }\n}\n", "import { isServer, LitElement } from 'lit';\n\nimport { property } from 'lit/decorators.js';\n\nimport BaseElement from './base-element.js';\nimport { CustomErrorValidator } from './custom-error-validator.js';\nimport { WInvalidEvent } from './invalid';\n\nexport interface Validator<T extends BaseFormAssociatedElement = BaseFormAssociatedElement> {\n observedAttributes?: string[];\n checkValidity: (element: T) => {\n message: string;\n isValid: boolean;\n invalidKeys: Exclude<keyof ValidityState, 'valid'>[];\n };\n message?: string | ((element: T) => string);\n}\n\nexport interface BaseFormControl extends BaseElement {\n // Form attributes\n name: null | string;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n checked?: boolean;\n defaultSelected?: boolean;\n selected?: boolean;\n form?: string | null;\n\n value?: unknown;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | 'any';\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n\n // Form validation properties\n readonly validity: ValidityState;\n readonly validationMessage: string;\n\n // Form validation methods\n checkValidity: () => boolean;\n getForm: () => HTMLFormElement | null;\n reportValidity: () => boolean;\n setCustomValidity: (message: string) => void;\n\n // Form properties\n hasInteracted: boolean;\n valueHasChanged?: boolean;\n\n /** Convenience API for `setCustomValidity()` */\n customError: null | string;\n}\n\n// setFormValue omitted so that we can use `setValue`\nexport class BaseFormAssociatedElement\n extends BaseElement\n implements Omit<ElementInternals, 'form' | 'setFormValue'>, BaseFormControl\n{\n static formAssociated = true;\n\n /**\n * Validators are static because they have `observedAttributes`, essentially attributes to \"watch\"\n * for changes. Whenever these attributes change, we want to be notified and update the validator.\n */\n static get validators(): Validator[] {\n return [CustomErrorValidator()];\n }\n\n // Append all Validator \"observedAttributes\" into the \"observedAttributes\" so they can run.\n static get observedAttributes() {\n const parentAttrs = new Set(super.observedAttributes || []);\n\n for (const validator of this.validators) {\n if (!validator.observedAttributes) {\n continue;\n }\n\n for (const attr of validator.observedAttributes) {\n parentAttrs.add(attr);\n }\n }\n\n return [...parentAttrs];\n }\n\n // Form attributes\n /** The name of the input, submitted as a name/value pair with form data. */\n @property({ reflect: true }) name: string | null = null;\n\n /** Disables the form control. */\n @property({ type: Boolean }) disabled = false;\n\n required = false;\n\n assumeInteractionOn: string[] = ['input'];\n\n // Additional\n input?: (HTMLElement & { value: unknown }) | HTMLInputElement | HTMLTextAreaElement;\n\n validators: Validator[] = [];\n\n // Should these be private?\n @property({ state: true, attribute: false }) valueHasChanged = false;\n @property({ state: true, attribute: false }) hasInteracted = false;\n\n // This works around a limitation in Safari. It is a hacky way for us to preserve custom errors generated by the user.\n @property({ attribute: 'custom-error', reflect: true }) customError: string | null = null;\n\n private emittedEvents: string[] = [];\n\n constructor() {\n super();\n\n if (!isServer) {\n this.addEventListener('invalid', this.emitInvalid);\n }\n }\n // this bullshit makes no sense but tsc is angry about it\n // this needs both 'private' and 'typeof' or it will be angry and we don't know why\n // eslint-disable-next-line\n // @ts-ignore\n private states: typeof CustomStateSet;\n\n connectedCallback() {\n super.connectedCallback();\n this.updateValidity();\n\n // Lazily evaluate after the constructor to allow people to override the `assumeInteractionOn`\n this.assumeInteractionOn.forEach((event) => {\n this.addEventListener(event, this.handleInteraction);\n });\n }\n\n firstUpdated(...args: Parameters<LitElement['firstUpdated']>) {\n super.firstUpdated(...args);\n this.updateValidity();\n }\n\n emitInvalid = (e: Event) => {\n if (e.target !== this) return;\n\n // An \"invalid\" event counts as interacted, this is usually triggered by a button \"submitting\"\n this.hasInteracted = true;\n this.dispatchEvent(new WInvalidEvent());\n };\n\n protected willUpdate(changedProperties: Parameters<LitElement['willUpdate']>[0]) {\n if (!isServer && changedProperties.has('customError')) {\n // We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect\n if (!this.customError) {\n this.customError = null;\n }\n this.setCustomValidity(this.customError || '');\n }\n\n if (changedProperties.has('value') || changedProperties.has('disabled')) {\n // @ts-expect-error Some components will use an accessors, other use a property, so we don't want to limit them.\n const value = this.value as unknown;\n\n // Accounts for the snowflake case on `<wa-select>`\n if (Array.isArray(value)) {\n if (this.name) {\n const formData = new FormData();\n for (const val of value) {\n formData.append(this.name, val as string);\n }\n this.setValue(formData, formData);\n }\n } else {\n this.setValue(value as FormData | string | File | null, value as FormData | string | File | null);\n }\n }\n\n if (changedProperties.has('disabled')) {\n this.customStates.set('disabled', this.disabled);\n\n if (this.hasAttribute('disabled') || (!isServer && !this.matches(':disabled'))) {\n this.toggleAttribute('disabled', this.disabled);\n }\n }\n\n this.updateValidity();\n super.willUpdate(changedProperties);\n }\n\n private handleInteraction = (event: Event) => {\n const emittedEvents = this.emittedEvents;\n if (!emittedEvents.includes(event.type)) {\n emittedEvents.push(event.type);\n }\n\n // Mark it as user-interacted as soon as all associated events have been emitted\n if (emittedEvents.length === this.assumeInteractionOn?.length) {\n this.hasInteracted = true;\n }\n };\n\n get labels() {\n return this.internals.labels;\n }\n\n getForm() {\n return this.internals.form;\n }\n\n @property({ attribute: false, state: true, type: Object })\n get validity() {\n return this.internals.validity;\n }\n\n // Not sure if this supports `novalidate`. Will need to test.\n get willValidate() {\n return this.internals.willValidate;\n }\n\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n checkValidity() {\n this.updateValidity();\n return this.internals.checkValidity();\n }\n\n reportValidity() {\n this.updateValidity();\n // This seems reasonable. `reportValidity()` is kind of like \"we expect you to have interacted\"\n this.hasInteracted = true;\n return this.internals.reportValidity();\n }\n\n /**\n * Override this to change where constraint validation popups are anchored.\n */\n get validationTarget(): undefined | HTMLElement {\n return (this.input || undefined) as undefined | HTMLElement;\n }\n\n setValidity(...args: Parameters<typeof this.internals.setValidity>) {\n const flags = args[0];\n const message = args[1];\n let anchor = args[2];\n\n if (!anchor) {\n anchor = this.validationTarget;\n }\n\n this.internals.setValidity(flags, message, anchor || undefined);\n this.requestUpdate('validity');\n this.setCustomStates();\n }\n\n setCustomStates() {\n const required = Boolean(this.required);\n const isValid = this.internals.validity.valid;\n const hasInteracted = this.hasInteracted;\n\n this.customStates.set('required', required);\n this.customStates.set('optional', !required);\n this.customStates.set('invalid', !isValid);\n this.customStates.set('valid', isValid);\n this.customStates.set('user-invalid', !isValid && hasInteracted);\n this.customStates.set('user-valid', isValid && hasInteracted);\n }\n\n /**\n * Do not use this when creating a \"Validator\". This is intended for end users of components.\n * We track manually defined custom errors so we don't clear them on accident in our validators.\n *\n */\n setCustomValidity(message: string) {\n if (!message) {\n // We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect\n this.customError = null;\n this.setValidity({});\n return;\n }\n\n this.customError = message;\n this.setValidity({ customError: true }, message, this.validationTarget);\n }\n\n formResetCallback() {\n this.resetValidity();\n this.hasInteracted = false;\n this.valueHasChanged = false;\n this.emittedEvents = [];\n this.updateValidity();\n }\n\n formDisabledCallback(isDisabled: boolean) {\n this.disabled = isDisabled;\n\n this.updateValidity();\n }\n\n /**\n * Called when the browser is trying to restore element\u2019s state to state in which case reason is \"restore\", or when\n * the browser is trying to fulfill autofill on behalf of user in which case reason is \"autocomplete\". In the case of\n * \"restore\", state is a string, File, or FormData object previously set as the second argument to setFormValue.\n */\n formStateRestoreCallback(state: string | File | FormData | null, reason: 'autocomplete' | 'restore') {\n // @ts-expect-error We purposely do not have a value property. It makes things hard to extend.\n this.value = state;\n\n if (reason === 'restore') {\n this.resetValidity();\n }\n\n this.updateValidity();\n }\n\n setValue(...args: Parameters<typeof this.internals.setFormValue>) {\n const [value, state] = args;\n\n this.internals.setFormValue(value, state);\n }\n\n get allValidators() {\n const staticValidators = (this.constructor as typeof BaseFormAssociatedElement).validators || [];\n\n const validators = this.validators || [];\n return [...staticValidators, ...validators];\n }\n\n /**\n * Reset validity is a way of removing manual custom errors and native validation.\n */\n resetValidity() {\n this.setCustomValidity('');\n this.setValidity({});\n }\n\n updateValidity() {\n if (\n this.disabled ||\n this.hasAttribute('disabled') ||\n !this.willValidate //\n ) {\n this.resetValidity();\n\n return;\n }\n\n const validators = this.allValidators;\n\n if (!validators?.length) {\n // If there's no validators, we do nothing. We also don't want to mess with custom errors, so we just stop here.\n return;\n }\n\n type ValidityKey = { -readonly [P in keyof ValidityState]: ValidityState[P] };\n\n const flags: Partial<ValidityKey> = {\n // Don't trust custom errors from the Browser. Safari breaks the spec.\n customError: Boolean(this.customError),\n };\n\n const formControl = this.validationTarget || this.input || undefined;\n\n let finalMessage = '';\n\n for (const validator of validators) {\n const { isValid, message, invalidKeys } = validator.checkValidity(this);\n\n if (isValid) {\n continue;\n }\n\n if (!finalMessage) {\n finalMessage = message;\n }\n\n if (invalidKeys?.length >= 0) {\n (invalidKeys as (keyof ValidityState)[]).forEach((str) => (flags[str] = true));\n }\n }\n\n // This is a workaround for preserving custom errors\n if (!finalMessage) {\n finalMessage = this.validationMessage;\n }\n\n this.setValidity(flags, finalMessage, formControl);\n }\n}\n", "// eslint-disable-next-line\n// @ts-nocheck\nimport type { CSSResult, CSSResultGroup } from 'lit';\nimport { LitElement, unsafeCSS } from 'lit';\n\nimport { property } from 'lit/decorators.js';\n\nimport { styles as hostStyles } from './host-styles';\n\n// Augment Lit's module\ndeclare module 'lit' {\n interface PropertyDeclaration {\n /**\n * Specifies the property\u2019s default value\n */\n /* eslint-disable */\n default?: any;\n /* eslint-disable */\n initial?: any;\n }\n}\n\nexport default class BaseElement extends LitElement {\n /**\n * One or more CSS files to include in the component's shadow root. Host styles are automatically prepended. We use\n * this instead of Lit's styles property because we're importing CSS files as strings and need to convert them using\n * unsafeCSS.\n */\n static css?: CSSResultGroup | CSSResult | string | (CSSResult | string)[];\n\n /**\n * Override the default styles property to fetch and convert string CSS files. Components can override this behavior\n * by setting their own `static styles = []` property.\n */\n static get styles(): CSSResultGroup {\n const styles = Array.isArray(this.css) ? this.css : this.css ? [this.css] : [];\n return [hostStyles, ...styles].map((style) => (typeof style === 'string' ? unsafeCSS(style) : style));\n }\n\n #hasRecordedInitialProperties = false;\n initialReflectedProperties: Map<string, unknown> = new Map();\n internals: ElementInternals;\n\n // Make localization attributes reactive\n @property() dir: string;\n @property() lang: string;\n\n constructor() {\n super();\n\n try {\n this.internals = this.attachInternals();\n } catch {\n /* Need to tell people if they need a polyfill. */\n\n console.error('Element internals are not supported in your browser. Consider using a polyfill');\n }\n\n this.customStates.set('wa-defined', true);\n\n const Self = this.constructor as typeof BaseElement;\n for (const [property, spec] of Self.elementProperties) {\n if (spec.default === 'inherit' && spec.initial !== undefined && typeof property === 'string') {\n this.customStates.set(`initial-${property}-${spec.initial}`, true);\n }\n }\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n if (!this.#hasRecordedInitialProperties) {\n (this.constructor as typeof BaseElement).elementProperties.forEach((obj, prop: keyof typeof this & string) => {\n if (obj.reflect && this[prop] != null) {\n this.initialReflectedProperties.set(prop, this[prop]);\n }\n });\n\n this.#hasRecordedInitialProperties = true;\n }\n\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n protected willUpdate(changedProperties: Parameters<LitElement['willUpdate']>[0]): void {\n super.willUpdate(changedProperties);\n\n // Run the morph fixing *after* willUpdate.\n this.initialReflectedProperties.forEach((value, prop: string & keyof typeof this) => {\n // If a prop changes to `null`, we assume this happens via an attribute changing to `null`.\n\n if (changedProperties.has(prop) && this[prop] == null) {\n // Silly type gymnastics to appease the compiler.\n (this as Record<string, unknown>)[prop] = value;\n }\n });\n }\n\n /**\n * Methods for setting and checking custom states.\n */\n public customStates = {\n /** Adds or removes the specified custom state. */\n set: (customState: string, active: boolean) => {\n if (!this.internals?.states) return;\n if (active) {\n this.internals.states.add(customState);\n } else {\n this.internals.states.delete(customState);\n }\n },\n\n /** Determines whether or not the element currently has the specified state. */\n has: (customState: string) => {\n if (!this.internals?.states) return false;\n return this.internals.states.has(customState);\n },\n };\n\n /**\n * Given a native event, this function cancels it and dispatches it again from the host element using the desired\n * event options.\n */\n relayNativeEvent(event: Event, eventOptions?: EventInit) {\n event.stopImmediatePropagation();\n\n this.dispatchEvent(\n new (event.constructor as typeof Event)(event.type, {\n ...event,\n ...eventOptions,\n }),\n );\n }\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n :host {\n box-sizing: border-box !important;\n }\n\n :host *,\n :host *::before,\n :host *::after {\n box-sizing: inherit !important;\n }\n`;\n", "import type { Validator } from './form-associated-element';\n\n/**\n * This validator is for if you have an exact copy of your element in the shadow DOM. Rather than needing\n * custom translations and error messages, you can simply rely on the element \"formControl\" in your shadow dom.\n */\nexport const CustomErrorValidator = (): Validator => {\n return {\n observedAttributes: ['custom-error'],\n checkValidity(element) {\n const validity: ReturnType<Validator['checkValidity']> = {\n message: '',\n isValid: true,\n invalidKeys: [],\n };\n\n if (element.customError) {\n validity.message = element.customError;\n validity.isValid = false;\n validity.invalidKeys = ['customError'];\n }\n\n return validity;\n },\n };\n};\n", "export class WInvalidEvent extends Event {\n constructor() {\n super('w-invalid', { bubbles: true, cancelable: false, composed: true });\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'wa-invalid': WInvalidEvent;\n }\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n :host {\n color: var(--wa-form-control-value-color);\n display: inline-flex;\n flex-direction: row;\n align-items: top;\n font-family: inherit;\n font-weight: var(--wa-form-control-value-font-weight);\n line-height: var(--wa-form-control-value-line-height);\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n }\n\n :host(:focus) {\n outline: none;\n }\n\n [part~='label'] {\n display: inline;\n }\n\n [part~='hint'] {\n margin-block-start: 0.5em;\n }\n\n /* Default appearance */\n :host([appearance='default']) .control {\n flex: 0 0 auto;\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--wa-form-control-toggle-size, 2rem);\n height: var(--wa-form-control-toggle-size, 2rem);\n border-color: var(--wa-form-control-border-color, gray);\n border-radius: 50%;\n border-style: var(--wa-form-control-border-style, solid);\n border-width: var(--wa-form-control-border-width, 1px);\n background-color: var(--wa-form-control-background-color, white);\n color: transparent;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n\n margin-inline-end: 0.5em;\n }\n\n :host([appearance='clickable']) .control {\n position: absolute;\n inset: 0;\n height: 100%;\n width: 100%;\n cursor: pointer;\n }\n\n /* Checked */\n :host(:state(checked)):not(:host([appearance='clickable'])) .control {\n /* color: var(--checked-icon-color, white); */\n border-color: var(--wa-form-control-activated-color, blue);\n background-color: var(--wa-form-control-background-color, white);\n border-width: 0.6rem;\n }\n\n /* Focus */\n :host(:focus-visible) .control {\n outline: 2px solid var(--w-s-color-border-focus);\n outline-offset: var(--w-outline-offset, 1px);\n }\n\n :host([appearance='clickable']:focus-visible) .control {\n outline-offset: -4px;\n border-radius: 8px;\n }\n\n /* Disabled */\n :host(:state(disabled)) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Button appearance */\n :host([appearance='button']) {\n align-items: center;\n min-height: var(--wa-form-control-height);\n background-color: var(--wa-color-surface-default);\n border: var(--wa-form-control-border-width) var(--wa-form-control-border-style) var(--wa-form-control-border-color);\n border-radius: var(--wa-border-radius-m);\n padding: 0 var(--wa-form-control-padding-inline);\n transition:\n background-color var(--wa-transition-fast),\n border-color var(--wa-transition-fast);\n }\n\n :host([appearance='button']) .control {\n display: none;\n }\n\n /* Horizontal grouping - remove inner border radius */\n :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-inner]) {\n border-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-first]) {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-last]) {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n\n /* Vertical grouping - remove inner border radius */\n :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-inner]) {\n border-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-first]) {\n border-end-start-radius: 0;\n border-end-end-radius: 0;\n }\n\n :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-last]) {\n border-start-start-radius: 0;\n border-start-end-radius: 0;\n }\n\n @media (hover: hover) {\n :host([appearance='button']:hover:not(:state(disabled), :state(checked))) {\n background-color: color-mix(in srgb, var(--wa-color-surface-default) 95%, var(--wa-color-mix-hover));\n }\n }\n\n :host([appearance='button']:focus-visible) {\n outline: var(--wa-focus-ring);\n outline-offset: var(--wa-focus-ring-offset);\n }\n\n :host([appearance='button']:state(checked)) {\n border-color: var(--wa-form-control-activated-color);\n background-color: var(--wa-color-brand-fill-quiet);\n }\n\n :host([appearance='button']:state(checked):focus-visible) {\n outline: var(--wa-focus-ring-style) var(--wa-focus-ring-width) var(--wa-color-brand-border-loud);\n outline-offset: var(--wa-focus-ring-offset);\n }\n\n /* Remove inner borders and handle overlap */\n :host([appearance='button'][data-wa-radio-horizontal]:not([data-wa-radio-first])) {\n margin-inline-start: calc(-1 * var(--wa-form-control-border-width));\n }\n\n :host([appearance='button'][data-wa-radio-vertical]:not([data-wa-radio-first])) {\n margin-block-start: calc(-1 * var(--wa-form-control-border-width));\n }\n\n /* Ensure interactive states are visible above adjacent buttons */\n :host([appearance='button']:hover),\n :host([appearance='button']:state(checked)) {\n position: relative;\n z-index: 1;\n }\n\n :host([appearance='button']:focus-visible) {\n z-index: 2;\n }\n`;\n", "import type { PropertyValues } from 'lit';\nimport { html } from 'lit';\n\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { BaseFormAssociatedElement } from './form-associated-element';\nimport { uniqueId } from './math';\nimport './radio';\nimport type { WRadio } from './radio';\n// eslint-disable-next-line\n// @ts-ignore\nimport { styles } from './radio-group-styles';\nimport { RequiredValidator } from './required-validator';\nimport { HasSlotController } from './slot';\n\n/**\n * @slot label - Alternative to the `label` attribute should you need custom HTML.\n */\nexport class WRadioGroup extends BaseFormAssociatedElement {\n static css = [styles];\n\n static get validators() {\n const validators = [\n RequiredValidator({\n validationElement: Object.assign(document.createElement('input'), {\n required: true,\n type: 'radio',\n // we need an id that's guaranteed to be unique; users will never see this\n name: uniqueId('__w-radio'),\n }),\n }),\n ];\n return [...super.validators, ...validators];\n }\n\n private readonly hasSlotController = new HasSlotController(this, 'hint', 'label');\n\n @state() hasRadioButtons = false;\n\n @query('slot:not([name])') defaultSlot: HTMLSlotElement;\n\n /**\n * The radio group's label. Required for proper accessibility. If you need to display HTML, use the `label` slot\n * instead.\n */\n @property() label = '';\n\n /** The radio groups's hint. If you need to display HTML, use the `hint` slot instead. */\n @property({ attribute: 'hint' }) hint = '';\n\n /** The name of the radio group, submitted as a name/value pair with form data. */\n @property({ reflect: true }) name: string | null = null;\n\n /** Disables the radio group and all child radios. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** The orientation in which to show radio items. */\n @property({ reflect: true }) orientation: 'horizontal' | 'vertical' = 'vertical';\n\n private _value: string | null = null;\n\n get value() {\n if (this.valueHasChanged) {\n return this._value;\n }\n\n return this._value ?? this.defaultValue;\n }\n\n /** The current value of the radio group, submitted as a name/value pair with form data. */\n @state()\n set value(val: string | number | null) {\n if (typeof val === 'number') val = String(val);\n this.valueHasChanged = true;\n this._value = val;\n }\n\n /** The default value of the form control. Primarily used for resetting the form control. */\n @property({ attribute: 'value', reflect: true }) defaultValue: string | null = this.getAttribute('value') || null;\n\n /** The radio group's size. This size will be applied to all child radios and radio buttons, except when explicitly overridden. */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Ensures a child radio is checked before allowing the containing form to submit. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /**\n * Used for SSR. if true, will show slotted label on initial render.\n */\n @property({ type: Boolean, attribute: 'with-label' }) withLabel = false;\n\n /**\n * Used for SSR. if true, will show slotted hint on initial render.\n */\n @property({ type: Boolean, attribute: 'with-hint' }) withHint = false;\n\n //\n // We need this because if we don't have it, FormValidation yells at us that it's \"not focusable\".\n // If we use `this.tabIndex = -1` we can't focus the radio inside.\n //\n static shadowRootOptions = { ...BaseFormAssociatedElement.shadowRootOptions, delegatesFocus: true };\n\n constructor() {\n super();\n this.addEventListener('keydown', this.handleKeyDown);\n this.addEventListener('click', this.handleRadioClick);\n }\n\n /**\n * We use the first available radio as the validationTarget similar to native HTML that shows the validation popup on\n * the first radio element.\n */\n get validationTarget() {\n const radio = this.querySelector<WRadio>(':is(w-radio):not([disabled])');\n if (!radio) return undefined;\n\n return radio;\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('disabled') || changedProperties.has('value')) {\n this.syncRadioElements();\n }\n }\n\n formResetCallback(...args: Parameters<BaseFormAssociatedElement['formResetCallback']>) {\n this.value = this.defaultValue;\n\n super.formResetCallback(...args);\n\n this.syncRadioElements();\n }\n\n private handleRadioClick = (e: Event) => {\n const clickedRadio = (e.target as HTMLElement).closest<WRadio>('w-radio');\n /* eslint-disable */\n if (!clickedRadio || clickedRadio.disabled || (clickedRadio as any).forceDisabled || this.disabled) {\n return;\n }\n\n const oldValue = this.value;\n this.value = clickedRadio.value;\n clickedRadio.checked = true;\n\n const radios = this.getAllRadios();\n for (const radio of radios) {\n if (clickedRadio === radio) {\n continue;\n }\n\n radio.checked = false;\n radio.setAttribute('tabindex', '-1');\n }\n\n if (this.value !== oldValue) {\n this.updateComplete.then(() => {\n this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n });\n }\n };\n\n private getAllRadios() {\n return [...this.querySelectorAll<WRadio>('w-radio')];\n }\n\n private handleLabelClick() {\n this.focus();\n }\n\n private async syncRadioElements() {\n const radios = this.getAllRadios();\n let hasRadioButtons = false;\n\n // Add data attributes to support styling\n radios.forEach((radio, index) => {\n if (radio.appearance === 'button') hasRadioButtons = true;\n radio.setAttribute('size', this.size);\n radio.toggleAttribute('data-w-radio-horizontal', this.orientation !== 'vertical');\n radio.toggleAttribute('data-w-radio-vertical', this.orientation === 'vertical');\n radio.toggleAttribute('data-w-radio-first', index === 0);\n radio.toggleAttribute('data-w-radio-inner', index !== 0 && index !== radios.length - 1);\n radio.toggleAttribute('data-w-radio-last', index === radios.length - 1);\n\n // Set forceDisabled state based on radio group's disabled state\n (radio as WRadio).forceDisabled = this.disabled;\n });\n\n // If at least one radio button exists, we assume it's a radio button group\n this.hasRadioButtons = hasRadioButtons;\n\n await Promise.all(\n radios.map(async (radio) => {\n await radio.updateComplete;\n\n if (!radio.disabled && radio.value === this.value) {\n radio.checked = true;\n } else {\n radio.checked = false;\n }\n }),\n );\n\n // Manage tabIndex based on disabled state and checked status\n if (this.disabled) {\n // If radio group is disabled, all radios should not be tabbable\n radios.forEach((radio) => {\n radio.tabIndex = -1;\n });\n } else {\n // Normal tabbing behavior\n const enabledRadios = radios.filter((radio) => !radio.disabled);\n const checkedRadio = enabledRadios.find((radio) => radio.checked);\n\n if (enabledRadios.length > 0) {\n if (checkedRadio) {\n // If there's a checked radio, it should be tabbable\n enabledRadios.forEach((radio) => {\n radio.tabIndex = radio.checked ? 0 : -1;\n });\n } else {\n // If no radio is checked, first enabled radio should be tabbable\n enabledRadios.forEach((radio, index) => {\n radio.tabIndex = index === 0 ? 0 : -1;\n });\n }\n }\n\n // Disabled radios should never be tabbable\n radios\n .filter((radio) => radio.disabled)\n .forEach((radio) => {\n radio.tabIndex = -1;\n });\n }\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', ' '].includes(event.key) || this.disabled) {\n return;\n }\n\n const radios = this.getAllRadios().filter((radio) => !radio.disabled);\n\n if (radios.length <= 0) {\n return;\n }\n\n event.preventDefault();\n\n const oldValue = this.value;\n\n const checkedRadio = radios.find((radio) => radio.checked) ?? radios[0];\n const incr = event.key === ' ' ? 0 : ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1;\n let index = radios.indexOf(checkedRadio) + incr;\n\n if (!index) index = 0;\n\n if (index < 0) {\n index = radios.length - 1;\n }\n\n if (index > radios.length - 1) {\n index = 0;\n }\n\n const hasRadioButtons = radios.some((radio) => radio.tagName.toLowerCase() === 'w-radio-button');\n\n this.getAllRadios().forEach((radio) => {\n radio.checked = false;\n\n if (!hasRadioButtons) {\n radio.setAttribute('tabindex', '-1');\n }\n });\n\n this.value = radios[index].value;\n radios[index].checked = true;\n\n if (!hasRadioButtons) {\n radios[index].setAttribute('tabindex', '0');\n radios[index].focus();\n } else {\n radios[index].shadowRoot?.querySelector('button')?.focus();\n }\n\n if (this.value !== oldValue) {\n this.updateComplete.then(() => {\n this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n });\n }\n\n event.preventDefault();\n }\n\n /** Sets focus on the radio group. */\n public focus(options?: FocusOptions) {\n if (this.disabled) return;\n\n const radios = this.getAllRadios();\n const checked = radios.find((radio) => radio.checked);\n const firstEnabledRadio = radios.find((radio) => !radio.disabled);\n const radioToFocus = checked || firstEnabledRadio;\n\n // Call focus for the checked radio. If no radio is checked, focus the first one that isn't disabled.\n if (radioToFocus) {\n radioToFocus.focus(options);\n }\n }\n\n render() {\n const hasLabelSlot = this.hasUpdated ? this.hasSlotController.test('label') : this.withLabel;\n const hasHintSlot = this.hasUpdated ? this.hasSlotController.test('hint') : this.withHint;\n const hasLabel = this.label ? true : !!hasLabelSlot;\n const hasHint = this.hint ? true : !!hasHintSlot;\n\n return html`\n <fieldset\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control-radio-group': true,\n 'form-control-has-label': hasLabel,\n 'has-radio-buttons': this.hasRadioButtons,\n })}\n role=\"radiogroup\"\n aria-labelledby=\"label\"\n aria-describedby=\"hint\"\n aria-errormessage=\"error-message\"\n aria-orientation=${this.orientation}>\n <label\n part=\"form-control-label\"\n id=\"label\"\n class=\"label\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n @click=${this.handleLabelClick}>\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <slot part=\"form-control-input\" @slotchange=${this.syncRadioElements}></slot>\n\n <slot\n id=\"hint\"\n name=\"hint\"\n part=\"hint\"\n class=${classMap({\n 'has-slotted': hasHint,\n })}\n aria-hidden=${hasHint ? 'false' : 'true'}\n >${this.hint}</slot\n >\n </fieldset>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'w-radio-group': WRadioGroup;\n }\n}\n", "export const urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n", "/* @ts-self-types=\"./index.d.ts\" */\nimport { urlAlphabet as scopedUrlAlphabet } from './url-alphabet/index.js'\nexport { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << Math.log2(alphabet.length - 1)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step | 0\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length >= size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size | 0, random)\nexport let nanoid = (size = 21) => {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))\n while (size--) {\n id += scopedUrlAlphabet[bytes[size] & 63]\n }\n return id\n}\n", "import { nanoid } from 'nanoid';\n\nexport function uniqueId(prefix = '') {\n return `${prefix}${nanoid()}`;\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n :host {\n display: block;\n }\n\n .form-control {\n position: relative;\n border: none;\n padding: 0;\n margin: 0;\n }\n\n .label {\n font-size: var(--w-font-size-s);\n line-height: var(--w-line-height-s);\n font-weight: 700;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n font-smoothing: grayscale;\n cursor: pointer;\n padding-bottom: 0.4rem;\n color: var(--w-s-color-text);\n display: block;\n }\n\n .radio-group-required .label::after {\n content: var(--wa-form-control-required-content);\n margin-inline-start: var(--wa-form-control-required-content-offset);\n }\n\n .button-group {\n display: flex;\n }\n\n [part~='form-control-input'] {\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n gap: 0.75em;\n }\n\n /* Horizontal */\n :host([orientation='horizontal']) [part~='form-control-input'] {\n flex-direction: row;\n gap: 1em;\n }\n\n /* Help text */\n [part~='hint'] {\n margin-block-start: 0.5em;\n }\n\n /* Radios have the \"button\" appearance */\n :host fieldset.has-radio-buttons {\n [part~='form-control-input'] {\n gap: 0;\n }\n }\n`;\n", "import type { Validator } from './form-associated-element';\n\nexport interface RequiredValidatorOptions {\n /** This is a cheap way for us to get translation strings for the user without having proper translations. */\n validationElement?: HTMLSelectElement | HTMLInputElement;\n\n /**\n * The property to check if its not null-ish. For most elements this will be \"value\".\n * For \"checkbox\" for example it will be \"checked\"\n */\n validationProperty?: string;\n}\n\nexport const RequiredValidator = (options: RequiredValidatorOptions = {}): Validator => {\n let { validationElement, validationProperty } = options;\n\n if (!validationElement) {\n validationElement = Object.assign(document.createElement('input'), { required: true });\n }\n\n if (!validationProperty) {\n validationProperty = 'value';\n }\n\n const obj: Validator = {\n observedAttributes: ['required'],\n message: validationElement.validationMessage, // @TODO: Add a translation.\n checkValidity(element) {\n const validity: ReturnType<Validator['checkValidity']> = {\n message: '',\n isValid: true,\n invalidKeys: [],\n };\n\n const isRequired = element.required ?? element.hasAttribute('required');\n\n // Always true if the element isn't required.\n if (!isRequired) {\n return validity;\n }\n\n const value = element[validationProperty as keyof typeof element];\n\n const isEmpty = !value;\n\n if (isEmpty) {\n validity.message = typeof obj.message === 'function' ? obj.message(element) : obj.message || '';\n validity.isValid = false;\n validity.invalidKeys.push('valueMissing');\n }\n\n return validity;\n },\n };\n\n return obj;\n};\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/** A reactive controller that determines when slots exist. */\nexport class HasSlotController implements ReactiveController {\n host: ReactiveControllerHost & Element;\n slotNames: string[] = [];\n\n constructor(host: ReactiveControllerHost & Element, ...slotNames: string[]) {\n (this.host = host).addController(this);\n this.slotNames = slotNames;\n }\n\n private hasDefaultSlot() {\n return [...this.host.childNodes].some((node) => {\n if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim() !== '') {\n return true;\n }\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n const el = node as HTMLElement;\n const tagName = el.tagName.toLowerCase();\n\n // Ignore visually hidden elements since they aren't rendered\n if (tagName === 'w-visually-hidden') {\n return false;\n }\n\n // If it doesn't have a slot attribute, it's part of the default slot\n if (!el.hasAttribute('slot')) {\n return true;\n }\n }\n\n return false;\n });\n }\n\n private hasNamedSlot(name: string) {\n return this.host.querySelector(`:scope > [slot=\"${name}\"]`) !== null;\n }\n\n test(slotName: string) {\n return slotName === '[default]' ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);\n }\n\n hostConnected() {\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n }\n\n hostDisconnected() {\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n }\n\n private handleSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n\n if ((this.slotNames.includes('[default]') && !slot.name) || (slot.name && this.slotNames.includes(slot.name))) {\n this.host.requestUpdate();\n }\n };\n}\n\n/**\n * Given a list of nodes, this function iterates over all of them and returns the concatenated\n * HTML as a string. This is useful for getting the HTML that corresponds to a slot\u2019s assigned nodes (since we can't use slot.innerHTML as an alternative).\n * @param nodes - The list of nodes to iterate over.\n * @param callback - A function that can be used to customize the HTML output for specific types of nodes. If the function returns undefined, the default HTML output will be used.\n */\nexport function getInnerHTML(nodes: Iterable<Node>, callback?: (node: Node) => string | undefined): string {\n let html = '';\n\n for (const node of nodes) {\n if (callback) {\n const customHTML = callback(node);\n\n if (customHTML !== undefined) {\n html += customHTML;\n continue;\n }\n }\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n html += (node as HTMLElement).outerHTML;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n html += node.textContent;\n }\n }\n\n return html;\n}\n", "import { WRadio } from './radio';\nimport { WRadioGroup } from './radio-group';\n\nif (!customElements.get('w-radio')) {\n customElements.define('w-radio', WRadio);\n customElements.define('w-radio-group', WRadioGroup);\n}\n"],
|
|
5
|
+
"mappings": "mhBACA,OAAS,QAAAA,MAAY,MCArB,OAAS,QAAAC,MAAY,MAErB,OAAS,YAAAC,EAAU,SAAAC,MAAa,oBCHhC,OAAS,YAAAC,MAA4B,MAErC,OAAS,YAAAC,MAAgB,oBCCzB,OAAS,cAAAC,EAAY,aAAAC,MAAiB,MAEtC,OAAS,YAAAC,MAAgB,oBCLzB,OAAS,OAAAC,MAAW,MAEb,IAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EDFtB,IAAAE,EAsBqBC,EAArB,cAAyCC,CAAW,CAyBlD,aAAc,CACZ,MAAM,EATRC,EAAA,KAAAH,EAAgC,IAChC,gCAAmD,IAAI,IA2DvD,KAAO,aAAe,CAEpB,IAAK,CAACI,EAAqBC,IAAoB,CArGnD,IAAAC,GAsGWA,EAAA,KAAK,YAAL,MAAAA,EAAgB,SACjBD,EACF,KAAK,UAAU,OAAO,IAAID,CAAW,EAErC,KAAK,UAAU,OAAO,OAAOA,CAAW,EAE5C,EAGA,IAAMA,GAAwB,CA/GlC,IAAAE,EAgH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AAW,MAAO,CAAC,GA9BpBrC,EA8BsB,oBAGJkC,EAAA,CAA5BG,EAAS,CAAE,QAAS,EAAK,CAAC,GAjChBrC,EAiCkB,oBAGekC,EAAA,CAA3CG,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GApC/BrC,EAoCiC,wBAGfkC,EAAA,CAA5BG,EAAS,CAAE,QAAS,EAAK,CAAC,GAvChBrC,EAuCkB,2BAczBkC,EAAA,CADHC,EAAM,GApDInC,EAqDP,qBAO6CkC,EAAA,CAAhDG,EAAS,CAAE,UAAW,QAAS,QAAS,EAAK,CAAC,GA5DpCrC,EA4DsC,4BAGpBkC,EAAA,CAA5BG,EAAS,CAAE,QAAS,EAAK,CAAC,GA/DhBrC,EA+DkB,oBAGekC,EAAA,CAA3CG,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAlE/BrC,EAkEiC,wBAKUkC,EAAA,CAArDG,EAAS,CAAE,KAAM,QAAS,UAAW,YAAa,CAAC,GAvEzCrC,EAuE2C,yBAKDkC,EAAA,CAApDG,EAAS,CAAE,KAAM,QAAS,UAAW,WAAY,CAAC,GA5ExCrC,EA4E0C,wBO5FlD,eAAe,IAAI,SAAS,IAC/B,eAAe,OAAO,UAAWsC,CAAM,EACvC,eAAe,OAAO,gBAAiBC,CAAW,GfDpD,IAAOC,GAAQ,CACb,MAAO,cACP,OAAQ,IACCC;AAAA;AAAA;AAAA;AAAA;AAAA,KAOX,EAEaC,GAAoB,CAAC",
|
|
6
|
+
"names": ["html", "html", "property", "state", "isServer", "property", "LitElement", "unsafeCSS", "property", "css", "styles", "_hasRecordedInitialProperties", "BaseElement", "LitElement", "__privateAdd", "customState", "active", "_a", "Self", "property", "spec", "styles", "style", "unsafeCSS", "name", "oldValue", "newValue", "__privateGet", "obj", "prop", "__privateSet", "changedProperties", "value", "event", "eventOptions", "__decorateClass", "CustomErrorValidator", "element", "validity", "WInvalidEvent", "BaseFormAssociatedElement", "BaseElement", "e", "WInvalidEvent", "event", "_a", "emittedEvents", "isServer", "CustomErrorValidator", "parentAttrs", "validator", "attr", "args", "changedProperties", "value", "formData", "val", "flags", "message", "anchor", "required", "isValid", "hasInteracted", "isDisabled", "state", "reason", "staticValidators", "validators", "formControl", "finalMessage", "invalidKeys", "str", "__decorateClass", "property", "css", "styles", "WRadio", "BaseFormAssociatedElement", "changedProperties", "effectivelyDisabled", "html", "styles", "__decorateClass", "state", "property", "html", "property", "query", "state", "classMap", "urlAlphabet", "nanoid", "size", "id", "bytes", "urlAlphabet", "uniqueId", "prefix", "nanoid", "css", "styles", "RequiredValidator", "options", "validationElement", "validationProperty", "obj", "element", "_a", "validity", "HasSlotController", "host", "slotNames", "event", "slot", "node", "_a", "el", "name", "slotName", "WRadioGroup", "BaseFormAssociatedElement", "HasSlotController", "e", "clickedRadio", "oldValue", "radios", "radio", "validators", "RequiredValidator", "uniqueId", "_a", "val", "changedProperties", "args", "hasRadioButtons", "index", "enabledRadios", "checkedRadio", "event", "_b", "_c", "incr", "options", "checked", "firstEnabledRadio", "radioToFocus", "hasLabelSlot", "hasHintSlot", "hasLabel", "hasHint", "html", "classMap", "styles", "__decorateClass", "state", "query", "property", "WRadio", "WRadioGroup", "radio_stories_default", "html", "Default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WRadio } from './radio';
|
|
2
|
+
import { WRadioGroup } from './radio-group';
|
|
3
|
+
export declare const Radio: import("@lit/react").ReactWebComponent<WRadio, {}>;
|
|
4
|
+
export declare const RadioGroup: import("@lit/react").ReactWebComponent<WRadioGroup, {
|
|
5
|
+
onInput: string;
|
|
6
|
+
oninput: string;
|
|
7
|
+
onChange: string;
|
|
8
|
+
onchange: string;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createComponent } from '@lit/react';
|
|
4
|
+
// decouple from CDN by providing a dummy class
|
|
5
|
+
class Component extends LitElement {
|
|
6
|
+
}
|
|
7
|
+
export const Radio = createComponent({
|
|
8
|
+
tagName: 'w-radio',
|
|
9
|
+
elementClass: Component,
|
|
10
|
+
react: React,
|
|
11
|
+
});
|
|
12
|
+
export const RadioGroup = createComponent({
|
|
13
|
+
tagName: 'w-radio-group',
|
|
14
|
+
elementClass: Component,
|
|
15
|
+
react: React,
|
|
16
|
+
events: {
|
|
17
|
+
onInput: 'input',
|
|
18
|
+
oninput: 'input',
|
|
19
|
+
onChange: 'change',
|
|
20
|
+
onchange: 'change',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { Radio } from './react';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import("@lit/react").ReactWebComponent<import("./radio").WRadio, {}>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export type Story = StoryObj<typeof Radio>;
|
|
9
|
+
export declare const Primary: Story;
|
|
@@ -13,7 +13,7 @@ export class HasSlotController {
|
|
|
13
13
|
}
|
|
14
14
|
hasDefaultSlot() {
|
|
15
15
|
return [...this.host.childNodes].some((node) => {
|
|
16
|
-
if (node.nodeType === Node.TEXT_NODE && node.textContent
|
|
16
|
+
if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim() !== '') {
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
19
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -38,10 +38,10 @@ export class HasSlotController {
|
|
|
38
38
|
return slotName === '[default]' ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);
|
|
39
39
|
}
|
|
40
40
|
hostConnected() {
|
|
41
|
-
this.host.shadowRoot
|
|
41
|
+
this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);
|
|
42
42
|
}
|
|
43
43
|
hostDisconnected() {
|
|
44
|
-
this.host.shadowRoot
|
|
44
|
+
this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import '@warp-ds/icons/elements/chevron-down-16';
|
|
3
3
|
export declare const ccSelect: {
|
|
4
4
|
base: string;
|
|
@@ -45,18 +45,18 @@ export declare class WarpSelect extends WarpSelect_base {
|
|
|
45
45
|
/** Renders the field in a readonly state. */
|
|
46
46
|
readOnly: boolean;
|
|
47
47
|
/** @internal */
|
|
48
|
-
_options:
|
|
48
|
+
_options: Array<TemplateResult>;
|
|
49
49
|
name: string;
|
|
50
50
|
value: string;
|
|
51
51
|
static styles: import("lit").CSSResult[];
|
|
52
52
|
constructor();
|
|
53
53
|
/** @internal */
|
|
54
54
|
_setValue: (value: string) => void;
|
|
55
|
-
|
|
55
|
+
connectedCallback(): void;
|
|
56
56
|
handleKeyDown(event: KeyboardEvent): void;
|
|
57
57
|
onChange({ target }: {
|
|
58
58
|
target: any;
|
|
59
59
|
}): void;
|
|
60
|
-
render():
|
|
60
|
+
render(): TemplateResult<1>;
|
|
61
61
|
}
|
|
62
62
|
export {};
|