@aurodesignsystem/auro-formkit 2.0.0-beta.8 → 2.0.0-beta.9

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 (288) hide show
  1. package/.turbo/cache/012997da408d7381-meta.json +1 -0
  2. package/.turbo/cache/0c8124a987c1cc05-meta.json +1 -1
  3. package/.turbo/cache/114f70925d97840c-meta.json +1 -0
  4. package/.turbo/cache/114f70925d97840c.tar.zst +0 -0
  5. package/.turbo/cache/144803363093af6b-meta.json +1 -0
  6. package/.turbo/cache/18129dba20f51b6b-meta.json +1 -1
  7. package/.turbo/cache/19afa09c8e45c25d-meta.json +1 -0
  8. package/.turbo/cache/19afa09c8e45c25d.tar.zst +0 -0
  9. package/.turbo/cache/20a17be1e896dc95-meta.json +1 -0
  10. package/.turbo/cache/20a17be1e896dc95.tar.zst +0 -0
  11. package/.turbo/cache/2624bedf18a03ab1-meta.json +1 -0
  12. package/.turbo/cache/2624bedf18a03ab1.tar.zst +0 -0
  13. package/.turbo/cache/2706814699cff63a-meta.json +1 -0
  14. package/.turbo/cache/2787020e69f50af2-meta.json +1 -1
  15. package/.turbo/cache/29d704afd7578cda-meta.json +1 -0
  16. package/.turbo/cache/2edcc8b31cd713fc-meta.json +1 -0
  17. package/.turbo/cache/2edcc8b31cd713fc.tar.zst +0 -0
  18. package/.turbo/cache/318a9085a92f2d32-meta.json +1 -0
  19. package/.turbo/cache/326d9e4692d61af1-meta.json +1 -0
  20. package/.turbo/cache/326d9e4692d61af1.tar.zst +0 -0
  21. package/.turbo/cache/36962b1c4c89a3a2-meta.json +1 -0
  22. package/.turbo/cache/{0ca9c5ccf3e90704.tar.zst → 36962b1c4c89a3a2.tar.zst} +0 -0
  23. package/.turbo/cache/3cd8fc5f388323db-meta.json +1 -1
  24. package/.turbo/cache/3f8ea42b850fd7b1-meta.json +1 -0
  25. package/.turbo/cache/3f8ea42b850fd7b1.tar.zst +0 -0
  26. package/.turbo/cache/4006a206400d5c7b-meta.json +1 -1
  27. package/.turbo/cache/457af7906413d2ff-meta.json +1 -0
  28. package/.turbo/cache/492dda333b8d15f1-meta.json +1 -1
  29. package/.turbo/cache/508f2fcc60e5046f-meta.json +1 -0
  30. package/.turbo/cache/508f2fcc60e5046f.tar.zst +0 -0
  31. package/.turbo/cache/50993de942ec15a9-meta.json +1 -1
  32. package/.turbo/cache/51eaa58d5c167de8-meta.json +1 -1
  33. package/.turbo/cache/5567d6b2fdae56a9-meta.json +1 -0
  34. package/.turbo/cache/5a6290b52b84f5ef-meta.json +1 -0
  35. package/.turbo/cache/5a6290b52b84f5ef.tar.zst +0 -0
  36. package/.turbo/cache/5aadae8d3f94202e-meta.json +1 -1
  37. package/.turbo/cache/6081837e8943b62e-meta.json +1 -0
  38. package/.turbo/cache/6081837e8943b62e.tar.zst +0 -0
  39. package/.turbo/cache/60ad74320c682a2b-meta.json +1 -1
  40. package/.turbo/cache/61e218aba69cff58-meta.json +1 -1
  41. package/.turbo/cache/64ac8d6a4669ba20-meta.json +1 -0
  42. package/.turbo/cache/64ac8d6a4669ba20.tar.zst +0 -0
  43. package/.turbo/cache/706649b429184693-meta.json +1 -0
  44. package/.turbo/cache/706649b429184693.tar.zst +0 -0
  45. package/.turbo/cache/71dbeaf0706c12fe-meta.json +1 -1
  46. package/.turbo/cache/7445df6e7feed2a7-meta.json +1 -1
  47. package/.turbo/cache/769652d1b874d7cf-meta.json +1 -0
  48. package/.turbo/cache/77da375a012de9d0-meta.json +1 -1
  49. package/.turbo/cache/7bf2b06a479d0b30-meta.json +1 -1
  50. package/.turbo/cache/7c4645de5001b034-meta.json +1 -0
  51. package/.turbo/cache/7c4645de5001b034.tar.zst +0 -0
  52. package/.turbo/cache/7e3244d67de2d977-meta.json +1 -0
  53. package/.turbo/cache/7e3244d67de2d977.tar.zst +0 -0
  54. package/.turbo/cache/7f3b42ddf36d0158-meta.json +1 -1
  55. package/.turbo/cache/804ad767c7ba2fc3-meta.json +1 -0
  56. package/.turbo/cache/8366405184d123d2-meta.json +1 -0
  57. package/.turbo/cache/8366405184d123d2.tar.zst +0 -0
  58. package/.turbo/cache/85cc23a2de6b1009-meta.json +1 -0
  59. package/.turbo/cache/99936b010f1533f9-meta.json +1 -0
  60. package/.turbo/cache/{dc6fbe2a8d5b9d9b.tar.zst → 99936b010f1533f9.tar.zst} +0 -0
  61. package/.turbo/cache/9a9b4e449cd84be4-meta.json +1 -1
  62. package/.turbo/cache/9ae99e8e7bd83d06-meta.json +1 -1
  63. package/.turbo/cache/a275406512608e45-meta.json +1 -1
  64. package/.turbo/cache/a54b4d75b5d265de-meta.json +1 -0
  65. package/.turbo/cache/b280ed4daaf15dcb-meta.json +1 -0
  66. package/.turbo/cache/b5e6dc7fb9ae1a2f-meta.json +1 -1
  67. package/.turbo/cache/b6a202cc85cb61a0-meta.json +1 -1
  68. package/.turbo/cache/c44efc9e4ddd8a0e-meta.json +1 -1
  69. package/.turbo/cache/c47b8032d18fc452-meta.json +1 -0
  70. package/.turbo/cache/c47b8032d18fc452.tar.zst +0 -0
  71. package/.turbo/cache/c6c6411199b68170-meta.json +1 -1
  72. package/.turbo/cache/d3a05e38449c9b24-meta.json +1 -1
  73. package/.turbo/cache/d44acd685455b288-meta.json +1 -0
  74. package/.turbo/cache/d5db503b2eaf239c-meta.json +1 -1
  75. package/.turbo/cache/d683a7d23b0d7073-meta.json +1 -0
  76. package/.turbo/cache/d683a7d23b0d7073.tar.zst +0 -0
  77. package/.turbo/cache/d7caaacb8114772f-meta.json +1 -0
  78. package/.turbo/cache/d7caaacb8114772f.tar.zst +0 -0
  79. package/.turbo/cache/dad3d78b33edd9e4-meta.json +1 -0
  80. package/.turbo/cache/dad3d78b33edd9e4.tar.zst +0 -0
  81. package/.turbo/cache/db4ea5071b44ee8c-meta.json +1 -1
  82. package/.turbo/cache/de44707e76bdd80c-meta.json +1 -0
  83. package/.turbo/cache/de44707e76bdd80c.tar.zst +0 -0
  84. package/.turbo/cache/e03997efe5adad43-meta.json +1 -0
  85. package/.turbo/cache/e1aa836f0cc2d7c5-meta.json +1 -0
  86. package/.turbo/cache/e1aa836f0cc2d7c5.tar.zst +0 -0
  87. package/.turbo/cache/e62cfee068e3ef36-meta.json +1 -1
  88. package/.turbo/cache/e820cc8f220a05f3-meta.json +1 -0
  89. package/.turbo/cache/e9e36823f6c98f07-meta.json +1 -0
  90. package/.turbo/cache/e9e36823f6c98f07.tar.zst +0 -0
  91. package/.turbo/cache/f3f4ddfd3230e489-meta.json +1 -0
  92. package/.turbo/cache/f3f4ddfd3230e489.tar.zst +0 -0
  93. package/.turbo/cache/fdaf484b1ec4b5ed-meta.json +1 -0
  94. package/.vscode/settings.json +3 -0
  95. package/CHANGELOG.md +20 -0
  96. package/components/checkbox/.turbo/turbo-build.log +3 -3
  97. package/components/checkbox/.turbo/turbo-bundler.log +3 -3
  98. package/components/checkbox/README.md +1 -1
  99. package/components/checkbox/demo/api.min.js +79 -20
  100. package/components/checkbox/demo/index.min.js +79 -20
  101. package/components/checkbox/dist/index.js +79 -20
  102. package/components/combobox/.turbo/turbo-build.log +3 -3
  103. package/components/combobox/.turbo/turbo-bundler.log +3 -3
  104. package/components/combobox/README.md +4 -4
  105. package/components/combobox/demo/api.min.js +160 -42
  106. package/components/combobox/demo/index.min.js +160 -42
  107. package/components/combobox/dist/index.js +158 -40
  108. package/components/counter/.turbo/turbo-build$colon$sass.log +172 -0
  109. package/components/counter/.turbo/turbo-build$colon$version.log +10 -0
  110. package/components/counter/.turbo/turbo-build.log +278 -4
  111. package/components/counter/.turbo/turbo-bundler.log +3 -3
  112. package/components/counter/.turbo/turbo-sass$colon$render.log +36 -0
  113. package/components/counter/README.md +188 -0
  114. package/components/counter/demo/api.md +98 -1016
  115. package/components/counter/demo/api.min.js +1670 -32
  116. package/components/counter/demo/index.js +2 -1
  117. package/components/counter/demo/index.md +194 -0
  118. package/components/counter/demo/index.min.js +1702 -19
  119. package/components/counter/dist/auro-counter-button.d.ts +13 -0
  120. package/components/counter/dist/auro-counter-button.d.ts.map +1 -0
  121. package/components/counter/dist/auro-counter-group.d.ts +77 -6
  122. package/components/counter/dist/auro-counter-group.d.ts.map +1 -1
  123. package/components/counter/dist/auro-counter.d.ts +78 -0
  124. package/components/counter/dist/auro-counter.d.ts.map +1 -1
  125. package/components/counter/dist/formkit/auro-dropdownVersion.d.ts +3 -0
  126. package/components/counter/dist/formkit/auro-dropdownVersion.d.ts.map +1 -0
  127. package/components/counter/dist/iconVersion.d.ts +3 -0
  128. package/components/counter/dist/iconVersion.d.ts.map +1 -0
  129. package/components/counter/dist/index.js +1670 -32
  130. package/components/counter/dist/styles/color-css.d.ts +3 -0
  131. package/components/counter/dist/styles/color-css.d.ts.map +1 -0
  132. package/components/counter/dist/styles/counter-button-color-css.d.ts +3 -0
  133. package/components/counter/dist/styles/counter-button-color-css.d.ts.map +1 -0
  134. package/components/counter/dist/styles/counter-button-css.d.ts +3 -0
  135. package/components/counter/dist/styles/counter-button-css.d.ts.map +1 -0
  136. package/components/counter/dist/styles/counter-button-tokens-css.d.ts +3 -0
  137. package/components/counter/dist/styles/counter-button-tokens-css.d.ts.map +1 -0
  138. package/components/counter/dist/styles/counter-group-color-css.d.ts +3 -0
  139. package/components/counter/dist/styles/counter-group-color-css.d.ts.map +1 -0
  140. package/components/counter/dist/styles/tokens-css.d.ts +3 -0
  141. package/components/counter/dist/styles/tokens-css.d.ts.map +1 -0
  142. package/components/counter/package.json +8 -2
  143. package/components/counter/src/auro-counter-button.js +42 -0
  144. package/components/counter/src/auro-counter-group.js +150 -21
  145. package/components/counter/src/auro-counter.js +272 -12
  146. package/components/counter/src/formkit/auro-dropdownVersion.js +1 -0
  147. package/components/counter/src/iconVersion.js +1 -0
  148. package/components/counter/src/index.js +1 -1
  149. package/components/counter/src/styles/color-css.js +2 -0
  150. package/components/counter/src/styles/color.css +25 -0
  151. package/components/counter/src/styles/color.scss +44 -0
  152. package/components/counter/src/styles/counter-button-color-css.js +2 -0
  153. package/components/counter/src/styles/counter-button-color.css +14 -0
  154. package/components/counter/src/styles/counter-button-color.scss +29 -0
  155. package/components/counter/src/styles/counter-button-css.js +2 -0
  156. package/components/counter/src/styles/counter-button-tokens-css.js +2 -0
  157. package/components/counter/src/styles/counter-button-tokens.css +7 -0
  158. package/components/counter/src/styles/counter-button-tokens.scss +9 -0
  159. package/components/counter/src/styles/counter-button.css +187 -0
  160. package/components/counter/src/styles/counter-button.scss +83 -0
  161. package/components/counter/src/styles/counter-group-color-css.js +2 -0
  162. package/components/counter/src/styles/counter-group-color.css +4 -0
  163. package/components/counter/src/styles/counter-group-color.scss +19 -0
  164. package/components/counter/src/styles/counter-group-css.js +1 -1
  165. package/components/counter/src/styles/counter-group.css +13 -1
  166. package/components/counter/src/styles/counter-group.scss +14 -1
  167. package/components/counter/src/styles/style-css.js +1 -1
  168. package/components/counter/src/styles/style.css +43 -1
  169. package/components/counter/src/styles/style.scss +48 -2
  170. package/components/counter/src/styles/tokens-css.js +2 -0
  171. package/components/counter/src/styles/tokens.css +11 -0
  172. package/components/counter/src/styles/tokens.scss +24 -0
  173. package/components/datepicker/.turbo/turbo-build.log +2 -2
  174. package/components/datepicker/.turbo/turbo-bundler.log +2 -2
  175. package/components/datepicker/README.md +4 -4
  176. package/components/datepicker/demo/api.min.js +158 -40
  177. package/components/datepicker/demo/index.min.js +158 -40
  178. package/components/datepicker/dist/index.js +158 -40
  179. package/components/dropdown/.turbo/turbo-build.log +3 -3
  180. package/components/dropdown/.turbo/turbo-bundler.log +2 -2
  181. package/components/dropdown/README.md +1 -1
  182. package/components/form/.turbo/turbo-build.log +3 -3
  183. package/components/form/.turbo/turbo-bundler.log +3 -3
  184. package/components/form/README.md +1 -1
  185. package/components/input/.turbo/turbo-build.log +2 -2
  186. package/components/input/.turbo/turbo-bundler.log +3 -3
  187. package/components/input/README.md +1 -1
  188. package/components/input/demo/api.min.js +79 -20
  189. package/components/input/demo/index.min.js +79 -20
  190. package/components/input/dist/index.js +79 -20
  191. package/components/menu/.turbo/turbo-build.log +3 -3
  192. package/components/menu/.turbo/turbo-bundler.log +2 -2
  193. package/components/menu/README.md +1 -1
  194. package/components/radio/.turbo/turbo-build.log +3 -3
  195. package/components/radio/.turbo/turbo-bundler.log +3 -3
  196. package/components/radio/README.md +1 -1
  197. package/components/radio/demo/api.min.js +79 -20
  198. package/components/radio/demo/index.min.js +79 -20
  199. package/components/radio/dist/index.js +79 -20
  200. package/components/select/.turbo/turbo-build.log +3 -3
  201. package/components/select/.turbo/turbo-bundler.log +6 -3
  202. package/components/select/README.md +3 -3
  203. package/components/select/demo/api.min.js +79 -20
  204. package/components/select/demo/index.min.js +79 -20
  205. package/components/select/dist/index.js +79 -20
  206. package/package.json +1 -1
  207. package/packages/form-validation/src/validation.js +79 -20
  208. package/packages/utils/package.json +12 -0
  209. package/packages/utils/src/iconUtil.js +25 -0
  210. package/packages/utils/src/index.js +1 -0
  211. package/.turbo/cache/06845874cc82b186-meta.json +0 -1
  212. package/.turbo/cache/06845874cc82b186.tar.zst +0 -0
  213. package/.turbo/cache/0a96f136af026d57-meta.json +0 -1
  214. package/.turbo/cache/0a96f136af026d57.tar.zst +0 -0
  215. package/.turbo/cache/0c9ee13a7c863709-meta.json +0 -1
  216. package/.turbo/cache/0ca9c5ccf3e90704-meta.json +0 -1
  217. package/.turbo/cache/1a8d6e4cab38121a-meta.json +0 -1
  218. package/.turbo/cache/1ce32edb29492636-meta.json +0 -1
  219. package/.turbo/cache/1ce32edb29492636.tar.zst +0 -0
  220. package/.turbo/cache/2ec1b6d23563659e-meta.json +0 -1
  221. package/.turbo/cache/3afc5b2ea7c1bf51-meta.json +0 -1
  222. package/.turbo/cache/3afc5b2ea7c1bf51.tar.zst +0 -0
  223. package/.turbo/cache/40de011abc31c0cf-meta.json +0 -1
  224. package/.turbo/cache/40de011abc31c0cf.tar.zst +0 -0
  225. package/.turbo/cache/426c825f57054f5f-meta.json +0 -1
  226. package/.turbo/cache/426c825f57054f5f.tar.zst +0 -0
  227. package/.turbo/cache/4524aae614598308-meta.json +0 -1
  228. package/.turbo/cache/4524aae614598308.tar.zst +0 -0
  229. package/.turbo/cache/45ea3e30ae949d53-meta.json +0 -1
  230. package/.turbo/cache/45ea3e30ae949d53.tar.zst +0 -0
  231. package/.turbo/cache/577d86e4072c01f5-meta.json +0 -1
  232. package/.turbo/cache/577d86e4072c01f5.tar.zst +0 -0
  233. package/.turbo/cache/5d770c787aa78d4d-meta.json +0 -1
  234. package/.turbo/cache/5d770c787aa78d4d.tar.zst +0 -0
  235. package/.turbo/cache/624bf5350aacae42-meta.json +0 -1
  236. package/.turbo/cache/68060c79df03f45a-meta.json +0 -1
  237. package/.turbo/cache/68060c79df03f45a.tar.zst +0 -0
  238. package/.turbo/cache/68e3afb31feab4e9-meta.json +0 -1
  239. package/.turbo/cache/6a1c28febca6163f-meta.json +0 -1
  240. package/.turbo/cache/6bc4e2d881af6ffb-meta.json +0 -1
  241. package/.turbo/cache/6bc4e2d881af6ffb.tar.zst +0 -0
  242. package/.turbo/cache/6c8ea74dc3b07640-meta.json +0 -1
  243. package/.turbo/cache/7a6ef918375d4010-meta.json +0 -1
  244. package/.turbo/cache/7a6ef918375d4010.tar.zst +0 -0
  245. package/.turbo/cache/7da23884069695e6-meta.json +0 -1
  246. package/.turbo/cache/7da23884069695e6.tar.zst +0 -0
  247. package/.turbo/cache/83e1029b14af6545-meta.json +0 -1
  248. package/.turbo/cache/8410cd8eeadc3af7-meta.json +0 -1
  249. package/.turbo/cache/98936c69a55361fc-meta.json +0 -1
  250. package/.turbo/cache/a3db8f78e018a955-meta.json +0 -1
  251. package/.turbo/cache/a3db8f78e018a955.tar.zst +0 -0
  252. package/.turbo/cache/b91d2888e699c76a-meta.json +0 -1
  253. package/.turbo/cache/b91d2888e699c76a.tar.zst +0 -0
  254. package/.turbo/cache/bdc6aadfdbb6feb9-meta.json +0 -1
  255. package/.turbo/cache/c114d428251f56a5-meta.json +0 -1
  256. package/.turbo/cache/c114d428251f56a5.tar.zst +0 -0
  257. package/.turbo/cache/c7338727efbc457a-meta.json +0 -1
  258. package/.turbo/cache/c7338727efbc457a.tar.zst +0 -0
  259. package/.turbo/cache/cf235df1ef8d90b0-meta.json +0 -1
  260. package/.turbo/cache/d1d1a072ee099992-meta.json +0 -1
  261. package/.turbo/cache/d9331772756d3d94-meta.json +0 -1
  262. package/.turbo/cache/d9331772756d3d94.tar.zst +0 -0
  263. package/.turbo/cache/dc6fbe2a8d5b9d9b-meta.json +0 -1
  264. package/.turbo/cache/df28a5ee199e995d-meta.json +0 -1
  265. package/.turbo/cache/e1e2582a7131011f-meta.json +0 -1
  266. package/.turbo/cache/e6271174c00888fe-meta.json +0 -1
  267. package/.turbo/cache/e8485d2a584b5f08-meta.json +0 -1
  268. package/.turbo/cache/e8485d2a584b5f08.tar.zst +0 -0
  269. package/.turbo/cache/e86451b8f88594b2-meta.json +0 -1
  270. package/.turbo/cache/e86451b8f88594b2.tar.zst +0 -0
  271. package/.turbo/cache/e9872ba002963dd3-meta.json +0 -1
  272. package/.turbo/cache/e9872ba002963dd3.tar.zst +0 -0
  273. /package/.turbo/cache/{e6271174c00888fe.tar.zst → 012997da408d7381.tar.zst} +0 -0
  274. /package/.turbo/cache/{6a1c28febca6163f.tar.zst → 144803363093af6b.tar.zst} +0 -0
  275. /package/.turbo/cache/{0c9ee13a7c863709.tar.zst → 2706814699cff63a.tar.zst} +0 -0
  276. /package/.turbo/cache/{8410cd8eeadc3af7.tar.zst → 29d704afd7578cda.tar.zst} +0 -0
  277. /package/.turbo/cache/{68e3afb31feab4e9.tar.zst → 318a9085a92f2d32.tar.zst} +0 -0
  278. /package/.turbo/cache/{1a8d6e4cab38121a.tar.zst → 457af7906413d2ff.tar.zst} +0 -0
  279. /package/.turbo/cache/{6c8ea74dc3b07640.tar.zst → 5567d6b2fdae56a9.tar.zst} +0 -0
  280. /package/.turbo/cache/{d1d1a072ee099992.tar.zst → 769652d1b874d7cf.tar.zst} +0 -0
  281. /package/.turbo/cache/{df28a5ee199e995d.tar.zst → 804ad767c7ba2fc3.tar.zst} +0 -0
  282. /package/.turbo/cache/{bdc6aadfdbb6feb9.tar.zst → 85cc23a2de6b1009.tar.zst} +0 -0
  283. /package/.turbo/cache/{e1e2582a7131011f.tar.zst → a54b4d75b5d265de.tar.zst} +0 -0
  284. /package/.turbo/cache/{83e1029b14af6545.tar.zst → b280ed4daaf15dcb.tar.zst} +0 -0
  285. /package/.turbo/cache/{624bf5350aacae42.tar.zst → d44acd685455b288.tar.zst} +0 -0
  286. /package/.turbo/cache/{cf235df1ef8d90b0.tar.zst → e03997efe5adad43.tar.zst} +0 -0
  287. /package/.turbo/cache/{2ec1b6d23563659e.tar.zst → e820cc8f220a05f3.tar.zst} +0 -0
  288. /package/.turbo/cache/{98936c69a55361fc.tar.zst → fdaf484b1ec4b5ed.tar.zst} +0 -0
