@warp-ds/elements 2.9.1 → 2.10.0-next.1

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.
Files changed (97) hide show
  1. package/dist/custom-elements.json +347 -284
  2. package/dist/docs/button/accessibility.md +42 -0
  3. package/dist/docs/button/api.md +63 -39
  4. package/dist/docs/button/button.md +322 -40
  5. package/dist/docs/button/examples.md +126 -0
  6. package/dist/docs/button/usage.md +89 -0
  7. package/dist/docs/modal/accessibility.md +1 -0
  8. package/dist/docs/modal/api.md +51 -0
  9. package/dist/docs/modal/examples.md +67 -0
  10. package/dist/docs/modal/modal.md +238 -0
  11. package/dist/docs/modal/usage.md +110 -0
  12. package/dist/docs/modal-footer/accessibility.md +1 -0
  13. package/dist/docs/modal-footer/api.md +11 -0
  14. package/dist/docs/modal-footer/examples.md +1 -0
  15. package/dist/docs/modal-footer/modal-footer.md +23 -0
  16. package/dist/docs/modal-footer/usage.md +1 -0
  17. package/dist/docs/modal-header/accessibility.md +1 -0
  18. package/dist/docs/modal-header/api.md +42 -0
  19. package/dist/docs/modal-header/examples.md +1 -0
  20. package/dist/docs/modal-header/modal-header.md +54 -0
  21. package/dist/docs/modal-header/usage.md +1 -0
  22. package/dist/docs/page-indicator/api.md +6 -6
  23. package/dist/docs/page-indicator/examples.md +8 -0
  24. package/dist/docs/page-indicator/page-indicator.md +23 -6
  25. package/dist/docs/page-indicator/usage.md +8 -0
  26. package/dist/docs/pagination/api.md +12 -10
  27. package/dist/docs/pagination/examples.md +20 -0
  28. package/dist/docs/pagination/pagination.md +50 -12
  29. package/dist/docs/pagination/usage.md +18 -0
  30. package/dist/docs/pill/accessibility.md +2 -0
  31. package/dist/docs/pill/api.md +10 -26
  32. package/dist/docs/pill/examples.md +23 -0
  33. package/dist/docs/pill/pill.md +43 -28
  34. package/dist/docs/pill/usage.md +8 -0
  35. package/dist/docs/radio/accessibility.md +1 -0
  36. package/dist/docs/radio/api.md +57 -0
  37. package/dist/docs/radio/examples.md +1 -0
  38. package/dist/docs/radio/radio.md +69 -0
  39. package/dist/docs/radio/usage.md +1 -0
  40. package/dist/docs/radio-group/accessibility.md +1 -0
  41. package/dist/docs/radio-group/api.md +69 -0
  42. package/dist/docs/radio-group/examples.md +68 -0
  43. package/dist/docs/radio-group/radio-group.md +311 -0
  44. package/dist/docs/radio-group/styling.md +118 -0
  45. package/dist/docs/radio-group/usage.md +44 -0
  46. package/dist/docs/select/accessibility.md +2 -0
  47. package/dist/docs/select/api.md +20 -16
  48. package/dist/docs/select/examples.md +116 -0
  49. package/dist/docs/select/select.md +168 -18
  50. package/dist/docs/select/usage.md +30 -0
  51. package/dist/index.d.ts +441 -474
  52. package/dist/packages/attention/attention.js +23 -21
  53. package/dist/packages/attention/attention.js.map +3 -3
  54. package/dist/packages/button/button.d.ts +54 -37
  55. package/dist/packages/button/button.js +17 -15
  56. package/dist/packages/button/button.js.map +3 -3
  57. package/dist/packages/button/button.react.stories.d.ts +2 -2
  58. package/dist/packages/button/react.d.ts +1 -1
  59. package/dist/packages/modal/index.d.ts +4 -4
  60. package/dist/packages/modal/index.js +4 -4
  61. package/dist/packages/modal/modal.d.ts +21 -12
  62. package/dist/packages/modal/modal.js +4 -4
  63. package/dist/packages/modal/modal.js.map +3 -3
  64. package/dist/packages/modal/modal.react.stories.d.ts +3 -3
  65. package/dist/packages/modal/modal.stories.d.ts +2 -1
  66. package/dist/packages/modal/modal.stories.js +85 -3
  67. package/dist/packages/modal/react.d.ts +2 -2
  68. package/dist/packages/modal-footer/modal-footer.d.ts +5 -3
  69. package/dist/packages/modal-footer/modal-footer.js +4 -4
  70. package/dist/packages/modal-footer/modal-footer.js.map +3 -3
  71. package/dist/packages/modal-footer/react.d.ts +1 -1
  72. package/dist/packages/modal-header/modal-header.d.ts +21 -11
  73. package/dist/packages/modal-header/modal-header.js +1 -1
  74. package/dist/packages/modal-header/modal-header.js.map +3 -3
  75. package/dist/packages/modal-header/react.d.ts +2 -2
  76. package/dist/packages/page-indicator/page-indicator.d.ts +9 -14
  77. package/dist/packages/page-indicator/page-indicator.js.map +2 -2
  78. package/dist/packages/pagination/pagination.d.ts +11 -11
  79. package/dist/packages/pagination/pagination.js.map +2 -2
  80. package/dist/packages/pill/pill.d.ts +14 -29
  81. package/dist/packages/pill/pill.js.map +2 -2
  82. package/dist/packages/pill/pill.react.stories.d.ts +2 -2
  83. package/dist/packages/pill/react.d.ts +1 -1
  84. package/dist/packages/radio/radio.d.ts +51 -13
  85. package/dist/packages/radio/radio.js +3 -3
  86. package/dist/packages/radio/radio.js.map +3 -3
  87. package/dist/packages/radio/radio.react.stories.d.ts +1 -1
  88. package/dist/packages/radio/radio.stories.d.ts +2 -2
  89. package/dist/packages/radio/react.d.ts +2 -2
  90. package/dist/packages/radio-group/radio-group.d.ts +43 -5
  91. package/dist/packages/radio-group/radio-group.js +7 -7
  92. package/dist/packages/radio-group/radio-group.js.map +3 -3
  93. package/dist/packages/radio-group/react.d.ts +4 -4
  94. package/dist/packages/select/select.d.ts +32 -48
  95. package/dist/packages/select/select.js.map +2 -2
  96. package/dist/web-types.json +349 -115
  97. package/package.json +5 -5
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { Pill } from './react';
4
4
  declare const _default: {
5
5
  title: string;
6
- render(args: Omit<Omit<Omit<React.HTMLAttributes<import("./pill").WarpPill>, "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onclick" | "onclose" | "render" | "renderOptions" | "onClick" | "canClose" | "onClose" | "suggestion" | "openSrLabel" | "openAriaLabel" | "closeSrLabel" | "closeAriaLabel" | "openFilterSrText" | "removeFilterSrText" | "_labelClasses" | "_closeClasses" | "_onClick" | "_onClose"> & {
6
+ render(args: Omit<Omit<Omit<React.HTMLAttributes<import("./pill").WarpPill>, "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onclick" | "onclose" | "render" | "renderOptions" | "onClick" | "canClose" | "onClose" | "suggestion" | "openSrLabel" | "openAriaLabel" | "closeSrLabel" | "closeAriaLabel"> & {
7
7
  onClick?: (e: Event) => void;
8
8
  onclick?: (e: Event) => void;
9
9
  onClose?: (e: Event) => void;
@@ -15,7 +15,7 @@ declare const _default: {
15
15
  closeSrLabel?: string;
16
16
  closeAriaLabel?: string;
17
17
  } & React.RefAttributes<import("./pill").WarpPill>): React.JSX.Element;
18
- component: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<import("./pill").WarpPill>, "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onclick" | "onclose" | "render" | "renderOptions" | "onClick" | "canClose" | "onClose" | "suggestion" | "openSrLabel" | "openAriaLabel" | "closeSrLabel" | "closeAriaLabel" | "openFilterSrText" | "removeFilterSrText" | "_labelClasses" | "_closeClasses" | "_onClick" | "_onClose"> & {
18
+ component: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<import("./pill").WarpPill>, "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onclick" | "onclose" | "render" | "renderOptions" | "onClick" | "canClose" | "onClose" | "suggestion" | "openSrLabel" | "openAriaLabel" | "closeSrLabel" | "closeAriaLabel"> & {
19
19
  onClick?: (e: Event) => void;
20
20
  onclick?: (e: Event) => void;
21
21
  onClose?: (e: Event) => void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { WarpPill } from './pill.js';
3
- export declare const Pill: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpPill>, "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onclick" | "onclose" | "render" | "renderOptions" | "onClick" | "canClose" | "onClose" | "suggestion" | "openSrLabel" | "openAriaLabel" | "closeSrLabel" | "closeAriaLabel" | "openFilterSrText" | "removeFilterSrText" | "_labelClasses" | "_closeClasses" | "_onClick" | "_onClose"> & {
3
+ export declare const Pill: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpPill>, "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onclick" | "onclose" | "render" | "renderOptions" | "onClick" | "canClose" | "onClose" | "suggestion" | "openSrLabel" | "openAriaLabel" | "closeSrLabel" | "closeAriaLabel"> & {
4
4
  onClick?: (e: Event) => void;
5
5
  onclick?: (e: Event) => void;
6
6
  onClose?: (e: Event) => void;
@@ -1,9 +1,13 @@
1
1
  import type { PropertyValues } from 'lit';
2
2
  import { LitElement } from 'lit';
3
- declare const WRadio_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & typeof LitElement;
4
- export declare class WRadio extends WRadio_base {
3
+ declare const WarpRadio_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & typeof LitElement;
4
+ /**
5
+ * @parent w-radio-group
6
+ */
7
+ export declare class WarpRadio extends WarpRadio_base {
5
8
  #private;
6
9
  static styles: import("lit").CSSResult[];
10
+ /** @internal */
7
11
  static shadowRootOptions: {
8
12
  delegatesFocus: boolean;
9
13
  clonable?: boolean;
@@ -12,17 +16,29 @@ export declare class WRadio extends WRadio_base {
12
16
  serializable?: boolean;
13
17
  slotAssignment?: SlotAssignmentMode;
14
18
  };
15
- /** The name of the radio, submitted as a name/value pair with form data. */
19
+ /**
20
+ * The name of the radio, submitted as a name/value pair with form data.
21
+ */
16
22
  name: string;
17
- /** The radio's value. When selected, the radio group will receive this value. */
23
+ /**
24
+ * The radio's value. When selected, the radio group will receive this value.
25
+ */
18
26
  value: string | null;
19
- /** Draws the radio in a checked state (reflected to attribute). */
27
+ /**
28
+ * Draws the radio in a checked state (reflected to attribute).
29
+ */
20
30
  checked: boolean;
21
- /** Disables the radio. */
31
+ /**
32
+ * Disables the radio.
33
+ */
22
34
  disabled: boolean;
23
- /** Makes the radio a required field. */
35
+ /**
36
+ * Makes the radio a required field.
37
+ */
24
38
  required: boolean;
25
- /** Draws the radio in an invalid state. */
39
+ /**
40
+ * Draws the radio in an invalid state.
41
+ */
26
42
  invalid: boolean;
27
43
  /**
28
44
  * Internal tabindex managed by parent radio-group.
@@ -33,11 +49,14 @@ export declare class WRadio extends WRadio_base {
33
49
  /**
34
50
  * Override tabIndex getter to return the computed internal tabIndex.
35
51
  * This allows external code to check if the radio is focusable.
52
+ * @internal
36
53
  */
37
54
  get tabIndex(): number;
38
55
  /**
39
56
  * Override tabIndex setter to set _groupTabIndex (for backwards compatibility).
40
57
  * Radio-group should use _groupTabIndex directly for clarity.
58
+ *
59
+ * @internal
41
60
  */
42
61
  set tabIndex(value: number);
43
62
  constructor();
@@ -49,14 +68,27 @@ export declare class WRadio extends WRadio_base {
49
68
  private handleClick;
50
69
  private handleInvalid;
51
70
  private handleKeyDown;
71
+ /** @internal */
52
72
  resetFormControl(): void;
53
- /** Returns the validation message if the radio is invalid, otherwise an empty string */
73
+ /**
74
+ * Returns the validation message if the radio is invalid, otherwise an empty string
75
+ * @internal
76
+ */
54
77
  get validationMessage(): string;
55
- /** Returns the validity state of the radio */
78
+ /**
79
+ * Returns the validity state of the radio
80
+ * @internal
81
+ */
56
82
  get validity(): ValidityState;
57
- /** Checks whether the radio passes constraint validation */
83
+ /**
84
+ * Checks whether the radio passes constraint validation
85
+ * @internal
86
+ */
58
87
  checkValidity(): boolean;
59
- /** Checks validity and shows the browser's validation message if invalid */
88
+ /**
89
+ * Checks validity and shows the browser's validation message if invalid
90
+ * @internal
91
+ */
60
92
  reportValidity(): boolean;
61
93
  private isInGroup;
62
94
  private getRadioScope;
@@ -70,6 +102,8 @@ export declare class WRadio extends WRadio_base {
70
102
  /**
71
103
  * Internal tabindex for standalone radios (not in a group).
72
104
  * Non-reflecting to avoid DOM changes during hydration.
105
+ *
106
+ * @internal
73
107
  */
74
108
  _standaloneTabIndex: number | undefined;
75
109
  protected firstUpdated(): void;
@@ -79,9 +113,13 @@ export declare class WRadio extends WRadio_base {
79
113
  private shouldSyncFormState;
80
114
  render(): import("lit").TemplateResult<1>;
81
115
  }
116
+ /**
117
+ * @deprecated Exported for backwards compatibility only, use `WarpRadio`
118
+ */
119
+ export declare const WRadio: typeof WarpRadio;
82
120
  declare global {
83
121
  interface HTMLElementTagNameMap {
84
- 'w-radio': WRadio;
122
+ 'w-radio': WarpRadio;
85
123
  }
86
124
  }
87
125
  export {};
@@ -1,4 +1,4 @@
1
- var ee=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var D=i=>{throw TypeError(i)};var f=(i,r,e,o)=>{for(var a=o>1?void 0:o?re(r,e):r,l=i.length-1,u;l>=0;l--)(u=i[l])&&(a=(o?u(r,e,a):u(a))||a);return o&&a&&ee(r,e,a),a};var N=(i,r,e)=>r.has(i)||D("Cannot "+e);var F=(i,r,e)=>(N(i,r,"read from private field"),e?e.call(i):r.get(i)),G=(i,r,e)=>r.has(i)?D("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),x=(i,r,e,o)=>(N(i,r,"write to private field"),o?o.call(i,e):r.set(i,e),e);var n=function(i,r,e,o){if(e==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!o:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?o:e==="a"?o.call(i):o?o.value:r.get(i)},c=function(i,r,e,o,a){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?i!==r||!a:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?a.call(i,e):a?a.value=e:r.set(i,e),e};function W(i){var r,e,o,a,l,u,h,q,z,g,m,X,Y,E,j,k,Z,L,O;class Q extends i{constructor(...t){var s,d,b;super(...t),r.add(this),this.internals=this.attachInternals(),e.set(this,!1),o.set(this,!1),a.set(this,!1),l.set(this,void 0),u.set(this,void 0),h.set(this,!0),z.set(this,""),g.set(this,()=>{c(this,a,!0,"f"),c(this,e,!0,"f"),n(this,r,"m",k).call(this)}),m.set(this,()=>{c(this,e,!1,"f"),n(this,r,"m",Z).call(this,this.shouldFormValueUpdate()?n(this,z,"f"):""),!this.validity.valid&&n(this,a,"f")&&c(this,o,!0,"f");let w=n(this,r,"m",k).call(this);this.validationMessageCallback&&this.validationMessageCallback(w?this.internals.validationMessage:"")}),X.set(this,()=>{var w;n(this,h,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),c(this,h,!1,"f")),c(this,a,!0,"f"),c(this,o,!0,"f"),n(this,r,"m",k).call(this),(w=this===null||this===void 0?void 0:this.validationMessageCallback)===null||w===void 0||w.call(this,this.showError?this.internals.validationMessage:"")}),Y.set(this,void 0),E.set(this,!1),j.set(this,Promise.resolve()),(s=this.addEventListener)===null||s===void 0||s.call(this,"focus",n(this,g,"f")),(d=this.addEventListener)===null||d===void 0||d.call(this,"blur",n(this,m,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"invalid",n(this,X,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let t=this.validators.map(b=>b.attribute).flat(),s=super.observedAttributes||[];return[...new Set([...s,...t])]}static getValidator(t){return this.validators.find(s=>s.attribute===t)||null}static getValidators(t){return this.validators.filter(s=>{var d;if(s.attribute===t||!((d=s.attribute)===null||d===void 0)&&d.includes(t))return!0})}get form(){return this.internals.form}get showError(){return n(this,r,"m",k).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(t,s,d){var b;(b=super.attributeChangedCallback)===null||b===void 0||b.call(this,t,s,d);let S=this.constructor.getValidators(t);S!=null&&S.length&&this.validationTarget&&this.setValue(n(this,z,"f"))}setValue(t){var s;c(this,o,!1,"f"),(s=this.validationMessageCallback)===null||s===void 0||s.call(this,""),c(this,z,t,"f");let b=this.shouldFormValueUpdate()?t:null;this.internals.setFormValue(b),n(this,r,"m",Z).call(this,b),this.valueChangedCallback&&this.valueChangedCallback(b),n(this,r,"m",k).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(t=>t(n(this,j,"f")))}formResetCallback(){var t,s;c(this,a,!1,"f"),c(this,o,!1,"f"),n(this,r,"m",k).call(this),(t=this.resetFormControl)===null||t===void 0||t.call(this),(s=this.validationMessageCallback)===null||s===void 0||s.call(this,n(this,r,"m",k).call(this)?this.validationMessage:"")}}return e=new WeakMap,o=new WeakMap,a=new WeakMap,l=new WeakMap,u=new WeakMap,h=new WeakMap,z=new WeakMap,g=new WeakMap,m=new WeakMap,X=new WeakMap,Y=new WeakMap,E=new WeakMap,j=new WeakMap,r=new WeakSet,q=function(){let t=this.getRootNode(),s=`${this.localName}[name="${this.getAttribute("name")}"]`;return t.querySelectorAll(s)},k=function(){if(this.hasAttribute("disabled"))return!1;let t=n(this,o,"f")||n(this,a,"f")&&!this.validity.valid&&!n(this,e,"f");return t&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),t},Z=function(t){let s=this.constructor,d={},b=s.validators,w=[],S=b.some(v=>v.isValid instanceof Promise);n(this,E,"f")||(c(this,j,new Promise(v=>{c(this,Y,v,"f")}),"f"),c(this,E,!0,"f")),n(this,l,"f")&&(n(this,l,"f").abort(),c(this,u,n(this,l,"f"),"f"));let I=new AbortController;c(this,l,I,"f");let A,U=!1;b.length&&(b.forEach(v=>{let P=v.key||"customError",V=v.isValid(this,t,I.signal);V instanceof Promise?(w.push(V),V.then(R=>{R!=null&&(d[P]=!R,A=n(this,r,"m",O).call(this,v,t),n(this,r,"m",L).call(this,d,A))})):(d[P]=!V,this.validity[P]!==!V&&(U=!0),!V&&!A&&(A=n(this,r,"m",O).call(this,v,t)))}),Promise.allSettled(w).then(()=>{var v;I!=null&&I.signal.aborted||(c(this,E,!1,"f"),(v=n(this,Y,"f"))===null||v===void 0||v.call(this))}),(U||!S)&&n(this,r,"m",L).call(this,d,A))},L=function(t,s){if(this.validationTarget)this.internals.setValidity(t,s,this.validationTarget),c(this,h,!1,"f");else{if(this.internals.setValidity(t,s),this.internals.validity.valid)return;c(this,h,!0,"f")}},O=function(t,s){if(this.validityCallback){let d=this.validityCallback(t.key||"customError");if(d)return d}return t.message instanceof Function?t.message(this,s):t.message},Q}import{html as ae,LitElement as J}from"lit";import{property as y}from"lit/decorators.js";import{css as B}from"lit";var $=B`
1
+ var ee=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var W=i=>{throw TypeError(i)};var f=(i,r,e,o)=>{for(var a=o>1?void 0:o?re(r,e):r,l=i.length-1,u;l>=0;l--)(u=i[l])&&(a=(o?u(r,e,a):u(a))||a);return o&&a&&ee(r,e,a),a};var D=(i,r,e)=>r.has(i)||W("Cannot "+e);var F=(i,r,e)=>(D(i,r,"read from private field"),e?e.call(i):r.get(i)),G=(i,r,e)=>r.has(i)?W("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),x=(i,r,e,o)=>(D(i,r,"write to private field"),o?o.call(i,e):r.set(i,e),e);var n=function(i,r,e,o){if(e==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!o:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?o:e==="a"?o.call(i):o?o.value:r.get(i)},c=function(i,r,e,o,a){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?i!==r||!a:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?a.call(i,e):a?a.value=e:r.set(i,e),e};function N(i){var r,e,o,a,l,u,h,q,z,g,m,X,Y,E,j,k,R,Z,L;class Q extends i{constructor(...t){var s,d,b;super(...t),r.add(this),this.internals=this.attachInternals(),e.set(this,!1),o.set(this,!1),a.set(this,!1),l.set(this,void 0),u.set(this,void 0),h.set(this,!0),z.set(this,""),g.set(this,()=>{c(this,a,!0,"f"),c(this,e,!0,"f"),n(this,r,"m",k).call(this)}),m.set(this,()=>{c(this,e,!1,"f"),n(this,r,"m",R).call(this,this.shouldFormValueUpdate()?n(this,z,"f"):""),!this.validity.valid&&n(this,a,"f")&&c(this,o,!0,"f");let w=n(this,r,"m",k).call(this);this.validationMessageCallback&&this.validationMessageCallback(w?this.internals.validationMessage:"")}),X.set(this,()=>{var w;n(this,h,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),c(this,h,!1,"f")),c(this,a,!0,"f"),c(this,o,!0,"f"),n(this,r,"m",k).call(this),(w=this===null||this===void 0?void 0:this.validationMessageCallback)===null||w===void 0||w.call(this,this.showError?this.internals.validationMessage:"")}),Y.set(this,void 0),E.set(this,!1),j.set(this,Promise.resolve()),(s=this.addEventListener)===null||s===void 0||s.call(this,"focus",n(this,g,"f")),(d=this.addEventListener)===null||d===void 0||d.call(this,"blur",n(this,m,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"invalid",n(this,X,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let t=this.validators.map(b=>b.attribute).flat(),s=super.observedAttributes||[];return[...new Set([...s,...t])]}static getValidator(t){return this.validators.find(s=>s.attribute===t)||null}static getValidators(t){return this.validators.filter(s=>{var d;if(s.attribute===t||!((d=s.attribute)===null||d===void 0)&&d.includes(t))return!0})}get form(){return this.internals.form}get showError(){return n(this,r,"m",k).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(t,s,d){var b;(b=super.attributeChangedCallback)===null||b===void 0||b.call(this,t,s,d);let S=this.constructor.getValidators(t);S!=null&&S.length&&this.validationTarget&&this.setValue(n(this,z,"f"))}setValue(t){var s;c(this,o,!1,"f"),(s=this.validationMessageCallback)===null||s===void 0||s.call(this,""),c(this,z,t,"f");let b=this.shouldFormValueUpdate()?t:null;this.internals.setFormValue(b),n(this,r,"m",R).call(this,b),this.valueChangedCallback&&this.valueChangedCallback(b),n(this,r,"m",k).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(t=>t(n(this,j,"f")))}formResetCallback(){var t,s;c(this,a,!1,"f"),c(this,o,!1,"f"),n(this,r,"m",k).call(this),(t=this.resetFormControl)===null||t===void 0||t.call(this),(s=this.validationMessageCallback)===null||s===void 0||s.call(this,n(this,r,"m",k).call(this)?this.validationMessage:"")}}return e=new WeakMap,o=new WeakMap,a=new WeakMap,l=new WeakMap,u=new WeakMap,h=new WeakMap,z=new WeakMap,g=new WeakMap,m=new WeakMap,X=new WeakMap,Y=new WeakMap,E=new WeakMap,j=new WeakMap,r=new WeakSet,q=function(){let t=this.getRootNode(),s=`${this.localName}[name="${this.getAttribute("name")}"]`;return t.querySelectorAll(s)},k=function(){if(this.hasAttribute("disabled"))return!1;let t=n(this,o,"f")||n(this,a,"f")&&!this.validity.valid&&!n(this,e,"f");return t&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),t},R=function(t){let s=this.constructor,d={},b=s.validators,w=[],S=b.some(v=>v.isValid instanceof Promise);n(this,E,"f")||(c(this,j,new Promise(v=>{c(this,Y,v,"f")}),"f"),c(this,E,!0,"f")),n(this,l,"f")&&(n(this,l,"f").abort(),c(this,u,n(this,l,"f"),"f"));let I=new AbortController;c(this,l,I,"f");let A,U=!1;b.length&&(b.forEach(v=>{let O=v.key||"customError",V=v.isValid(this,t,I.signal);V instanceof Promise?(w.push(V),V.then(P=>{P!=null&&(d[O]=!P,A=n(this,r,"m",L).call(this,v,t),n(this,r,"m",Z).call(this,d,A))})):(d[O]=!V,this.validity[O]!==!V&&(U=!0),!V&&!A&&(A=n(this,r,"m",L).call(this,v,t)))}),Promise.allSettled(w).then(()=>{var v;I!=null&&I.signal.aborted||(c(this,E,!1,"f"),(v=n(this,Y,"f"))===null||v===void 0||v.call(this))}),(U||!S)&&n(this,r,"m",Z).call(this,d,A))},Z=function(t,s){if(this.validationTarget)this.internals.setValidity(t,s,this.validationTarget),c(this,h,!1,"f");else{if(this.internals.setValidity(t,s),this.internals.validity.valid)return;c(this,h,!0,"f")}},L=function(t,s){if(this.validityCallback){let d=this.validityCallback(t.key||"customError");if(d)return d}return t.message instanceof Function?t.message(this,s):t.message},Q}import{html as ae,LitElement as J}from"lit";import{property as y}from"lit/decorators.js";import{css as B}from"lit";var $=B`
2
2
  *,
3
3
  :before,
4
4
  :after {
@@ -2607,10 +2607,10 @@ var ee=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var D=i=>{th
2607
2607
  border-color: var(--_border-color-disabled);
2608
2608
  }
2609
2609
  }
2610
- `;var M,C,_,p=class extends W(J){constructor(){super();this.value=null;this.checked=!1;this.disabled=!1;this.required=!1;this.invalid=!1;G(this,M,!1);G(this,C,!1);G(this,_,!1);this.handleClick=()=>{this.isInGroup()||this.disabled||(x(this,_,!0),!this.checked&&(this.checked=!0,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})))};this.handleInvalid=()=>{x(this,_,!0),this.updateValidity()};this.handleKeyDown=e=>{var o,a;if(!this.isInGroup()&&!this.disabled&&!e.defaultPrevented){if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key)){let l=this.getStandaloneNamedRadios().filter(m=>!m.disabled);if(l.length<=1)return;e.preventDefault();let u=(a=(o=l.find(m=>m.checked))!=null?o:l.find(m=>m===this))!=null?a:l[0],h=e.key==="ArrowUp"||e.key==="ArrowLeft"?-1:1,z=(l.indexOf(u)+h+l.length)%l.length,g=l[z];x(g,_,!0),g.checked||(g.checked=!0,g.updateComplete.then(()=>{g.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})),g.focus();return}if(!(e.key!==" "&&e.key!=="Spacebar"&&e.key!=="Enter")){if(e.key==="Enter"&&this.internals.form){this.internals.form.requestSubmit();return}e.preventDefault(),this.click()}}};this.addEventListener("click",this.handleClick),this.addEventListener("invalid",this.handleInvalid),this.addEventListener("keydown",this.handleKeyDown)}get tabIndex(){return this._internalTabIndex}set tabIndex(e){this._groupTabIndex=e}connectedCallback(){var e;super.connectedCallback(),this.value=(e=this.getAttribute("value"))!=null?e:"on",x(this,M,this.hasAttribute("checked")),this.checked=F(this,M),this.internals.role="radio",this.syncAriaDisabled(),this.syncFormValue(),this.updateValidity()}syncAriaDisabled(){this.internals.ariaDisabled=this.disabled?"true":"false"}syncAriaChecked(){this.internals.ariaChecked=this.checked?"true":"false"}willUpdate(e){this.shouldSyncFormState(e)&&(this.syncFormValue(),this.updateValidity())}updated(e){super.updated(e),e.has("checked")&&(this.syncAriaChecked(),this.checked&&!this.isInGroup()&&(this.uncheckOtherRadios(),this.syncStandaloneTabOrder())),e.has("disabled")&&(this.syncAriaDisabled(),this.isInGroup()||this.syncStandaloneTabOrder()),e.has("invalid")&&(this.internals.ariaInvalid=this.invalid?"true":null),e.has("name")&&this.checked&&!this.isInGroup()&&this.uncheckOtherRadios()}resetFormControl(){this.checked=F(this,M),this.syncFormValue(),this.updateValidity()}get validationMessage(){return this.internals.validationMessage}get validity(){return this.internals.validity}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return x(this,_,!0),this.updateValidity(),this.internals.checkValidity()}isInGroup(){return!!this.closest("w-radio-group")}getRadioScope(){var e,o;return(o=(e=this.internals.form)!=null?e:this.closest("form"))!=null?o:document}getStandaloneNamedRadios(){if(!this.name)return[this];let e=this.getRadioScope();return Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).filter(o=>!o.closest("w-radio-group"))}syncStandaloneTabOrder(){var u;let e=this.getStandaloneNamedRadios(),o=e.filter(h=>!h.disabled),a=o.find(h=>h.checked),l=(u=a!=null?a:o[0])!=null?u:null;e.forEach(h=>{h._standaloneTabIndex=h===l?0:-1})}get _internalTabIndex(){return this.disabled?-1:this._groupTabIndex!==void 0?this._groupTabIndex:this._standaloneTabIndex!==void 0?this._standaloneTabIndex:0}firstUpdated(){this.isInGroup()||this.syncStandaloneTabOrder()}uncheckOtherRadios(){if(!this.name)return;let e=this.getRadioScope();Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).forEach(a=>{a!==this&&(a.closest("w-radio-group")||a.checked&&(a.checked=!1))})}updateValidity(){if(this.disabled||this.isInGroup()){this.internals.setValidity({});return}let e=this.required&&!this.checked,o=this.invalid&&!F(this,C);if(e){x(this,C,!0),this.invalid=F(this,_),this.internals.setValidity({valueMissing:!0},this.internals.validationMessage||" ");return}if(F(this,C)&&(this.invalid=!1,x(this,C,!1)),o){this.internals.setValidity({customError:!0},this.internals.validationMessage||" ");return}this.internals.setValidity({})}syncFormValue(){if(this.disabled){this.setValue(null);return}this.setValue(this.checked?this.value:null)}shouldSyncFormState(e){return e.has("checked")||e.has("value")||e.has("disabled")||e.has("required")||e.has("invalid")}render(){return ae`
2610
+ `;var M,C,_,p=class extends N(J){constructor(){super();this.value=null;this.checked=!1;this.disabled=!1;this.required=!1;this.invalid=!1;G(this,M,!1);G(this,C,!1);G(this,_,!1);this.handleClick=()=>{this.isInGroup()||this.disabled||(x(this,_,!0),!this.checked&&(this.checked=!0,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})))};this.handleInvalid=()=>{x(this,_,!0),this.updateValidity()};this.handleKeyDown=e=>{var o,a;if(!this.isInGroup()&&!this.disabled&&!e.defaultPrevented){if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key)){let l=this.getStandaloneNamedRadios().filter(m=>!m.disabled);if(l.length<=1)return;e.preventDefault();let u=(a=(o=l.find(m=>m.checked))!=null?o:l.find(m=>m===this))!=null?a:l[0],h=e.key==="ArrowUp"||e.key==="ArrowLeft"?-1:1,z=(l.indexOf(u)+h+l.length)%l.length,g=l[z];x(g,_,!0),g.checked||(g.checked=!0,g.updateComplete.then(()=>{g.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})),g.focus();return}if(!(e.key!==" "&&e.key!=="Spacebar"&&e.key!=="Enter")){if(e.key==="Enter"&&this.internals.form){this.internals.form.requestSubmit();return}e.preventDefault(),this.click()}}};this.addEventListener("click",this.handleClick),this.addEventListener("invalid",this.handleInvalid),this.addEventListener("keydown",this.handleKeyDown)}get tabIndex(){return this._internalTabIndex}set tabIndex(e){this._groupTabIndex=e}connectedCallback(){var e;super.connectedCallback(),this.value=(e=this.getAttribute("value"))!=null?e:"on",x(this,M,this.hasAttribute("checked")),this.checked=F(this,M),this.internals.role="radio",this.syncAriaDisabled(),this.syncFormValue(),this.updateValidity()}syncAriaDisabled(){this.internals.ariaDisabled=this.disabled?"true":"false"}syncAriaChecked(){this.internals.ariaChecked=this.checked?"true":"false"}willUpdate(e){this.shouldSyncFormState(e)&&(this.syncFormValue(),this.updateValidity())}updated(e){super.updated(e),e.has("checked")&&(this.syncAriaChecked(),this.checked&&!this.isInGroup()&&(this.uncheckOtherRadios(),this.syncStandaloneTabOrder())),e.has("disabled")&&(this.syncAriaDisabled(),this.isInGroup()||this.syncStandaloneTabOrder()),e.has("invalid")&&(this.internals.ariaInvalid=this.invalid?"true":null),e.has("name")&&this.checked&&!this.isInGroup()&&this.uncheckOtherRadios()}resetFormControl(){this.checked=F(this,M),this.syncFormValue(),this.updateValidity()}get validationMessage(){return this.internals.validationMessage}get validity(){return this.internals.validity}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return x(this,_,!0),this.updateValidity(),this.internals.checkValidity()}isInGroup(){return!!this.closest("w-radio-group")}getRadioScope(){var e,o;return(o=(e=this.internals.form)!=null?e:this.closest("form"))!=null?o:document}getStandaloneNamedRadios(){if(!this.name)return[this];let e=this.getRadioScope();return Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).filter(o=>!o.closest("w-radio-group"))}syncStandaloneTabOrder(){var u;let e=this.getStandaloneNamedRadios(),o=e.filter(h=>!h.disabled),a=o.find(h=>h.checked),l=(u=a!=null?a:o[0])!=null?u:null;e.forEach(h=>{h._standaloneTabIndex=h===l?0:-1})}get _internalTabIndex(){return this.disabled?-1:this._groupTabIndex!==void 0?this._groupTabIndex:this._standaloneTabIndex!==void 0?this._standaloneTabIndex:0}firstUpdated(){this.isInGroup()||this.syncStandaloneTabOrder()}uncheckOtherRadios(){if(!this.name)return;let e=this.getRadioScope();Array.from(e.querySelectorAll(`w-radio[name="${this.name}"]`)).forEach(a=>{a!==this&&(a.closest("w-radio-group")||a.checked&&(a.checked=!1))})}updateValidity(){if(this.disabled||this.isInGroup()){this.internals.setValidity({});return}let e=this.required&&!this.checked,o=this.invalid&&!F(this,C);if(e){x(this,C,!0),this.invalid=F(this,_),this.internals.setValidity({valueMissing:!0},this.internals.validationMessage||" ");return}if(F(this,C)&&(this.invalid=!1,x(this,C,!1)),o){this.internals.setValidity({customError:!0},this.internals.validationMessage||" ");return}this.internals.setValidity({})}syncFormValue(){if(this.disabled){this.setValue(null);return}this.setValue(this.checked?this.value:null)}shouldSyncFormState(e){return e.has("checked")||e.has("value")||e.has("disabled")||e.has("required")||e.has("invalid")}render(){return ae`
2611
2611
  <div class="wrapper" tabindex="${this._internalTabIndex}">
2612
2612
  <div part="control" class="control"></div>
2613
2613
  <slot part="label" class="label"></slot>
2614
2614
  </div>
2615
- `}};M=new WeakMap,C=new WeakMap,_=new WeakMap,p.styles=[H,$,K],p.shadowRootOptions={...J.shadowRootOptions,delegatesFocus:!0},f([y({reflect:!0})],p.prototype,"name",2),f([y({reflect:!0})],p.prototype,"value",2),f([y({type:Boolean,reflect:!0})],p.prototype,"checked",2),f([y({type:Boolean,reflect:!0})],p.prototype,"disabled",2),f([y({type:Boolean,reflect:!0})],p.prototype,"required",2),f([y({type:Boolean,reflect:!0})],p.prototype,"invalid",2),f([y({attribute:!1})],p.prototype,"_groupTabIndex",2),f([y({attribute:!1})],p.prototype,"_standaloneTabIndex",2);customElements.get("w-radio")||customElements.define("w-radio",p);export{p as WRadio};
2615
+ `}};M=new WeakMap,C=new WeakMap,_=new WeakMap,p.styles=[H,$,K],p.shadowRootOptions={...J.shadowRootOptions,delegatesFocus:!0},f([y({reflect:!0})],p.prototype,"name",2),f([y({reflect:!0})],p.prototype,"value",2),f([y({type:Boolean,reflect:!0})],p.prototype,"checked",2),f([y({type:Boolean,reflect:!0})],p.prototype,"disabled",2),f([y({type:Boolean,reflect:!0})],p.prototype,"required",2),f([y({type:Boolean,reflect:!0})],p.prototype,"invalid",2),f([y({attribute:!1})],p.prototype,"_groupTabIndex",2),f([y({attribute:!1})],p.prototype,"_standaloneTabIndex",2);var xe=p;customElements.get("w-radio")||customElements.define("w-radio",p);export{xe as WRadio,p as WarpRadio};
2616
2616
  //# sourceMappingURL=radio.js.map