igniteui-webcomponents 7.3.1 → 7.4.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 (606) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/animations/easings.d.ts +21 -31
  3. package/animations/easings.js +21 -34
  4. package/animations/easings.js.map +1 -1
  5. package/animations/player.d.ts +8 -16
  6. package/animations/player.js +5 -8
  7. package/animations/player.js.map +1 -1
  8. package/animations/view-transition.d.ts +10 -10
  9. package/animations/view-transition.js +26 -37
  10. package/animations/view-transition.js.map +1 -1
  11. package/components/avatar/themes/avatar.base.css.js +1 -1
  12. package/components/avatar/themes/avatar.base.css.js.map +1 -1
  13. package/components/badge/themes/badge.base.css.js +1 -1
  14. package/components/badge/themes/badge.base.css.js.map +1 -1
  15. package/components/banner/themes/banner.base.css.js +1 -1
  16. package/components/banner/themes/banner.base.css.js.map +1 -1
  17. package/components/banner/themes/shared/banner.indigo.css.js +1 -1
  18. package/components/banner/themes/shared/banner.indigo.css.js.map +1 -1
  19. package/components/breadcrumb/breadcrumb.d.ts +74 -0
  20. package/components/breadcrumb/breadcrumb.js +107 -0
  21. package/components/breadcrumb/breadcrumb.js.map +1 -0
  22. package/components/breadcrumb/breadcrumbs.d.ts +60 -0
  23. package/components/breadcrumb/breadcrumbs.js +50 -0
  24. package/components/breadcrumb/breadcrumbs.js.map +1 -0
  25. package/components/breadcrumb/themes/breadcrumb.base.css.d.ts +1 -0
  26. package/components/breadcrumb/themes/breadcrumb.base.css.js +3 -0
  27. package/components/breadcrumb/themes/breadcrumb.base.css.js.map +1 -0
  28. package/components/breadcrumb/themes/breadcrumbs.base.css.d.ts +1 -0
  29. package/components/breadcrumb/themes/breadcrumbs.base.css.js +3 -0
  30. package/components/breadcrumb/themes/breadcrumbs.base.css.js.map +1 -0
  31. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.d.ts +1 -0
  32. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js +3 -0
  33. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js.map +1 -0
  34. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.d.ts +1 -0
  35. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js +3 -0
  36. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js.map +1 -0
  37. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.d.ts +1 -0
  38. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js +3 -0
  39. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js.map +1 -0
  40. package/components/breadcrumb/themes/dark/breadcrumb.material.css.d.ts +1 -0
  41. package/components/breadcrumb/themes/dark/breadcrumb.material.css.js +3 -0
  42. package/components/breadcrumb/themes/dark/breadcrumb.material.css.js.map +1 -0
  43. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.d.ts +1 -0
  44. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js +3 -0
  45. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js.map +1 -0
  46. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.d.ts +1 -0
  47. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js +3 -0
  48. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js.map +1 -0
  49. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.d.ts +1 -0
  50. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js +3 -0
  51. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js.map +1 -0
  52. package/components/breadcrumb/themes/light/breadcrumb.material.css.d.ts +1 -0
  53. package/components/breadcrumb/themes/light/breadcrumb.material.css.js +3 -0
  54. package/components/breadcrumb/themes/light/breadcrumb.material.css.js.map +1 -0
  55. package/components/breadcrumb/themes/light/breadcrumb.shared.css.d.ts +1 -0
  56. package/components/breadcrumb/themes/light/breadcrumb.shared.css.js +3 -0
  57. package/components/breadcrumb/themes/light/breadcrumb.shared.css.js.map +1 -0
  58. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.d.ts +1 -0
  59. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js +3 -0
  60. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js.map +1 -0
  61. package/components/breadcrumb/themes/shared/breadcrumb.common.css.d.ts +1 -0
  62. package/components/breadcrumb/themes/shared/breadcrumb.common.css.js +3 -0
  63. package/components/breadcrumb/themes/shared/breadcrumb.common.css.js.map +1 -0
  64. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.d.ts +1 -0
  65. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js +3 -0
  66. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js.map +1 -0
  67. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.d.ts +1 -0
  68. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js +3 -0
  69. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js.map +1 -0
  70. package/components/breadcrumb/themes/shared/breadcrumb.material.css.d.ts +1 -0
  71. package/components/breadcrumb/themes/shared/breadcrumb.material.css.js +3 -0
  72. package/components/breadcrumb/themes/shared/breadcrumb.material.css.js.map +1 -0
  73. package/components/breadcrumb/themes/themes.d.ts +2 -0
  74. package/components/breadcrumb/themes/themes.js +50 -0
  75. package/components/breadcrumb/themes/themes.js.map +1 -0
  76. package/components/button/button.d.ts +0 -2
  77. package/components/button/button.js.map +1 -1
  78. package/components/button-group/button-group.d.ts +42 -12
  79. package/components/button-group/button-group.js +82 -34
  80. package/components/button-group/button-group.js.map +1 -1
  81. package/components/button-group/toggle-button.d.ts +6 -1
  82. package/components/button-group/toggle-button.js +28 -2
  83. package/components/button-group/toggle-button.js.map +1 -1
  84. package/components/calendar/base.d.ts +7 -2
  85. package/components/calendar/base.js +10 -4
  86. package/components/calendar/base.js.map +1 -1
  87. package/components/calendar/calendar.d.ts +6 -3
  88. package/components/calendar/calendar.js +41 -14
  89. package/components/calendar/calendar.js.map +1 -1
  90. package/components/calendar/days-view/days-view.d.ts +5 -8
  91. package/components/calendar/days-view/days-view.js +7 -16
  92. package/components/calendar/days-view/days-view.js.map +1 -1
  93. package/components/calendar/helpers.d.ts +13 -0
  94. package/components/calendar/helpers.js +15 -0
  95. package/components/calendar/helpers.js.map +1 -1
  96. package/components/calendar/themes/calendar.base.css.js +1 -1
  97. package/components/calendar/themes/calendar.base.css.js.map +1 -1
  98. package/components/calendar/themes/days-view.base.css.js +1 -1
  99. package/components/calendar/themes/days-view.base.css.js.map +1 -1
  100. package/components/calendar/themes/shared/bootstrap/calendar.bootstrap.css.js +1 -1
  101. package/components/calendar/themes/shared/bootstrap/calendar.bootstrap.css.js.map +1 -1
  102. package/components/calendar/themes/shared/bootstrap/days-view.bootstrap.css.js +1 -1
  103. package/components/calendar/themes/shared/bootstrap/days-view.bootstrap.css.js.map +1 -1
  104. package/components/calendar/themes/shared/fluent/days-view.fluent.css.js +1 -1
  105. package/components/calendar/themes/shared/fluent/days-view.fluent.css.js.map +1 -1
  106. package/components/calendar/themes/shared/indigo/calendar.indigo.css.js +1 -1
  107. package/components/calendar/themes/shared/indigo/calendar.indigo.css.js.map +1 -1
  108. package/components/calendar/themes/shared/indigo/days-view.indigo.css.js +1 -1
  109. package/components/calendar/themes/shared/indigo/days-view.indigo.css.js.map +1 -1
  110. package/components/calendar/themes/shared/material/days-view.material.css.js +1 -1
  111. package/components/calendar/themes/shared/material/days-view.material.css.js.map +1 -1
  112. package/components/calendar/themes/year-month-view.base.css.js +1 -1
  113. package/components/calendar/themes/year-month-view.base.css.js.map +1 -1
  114. package/components/card/themes/container.base.css.js +1 -1
  115. package/components/card/themes/container.base.css.js.map +1 -1
  116. package/components/carousel/carousel-indicator.js +1 -0
  117. package/components/carousel/carousel-indicator.js.map +1 -1
  118. package/components/carousel/carousel-slide.d.ts +1 -1
  119. package/components/carousel/carousel-slide.js.map +1 -1
  120. package/components/carousel/carousel.d.ts +3 -3
  121. package/components/carousel/carousel.js.map +1 -1
  122. package/components/carousel/themes/carousel.base.css.js +1 -1
  123. package/components/carousel/themes/carousel.base.css.js.map +1 -1
  124. package/components/carousel/themes/shared/carousel.indigo.css.js +1 -1
  125. package/components/carousel/themes/shared/carousel.indigo.css.js.map +1 -1
  126. package/components/chat/chat-input.d.ts +1 -2
  127. package/components/chat/chat-input.js +1 -1
  128. package/components/chat/chat-input.js.map +1 -1
  129. package/components/chat/chat-state.d.ts +8 -9
  130. package/components/chat/chat-state.js.map +1 -1
  131. package/components/chat/chat.d.ts +1 -3
  132. package/components/chat/chat.js +2 -2
  133. package/components/chat/chat.js.map +1 -1
  134. package/components/chat/message-attachments.d.ts +6 -15
  135. package/components/chat/message-attachments.js.map +1 -1
  136. package/components/chat/themes/chat.base.css.js +1 -1
  137. package/components/chat/themes/chat.base.css.js.map +1 -1
  138. package/components/chat/themes/message.base.css.js +1 -1
  139. package/components/chat/themes/message.base.css.js.map +1 -1
  140. package/components/chat/utils.d.ts +0 -1
  141. package/components/chat/utils.js +1 -1
  142. package/components/chat/utils.js.map +1 -1
  143. package/components/checkbox/checkbox-base.d.ts +1 -1
  144. package/components/checkbox/checkbox.js +1 -1
  145. package/components/checkbox/checkbox.js.map +1 -1
  146. package/components/checkbox/themes/checkbox.base.css.js +1 -1
  147. package/components/checkbox/themes/checkbox.base.css.js.map +1 -1
  148. package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js +1 -1
  149. package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js.map +1 -1
  150. package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js +1 -1
  151. package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js.map +1 -1
  152. package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js +1 -1
  153. package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js.map +1 -1
  154. package/components/checkbox/themes/shared/switch/switch.fluent.css.js +1 -1
  155. package/components/checkbox/themes/shared/switch/switch.fluent.css.js.map +1 -1
  156. package/components/checkbox/themes/shared/switch/switch.indigo.css.js +1 -1
  157. package/components/checkbox/themes/shared/switch/switch.indigo.css.js.map +1 -1
  158. package/components/checkbox/themes/shared/switch/switch.material.css.js +1 -1
  159. package/components/checkbox/themes/shared/switch/switch.material.css.js.map +1 -1
  160. package/components/checkbox/themes/switch.base.css.js +1 -1
  161. package/components/checkbox/themes/switch.base.css.js.map +1 -1
  162. package/components/chip/chip.d.ts +2 -2
  163. package/components/chip/chip.js.map +1 -1
  164. package/components/color-picker/color-picker.d.ts +35 -34
  165. package/components/color-picker/color-picker.js +9 -4
  166. package/components/color-picker/color-picker.js.map +1 -1
  167. package/components/color-picker/common.d.ts +0 -2
  168. package/components/color-picker/common.js +2 -2
  169. package/components/color-picker/common.js.map +1 -1
  170. package/components/color-picker/converters.js.map +1 -1
  171. package/components/color-picker/picker-canvas.js.map +1 -1
  172. package/components/color-picker/themes/color-picker.base.css.js +1 -1
  173. package/components/color-picker/themes/color-picker.base.css.js.map +1 -1
  174. package/components/combo/combo.d.ts +18 -20
  175. package/components/combo/combo.js +8 -2
  176. package/components/combo/combo.js.map +1 -1
  177. package/components/combo/controllers/data.d.ts +7 -10
  178. package/components/combo/controllers/data.js.map +1 -1
  179. package/components/combo/themes/combo-item.base.css.js +1 -1
  180. package/components/combo/themes/combo-item.base.css.js.map +1 -1
  181. package/components/combo/themes/combo.base.css.js +1 -1
  182. package/components/combo/themes/combo.base.css.js.map +1 -1
  183. package/components/combo/themes/shared/combo.bootstrap.css.js +1 -1
  184. package/components/combo/themes/shared/combo.bootstrap.css.js.map +1 -1
  185. package/components/date-picker/date-picker.base.d.ts +33 -29
  186. package/components/date-picker/date-picker.base.js +15 -4
  187. package/components/date-picker/date-picker.base.js.map +1 -1
  188. package/components/date-picker/date-picker.d.ts +1 -1
  189. package/components/date-picker/date-picker.js +5 -3
  190. package/components/date-picker/date-picker.js.map +1 -1
  191. package/components/date-picker/themes/date-picker.base.css.js +1 -1
  192. package/components/date-picker/themes/date-picker.base.css.js.map +1 -1
  193. package/components/date-range-picker/date-range-input.d.ts +0 -2
  194. package/components/date-range-picker/date-range-input.js +0 -6
  195. package/components/date-range-picker/date-range-input.js.map +1 -1
  196. package/components/date-range-picker/date-range-picker.base.css.js +1 -1
  197. package/components/date-range-picker/date-range-picker.base.css.js.map +1 -1
  198. package/components/date-range-picker/date-range-picker.d.ts +22 -31
  199. package/components/date-range-picker/date-range-picker.js +7 -7
  200. package/components/date-range-picker/date-range-picker.js.map +1 -1
  201. package/components/date-range-picker/i18n.d.ts +21 -0
  202. package/components/date-range-picker/i18n.js +10 -0
  203. package/components/date-range-picker/i18n.js.map +1 -0
  204. package/components/date-range-picker/predefined-ranges-area.base.css.js +1 -1
  205. package/components/date-range-picker/predefined-ranges-area.base.css.js.map +1 -1
  206. package/components/date-range-picker/predefined-ranges-area.d.ts +3 -3
  207. package/components/date-range-picker/predefined-ranges-area.js +2 -5
  208. package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
  209. package/components/date-range-picker/validators.d.ts +0 -4
  210. package/components/date-range-picker/validators.js +4 -4
  211. package/components/date-range-picker/validators.js.map +1 -1
  212. package/components/date-time-input/date-time-input.base.d.ts +39 -37
  213. package/components/date-time-input/date-time-input.base.js +6 -0
  214. package/components/date-time-input/date-time-input.base.js.map +1 -1
  215. package/components/date-time-input/date-time-input.d.ts +1 -11
  216. package/components/date-time-input/date-time-input.js +0 -6
  217. package/components/date-time-input/date-time-input.js.map +1 -1
  218. package/components/date-time-input/datetime-mask-parser.d.ts +0 -10
  219. package/components/date-time-input/datetime-mask-parser.js +1 -1
  220. package/components/date-time-input/datetime-mask-parser.js.map +1 -1
  221. package/components/dialog/dialog.js.map +1 -1
  222. package/components/divider/themes/divider.base.css.js +1 -1
  223. package/components/divider/themes/divider.base.css.js.map +1 -1
  224. package/components/dropdown/dropdown-group.d.ts +2 -10
  225. package/components/dropdown/dropdown-group.js +2 -27
  226. package/components/dropdown/dropdown-group.js.map +1 -1
  227. package/components/dropdown/dropdown.d.ts +17 -23
  228. package/components/dropdown/dropdown.js +5 -17
  229. package/components/dropdown/dropdown.js.map +1 -1
  230. package/components/dropdown/themes/dropdown-item.base.css.js +1 -1
  231. package/components/dropdown/themes/dropdown-item.base.css.js.map +1 -1
  232. package/components/dropdown/themes/dropdown.base.css.js +1 -1
  233. package/components/dropdown/themes/dropdown.base.css.js.map +1 -1
  234. package/components/file-input/file-input.d.ts +2 -2
  235. package/components/file-input/file-input.js.map +1 -1
  236. package/components/file-input/themes/file-input.base.css.js +1 -1
  237. package/components/file-input/themes/file-input.base.css.js.map +1 -1
  238. package/components/file-input/themes/shared/file-input.bootstrap.css.js +1 -1
  239. package/components/file-input/themes/shared/file-input.bootstrap.css.js.map +1 -1
  240. package/components/icon/icon.d.ts +1 -1
  241. package/components/icon/icon.registry.d.ts +6 -6
  242. package/components/icon/icon.registry.js.map +1 -1
  243. package/components/input/input.d.ts +3 -3
  244. package/components/input/input.js.map +1 -1
  245. package/components/input/themes/shared/input.indigo.css.js +1 -1
  246. package/components/input/themes/shared/input.indigo.css.js.map +1 -1
  247. package/components/input/themes/shared/input.material.css.js +1 -1
  248. package/components/input/themes/shared/input.material.css.js.map +1 -1
  249. package/components/list/themes/item.base.css.js +1 -1
  250. package/components/list/themes/item.base.css.js.map +1 -1
  251. package/components/mask-input/mask-history.d.ts +22 -18
  252. package/components/mask-input/mask-history.js.map +1 -1
  253. package/components/mask-input/mask-input.d.ts +1 -1
  254. package/components/mask-input/mask-parser.d.ts +11 -13
  255. package/components/mask-input/mask-parser.js.map +1 -1
  256. package/components/nav-drawer/themes/item.base.css.js +1 -1
  257. package/components/nav-drawer/themes/item.base.css.js.map +1 -1
  258. package/components/popover/popover.d.ts +45 -34
  259. package/components/popover/popover.js +54 -122
  260. package/components/popover/popover.js.map +1 -1
  261. package/components/popover/position/arrow.d.ts +19 -0
  262. package/components/popover/position/arrow.js +33 -0
  263. package/components/popover/position/arrow.js.map +1 -0
  264. package/components/popover/position/floating.d.ts +40 -0
  265. package/components/popover/position/floating.js +146 -0
  266. package/components/popover/position/floating.js.map +1 -0
  267. package/components/popover/position/native.d.ts +45 -0
  268. package/components/popover/position/native.js +158 -0
  269. package/components/popover/position/native.js.map +1 -0
  270. package/components/popover/position/strategy.d.ts +37 -0
  271. package/components/popover/position/strategy.js +21 -0
  272. package/components/popover/position/strategy.js.map +1 -0
  273. package/components/popover/position/types.d.ts +26 -0
  274. package/components/popover/position/types.js +15 -0
  275. package/components/popover/position/types.js.map +1 -0
  276. package/components/popover/themes/light/popover.base.css.js +1 -1
  277. package/components/popover/themes/light/popover.base.css.js.map +1 -1
  278. package/components/progress/circular-progress.d.ts +0 -5
  279. package/components/progress/circular-progress.js.map +1 -1
  280. package/components/progress/themes/linear/linear.progress.base.css.js +1 -1
  281. package/components/progress/themes/linear/linear.progress.base.css.js.map +1 -1
  282. package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.d.ts +1 -0
  283. package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.js +3 -0
  284. package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.js.map +1 -0
  285. package/components/progress/themes/linear/themes.js +3 -2
  286. package/components/progress/themes/linear/themes.js.map +1 -1
  287. package/components/qr-code/qr-code.d.ts +29 -2
  288. package/components/qr-code/qr-code.js +56 -13
  289. package/components/qr-code/qr-code.js.map +1 -1
  290. package/components/qr-code/renderer/export.d.ts +28 -0
  291. package/components/qr-code/renderer/export.js +120 -0
  292. package/components/qr-code/renderer/export.js.map +1 -0
  293. package/components/qr-code/types.d.ts +26 -0
  294. package/components/qr-code/types.js.map +1 -1
  295. package/components/radio/radio.d.ts +4 -4
  296. package/components/radio/radio.js +17 -14
  297. package/components/radio/radio.js.map +1 -1
  298. package/components/radio/themes/radio.base.css.js +1 -1
  299. package/components/radio/themes/radio.base.css.js.map +1 -1
  300. package/components/radio/themes/shared/radio.bootstrap.css.js +1 -1
  301. package/components/radio/themes/shared/radio.bootstrap.css.js.map +1 -1
  302. package/components/radio/themes/shared/radio.indigo.css.js +1 -1
  303. package/components/radio/themes/shared/radio.indigo.css.js.map +1 -1
  304. package/components/radio-group/radio-group.js.map +1 -1
  305. package/components/rating/rating.d.ts +6 -6
  306. package/components/rating/rating.js.map +1 -1
  307. package/components/select/select-group.d.ts +5 -10
  308. package/components/select/select-group.js +10 -34
  309. package/components/select/select-group.js.map +1 -1
  310. package/components/select/select.d.ts +12 -20
  311. package/components/select/select.js +4 -14
  312. package/components/select/select.js.map +1 -1
  313. package/components/select/themes/select.base.css.js +1 -1
  314. package/components/select/themes/select.base.css.js.map +1 -1
  315. package/components/select/themes/shared/select.bootstrap.css.js +1 -1
  316. package/components/select/themes/shared/select.bootstrap.css.js.map +1 -1
  317. package/components/slider/themes/shared/slider.material.css.js +1 -1
  318. package/components/slider/themes/shared/slider.material.css.js.map +1 -1
  319. package/components/slider/themes/slider.base.css.js +1 -1
  320. package/components/slider/themes/slider.base.css.js.map +1 -1
  321. package/components/snackbar/themes/snackbar.base.css.js +1 -1
  322. package/components/snackbar/themes/snackbar.base.css.js.map +1 -1
  323. package/components/splitter/splitter.d.ts +6 -6
  324. package/components/splitter/splitter.js.map +1 -1
  325. package/components/splitter/themes/splitter.base.css.js +1 -1
  326. package/components/splitter/themes/splitter.base.css.js.map +1 -1
  327. package/components/stepper/themes/step/step.base.css.js +1 -1
  328. package/components/stepper/themes/step/step.base.css.js.map +1 -1
  329. package/components/tabs/themes/shared/tab/tab.bootstrap.css.js +1 -1
  330. package/components/tabs/themes/shared/tab/tab.bootstrap.css.js.map +1 -1
  331. package/components/tabs/themes/shared/tab/tab.fluent.css.js +1 -1
  332. package/components/tabs/themes/shared/tab/tab.fluent.css.js.map +1 -1
  333. package/components/tabs/themes/shared/tab/tab.indigo.css.js +1 -1
  334. package/components/tabs/themes/shared/tab/tab.indigo.css.js.map +1 -1
  335. package/components/tabs/themes/shared/tab/tab.material.css.js +1 -1
  336. package/components/tabs/themes/shared/tab/tab.material.css.js.map +1 -1
  337. package/components/tabs/themes/shared/tabs/tabs.fluent.css.js +1 -1
  338. package/components/tabs/themes/shared/tabs/tabs.fluent.css.js.map +1 -1
  339. package/components/tabs/themes/shared/tabs/tabs.indigo.css.js +1 -1
  340. package/components/tabs/themes/shared/tabs/tabs.indigo.css.js.map +1 -1
  341. package/components/tabs/themes/shared/tabs/tabs.material.css.js +1 -1
  342. package/components/tabs/themes/shared/tabs/tabs.material.css.js.map +1 -1
  343. package/components/tabs/themes/tab.base.css.js +1 -1
  344. package/components/tabs/themes/tab.base.css.js.map +1 -1
  345. package/components/textarea/textarea.d.ts +1 -1
  346. package/components/textarea/textarea.js.map +1 -1
  347. package/components/textarea/themes/shared/textarea.bootstrap.css.js +1 -1
  348. package/components/textarea/themes/shared/textarea.bootstrap.css.js.map +1 -1
  349. package/components/textarea/themes/shared/textarea.common.css.js +1 -1
  350. package/components/textarea/themes/shared/textarea.common.css.js.map +1 -1
  351. package/components/textarea/themes/shared/textarea.fluent.css.js +1 -1
  352. package/components/textarea/themes/shared/textarea.fluent.css.js.map +1 -1
  353. package/components/textarea/themes/shared/textarea.indigo.css.js +1 -1
  354. package/components/textarea/themes/shared/textarea.indigo.css.js.map +1 -1
  355. package/components/textarea/themes/shared/textarea.material.css.js +1 -1
  356. package/components/textarea/themes/shared/textarea.material.css.js.map +1 -1
  357. package/components/tile-manager/themes/tile.base.css.js +1 -1
  358. package/components/tile-manager/themes/tile.base.css.js.map +1 -1
  359. package/components/tile-manager/tile-manager.d.ts +6 -7
  360. package/components/tile-manager/tile-manager.js.map +1 -1
  361. package/components/tile-manager/tile.d.ts +3 -3
  362. package/components/tile-manager/tile.js.map +1 -1
  363. package/components/toast/themes/toast.base.css.js +1 -1
  364. package/components/toast/themes/toast.base.css.js.map +1 -1
  365. package/components/toast/toast.d.ts +0 -2
  366. package/components/toast/toast.js.map +1 -1
  367. package/components/tooltip/controller.js.map +1 -1
  368. package/components/tooltip/service.js +4 -5
  369. package/components/tooltip/service.js.map +1 -1
  370. package/components/tooltip/themes/tooltip.base.css.js +1 -1
  371. package/components/tooltip/themes/tooltip.base.css.js.map +1 -1
  372. package/components/tooltip/tooltip.d.ts +34 -13
  373. package/components/tooltip/tooltip.js +8 -4
  374. package/components/tooltip/tooltip.js.map +1 -1
  375. package/components/tree/themes/item.base.css.js +1 -1
  376. package/components/tree/themes/item.base.css.js.map +1 -1
  377. package/components/tree/tree-item.d.ts +6 -6
  378. package/components/tree/tree-item.js.map +1 -1
  379. package/components/tree/tree.navigation.d.ts +5 -6
  380. package/components/tree/tree.navigation.js.map +1 -1
  381. package/components/tree/tree.selection.js.map +1 -1
  382. package/components/types.d.ts +1 -1
  383. package/components/types.js.map +1 -1
  384. package/components/validation-container/themes/validator.base.css.js +1 -1
  385. package/components/validation-container/themes/validator.base.css.js.map +1 -1
  386. package/components/validation-container/validation-container.d.ts +10 -12
  387. package/components/validation-container/validation-container.js +14 -17
  388. package/components/validation-container/validation-container.js.map +1 -1
  389. package/components/virtualization/engine.d.ts +5 -5
  390. package/components/virtualization/engine.js.map +1 -1
  391. package/components/virtualization/virtualization.d.ts +61 -63
  392. package/components/virtualization/virtualization.js +6 -5
  393. package/components/virtualization/virtualization.js.map +1 -1
  394. package/custom-elements.json +16769 -19698
  395. package/igniteui-webcomponents.css-data.json +2 -2
  396. package/igniteui-webcomponents.html-data.json +1 -1
  397. package/index.d.ts +3 -1
  398. package/index.js +2 -0
  399. package/index.js.map +1 -1
  400. package/internals/abort-handler.d.ts +13 -25
  401. package/internals/abort-handler.js +4 -6
  402. package/internals/abort-handler.js.map +1 -1
  403. package/internals/context.d.ts +13 -7
  404. package/internals/context.js +2 -1
  405. package/internals/context.js.map +1 -1
  406. package/internals/controllers/adopt-styles.d.ts +19 -20
  407. package/internals/controllers/adopt-styles.js +3 -8
  408. package/internals/controllers/adopt-styles.js.map +1 -1
  409. package/internals/controllers/aria-projection.d.ts +56 -55
  410. package/internals/controllers/aria-projection.js +14 -15
  411. package/internals/controllers/aria-projection.js.map +1 -1
  412. package/internals/controllers/async-consumer.js.map +1 -1
  413. package/internals/controllers/command.d.ts +15 -30
  414. package/internals/controllers/command.js +2 -7
  415. package/internals/controllers/command.js.map +1 -1
  416. package/internals/controllers/context-provider.d.ts +7 -13
  417. package/internals/controllers/context-provider.js.map +1 -1
  418. package/internals/controllers/focus-ring.d.ts +10 -30
  419. package/internals/controllers/focus-ring.js +6 -12
  420. package/internals/controllers/focus-ring.js.map +1 -1
  421. package/internals/controllers/fullscreen.d.ts +7 -23
  422. package/internals/controllers/fullscreen.js +3 -9
  423. package/internals/controllers/fullscreen.js.map +1 -1
  424. package/internals/controllers/gestures.d.ts +10 -29
  425. package/internals/controllers/gestures.js +1 -3
  426. package/internals/controllers/gestures.js.map +1 -1
  427. package/internals/controllers/group.d.ts +13 -30
  428. package/internals/controllers/group.js.map +1 -1
  429. package/internals/controllers/host-listeners.d.ts +28 -0
  430. package/internals/controllers/host-listeners.js +27 -0
  431. package/internals/controllers/host-listeners.js.map +1 -0
  432. package/internals/controllers/id-resolver.d.ts +8 -9
  433. package/internals/controllers/id-resolver.js +6 -14
  434. package/internals/controllers/id-resolver.js.map +1 -1
  435. package/internals/controllers/internals.d.ts +53 -104
  436. package/internals/controllers/internals.js +40 -13
  437. package/internals/controllers/internals.js.map +1 -1
  438. package/internals/controllers/key-bindings.d.ts +61 -158
  439. package/internals/controllers/key-bindings.js +68 -67
  440. package/internals/controllers/key-bindings.js.map +1 -1
  441. package/internals/controllers/keys.d.ts +32 -0
  442. package/internals/controllers/keys.js +20 -0
  443. package/internals/controllers/keys.js.map +1 -0
  444. package/internals/controllers/mutation-observer.d.ts +14 -37
  445. package/internals/controllers/mutation-observer.js +1 -1
  446. package/internals/controllers/mutation-observer.js.map +1 -1
  447. package/internals/controllers/resize-observer.d.ts +9 -19
  448. package/internals/controllers/resize-observer.js.map +1 -1
  449. package/internals/controllers/root-click.d.ts +11 -42
  450. package/internals/controllers/root-click.js +4 -6
  451. package/internals/controllers/root-click.js.map +1 -1
  452. package/internals/controllers/roving-focus.d.ts +16 -35
  453. package/internals/controllers/roving-focus.js.map +1 -1
  454. package/internals/controllers/slot.d.ts +25 -54
  455. package/internals/controllers/slot.js +6 -6
  456. package/internals/controllers/slot.js.map +1 -1
  457. package/internals/controllers/toggle.d.ts +44 -48
  458. package/internals/controllers/toggle.js.map +1 -1
  459. package/internals/date/compare.js.map +1 -1
  460. package/internals/date/converters.d.ts +10 -7
  461. package/internals/date/converters.js.map +1 -1
  462. package/internals/date/model.d.ts +9 -16
  463. package/internals/date/model.js +22 -25
  464. package/internals/date/model.js.map +1 -1
  465. package/internals/decorators/blazorAdditionalDependencies.d.ts +4 -2
  466. package/internals/decorators/blazorAdditionalDependencies.js.map +1 -1
  467. package/internals/decorators/blazorDeepImport.d.ts +1 -3
  468. package/internals/decorators/blazorDeepImport.js.map +1 -1
  469. package/internals/decorators/blazorInclude.d.ts +3 -2
  470. package/internals/decorators/blazorInclude.js.map +1 -1
  471. package/internals/decorators/blazorIndirectRender.d.ts +1 -3
  472. package/internals/decorators/blazorIndirectRender.js.map +1 -1
  473. package/internals/decorators/blazorSuppressComponent.d.ts +1 -3
  474. package/internals/decorators/blazorSuppressComponent.js.map +1 -1
  475. package/internals/decorators/coerced-property.d.ts +14 -20
  476. package/internals/decorators/coerced-property.js.map +1 -1
  477. package/internals/decorators/shadow-options.d.ts +2 -5
  478. package/internals/decorators/shadow-options.js.map +1 -1
  479. package/internals/definitions/defineAllComponents.js +6 -0
  480. package/internals/definitions/defineAllComponents.js.map +1 -1
  481. package/internals/directives/drag.d.ts +51 -81
  482. package/internals/directives/drag.js +27 -89
  483. package/internals/directives/drag.js.map +1 -1
  484. package/internals/directives/pointer-operation.d.ts +75 -0
  485. package/internals/directives/pointer-operation.js +92 -0
  486. package/internals/directives/pointer-operation.js.map +1 -0
  487. package/internals/directives/resize.d.ts +36 -64
  488. package/internals/directives/resize.js +18 -85
  489. package/internals/directives/resize.js.map +1 -1
  490. package/internals/i18n/EN/calendar.resources.d.ts +8 -2
  491. package/internals/i18n/EN/calendar.resources.js +2 -2
  492. package/internals/i18n/EN/calendar.resources.js.map +1 -1
  493. package/internals/i18n/EN/chat.resources.d.ts +8 -2
  494. package/internals/i18n/EN/chat.resources.js +3 -10
  495. package/internals/i18n/EN/chat.resources.js.map +1 -1
  496. package/internals/i18n/EN/date-picker.resources.d.ts +6 -4
  497. package/internals/i18n/EN/date-picker.resources.js +1 -7
  498. package/internals/i18n/EN/date-picker.resources.js.map +1 -1
  499. package/internals/i18n/EN/date-range-picker.resources.d.ts +9 -2
  500. package/internals/i18n/EN/date-range-picker.resources.js +2 -2
  501. package/internals/i18n/EN/date-range-picker.resources.js.map +1 -1
  502. package/internals/i18n/i18n-controller.d.ts +44 -46
  503. package/internals/i18n/i18n-controller.js +46 -33
  504. package/internals/i18n/i18n-controller.js.map +1 -1
  505. package/internals/i18n/utils.d.ts +9 -4
  506. package/internals/i18n/utils.js +4 -27
  507. package/internals/i18n/utils.js.map +1 -1
  508. package/internals/mixins/alert.d.ts +10 -25
  509. package/internals/mixins/alert.js.map +1 -1
  510. package/internals/mixins/combo-box.d.ts +21 -11
  511. package/internals/mixins/combo-box.js +16 -22
  512. package/internals/mixins/combo-box.js.map +1 -1
  513. package/internals/mixins/event-emitter.js +9 -11
  514. package/internals/mixins/event-emitter.js.map +1 -1
  515. package/internals/mixins/forms/associated-required.d.ts +4 -4
  516. package/internals/mixins/forms/associated-required.js.map +1 -1
  517. package/internals/mixins/forms/associated.d.ts +4 -2
  518. package/internals/mixins/forms/associated.js +8 -19
  519. package/internals/mixins/forms/associated.js.map +1 -1
  520. package/internals/mixins/forms/form-transformers.js.map +1 -1
  521. package/internals/mixins/forms/types.d.ts +24 -80
  522. package/internals/mixins/forms/types.js.map +1 -1
  523. package/internals/mixins/group.d.ts +18 -0
  524. package/internals/mixins/group.js +37 -0
  525. package/internals/mixins/group.js.map +1 -0
  526. package/internals/mixins/i18n.d.ts +10 -16
  527. package/internals/mixins/i18n.js.map +1 -1
  528. package/internals/mixins/mask-behavior.d.ts +8 -22
  529. package/internals/mixins/mask-behavior.js +1 -2
  530. package/internals/mixins/mask-behavior.js.map +1 -1
  531. package/internals/mixins/option.d.ts +1 -2
  532. package/internals/mixins/option.js +2 -1
  533. package/internals/mixins/option.js.map +1 -1
  534. package/internals/part-map.d.ts +4 -2
  535. package/internals/part-map.js +1 -1
  536. package/internals/part-map.js.map +1 -1
  537. package/internals/templates/input-shell.d.ts +8 -17
  538. package/internals/templates/input-shell.js +4 -1
  539. package/internals/templates/input-shell.js.map +1 -1
  540. package/internals/templates/masked-input.d.ts +7 -8
  541. package/internals/templates/masked-input.js.map +1 -1
  542. package/internals/templates/slotted-icon.d.ts +7 -12
  543. package/internals/templates/slotted-icon.js.map +1 -1
  544. package/internals/templates/toggle-shell.d.ts +6 -7
  545. package/internals/templates/toggle-shell.js.map +1 -1
  546. package/internals/timing.d.ts +5 -14
  547. package/internals/timing.js.map +1 -1
  548. package/internals/utils/arrays.d.ts +21 -21
  549. package/internals/utils/arrays.js +14 -0
  550. package/internals/utils/arrays.js.map +1 -1
  551. package/internals/utils/dom.d.ts +51 -39
  552. package/internals/utils/dom.js +1 -2
  553. package/internals/utils/dom.js.map +1 -1
  554. package/internals/utils/events.d.ts +29 -16
  555. package/internals/utils/events.js +9 -1
  556. package/internals/utils/events.js.map +1 -1
  557. package/internals/utils/lit.d.ts +5 -2
  558. package/internals/utils/lit.js.map +1 -1
  559. package/internals/utils/math.d.ts +8 -6
  560. package/internals/utils/math.js.map +1 -1
  561. package/internals/utils/objects.d.ts +3 -20
  562. package/internals/utils/objects.js +1 -39
  563. package/internals/utils/objects.js.map +1 -1
  564. package/internals/utils/strings.d.ts +9 -11
  565. package/internals/utils/strings.js.map +1 -1
  566. package/internals/utils/types.d.ts +16 -3
  567. package/internals/utils/types.js +3 -0
  568. package/internals/utils/types.js.map +1 -1
  569. package/internals/validators.d.ts +9 -8
  570. package/internals/validators.js +12 -6
  571. package/internals/validators.js.map +1 -1
  572. package/package.json +1 -1
  573. package/skills/README.md +3 -0
  574. package/skills/igniteui-wc-figma-to-app/SKILL.md +907 -0
  575. package/skills/igniteui-wc-figma-to-app/references/asset-extraction.md +363 -0
  576. package/skills/igniteui-wc-figma-to-app/references/design-token-bridge.md +407 -0
  577. package/skills/igniteui-wc-figma-to-app/references/figma-component-map.md +325 -0
  578. package/skills/igniteui-wc-figma-to-app/references/mcp-setup.md +409 -0
  579. package/skills/igniteui-wc-figma-to-app/references/validation-patterns.md +376 -0
  580. package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +21 -0
  581. package/skills/igniteui-wc-integrate-with-framework/SKILL.md +4 -3
  582. package/skills/igniteui-wc-integrate-with-framework/references/vanilla-js.md +14 -0
  583. package/skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md +12 -2
  584. package/theming/config.d.ts +14 -5
  585. package/theming/config.js +38 -18
  586. package/theming/config.js.map +1 -1
  587. package/theming/context.d.ts +1 -23
  588. package/theming/context.js.map +1 -1
  589. package/theming/theming-controller.d.ts +2 -32
  590. package/theming/theming-controller.js +15 -21
  591. package/theming/theming-controller.js.map +1 -1
  592. package/theming/theming-event.d.ts +0 -7
  593. package/theming/theming-event.js +0 -13
  594. package/theming/theming-event.js.map +1 -1
  595. package/theming/types.d.ts +1 -8
  596. package/theming/types.js.map +1 -1
  597. package/web-types.json +3 -3
  598. package/animations/presets/slide/index.d.ts +0 -3
  599. package/animations/presets/slide/index.js +0 -16
  600. package/animations/presets/slide/index.js.map +0 -1
  601. package/internals/controllers/root-scroll.d.ts +0 -31
  602. package/internals/controllers/root-scroll.js +0 -71
  603. package/internals/controllers/root-scroll.js.map +0 -1
  604. package/theming/utils.d.ts +0 -11
  605. package/theming/utils.js +0 -20
  606. package/theming/utils.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