@@ -252,30 +252,87 @@ class AuroFormValidation {
252
252
  }
253
253
 
254
254
  /**
255
- * Determines the validity state of the element based on the common attribute restrictions (pattern).
256
- * @private
257
- * @param {object} elem - HTML element to validate.
255
+ * Validates the attributes of a given element based on predefined validation rules.
256
+ *
257
+ * @param {HTMLElement} elem - The element to be validated.
258
258
  * @returns {void}
259
+ *
260
+ * @example
261
+ * // Assuming `inputElement` is a reference to an input element in the DOM
262
+ * validateElementAttributes(inputElement);
263
+ *
264
+ * The function checks the element's attributes against the validation rules defined for 'input' and 'counter' types.
265
+ * If a validation rule is violated, it sets the element's validity state and error message accordingly.
266
+ *
267
+ * Validation rules:
268
+ * - input:
269
+ * - length:
270
+ * - tooShort: Checks if the value length is less than the minimum length.
271
+ * - tooLong: Checks if the value length exceeds the maximum length.
272
+ * - pattern:
273
+ * - patternMismatch: Checks if the value does not match the specified pattern.
274
+ * - counter:
275
+ * - range:
276
+ * - rangeOverflow: Checks if the value exceeds the maximum value.
277
+ * - rangeUnderflow: Checks if the value is less than the minimum value.
259
278
  */
