adp-web-components 0.1.57 → 0.1.59

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 (301) hide show
  1. package/dist/cjs/dead-stock-lookup_3.cjs.entry.js +7 -7
  2. package/dist/cjs/decode-time-offset-DqzP0mck.js +37 -0
  3. package/dist/cjs/flexible-container.cjs.entry.js +1 -1
  4. package/dist/cjs/form-checkbox.cjs.entry.js +1 -1
  5. package/dist/cjs/form-date-picker.cjs.entry.js +221 -0
  6. package/dist/cjs/form-dialog_8.cjs.entry.js +809 -0
  7. package/dist/cjs/{form-input-prefix-BEKoXMuK.js → form-input-label-meHUwu3m.js} +0 -9
  8. package/dist/cjs/form-input-prefix-RFgXEC1Q.js +18 -0
  9. package/dist/cjs/form-input_4.cjs.entry.js +31 -14
  10. package/dist/cjs/form-switch.cjs.entry.js +2 -2
  11. package/dist/cjs/form-time-picker.cjs.entry.js +165 -0
  12. package/dist/cjs/general-inquiry-form.cjs.entry.js +11 -9
  13. package/dist/cjs/{get-local-language-CLEoE4A4.js → get-local-language-CMptyFxH.js} +1 -1
  14. package/dist/cjs/index-D5c513Xn.js +22147 -0
  15. package/dist/cjs/information-table.cjs.entry.js +1 -1
  16. package/dist/cjs/{loader-icon-8WtBJ-H1.js → loader-icon-qrSyqpQO.js} +49 -26
  17. package/dist/cjs/loader.cjs.js +1 -1
  18. package/dist/cjs/loading-spinner.cjs.entry.js +1 -1
  19. package/dist/cjs/manufacturer-part-lookup.cjs.entry.js +3 -3
  20. package/dist/cjs/part-lookup.cjs.entry.js +3 -3
  21. package/dist/cjs/service-booking-form.cjs.entry.js +21 -194
  22. package/dist/cjs/shift-components.cjs.js +1 -1
  23. package/dist/cjs/shift-tab-content.cjs.entry.js +1 -1
  24. package/dist/cjs/shift-tabs_2.cjs.entry.js +10 -10
  25. package/dist/cjs/ssc-lookup-form.cjs.entry.js +11 -9
  26. package/dist/cjs/state-object-B_0-oj8G.js +243 -0
  27. package/dist/cjs/test-drive-form.cjs.entry.js +11 -9
  28. package/dist/cjs/{type-DlWZZ9uC.js → type-B8LchmnL.js} +1 -1
  29. package/dist/cjs/{type-VgtSVhXd.js → type-BqNpIYcE.js} +1 -1
  30. package/dist/cjs/{type-CG7yWUpY.js → type-BrzZ5GMr.js} +1 -1
  31. package/dist/cjs/vehicle-accessories_7.cjs.entry.js +24 -24
  32. package/dist/cjs/vehicle-lookup.cjs.entry.js +3 -3
  33. package/dist/cjs/vehicle-quotation-form.cjs.entry.js +14 -11
  34. package/dist/collection/collection-manifest.json +3 -0
  35. package/dist/collection/components/components/flexible-container.css +1 -1
  36. package/dist/collection/components/components/information-table.css +1 -1
  37. package/dist/collection/components/components/loading-spinner.css +1 -1
  38. package/dist/collection/components/components/shift-tab-content.css +1 -1
  39. package/dist/collection/components/components/shift-tabs.css +1 -1
  40. package/dist/collection/components/form-elements/VehicleImageViewer.js +50 -0
  41. package/dist/collection/components/form-elements/form-date-picker-legacy.js +498 -0
  42. package/dist/collection/components/form-elements/form-dialog.js +3 -3
  43. package/dist/collection/components/form-elements/form-input.js +95 -5
  44. package/dist/collection/components/form-elements/form-inputs.css +1 -1
  45. package/dist/collection/components/form-elements/form-phone-number.js +2 -2
  46. package/dist/collection/components/form-elements/form-picker-input.js +478 -0
  47. package/dist/collection/components/form-elements/form-shadow-input.js +24 -1
  48. package/dist/collection/components/form-elements/form-structure-error.js +1 -1
  49. package/dist/collection/components/form-elements/form-submit.js +2 -2
  50. package/dist/collection/components/form-elements/form-switch.js +1 -1
  51. package/dist/collection/components/form-elements/form-text-area.js +2 -2
  52. package/dist/collection/components/form-elements/form-time-picker-legacy.js +397 -0
  53. package/dist/collection/components/form-elements/form-vin-input.js +5 -4
  54. package/dist/collection/components/forms/defaults/mappers.js +72 -0
  55. package/dist/collection/components/forms/defaults/style.css +1 -1
  56. package/dist/collection/components/forms/defaults/validation.js +29 -1
  57. package/dist/collection/components/forms/general-inquiry.js +6 -6
  58. package/dist/collection/components/forms/service-booking.js +21 -21
  59. package/dist/collection/components/forms/ssc-lookup.js +6 -6
  60. package/dist/collection/components/forms/test-drive.js +6 -6
  61. package/dist/collection/components/forms/vehicle-quotation/VehicleImageViewer.js +1 -1
  62. package/dist/collection/components/forms/vehicle-quotation.js +11 -9
  63. package/dist/collection/components/part-lookup/dead-stock-lookup.js +2 -2
  64. package/dist/collection/components/part-lookup/distributor-lookup.js +2 -2
  65. package/dist/collection/components/part-lookup/manufacturer-part-lookup.js +1 -1
  66. package/dist/collection/components/vehicle-lookup/vehicle-accessories.css +1 -1
  67. package/dist/collection/components/vehicle-lookup/vehicle-accessories.js +2 -2
  68. package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.css +1 -1
  69. package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.js +4 -4
  70. package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.css +1 -1
  71. package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.js +8 -8
  72. package/dist/collection/components/vehicle-lookup/vehicle-lookup.css +1 -1
  73. package/dist/collection/components/vehicle-lookup/vehicle-paint-thickness.css +1 -1
  74. package/dist/collection/components/vehicle-lookup/vehicle-paint-thickness.js +1 -1
  75. package/dist/collection/components/vehicle-lookup/vehicle-sale-information.css +1 -1
  76. package/dist/collection/components/vehicle-lookup/vehicle-sale-information.js +2 -2
  77. package/dist/collection/components/vehicle-lookup/vehicle-service-history.css +1 -1
  78. package/dist/collection/components/vehicle-lookup/vehicle-service-history.js +1 -1
  79. package/dist/collection/components/vehicle-lookup/vehicle-specification.css +1 -1
  80. package/dist/collection/components/vehicle-lookup/vehicle-specification.js +1 -1
  81. package/dist/collection/components/vehicle-lookup/vehicle-warranty-details.css +1 -1
  82. package/dist/collection/components/vehicle-lookup/vehicle-warranty-details.js +4 -4
  83. package/dist/collection/components/vin-extractor/vin-extractor.css +1 -1
  84. package/dist/collection/components/vin-extractor/vin-extractor.js +1 -1
  85. package/dist/collection/features/form-hook/functions.js +37 -13
  86. package/dist/collection/global/assets/calendar-days-icon.js +6 -0
  87. package/dist/collection/global/assets/clock-8-icon.js +6 -0
  88. package/dist/collection/global/lib/decode-time-offset.js +32 -0
  89. package/dist/components/dead-stock-lookup.js +1 -1
  90. package/dist/components/distributor-lookup.js +1 -1
  91. package/dist/components/flexible-container.js +1 -1
  92. package/dist/components/form-checkbox.js +1 -1
  93. package/dist/components/form-date-picker.d.ts +11 -0
  94. package/dist/components/form-date-picker.js +5 -0
  95. package/dist/components/form-dialog.js +1 -1
  96. package/dist/components/form-input.js +1 -1
  97. package/dist/components/form-phone-number.js +1 -1
  98. package/dist/components/form-picker-input.d.ts +11 -0
  99. package/dist/components/form-picker-input.js +5 -0
  100. package/dist/components/form-select.js +1 -1
  101. package/dist/components/form-shadow-input.js +1 -1
  102. package/dist/components/form-structure-error.js +1 -1
  103. package/dist/components/form-structure.js +1 -1
  104. package/dist/components/form-submit.js +1 -1
  105. package/dist/components/form-switch.js +1 -1
  106. package/dist/components/form-text-area.js +1 -1
  107. package/dist/components/form-time-picker.d.ts +11 -0
  108. package/dist/components/form-time-picker.js +5 -0
  109. package/dist/components/form-vin-input.js +1 -1
  110. package/dist/components/general-inquiry-form.js +1 -1
  111. package/dist/components/information-table.js +1 -1
  112. package/dist/components/loading-spinner.js +1 -1
  113. package/dist/components/manufacturer-lookup.js +1 -1
  114. package/dist/components/manufacturer-part-lookup.js +1 -1
  115. package/dist/components/{p-Bi75CV6R.js → p-3WjYFbnU.js} +1 -1
  116. package/dist/components/p-64G0Y_tC.js +5 -0
  117. package/dist/components/p-7y7dFWS-.js +5 -0
  118. package/dist/components/p-BEClgvwe.js +5 -0
  119. package/dist/components/p-BILW0yP6.js +5 -0
  120. package/dist/components/p-BTqv9A1K.js +5 -0
  121. package/dist/components/p-B_QEyJOO.js +5 -0
  122. package/dist/components/{p-F0WWPE_O.js → p-Bd2-gh8M.js} +1 -1
  123. package/dist/components/p-BffBGA_K.js +5 -0
  124. package/dist/components/p-Bon4whdT.js +5 -0
  125. package/dist/components/{p-CCGW3XAg.js → p-BsFKuBtC.js} +1 -1
  126. package/dist/components/p-C-4CT4ZF.js +5 -0
  127. package/dist/components/p-C6WhIy7O.js +5 -0
  128. package/dist/components/{p-CixlAlH4.js → p-CBXAxKky.js} +1 -1
  129. package/dist/components/p-CEM5EBP0.js +5 -0
  130. package/dist/components/p-CHdx52dw.js +5 -0
  131. package/dist/components/p-CwQEFAEF.js +5 -0
  132. package/dist/components/p-Cxfsh87m.js +5 -0
  133. package/dist/components/p-D-tlRZMk.js +5 -0
  134. package/dist/components/p-D930Q75B.js +5 -0
  135. package/dist/components/p-DA0taq65.js +5 -0
  136. package/dist/components/p-DJKERvsE.js +5 -0
  137. package/dist/components/p-DNn44A0I.js +5 -0
  138. package/dist/components/{p-DEDxfC7_.js → p-Df56BNKV.js} +1 -1
  139. package/dist/components/p-DjDUhW2q.js +5 -0
  140. package/dist/components/{p-Cv4B-c-D.js → p-DkA_i--O.js} +1 -1
  141. package/dist/components/{p-C9NbnDFD.js → p-DqNmAqS_.js} +1 -1
  142. package/dist/components/p-DuNp8sSh.js +5 -0
  143. package/dist/components/p-NEl9bwNq.js +5 -0
  144. package/dist/components/p-RInF2GNQ.js +5 -0
  145. package/dist/components/{p-BtR-iDdk.js → p-_C-vBKCe.js} +1 -1
  146. package/dist/components/p-eTLWmtnI.js +5 -0
  147. package/dist/components/{p-C3JyRnEg.js → p-vEsQVFLN.js} +1 -1
  148. package/dist/components/{p-CFfmHNjt.js → p-zofQKKfh.js} +1 -1
  149. package/dist/components/part-lookup.js +1 -1
  150. package/dist/components/service-booking-form.js +1 -1
  151. package/dist/components/shift-accordion.js +1 -1
  152. package/dist/components/shift-slider.js +1 -1
  153. package/dist/components/shift-tab-content.js +1 -1
  154. package/dist/components/shift-tabs.js +1 -1
  155. package/dist/components/ssc-lookup-form.js +1 -1
  156. package/dist/components/test-drive-form.js +1 -1
  157. package/dist/components/vehicle-accessories.js +1 -1
  158. package/dist/components/vehicle-claimable-items.js +1 -1
  159. package/dist/components/vehicle-item-claim-form.js +1 -1
  160. package/dist/components/vehicle-lookup.js +1 -1
  161. package/dist/components/vehicle-paint-thickness.js +1 -1
  162. package/dist/components/vehicle-quotation-form.js +1 -1
  163. package/dist/components/vehicle-sale-information.js +1 -1
  164. package/dist/components/vehicle-service-history.js +1 -1
  165. package/dist/components/vehicle-specification.js +1 -1
  166. package/dist/components/vehicle-warranty-details.js +1 -1
  167. package/dist/components/vin-extractor.js +1 -1
  168. package/dist/esm/dead-stock-lookup_3.entry.js +7 -7
  169. package/dist/esm/decode-time-offset-Cfi43WoV.js +35 -0
  170. package/dist/esm/flexible-container.entry.js +1 -1
  171. package/dist/esm/form-checkbox.entry.js +1 -1
  172. package/dist/esm/form-date-picker.entry.js +219 -0
  173. package/dist/esm/form-dialog_8.entry.js +800 -0
  174. package/dist/esm/{form-input-prefix-uiMTBAZe.js → form-input-label-BhD_T_C5.js} +1 -9
  175. package/dist/esm/form-input-prefix-C48SfAOK.js +16 -0
  176. package/dist/esm/form-input_4.entry.js +30 -13
  177. package/dist/esm/form-switch.entry.js +2 -2
  178. package/dist/esm/form-time-picker.entry.js +163 -0
  179. package/dist/esm/general-inquiry-form.entry.js +11 -9
  180. package/dist/esm/{get-local-language-B3oLMQ7x.js → get-local-language-CCj6E27L.js} +1 -1
  181. package/dist/esm/index-BILW0yP6.js +22145 -0
  182. package/dist/esm/information-table.entry.js +1 -1
  183. package/dist/esm/{loader-icon-BT-MqKj_.js → loader-icon-DhBPTC5g.js} +39 -15
  184. package/dist/esm/loader.js +1 -1
  185. package/dist/esm/loading-spinner.entry.js +1 -1
  186. package/dist/esm/manufacturer-part-lookup.entry.js +3 -3
  187. package/dist/esm/part-lookup.entry.js +3 -3
  188. package/dist/esm/service-booking-form.entry.js +21 -194
  189. package/dist/esm/shift-components.js +1 -1
  190. package/dist/esm/shift-tab-content.entry.js +1 -1
  191. package/dist/esm/shift-tabs_2.entry.js +10 -10
  192. package/dist/esm/ssc-lookup-form.entry.js +11 -9
  193. package/dist/esm/state-object-Cwph5K2Q.js +238 -0
  194. package/dist/esm/test-drive-form.entry.js +11 -9
  195. package/dist/esm/{type-B96smKVB.js → type-BluG_k1P.js} +1 -1
  196. package/dist/esm/{type-CJFFdz9f.js → type-D_rpjbuj.js} +1 -1
  197. package/dist/esm/{type-BymH_Reb.js → type-zroDKO0U.js} +1 -1
  198. package/dist/esm/vehicle-accessories_7.entry.js +24 -24
  199. package/dist/esm/vehicle-lookup.entry.js +3 -3
  200. package/dist/esm/vehicle-quotation-form.entry.js +14 -11
  201. package/dist/locales/vehicleLookup/saleInformation/ar.json +1 -1
  202. package/dist/locales/vehicleLookup/saleInformation/en.json +1 -1
  203. package/dist/locales/vehicleLookup/saleInformation/ku.json +1 -1
  204. package/dist/locales/vehicleLookup/saleInformation/ru.json +1 -1
  205. package/dist/shift-components/p-0a728fec.entry.js +5 -0
  206. package/dist/shift-components/p-0e630c66.entry.js +5 -0
  207. package/dist/shift-components/p-0f83786b.entry.js +5 -0
  208. package/dist/shift-components/p-1c93d5e6.entry.js +5 -0
  209. package/dist/shift-components/p-26f3e6da.entry.js +5 -0
  210. package/dist/shift-components/p-3a7196d4.entry.js +5 -0
  211. package/dist/shift-components/{p-ce1bf4af.entry.js → p-45670df9.entry.js} +1 -1
  212. package/dist/shift-components/{p-d9234e52.entry.js → p-4aa6f707.entry.js} +1 -1
  213. package/dist/shift-components/p-50fd9d29.entry.js +5 -0
  214. package/dist/shift-components/p-63e1e80e.entry.js +5 -0
  215. package/dist/shift-components/{p-c250576d.entry.js → p-67476178.entry.js} +1 -1
  216. package/dist/shift-components/p-683f3ab3.entry.js +5 -0
  217. package/dist/shift-components/p-8700e868.entry.js +5 -0
  218. package/dist/shift-components/p-90a6803f.entry.js +5 -0
  219. package/dist/shift-components/{p-DPJOLEPo.js → p-B-8v_CQL.js} +1 -1
  220. package/dist/shift-components/p-BILW0yP6.js +5 -0
  221. package/dist/shift-components/{p-C2E0OQuQ.js → p-BK4ZcuiW.js} +1 -1
  222. package/dist/shift-components/p-BVMG8UaH.js +5 -0
  223. package/dist/shift-components/{p-BQaoN4EI.js → p-Bfkguwb-.js} +1 -1
  224. package/dist/shift-components/p-BnQp2Q8E.js +5 -0
  225. package/dist/shift-components/{p-DitnhRjp.js → p-C3YLTa2J.js} +1 -1
  226. package/dist/shift-components/p-DXZTo2xz.js +5 -0
  227. package/dist/shift-components/p-Dgh-j_S7.js +5 -0
  228. package/dist/shift-components/p-XyQhTm0V.js +5 -0
  229. package/dist/shift-components/p-b4231e50.entry.js +5 -0
  230. package/dist/shift-components/p-c7eaf245.entry.js +5 -0
  231. package/dist/shift-components/{p-6f59eb5f.entry.js → p-d7da1152.entry.js} +1 -1
  232. package/dist/shift-components/p-f7692371.entry.js +5 -0
  233. package/dist/shift-components/p-f8ac59ee.entry.js +5 -0
  234. package/dist/shift-components/p-fac0fdb9.entry.js +5 -0
  235. package/dist/shift-components/p-fe02d5ed.entry.js +5 -0
  236. package/dist/shift-components/shift-components.esm.js +1 -1
  237. package/dist/types/components/form-elements/VehicleImageViewer.d.ts +7 -0
  238. package/dist/types/components/form-elements/form-date-picker-legacy.d.ts +44 -0
  239. package/dist/types/components/form-elements/form-input.d.ts +5 -0
  240. package/dist/types/components/form-elements/form-picker-input.d.ts +36 -0
  241. package/dist/types/components/form-elements/form-shadow-input.d.ts +1 -0
  242. package/dist/types/components/form-elements/form-time-picker-legacy.d.ts +38 -0
  243. package/dist/types/components/form-elements/form-vin-input.d.ts +1 -1
  244. package/dist/types/components/forms/defaults/mappers.d.ts +20 -0
  245. package/dist/types/components/forms/defaults/validation.d.ts +5 -1
  246. package/dist/types/components/forms/service-booking.d.ts +5 -7
  247. package/dist/types/components.d.ts +187 -6
  248. package/dist/types/features/form-hook/functions.d.ts +6 -6
  249. package/dist/types/global/assets/calendar-days-icon.d.ts +8 -0
  250. package/dist/types/global/assets/clock-8-icon.d.ts +8 -0
  251. package/dist/types/global/lib/decode-time-offset.d.ts +6 -0
  252. package/dist/types/locales/vehicleLookup/serviceHistory/type.d.ts +2 -2
  253. package/dist/types/locales/vehicleLookup/wrapper-type.d.ts +2 -2
  254. package/package.json +2 -1
  255. package/dist/cjs/form-dialog_2.cjs.entry.js +0 -80
  256. package/dist/cjs/form-phone-number_5.cjs.entry.js +0 -638
  257. package/dist/cjs/state-object-BKYoOET2.js +0 -84
  258. package/dist/components/p-0RPSruUw.js +0 -5
  259. package/dist/components/p-AXXIpFHS.js +0 -5
  260. package/dist/components/p-B6oAdbSG.js +0 -5
  261. package/dist/components/p-B8ficu-2.js +0 -5
  262. package/dist/components/p-BccOXbO6.js +0 -5
  263. package/dist/components/p-BiWhrVwg.js +0 -5
  264. package/dist/components/p-CCnpN4O6.js +0 -5
  265. package/dist/components/p-CMIWLyy-.js +0 -5
  266. package/dist/components/p-CTvhIyUe.js +0 -5
  267. package/dist/components/p-CVPVwYky.js +0 -5
  268. package/dist/components/p-CY-XNpVl.js +0 -5
  269. package/dist/components/p-Cfv1Ad7h.js +0 -5
  270. package/dist/components/p-CmZX4oFn.js +0 -5
  271. package/dist/components/p-DDwq6NYq.js +0 -5
  272. package/dist/components/p-DGmPDcfO.js +0 -5
  273. package/dist/components/p-DnDLOq--.js +0 -5
  274. package/dist/components/p-Dot72Ksm.js +0 -5
  275. package/dist/components/p-DwlUO-mQ.js +0 -5
  276. package/dist/components/p-Dy_xcj4e.js +0 -5
  277. package/dist/components/p-HU3XmNIl.js +0 -5
  278. package/dist/components/p-qgWJBcxw.js +0 -5
  279. package/dist/components/p-uhXr4495.js +0 -5
  280. package/dist/esm/form-dialog_2.entry.js +0 -77
  281. package/dist/esm/form-phone-number_5.entry.js +0 -632
  282. package/dist/esm/state-object-DKRL_FzI.js +0 -79
  283. package/dist/shift-components/p-0e2d3d93.entry.js +0 -5
  284. package/dist/shift-components/p-10da80aa.entry.js +0 -5
  285. package/dist/shift-components/p-1ff500c4.entry.js +0 -5
  286. package/dist/shift-components/p-361e8b06.entry.js +0 -5
  287. package/dist/shift-components/p-38bb86f3.entry.js +0 -5
  288. package/dist/shift-components/p-39914eb3.entry.js +0 -5
  289. package/dist/shift-components/p-76f94eb5.entry.js +0 -5
  290. package/dist/shift-components/p-830b1bea.entry.js +0 -5
  291. package/dist/shift-components/p-835b1234.entry.js +0 -5
  292. package/dist/shift-components/p-92551553.entry.js +0 -5
  293. package/dist/shift-components/p-9c01c8ff.entry.js +0 -5
  294. package/dist/shift-components/p-CaFQm1Ia.js +0 -5
  295. package/dist/shift-components/p-Cf1rwCRV.js +0 -5
  296. package/dist/shift-components/p-DpDKQYgQ.js +0 -5
  297. package/dist/shift-components/p-a2419627.entry.js +0 -5
  298. package/dist/shift-components/p-a9a116b5.entry.js +0 -5
  299. package/dist/shift-components/p-bb5c2961.entry.js +0 -5
  300. package/dist/shift-components/p-bcb6b13e.entry.js +0 -5
  301. package/dist/shift-components/p-e06782ee.entry.js +0 -5
