@aurodesignsystem-dev/auro-formkit 0.0.0-pr593.0

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 (268) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +2 -0
  4. package/README.md +314 -0
  5. package/components/bibtemplate/dist/auro-bibtemplate.d.ts +39 -0
  6. package/components/bibtemplate/dist/headerVersion.d.ts +2 -0
  7. package/components/bibtemplate/dist/iconVersion.d.ts +2 -0
  8. package/components/bibtemplate/dist/index.d.ts +2 -0
  9. package/components/bibtemplate/dist/index.js +709 -0
  10. package/components/bibtemplate/dist/registered.js +709 -0
  11. package/components/bibtemplate/dist/styles/color-css.d.ts +2 -0
  12. package/components/bibtemplate/dist/styles/style-css.d.ts +2 -0
  13. package/components/bibtemplate/dist/styles/tokens-css.d.ts +2 -0
  14. package/components/checkbox/README.md +142 -0
  15. package/components/checkbox/demo/api.html +55 -0
  16. package/components/checkbox/demo/api.js +17 -0
  17. package/components/checkbox/demo/api.md +401 -0
  18. package/components/checkbox/demo/api.min.js +1833 -0
  19. package/components/checkbox/demo/index.html +51 -0
  20. package/components/checkbox/demo/index.js +8 -0
  21. package/components/checkbox/demo/index.md +327 -0
  22. package/components/checkbox/demo/index.min.js +1808 -0
  23. package/components/checkbox/demo/readme.html +50 -0
  24. package/components/checkbox/demo/readme.md +142 -0
  25. package/components/checkbox/dist/auro-checkbox-group.d.ts +166 -0
  26. package/components/checkbox/dist/auro-checkbox.d.ts +129 -0
  27. package/components/checkbox/dist/helptextVersion.d.ts +2 -0
  28. package/components/checkbox/dist/index.d.ts +3 -0
  29. package/components/checkbox/dist/index.js +1757 -0
  30. package/components/checkbox/dist/registered.js +1758 -0
  31. package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +2 -0
  32. package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +2 -0
  33. package/components/checkbox/dist/styles/color-css.d.ts +2 -0
  34. package/components/checkbox/dist/styles/colorGroup-css.d.ts +2 -0
  35. package/components/checkbox/dist/styles/tokens-css.d.ts +2 -0
  36. package/components/combobox/README.md +152 -0
  37. package/components/combobox/demo/api.html +57 -0
  38. package/components/combobox/demo/api.js +36 -0
  39. package/components/combobox/demo/api.md +1209 -0
  40. package/components/combobox/demo/api.min.js +15117 -0
  41. package/components/combobox/demo/index.html +56 -0
  42. package/components/combobox/demo/index.js +26 -0
  43. package/components/combobox/demo/index.md +621 -0
  44. package/components/combobox/demo/index.min.js +14971 -0
  45. package/components/combobox/demo/readme.html +50 -0
  46. package/components/combobox/demo/readme.md +152 -0
  47. package/components/combobox/dist/auro-combobox.d.ts +384 -0
  48. package/components/combobox/dist/bibtemplateVersion.d.ts +2 -0
  49. package/components/combobox/dist/dropdownVersion.d.ts +2 -0
  50. package/components/combobox/dist/index.d.ts +2 -0
  51. package/components/combobox/dist/index.js +13554 -0
  52. package/components/combobox/dist/inputVersion.d.ts +2 -0
  53. package/components/combobox/dist/registered.js +13556 -0
  54. package/components/combobox/dist/styles/style-css.d.ts +2 -0
  55. package/components/counter/README.md +146 -0
  56. package/components/counter/demo/api.html +54 -0
  57. package/components/counter/demo/api.js +20 -0
  58. package/components/counter/demo/api.md +584 -0
  59. package/components/counter/demo/api.min.js +7111 -0
  60. package/components/counter/demo/index.html +54 -0
  61. package/components/counter/demo/index.js +21 -0
  62. package/components/counter/demo/index.md +244 -0
  63. package/components/counter/demo/index.min.js +7075 -0
  64. package/components/counter/demo/readme.html +50 -0
  65. package/components/counter/demo/readme.md +146 -0
  66. package/components/counter/dist/auro-counter-button.d.ts +12 -0
  67. package/components/counter/dist/auro-counter-group.d.ts +235 -0
  68. package/components/counter/dist/auro-counter-wrapper.d.ts +22 -0
  69. package/components/counter/dist/auro-counter.d.ts +97 -0
  70. package/components/counter/dist/bibtemplateVersion.d.ts +2 -0
  71. package/components/counter/dist/dropdownVersion.d.ts +2 -0
  72. package/components/counter/dist/iconVersion.d.ts +2 -0
  73. package/components/counter/dist/index.d.ts +3 -0
  74. package/components/counter/dist/index.js +7018 -0
  75. package/components/counter/dist/registered.js +7019 -0
  76. package/components/counter/dist/styles/color-css.d.ts +2 -0
  77. package/components/counter/dist/styles/counter-button-color-css.d.ts +2 -0
  78. package/components/counter/dist/styles/counter-button-css.d.ts +2 -0
  79. package/components/counter/dist/styles/counter-group-css.d.ts +2 -0
  80. package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +2 -0
  81. package/components/counter/dist/styles/counter-wrapper-css.d.ts +2 -0
  82. package/components/counter/dist/styles/style-css.d.ts +2 -0
  83. package/components/counter/dist/styles/tokens-css.d.ts +2 -0
  84. package/components/datepicker/README.md +140 -0
  85. package/components/datepicker/demo/api.html +57 -0
  86. package/components/datepicker/demo/api.js +35 -0
  87. package/components/datepicker/demo/api.md +1479 -0
  88. package/components/datepicker/demo/api.min.js +24534 -0
  89. package/components/datepicker/demo/index.html +56 -0
  90. package/components/datepicker/demo/index.js +19 -0
  91. package/components/datepicker/demo/index.md +112 -0
  92. package/components/datepicker/demo/index.min.js +24255 -0
  93. package/components/datepicker/demo/readme.html +50 -0
  94. package/components/datepicker/demo/readme.md +140 -0
  95. package/components/datepicker/dist/auro-calendar-cell.d.ts +163 -0
  96. package/components/datepicker/dist/auro-calendar-month.d.ts +20 -0
  97. package/components/datepicker/dist/auro-calendar.d.ts +133 -0
  98. package/components/datepicker/dist/auro-datepicker.d.ts +466 -0
  99. package/components/datepicker/dist/bibtemplateVersion.d.ts +2 -0
  100. package/components/datepicker/dist/buttonVersion.d.ts +2 -0
  101. package/components/datepicker/dist/dropdownVersion.d.ts +2 -0
  102. package/components/datepicker/dist/index.d.ts +2 -0
  103. package/components/datepicker/dist/index.js +24185 -0
  104. package/components/datepicker/dist/inputVersion.d.ts +2 -0
  105. package/components/datepicker/dist/popoverVersion.d.ts +2 -0
  106. package/components/datepicker/dist/registered.js +24185 -0
  107. package/components/datepicker/dist/styles/color-calendar-css.d.ts +2 -0
  108. package/components/datepicker/dist/styles/color-cell-css.d.ts +2 -0
  109. package/components/datepicker/dist/styles/color-css.d.ts +2 -0
  110. package/components/datepicker/dist/styles/color-month-css.d.ts +2 -0
  111. package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +2 -0
  112. package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +2 -0
  113. package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +2 -0
  114. package/components/datepicker/dist/styles/style-css.d.ts +2 -0
  115. package/components/datepicker/dist/styles/tokens-css.d.ts +2 -0
  116. package/components/datepicker/dist/utilities.d.ts +78 -0
  117. package/components/datepicker/dist/utilitiesCalendar.d.ts +38 -0
  118. package/components/datepicker/dist/utilitiesCalendarRender.d.ts +50 -0
  119. package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +5 -0
  120. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +60 -0
  121. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +1 -0
  122. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +57 -0
  123. package/components/dropdown/README.md +144 -0
  124. package/components/dropdown/demo/api.html +57 -0
  125. package/components/dropdown/demo/api.js +21 -0
  126. package/components/dropdown/demo/api.md +1434 -0
  127. package/components/dropdown/demo/api.min.js +3826 -0
  128. package/components/dropdown/demo/index.html +55 -0
  129. package/components/dropdown/demo/index.js +19 -0
  130. package/components/dropdown/demo/index.md +510 -0
  131. package/components/dropdown/demo/index.min.js +3789 -0
  132. package/components/dropdown/demo/readme.html +50 -0
  133. package/components/dropdown/demo/readme.md +144 -0
  134. package/components/dropdown/dist/auro-dropdown.d.ts +406 -0
  135. package/components/dropdown/dist/auro-dropdownBib.d.ts +46 -0
  136. package/components/dropdown/dist/dropdownVersion.d.ts +2 -0
  137. package/components/dropdown/dist/helptextVersion.d.ts +2 -0
  138. package/components/dropdown/dist/iconVersion.d.ts +2 -0
  139. package/components/dropdown/dist/index.d.ts +2 -0
  140. package/components/dropdown/dist/index.js +3734 -0
  141. package/components/dropdown/dist/registered.js +3734 -0
  142. package/components/dropdown/dist/styles/bibColors-css.d.ts +2 -0
  143. package/components/dropdown/dist/styles/bibStyles-css.d.ts +2 -0
  144. package/components/dropdown/dist/styles/color-css.d.ts +2 -0
  145. package/components/dropdown/dist/styles/style-css.d.ts +2 -0
  146. package/components/dropdown/dist/styles/tokens-css.d.ts +2 -0
  147. package/components/form/README.md +142 -0
  148. package/components/form/demo/api.html +49 -0
  149. package/components/form/demo/api.js +3 -0
  150. package/components/form/demo/api.md +51 -0
  151. package/components/form/demo/api.min.js +638 -0
  152. package/components/form/demo/autocomplete.html +15 -0
  153. package/components/form/demo/index.html +50 -0
  154. package/components/form/demo/index.js +4 -0
  155. package/components/form/demo/index.md +403 -0
  156. package/components/form/demo/index.min.js +639 -0
  157. package/components/form/demo/readme.html +50 -0
  158. package/components/form/demo/readme.md +142 -0
  159. package/components/form/demo/registerDemoDeps.js +23 -0
  160. package/components/form/demo/working.html +118 -0
  161. package/components/form/dist/auro-form.d.ts +223 -0
  162. package/components/form/dist/index.d.ts +2 -0
  163. package/components/form/dist/index.js +614 -0
  164. package/components/form/dist/registered.d.ts +1 -0
  165. package/components/form/dist/registered.js +614 -0
  166. package/components/form/dist/styles/style-css.d.ts +2 -0
  167. package/components/helptext/dist/auro-helptext.d.ts +61 -0
  168. package/components/helptext/dist/index.d.ts +2 -0
  169. package/components/helptext/dist/index.js +209 -0
  170. package/components/helptext/dist/registered.js +209 -0
  171. package/components/helptext/dist/styles/color-css.d.ts +2 -0
  172. package/components/helptext/dist/styles/style-css.d.ts +2 -0
  173. package/components/helptext/dist/styles/tokens-css.d.ts +2 -0
  174. package/components/input/README.md +135 -0
  175. package/components/input/demo/api.html +42 -0
  176. package/components/input/demo/api.js +29 -0
  177. package/components/input/demo/api.md +1252 -0
  178. package/components/input/demo/api.min.js +7238 -0
  179. package/components/input/demo/index.html +43 -0
  180. package/components/input/demo/index.js +20 -0
  181. package/components/input/demo/index.md +202 -0
  182. package/components/input/demo/index.min.js +7157 -0
  183. package/components/input/demo/readme.html +50 -0
  184. package/components/input/demo/readme.md +135 -0
  185. package/components/input/dist/auro-input.d.ts +31 -0
  186. package/components/input/dist/base-input.d.ts +512 -0
  187. package/components/input/dist/buttonVersion.d.ts +2 -0
  188. package/components/input/dist/helptextVersion.d.ts +2 -0
  189. package/components/input/dist/i18n.d.ts +18 -0
  190. package/components/input/dist/iconVersion.d.ts +2 -0
  191. package/components/input/dist/index.d.ts +2 -0
  192. package/components/input/dist/index.js +7063 -0
  193. package/components/input/dist/registered.js +7063 -0
  194. package/components/input/dist/styles/borders-css.d.ts +2 -0
  195. package/components/input/dist/styles/color-css.d.ts +2 -0
  196. package/components/input/dist/styles/input-css.d.ts +2 -0
  197. package/components/input/dist/styles/label-css.d.ts +2 -0
  198. package/components/input/dist/styles/mixins-css.d.ts +2 -0
  199. package/components/input/dist/styles/notificationIcons-css.d.ts +2 -0
  200. package/components/input/dist/styles/style-css.d.ts +2 -0
  201. package/components/input/dist/styles/tokens-css.d.ts +2 -0
  202. package/components/input/dist/utilities.d.ts +25 -0
  203. package/components/menu/README.md +145 -0
  204. package/components/menu/demo/api.html +55 -0
  205. package/components/menu/demo/api.js +27 -0
  206. package/components/menu/demo/api.md +954 -0
  207. package/components/menu/demo/api.min.js +1538 -0
  208. package/components/menu/demo/index.html +52 -0
  209. package/components/menu/demo/index.js +28 -0
  210. package/components/menu/demo/index.md +61 -0
  211. package/components/menu/demo/index.min.js +1484 -0
  212. package/components/menu/demo/readme.html +50 -0
  213. package/components/menu/demo/readme.md +145 -0
  214. package/components/menu/dist/auro-menu-utils.d.ts +42 -0
  215. package/components/menu/dist/auro-menu.d.ts +205 -0
  216. package/components/menu/dist/auro-menuoption.d.ts +63 -0
  217. package/components/menu/dist/dropdownVersion.d.ts +2 -0
  218. package/components/menu/dist/iconVersion.d.ts +2 -0
  219. package/components/menu/dist/index.d.ts +4 -0
  220. package/components/menu/dist/index.js +1426 -0
  221. package/components/menu/dist/registered.js +1427 -0
  222. package/components/menu/dist/styles/color-menu-css.d.ts +2 -0
  223. package/components/menu/dist/styles/color-menuoption-css.d.ts +2 -0
  224. package/components/menu/dist/styles/style-menu-css.d.ts +2 -0
  225. package/components/menu/dist/styles/style-menuoption-css.d.ts +2 -0
  226. package/components/menu/dist/styles/tokens-css.d.ts +2 -0
  227. package/components/radio/README.md +137 -0
  228. package/components/radio/demo/api.html +53 -0
  229. package/components/radio/demo/api.js +19 -0
  230. package/components/radio/demo/api.md +562 -0
  231. package/components/radio/demo/api.min.js +1944 -0
  232. package/components/radio/demo/index.html +50 -0
  233. package/components/radio/demo/index.js +8 -0
  234. package/components/radio/demo/index.md +150 -0
  235. package/components/radio/demo/index.min.js +1901 -0
  236. package/components/radio/demo/readme.html +50 -0
  237. package/components/radio/demo/readme.md +137 -0
  238. package/components/radio/dist/auro-radio-group.d.ts +194 -0
  239. package/components/radio/dist/auro-radio.d.ts +144 -0
  240. package/components/radio/dist/helptextVersion.d.ts +2 -0
  241. package/components/radio/dist/index.d.ts +3 -0
  242. package/components/radio/dist/index.js +1850 -0
  243. package/components/radio/dist/registered.js +1851 -0
  244. package/components/radio/dist/styles/auro-radio-group-css.d.ts +2 -0
  245. package/components/radio/dist/styles/color-css.d.ts +2 -0
  246. package/components/radio/dist/styles/groupColor-css.d.ts +2 -0
  247. package/components/radio/dist/styles/style-css.d.ts +2 -0
  248. package/components/radio/dist/styles/tokens-css.d.ts +2 -0
  249. package/components/select/README.md +144 -0
  250. package/components/select/demo/api.html +71 -0
  251. package/components/select/demo/api.js +35 -0
  252. package/components/select/demo/api.md +1313 -0
  253. package/components/select/demo/api.min.js +7763 -0
  254. package/components/select/demo/index.html +66 -0
  255. package/components/select/demo/index.js +9 -0
  256. package/components/select/demo/index.md +815 -0
  257. package/components/select/demo/index.min.js +7651 -0
  258. package/components/select/demo/readme.html +50 -0
  259. package/components/select/demo/readme.md +144 -0
  260. package/components/select/dist/auro-select.d.ts +359 -0
  261. package/components/select/dist/bibtemplateVersion.d.ts +2 -0
  262. package/components/select/dist/dropdownVersion.d.ts +2 -0
  263. package/components/select/dist/index.d.ts +2 -0
  264. package/components/select/dist/index.js +6300 -0
  265. package/components/select/dist/registered.js +6300 -0
  266. package/components/select/dist/styles/style-css.d.ts +2 -0
  267. package/package.json +217 -0
  268. package/packages/build-tools/src/postinstall.mjs +12 -0