260
- validateAttributes(elem) {
261
- if (elem.pattern) {
262
- const pattern = new RegExp(`^${elem.pattern}$`, 'u');
263
-
264
- if (!pattern.test(elem.value)) {
265
- elem.validity = 'patternMismatch';
266
- elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || '';
279
+ validateElementAttributes(elem) {
280
+ const validationRules = {
281
+ input: {
282
+ length: [
283
+ {
284
+ check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
285
+ validity: 'tooShort',
286
+ message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
287
+ },
288
+ {
289
+ check: (e) => e.value?.length > e.maxLength,
290
+ validity: 'tooLong',
291
+ message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
292
+ }
293
+ ],
294
+ pattern: [
295
+ {
296
+ check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
297
+ validity: 'patternMismatch',
298
+ message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
299
+ }
300
+ ]
301
+ },
302
+ counter: {
303
+ range: [
304
+ {
305
+ check: (e) => e.max !== undefined && Number(e.max) < Number(e.value),
306
+ validity: 'rangeOverflow',
307
+ message: e => e.getAttribute('setCustomValidityRangeOverflow') || ''
308
+ },
309
+ {
310
+ check: (e) => e.min !== undefined && Number(e.min) > Number(e.value),
311
+ validity: 'rangeUnderflow',
312
+ message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
313
+ }
314
+ ]
267
315
  }
316
+ };
317
+
318
+ let elementType;
319
+ if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
320
+ elementType = 'input';
321
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
322
+ elementType = 'counter';
268
323
  }
269
-
270
- // Length > 0 is required to prevent the error message from showing when the input is empty
271
- if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
272
- elem.validity = 'tooShort';
273
- elem.errorMessage = elem.setCustomValidityTooShort || elem.setCustomValidity || '';
274
- }
275
324
 
276
- if (elem.value?.length > elem.maxLength) {
277
- elem.validity = 'tooLong';
278
- elem.errorMessage = elem.setCustomValidityTooLong || elem.setCustomValidity || '';
325
+ if (elementType) {
326
+ const rules = validationRules[elementType];
327
+
328
+ if (rules) {
329
+ Object.values(rules).flat().forEach(rule => {
330
+ if (rule.check(elem)) {
331
+ elem.validity = rule.validity;
332
+ elem.errorMessage = rule.message(elem);
333
+ }
334
+ });
335
+ }
279
336
  }
280
337
  }
281
338
 
@@ -385,7 +442,9 @@ class AuroFormValidation {
385
442
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
386
443
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
387
444
  this.validateType(elem);
388
- this.validateAttributes(elem);
445
+ this.validateElementAttributes(elem);
446
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
447
+ this.validateElementAttributes(elem);
389
448
  }
390
449
  }
391
450
 
@@ -148,30 +148,87 @@ class AuroFormValidation {
148
148
  }
149
149
 
150
150
  /**
151
- * Determines the validity state of the element based on the common attribute restrictions (pattern).
152
- * @private
153
- * @param {object} elem - HTML element to validate.
151
+ * Validates the attributes of a given element based on predefined validation rules.
152
+ *
153
+ * @param {HTMLElement} elem - The element to be validated.
154
154
  * @returns {void}
155
+ *
156
+ * @example
157
+ * // Assuming `inputElement` is a reference to an input element in the DOM
158
+ * validateElementAttributes(inputElement);
159
+ *
160
+ * The function checks the element's attributes against the validation rules defined for 'input' and 'counter' types.
161
+ * If a validation rule is violated, it sets the element's validity state and error message accordingly.
162
+ *
163
+ * Validation rules:
164
+ * - input:
165
+ * - length:
166
+ * - tooShort: Checks if the value length is less than the minimum length.
167
+ * - tooLong: Checks if the value length exceeds the maximum length.
168
+ * - pattern:
169
+ * - patternMismatch: Checks if the value does not match the specified pattern.
170
+ * - counter:
171
+ * - range:
172
+ * - rangeOverflow: Checks if the value exceeds the maximum value.
173
+ * - rangeUnderflow: Checks if the value is less than the minimum value.
155
174
  */
156
- validateAttributes(elem) {
157
- if (elem.pattern) {
158
- const pattern = new RegExp(`^${elem.pattern}$`, 'u');
159
-
160
- if (!pattern.test(elem.value)) {
161
- elem.validity = 'patternMismatch';
162
- elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || '';
175
+ validateElementAttributes(elem) {
176
+ const validationRules = {
177
+ input: {
178
+ length: [
179
+ {
180
+ check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
181
+ validity: 'tooShort',
182
+ message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
183
+ },
184
+ {
185
+ check: (e) => e.value?.length > e.maxLength,
186
+ validity: 'tooLong',
187
+ message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
188
+ }
189
+ ],
190
+ pattern: [
191
+ {
192
+ check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
193
+ validity: 'patternMismatch',
194
+ message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
195
+ }
196
+ ]
197
+ },
198
+ counter: {
199
+ range: [
200
+ {
201
+ check: (e) => e.max !== undefined && Number(e.max) < Number(e.value),
202
+ validity: 'rangeOverflow',
203
+ message: e => e.getAttribute('setCustomValidityRangeOverflow') || ''
204
+ },
205
+ {
206
+ check: (e) => e.min !== undefined && Number(e.min) > Number(e.value),
207
+ validity: 'rangeUnderflow',
208
+ message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
209
+ }
210
+ ]
163
211
  }
212
+ };
213
+
214
+ let elementType;
215
+ if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
216
+ elementType = 'input';
217
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
218
+ elementType = 'counter';
164
219
  }
165
-
166
- // Length > 0 is required to prevent the error message from showing when the input is empty
167
- if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
168
- elem.validity = 'tooShort';
169
- elem.errorMessage = elem.setCustomValidityTooShort || elem.setCustomValidity || '';
170
- }
171
220
 
172
- if (elem.value?.length > elem.maxLength) {
173
- elem.validity = 'tooLong';
174
- elem.errorMessage = elem.setCustomValidityTooLong || elem.setCustomValidity || '';
221
+ if (elementType) {
222
+ const rules = validationRules[elementType];
223
+
224
+ if (rules) {
225
+ Object.values(rules).flat().forEach(rule => {
226
+ if (rule.check(elem)) {
227
+ elem.validity = rule.validity;
228
+ elem.errorMessage = rule.message(elem);
229
+ }
230
+ });
231
+ }
175
232
  }
176
233
  }
177
234
 
@@ -281,7 +338,9 @@ class AuroFormValidation {
281
338
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
282
339
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
283
340
  this.validateType(elem);
284
- this.validateAttributes(elem);
341
+ this.validateElementAttributes(elem);
342
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
343
+ this.validateElementAttributes(elem);
285
344
  }
286
345
  }
287
346
 
@@ -148,30 +148,87 @@ class AuroFormValidation {
148
148
  }
149
149
 
150
150
  /**
151
- * Determines the validity state of the element based on the common attribute restrictions (pattern).
152
- * @private
153
- * @param {object} elem - HTML element to validate.
151
+ * Validates the attributes of a given element based on predefined validation rules.
152
+ *
153
+ * @param {HTMLElement} elem - The element to be validated.
154
154
  * @returns {void}
155
+ *
156
+ * @example
157
+ * // Assuming `inputElement` is a reference to an input element in the DOM
158
+ * validateElementAttributes(inputElement);
159
+ *
160
+ * The function checks the element's attributes against the validation rules defined for 'input' and 'counter' types.
161
+ * If a validation rule is violated, it sets the element's validity state and error message accordingly.
162
+ *
163
+ * Validation rules:
164
+ * - input:
165
+ * - length:
166
+ * - tooShort: Checks if the value length is less than the minimum length.
167
+ * - tooLong: Checks if the value length exceeds the maximum length.
168
+ * - pattern:
169
+ * - patternMismatch: Checks if the value does not match the specified pattern.
170
+ * - counter:
171
+ * - range:
172
+ * - rangeOverflow: Checks if the value exceeds the maximum value.
173
+ * - rangeUnderflow: Checks if the value is less than the minimum value.
155
174
  */
156
- validateAttributes(elem) {
157
- if (elem.pattern) {
158
- const pattern = new RegExp(`^${elem.pattern}$`, 'u');
159
-
160
- if (!pattern.test(elem.value)) {
161
- elem.validity = 'patternMismatch';
162
- elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || '';
175
+ validateElementAttributes(elem) {
176
+ const validationRules = {
177
+ input: {
178
+ length: [
179
+ {
180
+ check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
181
+ validity: 'tooShort',
182
+ message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
183
+ },
184
+ {
185
+ check: (e) => e.value?.length > e.maxLength,
186
+ validity: 'tooLong',
187
+ message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
188
+ }
189
+ ],
190
+ pattern: [
191
+ {
192
+ check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
193
+ validity: 'patternMismatch',
194
+ message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
195
+ }
196
+ ]
197
+ },
198
+ counter: {
199
+ range: [
200
+ {
201
+ check: (e) => e.max !== undefined && Number(e.max) < Number(e.value),
202
+ validity: 'rangeOverflow',
203
+ message: e => e.getAttribute('setCustomValidityRangeOverflow') || ''
204
+ },
205
+ {
206
+ check: (e) => e.min !== undefined && Number(e.min) > Number(e.value),
207
+ validity: 'rangeUnderflow',
208
+ message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
209
+ }
210
+ ]
163
211
  }
212
+ };
213
+
214
+ let elementType;
215
+ if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
216
+ elementType = 'input';
217
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
218
+ elementType = 'counter';
164
219
  }
165
-
166
- // Length > 0 is required to prevent the error message from showing when the input is empty
167
- if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
168
- elem.validity = 'tooShort';
169
- elem.errorMessage = elem.setCustomValidityTooShort || elem.setCustomValidity || '';
170
- }
171
220
 
172
- if (elem.value?.length > elem.maxLength) {
173
- elem.validity = 'tooLong';
174
- elem.errorMessage = elem.setCustomValidityTooLong || elem.setCustomValidity || '';
221
+ if (elementType) {
222
+ const rules = validationRules[elementType];
223
+
224
+ if (rules) {
225
+ Object.values(rules).flat().forEach(rule => {
226
+ if (rule.check(elem)) {
227
+ elem.validity = rule.validity;
228
+ elem.errorMessage = rule.message(elem);
229
+ }
230
+ });
231
+ }
175
232
  }
176
233
  }
177
234
 
@@ -281,7 +338,9 @@ class AuroFormValidation {
281
338
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
282
339
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
283
340
  this.validateType(elem);
284
- this.validateAttributes(elem);
341
+ this.validateElementAttributes(elem);
342
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
343
+ this.validateElementAttributes(elem);
285
344
  }
286
345
  }
287
346
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem/auro-formkit",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0-beta.9",
4
4
  "description": "A collection of web components used to build forms.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -37,30 +37,87 @@ export default class AuroFormValidation {
37
37
  }
38
38
 
39
39
  /**
40
- * Determines the validity state of the element based on the common attribute restrictions (pattern).
41
- * @private
42
- * @param {object} elem - HTML element to validate.
40
+ * Validates the attributes of a given element based on predefined validation rules.
41
+ *
42
+ * @param {HTMLElement} elem - The element to be validated.
43
43
  * @returns {void}
44
+ *
45
+ * @example
46
+ * // Assuming `inputElement` is a reference to an input element in the DOM
47
+ * validateElementAttributes(inputElement);
48
+ *
49
+ * The function checks the element's attributes against the validation rules defined for 'input' and 'counter' types.
50
+ * If a validation rule is violated, it sets the element's validity state and error message accordingly.
51
+ *
52
+ * Validation rules:
53
+ * - input:
54
+ * - length:
55
+ * - tooShort: Checks if the value length is less than the minimum length.
56
+ * - tooLong: Checks if the value length exceeds the maximum length.
57
+ * - pattern:
58
+ * - patternMismatch: Checks if the value does not match the specified pattern.
59
+ * - counter:
60
+ * - range:
61
+ * - rangeOverflow: Checks if the value exceeds the maximum value.
62
+ * - rangeUnderflow: Checks if the value is less than the minimum value.
44
63
  */
45
- validateAttributes(elem) {
46
- if (elem.pattern) {
47
- const pattern = new RegExp(`^${elem.pattern}$`, 'u');
48
-
49
- if (!pattern.test(elem.value)) {
50
- elem.validity = 'patternMismatch';
51
- elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || '';
64
+ validateElementAttributes(elem) {
65
+ const validationRules = {
66
+ input: {
67
+ length: [
68
+ {
69
+ check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
70
+ validity: 'tooShort',
71
+ message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
72
+ },
73
+ {
74
+ check: (e) => e.value?.length > e.maxLength,
75
+ validity: 'tooLong',
76
+ message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
77
+ }
78
+ ],
79
+ pattern: [
80
+ {
81
+ check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
82
+ validity: 'patternMismatch',
83
+ message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
84
+ }
85
+ ]
86
+ },
87
+ counter: {
88
+ range: [
89
+ {
90
+ check: (e) => e.max !== undefined && Number(e.max) < Number(e.value),
91
+ validity: 'rangeOverflow',
92
+ message: e => e.getAttribute('setCustomValidityRangeOverflow') || ''
93
+ },
94
+ {
95
+ check: (e) => e.min !== undefined && Number(e.min) > Number(e.value),
96
+ validity: 'rangeUnderflow',
97
+ message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
98
+ }
99
+ ]
52
100
  }
101
+ };
102
+
103
+ let elementType;
104
+ if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
105
+ elementType = 'input';
106
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
107
+ elementType = 'counter';
53
108
  }
54
-
55
- // Length > 0 is required to prevent the error message from showing when the input is empty
56
- if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
57
- elem.validity = 'tooShort';
58
- elem.errorMessage = elem.setCustomValidityTooShort || elem.setCustomValidity || '';
59
- }
60
109
 
61
- if (elem.value?.length > elem.maxLength) {
62
- elem.validity = 'tooLong';
63
- elem.errorMessage = elem.setCustomValidityTooLong || elem.setCustomValidity || '';
110
+ if (elementType) {
111
+ const rules = validationRules[elementType];
112
+
113
+ if (rules) {
114
+ Object.values(rules).flat().forEach(rule => {
115
+ if (rule.check(elem)) {
116
+ elem.validity = rule.validity;
117
+ elem.errorMessage = rule.message(elem);
118
+ }
119
+ });
120
+ }
64
121
  }
65
122
  }
66
123
 
@@ -170,7 +227,9 @@ export default class AuroFormValidation {
170
227
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
171
228
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
172
229
  this.validateType(elem);
173
- this.validateAttributes(elem);
230
+ this.validateElementAttributes(elem);
231
+ } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
232
+ this.validateElementAttributes(elem);
174
233
  }
175
234
  }
176
235
 
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@auro-formkit/utils",
3
+ "description": "Shared utility functions for all components in auro-formkit monorepo",
4
+ "version": "0.0.0",
5
+ "private": true,
6
+ "type": "module",
7
+ "main": "./src/index.js",
8
+ "types": "tsc",
9
+ "exports": {
10
+ ".": "./src/index.js"
11
+ }
12
+ }
@@ -0,0 +1,25 @@
1
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
2
+ // See LICENSE in the project root for license information.
3
+
4
+ // ---------------------------------------------------------------------
5
+
6
+ import { html } from "lit/static-html.js";
7
+
8
+ export class IconUtil {
9
+
10
+ /**
11
+ * Generates an HTML element containing an SVG icon based on the provided `svgContent`.
12
+ *
13
+ * @param {string} svgContent - The SVG content to be embedded.
14
+ * @param {Object} _attributes - Additional attributes to set on the icon element.
15
+ * @returns {Element} The HTML element containing the SVG icon.
16
+ */
17
+ static generateSvgHtml(svgContent) {
18
+ const dom = new DOMParser().parseFromString(svgContent.svg, 'text/html');
19
+ const svg = dom.body.firstChild;
20
+
21
+ svg.setAttribute('slot', 'svg');
22
+
23
+ return html`${svg}`;
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ export { IconUtil } from './iconUtil.js';
@@ -1 +0,0 @@
1
- {"hash":"06845874cc82b186","duration":27232}
@@ -1 +0,0 @@
1
- {"hash":"0a96f136af026d57","duration":12390}
@@ -1 +0,0 @@
1
- {"hash":"0c9ee13a7c863709","duration":5848}
@@ -1 +0,0 @@
1
- {"hash":"0ca9c5ccf3e90704","duration":5052}
@@ -1 +0,0 @@
1
- {"hash":"1a8d6e4cab38121a","duration":1330}
@@ -1 +0,0 @@
1
- {"hash":"1ce32edb29492636","duration":36986}
@@ -1 +0,0 @@
1
- {"hash":"2ec1b6d23563659e","duration":4686}
@@ -1 +0,0 @@
1
- {"hash":"3afc5b2ea7c1bf51","duration":27580}
@@ -1 +0,0 @@
1
- {"hash":"40de011abc31c0cf","duration":3126}
@@ -1 +0,0 @@
1
- {"hash":"426c825f57054f5f","duration":1565}
@@ -1 +0,0 @@
1
- {"hash":"4524aae614598308","duration":6252}
@@ -1 +0,0 @@
1
- {"hash":"45ea3e30ae949d53","duration":29872}
@@ -1 +0,0 @@
1
- {"hash":"577d86e4072c01f5","duration":27551}
@@ -1 +0,0 @@
1
- {"hash":"5d770c787aa78d4d","duration":3115}
@@ -1 +0,0 @@
1
- {"hash":"624bf5350aacae42","duration":868}
@@ -1 +0,0 @@
1
- {"hash":"68060c79df03f45a","duration":27884}
@@ -1 +0,0 @@
1
- {"hash":"68e3afb31feab4e9","duration":5985}
@@ -1 +0,0 @@
1
- {"hash":"6a1c28febca6163f","duration":5118}
@@ -1 +0,0 @@
1
- {"hash":"6bc4e2d881af6ffb","duration":1479}
@@ -1 +0,0 @@
1
- {"hash":"6c8ea74dc3b07640","duration":919}
@@ -1 +0,0 @@
1
- {"hash":"7a6ef918375d4010","duration":4163}
@@ -1 +0,0 @@
1
- {"hash":"7da23884069695e6","duration":16054}
@@ -1 +0,0 @@
1
- {"hash":"83e1029b14af6545","duration":5140}
@@ -1 +0,0 @@
1
- {"hash":"8410cd8eeadc3af7","duration":8573}
@@ -1 +0,0 @@
1
- {"hash":"98936c69a55361fc","duration":5271}
@@ -1 +0,0 @@
1
- {"hash":"a3db8f78e018a955","duration":4426}