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