@@ -0,0 +1,638 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const t$1=globalThis,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$3=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$2(o,t,s$2)},S$1=(s,o)=>{if(e$2)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
7
+
8
+ /**
9
+ * @license
10
+ * Copyright 2017 Google LLC
11
+ * SPDX-License-Identifier: BSD-3-Clause
12
+ */const{is:i$2,defineProperty:e$1,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$2,getPrototypeOf:n$1}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$1(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$1(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=h.fromAttribute(s,t.type)??this._$Ej?.get(e)??null,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.0");
13
+
14
+ /**
15
+ * @license
16
+ * Copyright 2017 Google LLC
17
+ * SPDX-License-Identifier: BSD-3-Clause
18
+ */
19
+ const t=globalThis,i$1=t.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$1="?"+h,n=`<${o$1}>`,r=document,l=()=>r.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$1)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t.litHtmlPolyfillSupport;j?.(N,R),(t.litHtmlVersions??=[]).push("3.3.0");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
20
+
21
+ /**
22
+ * @license
23
+ * Copyright 2017 Google LLC
24
+ * SPDX-License-Identifier: BSD-3-Clause
25
+ */const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.0");
26
+
27
+ var styleCss = i$3`:focus:not(:focus-visible){outline:3px solid transparent}`;
28
+
29
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
30
+ // See LICENSE in the project root for license information.
31
+
32
+ // ---------------------------------------------------------------------
33
+
34
+ /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
35
+
36
+ class AuroLibraryRuntimeUtils {
37
+
38
+ /* eslint-disable jsdoc/require-param */
39
+
40
+ /**
41
+ * This will register a new custom element with the browser.
42
+ * @param {String} name - The name of the custom element.
43
+ * @param {Object} componentClass - The class to register as a custom element.
44
+ * @returns {void}
45
+ */
46
+ registerComponent(name, componentClass) {
47
+ if (!customElements.get(name)) {
48
+ customElements.define(name, class extends componentClass {});
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Finds and returns the closest HTML Element based on a selector.
54
+ * @returns {void}
55
+ */
56
+ closestElement(
57
+ selector, // selector like in .closest()
58
+ base = this, // extra functionality to skip a parent
59
+ __Closest = (el, found = el && el.closest(selector)) =>
60
+ !el || el === document || el === window
61
+ ? null // standard .closest() returns null for non-found selectors also
62
+ : found
63
+ ? found // found a selector INside this element
64
+ : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
65
+ ) {
66
+ return __Closest(base);
67
+ }
68
+ /* eslint-enable jsdoc/require-param */
69
+
70
+ /**
71
+ * If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
72
+ * @param {Object} elem - The element to check.
73
+ * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
74
+ * @returns {void}
75
+ */
76
+ handleComponentTagRename(elem, tagName) {
77
+ const tag = tagName.toLowerCase();
78
+ const elemTag = elem.tagName.toLowerCase();
79
+
80
+ if (elemTag !== tag) {
81
+ elem.setAttribute(tag, true);
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Validates if an element is a specific Auro component.
87
+ * @param {Object} elem - The element to validate.
88
+ * @param {String} tagName - The name of the Auro component to check against.
89
+ * @returns {Boolean} - Returns true if the element is the specified Auro component.
90
+ */
91
+ elementMatch(elem, tagName) {
92
+ const tag = tagName.toLowerCase();
93
+ const elemTag = elem.tagName.toLowerCase();
94
+
95
+ return elemTag === tag || elem.hasAttribute(tag);
96
+ }
97
+ }
98
+
99
+ /* eslint-disable no-underscore-dangle,max-lines */
100
+
101
+
102
+ /**
103
+ * @typedef {Object} FormStateMember - The form state member.
104
+ * @property {string | number | boolean | string[] | null} value - The value of the form element.
105
+ * @property {ValidityState} validity - The validity state of the form element, stored when fired from the form element.
106
+ * @property {boolean} required - Whether the form element is required or not.
107
+ * @property {HTMLElement} element - Whether the form element is required or not.
108
+ */
109
+
110
+ /**
111
+ * @typedef {Object.<string, FormStateMember>} FormState - The form state.
112
+ */
113
+
114
+
115
+ // See https://git.io/JJ6SJ for "How to document your components using JSDoc"
116
+ /**
117
+ * The auro-form element provides users a way to ... (it would be great if you fill this out).
118
+ *
119
+ * @attr {Boolean} fixed - Uses fixed pixel values for element shape
120
+ * @attr {String} cssClass - Applies designated CSS class to demo element - you want to delete me!
121
+ * @event {Event} change - Fires when form state changes.
122
+ */
123
+
124
+ // build the component class
125
+ class AuroForm extends i {
126
+ static get properties() {
127
+ return {
128
+ formState: { attribute: false },
129
+ _validity: { attribute: false },
130
+ _isInitialState: { attribute: false },
131
+ _elements: { attribute: false },
132
+ _submitElements: { attribute: false },
133
+ _resetElements: { attribute: false },
134
+ };
135
+ }
136
+
137
+ constructor() {
138
+ super();
139
+
140
+ /** @type {FormState} */
141
+ this.formState = {};
142
+
143
+ /** @type {"valid" | "invalid" | null} */
144
+ this._validity = null;
145
+ this._isInitialState = true;
146
+
147
+ /** @type {(HTMLElement & {reset: () => void})[]} */
148
+ this._elements = [];
149
+
150
+ /** @type {HTMLButtonElement[]} */
151
+ this._submitelements = [];
152
+
153
+ /** @type {HTMLButtonElement[]} */
154
+ this._resetElements = [];
155
+
156
+ /**
157
+ * @private
158
+ * @type {MutationObserver[]}
159
+ */
160
+ this.mutationObservers = [];
161
+
162
+ // Bind listeners
163
+ this.reset = this.reset.bind(this);
164
+ this.submit = this.submit.bind(this);
165
+ this.sharedInputListener = this.sharedInputListener.bind(this);
166
+ this.sharedValidationListener = this.sharedValidationListener.bind(this);
167
+ this.mutationEventListener = this.mutationEventListener.bind(this);
168
+ }
169
+
170
+ // Note: button is NOT considered a form element in this context
171
+ // as it does not have a .value property.
172
+ static get formElementTags() {
173
+ return [
174
+ 'auro-input',
175
+ 'auro-select',
176
+ 'auro-datepicker',
177
+ 'auro-combobox',
178
+ // checkbox and radio are grouped elements
179
+ 'auro-checkbox-group',
180
+ 'auro-radio-group',
181
+ // while counter is groupable, the group is for min/max values and not for grouped values
182
+ 'auro-counter-group'
183
+ ];
184
+ }
185
+
186
+ /**
187
+ * Compare tag name with element to identify it (for API purposes).
188
+ * @param {string} elementTag - The HTML tag name like `auro-datepicker`.
189
+ * @param {HTMLElement} element - The actual HTML element to compare.
190
+ * @returns {boolean}
191
+ * @private
192
+ */
193
+ _isElementTag(elementTag, element) {
194
+ return element.tagName.toLowerCase() === elementTag || element.hasAttribute(elementTag.toLowerCase());
195
+ }
196
+
197
+ /**
198
+ * Shared code for determining if an element is something we care about (submit, form element, etc.).
199
+ * @param {string[]} collection - The array to use for tag name search.
200
+ * @param {HTMLElement} element - The element to compare against the master list.
201
+ * @returns {boolean}
202
+ * @private
203
+ */
204
+ _isInElementCollection(collection, element) {
205
+ return collection.some((elementTag) => this._isElementTag(elementTag, element));
206
+ }
207
+
208
+ /**
209
+ * Check if the tag name is a form element.
210
+ * @param {HTMLElement} element - The element to check (attr or tag name).
211
+ * @returns {boolean}
212
+ */
213
+ isFormElement(element) {
214
+ return this._isInElementCollection(AuroForm.formElementTags, element);
215
+ }
216
+
217
+ /**
218
+ * Validates if an event is from a valid form element with a name.
219
+ * @param {Event} event - The event to validate.
220
+ * @returns {boolean} - True if event is valid for processing.
221
+ * @private
222
+ */
223
+ _eventIsValidFormEvent(event) {
224
+ const targetName = event.target.getAttribute("name");
225
+ return this.isFormElement(event.target) && targetName;
226
+ }
227
+
228
+
229
+ static get buttonElementTags() {
230
+ return [
231
+ 'button',
232
+ 'auro-button',
233
+ ];
234
+ }
235
+
236
+ /**
237
+ * Check if the tag name is a button element.
238
+ * @param {HTMLElement} element - The element to check.
239
+ * @returns {boolean}
240
+ */
241
+ isButtonElement(element) {
242
+ return this._isInElementCollection(AuroForm.buttonElementTags, element);
243
+ }
244
+
245
+ static get styles() {
246
+ return [styleCss];
247
+ }
248
+
249
+ /**
250
+ * Reduce the form value into a key-value pair.
251
+ *
252
+ * NOTE: form keys use `name` first, and `id` second if `name` is not available.
253
+ * This follows standard HTML5 form behavior - submission uses `name` by default when creating
254
+ * the FormData object.
255
+ *
256
+ * @returns {Record<string, string | number | boolean | string[] | null>} The form value.
257
+ */
258
+ get value() {
259
+ return Object.keys(this.formState).reduce((acc, key) => {
260
+ acc[key] = this.formState[key].value;
261
+ return acc;
262
+ }, {});
263
+ }
264
+
265
+ /**
266
+ * Getter for internal _submitElements.
267
+ * @returns {HTMLButtonElement[]}
268
+ */
269
+ get submitElements() {
270
+ return this._submitelements;
271
+ }
272
+
273
+ /**
274
+ * Returns a collection of elements that will reset the form
275
+ * @returns {HTMLButtonElement[]}
276
+ */
277
+ get resetElements() {
278
+ return this._resetElements;
279
+ }
280
+
281
+ /**
282
+ * Infer validity status based on current formState.
283
+ * @private
284
+ */
285
+ _calculateValidity() {
286
+ if (this.isInitialState) {
287
+ this._validity = null;
288
+ } else {
289
+ // go through validity states and return the first invalid state (if any)
290
+ const invalidKey = Object.keys(this.formState).
291
+ find((key) => {
292
+ const formKey = this.formState[key];
293
+ // these are NOT extra parens
294
+ // eslint-disable-next-line no-extra-parens
295
+ return (formKey.validity !== 'valid' && formKey.required) || (formKey.validity !== 'valid' && formKey.value !== null);
296
+ });
297
+ this._validity = invalidKey ? 'invalid' : 'valid';
298
+ }
299
+ }
300
+
301
+ /**
302
+ * Current validity state of the form, based on form element events.
303
+ * @returns {"valid" | "invalid"}
304
+ */
305
+ get validity() {
306
+ // Force calculate, as sometimes validity won't reflect
307
+ // the latest value while in-between renders.
308
+ this._calculateValidity();
309
+ return this._validity;
310
+ }
311
+
312
+ _setInitialState() {
313
+ const anyTainted = Object.keys(this.formState).some((key) => this.formState[key].validity !== null || this.formState[key].value !== null);
314
+
315
+ this._isInitialState = !anyTainted;
316
+
317
+ this._resetElements.forEach((resetElement) => {
318
+ if (resetElement.hasAttribute("disabled")) {
319
+ resetElement.removeAttribute("disabled");
320
+ }
321
+ });
322
+ }
323
+
324
+ /**
325
+ * Mostly internal way to determine if a form is in the initial state.
326
+ * @returns {boolean}
327
+ */
328
+ get isInitialState() {
329
+ return this._isInitialState;
330
+ }
331
+
332
+ setDisabledStateOnButtons() {
333
+ this._resetElements.forEach((element) => {
334
+ if (this.isInitialState) {
335
+ element.setAttribute("disabled", "");
336
+ } else {
337
+ element.removeAttribute("disabled");
338
+ }
339
+ });
340
+
341
+ this._submitelements.forEach((element) => {
342
+ if (this.isInitialState || this.validity !== "valid") {
343
+ element.setAttribute("disabled", "");
344
+ } else {
345
+ element.removeAttribute("disabled");
346
+ }
347
+ });
348
+ }
349
+
350
+ /**
351
+ * Construct the query strings from elements, append them together, execute, and return the NodeList.
352
+ * @returns {NodeList}
353
+ */
354
+ queryAuroElements() {
355
+ const queries = [
356
+ [
357
+ AuroForm.formElementTags,
358
+ '[name]'
359
+ ],
360
+ [
361
+ AuroForm.buttonElementTags,
362
+ '[type=submit]'
363
+ ],
364
+ [
365
+ AuroForm.buttonElementTags,
366
+ '[type=reset]'
367
+ ]
368
+ ];
369
+
370
+ return this.querySelectorAll(queries.flatMap(([
371
+ tags,
372
+ extraAttributes
373
+ ]) => tags.map((tag) => `${tag}${extraAttributes}, [${tag}]${extraAttributes}`)).join(', '));
374
+ }
375
+
376
+ /**
377
+ * Store an element in state and on the _elements array.
378
+ * @param {HTMLElement} element - The element to add to our state.
379
+ * @private
380
+ */
381
+ _addElementToState(element) {
382
+ const targetName = element.getAttribute('name');
383
+ if (this.formState[targetName]) {
384
+ return;
385
+ }
386
+
387
+ this.formState[targetName] = {
388
+ value: element.value || element.getAttribute('value'),
389
+ validity: element.validity || null,
390
+ required: element.hasAttribute('required'),
391
+ // element
392
+ };
393
+
394
+ this._elements.push(element);
395
+ }
396
+
397
+ /**
398
+ * Initialize (or reinitialize) the form state.
399
+ */
400
+ initializeState() {
401
+ this.formState = {};
402
+ this._submitelements = [];
403
+ this._resetElements = [];
404
+ this._elements = [];
405
+
406
+ this.queryAuroElements().forEach((element) => {
407
+ if (this.isFormElement(element)) {
408
+ this._addElementToState(element);
409
+ }
410
+
411
+ if (this.isButtonElement(element) && element.getAttribute('type') === 'submit') {
412
+ element.removeEventListener('click', this.submit);
413
+ element.addEventListener('click', this.submit);
414
+
415
+ // Keep record of this element, so we can enable/disable as needed
416
+ this._submitelements.push(element);
417
+ }
418
+
419
+ if (this.isButtonElement(element) && element.getAttribute('type') === 'reset') {
420
+ // Keep record of this element, so we can enable/disable as needed
421
+ element.removeEventListener('click', this.reset);
422
+ element.addEventListener('click', this.reset);
423
+
424
+ this._resetElements.push(element);
425
+ }
426
+ });
427
+
428
+ this.dispatchEvent(new Event('change', {
429
+ bubbles: true,
430
+ composed: true,
431
+ cancelable: true
432
+ }));
433
+
434
+ // Set enabled/disabled states on buttons
435
+ this.setDisabledStateOnButtons();
436
+ }
437
+
438
+ /**
439
+ * Reset fires an event called `reset` - just as you would expect from a normal form.
440
+ */
441
+ reset() {
442
+ const previousValue = this.value;
443
+ this._elements.forEach((element) => element.reset());
444
+
445
+ this.updateComplete.then(() => {
446
+ this.initializeState();
447
+ // Initial state must come first - validity can only be null if initial state is true
448
+ this._setInitialState();
449
+ this._calculateValidity();
450
+
451
+ // Wait for the above changes to run through, then disable submit/reset
452
+ this.updateComplete.then(() => {
453
+ this.setDisabledStateOnButtons();
454
+
455
+ this.dispatchEvent(new CustomEvent('reset', {
456
+ bubbles: true,
457
+ composed: true,
458
+ detail: {
459
+ previousValue
460
+ }
461
+ }));
462
+ });
463
+ });
464
+ }
465
+
466
+ /**
467
+ * Submit fires an event called `submit` - just as you would expect from a normal form.
468
+ */
469
+ submit() {
470
+ // Steps required to get out of beta:
471
+ // 1. Submit triggers a forced validation on ALL elements
472
+ // 2. Wait for validation to complete (this.updateComplete.then or similar)
473
+ // 3. If still valid, go ahead with submit.
474
+ this._elements.forEach((element) => {
475
+ if (element.tagName.toLowerCase() !== "auro-datepicker") {
476
+ // Next line currently does NOT force
477
+ element.validate();
478
+ }
479
+ });
480
+
481
+ this.dispatchEvent(new CustomEvent('submit', {
482
+ bubbles: true,
483
+ composed: true,
484
+ detail: {
485
+ value: this.value
486
+ }
487
+ }));
488
+ }
489
+
490
+ /**
491
+ * This will register this element with the browser.
492
+ * @param {string} [name="auro-form"] - The name of element that you want to register to.
493
+ *
494
+ * @example
495
+ * AuroForm.register("custom-form") // this will register this element to <custom-form/>
496
+ *
497
+ */
498
+ static register(name = "auro-form") {
499
+ AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroForm);
500
+ }
501
+
502
+ /**
503
+ * Shared input listener for all form elements.
504
+ * @private
505
+ * @param {Event} event - The event that is fired from the form element.
506
+ */
507
+ sharedInputListener(event) {
508
+ const targetName = event.target.getAttribute("name");
509
+
510
+ // This should only happen if some bubble-up event is fired from inside a form element.
511
+ if (!this._eventIsValidFormEvent(event)) {
512
+ return;
513
+ }
514
+
515
+ // Occasionally, a form element will emit their event before the form can read data about the form element.
516
+ if (!this.formState[targetName] && this.isFormElement(event.target)) {
517
+ this._addElementToState(event.target);
518
+ }
519
+
520
+ // Check special input types and handle their edge cases
521
+ if (this._isElementTag('auro-datepicker', event.target) && event.target.hasAttribute('range')) {
522
+ this.formState[targetName].value = event.target.values;
523
+ } else {
524
+ this.formState[targetName].value = event.target.value;
525
+ }
526
+
527
+ this.requestUpdate('formState');
528
+ this.dispatchEvent(new CustomEvent('change', {
529
+ bubbles: true,
530
+ composed: true,
531
+ cancelable: true
532
+ }));
533
+ }
534
+
535
+ /**
536
+ * Shared validation listener for all form elements.
537
+ * @private
538
+ * @param {Event} event - The event that is fired from the form element.
539
+ */
540
+ sharedValidationListener(event) {
541
+ const targetName = event.target.getAttribute("name");
542
+ if (!this._eventIsValidFormEvent(event)) {
543
+ return;
544
+ }
545
+
546
+ if (!this.formState[targetName]) {
547
+ this._addElementToState(event.target);
548
+ }
549
+
550
+ this.formState[targetName].validity = event.detail.validity;
551
+ this._calculateValidity();
552
+ this.requestUpdate('formState');
553
+ }
554
+
555
+ _attachEventListeners() {
556
+ this.queryAuroElements().forEach((element) => {
557
+ // remove any existing event listeners (in case of re-initialization)
558
+ element.removeEventListener('input', this.sharedInputListener);
559
+ element.removeEventListener('auroFormElement-validated', this.sharedValidationListener);
560
+
561
+ // add new event listeners
562
+ element.addEventListener('input', this.sharedInputListener);
563
+ element.addEventListener('auroFormElement-validated', this.sharedValidationListener);
564
+ });
565
+ }
566
+
567
+ firstUpdated(_changedProperties) {
568
+ super.firstUpdated(_changedProperties);
569
+
570
+ this._attachEventListeners();
571
+ }
572
+
573
+ updated(_changedProperties) {
574
+ super.updated(_changedProperties);
575
+
576
+ if (_changedProperties.has("formState")) {
577
+ this._setInitialState();
578
+
579
+ // Automatically infer disabled state now
580
+ this.setDisabledStateOnButtons();
581
+ }
582
+
583
+ if (_changedProperties.has("_validity")) {
584
+ this._setInitialState();
585
+ }
586
+ }
587
+
588
+ /**
589
+ * Mutation observer for form elements. Slot change does not trigger unless
590
+ * root-level elements are added/removed. This is a workaround to ensure
591
+ * nested form elements are also observed.
592
+ *
593
+ * @private
594
+ * @returns {void}
595
+ */
596
+ mutationEventListener() {
597
+ this.initializeState();
598
+ this._attachEventListeners();
599
+ }
600
+
601
+ /**
602
+ * Slot change event listener. This is the main entry point for the form element.
603
+ * @param {Event} event - The slot change event.
604
+ * @returns {void}
605
+ */
606
+ onSlotChange(event) {
607
+ this.initializeState();
608
+ // Safe to call as we remove and re-add event listeners
609
+ this._attachEventListeners();
610
+
611
+ // Get rid of old observers - we'll create new ones in a moment
612
+ this.mutationObservers.forEach((mo) => mo.disconnect());
613
+ this.mutationObservers = [];
614
+
615
+ const slotNodes = event.currentTarget.assignedNodes();
616
+ slotNodes.forEach((node) => {
617
+ if (node.tagName && !this.isFormElement(node)) {
618
+ const mo = new MutationObserver(this.mutationEventListener);
619
+ mo.observe(node, {
620
+ subtree: true,
621
+ childList: true
622
+ });
623
+ this.mutationObservers.push(mo);
624
+ }
625
+ });
626
+ }
627
+
628
+ // function that renders the HTML and CSS into the scope of the component
629
+ render() {
630
+ return x`
631
+ <form>
632
+ <slot @slotchange="${this.onSlotChange}"></slot>
633
+ </form>
634
+ `;
635
+ }
636
+ }
637
+
638
+ AuroForm.register();
@@ -0,0 +1,15 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Demo page for auto-complete</title>
7
+ </head>
8
+ <body>
9
+ <!-- EVERY AUTOCOMPLETE OPTION, auro inputs -->
10
+
11
+ <!-- EVERY AUTOCOMPLETE OPTION, auro combobox -->
12
+
13
+ <!-- LOGIN FORM -->
14
+ </body>
15
+ </html>