@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,1850 @@
1
+ import { css, LitElement, html } from 'lit';
2
+ import { classMap } from 'lit/directives/class-map.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { unsafeStatic, literal, html as html$1 } from 'lit/static-html.js';
5
+
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t();}(0,function(){function e(e){var t=true,n=false,o=null,d={text:true,search:true,url:true,tel:true,email:true,password:true,number:true,date:true,month:true,week:true,time:true,datetime:true,"datetime-local":true};function i(e){return !!(e&&e!==document&&"HTML"!==e.nodeName&&"BODY"!==e.nodeName&&"classList"in e&&"contains"in e.classList)}function s(e){e.classList.contains("focus-visible")||(e.classList.add("focus-visible"),e.setAttribute("data-focus-visible-added",""));}function u(e){t=false;}function a(){document.addEventListener("mousemove",c),document.addEventListener("mousedown",c),document.addEventListener("mouseup",c),document.addEventListener("pointermove",c),document.addEventListener("pointerdown",c),document.addEventListener("pointerup",c),document.addEventListener("touchmove",c),document.addEventListener("touchstart",c),document.addEventListener("touchend",c);}function c(e){e.target.nodeName&&"html"===e.target.nodeName.toLowerCase()||(t=false,document.removeEventListener("mousemove",c),document.removeEventListener("mousedown",c),document.removeEventListener("mouseup",c),document.removeEventListener("pointermove",c),document.removeEventListener("pointerdown",c),document.removeEventListener("pointerup",c),document.removeEventListener("touchmove",c),document.removeEventListener("touchstart",c),document.removeEventListener("touchend",c));}document.addEventListener("keydown",function(n){n.metaKey||n.altKey||n.ctrlKey||(i(e.activeElement)&&s(e.activeElement),t=true);},true),document.addEventListener("mousedown",u,true),document.addEventListener("pointerdown",u,true),document.addEventListener("touchstart",u,true),document.addEventListener("visibilitychange",function(e){"hidden"===document.visibilityState&&(n&&(t=true),a());},true),a(),e.addEventListener("focus",function(e){var n,o,u;i(e.target)&&(t||(n=e.target,o=n.type,"INPUT"===(u=n.tagName)&&d[o]&&!n.readOnly||"TEXTAREA"===u&&!n.readOnly||n.isContentEditable))&&s(e.target);},true),e.addEventListener("blur",function(e){var t;i(e.target)&&(e.target.classList.contains("focus-visible")||e.target.hasAttribute("data-focus-visible-added"))&&(n=true,window.clearTimeout(o),o=window.setTimeout(function(){n=false;},100),(t=e.target).hasAttribute("data-focus-visible-added")&&(t.classList.remove("focus-visible"),t.removeAttribute("data-focus-visible-added")));},true),e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host?e.host.setAttribute("data-js-focus-visible",""):e.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""));}if("undefined"!=typeof window&&"undefined"!=typeof document){var t;window.applyFocusVisiblePolyfill=e;try{t=new CustomEvent("focus-visible-polyfill-ready");}catch(e){(t=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",false,false,{});}window.dispatchEvent(t);}"undefined"!=typeof document&&e(document);});
7
+
8
+ var styleCss$2 = css`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;outline:unset}:host(.focus-visible) .displayFlex .inputGroup:focus-within{width:auto}:host(.focus-visible) .rdoGroup{display:block;padding-right:var(--ds-size-100, 0.5rem);outline:3px solid transparent}:host(.focus-visible) .rdoGroup .label:after{outline-width:1px;outline-style:solid}.rdoGroup{position:relative;padding-right:var(--ds-size-100, 0.5rem);padding-left:var(--ds-size-100, 0.5rem);line-height:var(--ds-size-400, 2rem)}.label{display:block;margin-left:var(--ds-size-300, 1.5rem)}.label:hover{cursor:pointer}.label:after{position:absolute;z-index:1;top:50%;left:var(--ds-size-50, 0.25rem);width:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem));height:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem));transform:translateY(-50%);content:"";border-radius:50%;border:1px solid}.slotContent{display:block;margin-left:var(--ds-size-400, 2rem);padding-left:var(--ds-size-100, 0.5rem)}`;
9
+
10
+ var colorCss$2 = css`.label{color:var(--ds-auro-radio-label-color)}.label:after{background-color:var(--ds-auro-radio-btn-fill-color);border-color:var(--ds-auro-radio-btn-border-color);box-shadow:inset 0 0 0 3px var(--ds-auro-radio-btn-inset-color);outline-color:var(--ds-auro-radio-btn-border-color);-webkit-tap-highlight-color:var(--ds-auro-radio-tap-color)}:host([checked]){--ds-auro-radio-btn-inset-color: var(--ds-advanced-color-boolean-indicator, #ffffff);--ds-auro-radio-btn-fill-color: var(--ds-advanced-color-boolean-istrue, #01426a);--ds-auro-radio-btn-border-color: var(--ds-advanced-color-boolean-istrue, #01426a)}:host([error]){--ds-auro-radio-btn-border-color: var(--ds-advanced-color-boolean-error, #e31f26)}:host([checked][error]){--ds-auro-radio-btn-fill-color: var(--ds-advanced-color-boolean-error, #e31f26)}:host([disabled]){--ds-auro-radio-btn-border-color: var(--ds-advanced-color-state-background-disabled, #dddddd);--ds-auro-radio-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([checked][disabled]){--ds-auro-radio-btn-fill-color: var(--ds-advanced-color-state-background-disabled, #dddddd)}:host(.focus-visible){--ds-auro-radio-btn-border-color: var(--ds-advanced-color-state-focused, #01426a)}:host([onDark]){--ds-auro-radio-label-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-radio-btn-border-color: var(--ds-basic-color-border-inverse, #ffffff)}:host([onDark][checked]){--ds-auro-radio-btn-inset-color: var(--ds-advanced-color-boolean-indicator-inverse, #00274a);--ds-auro-radio-btn-fill-color: var(--ds-advanced-color-boolean-istrue-inverse, #ffffff);--ds-auro-radio-btn-border-color: var(--ds-advanced-color-boolean-istrue-inverse, #ffffff)}:host([onDark][error]){--ds-auro-radio-btn-border-color: var(--ds-advanced-color-boolean-error-inverse, #f9a4a8)}:host([onDark][checked][error]){--ds-auro-radio-btn-fill-color: var(--ds-advanced-color-boolean-error-inverse, #f9a4a8)}:host([onDark][disabled]){--ds-auro-radio-btn-border-color: var(--ds-advanced-color-state-background-inverse-disabled, #7e8894);--ds-auro-radio-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][checked][disabled]){--ds-auro-radio-btn-fill-color: var(--ds-advanced-color-state-background-inverse-disabled, #7e8894)}:host([onDark].focus-visible){--ds-auro-radio-btn-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}`;
11
+
12
+ var tokenCss = css`:host{--ds-auro-radio-group-label-color: inherit;--ds-auro-radio-btn-border-color: var(--ds-basic-color-border-bold, #585e67);--ds-auro-radio-btn-fill-color: transparent;--ds-auro-radio-btn-inset-color: transparent;--ds-auro-radio-label-color: inherit;--ds-auro-radio-tap-color: transparent}`;
13
+
14
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
15
+ // See LICENSE in the project root for license information.
16
+
17
+ // ---------------------------------------------------------------------
18
+
19
+ /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
20
+
21
+ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
22
+
23
+ /* eslint-disable jsdoc/require-param */
24
+
25
+ /**
26
+ * This will register a new custom element with the browser.
27
+ * @param {String} name - The name of the custom element.
28
+ * @param {Object} componentClass - The class to register as a custom element.
29
+ * @returns {void}
30
+ */
31
+ registerComponent(name, componentClass) {
32
+ if (!customElements.get(name)) {
33
+ customElements.define(name, class extends componentClass {});
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Finds and returns the closest HTML Element based on a selector.
39
+ * @returns {void}
40
+ */
41
+ closestElement(
42
+ selector, // selector like in .closest()
43
+ base = this, // extra functionality to skip a parent
44
+ __Closest = (el, found = el && el.closest(selector)) =>
45
+ !el || el === document || el === window
46
+ ? null // standard .closest() returns null for non-found selectors also
47
+ : found
48
+ ? found // found a selector INside this element
49
+ : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
50
+ ) {
51
+ return __Closest(base);
52
+ }
53
+ /* eslint-enable jsdoc/require-param */
54
+
55
+ /**
56
+ * 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.
57
+ * @param {Object} elem - The element to check.
58
+ * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
59
+ * @returns {void}
60
+ */
61
+ handleComponentTagRename(elem, tagName) {
62
+ const tag = tagName.toLowerCase();
63
+ const elemTag = elem.tagName.toLowerCase();
64
+
65
+ if (elemTag !== tag) {
66
+ elem.setAttribute(tag, true);
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Validates if an element is a specific Auro component.
72
+ * @param {Object} elem - The element to validate.
73
+ * @param {String} tagName - The name of the Auro component to check against.
74
+ * @returns {Boolean} - Returns true if the element is the specified Auro component.
75
+ */
76
+ elementMatch(elem, tagName) {
77
+ const tag = tagName.toLowerCase();
78
+ const elemTag = elem.tagName.toLowerCase();
79
+
80
+ return elemTag === tag || elem.hasAttribute(tag);
81
+ }
82
+ };
83
+
84
+ // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
85
+ // See LICENSE in the project root for license information.
86
+
87
+
88
+ /**
89
+ * @attr {Boolean} checked - If set to true, the radio button will be filled.
90
+ * @attr {Boolean} disabled - If set to true, the radio button will be non-clickable.
91
+ * @attr {Boolean} required - Defines element as required.
92
+ * @attr {Boolean} error - If set to true, sets an error state on the radio button.
93
+ * @attr {Boolean} onDark - If set to true, the component will render with a dark theme.
94
+ * @event toggleSelected - Notifies that the component has toggled the checked/selected state.
95
+ *
96
+ * @prop {string} id - The id global attribute defines an identifier (ID) which must be unique in the whole document.
97
+ * @attr id
98
+ *
99
+ * @event focusSelected - Notifies that the component has gained focus.
100
+ * @event auroRadio-blur - Notifies that the component has lost focus.
101
+ * @event resetRadio - Notifies that the component has reset the checked/selected state.
102
+ * @event auroRadio-selected - Notifies that the component has been marked as checked/selected.
103
+ */
104
+
105
+ // build the component class
106
+ class AuroRadio extends LitElement {
107
+ constructor() {
108
+ super();
109
+ this.checked = false;
110
+ this.disabled = false;
111
+ this.required = false;
112
+ this.error = false;
113
+ this.onDark = false;
114
+ this.tabIndex = -1;
115
+ this.touched = false;
116
+
117
+ /**
118
+ * @private
119
+ */
120
+ this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
121
+ }
122
+
123
+ static get styles() {
124
+ return [
125
+ styleCss$2,
126
+ colorCss$2,
127
+ tokenCss
128
+ ];
129
+ }
130
+
131
+ // function to define props used within the scope of this component
132
+ static get properties() {
133
+ return {
134
+ checked: {
135
+ type: Boolean,
136
+ reflect: true
137
+ },
138
+ disabled: {
139
+ type: Boolean,
140
+ reflect: true
141
+ },
142
+ required: {
143
+ type: Boolean,
144
+ reflect: true
145
+ },
146
+ error: {
147
+ type: Boolean,
148
+ reflect: true
149
+ },
150
+ onDark: {
151
+ type: Boolean,
152
+ reflect: true
153
+ },
154
+ label: { type: String },
155
+ name: { type: String },
156
+ value: { type: String },
157
+ tabIndex: {
158
+ type: Number,
159
+ reflect: true
160
+ },
161
+
162
+ /**
163
+ * Whether or not the radio button has been touched by the user.
164
+ * @private
165
+ */
166
+ touched: {
167
+ type: Boolean,
168
+ reflect: true,
169
+ attribute: false
170
+ },
171
+
172
+ /**
173
+ * @private
174
+ * id for input node
175
+ */
176
+ inputId: {
177
+ type: String,
178
+ reflect: false,
179
+ attribute: false
180
+ }
181
+ };
182
+ }
183
+
184
+ /**
185
+ * This will register this element with the browser.
186
+ * @param {string} [name="auro-radio"] - The name of element that you want to register to.
187
+ *
188
+ * @example
189
+ * AuroRadio.register("custom-radio") // This will resgiter this element to <custom-radio/>
190
+ *
191
+ */
192
+ static register(name = "auro-radio") {
193
+ AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroRadio);
194
+ }
195
+
196
+ /**
197
+ * Method for handling content when change event is fired.
198
+ * @private
199
+ * @param {Event} event - The trigger event tied to this function.
200
+ * @returns {void}
201
+ */
202
+ handleChange(event) {
203
+ this.checked = event.target.checked;
204
+ const customEvent = new CustomEvent(event.type, event);
205
+
206
+ this.dispatchEvent(customEvent);
207
+ }
208
+
209
+ /**
210
+ * Method for handling content when input event is fired.
211
+ * @private
212
+ * @param {Event} event - The trigger event tied to this function.
213
+ * @returns {void}
214
+ */
215
+ handleInput(event) {
216
+ this.checked = event.target.checked;
217
+ this.dispatchEvent(new CustomEvent('toggleSelected', {
218
+ bubbles: true,
219
+ composed: true,
220
+ target: this
221
+ }));
222
+ }
223
+
224
+ /**
225
+ * Method for handling focus event.
226
+ * @private
227
+ * @param {Event} event - The trigger event tied to this function.
228
+ * @returns {void}
229
+ */
230
+ handleFocus(event) {
231
+ this.touched = true;
232
+ this.dispatchEvent(new CustomEvent('focusSelected', {
233
+ bubbles: true,
234
+ composed: true,
235
+ target: event.target
236
+ }));
237
+ }
238
+
239
+ /**
240
+ * Method for handling blur event.
241
+ * @private
242
+ * @param {Event} event - The trigger event tied to this function.
243
+ * @returns {void}
244
+ */
245
+ handleBlur(event) {
246
+ this.dispatchEvent(new CustomEvent('auroRadio-blur', {
247
+ bubbles: true,
248
+ composed: true,
249
+ target: event.target
250
+ }));
251
+ }
252
+
253
+ /**
254
+ * Resets component to initial state.
255
+ * @returns {void}
256
+ */
257
+ reset() {
258
+ this.touched = false;
259
+ this.checked = false;
260
+ this.error = false;
261
+ }
262
+
263
+ updated(changedProperties) {
264
+ if (changedProperties.has('checked')) {
265
+ this.dispatchEvent(new CustomEvent('resetRadio', {
266
+ bubbles: true,
267
+ composed: true
268
+ }));
269
+
270
+ if (this.checked) {
271
+ this.dispatchEvent(new CustomEvent('auroRadio-selected', {
272
+ bubbles: true,
273
+ composed: true
274
+ }));
275
+ }
276
+ }
277
+ }
278
+
279
+ /**
280
+ * Method for handling content when it is invalid accessibility wise.
281
+ * @private
282
+ * @param {Boolean} error - The element's error attribute.
283
+ * @returns {void}
284
+ */
285
+ invalid(error) {
286
+ if (error) {
287
+ return 'true';
288
+ }
289
+
290
+ return 'false';
291
+ }
292
+
293
+ /**
294
+ * Method for handling passing the required status to aria.
295
+ * @private
296
+ * @param {Boolean} required - The element's required attribute.
297
+ * @returns {void}
298
+ */
299
+ isRequired(required) {
300
+ if (required) {
301
+ return 'true';
302
+ }
303
+
304
+ return 'false';
305
+ }
306
+
307
+ firstUpdated() {
308
+ // Add the tag name as an attribute if it is different than the component name
309
+ this.runtimeUtils.handleComponentTagRename(this, 'auro-radio');
310
+
311
+ this.addEventListener('blur', this.handleBlur);
312
+
313
+ this.input = this.shadowRoot.querySelector('input');
314
+
315
+ this.inputId = this.id ? `${this.id}-input` : window.crypto.randomUUID();
316
+
317
+ this.addEventListener('click', () => {
318
+ this.input.click();
319
+ });
320
+ }
321
+
322
+ // function that renders the HTML and CSS into the scope of the component
323
+ render() {
324
+ const labelClasses = {
325
+ 'ods-inputLabel': true,
326
+ 'ods-inputLabel--radio': true,
327
+ 'label': true,
328
+ 'label--rdo': true,
329
+ 'errorBorder': this.error
330
+ };
331
+
332
+ return html`
333
+ <div class="ods-inputGroup rdoGroup">
334
+ <input
335
+ class="util_displayHiddenVisually ods-inputOption rdo--input"
336
+ @focus="${this.handleFocus}"
337
+ @input="${this.handleInput}"
338
+ @change="${this.handleChange}"
339
+ ?disabled="${this.disabled}"
340
+ aria-invalid="${this.invalid(this.error)}"
341
+ aria-required="${this.isRequired(this.required)}"
342
+ .checked="${this.checked}"
343
+ id="${this.inputId}"
344
+ name="${ifDefined(this.name)}"
345
+ type="radio"
346
+ .value="${this.value}"
347
+ tabIndex="-1"
348
+ />
349
+
350
+ <label for="${this.inputId}" class="${classMap(labelClasses)}">
351
+ <slot>${this.label}</slot>
352
+ </label>
353
+
354
+ </div>
355
+ <slot name="content" class="slotContent"></slot>
356
+ `;
357
+ }
358
+ }
359
+
360
+ var styleCss$1 = css`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}`;
361
+
362
+ var colorCss$1 = css`:host legend{color:var(--ds-auro-radio-group-label-color)}:host([disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([onDark]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}`;
363
+
364
+ class DateFormatter {
365
+
366
+ constructor() {
367
+
368
+ /**
369
+ * @description Parses a date string into its components.
370
+ * @param {string} dateStr - Date string to parse.
371
+ * @param {string} format - Date format to parse.
372
+ * @returns {Object<key["month" | "day" | "year"]: number>|undefined}
373
+ */
374
+ this.parseDate = (dateStr, format = 'mm/dd/yyyy') => {
375
+
376
+ // Guard Clause: Date string is defined
377
+ if (!dateStr) {
378
+ return undefined;
379
+ }
380
+
381
+ // Assume the separator is a "/" a defined in our code base
382
+ const separator = '/';
383
+
384
+ // Get the parts of the date and format
385
+ const valueParts = dateStr.split(separator);
386
+ const formatParts = format.split(separator);
387
+
388
+ // Check if the value and format have the correct number of parts
389
+ if (valueParts.length !== formatParts.length) {
390
+ throw new Error('AuroDatepickerUtilities | parseDate: Date string and format length do not match');
391
+ }
392
+
393
+ // Holds the result to be returned
394
+ const result = formatParts.reduce((acc, part, index) => {
395
+ const value = valueParts[index];
396
+
397
+ if ((/m/iu).test(part)) {
398
+ acc.month = value;
399
+ } else if ((/d/iu).test(part)) {
400
+ acc.day = value;
401
+ } else if ((/y/iu).test(part)) {
402
+ acc.year = value;
403
+ }
404
+
405
+ return acc;
406
+ }, {});
407
+
408
+ // If we found all the parts, return the result
409
+ if (result.month && result.year) {
410
+ return result;
411
+ }
412
+
413
+ // Throw an error to let the dev know we were unable to parse the date string
414
+ throw new Error('AuroDatepickerUtilities | parseDate: Unable to parse date string');
415
+ };
416
+
417
+ /**
418
+ * Convert a date object to string format.
419
+ * @param {Object} date - Date to convert to string.
420
+ * @returns {Object} Returns the date as a string.
421
+ */
422
+ this.getDateAsString = (date) => date.toLocaleDateString(undefined, {
423
+ year: "numeric",
424
+ month: "2-digit",
425
+ day: "2-digit",
426
+ });
427
+
428
+ /**
429
+ * Converts a date string to a North American date format.
430
+ * @param {String} dateStr - Date to validate.
431
+ * @param {String} format - Date format to validate against.
432
+ * @returns {Boolean}
433
+ */
434
+ this.toNorthAmericanFormat = (dateStr, format) => {
435
+
436
+ if (format === 'mm/dd/yyyy') {
437
+ return dateStr;
438
+ }
439
+
440
+ const parsedDate = this.parseDate(dateStr, format);
441
+
442
+ if (!parsedDate) {
443
+ throw new Error('AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string');
444
+ }
445
+
446
+ const { month, day, year } = parsedDate;
447
+
448
+ const dateParts = [];
449
+ if (month) {
450
+ dateParts.push(month);
451
+ }
452
+
453
+ if (day) {
454
+ dateParts.push(day);
455
+ }
456
+
457
+ if (year) {
458
+ dateParts.push(year);
459
+ }
460
+
461
+ return dateParts.join('/');
462
+ };
463
+ }
464
+ }
465
+ const dateFormatter = new DateFormatter();
466
+
467
+ // filepath: dateConstraints.mjs
468
+ const DATE_UTIL_CONSTRAINTS = {
469
+ maxDay: 31,
470
+ maxMonth: 12,
471
+ maxYear: 2400,
472
+ minDay: 1,
473
+ minMonth: 1,
474
+ minYear: 1900,
475
+ };
476
+
477
+ class AuroDateUtilitiesBase {
478
+
479
+ /**
480
+ * @description The maximum day value allowed by the various utilities in this class.
481
+ * @readonly
482
+ * @type {Number}
483
+ */
484
+ get maxDay() {
485
+ return DATE_UTIL_CONSTRAINTS.maxDay;
486
+ }
487
+
488
+ /**
489
+ * @description The maximum month value allowed by the various utilities in this class.
490
+ * @readonly
491
+ * @type {Number}
492
+ */
493
+ get maxMonth() {
494
+ return DATE_UTIL_CONSTRAINTS.maxMonth;
495
+ }
496
+
497
+ /**
498
+ * @description The maximum year value allowed by the various utilities in this class.
499
+ * @readonly
500
+ * @type {Number}
501
+ */
502
+ get maxYear() {
503
+ return DATE_UTIL_CONSTRAINTS.maxYear;
504
+ }
505
+
506
+ /**
507
+ * @description The minimum day value allowed by the various utilities in this class.
508
+ * @readonly
509
+ * @type {Number}
510
+ */
511
+ get minDay() {
512
+ return DATE_UTIL_CONSTRAINTS.minDay;
513
+ }
514
+
515
+ /**
516
+ * @description The minimum month value allowed by the various utilities in this class.
517
+ * @readonly
518
+ * @type {Number}
519
+ */
520
+ get minMonth() {
521
+ return DATE_UTIL_CONSTRAINTS.minMonth;
522
+ }
523
+
524
+ /**
525
+ * @description The minimum year value allowed by the various utilities in this class.
526
+ * @readonly
527
+ * @type {Number}
528
+ */
529
+ get minYear() {
530
+ return DATE_UTIL_CONSTRAINTS.minYear;
531
+ }
532
+ }
533
+
534
+ /* eslint-disable no-magic-numbers */
535
+
536
+ class AuroDateUtilities extends AuroDateUtilitiesBase {
537
+
538
+ /**
539
+ * Returns the current century.
540
+ * @returns {String} The current century.
541
+ */
542
+ getCentury () {
543
+ return String(new Date().getFullYear()).slice(0, 2);
544
+ }
545
+
546
+ /**
547
+ * Returns a four digit year.
548
+ * @param {String} year - The year to convert to four digits.
549
+ * @returns {String} The four digit year.
550
+ */
551
+ getFourDigitYear (year) {
552
+
553
+ const strYear = String(year).trim();
554
+ return strYear.length <= 2 ? this.getCentury() + strYear : strYear;
555
+ }
556
+
557
+ constructor() {
558
+
559
+ super();
560
+
561
+ /**
562
+ * Compares two dates to see if they match.
563
+ * @param {Object} date1 - First date to compare.
564
+ * @param {Object} date2 - Second date to compare.
565
+ * @returns {Boolean} Returns true if the dates match.
566
+ */
567
+ this.datesMatch = (date1, date2) => new Date(date1).getTime() === new Date(date2).getTime();
568
+
569
+ /**
570
+ * Returns true if value passed in is a valid date.
571
+ * @param {String} date - Date to validate.
572
+ * @param {String} format - Date format to validate against.
573
+ * @returns {Boolean}
574
+ */
575
+ this.validDateStr = (date, format) => {
576
+
577
+ // The length we expect the date string to be
578
+ const dateStrLength = format.length;
579
+
580
+ // Guard Clause: Date and format are defined
581
+ if (typeof date === "undefined" || typeof format === "undefined") {
582
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Date and format are required');
583
+ }
584
+
585
+ // Guard Clause: Date should be of type string
586
+ if (typeof date !== "string") {
587
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Date must be a string');
588
+ }
589
+
590
+ // Guard Clause: Format should be of type string
591
+ if (typeof format !== "string") {
592
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Format must be a string');
593
+ }
594
+
595
+ // Guard Clause: Length is what we expect it to be
596
+ if (date.length !== dateStrLength) {
597
+ return false;
598
+ }
599
+ // Get a formatted date string and parse it
600
+ const dateParts = dateFormatter.parseDate(date, format);
601
+
602
+ // Guard Clause: Date parse succeeded
603
+ if (!dateParts) {
604
+ return false;
605
+ }
606
+
607
+ // Create the expected date string based on the date parts
608
+ const expectedDateStr = `${dateParts.month}/${dateParts.day || "01"}/${this.getFourDigitYear(dateParts.year)}`;
609
+
610
+ // Generate a date object that we will extract a string date from to compare to the passed in date string
611
+ const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
612
+
613
+ // Get the date string of the date object we created from the string date
614
+ const actualDateStr = dateFormatter.getDateAsString(dateObj);
615
+
616
+ // Guard Clause: Generated date matches date string input
617
+ if (expectedDateStr !== actualDateStr) {
618
+ return false;
619
+ }
620
+
621
+ // If we passed all other checks, we can assume the date is valid
622
+ return true;
623
+ };
624
+
625
+ /**
626
+ * Determines if a string date value matches the format provided.
627
+ * @param {string} value = The date string value.
628
+ * @param { string} format = The date format to match against.
629
+ * @returns {boolean}
630
+ */
631
+ this.dateAndFormatMatch = (value, format) => {
632
+
633
+ // Ensure we have both values we need to do the comparison
634
+ if (!value || !format) {
635
+ throw new Error('AuroFormValidation | dateFormatMatch: value and format are required');
636
+ }
637
+
638
+ // If the lengths are different, they cannot match
639
+ if (value.length !== format.length) {
640
+ return false;
641
+ }
642
+
643
+ // Get the parts of the date
644
+ const dateParts = dateFormatter.parseDate(value, format);
645
+
646
+ // Validator for day
647
+ const dayValueIsValid = (day) => {
648
+
649
+ // Guard clause: if there is no day in the dateParts, we can ignore this check.
650
+ if (!dateParts.day) {
651
+ return true;
652
+ }
653
+
654
+ // Guard clause: ensure day exists.
655
+ if (!day) {
656
+ return false;
657
+ }
658
+
659
+ // Convert day to number
660
+ const numDay = Number.parseInt(day, 10);
661
+
662
+ // Guard clause: ensure day is a valid integer
663
+ if (Number.isNaN(numDay)) {
664
+ throw new Error('AuroDatepickerUtilities | dayValueIsValid: Unable to parse day value integer');
665
+ }
666
+
667
+ // Guard clause: ensure day is within the valid range
668
+ if (numDay < this.minDay || numDay > this.maxDay) {
669
+ return false;
670
+ }
671
+
672
+ // Default return
673
+ return true;
674
+ };
675
+
676
+ // Validator for month
677
+ const monthValueIsValid = (month) => {
678
+
679
+ // Guard clause: ensure month exists.
680
+ if (!month) {
681
+ return false;
682
+ }
683
+
684
+ // Convert month to number
685
+ const numMonth = Number.parseInt(month, 10);
686
+
687
+ // Guard clause: ensure month is a valid integer
688
+ if (Number.isNaN(numMonth)) {
689
+ throw new Error('AuroDatepickerUtilities | monthValueIsValid: Unable to parse month value integer');
690
+ }
691
+
692
+ // Guard clause: ensure month is within the valid range
693
+ if (numMonth < this.minMonth || numMonth > this.maxMonth) {
694
+ return false;
695
+ }
696
+
697
+ // Default return
698
+ return true;
699
+ };
700
+
701
+ // Validator for year
702
+ const yearIsValid = (_year) => {
703
+
704
+ // Guard clause: ensure year exists.
705
+ if (!_year) {
706
+ return false;
707
+ }
708
+
709
+ // Get the full year
710
+ const year = this.getFourDigitYear(_year);
711
+
712
+ // Convert year to number
713
+ const numYear = Number.parseInt(year, 10);
714
+
715
+ // Guard clause: ensure year is a valid integer
716
+ if (Number.isNaN(numYear)) {
717
+ throw new Error('AuroDatepickerUtilities | yearValueIsValid: Unable to parse year value integer');
718
+ }
719
+
720
+ // Guard clause: ensure year is within the valid range
721
+ if (numYear < this.minYear || numYear > this.maxYear) {
722
+ return false;
723
+ }
724
+
725
+ // Default return
726
+ return true;
727
+ };
728
+
729
+ // Self-contained checks for month, day, and year
730
+ const checks = [
731
+ monthValueIsValid(dateParts.month),
732
+ dayValueIsValid(dateParts.day),
733
+ yearIsValid(dateParts.year)
734
+ ];
735
+
736
+ // If any of the checks failed, the date format does not match and the result is invalid
737
+ const isValid = checks.every((check) => check === true);
738
+
739
+ // If the check is invalid, return false
740
+ if (!isValid) {
741
+ return false;
742
+ }
743
+
744
+ // Default case
745
+ return true;
746
+ };
747
+ }
748
+ }
749
+
750
+ // Export a class instance
751
+ const dateUtilities = new AuroDateUtilities();
752
+
753
+ // Export the class instance methods individually
754
+ const {
755
+ datesMatch,
756
+ validDateStr,
757
+ dateAndFormatMatch,
758
+ minDay,
759
+ minMonth,
760
+ minYear,
761
+ maxDay,
762
+ maxMonth,
763
+ maxYear
764
+ } = dateUtilities;
765
+
766
+ const {
767
+ toNorthAmericanFormat,
768
+ parseDate,
769
+ getDateAsString
770
+ } = dateFormatter;
771
+
772
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
773
+ // See LICENSE in the project root for license information.
774
+
775
+
776
+ class AuroFormValidation {
777
+
778
+ constructor() {
779
+ this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
780
+ }
781
+
782
+ /**
783
+ * Resets the element to its initial state.
784
+ * @private
785
+ * @param {object} elem - HTML element to reset.
786
+ * @returns {void}
787
+ */
788
+ reset(elem) {
789
+ elem.validity = undefined;
790
+ elem.value = undefined;
791
+ elem.touched = false;
792
+
793
+ // Resets the second value of the datepicker in range state
794
+ if (elem.valueEnd) {
795
+ elem.valueEnd = undefined;
796
+ }
797
+
798
+ // Resets selected option of element
799
+ if (elem.optionSelected) {
800
+ elem.optionSelected = undefined;
801
+ }
802
+
803
+ // Runs validation to handle error attribute
804
+ this.validate(elem);
805
+ }
806
+
807
+ /**
808
+ * Validates the attributes of a given element based on predefined validation rules.
809
+ *
810
+ * @param {HTMLElement} elem - The element to be validated.
811
+ * @returns {void}
812
+ *
813
+ * @example
814
+ * // Assuming `inputElement` is a reference to an input element in the DOM
815
+ * validateElementAttributes(inputElement);
816
+ *
817
+ * The function checks the element's attributes against the validation rules defined for 'input' and 'counter' types.
818
+ * If a validation rule is violated, it sets the element's validity state and error message accordingly.
819
+ *
820
+ * Validation rules:
821
+ * - input:
822
+ * - length:
823
+ * - tooShort: Checks if the value length is less than the minimum length.
824
+ * - tooLong: Checks if the value length exceeds the maximum length.
825
+ * - pattern:
826
+ * - patternMismatch: Checks if the value does not match the specified pattern.
827
+ * - counter:
828
+ * - range:
829
+ * - rangeOverflow: Checks if the value exceeds the maximum value.
830
+ * - rangeUnderflow: Checks if the value is less than the minimum value.
831
+ */
832
+ validateElementAttributes(elem) {
833
+ const validationRules = {
834
+ input: {
835
+ length: [
836
+ {
837
+ check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
838
+ validity: 'tooShort',
839
+ message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
840
+ },
841
+ {
842
+ check: (e) => e.value?.length > e.maxLength,
843
+ validity: 'tooLong',
844
+ message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
845
+ }
846
+ ],
847
+ pattern: [
848
+ {
849
+ check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
850
+ validity: 'patternMismatch',
851
+ message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
852
+ }
853
+ ]
854
+ },
855
+ counter: {
856
+ range: [
857
+ {
858
+ check: (e) => e.max !== undefined && Number(e.max) < Number(e.value),
859
+ validity: 'rangeOverflow',
860
+ message: e => e.getAttribute('setCustomValidityRangeOverflow') || ''
861
+ },
862
+ {
863
+ check: (e) => e.min !== undefined && Number(e.min) > Number(e.value),
864
+ validity: 'rangeUnderflow',
865
+ message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
866
+ }
867
+ ]
868
+ }
869
+ };
870
+
871
+ let elementType;
872
+ if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
873
+ elementType = 'input';
874
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
875
+ elementType = 'counter';
876
+ }
877
+
878
+ if (elementType) {
879
+ const rules = validationRules[elementType];
880
+
881
+ if (rules) {
882
+ Object.values(rules).flat().forEach(rule => {
883
+ if (rule.check(elem)) {
884
+ elem.validity = rule.validity;
885
+ elem.errorMessage = rule.message(elem);
886
+ }
887
+ });
888
+ }
889
+ }
890
+ }
891
+
892
+ /**
893
+ * Determines the validity state of the element based on the type attribute.
894
+ * @private
895
+ * @param {object} elem - HTML element to validate.
896
+ * @returns {void}
897
+ */
898
+ validateType(elem) {
899
+ if (elem.hasAttribute('type')) {
900
+ if (elem.type === 'email') {
901
+ const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; // eslint-disable-line require-unicode-regexp
902
+
903
+ if (!elem.value.match(emailRegex)) {
904
+ elem.validity = 'patternMismatch';
905
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
906
+ return;
907
+ }
908
+ } else if (elem.type === 'credit-card') {
909
+ if (elem.value.length > 0 && elem.value.length < elem.validationCCLength) {
910
+ elem.validity = 'tooShort';
911
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
912
+ return;
913
+ }
914
+ } else if (elem.type === 'number') {
915
+ if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) {
916
+ elem.validity = 'rangeOverflow';
917
+ elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
918
+ return;
919
+ }
920
+
921
+ if (elem.min !== undefined && elem.value?.length > 0 && Number(elem.min) > Number(elem.value)) {
922
+ elem.validity = 'rangeUnderflow';
923
+ elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
924
+ return;
925
+ }
926
+ } else if (elem.type === 'date' && elem.value?.length > 0) {
927
+
928
+ // Guard Clause: if the value is too short
929
+ if (elem.value?.length < elem.lengthForType) {
930
+
931
+ elem.validity = 'tooShort';
932
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
933
+ return;
934
+ }
935
+
936
+ // Guard Clause: If the value is too long for the type
937
+ if (elem.value?.length > elem.lengthForType) {
938
+
939
+ elem.validity = 'tooLong';
940
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
941
+ return;
942
+ }
943
+
944
+ // Validate that the date passed was the correct format
945
+ if (!dateAndFormatMatch(elem.value, elem.format)) {
946
+ elem.validity = 'patternMismatch';
947
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || 'Invalid Date Format Entered';
948
+ return;
949
+ }
950
+
951
+ // Validate that the date passed was a valid date
952
+ if (!validDateStr(elem.value, elem.format)) {
953
+ elem.validity = 'invalidDate';
954
+ elem.errorMessage = elem.setCustomValidityInvalidDate || elem.setCustomValidity || 'Invalid Date Entered';
955
+ return;
956
+ }
957
+
958
+ // Perform the rest of the validation
959
+ const formattedValue = toNorthAmericanFormat(elem.value, elem.format);
960
+ const valueDate = new Date(formattedValue);
961
+
962
+ // // Validate max date
963
+ if (elem.max?.length === elem.lengthForType) {
964
+
965
+ const maxDate = new Date(toNorthAmericanFormat(elem.max, elem.format));
966
+
967
+ if (valueDate > maxDate) {
968
+ elem.validity = 'rangeOverflow';
969
+ elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
970
+ return;
971
+ }
972
+ }
973
+
974
+ // Validate min date
975
+ if (elem.min?.length === elem.lengthForType) {
976
+ const minDate = new Date(toNorthAmericanFormat(elem.min, elem.format));
977
+
978
+ if (valueDate < minDate) {
979
+ elem.validity = 'rangeUnderflow';
980
+ elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
981
+ return;
982
+ }
983
+ }
984
+ }
985
+ }
986
+ }
987
+
988
+ /**
989
+ * Determines the validity state of the element.
990
+ * @param {object} elem - HTML element to validate.
991
+ * @param {boolean} force - Boolean that forces validation to run.
992
+ * @returns {void}
993
+ */
994
+ validate(elem, force) {
995
+ this.getInputElements(elem);
996
+ this.getAuroInputs(elem);
997
+
998
+ // Validate only if noValidate is not true and the input does not have focus
999
+ let validationShouldRun =
1000
+ force ||
1001
+ (!elem.contains(document.activeElement) &&
1002
+ (elem.touched ||
1003
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
1004
+ elem.validateOnInput;
1005
+
1006
+ if (elem.hasAttribute('error')) {
1007
+ elem.validity = 'customError';
1008
+ elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
1009
+ validationShouldRun = false;
1010
+ } else if (validationShouldRun) {
1011
+ elem.validity = 'valid';
1012
+ elem.errorMessage = '';
1013
+
1014
+ /**
1015
+ * Only validate once we interact with the datepicker
1016
+ * elem.value === undefined is the initial state pre-interaction.
1017
+ *
1018
+ * The validityState definitions are located at https://developer.mozilla.org/en-US/docs/Web/API/ValidityState.
1019
+ */
1020
+
1021
+ let hasValue = false;
1022
+
1023
+ // Check string for having a value
1024
+ if (typeof elem.value === "string") {
1025
+ hasValue = elem.value && elem.value.length > 0;
1026
+ }
1027
+
1028
+ // Check array value types for having a value
1029
+ if (Array.isArray(elem.value)) {
1030
+ hasValue = Boolean(
1031
+ elem.value.length > 0 &&
1032
+ elem.value.some((value) => typeof value === "string" && value.length > 0)
1033
+ );
1034
+ }
1035
+
1036
+ // If there is a second input in the elem and that value is undefined or an empty string set hasValue to false;
1037
+ if (this.auroInputElements?.length === 2) {
1038
+ if (!this.auroInputElements[1].value || this.auroInputElements[1].length === 0) {
1039
+ hasValue = false;
1040
+ }
1041
+ }
1042
+
1043
+ if (!hasValue && elem.required && elem.touched) {
1044
+ elem.validity = 'valueMissing';
1045
+ elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
1046
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
1047
+ this.validateType(elem);
1048
+ this.validateElementAttributes(elem);
1049
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
1050
+ this.validateElementAttributes(elem);
1051
+ }
1052
+ }
1053
+
1054
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
1055
+ elem.validity = this.auroInputElements[0].validity;
1056
+ elem.errorMessage = this.auroInputElements[0].errorMessage;
1057
+
1058
+ if (elem.validity === 'valid' && this.auroInputElements.length > 1) {
1059
+ elem.validity = this.auroInputElements[1].validity;
1060
+ elem.errorMessage = this.auroInputElements[1].errorMessage;
1061
+ }
1062
+ }
1063
+
1064
+ if (validationShouldRun || elem.hasAttribute('error')) {
1065
+ // Use the validity message override if it is declared
1066
+ if (elem.validity && elem.validity !== 'valid' && elem.ValidityMessageOverride) {
1067
+ elem.errorMessage = elem.ValidityMessageOverride;
1068
+ }
1069
+
1070
+ this.getErrorMessage(elem);
1071
+
1072
+ elem.dispatchEvent(new CustomEvent('auroFormElement-validated', {
1073
+ bubbles: true,
1074
+ composed: true,
1075
+ detail: {
1076
+ validity: elem.validity,
1077
+ message: elem.errorMessage
1078
+ }
1079
+ }));
1080
+ }
1081
+ }
1082
+
1083
+ /**
1084
+ * Gets all the HTML5 `inputs` in the element shadow DOM.
1085
+ * @private
1086
+ * @param {object} elem - HTML element to validate.
1087
+ * @returns {void}
1088
+ */
1089
+ getInputElements(elem) {
1090
+ this.inputElements = elem.renderRoot.querySelectorAll('input');
1091
+ }
1092
+
1093
+ /**
1094
+ * Gets all the `auro-inputs` in the element shadow DOM.
1095
+ * @private
1096
+ * @param {object} elem - HTML element to validate.
1097
+ * @returns {void}
1098
+ */
1099
+ getAuroInputs(elem) {
1100
+ this.auroInputElements = elem.shadowRoot.querySelectorAll('auro-input, [auro-input]');
1101
+ }
1102
+
1103
+ /**
1104
+ * Return appropriate error message.
1105
+ * @private
1106
+ * @param {object} elem - HTML element to validate.
1107
+ * @returns {void}
1108
+ */
1109
+ getErrorMessage(elem) {
1110
+ if (elem.validity !== 'valid') {
1111
+ if (elem.setCustomValidity) {
1112
+ elem.errorMessage = elem.setCustomValidity;
1113
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-input') && elem.errorMessage === '') {
1114
+ const input = elem.renderRoot.querySelector('input');
1115
+
1116
+ if (input.validationMessage.length > 0) {
1117
+ elem.errorMessage = input.validationMessage;
1118
+ }
1119
+ } else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
1120
+ const firstInput = this.inputElements[0];
1121
+
1122
+ if (firstInput.validationMessage.length > 0) {
1123
+ elem.errorMessage = firstInput.validationMessage;
1124
+ } else if (this.inputElements?.length === 2) {
1125
+ const secondInput = this.inputElements[1];
1126
+
1127
+ if (secondInput.validationMessage.length > 0) {
1128
+ elem.errorMessage = secondInput.validationMessage;
1129
+ }
1130
+ }
1131
+ }
1132
+ } else {
1133
+ elem.errorMessage = '';
1134
+ }
1135
+ }
1136
+ }
1137
+
1138
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1139
+ // See LICENSE in the project root for license information.
1140
+
1141
+
1142
+ class AuroDependencyVersioning {
1143
+
1144
+ /**
1145
+ * Generates a unique string to be used for child auro element naming.
1146
+ * @private
1147
+ * @param {string} baseName - Defines the first part of the unique element name.
1148
+ * @param {string} version - Version of the component that will be appended to the baseName.
1149
+ * @returns {string} - Unique string to be used for naming.
1150
+ */
1151
+ generateElementName(baseName, version) {
1152
+ let result = baseName;
1153
+
1154
+ result += '-';
1155
+ result += version.replace(/[.]/g, '_');
1156
+
1157
+ return result;
1158
+ }
1159
+
1160
+ /**
1161
+ * Generates a unique string to be used for child auro element naming.
1162
+ * @param {string} baseName - Defines the first part of the unique element name.
1163
+ * @param {string} version - Version of the component that will be appended to the baseName.
1164
+ * @returns {string} - Unique string to be used for naming.
1165
+ */
1166
+ generateTag(baseName, version, tagClass) {
1167
+ const elementName = this.generateElementName(baseName, version);
1168
+ const tag = literal`${unsafeStatic(elementName)}`;
1169
+
1170
+ if (!customElements.get(elementName)) {
1171
+ customElements.define(elementName, class extends tagClass {});
1172
+ }
1173
+
1174
+ return tag;
1175
+ }
1176
+ }
1177
+
1178
+ var colorCss = css`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
1179
+
1180
+ var styleCss = css`.helptext-wrapper{display:none;font-size:var(--ds-basic-text-body-xs-font-size, 12px);font-weight:var(--ds-basic-text-body-xs-font-weight, 450);letter-spacing:var(--ds-basic-text-body-xs-letter-spacing, 0);line-height:var(--ds-basic-text-body-xs-line-height, 16px)}:host([large]) .helptext-wrapper{font-size:var(--ds-basic-text-body-default-font-size, 16px);font-weight:var(--ds-basic-text-body-default-font-weight, 450);letter-spacing:var(--ds-basic-text-body-default-letter-spacing, 0);line-height:var(--ds-basic-text-body-default-line-height, 24px)}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
1181
+
1182
+ var tokensCss = css`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
1183
+
1184
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1185
+ // See LICENSE in the project root for license information.
1186
+
1187
+ // ---------------------------------------------------------------------
1188
+
1189
+ /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
1190
+
1191
+ class AuroLibraryRuntimeUtils {
1192
+
1193
+ /* eslint-disable jsdoc/require-param */
1194
+
1195
+ /**
1196
+ * This will register a new custom element with the browser.
1197
+ * @param {String} name - The name of the custom element.
1198
+ * @param {Object} componentClass - The class to register as a custom element.
1199
+ * @returns {void}
1200
+ */
1201
+ registerComponent(name, componentClass) {
1202
+ if (!customElements.get(name)) {
1203
+ customElements.define(name, class extends componentClass {});
1204
+ }
1205
+ }
1206
+
1207
+ /**
1208
+ * Finds and returns the closest HTML Element based on a selector.
1209
+ * @returns {void}
1210
+ */
1211
+ closestElement(
1212
+ selector, // selector like in .closest()
1213
+ base = this, // extra functionality to skip a parent
1214
+ __Closest = (el, found = el && el.closest(selector)) =>
1215
+ !el || el === document || el === window
1216
+ ? null // standard .closest() returns null for non-found selectors also
1217
+ : found
1218
+ ? found // found a selector INside this element
1219
+ : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
1220
+ ) {
1221
+ return __Closest(base);
1222
+ }
1223
+ /* eslint-enable jsdoc/require-param */
1224
+
1225
+ /**
1226
+ * 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.
1227
+ * @param {Object} elem - The element to check.
1228
+ * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
1229
+ * @returns {void}
1230
+ */
1231
+ handleComponentTagRename(elem, tagName) {
1232
+ const tag = tagName.toLowerCase();
1233
+ const elemTag = elem.tagName.toLowerCase();
1234
+
1235
+ if (elemTag !== tag) {
1236
+ elem.setAttribute(tag, true);
1237
+ }
1238
+ }
1239
+
1240
+ /**
1241
+ * Validates if an element is a specific Auro component.
1242
+ * @param {Object} elem - The element to validate.
1243
+ * @param {String} tagName - The name of the Auro component to check against.
1244
+ * @returns {Boolean} - Returns true if the element is the specified Auro component.
1245
+ */
1246
+ elementMatch(elem, tagName) {
1247
+ const tag = tagName.toLowerCase();
1248
+ const elemTag = elem.tagName.toLowerCase();
1249
+
1250
+ return elemTag === tag || elem.hasAttribute(tag);
1251
+ }
1252
+ }
1253
+
1254
+ // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1255
+ // See LICENSE in the project root for license information.
1256
+
1257
+
1258
+ /**
1259
+ * Displays help text or error messages within form elements - Internal Use Only.
1260
+ *
1261
+ * @attr { Boolean } large - If declared, make font-size to 1rem(16px).
1262
+ */
1263
+ class AuroHelpText extends LitElement {
1264
+
1265
+ constructor() {
1266
+ super();
1267
+
1268
+ this.error = false;
1269
+ this.onDark = false;
1270
+ this.hasTextContent = false;
1271
+
1272
+ AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-helptext');
1273
+ }
1274
+
1275
+ static get styles() {
1276
+ return [
1277
+ colorCss,
1278
+ styleCss,
1279
+ tokensCss
1280
+ ];
1281
+ }
1282
+
1283
+ // function to define props used within the scope of this component
1284
+ static get properties() {
1285
+ return {
1286
+
1287
+ /**
1288
+ * @private
1289
+ */
1290
+ slotNodes: {
1291
+ type: Boolean,
1292
+ },
1293
+
1294
+ /**
1295
+ * @private
1296
+ */
1297
+ hasTextContent: {
1298
+ type: Boolean,
1299
+ },
1300
+
1301
+ /**
1302
+ * If declared, make font color red.
1303
+ */
1304
+ error: {
1305
+ type: Boolean,
1306
+ reflect: true,
1307
+ },
1308
+
1309
+ /**
1310
+ * If declared, will apply onDark styles.
1311
+ */
1312
+ onDark: {
1313
+ type: Boolean,
1314
+ reflect: true
1315
+ }
1316
+ };
1317
+ }
1318
+
1319
+ /**
1320
+ * This will register this element with the browser.
1321
+ * @param {string} [name="auro-helptext"] - The name of element that you want to register to.
1322
+ *
1323
+ * @example
1324
+ * AuroCheckbox.register("custom-helptext") // this will register this element to <custom-helptext/>
1325
+ *
1326
+ */
1327
+ static register(name = "auro-helptext") {
1328
+ AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroHelpText);
1329
+ }
1330
+
1331
+ updated() {
1332
+ this.handleSlotChange();
1333
+ }
1334
+
1335
+ handleSlotChange(event) {
1336
+ if (event) {
1337
+ this.slotNodes = event.target.assignedNodes();
1338
+ }
1339
+
1340
+ this.hasTextContent = this.checkSlotsForContent(this.slotNodes);
1341
+ }
1342
+
1343
+ /**
1344
+ * Checks if any of the provided nodes or their nested slot nodes contain non-empty text content.
1345
+ *
1346
+ * @param {NodeList|Array} nodes - The list of nodes to check for content.
1347
+ * @returns {boolean} - Returns true if any node or nested slot node contains non-empty text content, otherwise false.
1348
+ * @private
1349
+ */
1350
+ checkSlotsForContent(nodes) {
1351
+ if (!nodes) {
1352
+ return false;
1353
+ }
1354
+
1355
+ return nodes.some((node) => {
1356
+ if (node.textContent.trim()) {
1357
+ return true;
1358
+ }
1359
+
1360
+ if (!node.querySelector) {
1361
+ return false;
1362
+ }
1363
+
1364
+ const nestedSlot = node.tagName === 'SLOT' ? node : node.querySelector('slot');
1365
+ if (!nestedSlot) {
1366
+ return false;
1367
+ }
1368
+
1369
+ const nestedSlotNodes = nestedSlot.assignedNodes();
1370
+ return this.checkSlotsForContent(nestedSlotNodes);
1371
+ });
1372
+ }
1373
+
1374
+ // function that renders the HTML and CSS into the scope of the component
1375
+ render() {
1376
+ return html`
1377
+ <div class="helptext-wrapper" ?visible="${this.hasTextContent}">
1378
+ <slot @slotchange=${this.handleSlotChange}></slot>
1379
+ </div>
1380
+ `;
1381
+ }
1382
+ }
1383
+
1384
+ var helpTextVersion = '1.0.0';
1385
+
1386
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1387
+ // See LICENSE in the project root for license information.
1388
+ // ---------------------------------------------------------------------
1389
+
1390
+
1391
+ /* eslint no-magic-numbers: ["error", { "ignore": [0, 1, -1] }] */
1392
+ /* eslint-disable max-lines, lit/binding-positions, lit/no-invalid-html */
1393
+
1394
+ /**
1395
+ * @attr {String} validity - Specifies the `validityState` this element is in.
1396
+ * @attr {String} setCustomValidity - Sets a custom help text message to display for all validityStates.
1397
+ * @attr {String} setCustomValidityCustomError - Custom help text message to display when validity = `customError`.
1398
+ * @attr {String} setCustomValidityValueMissing - Custom help text message to display when validity = `valueMissing`.
1399
+ * @attr {String} error - When defined, sets persistent validity to `customError` and sets `setCustomValidity` = attribute value.
1400
+ * @attr {Boolean} noValidate - If set, disables auto-validation on blur.
1401
+ * @attr {Boolean} onDark - Applies dark mode styles to the component.
1402
+ * @attr {Boolean} required - Populates the `required` attribute on the element. Used for client-side validation.
1403
+ * @attr {Object} optionSelected - Specifies the current selected radio button.
1404
+ * @csspart radio-group - Apply css to the fieldset element in the shadow DOM
1405
+ * @slot {HTMLSlotElement} legend - Allows for the legend to be overridden.
1406
+ * @slot {HTMLSlotElement} optionalLabel - Allows for the optional label to be overridden.
1407
+ * @slot {HTMLSlotElement} helpText - Allows for the helper text to be overridden.
1408
+ * @event auroFormElement-validated - Notifies that the element has been validated.
1409
+ * @event input - Notifies every time the value prop of the element is changed.
1410
+ */
1411
+
1412
+ class AuroRadioGroup extends LitElement {
1413
+ constructor() {
1414
+ super();
1415
+ this.disabled = false;
1416
+ this.horizontal = false;
1417
+ this.required = false;
1418
+ this.validity = undefined;
1419
+ this.value = undefined;
1420
+ this.optionSelected = undefined;
1421
+ this.onDark = false;
1422
+ this.touched = false;
1423
+
1424
+ /**
1425
+ * @private
1426
+ */
1427
+ this.validation = new AuroFormValidation();
1428
+
1429
+ /**
1430
+ * @private
1431
+ */
1432
+ this.index = 0;
1433
+
1434
+ /**
1435
+ * @private
1436
+ */
1437
+ this.max = 3;
1438
+
1439
+ /**
1440
+ * @private
1441
+ */
1442
+ this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
1443
+
1444
+ /**
1445
+ * Generate unique names for dependency components.
1446
+ */
1447
+ const versioning = new AuroDependencyVersioning();
1448
+
1449
+ /**
1450
+ * @private
1451
+ */
1452
+ this.helpTextTag = versioning.generateTag('auro-formkit-radio-helptext', helpTextVersion, AuroHelpText);
1453
+ }
1454
+
1455
+ static get styles() {
1456
+ return [
1457
+ styleCss$1,
1458
+ colorCss$1,
1459
+ tokenCss
1460
+ ];
1461
+ }
1462
+
1463
+ static get properties() {
1464
+ return {
1465
+ disabled: {
1466
+ type: Boolean,
1467
+ reflect: true
1468
+ },
1469
+ horizontal: { type: Boolean },
1470
+ error: {
1471
+ type: String,
1472
+ reflect: true
1473
+ },
1474
+ value: {
1475
+ type: String
1476
+ },
1477
+ noValidate: {
1478
+ type: Boolean,
1479
+ reflect: true
1480
+ },
1481
+ onDark: {
1482
+ type: Boolean,
1483
+ reflect: true
1484
+ },
1485
+ required: {
1486
+ type: Boolean,
1487
+ reflect: true
1488
+ },
1489
+ setCustomValidity: {
1490
+ type: String
1491
+ },
1492
+ setCustomValidityCustomError: {
1493
+ type: String
1494
+ },
1495
+ setCustomValidityValueMissing: {
1496
+ type: String
1497
+ },
1498
+ validity: {
1499
+ type: String,
1500
+ reflect: true
1501
+ },
1502
+ optionSelected: {
1503
+ type: Object
1504
+ },
1505
+
1506
+ /**
1507
+ * Indicates whether the radio group is in a dirty state (has been interacted with).
1508
+ * @type {boolean}
1509
+ * @default false
1510
+ * @private
1511
+ */
1512
+ touched: {
1513
+ type: Boolean,
1514
+ reflect: true,
1515
+ attribute: false
1516
+ }
1517
+ };
1518
+ }
1519
+
1520
+ /**
1521
+ * This will register this element with the browser.
1522
+ * @param {string} [name="auro-radio-group"] - The name of element that you want to register to.
1523
+ *
1524
+ * @example
1525
+ * AuroRadioGroup.register("custom-radio-group") // This will register this element to <custom-radio-group/>
1526
+ *
1527
+ */
1528
+ static register(name = "auro-radio-group") {
1529
+ AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroRadioGroup);
1530
+ }
1531
+
1532
+ connectedCallback() {
1533
+ super.connectedCallback();
1534
+ this.handleItems();
1535
+ this.addEventListener('toggleSelected', this.handleToggleSelected);
1536
+ this.addEventListener('keydown', this.handleKeyDown);
1537
+ this.addEventListener('resetRadio', this.resetRadio);
1538
+ this.addEventListener('auroRadio-blur', this.handleRadioBlur);
1539
+ this.addEventListener('auroRadio-selected', this.handleSelection);
1540
+ }
1541
+
1542
+ firstUpdated() {
1543
+ // Add the tag name as an attribute if it is different than the component name
1544
+ this.runtimeUtils.handleComponentTagRename(this, 'auro-radio-group');
1545
+ }
1546
+
1547
+ /**
1548
+ * Method for handling of selection of a radio element.
1549
+ * @private
1550
+ * @param {Event} event - The trigger event tied to this function.
1551
+ * @returns {void}
1552
+ */
1553
+ handleSelection(event) {
1554
+ if (event.target.value) {
1555
+ this.value = event.target.value;
1556
+ } else {
1557
+ this.value = '';
1558
+ }
1559
+
1560
+ this.optionSelected = event.target;
1561
+
1562
+ this.validation.validate(this);
1563
+ }
1564
+
1565
+ /**
1566
+ * Method handles radio element blur.
1567
+ * @private
1568
+ * @returns {void}
1569
+ */
1570
+ handleRadioBlur() {
1571
+ this.touched = true;
1572
+ this.validation.validate(this);
1573
+ }
1574
+
1575
+ /**
1576
+ * LitElement lifecycle method. Called after the DOM has been updated.
1577
+ * @param {Map<string, any>} changedProperties - Keys are the names of changed properties, values are the corresponding previous values.
1578
+ * @returns {void}
1579
+ */
1580
+ updated(changedProperties) {
1581
+ if (changedProperties.has('disabled')) {
1582
+ // only change the children if we are making everything disabled, or if we are making everything enabled and there are no individually-disabled radio buttons
1583
+ if (this.disabled || this.items.every((el) => el.disabled)) {
1584
+ this.items.forEach((el) => {
1585
+ el.disabled = this.disabled;
1586
+ });
1587
+ }
1588
+ }
1589
+
1590
+ if (changedProperties.has('value')) {
1591
+ this.dispatchEvent(new CustomEvent('input', {
1592
+ bubbles: true,
1593
+ cancelable: true,
1594
+ composed: true,
1595
+ }));
1596
+ }
1597
+
1598
+ if (changedProperties.has('required')) {
1599
+ this.items.forEach((el) => {
1600
+ el.required = this.required;
1601
+ });
1602
+ }
1603
+
1604
+ if (changedProperties.has('onDark')) {
1605
+ this.items.forEach((el) => {
1606
+ el.onDark = this.onDark;
1607
+ });
1608
+ }
1609
+
1610
+ if (changedProperties.has('error')) {
1611
+ this.validate(true);
1612
+ }
1613
+
1614
+ if (changedProperties.has('validity')) {
1615
+ if (this.validity && this.validity !== 'valid') {
1616
+ this.items.forEach((el) => {
1617
+ el.setAttribute('error', true);
1618
+ });
1619
+ } else {
1620
+ this.items.forEach((el) => {
1621
+ el.removeAttribute('error');
1622
+ });
1623
+ }
1624
+ }
1625
+ }
1626
+
1627
+ /**
1628
+ * Resets component to initial state.
1629
+ * @returns {void}
1630
+ */
1631
+ reset() {
1632
+ // Sets first radio button to receive focus during keyboard navigation
1633
+ this.index = 0;
1634
+
1635
+ const buttons = this.querySelectorAll('auro-radio, [auro-radio]');
1636
+
1637
+ buttons.forEach((button) => {
1638
+ button.reset();
1639
+ });
1640
+
1641
+ this.validation.reset(this);
1642
+ }
1643
+
1644
+ /**
1645
+ * Validates value.
1646
+ * @param {boolean} [force=false] - Whether to force validation.
1647
+ */
1648
+ validate(force = false) {
1649
+ this.validation.validate(this, force);
1650
+ }
1651
+
1652
+ /**
1653
+ * Method handles the reset event from a radio element.
1654
+ * @private
1655
+ * @returns {void}
1656
+ */
1657
+ resetRadio() {
1658
+ if (this.items.length === 0) {
1659
+ this.handleItems();
1660
+ }
1661
+
1662
+ // handle tab index
1663
+ this.items.forEach((item) => {
1664
+ item.tabIndex = -1;
1665
+ });
1666
+
1667
+ if (!this.disabled) {
1668
+ this.items[this.index].tabIndex = 0;
1669
+ }
1670
+ }
1671
+
1672
+ /**
1673
+ * Method for handling the attributes of each radio input.
1674
+ * @private
1675
+ * @returns {void}
1676
+ */
1677
+ handleItems() {
1678
+ this.items = [...this.querySelectorAll(':scope auro-radio, :scope [auro-radio]')];
1679
+ this.initializeIndex();
1680
+
1681
+ if (this.disabled) {
1682
+ this.items.forEach((el) => {
1683
+ el.disabled = this.disabled;
1684
+ });
1685
+ }
1686
+
1687
+ this.items.forEach((el) => {
1688
+ el.required = this.required;
1689
+ el.error = Boolean(this.error);
1690
+ });
1691
+ }
1692
+
1693
+ /**
1694
+ * Method for handling slot content changes.
1695
+ * @private
1696
+ * @returns {void}
1697
+ */
1698
+ handleSlotChange() {
1699
+ this.handleItems();
1700
+ }
1701
+
1702
+ /**
1703
+ * Method for initializing the tab index of the checked radio input.
1704
+ * @private
1705
+ * @returns {void}
1706
+ */
1707
+ initializeIndex() {
1708
+ if (!this.disabled) {
1709
+ const index = this.items.findIndex((item) => item.hasAttribute('checked') && !item.hasAttribute('disabled'));
1710
+ const nextEnabledIndex = this.items.findIndex((item) => !item.hasAttribute('disabled'));
1711
+
1712
+ this.index = index >= 0 ? index : nextEnabledIndex;
1713
+
1714
+ if (this.index >= 0) {
1715
+ this.items[this.index].tabIndex = 0;
1716
+ }
1717
+ }
1718
+ }
1719
+
1720
+ /**
1721
+ * Method for handling a newly selected radio input.
1722
+ * @private
1723
+ * @param {Event} event - The trigger event tied to this function.
1724
+ * @returns {void}
1725
+ */
1726
+ handleToggleSelected(event) {
1727
+ this.index = this.items.indexOf(event.target);
1728
+
1729
+ this.items.forEach((item) => {
1730
+ if (item === event.target) {
1731
+ item.tabIndex = 0;
1732
+ if (event.target.value) {
1733
+ this.value = event.target.value;
1734
+ }
1735
+ } else {
1736
+ const sdInput = item.shadowRoot.querySelector('input');
1737
+
1738
+ sdInput.checked = false;
1739
+ item.checked = false;
1740
+ item.tabIndex = -1;
1741
+ }
1742
+ });
1743
+
1744
+ this.optionSelected = event.target;
1745
+
1746
+ this.validation.validate(this);
1747
+ }
1748
+
1749
+ /**
1750
+ * Method for selecting a radio input.
1751
+ * @private
1752
+ * @param {Number} index - The value of the element's index attribute.
1753
+ * @returns {void}
1754
+ */
1755
+ selectItem(index) {
1756
+ const sdItem = this.items[index].shadowRoot.querySelector('input');
1757
+
1758
+ sdItem.click();
1759
+ sdItem.focus();
1760
+ this.index = index;
1761
+ }
1762
+
1763
+ /**
1764
+ * Method for selecting the next radio input.
1765
+ * @private
1766
+ * @param {Number} index - The value of the element's index attribute.
1767
+ * @param {String} moveDirection - Arrow key pressed by user.
1768
+ * @returns {void}
1769
+ */
1770
+ selectNextItem(index, moveDirection) {
1771
+ let currIndex = index;
1772
+
1773
+ for (currIndex; currIndex < this.items.length; moveDirection === "Down" ? currIndex += 1 : currIndex -= 1) {
1774
+ currIndex = currIndex === -1 ? this.items.length - 1 : currIndex;
1775
+ const sdItem = this.items[currIndex].shadowRoot.querySelector('input');
1776
+
1777
+ if (this.disabled || this.items.every((item) => item.disabled === true)) {
1778
+ sdItem.focus();
1779
+ break;
1780
+ }
1781
+ if (!sdItem.disabled) {
1782
+ sdItem.click();
1783
+ sdItem.focus();
1784
+ this.index = currIndex;
1785
+ break;
1786
+ }
1787
+ }
1788
+ }
1789
+
1790
+ /**
1791
+ * Method for handling a keydown event.
1792
+ * @private
1793
+ * @param {Event} event - The trigger event tied to this function.
1794
+ * @returns {void}
1795
+ */
1796
+ handleKeyDown(event) {
1797
+ switch (event.key) {
1798
+ case " ":
1799
+ event.preventDefault();
1800
+ this.selectItem(this.index);
1801
+ break;
1802
+
1803
+ case "Down":
1804
+ case "ArrowDown":
1805
+ case "Right":
1806
+ case "ArrowRight":
1807
+ event.preventDefault();
1808
+ this.selectNextItem(this.index === this.items.length - 1 ? 0 : this.index + 1, "Down");
1809
+ break;
1810
+
1811
+ case "Up":
1812
+ case "ArrowUp":
1813
+ case "Left":
1814
+ case "ArrowLeft":
1815
+ event.preventDefault();
1816
+ this.selectNextItem(this.index === 0 ? this.items.length - 1 : this.index - 1, "Up");
1817
+ break;
1818
+ }
1819
+ }
1820
+
1821
+ // function that renders the HTML and CSS into the scope of the component
1822
+ render() {
1823
+ const groupClasses = {
1824
+ 'displayFlex': this.horizontal && this.items.length <= this.max
1825
+ };
1826
+
1827
+ return html$1`
1828
+ <fieldset class="${classMap(groupClasses)}" part="radio-group">
1829
+ ${this.required
1830
+ ? html$1`<legend><slot name="legend"></slot></legend>`
1831
+ : html$1`<legend><slot name="legend"></slot> <slot name="optionalLabel">(optional)</slot></legend>`
1832
+ }
1833
+ <slot @slotchange=${this.handleSlotChange}></slot>
1834
+ </fieldset>
1835
+
1836
+ ${!this.validity || this.validity === undefined || this.validity === 'valid'
1837
+ ? html$1`
1838
+ <${this.helpTextTag} large ?onDark="${this.onDark}" part="helpText">
1839
+ <slot name="helpText"></slot>
1840
+ </${this.helpTextTag}>`
1841
+ : html$1`
1842
+ <${this.helpTextTag} large ?onDark="${this.onDark}" role="alert" error aria-live="assertive" part="helpText">
1843
+ ${this.errorMessage}
1844
+ </${this.helpTextTag}>`
1845
+ }
1846
+ `;
1847
+ }
1848
+ }
1849
+
1850
+ export { AuroRadio, AuroRadioGroup };