@@ -0,0 +1,498 @@
1
+ /*!
2
+ * Built by ShiftSoftware
3
+ * Copyright (c)
4
+ */
5
+ import { Host, h } from "@stencil/core";
6
+ import cn from "../../global/lib/cn";
7
+ import { getNestedValue } from "../../global/lib/get-nested-value";
8
+ import { FormInputLabel } from "./components/form-input-label";
9
+ import { FormErrorMessage } from "./components/form-error-message";
10
+ export class FormDatePicker {
11
+ constructor() {
12
+ this.language = 'en';
13
+ this.firstDayOfWeek = 0; // 0=Sun, 1=Mon, 6=Sat
14
+ this.isOpen = false;
15
+ this.selectedValue = '';
16
+ this.openUpwards = false;
17
+ this.handleOutsideClick = (event) => {
18
+ if (!this.el.contains(event.target))
19
+ this.isOpen = false;
20
+ };
21
+ this.handleKeyDown = (event) => {
22
+ if (event.key === 'Escape' && this.isOpen)
23
+ this.isOpen = false;
24
+ };
25
+ this.toggleDropdown = () => {
26
+ if (this.isOpen) {
27
+ this.isOpen = false;
28
+ return;
29
+ }
30
+ this.adjustDropdownPosition();
31
+ };
32
+ this.selectDate = (year, month, day) => {
33
+ this.selectedValue = this.toDateString(year, month, day);
34
+ this.isOpen = false;
35
+ };
36
+ this.prevMonth = () => {
37
+ if (!this.canGoPrev())
38
+ return;
39
+ if (this.viewMonth === 0) {
40
+ this.viewMonth = 11;
41
+ this.viewYear--;
42
+ }
43
+ else {
44
+ this.viewMonth--;
45
+ }
46
+ };
47
+ this.nextMonth = () => {
48
+ if (!this.canGoNext())
49
+ return;
50
+ if (this.viewMonth === 11) {
51
+ this.viewMonth = 0;
52
+ this.viewYear++;
53
+ }
54
+ else {
55
+ this.viewMonth++;
56
+ }
57
+ };
58
+ }
59
+ async componentWillLoad() {
60
+ this.form.subscribe(this.name, this);
61
+ if (this.staticValue)
62
+ this.defaultValue = this.staticValue;
63
+ if (this.defaultValue)
64
+ this.selectedValue = this.defaultValue;
65
+ const initDate = this.selectedValue ? new Date(this.selectedValue + 'T00:00:00') : new Date();
66
+ this.viewYear = initDate.getFullYear();
67
+ this.viewMonth = initDate.getMonth();
68
+ }
69
+ async onStaticValueChange(newStaticValue) {
70
+ if (newStaticValue) {
71
+ this.selectedValue = newStaticValue;
72
+ const date = new Date(newStaticValue + 'T00:00:00');
73
+ this.viewYear = date.getFullYear();
74
+ this.viewMonth = date.getMonth();
75
+ }
76
+ }
77
+ async componentDidLoad() {
78
+ document.addEventListener('click', this.handleOutsideClick);
79
+ document.addEventListener('keydown', this.handleKeyDown);
80
+ }
81
+ async disconnectedCallback() {
82
+ this.form.unsubscribe(this.name);
83
+ document.removeEventListener('click', this.handleOutsideClick);
84
+ document.removeEventListener('keydown', this.handleKeyDown);
85
+ }
86
+ reset(newValue) {
87
+ this.selectedValue = newValue || this.defaultValue || '';
88
+ if (this.selectedValue) {
89
+ const date = new Date(this.selectedValue + 'T00:00:00');
90
+ this.viewYear = date.getFullYear();
91
+ this.viewMonth = date.getMonth();
92
+ }
93
+ }
94
+ adjustDropdownPosition() {
95
+ requestAnimationFrame(() => {
96
+ const input = this.el.querySelector('.form-input-style');
97
+ if (!input)
98
+ return;
99
+ const rect = input.getBoundingClientRect();
100
+ const spaceBelow = window.innerHeight - rect.bottom - 20;
101
+ this.openUpwards = spaceBelow < 320;
102
+ setTimeout(() => {
103
+ this.isOpen = true;
104
+ }, 10);
105
+ });
106
+ }
107
+ // Date utilities
108
+ toDateString(year, month, day) {
109
+ return `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
110
+ }
111
+ isDateDisabled(year, month, day) {
112
+ const dateStr = this.toDateString(year, month, day);
113
+ if (this.minDate && dateStr < this.minDate)
114
+ return true;
115
+ if (this.maxDate && dateStr > this.maxDate)
116
+ return true;
117
+ if (this.disabledDates)
118
+ return this.disabledDates(new Date(year, month, day));
119
+ return false;
120
+ }
121
+ getCalendarDays() {
122
+ const year = this.viewYear;
123
+ const month = this.viewMonth;
124
+ const firstDayOfMonth = new Date(year, month, 1).getDay();
125
+ const daysInMonth = new Date(year, month + 1, 0).getDate();
126
+ const daysInPrevMonth = new Date(year, month, 0).getDate();
127
+ const leadingDays = (firstDayOfMonth - this.firstDayOfWeek + 7) % 7;
128
+ const days = [];
129
+ for (let i = leadingDays - 1; i >= 0; i--) {
130
+ const prevMonth = month === 0 ? 11 : month - 1;
131
+ const prevYear = month === 0 ? year - 1 : year;
132
+ days.push({ day: daysInPrevMonth - i, month: prevMonth, year: prevYear, isCurrentMonth: false });
133
+ }
134
+ for (let i = 1; i <= daysInMonth; i++) {
135
+ days.push({ day: i, month, year, isCurrentMonth: true });
136
+ }
137
+ const remaining = 42 - days.length;
138
+ for (let i = 1; i <= remaining; i++) {
139
+ const nextMonth = month === 11 ? 0 : month + 1;
140
+ const nextYear = month === 11 ? year + 1 : year;
141
+ days.push({ day: i, month: nextMonth, year: nextYear, isCurrentMonth: false });
142
+ }
143
+ return days;
144
+ }
145
+ getWeekDayNames() {
146
+ const names = [];
147
+ const baseDate = new Date(2024, 0, 7); // known Sunday
148
+ for (let i = 0; i < 7; i++) {
149
+ const d = new Date(baseDate);
150
+ d.setDate(d.getDate() + ((this.firstDayOfWeek + i) % 7));
151
+ names.push(new Intl.DateTimeFormat(this.language, { weekday: 'short' }).format(d));
152
+ }
153
+ return names;
154
+ }
155
+ getMonthYearTitle() {
156
+ return new Intl.DateTimeFormat(this.language, { month: 'long', year: 'numeric' }).format(new Date(this.viewYear, this.viewMonth));
157
+ }
158
+ formatDisplayValue() {
159
+ if (!this.selectedValue)
160
+ return '';
161
+ try {
162
+ return new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' }).format(new Date(this.selectedValue + 'T00:00:00'));
163
+ }
164
+ catch (_a) {
165
+ return this.selectedValue;
166
+ }
167
+ }
168
+ canGoPrev() {
169
+ if (!this.minDate)
170
+ return true;
171
+ const [minYear, minMonth] = this.minDate.split('-').map(Number);
172
+ return this.viewYear > minYear || (this.viewYear === minYear && this.viewMonth > minMonth - 1);
173
+ }
174
+ canGoNext() {
175
+ if (!this.maxDate)
176
+ return true;
177
+ const [maxYear, maxMonth] = this.maxDate.split('-').map(Number);
178
+ return this.viewYear < maxYear || (this.viewYear === maxYear && this.viewMonth < maxMonth - 1);
179
+ }
180
+ render() {
181
+ const { disabled, isRequired, meta, isError, errorMessage } = this.form.getInputState(this.name);
182
+ const [locale] = this.form.getFormLocale();
183
+ const label = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.label) || (meta === null || meta === void 0 ? void 0 : meta.label);
184
+ const placeholder = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.placeholder);
185
+ const isDisabled = disabled || this.isLoading || !!this.staticValue || this.isDisabled;
186
+ const displayValue = this.formatDisplayValue();
187
+ const weekDays = this.getWeekDayNames();
188
+ const days = this.getCalendarDays();
189
+ const monthTitle = this.getMonthYearTitle();
190
+ const now = new Date();
191
+ const todayStr = this.toDateString(now.getFullYear(), now.getMonth(), now.getDate());
192
+ return (h(Host, { key: '4db95c0c0381da76cfda97fdf70810808673d381' }, h("label", { key: 'cc816c07f4b85437a4b08f46e84c67acd6d6e804', part: this.name, id: this.wrapperId, class: cn('form-input-label-container', this.wrapperClass, { disabled: isDisabled }) }, h(FormInputLabel, { key: '8661150081ea4a8bbf98cdf8200b1467912715be', isRequired: isRequired, label: label }), h("form-shadow-input", { key: '70978796ac1617c54806c87963d772c0e2c2e50b', name: this.name, form: this.form, value: this.selectedValue }), h("div", { key: '9341f0d67eb4471d321124c9a9ee7ca8feb06e70', part: `${this.name}-container form-input-container`, class: cn('form-input-container', { open: this.isOpen }) }, h("input", { key: 'f8bfd2ea087a16ee69aa52d98d4ed02daa4b027f', type: "text", readOnly: true, disabled: isDisabled, value: displayValue, onClick: this.toggleDropdown, part: `${this.name}-input form-input`, placeholder: placeholder || (meta === null || meta === void 0 ? void 0 : meta.placeholder), class: cn('form-input-style form-input-select', {
193
+ 'form-input-error-style': isError,
194
+ }) }), h("span", { key: 'b90d55597940d7265aa4a9da2bf62e2206c1a443', part: `${this.name}-icon form-date-picker-icon`, class: "form-input-icon form-input-icon-end" }, h("svg", { key: '44a9ffabb98b9fa353504f2e32714cfc4cc55c0a', "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "size-full" }, h("path", { key: '65a36c47d6677d140bdd2732cc2a39cf0e1b4da0', d: "M8 2v4" }), h("path", { key: 'c8147da41710e22f6b9787f249140ad0a0b0e728', d: "M16 2v4" }), h("rect", { key: '05cecc8e5f7a1f7790cafd5bb55f3fce0909b359', width: "18", height: "18", x: "3", y: "4", rx: "2" }), h("path", { key: 'bad2f8467be0592c5878278845561d2d19c389c9', d: "M3 10h18" }))), h("div", { key: 'eab0aa136052e3fbe9d7b336f9214162ddc97167', part: `${this.name}-dropdown form-date-picker-dropdown`, class: cn('form-picker-dropdown', {
195
+ upwards: this.openUpwards,
196
+ downwards: !this.openUpwards,
197
+ }) }, h("div", { key: '58b349b2f93b3e6b144acb91462018175e8a2d4d', class: "form-date-picker-header" }, h("button", { key: '8bc1e5c9d917791c25a8abff82af6ed22ea2f840', type: "button", disabled: !this.canGoPrev(), part: `${this.name}-prev form-date-picker-nav`, onClick: this.prevMonth, class: "form-date-picker-nav" }, h("svg", { key: '4813e5358e8755f1fb8bd445182dd49706f72c51', "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "size-4 rtl:rotate-180" }, h("path", { key: 'c135f860ca663d428dad92669f33510be4f72dda', d: "m15 18-6-6 6-6" }))), h("span", { key: '0ee9dda3778c4c32c0ac6b9c29fe1f145cc72e6c', part: `${this.name}-title form-date-picker-title`, class: "form-date-picker-title" }, monthTitle), h("button", { key: '9c4a0e263c81c080ae4886f30a89be182e4f403a', type: "button", disabled: !this.canGoNext(), part: `${this.name}-next form-date-picker-nav`, onClick: this.nextMonth, class: "form-date-picker-nav" }, h("svg", { key: 'b647449654ae66e719bf1c1c93d203bad6ca814a', "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "size-4 rtl:rotate-180" }, h("path", { key: '6c3ab653e7eb383253f1696ace2e2d29c2a23d79', d: "m9 18 6-6-6-6" })))), h("div", { key: 'e650578c5e476e02f318f8a41ea3e4a5b4591bfb', class: "form-date-picker-grid" }, weekDays.map(day => (h("div", { class: "form-date-picker-weekday" }, day))), days.map(cell => {
198
+ const dateStr = this.toDateString(cell.year, cell.month, cell.day);
199
+ const isSelected = dateStr === this.selectedValue;
200
+ const isToday = dateStr === todayStr;
201
+ const dateDisabled = !cell.isCurrentMonth || this.isDateDisabled(cell.year, cell.month, cell.day);
202
+ return (h("button", { type: "button", disabled: dateDisabled, onClick: () => this.selectDate(cell.year, cell.month, cell.day), part: cn('form-date-picker-day', { 'form-date-picker-day-selected': isSelected, 'form-date-picker-day-today': isToday }), class: cn('form-date-picker-day', {
203
+ selected: isSelected,
204
+ today: isToday && !isSelected,
205
+ outside: !cell.isCurrentMonth,
206
+ }) }, cell.day));
207
+ })))), h(FormErrorMessage, { key: '04191c85e8dd2c23a3714c9f62c39ca0b5fa42d8', name: this.name, isError: isError, errorMessage: locale[errorMessage] || errorMessage }))));
208
+ }
209
+ static get is() { return "form-date-picker"; }
210
+ static get originalStyleUrls() {
211
+ return {
212
+ "$": ["form-inputs.css"]
213
+ };
214
+ }
215
+ static get styleUrls() {
216
+ return {
217
+ "$": ["form-inputs.css"]
218
+ };
219
+ }
220
+ static get properties() {
221
+ return {
222
+ "name": {
223
+ "type": "string",
224
+ "attribute": "name",
225
+ "mutable": false,
226
+ "complexType": {
227
+ "original": "string",
228
+ "resolved": "string",
229
+ "references": {}
230
+ },
231
+ "required": false,
232
+ "optional": false,
233
+ "docs": {
234
+ "tags": [],
235
+ "text": ""
236
+ },
237
+ "getter": false,
238
+ "setter": false,
239
+ "reflect": false
240
+ },
241
+ "wrapperId": {
242
+ "type": "string",
243
+ "attribute": "wrapper-id",
244
+ "mutable": false,
245
+ "complexType": {
246
+ "original": "string",
247
+ "resolved": "string",
248
+ "references": {}
249
+ },
250
+ "required": false,
251
+ "optional": false,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": ""
255
+ },
256
+ "getter": false,
257
+ "setter": false,
258
+ "reflect": false
259
+ },
260
+ "isLoading": {
261
+ "type": "boolean",
262
+ "attribute": "is-loading",
263
+ "mutable": false,
264
+ "complexType": {
265
+ "original": "boolean",
266
+ "resolved": "boolean",
267
+ "references": {}
268
+ },
269
+ "required": false,
270
+ "optional": true,
271
+ "docs": {
272
+ "tags": [],
273
+ "text": ""
274
+ },
275
+ "getter": false,
276
+ "setter": false,
277
+ "reflect": false
278
+ },
279
+ "isDisabled": {
280
+ "type": "boolean",
281
+ "attribute": "is-disabled",
282
+ "mutable": false,
283
+ "complexType": {
284
+ "original": "boolean",
285
+ "resolved": "boolean",
286
+ "references": {}
287
+ },
288
+ "required": false,
289
+ "optional": true,
290
+ "docs": {
291
+ "tags": [],
292
+ "text": ""
293
+ },
294
+ "getter": false,
295
+ "setter": false,
296
+ "reflect": false
297
+ },
298
+ "form": {
299
+ "type": "unknown",
300
+ "attribute": "form",
301
+ "mutable": false,
302
+ "complexType": {
303
+ "original": "FormHook<any>",
304
+ "resolved": "FormHook<any>",
305
+ "references": {
306
+ "FormHook": {
307
+ "location": "import",
308
+ "path": "~features/form-hook/form-hook",
309
+ "id": "src/features/form-hook/form-hook.ts::FormHook"
310
+ }
311
+ }
312
+ },
313
+ "required": false,
314
+ "optional": false,
315
+ "docs": {
316
+ "tags": [],
317
+ "text": ""
318
+ },
319
+ "getter": false,
320
+ "setter": false
321
+ },
322
+ "wrapperClass": {
323
+ "type": "string",
324
+ "attribute": "wrapper-class",
325
+ "mutable": false,
326
+ "complexType": {
327
+ "original": "string",
328
+ "resolved": "string",
329
+ "references": {}
330
+ },
331
+ "required": false,
332
+ "optional": false,
333
+ "docs": {
334
+ "tags": [],
335
+ "text": ""
336
+ },
337
+ "getter": false,
338
+ "setter": false,
339
+ "reflect": false
340
+ },
341
+ "staticValue": {
342
+ "type": "string",
343
+ "attribute": "static-value",
344
+ "mutable": false,
345
+ "complexType": {
346
+ "original": "string",
347
+ "resolved": "string",
348
+ "references": {}
349
+ },
350
+ "required": false,
351
+ "optional": true,
352
+ "docs": {
353
+ "tags": [],
354
+ "text": ""
355
+ },
356
+ "getter": false,
357
+ "setter": false,
358
+ "reflect": false
359
+ },
360
+ "defaultValue": {
361
+ "type": "string",
362
+ "attribute": "default-value",
363
+ "mutable": true,
364
+ "complexType": {
365
+ "original": "string",
366
+ "resolved": "string",
367
+ "references": {}
368
+ },
369
+ "required": false,
370
+ "optional": true,
371
+ "docs": {
372
+ "tags": [],
373
+ "text": ""
374
+ },
375
+ "getter": false,
376
+ "setter": false,
377
+ "reflect": false
378
+ },
379
+ "language": {
380
+ "type": "string",
381
+ "attribute": "language",
382
+ "mutable": false,
383
+ "complexType": {
384
+ "original": "string",
385
+ "resolved": "string",
386
+ "references": {}
387
+ },
388
+ "required": false,
389
+ "optional": true,
390
+ "docs": {
391
+ "tags": [],
392
+ "text": ""
393
+ },
394
+ "getter": false,
395
+ "setter": false,
396
+ "reflect": false,
397
+ "defaultValue": "'en'"
398
+ },
399
+ "minDate": {
400
+ "type": "string",
401
+ "attribute": "min-date",
402
+ "mutable": false,
403
+ "complexType": {
404
+ "original": "string",
405
+ "resolved": "string",
406
+ "references": {}
407
+ },
408
+ "required": false,
409
+ "optional": true,
410
+ "docs": {
411
+ "tags": [],
412
+ "text": ""
413
+ },
414
+ "getter": false,
415
+ "setter": false,
416
+ "reflect": false
417
+ },
418
+ "maxDate": {
419
+ "type": "string",
420
+ "attribute": "max-date",
421
+ "mutable": false,
422
+ "complexType": {
423
+ "original": "string",
424
+ "resolved": "string",
425
+ "references": {}
426
+ },
427
+ "required": false,
428
+ "optional": true,
429
+ "docs": {
430
+ "tags": [],
431
+ "text": ""
432
+ },
433
+ "getter": false,
434
+ "setter": false,
435
+ "reflect": false
436
+ },
437
+ "disabledDates": {
438
+ "type": "unknown",
439
+ "attribute": "disabled-dates",
440
+ "mutable": false,
441
+ "complexType": {
442
+ "original": "(date: Date) => boolean",
443
+ "resolved": "(date: Date) => boolean",
444
+ "references": {
445
+ "Date": {
446
+ "location": "global",
447
+ "id": "global::Date"
448
+ }
449
+ }
450
+ },
451
+ "required": false,
452
+ "optional": true,
453
+ "docs": {
454
+ "tags": [],
455
+ "text": ""
456
+ },
457
+ "getter": false,
458
+ "setter": false
459
+ },
460
+ "firstDayOfWeek": {
461
+ "type": "number",
462
+ "attribute": "first-day-of-week",
463
+ "mutable": false,
464
+ "complexType": {
465
+ "original": "number",
466
+ "resolved": "number",
467
+ "references": {}
468
+ },
469
+ "required": false,
470
+ "optional": true,
471
+ "docs": {
472
+ "tags": [],
473
+ "text": ""
474
+ },
475
+ "getter": false,
476
+ "setter": false,
477
+ "reflect": false,
478
+ "defaultValue": "0"
479
+ }
480
+ };
481
+ }
482
+ static get states() {
483
+ return {
484
+ "isOpen": {},
485
+ "selectedValue": {},
486
+ "viewYear": {},
487
+ "viewMonth": {},
488
+ "openUpwards": {}
489
+ };
490
+ }
491
+ static get elementRef() { return "el"; }
492
+ static get watchers() {
493
+ return [{
494
+ "propName": "staticValue",
495
+ "methodName": "onStaticValueChange"
496
+ }];
497
+ }
498
+ }
@@ -33,12 +33,12 @@ export class FormInput {
33
33
  }
34
34
  render() {
35
35
  const [locale] = this.form.getFormLocale();
36
- return (h(Host, { key: '199ef538686cf27c61302a6beca75ac5b9defb6d' }, h("div", { key: 'ddf67b9a178b0ba626039a4d286d007da76c4edb', part: "form-dialog-modal", dir: locale.sharedFormLocales.direction, class: cn('dialog-drop-container', {
36
+ return (h(Host, { key: 'c441c354ce115473f511a40781d24b7514b722d1' }, h("div", { key: 'f3569f94609f0306ab1ebcda3c6f6d248991b3a0', part: "form-dialog-modal", dir: locale.sharedFormLocales.direction, class: cn('dialog-drop-container', {
37
37
  'opened-dialog-drop-container dialog-blur': this.isOpened,
38
38
  'error': this.isError,
39
- }) }, h("div", { key: 'a8b7d5df1921736b9be3485d235ce87f0ad9e893', part: "dialog-wrapper", class: cn('dialog-wrapper', {
39
+ }) }, h("div", { key: '1d0cdd5ebc72dd513bd504aba206d9013e06e532', part: "dialog-wrapper", class: cn('dialog-wrapper', {
40
40
  'opened-dialog-wrapper': this.isOpened,
41
- }) }, h("button", { key: 'b841ac1bc84e4f87a0e4c497aaf0df4a1b24eefc', part: "dialog-close-icon-button", onClick: this.closeDialog, type: "button", class: "dialog-close-icon-button" }, h(AddIcon, { key: '444c50be6be0d87a1b35d13b389d60a849454b35' })), h("div", { key: '7e24a9f5d93046bea743553b388273dabd2e3054', part: "dialog-content", class: "dialog-content" }, this.isError && this.internalMessage, h("div", { key: 'eee613b8b3c5dacba95fd70695e92837cbb07229', style: { display: this.isError ? 'none' : 'block' } }, h("slot", { key: '41c811128d2e49e2472ebf6b1ee99e5099896a75' }))), h("button", { key: '8d70d118f61c8abb480a85551de869546885965c', part: "dialog-close-button", type: "button", onClick: this.closeDialog, class: "dialog-close-button" }, this.closeText)))));
41
+ }) }, h("button", { key: 'e20cbff0c28e88df61fb0fb9ba0648f5122bc9d1', "aria-label": "Close the dialog", part: "dialog-close-icon-button", onClick: this.closeDialog, type: "button", class: "dialog-close-icon-button" }, h(AddIcon, { key: '537d601ce25e20faa543f7be795310c7bf97cdbe' })), h("div", { key: '65c713967f31b1fab0c730d8b328a62cc2e319c1', part: "dialog-content", class: "dialog-content" }, this.isError && this.internalMessage, h("div", { key: 'fbc7477f1c2963081bd5026ac6ebefea68a17475', style: { display: this.isError ? 'none' : 'block' } }, h("slot", { key: '8127f5e16e326fc862cfac12910fde9a3aa45946' }))), h("button", { key: '7a36718edc3de3682201caeeaffee1ffc3cd9c9d', part: "dialog-close-button", type: "button", onClick: this.closeDialog, class: "dialog-close-button" }, this.closeText)))));
42
42
  }
43
43
  static get is() { return "form-dialog"; }
44
44
  static get originalStyleUrls() {
@@ -12,7 +12,12 @@ const partKeyPrefix = 'form-input-';
12
12
  export class FormInput {
13
13
  constructor() {
14
14
  this.inputProps = {};
15
+ this.iconPosition = 'end';
15
16
  this.prefixWidth = 0;
17
+ this.onInputChange = (event) => {
18
+ const target = event.target;
19
+ target.value = this.formatter ? this.formatter(target.value) : target.value;
20
+ };
16
21
  }
17
22
  async componentWillLoad() {
18
23
  this.form.subscribe(this.name, this);
@@ -20,8 +25,9 @@ export class FormInput {
20
25
  }
21
26
  async onStaticValueChange(newStaticValue, notInitialLoad = true) {
22
27
  if (!!newStaticValue) {
23
- this.defaultValue = newStaticValue;
24
- this.inputRef.value = newStaticValue;
28
+ const formatted = this.formatter ? this.formatter(newStaticValue) : newStaticValue;
29
+ this.defaultValue = formatted;
30
+ this.inputRef.value = formatted;
25
31
  }
26
32
  else if (notInitialLoad) {
27
33
  this.defaultValue = '';
@@ -38,7 +44,7 @@ export class FormInput {
38
44
  }
39
45
  reset(newValue) {
40
46
  const value = newValue || this.defaultValue || '';
41
- this.inputRef.value = value;
47
+ this.inputRef.value = this.formatter ? this.formatter(value) : value;
42
48
  }
43
49
  render() {
44
50
  var _a, _b;
@@ -48,9 +54,18 @@ export class FormInput {
48
54
  const label = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.label) || (meta === null || meta === void 0 ? void 0 : meta.label);
49
55
  const placeholder = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.placeholder);
50
56
  const isDisabled = disabled || this.isLoading || !!this.staticValue || this.isDisabled;
51
- return (h(Host, { key: '09bb9086c366f7267c76d1ee68d2b428463e1cb2' }, h("label", { key: 'f5c77348b7850981074220ed92b7536583108694', part: this.name, id: this.wrapperId, class: cn('form-input-label-container', this.wrapperClass, { disabled: isDisabled }) }, h(FormInputLabel, { key: '191b3d82af70a315092df65e68b3ba1e513309e1', isRequired: isRequired, label: label }), h("div", { key: '952b388e58e053f29000ba43694c9edb0a7220d4', part: `${this.name}-container form-input-container`, class: "form-input-container" }, h(FormInputPrefix, { key: '3a21d902431bd6a761a6189148be5fa751737099', name: this.name, direction: (_a = locale === null || locale === void 0 ? void 0 : locale.sharedFormLocales) === null || _a === void 0 ? void 0 : _a.direction, prefix: this.inputPrefix }), h("input", Object.assign({ key: '9c6393954ecfaa7b5a4b2ad6484bb4225f28e642' }, this.inputProps, { name: this.name, type: this === null || this === void 0 ? void 0 : this.type, disabled: isDisabled, defaultValue: this.defaultValue, part: `${this.name}-input form-input`, placeholder: placeholder || (meta === null || meta === void 0 ? void 0 : meta.placeholder), style: Object.assign({}, (this.prefixWidth ? { [((_b = locale === null || locale === void 0 ? void 0 : locale.sharedFormLocales) === null || _b === void 0 ? void 0 : _b.direction) === 'rtl' ? 'paddingRight' : 'paddingLeft']: `${this.prefixWidth}px` } : {})), class: cn('form-input-style', part, {
57
+ const isRtl = ((_a = locale === null || locale === void 0 ? void 0 : locale.sharedFormLocales) === null || _a === void 0 ? void 0 : _a.direction) === 'rtl';
58
+ const isIconStart = this.iconPosition === 'start';
59
+ const iconPaddingSide = isIconStart ? (isRtl ? 'paddingRight' : 'paddingLeft') : isRtl ? 'paddingLeft' : 'paddingRight';
60
+ const iconClass = cn('form-input-icon', {
61
+ 'form-input-icon-start': isIconStart,
62
+ 'form-input-icon-end': !isIconStart,
63
+ 'form-input-icon-interactive': !!this.iconAction,
64
+ });
65
+ const renderIcon = () => this.iconAction ? (h("button", { type: "button", disabled: isDisabled, onClick: this.iconAction, part: `${this.name}-icon form-input-icon`, class: iconClass }, this.icon)) : (h("span", { part: `${this.name}-icon form-input-icon`, class: iconClass }, this.icon));
66
+ return (h(Host, { key: '64e1dc935b2527d8264fd145b830533b244a3e06' }, h("label", { key: 'a3a03a65a13c1f64f3bc10236b26cdd9b0990250', part: this.name, id: this.wrapperId, class: cn('form-input-label-container', this.wrapperClass, { disabled: isDisabled }) }, h(FormInputLabel, { key: 'a650f865e2dc033dc611203b1c0bb02654c30c66', isRequired: isRequired, label: label }), h("div", { key: '21fc7153d4d1d8b1f66df3931deb3fe9467f1984', part: `${this.name}-container form-input-container`, class: "form-input-container" }, h(FormInputPrefix, { key: '2bcf38f42353f939603c2b6a9cced6962d1ba795', name: this.name, direction: (_b = locale === null || locale === void 0 ? void 0 : locale.sharedFormLocales) === null || _b === void 0 ? void 0 : _b.direction, prefix: this.inputPrefix }), h("input", Object.assign({ key: '056b29e97c4e784d824da863a12c6118d32c6b05' }, this.inputProps, { name: this.name, type: this === null || this === void 0 ? void 0 : this.type, disabled: isDisabled, onInput: this.onInputChange, defaultValue: this.formatter ? this.formatter(this.defaultValue || '') : this.defaultValue, part: `${this.name}-input form-input`, placeholder: placeholder || (meta === null || meta === void 0 ? void 0 : meta.placeholder), style: Object.assign(Object.assign({}, (this.prefixWidth ? { [isRtl ? 'paddingRight' : 'paddingLeft']: `${this.prefixWidth}px` } : {})), (this.icon ? { [iconPaddingSide]: '40px' } : {})), class: cn('form-input-style', part, {
52
67
  'form-input-error-style': isError,
53
- }) }))), h(FormErrorMessage, { key: '77532a9d8c77c5cd67b3a141d07315de1ad857f8', name: this.name, isError: isError, errorMessage: locale[errorMessage] || errorMessage }))));
68
+ }) })), this.icon && renderIcon()), h(FormErrorMessage, { key: 'd1f35267c7fb6348c456532042d922d56640c549', name: this.name, isError: isError, errorMessage: locale[errorMessage] || errorMessage }))));
54
69
  }
55
70
  static get is() { return "form-input"; }
56
71
  static get originalStyleUrls() {
@@ -284,6 +299,81 @@ export class FormInput {
284
299
  "getter": false,
285
300
  "setter": false,
286
301
  "reflect": false
302
+ },
303
+ "formatter": {
304
+ "type": "unknown",
305
+ "attribute": "formatter",
306
+ "mutable": false,
307
+ "complexType": {
308
+ "original": "(value: string) => string",
309
+ "resolved": "(value: string) => string",
310
+ "references": {}
311
+ },
312
+ "required": false,
313
+ "optional": true,
314
+ "docs": {
315
+ "tags": [],
316
+ "text": ""
317
+ },
318
+ "getter": false,
319
+ "setter": false
320
+ },
321
+ "icon": {
322
+ "type": "any",
323
+ "attribute": "icon",
324
+ "mutable": false,
325
+ "complexType": {
326
+ "original": "any",
327
+ "resolved": "any",
328
+ "references": {}
329
+ },
330
+ "required": false,
331
+ "optional": true,
332
+ "docs": {
333
+ "tags": [],
334
+ "text": ""
335
+ },
336
+ "getter": false,
337
+ "setter": false,
338
+ "reflect": false
339
+ },
340
+ "iconAction": {
341
+ "type": "unknown",
342
+ "attribute": "icon-action",
343
+ "mutable": false,
344
+ "complexType": {
345
+ "original": "() => void",
346
+ "resolved": "() => void",
347
+ "references": {}
348
+ },
349
+ "required": false,
350
+ "optional": true,
351
+ "docs": {
352
+ "tags": [],
353
+ "text": ""
354
+ },
355
+ "getter": false,
356
+ "setter": false
357
+ },
358
+ "iconPosition": {
359
+ "type": "string",
360
+ "attribute": "icon-position",
361
+ "mutable": false,
362
+ "complexType": {
363
+ "original": "'start' | 'end'",
364
+ "resolved": "\"end\" | \"start\"",
365
+ "references": {}
366
+ },
367
+ "required": false,
368
+ "optional": true,
369
+ "docs": {
370
+ "tags": [],
371
+ "text": ""
372
+ },
373
+ "getter": false,
374
+ "setter": false,
375
+ "reflect": false,
376
+ "defaultValue": "'end'"
287
377
  }
288
378
  };
289
379
  }