+ import type { PopoverScrollStrategy } from '../../components/types.js';
2
3
  import type { RootClickController } from '../controllers/root-click.js';
3
4
  import { type ToggleEventMap } from '../controllers/toggle.js';
4
5
  import type { UnpackCustomEvent } from './event-emitter.js';
@@ -12,6 +13,19 @@ export declare abstract class IgcBaseComboBoxComponent extends LitElement {
12
13
  * @default false
13
14
  */
14
15
  open: boolean;
16
+ /**
17
+ * Sets the behavior of the component when the parent container scrolls.
18
+ *
19
+ * If the value is `hide`, the component hides while the anchor is fully out
20
+ * of view. `hide` is the default value.
21
+ *
22
+ * If the value is `scroll`, the component stays visible and anchored.
23
+ *
24
+ * If the value is `close`, the component closes on each scroll.
25
+ * @attr scroll-strategy
26
+ * @default hide
27
+ */
28
+ scrollStrategy: PopoverScrollStrategy;
15
29
  protected _handleAnchorClick(): void;
16
30
  protected _hide(emitEvent?: boolean): Promise<boolean>;
17
31
  protected _show(emitEvent?: boolean): Promise<boolean>;
@@ -24,33 +38,29 @@ export declare abstract class IgcBaseComboBoxComponent extends LitElement {
24
38
  }
25
39
  export declare abstract class IgcComboBoxBaseLikeComponent extends IgcBaseComboBoxComponent {
26
40
  /**
27
- * Whether the component dropdown should be kept open on selection.
41
+ * Keeps the dropdown of the component open after the user selects an item.
28
42
  * @attr keep-open-on-select
29
43
  * @default false
30
44
  */
31
45
  keepOpenOnSelect: boolean;
32
46
  /**
33
- * Whether the component dropdown should be kept open on clicking outside of it.
47
+ * Keeps the dropdown of the component open when the user clicks outside of
48
+ * it.
34
49
  * @attr keep-open-on-outside-click
35
50
  * @default false
36
51
  */
37
52
  keepOpenOnOutsideClick: boolean;
38
53
  }
39
- export declare function getItems<T extends HTMLElement>(root: Node, tagName: string): Generator<T>;
54
+ /** Returns the elements of `root` matching `tagName` and `predicate`. */
55
+ export declare function getItems<T extends HTMLElement>(root: Node, tagName: string, predicate?: (item: T) => boolean): Generator<T>;
40
56
  export declare function getActiveItems<T extends HTMLElement & {
41
57
  disabled: boolean;
42
58
  }>(root: Node, tagName: string): Generator<T>;
43
- /**
44
- * Returns the first non-disabled item after `from`, or `from` itself when it is
45
- * already the last one.
46
- */
59
+ /** Returns the first non-disabled item after `from`, else `from` itself. */
47
60
  export declare function getNextActiveItem<T extends HTMLElement & {
48
61
  disabled: boolean;
49
62
  }>(items: T[], from?: T | null): T | undefined;
50
- /**
51
- * Returns the first non-disabled item before `from`, or `from` itself when it
52
- * is already the first one.
53
- */
63
+ /** Returns the first non-disabled item before `from`, else `from` itself. */
54
64
  export declare function getPreviousActiveItem<T extends HTMLElement & {
55
65
  disabled: boolean;
56
66
  }>(items: T[], from?: T | null): T | undefined;
@@ -7,13 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { LitElement } from 'lit';
8
8
  import { property } from 'lit/decorators.js';
9
9
  import { addToggleController, } from '../controllers/toggle.js';
10
- import { lastOf } from '../utils/arrays.js';
11
10
  import { iterNodes } from '../utils/dom.js';
12
11
  export class IgcBaseComboBoxComponent extends LitElement {
13
12
  constructor() {
14
13
  super(...arguments);
15
14
  this._toggleController = addToggleController(this);
16
15
  this.open = false;
16
+ this.scrollStrategy = 'hide';
17
17
  }
18
18
  _handleAnchorClick() {
19
19
  this.open ? this._hide(true) : this._show(true);
@@ -37,6 +37,9 @@ export class IgcBaseComboBoxComponent extends LitElement {
37
37
  __decorate([
38
38
  property({ type: Boolean, reflect: true })
39
39
  ], IgcBaseComboBoxComponent.prototype, "open", void 0);
40
+ __decorate([
41
+ property({ attribute: 'scroll-strategy' })
42
+ ], IgcBaseComboBoxComponent.prototype, "scrollStrategy", void 0);
40
43
  export class IgcComboBoxBaseLikeComponent extends IgcBaseComboBoxComponent {
41
44
  constructor() {
42
45
  super(...arguments);
@@ -54,45 +57,36 @@ __decorate([
54
57
  attribute: 'keep-open-on-outside-click',
55
58
  })
56
59
  ], IgcComboBoxBaseLikeComponent.prototype, "keepOpenOnOutsideClick", void 0);
57
- export function getItems(root, tagName) {
60
+ export function getItems(root, tagName, predicate) {
58
61
  return iterNodes(root, {
59
62
  show: 'SHOW_ELEMENT',
60
- filter: (item) => item.matches(tagName),
63
+ filter: (item) => item.matches(tagName) && (predicate ? predicate(item) : true),
61
64
  });
62
65
  }
63
66
  export function getActiveItems(root, tagName) {
64
- return iterNodes(root, {
65
- show: 'SHOW_ELEMENT',
66
- filter: (item) => item.matches(tagName) && !item.disabled,
67
- });
67
+ return getItems(root, tagName, (item) => !item.disabled);
68
68
  }
69
- function indexOfItem(items, from, fallback) {
69
+ function getActiveItemFrom(items, from, step) {
70
70
  const index = from ? items.indexOf(from) : -1;
71
- return index < 0 ? fallback : index;
72
- }
73
- export function getNextActiveItem(items, from) {
74
- const current = indexOfItem(items, from, -1);
75
- for (let i = current + 1; i < items.length; i++) {
71
+ const current = index < 0 ? (step === 1 ? -1 : items.length) : index;
72
+ for (let i = current + step; i >= 0 && i < items.length; i += step) {
76
73
  if (!items[i].disabled) {
77
74
  return items[i];
78
75
  }
79
76
  }
80
77
  return items[current];
81
78
  }
79
+ export function getNextActiveItem(items, from) {
80
+ return getActiveItemFrom(items, from, 1);
81
+ }
82
82
  export function getPreviousActiveItem(items, from) {
83
- const current = indexOfItem(items, from, items.length);
84
- for (let i = current - 1; i >= 0; i--) {
85
- if (!items[i].disabled) {
86
- return items[i];
87
- }
88
- }
89
- return items[current];
83
+ return getActiveItemFrom(items, from, -1);
90
84
  }
91
85
  export function setInitialSelectionState(items) {
92
- const lastSelected = lastOf(items.filter((item) => item.selected));
86
+ const lastSelected = items.findLast((item) => item.selected) ?? null;
93
87
  for (const item of items) {
94
88
  item.selected = item === lastSelected;
95
89
  }
96
- return lastSelected ?? null;
90
+ return lastSelected;
97
91
  }
98
92
  //# sourceMappingURL=combo-box.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../src/internals/mixins/combo-box.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EACL,mBAAmB,GAEpB,MAAM,0BAA0B,CA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KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC;AAMD,MAAM,UAAU,qBAAqB,CAEnC,KAAU,EAAE,IAAe;IAC3B,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEvD,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAEtC,KAAU;IACV,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEnE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,KAAK,YAAY,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,IAAI,IAAI,CAAC;AAC9B,CAAC","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { RootClickController } from '../controllers/root-click.js';\nimport {\n addToggleController,\n type ToggleEventMap,\n} from '../controllers/toggle.js';\nimport { lastOf } from '../utils/arrays.js';\nimport { iterNodes } from '../utils/dom.js';\nimport type { UnpackCustomEvent } from './event-emitter.js';\n\n/* blazorIndirectRender */\n/* omitModule */\nexport abstract class IgcBaseComboBoxComponent extends LitElement {\n /* blazorSuppress */\n declare public emitEvent: <\n K extends keyof ToggleEventMap,\n D extends UnpackCustomEvent<ToggleEventMap[K]>,\n >(\n event: K,\n eventInitDict?: CustomEventInit<D>\n ) => boolean;\n\n protected abstract _rootClickController: RootClickController;\n private readonly _toggleController = addToggleController(this);\n\n /**\n * Sets the open state of the component.\n * @attr open\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n protected _handleAnchorClick(): void {\n this.open ? this._hide(true) : this._show(true);\n }\n\n protected _hide(emitEvent = false): Promise<boolean> {\n return this._toggleController.hide(emitEvent);\n }\n\n protected _show(emitEvent = false): Promise<boolean> {\n return this._toggleController.show(emitEvent);\n }\n\n /** Shows the component. */\n public async show(): Promise<boolean> {\n return this._show();\n }\n\n /** Hides the component. */\n public async hide(): Promise<boolean> {\n return this._hide();\n }\n\n /** Toggles the open state of the component. */\n public async toggle(): Promise<boolean> {\n return this.open ? this.hide() : this.show();\n }\n}\n\n/* blazorIndirectRender */\n/* omitModule */\nexport abstract class IgcComboBoxBaseLikeComponent extends IgcBaseComboBoxComponent {\n /**\n * Whether the component dropdown should be kept open on selection.\n * @attr keep-open-on-select\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'keep-open-on-select' })\n public keepOpenOnSelect = false;\n\n /**\n * Whether the component dropdown should be kept open on clicking outside of it.\n * @attr keep-open-on-outside-click\n * @default false\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'keep-open-on-outside-click',\n })\n public keepOpenOnOutsideClick = false;\n}\n\nexport function getItems<T extends HTMLElement>(\n root: Node,\n tagName: string\n): Generator<T> {\n return iterNodes<T>(root, {\n show: 'SHOW_ELEMENT',\n filter: (item) => item.matches(tagName),\n });\n}\n\nexport function getActiveItems<T extends HTMLElement & { disabled: boolean }>(\n root: Node,\n tagName: string\n): Generator<T> {\n return iterNodes<T>(root, {\n show: 'SHOW_ELEMENT',\n filter: (item) => item.matches(tagName) && !item.disabled,\n });\n}\n\n/**\n * Both navigation helpers accept a missing or detached `from`, in which case\n * the search runs from the edge of the collection. They return `undefined` only\n * when there is nothing to navigate to at all.\n */\nfunction indexOfItem<T extends HTMLElement>(\n items: T[],\n from: T | null | undefined,\n fallback: number\n): number {\n const index = from ? items.indexOf(from) : -1;\n return index < 0 ? fallback : index;\n}\n\n/**\n * Returns the first non-disabled item after `from`, or `from` itself when it is\n * already the last one.\n */\nexport function getNextActiveItem<\n T extends HTMLElement & { disabled: boolean },\n>(items: T[], from?: T | null): T | undefined {\n const current = indexOfItem(items, from, -1);\n\n for (let i = current + 1; i < items.length; i++) {\n if (!items[i].disabled) {\n return items[i];\n }\n }\n\n return items[current];\n}\n\n/**\n * Returns the first non-disabled item before `from`, or `from` itself when it\n * is already the first one.\n */\nexport function getPreviousActiveItem<\n T extends HTMLElement & { disabled: boolean },\n>(items: T[], from?: T | null): T | undefined {\n const current = indexOfItem(items, from, items.length);\n\n for (let i = current - 1; i >= 0; i--) {\n if (!items[i].disabled) {\n return items[i];\n }\n }\n\n return items[current];\n}\n\nexport function setInitialSelectionState<\n T extends HTMLElement & { selected: boolean },\n>(items: T[]): T | null {\n const lastSelected = lastOf(items.filter((item) => item.selected));\n\n for (const item of items) {\n item.selected = item === lastSelected;\n }\n\n return lastSelected ?? null;\n}\n"]}
1
+ {"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../src/internals/mixins/combo-box.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EACL,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,MAAM,OAAgB,wBAAyB,SAAQ,UAAU;IAAjE;;QAWmB,sBAAiB,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAQxD,SAAI,GAAG,KAAK,CAAC;QAeb,mBAAc,GAA0B,MAAM,CAAC;IA4BxD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AAM,UAAU,iBAAiB,CAE/B,KAAU,EAAE,IAAe;IAC3B,OAAO,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAGD,MAAM,UAAU,qBAAqB,CAEnC,KAAU,EAAE,IAAe;IAC3B,OAAO,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,wBAAwB,CAEtC,KAAU;IACV,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;IAErE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,KAAK,YAAY,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { PopoverScrollStrategy } from '../../components/types.js';\nimport type { RootClickController } from '../controllers/root-click.js';\nimport {\n addToggleController,\n type ToggleEventMap,\n} from '../controllers/toggle.js';\n\nimport { iterNodes } from '../utils/dom.js';\nimport type { UnpackCustomEvent } from './event-emitter.js';\n\n/* blazorIndirectRender */\n/* omitModule */\nexport abstract class IgcBaseComboBoxComponent extends LitElement {\n /* blazorSuppress */\n declare public emitEvent: <\n K extends keyof ToggleEventMap,\n D extends UnpackCustomEvent<ToggleEventMap[K]>,\n >(\n event: K,\n eventInitDict?: CustomEventInit<D>\n ) => boolean;\n\n protected abstract _rootClickController: RootClickController;\n private readonly _toggleController = addToggleController(this);\n\n /**\n * Sets the open state of the component.\n * @attr open\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * Sets the behavior of the component when the parent container scrolls.\n *\n * If the value is `hide`, the component hides while the anchor is fully out\n * of view. `hide` is the default value.\n *\n * If the value is `scroll`, the component stays visible and anchored.\n *\n * If the value is `close`, the component closes on each scroll.\n * @attr scroll-strategy\n * @default hide\n */\n @property({ attribute: 'scroll-strategy' })\n public scrollStrategy: PopoverScrollStrategy = 'hide';\n\n protected _handleAnchorClick(): void {\n this.open ? this._hide(true) : this._show(true);\n }\n\n protected _hide(emitEvent = false): Promise<boolean> {\n return this._toggleController.hide(emitEvent);\n }\n\n protected _show(emitEvent = false): Promise<boolean> {\n return this._toggleController.show(emitEvent);\n }\n\n /** Shows the component. */\n public async show(): Promise<boolean> {\n return this._show();\n }\n\n /** Hides the component. */\n public async hide(): Promise<boolean> {\n return this._hide();\n }\n\n /** Toggles the open state of the component. */\n public async toggle(): Promise<boolean> {\n return this.open ? this.hide() : this.show();\n }\n}\n\n/* blazorIndirectRender */\n/* omitModule */\nexport abstract class IgcComboBoxBaseLikeComponent extends IgcBaseComboBoxComponent {\n /**\n * Keeps the dropdown of the component open after the user selects an item.\n * @attr keep-open-on-select\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'keep-open-on-select' })\n public keepOpenOnSelect = false;\n\n /**\n * Keeps the dropdown of the component open when the user clicks outside of\n * it.\n * @attr keep-open-on-outside-click\n * @default false\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'keep-open-on-outside-click',\n })\n public keepOpenOnOutsideClick = false;\n}\n\n/** Returns the elements of `root` matching `tagName` and `predicate`. */\nexport function getItems<T extends HTMLElement>(\n root: Node,\n tagName: string,\n predicate?: (item: T) => boolean\n): Generator<T> {\n return iterNodes<T>(root, {\n show: 'SHOW_ELEMENT',\n filter: (item) =>\n item.matches(tagName) && (predicate ? predicate(item) : true),\n });\n}\n\nexport function getActiveItems<T extends HTMLElement & { disabled: boolean }>(\n root: Node,\n tagName: string\n): Generator<T> {\n return getItems<T>(root, tagName, (item) => !item.disabled);\n}\n\n/**\n * Returns the closest non-disabled item to `from` in the given direction. A\n * missing or detached `from` starts at the edge; falls back to `from`, or\n * `undefined` when there is nothing to navigate to.\n */\nfunction getActiveItemFrom<T extends HTMLElement & { disabled: boolean }>(\n items: T[],\n from: T | null | undefined,\n step: -1 | 1\n): T | undefined {\n const index = from ? items.indexOf(from) : -1;\n const current = index < 0 ? (step === 1 ? -1 : items.length) : index;\n\n for (let i = current + step; i >= 0 && i < items.length; i += step) {\n if (!items[i].disabled) {\n return items[i];\n }\n }\n\n return items[current];\n}\n\n/** Returns the first non-disabled item after `from`, else `from` itself. */\nexport function getNextActiveItem<\n T extends HTMLElement & { disabled: boolean },\n>(items: T[], from?: T | null): T | undefined {\n return getActiveItemFrom(items, from, 1);\n}\n\n/** Returns the first non-disabled item before `from`, else `from` itself. */\nexport function getPreviousActiveItem<\n T extends HTMLElement & { disabled: boolean },\n>(items: T[], from?: T | null): T | undefined {\n return getActiveItemFrom(items, from, -1);\n}\n\nexport function setInitialSelectionState<\n T extends HTMLElement & { selected: boolean },\n>(items: T[]): T | null {\n const lastSelected = items.findLast((item) => item.selected) ?? null;\n\n for (const item of items) {\n item.selected = item === lastSelected;\n }\n\n return lastSelected;\n}\n"]}
@@ -1,18 +1,16 @@
1
+ const defaultEventInit = {
2
+ bubbles: true,
3
+ cancelable: false,
4
+ composed: true,
5
+ };
1
6
  export function EventEmitterMixin(superClass) {
2
7
  class EventEmitterElement extends superClass {
3
- addEventListener(type, listener, options) {
4
- super.addEventListener(type, listener, options);
5
- }
6
- removeEventListener(type, listener, options) {
7
- super.removeEventListener(type, listener, options);
8
- }
9
8
  emitEvent(type, eventInitDict) {
10
- return this.dispatchEvent(new CustomEvent(type, Object.assign({
11
- bubbles: true,
12
- cancelable: false,
13
- composed: true,
9
+ return this.dispatchEvent(new CustomEvent(type, {
14
10
  detail: {},
15
- }, eventInitDict)));
11
+ ...defaultEventInit,
12
+ ...eventInitDict,
13
+ }));
16
14
  }
17
15
  }
18
16
  return EventEmitterElement;
@@ -1 +1 @@
1
- {"version":3,"file":"event-emitter.js","sourceRoot":"","sources":["../../../src/internals/mixins/event-emitter.ts"],"names":[],"mappings":"AAsCA,MAAM,UAAU,iBAAiB,CAC/B,UAAa;IAEb,MAAM,mBAAoB,SAAQ,UAAU;QAY1B,gBAAgB,CAC9B,IAAY,EACZ,QAA4C,EAC5C,OAA2C;YAE3C,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC;QAae,mBAAmB,CACjC,IAAY,EACZ,QAA4C,EAC5C,OAAwC;YAExC,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QAKM,SAAS,CACd,IAAO,EACP,aAAkC;YAElC,OAAO,IAAI,CAAC,aAAa,CACvB,IAAI,WAAW,CACb,IAAc,EACd,MAAM,CAAC,MAAM,CACX;gBACE,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,EAAE;aACX,EACD,aAAa,CACd,CACF,CACF,CAAC;QACJ,CAAC;KACF;IACD,OAAO,mBAAgE,CAAC;AAC1E,CAAC","sourcesContent":["import type { LitElement } from 'lit';\nimport type { AbstractConstructor, Constructor } from './constructor.js';\n\nexport type UnpackCustomEvent<T> = T extends CustomEvent<infer U> ? U : never;\n\nexport declare class EventEmitterInterface<E> {\n public addEventListener<K extends keyof M, M extends E & HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n public addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void;\n public removeEventListener<\n K extends keyof M,\n M extends E & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n public removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void;\n public emitEvent<K extends keyof E, D extends UnpackCustomEvent<E[K]>>(\n type: K,\n eventInitDict?: CustomEventInit<D>\n ): boolean;\n}\n\nexport function EventEmitterMixin<E, T extends AbstractConstructor<LitElement>>(\n superClass: T\n): Constructor<EventEmitterInterface<E>> & T;\nexport function EventEmitterMixin<E, T extends Constructor<LitElement>>(\n superClass: T\n) {\n class EventEmitterElement extends superClass {\n /**\n * @hidden\n */\n public override addEventListener<\n K extends keyof M,\n M extends E & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n public override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n super.addEventListener(type, listener, options);\n }\n\n /**\n * @hidden\n */\n public override removeEventListener<\n K extends keyof M,\n M extends E & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n public override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void {\n super.removeEventListener(type, listener, options);\n }\n\n /**\n * @hidden @internal\n */\n public emitEvent<K extends keyof E, D extends UnpackCustomEvent<E[K]>>(\n type: K,\n eventInitDict?: CustomEventInit<D>\n ): boolean {\n return this.dispatchEvent(\n new CustomEvent<D>(\n type as string,\n Object.assign(\n {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail: {},\n },\n eventInitDict\n )\n )\n );\n }\n }\n return EventEmitterElement as Constructor<EventEmitterInterface<E>> & T;\n}\n"]}
1
+ {"version":3,"file":"event-emitter.js","sourceRoot":"","sources":["../../../src/internals/mixins/event-emitter.ts"],"names":[],"mappings":"AASA,MAAM,gBAAgB,GAAoB;IACxC,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,IAAI;CACf,CAAC;AAmCF,MAAM,UAAU,iBAAiB,CAC/B,UAAa;IAEb,MAAM,mBAAoB,SAAQ,UAAU;QAInC,SAAS,CACd,IAAO,EACP,aAAkC;YAElC,OAAO,IAAI,CAAC,aAAa,CACvB,IAAI,WAAW,CAAI,IAAc,EAAE;gBACjC,MAAM,EAAE,EAAO;gBACf,GAAG,gBAAgB;gBACnB,GAAG,aAAa;aACjB,CAAC,CACH,CAAC;QACJ,CAAC;KACF;IACD,OAAO,mBAAgE,CAAC;AAC1E,CAAC","sourcesContent":["import type { LitElement } from 'lit';\nimport type { AbstractConstructor, Constructor } from './constructor.js';\n\nexport type UnpackCustomEvent<T> = T extends CustomEvent<infer U> ? U : never;\n\n/**\n * The default event init. `detail` is absent: a shared constant would give\n * every detail-less event the same object.\n */\nconst defaultEventInit: CustomEventInit = {\n bubbles: true,\n cancelable: false,\n composed: true,\n};\n\nexport declare class EventEmitterInterface<E> {\n public addEventListener<K extends keyof M, M extends E & HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n public addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void;\n public removeEventListener<\n K extends keyof M,\n M extends E & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n public removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void;\n public emitEvent<K extends keyof E, D extends UnpackCustomEvent<E[K]>>(\n type: K,\n eventInitDict?: CustomEventInit<D>\n ): boolean;\n}\n\nexport function EventEmitterMixin<E, T extends AbstractConstructor<LitElement>>(\n superClass: T\n): Constructor<EventEmitterInterface<E>> & T;\nexport function EventEmitterMixin<E, T extends Constructor<LitElement>>(\n superClass: T\n) {\n class EventEmitterElement extends superClass {\n /**\n * @hidden @internal\n */\n public emitEvent<K extends keyof E, D extends UnpackCustomEvent<E[K]>>(\n type: K,\n eventInitDict?: CustomEventInit<D>\n ): boolean {\n return this.dispatchEvent(\n new CustomEvent<D>(type as string, {\n detail: {} as D,\n ...defaultEventInit,\n ...eventInitDict,\n })\n );\n }\n }\n return EventEmitterElement as Constructor<EventEmitterInterface<E>> & T;\n}\n"]}
@@ -2,12 +2,12 @@ import type { LitElement } from 'lit';
2
2
  import type { Constructor } from '../constructor.js';
3
3
  import type { FormAssociatedCheckboxElementInterface, FormAssociatedElementInterface, FormRequiredInterface } from './types.js';
4
4
  /**
5
- * Mixes the passed class into a form associated custom element with an
6
- * additional `required` attribute.
5
+ * Turns the given class into a form-associated custom element with a
6
+ * `required` attribute.
7
7
  */
8
8
  export declare function FormAssociatedRequiredMixin<T extends Constructor<LitElement>>(base: T): Constructor<FormRequiredInterface & FormAssociatedElementInterface> & T;
9
9
  /**
10
- * Mixes the passed class into a form associated custom element with an
11
- * additional `required` attribute.
10
+ * Turns the given class into a form-associated custom element for a checkbox
11
+ * with a `required` attribute.
12
12
  */
13
13
  export declare function FormAssociatedCheckboxRequiredMixin<T extends Constructor<LitElement>>(base: T): Constructor<FormRequiredInterface & FormAssociatedCheckboxElementInterface> & T;
@@ -1 +1 @@
1
- {"version":3,"file":"associated-required.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/associated-required.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAQzB,SAAS,0BAA0B,CAEjC,IAAO;IACP,MAAM,iCAAkC,SAAQ,IAAI;QAApD;;YACY,cAAS,GAAG,KAAK,CAAC;QAgB9B,CAAC;QARC,IAAW,QAAQ,CAAC,KAAc;YAChC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAChC,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC;QAED,IAAW,QAAQ;YACjB,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;KACF;IARC;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qEAI1C;IAOH,OAAO,iCAAiC,CAAC;AAC3C,CAAC;AAMD,MAAM,UAAU,2BAA2B,CACzC,IAAO;IAEP,MAAM,6BAA8B,SAAQ,0BAA0B,CACpE,mBAAmB,CAAC,IAAI,CAAC,CAC1B;KAAG;IAEJ,OAAO,6BAGJ,CAAC;AACN,CAAC;AAMD,MAAM,UAAU,mCAAmC,CAEjD,IAAO;IACP,MAAM,qCAAsC,SAAQ,0BAA0B,CAC5E,2BAA2B,CAAC,IAAI,CAAC,CAClC;KAAG;IAEJ,OAAO,qCAGJ,CAAC;AACN,CAAC","sourcesContent":["import type { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { Constructor } from '../constructor.js';\nimport {\n FormAssociatedCheckboxMixin,\n FormAssociatedMixin,\n} from './associated.js';\nimport type {\n BaseFormAssociatedElement,\n FormAssociatedCheckboxElementInterface,\n FormAssociatedElementInterface,\n FormRequiredInterface,\n} from './types.js';\n\nfunction BaseFormAssociatedRequired<\n T extends Constructor<BaseFormAssociatedElement & LitElement>,\n>(base: T) {\n class BaseFormAssociatedRequiredElement extends base {\n protected _required = false;\n\n /**\n * When set, makes the component a required field for validation.\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public set required(value: boolean) {\n this._required = Boolean(value);\n this._validate();\n }\n\n public get required(): boolean {\n return this._required;\n }\n }\n\n return BaseFormAssociatedRequiredElement;\n}\n\n/**\n * Mixes the passed class into a form associated custom element with an\n * additional `required` attribute.\n */\nexport function FormAssociatedRequiredMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedRequiredElement extends BaseFormAssociatedRequired(\n FormAssociatedMixin(base)\n ) {}\n\n return FormAssociatedRequiredElement as unknown as Constructor<\n FormRequiredInterface & FormAssociatedElementInterface\n > &\n T;\n}\n\n/**\n * Mixes the passed class into a form associated custom element with an\n * additional `required` attribute.\n */\nexport function FormAssociatedCheckboxRequiredMixin<\n T extends Constructor<LitElement>,\n>(base: T) {\n class FormAssociatedCheckboxRequiredElement extends BaseFormAssociatedRequired(\n FormAssociatedCheckboxMixin(base)\n ) {}\n\n return FormAssociatedCheckboxRequiredElement as unknown as Constructor<\n FormRequiredInterface & FormAssociatedCheckboxElementInterface\n > &\n T;\n}\n"]}
1
+ {"version":3,"file":"associated-required.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/associated-required.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAQzB,SAAS,0BAA0B,CAEjC,IAAO;IACP,MAAM,iCAAkC,SAAQ,IAAI;QAApD;;YACY,cAAS,GAAG,KAAK,CAAC;QAgB9B,CAAC;QARC,IAAW,QAAQ,CAAC,KAAc;YAChC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAChC,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC;QAED,IAAW,QAAQ;YACjB,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;KACF;IARC;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qEAI1C;IAOH,OAAO,iCAAiC,CAAC;AAC3C,CAAC;AAMD,MAAM,UAAU,2BAA2B,CACzC,IAAO;IAEP,MAAM,6BAA8B,SAAQ,0BAA0B,CACpE,mBAAmB,CAAC,IAAI,CAAC,CAC1B;KAAG;IAEJ,OAAO,6BAGJ,CAAC;AACN,CAAC;AAMD,MAAM,UAAU,mCAAmC,CAEjD,IAAO;IACP,MAAM,qCAAsC,SAAQ,0BAA0B,CAC5E,2BAA2B,CAAC,IAAI,CAAC,CAClC;KAAG;IAEJ,OAAO,qCAGJ,CAAC;AACN,CAAC","sourcesContent":["import type { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { Constructor } from '../constructor.js';\nimport {\n FormAssociatedCheckboxMixin,\n FormAssociatedMixin,\n} from './associated.js';\nimport type {\n BaseFormAssociatedElement,\n FormAssociatedCheckboxElementInterface,\n FormAssociatedElementInterface,\n FormRequiredInterface,\n} from './types.js';\n\nfunction BaseFormAssociatedRequired<\n T extends Constructor<BaseFormAssociatedElement & LitElement>,\n>(base: T) {\n class BaseFormAssociatedRequiredElement extends base {\n protected _required = false;\n\n /**\n * When set, makes the component a required field for validation.\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public set required(value: boolean) {\n this._required = Boolean(value);\n this._validate();\n }\n\n public get required(): boolean {\n return this._required;\n }\n }\n\n return BaseFormAssociatedRequiredElement;\n}\n\n/**\n * Turns the given class into a form-associated custom element with a\n * `required` attribute.\n */\nexport function FormAssociatedRequiredMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedRequiredElement extends BaseFormAssociatedRequired(\n FormAssociatedMixin(base)\n ) {}\n\n return FormAssociatedRequiredElement as unknown as Constructor<\n FormRequiredInterface & FormAssociatedElementInterface\n > &\n T;\n}\n\n/**\n * Turns the given class into a form-associated custom element for a checkbox\n * with a `required` attribute.\n */\nexport function FormAssociatedCheckboxRequiredMixin<\n T extends Constructor<LitElement>,\n>(base: T) {\n class FormAssociatedCheckboxRequiredElement extends BaseFormAssociatedRequired(\n FormAssociatedCheckboxMixin(base)\n ) {}\n\n return FormAssociatedCheckboxRequiredElement as unknown as Constructor<\n FormRequiredInterface & FormAssociatedCheckboxElementInterface\n > &\n T;\n}\n"]}
@@ -2,10 +2,12 @@ import { type LitElement } from 'lit';
2
2
  import type { Constructor } from '../constructor.js';
3
3
  import { type FormAssociatedCheckboxElementInterface, type FormAssociatedElementInterface } from './types.js';
4
4
  /**
5
- * Mixes the passed in class and turns it into a form associated custom element.
5
+ * Turns the given class into a form-associated custom element with a
6
+ * `defaultValue` property.
6
7
  */
7
8
  export declare function FormAssociatedMixin<T extends Constructor<LitElement>>(base: T): Constructor<FormAssociatedElementInterface> & T;
8
9
  /**
9
- * Mixes the passed in class and turns it into a form associated custom element.
10
+ * Turns the given class into a form-associated checkbox custom element with
11
+ * a `defaultChecked` property.
10
12
  */
11
13
  export declare function FormAssociatedCheckboxMixin<T extends Constructor<LitElement>>(base: T): Constructor<FormAssociatedCheckboxElementInterface> & T;
@@ -6,9 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { isServer } from 'lit';
8
8
  import { property } from 'lit/decorators.js';
9
- import IgcValidationContainerComponent from '../../../components/validation-container/validation-container.js';
10
9
  import { addInternalsController } from '../../controllers/internals.js';
11
- import { enterKey } from '../../controllers/key-bindings.js';
10
+ import { enterKey, isKey } from '../../controllers/keys.js';
12
11
  import { addSafeEventListener } from '../../utils/events.js';
13
12
  import { isFunction, isString } from '../../utils/types.js';
14
13
  import { InternalInvalidEvent, InternalResetEvent, } from './types.js';
@@ -17,11 +16,8 @@ const eventOptions = {
17
16
  bubbles: false,
18
17
  composed: false,
19
18
  };
20
- function emitFormInvalidEvent(host) {
21
- host.dispatchEvent(new CustomEvent(InternalInvalidEvent, eventOptions));
22
- }
23
- function emitFormResetEvent(host) {
24
- host.dispatchEvent(new CustomEvent(InternalResetEvent, eventOptions));
19
+ function emitInternalFormEvent(host, name) {
20
+ host.dispatchEvent(new CustomEvent(name, eventOptions));
25
21
  }
26
22
  function BaseFormAssociated(base) {
27
23
  class BaseFormAssociatedElement extends base {
@@ -87,7 +83,7 @@ function BaseFormAssociated(base) {
87
83
  this._validate();
88
84
  }
89
85
  _handleEnterKeydown(event) {
90
- if (event.key !== enterKey || event.repeat) {
86
+ if (!isKey(event, enterKey) || event.repeat) {
91
87
  return;
92
88
  }
93
89
  this.form?.requestSubmit();
@@ -100,7 +96,7 @@ function BaseFormAssociated(base) {
100
96
  }
101
97
  else {
102
98
  this._setTouchedState();
103
- emitFormInvalidEvent(this);
99
+ emitInternalFormEvent(this, InternalInvalidEvent);
104
100
  }
105
101
  this._setInvalidStyles();
106
102
  this.requestUpdate();
@@ -108,9 +104,6 @@ function BaseFormAssociated(base) {
108
104
  _setInvalidStyles() {
109
105
  this._internals.setState(INVALID_STATE, this._shouldApplyStyles);
110
106
  }
111
- _resolveInternalValidation() {
112
- this._isInternalValidation = false;
113
- }
114
107
  __runValidators() {
115
108
  let validity = {};
116
109
  let message = '';
@@ -149,7 +142,7 @@ function BaseFormAssociated(base) {
149
142
  this._internals.setValidity(validity, message);
150
143
  this._isInternalValidation = true;
151
144
  this._invalid = !this._internals.checkValidity();
152
- this._resolveInternalValidation();
145
+ this._isInternalValidation = false;
153
146
  this._setInvalidStyles();
154
147
  }
155
148
  _handleBlur() {
@@ -176,9 +169,6 @@ function BaseFormAssociated(base) {
176
169
  this._internals.setFormValue(value, state);
177
170
  this._validate();
178
171
  }
179
- _renderValidationContainer(config) {
180
- return IgcValidationContainerComponent.create(this, config);
181
- }
182
172
  formAssociatedCallback(_form) { }
183
173
  formDisabledCallback(state) {
184
174
  this._disabled = state;
@@ -192,9 +182,8 @@ function BaseFormAssociated(base) {
192
182
  this._invalid = false;
193
183
  this._isExternalInvalid = false;
194
184
  this._setInvalidStyles();
195
- emitFormResetEvent(this);
185
+ emitInternalFormEvent(this, InternalResetEvent);
196
186
  }
197
- formStateRestoreCallback(_state, _mode) { }
198
187
  reportValidity() {
199
188
  const state = this._internals.reportValidity();
200
189
  this._invalid = !state;
@@ -204,7 +193,7 @@ function BaseFormAssociated(base) {
204
193
  this._isInternalValidation = true;
205
194
  const state = this._internals.checkValidity();
206
195
  this._invalid = !state;
207
- this._resolveInternalValidation();
196
+ this._isInternalValidation = false;
208
197
  return state;
209
198
  }
210
199
  setCustomValidity(message) {
@@ -1 +1 @@
1
- {"version":3,"file":"associated.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/associated.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,KAAK,CAAC;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IA8BH,OAAO,6BACJ,CAAC;AACN,CAAC","sourcesContent":["import { isServer, type LitElement, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport IgcValidationContainerComponent, {\n type ValidationContainerConfig,\n} from '../../../components/validation-container/validation-container.js';\nimport { addInternalsController } from '../../controllers/internals.js';\nimport { enterKey } from '../../controllers/key-bindings.js';\nimport { addSafeEventListener } from '../../utils/events.js';\nimport { isFunction, isString } from '../../utils/types.js';\nimport type { Validator } from '../../validators.js';\nimport type { Constructor } from '../constructor.js';\nimport type { FormValue } from './form-value.js';\nimport {\n type FormAssociatedCheckboxElementInterface,\n type FormAssociatedElementInterface,\n type FormRestoreMode,\n type FormValueType,\n type IgcFormControl,\n InternalInvalidEvent,\n InternalResetEvent,\n} from './types.js';\n\nconst INVALID_STATE = 'ig-invalid';\n\n/**\n * Every form-associated component composes the event-emitter mixin somewhere in\n * its heritage, but this mixin cannot see it in its type chain - emits go through\n * a structural contract instead.\n */\ntype EventEmitterLike = {\n emitEvent(name: string, init?: CustomEventInit): boolean;\n};\n\nconst eventOptions = {\n bubbles: false,\n composed: false,\n};\n\nfunction emitFormInvalidEvent(host: LitElement): void {\n host.dispatchEvent(new CustomEvent(InternalInvalidEvent, eventOptions));\n}\n\nfunction emitFormResetEvent(host: LitElement): void {\n host.dispatchEvent(new CustomEvent(InternalResetEvent, eventOptions));\n}\n\nfunction BaseFormAssociated<T extends Constructor<LitElement>>(base: T) {\n class BaseFormAssociatedElement extends base {\n public static readonly formAssociated = true;\n\n //#region Internal state and properties\n\n protected readonly _internals = addInternalsController(this);\n protected readonly _formValue!: FormValue<unknown>;\n\n /**\n * Suppresses invalid styling for a programmatic validation cycle\n * (`checkValidity`/`_validate`). Scoped to the synchronous validity check:\n * set immediately before it and cleared immediately after, so it never\n * leaks into a later submission or user-interaction cycle.\n */\n private _isInternalValidation = false;\n private _touched = false;\n private _isExternalInvalid = false;\n\n private get _shouldApplyStyles(): boolean {\n if (this._isExternalInvalid) {\n return true;\n }\n\n // A disabled control is barred from constraint validation, so it never\n // carries invalid styling regardless of what its validators say.\n return (\n !this._disabled &&\n this._invalid &&\n this._touched &&\n !this._isInternalValidation\n );\n }\n\n protected _disabled = false;\n protected _invalid = false;\n protected _pristine = true;\n\n protected get __validators(): Validator[] {\n return [];\n }\n\n //#endregion\n\n //#region Public properties and attributes\n\n /**\n * The name of the control, submitted with the form data.\n * @attr\n */\n @property({ reflect: true })\n public name!: string;\n\n /**\n * The disabled state of the component.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set disabled(value: boolean) {\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n if (this.hasUpdated) {\n this._setInvalidStyles();\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Sets the control into invalid state (visual state only).\n *\n * @remarks\n * The property is not reflected back to the attribute. Reading it returns\n * the effective visual state, so a touched control failing validation\n * reads `true` even after assigning `false`.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set invalid(value: boolean) {\n this._isExternalInvalid = value;\n this._setInvalidStyles();\n }\n\n public get invalid(): boolean {\n return this._shouldApplyStyles;\n }\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n /**\n * Returns a ValidityState object which represents the different validity states\n * the element can be in, with respect to constraint validation.\n */\n public get validity(): ValidityState {\n return this._internals.validity;\n }\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string {\n return this._internals.validationMessage;\n }\n\n /**\n * A boolean value which returns true if the element is a submittable element\n * that is a candidate for constraint validation.\n */\n public get willValidate(): boolean {\n return this._internals.willValidate;\n }\n //#endregion\n\n //#region Life-cycle hooks\n\n constructor(...args: any[]) {\n super(...args);\n addSafeEventListener(this, 'invalid', this._handleInvalid);\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n\n if (!this.hasUpdated) {\n this._pristine = true;\n this._touched = false;\n }\n\n this._validate();\n }\n\n //#endregion\n\n //#region Enter key submission handling\n\n protected _handleEnterKeydown(event: KeyboardEvent): void {\n if (event.key !== enterKey || event.repeat) {\n return;\n }\n\n this.form?.requestSubmit();\n }\n\n //#endregion\n\n //#region Form value and validation states\n\n private _handleInvalid(event: Event): void {\n event.preventDefault();\n this._invalid = true;\n\n if (this._isInternalValidation) {\n this._isInternalValidation = false;\n } else {\n // A failed submission counts as user interaction, and a lasting one: the\n // control was asked for a value it could not provide. Keeping it touched\n // is what makes `invalid` - and with it the validation messages the host\n // projects - survive any later re-render, rather than holding only for\n // the update the submission itself scheduled.\n this._setTouchedState();\n emitFormInvalidEvent(this);\n }\n\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n private _setInvalidStyles(): void {\n this._internals.setState(INVALID_STATE, this._shouldApplyStyles);\n }\n\n /**\n * Closes a programmatic validation cycle. If the control was invalid, the\n * synchronous `invalid` event already cleared the flag; if it was valid no\n * event fired, so clear it here to stop it leaking into a later submission\n * or user-interaction cycle.\n */\n private _resolveInternalValidation(): void {\n this._isInternalValidation = false;\n }\n\n private __runValidators(): {\n validity: ValidityStateFlags;\n message: string;\n } {\n let validity: ValidityStateFlags = {};\n let message = '';\n\n for (const validator of this.__validators) {\n const isValid = validator.isValid(this);\n\n validity[validator.key] = !isValid;\n\n if (!isValid) {\n message = isFunction(validator.message)\n ? validator.message(this)\n : validator.message;\n\n if (validator.key === 'valueMissing') {\n validity = { valueMissing: true };\n break;\n }\n }\n }\n\n return { validity, message };\n }\n\n /**\n * Executes the component validators and updates the internal validity state.\n */\n protected _validate(userMessage?: string): void {\n if (isServer) return;\n const { validity, message: validatorMessage } = this.__runValidators();\n const hasCustomError = this.validity.customError;\n let message = validatorMessage;\n\n if (hasCustomError && userMessage === undefined) {\n // Internal validation cycle after the user has called setCustomValidity()\n // with some message. Keep the customError flag and the passed in message.\n validity.customError = true;\n message = this.validationMessage;\n } else if (hasCustomError && userMessage === '') {\n // setCustomValidity with an empty message.\n validity.customError = false;\n } else if (userMessage && userMessage !== '') {\n // setCustomValidity with a message.\n validity.customError = true;\n message = userMessage;\n }\n\n this._internals.setValidity(validity, message);\n this._isInternalValidation = true;\n this._invalid = !this._internals.checkValidity();\n this._resolveInternalValidation();\n this._setInvalidStyles();\n }\n\n protected _handleBlur(): void {\n this._setTouchedState();\n this._validate();\n }\n\n protected _setTouchedState(): void {\n this._touched = true;\n }\n\n protected _emitTouchedEvent(\n eventName: string,\n init?: CustomEventInit\n ): boolean {\n this._setTouchedState();\n return (this as unknown as EventEmitterLike).emitEvent(eventName, init);\n }\n\n protected _setDefaultValue(current: string | null): void {\n this._formValue.defaultValue = current;\n }\n\n protected _restoreDefaultValue(): void {\n const value = this._formValue.value;\n this._formValue.setValueAndFormState(this._formValue.defaultValue);\n this.requestUpdate('value', value);\n }\n\n protected _setFormValue(value: FormValueType, state?: FormValueType): void {\n this._pristine = false;\n this._internals.setFormValue(value, state);\n this._validate();\n }\n\n protected _renderValidationContainer(\n config?: ValidationContainerConfig\n ): TemplateResult {\n return IgcValidationContainerComponent.create(\n this as unknown as IgcFormControl,\n config\n );\n }\n\n //#endregion\n\n //#region Form associated callback hooks\n\n protected formAssociatedCallback(_form: HTMLFormElement): void {}\n\n protected formDisabledCallback(state: boolean): void {\n this._disabled = state;\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n protected formResetCallback(): void {\n this._restoreDefaultValue();\n this._pristine = true;\n this._touched = false;\n this._invalid = false;\n this._isExternalInvalid = false;\n this._setInvalidStyles();\n emitFormResetEvent(this);\n }\n\n /* c8 ignore next 4 */\n protected formStateRestoreCallback(\n _state: FormValueType,\n _mode: FormRestoreMode\n ): void {}\n\n //#endregion\n\n //#region Public API\n\n /** Checks for validity of the control and shows the browser message if it's invalid. */\n public reportValidity(): boolean {\n const state = this._internals.reportValidity();\n this._invalid = !state;\n return state;\n }\n\n /** Checks for validity of the control and emits the invalid event if it's invalid. */\n public checkValidity(): boolean {\n this._isInternalValidation = true;\n const state = this._internals.checkValidity();\n this._invalid = !state;\n this._resolveInternalValidation();\n return state;\n }\n\n /**\n * Sets a custom validation message for the control.\n * As long as `message` is not empty, the control is considered invalid.\n */\n public setCustomValidity(message: string): void {\n this._validate(message);\n this.requestUpdate();\n }\n\n //#endregion\n }\n return BaseFormAssociatedElement as Constructor<BaseFormAssociatedElement> &\n T;\n}\n\n/**\n * Mixes the passed in class and turns it into a form associated custom element.\n */\nexport function FormAssociatedMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultValue(value: unknown) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'value' in this) {\n this.value = this.defaultValue;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultValue(): unknown {\n return this._formValue.defaultValue;\n }\n\n /**\n * Restores the default value through the public `value` setter so any\n * clamping/normalization the component applies (slider bounds, rating max)\n * also applies on form reset, and the correct reactive property is\n * recorded for the update cycle.\n */\n protected override _restoreDefaultValue(): void {\n if ('value' in this) {\n this.value = this.defaultValue;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n /** Touched flips first, so the setter's validation cycle sees it. */\n protected _commitValue(value: unknown, eventName: string): boolean {\n this._setTouchedState();\n\n if ('value' in this) {\n this.value = value;\n return (this as unknown as EventEmitterLike).emitEvent(eventName, {\n detail: this.value,\n });\n }\n\n return false;\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'value') {\n this._setDefaultValue(current);\n }\n }\n }\n\n return FormAssociatedElement as unknown as Constructor<FormAssociatedElementInterface> &\n T;\n}\n\n/**\n * Mixes the passed in class and turns it into a form associated custom element.\n */\nexport function FormAssociatedCheckboxMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedCheckboxElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultChecked(value: boolean) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'checked' in this) {\n this.checked = this.defaultChecked;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultChecked(): boolean {\n return this._formValue.defaultValue as boolean;\n }\n\n /**\n * Restores the default checked state through the public `checked` setter\n * so the correct reactive property is recorded for the update cycle.\n */\n protected override _restoreDefaultValue(): void {\n if ('checked' in this) {\n this.checked = this.defaultChecked;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'checked') {\n this._setDefaultValue(isString(current) ? 'true' : null);\n }\n }\n }\n\n return FormAssociatedCheckboxElement as unknown as Constructor<FormAssociatedCheckboxElementInterface> &\n T;\n}\n"]}
1
+ {"version":3,"file":"associated.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/associated.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAI5D,OAAO,EAIL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,aAAa,GAAG,YAAY,CAAC;AAUnC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;CAChB,CAAC;AAGF,SAAS,qBAAqB,CAAC,IAAgB,EAAE,IAAY;IAC3D,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;AAC1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E,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KACF;IApCC;QADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uEAS9B;IA8BH,OAAO,6BACJ,CAAC;AACN,CAAC","sourcesContent":["import { isServer, type LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { addInternalsController } from '../../controllers/internals.js';\nimport { enterKey, isKey } from '../../controllers/keys.js';\nimport { addSafeEventListener } from '../../utils/events.js';\nimport { isFunction, isString } from '../../utils/types.js';\nimport type { Validator } from '../../validators.js';\nimport type { Constructor } from '../constructor.js';\nimport type { FormValue } from './form-value.js';\nimport {\n type FormAssociatedCheckboxElementInterface,\n type FormAssociatedElementInterface,\n type FormValueType,\n InternalInvalidEvent,\n InternalResetEvent,\n} from './types.js';\n\nconst INVALID_STATE = 'ig-invalid';\n\n/**\n * The event emitter of the host. This mixin cannot see the event-emitter\n * mixin in its type chain, so the emits go through this contract.\n */\ntype EventEmitterLike = {\n emitEvent(name: string, init?: CustomEventInit): boolean;\n};\n\nconst eventOptions = {\n bubbles: false,\n composed: false,\n};\n\n/** Emits one of the internal form events on the host. */\nfunction emitInternalFormEvent(host: LitElement, name: string): void {\n host.dispatchEvent(new CustomEvent(name, eventOptions));\n}\n\nfunction BaseFormAssociated<T extends Constructor<LitElement>>(base: T) {\n class BaseFormAssociatedElement extends base {\n public static readonly formAssociated = true;\n\n //#region Internal state and properties\n\n protected readonly _internals = addInternalsController(this);\n protected readonly _formValue!: FormValue<unknown>;\n\n /**\n * Hides the invalid styling for a validation cycle started from code. Set\n * immediately before the check and cleared immediately after, so that it\n * does not reach a later cycle.\n */\n private _isInternalValidation = false;\n private _touched = false;\n private _isExternalInvalid = false;\n\n private get _shouldApplyStyles(): boolean {\n if (this._isExternalInvalid) {\n return true;\n }\n\n // A disabled control cannot validate, so it never styles as invalid.\n return (\n !this._disabled &&\n this._invalid &&\n this._touched &&\n !this._isInternalValidation\n );\n }\n\n protected _disabled = false;\n protected _invalid = false;\n protected _pristine = true;\n\n protected get __validators(): Validator[] {\n return [];\n }\n\n //#endregion\n\n //#region Public properties and attributes\n\n /**\n * The name of the control, submitted with the form data.\n * @attr\n */\n @property({ reflect: true })\n public name!: string;\n\n /**\n * The disabled state of the component.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set disabled(value: boolean) {\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n if (this.hasUpdated) {\n this._setInvalidStyles();\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Sets the control into invalid state (visual state only).\n *\n * @remarks\n * Not reflected to the attribute. Reading returns the effective state, so\n * a touched control that fails validation reads `true` after `false`.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set invalid(value: boolean) {\n this._isExternalInvalid = value;\n this._setInvalidStyles();\n }\n\n public get invalid(): boolean {\n return this._shouldApplyStyles;\n }\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n /** Returns a `ValidityState` object for the element. */\n public get validity(): ValidityState {\n return this._internals.validity;\n }\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string {\n return this._internals.validationMessage;\n }\n\n /**\n * Returns `true` when the element is a candidate for constraint\n * validation.\n */\n public get willValidate(): boolean {\n return this._internals.willValidate;\n }\n //#endregion\n\n //#region Life-cycle hooks\n\n constructor(...args: any[]) {\n super(...args);\n addSafeEventListener(this, 'invalid', this._handleInvalid);\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n\n if (!this.hasUpdated) {\n this._pristine = true;\n this._touched = false;\n }\n\n this._validate();\n }\n\n //#endregion\n\n //#region Enter key submission handling\n\n protected _handleEnterKeydown(event: KeyboardEvent): void {\n if (!isKey(event, enterKey) || event.repeat) {\n return;\n }\n\n this.form?.requestSubmit();\n }\n\n //#endregion\n\n //#region Form value and validation states\n\n private _handleInvalid(event: Event): void {\n event.preventDefault();\n this._invalid = true;\n\n if (this._isInternalValidation) {\n this._isInternalValidation = false;\n } else {\n // A failed submission is a lasting interaction: touched keeps\n // `invalid` and the projected messages visible across re-renders.\n this._setTouchedState();\n emitInternalFormEvent(this, InternalInvalidEvent);\n }\n\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n private _setInvalidStyles(): void {\n this._internals.setState(INVALID_STATE, this._shouldApplyStyles);\n }\n\n private __runValidators(): {\n validity: ValidityStateFlags;\n message: string;\n } {\n let validity: ValidityStateFlags = {};\n let message = '';\n\n for (const validator of this.__validators) {\n const isValid = validator.isValid(this);\n\n validity[validator.key] = !isValid;\n\n if (!isValid) {\n message = isFunction(validator.message)\n ? validator.message(this)\n : validator.message;\n\n if (validator.key === 'valueMissing') {\n validity = { valueMissing: true };\n break;\n }\n }\n }\n\n return { validity, message };\n }\n\n /** Runs the validators and updates the internal validity state. */\n protected _validate(userMessage?: string): void {\n if (isServer) return;\n const { validity, message: validatorMessage } = this.__runValidators();\n const hasCustomError = this.validity.customError;\n let message = validatorMessage;\n\n if (hasCustomError && userMessage === undefined) {\n // Internal cycle after `setCustomValidity(message)`. Keep the\n // `customError` flag and the message.\n validity.customError = true;\n message = this.validationMessage;\n } else if (hasCustomError && userMessage === '') {\n // The caller passed an empty message to `setCustomValidity()`.\n validity.customError = false;\n } else if (userMessage && userMessage !== '') {\n // The caller passed a message to `setCustomValidity()`.\n validity.customError = true;\n message = userMessage;\n }\n\n this._internals.setValidity(validity, message);\n this._isInternalValidation = true;\n this._invalid = !this._internals.checkValidity();\n this._isInternalValidation = false;\n this._setInvalidStyles();\n }\n\n protected _handleBlur(): void {\n this._setTouchedState();\n this._validate();\n }\n\n protected _setTouchedState(): void {\n this._touched = true;\n }\n\n protected _emitTouchedEvent(\n eventName: string,\n init?: CustomEventInit\n ): boolean {\n this._setTouchedState();\n return (this as unknown as EventEmitterLike).emitEvent(eventName, init);\n }\n\n protected _setDefaultValue(current: string | null): void {\n this._formValue.defaultValue = current;\n }\n\n protected _restoreDefaultValue(): void {\n const value = this._formValue.value;\n this._formValue.setValueAndFormState(this._formValue.defaultValue);\n this.requestUpdate('value', value);\n }\n\n protected _setFormValue(value: FormValueType, state?: FormValueType): void {\n this._pristine = false;\n this._internals.setFormValue(value, state);\n this._validate();\n }\n\n //#endregion\n\n //#region Form associated callback hooks\n\n protected formAssociatedCallback(_form: HTMLFormElement): void {}\n\n protected formDisabledCallback(state: boolean): void {\n this._disabled = state;\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n protected formResetCallback(): void {\n this._restoreDefaultValue();\n this._pristine = true;\n this._touched = false;\n this._invalid = false;\n this._isExternalInvalid = false;\n this._setInvalidStyles();\n emitInternalFormEvent(this, InternalResetEvent);\n }\n\n //#endregion\n\n //#region Public API\n\n /** Checks validity and shows the browser message when invalid. */\n public reportValidity(): boolean {\n const state = this._internals.reportValidity();\n this._invalid = !state;\n return state;\n }\n\n /** Checks validity and emits `invalid` when the control is invalid. */\n public checkValidity(): boolean {\n this._isInternalValidation = true;\n const state = this._internals.checkValidity();\n this._invalid = !state;\n this._isInternalValidation = false;\n return state;\n }\n\n /** Sets a custom message. Invalid while `message` is not empty. */\n public setCustomValidity(message: string): void {\n this._validate(message);\n this.requestUpdate();\n }\n\n //#endregion\n }\n return BaseFormAssociatedElement as Constructor<BaseFormAssociatedElement> &\n T;\n}\n\n/**\n * Turns the given class into a form-associated custom element with a\n * `defaultValue` property.\n */\nexport function FormAssociatedMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultValue(value: unknown) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'value' in this) {\n this.value = this.defaultValue;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultValue(): unknown {\n return this._formValue.defaultValue;\n }\n\n /**\n * Restores the default value through the public `value` setter, so that a\n * form reset gets the same clamping, normalization and reactive state.\n */\n protected override _restoreDefaultValue(): void {\n if ('value' in this) {\n this.value = this.defaultValue;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n /** Sets touched first, so the `value` setter validation cycle sees it. */\n protected _commitValue(value: unknown, eventName: string): boolean {\n this._setTouchedState();\n\n if ('value' in this) {\n this.value = value;\n return (this as unknown as EventEmitterLike).emitEvent(eventName, {\n detail: this.value,\n });\n }\n\n return false;\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'value') {\n this._setDefaultValue(current);\n }\n }\n }\n\n return FormAssociatedElement as unknown as Constructor<FormAssociatedElementInterface> &\n T;\n}\n\n/**\n * Turns the given class into a form-associated checkbox custom element with\n * a `defaultChecked` property.\n */\nexport function FormAssociatedCheckboxMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedCheckboxElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultChecked(value: boolean) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'checked' in this) {\n this.checked = this.defaultChecked;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultChecked(): boolean {\n return this._formValue.defaultValue as boolean;\n }\n\n /**\n * Restores the default checked state through the public `checked` setter,\n * which records the correct reactive property for the update cycle.\n */\n protected override _restoreDefaultValue(): void {\n if ('checked' in this) {\n this.checked = this.defaultChecked;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'checked') {\n this._setDefaultValue(isString(current) ? 'true' : null);\n }\n }\n }\n\n return FormAssociatedCheckboxElement as unknown as Constructor<FormAssociatedCheckboxElementInterface> &\n T;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"form-transformers.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/form-transformers.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAmB/C,MAAM,CAAC,MAAM,4BAA4B,GAAkC;IACzE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IAC1B,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IACvC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACjC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAErC;IACF,QAAQ,EAAE,OAAO;IACjB,eAAe,EAAE,OAAO;IACxB,YAAY,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAC9B,OAAO,IAAI,OAAO,IAAI,IAAI,CAAC,CAAC,CAAE,IAAI,CAAC,KAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI;CACrE,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAEpC;IACF,QAAQ,EAAE,QAAQ;IAClB,eAAe,EAAE,QAAQ;IACzB,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAEtC;IACF,QAAQ,EAAE,aAAa;IACvB,eAAe,EAAE,aAAa;IAC9B,YAAY,EAAE,gBAAgB;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,8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AC;YACzB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,2BAA2B,GAEpC;IACF,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,SAAS;IACvC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,SAAS;CAC/C,CAAC","sourcesContent":["import type { DateRangeValue } from '../../../components/types.js';\nimport {\n convertToDate,\n convertToDateRange,\n getDateFormValue,\n} from '../../date/converters.js';\nimport { asNumber } from '../../utils/math.js';\nimport type { FormValueType, IgcFormControl } from './types.js';\n\nexport type FormValueTransformers<T> = {\n setValue: (value: T) => T;\n getValue: (value: T) => T;\n setDefaultValue: (value: T) => T;\n getDefaultValue: (value: T) => T;\n setFormValue: (value: T, host: IgcFormControl) => FormValueType;\n};\n\nexport type FormValueConfig<T> = {\n initialValue: T;\n initialDefaultValue?: T;\n transformers?: Partial<FormValueTransformers<T>>;\n};\n\n// Transformers\n\nexport const FormValueDefaultTransformers: FormValueTransformers<string> = {\n setValue: (value) => value || '',\n getValue: (value) => value,\n setDefaultValue: (value) => value || '',\n getDefaultValue: (value) => value,\n setFormValue: (value, _) => value || null,\n};\n\nexport const FormValueBooleanTransformers: Partial<\n FormValueTransformers<boolean>\n> = {\n setValue: Boolean,\n setDefaultValue: Boolean,\n setFormValue: (checked, host) =>\n checked && 'value' in host ? (host.value as string) || 'on' : null,\n};\n\nexport const FormValueNumberTransformers: Partial<\n FormValueTransformers<number>\n> = {\n setValue: asNumber,\n setDefaultValue: asNumber,\n setFormValue: (value) => value.toString(),\n};\n\nexport const FormValueDateTimeTransformers: Partial<\n FormValueTransformers<Date | null>\n> = {\n setValue: convertToDate,\n setDefaultValue: convertToDate,\n setFormValue: getDateFormValue,\n};\n\nexport const FormValueDateRangeTransformers: Partial<\n FormValueTransformers<DateRangeValue | null>\n> = {\n setValue: convertToDateRange,\n setDefaultValue: convertToDateRange,\n setFormValue: (value, host) => {\n if (!host.name) {\n return null;\n }\n const start = value?.start?.toISOString();\n const end = value?.end?.toISOString();\n\n const formData = new FormData();\n\n if (start) {\n formData.append(`${host.name}-start`, start);\n }\n if (end) {\n formData.append(`${host.name}-end`, end);\n }\n\n return formData;\n },\n};\n\n/* blazorSuppress */\nexport const FormValueFileListTransformers: FormValueTransformers<FileList | null> =\n {\n setValue: (value) => value || null,\n getValue: (value) => value,\n setDefaultValue: (value) => value || null,\n getDefaultValue: (value) => value,\n setFormValue: (files, host) => {\n if (!(host.name && files)) {\n return null;\n }\n\n const formData = new FormData();\n for (const file of files) {\n formData.append(host.name, file);\n }\n\n return formData;\n },\n };\n\nexport const FormValueSelectTransformers: Partial<\n FormValueTransformers<string | undefined>\n> = {\n setValue: (value) => value || undefined,\n setDefaultValue: (value) => value || undefined,\n};\n"]}
1
+ {"version":3,"file":"form-transformers.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/form-transformers.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAiB/C,MAAM,CAAC,MAAM,4BAA4B,GAAkC;IACzE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IAC1B,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IACvC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACjC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAErC;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CAAC;CACF,CAAC;AAGF,MAAM,CAAC,MAAM,6BAA6B,GACxC;IACE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IAC1B,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI;IACzC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACjC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC5B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,2BAA2B,GAEpC;IACF,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,SAAS;IACvC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,SAAS;CAC/C,CAAC","sourcesContent":["import type { DateRangeValue } from '../../../components/types.js';\nimport {\n convertToDate,\n convertToDateRange,\n getDateFormValue,\n} from '../../date/converters.js';\nimport { asNumber } from '../../utils/math.js';\nimport type { FormValueType, IgcFormControl } from './types.js';\n\nexport type FormValueTransformers<T> = {\n setValue: (value: T) => T;\n getValue: (value: T) => T;\n setDefaultValue: (value: T) => T;\n getDefaultValue: (value: T) => T;\n setFormValue: (value: T, host: IgcFormControl) => FormValueType;\n};\n\nexport type FormValueConfig<T> = {\n initialValue: T;\n initialDefaultValue?: T;\n transformers?: Partial<FormValueTransformers<T>>;\n};\n\nexport const FormValueDefaultTransformers: FormValueTransformers<string> = {\n setValue: (value) => value || '',\n getValue: (value) => value,\n setDefaultValue: (value) => value || '',\n getDefaultValue: (value) => value,\n setFormValue: (value, _) => value || null,\n};\n\nexport const FormValueBooleanTransformers: Partial<\n FormValueTransformers<boolean>\n> = {\n setValue: Boolean,\n setDefaultValue: Boolean,\n setFormValue: (checked, host) =>\n checked && 'value' in host ? (host.value as string) || 'on' : null,\n};\n\nexport const FormValueNumberTransformers: Partial<\n FormValueTransformers<number>\n> = {\n setValue: asNumber,\n setDefaultValue: asNumber,\n setFormValue: (value) => value.toString(),\n};\n\nexport const FormValueDateTimeTransformers: Partial<\n FormValueTransformers<Date | null>\n> = {\n setValue: convertToDate,\n setDefaultValue: convertToDate,\n setFormValue: getDateFormValue,\n};\n\nexport const FormValueDateRangeTransformers: Partial<\n FormValueTransformers<DateRangeValue | null>\n> = {\n setValue: convertToDateRange,\n setDefaultValue: convertToDateRange,\n setFormValue: (value, host) => {\n if (!host.name) {\n return null;\n }\n const start = value?.start?.toISOString();\n const end = value?.end?.toISOString();\n\n const formData = new FormData();\n\n if (start) {\n formData.append(`${host.name}-start`, start);\n }\n if (end) {\n formData.append(`${host.name}-end`, end);\n }\n\n return formData;\n },\n};\n\n/* blazorSuppress */\nexport const FormValueFileListTransformers: FormValueTransformers<FileList | null> =\n {\n setValue: (value) => value || null,\n getValue: (value) => value,\n setDefaultValue: (value) => value || null,\n getDefaultValue: (value) => value,\n setFormValue: (files, host) => {\n if (!(host.name && files)) {\n return null;\n }\n\n const formData = new FormData();\n for (const file of files) {\n formData.append(host.name, file);\n }\n\n return formData;\n },\n };\n\nexport const FormValueSelectTransformers: Partial<\n FormValueTransformers<string | undefined>\n> = {\n setValue: (value) => value || undefined,\n setDefaultValue: (value) => value || undefined,\n};\n"]}