bromcom-ui 2.11.1 → 2.12.0-test.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 (361) hide show
  1. package/dist/bromcom-ui/bromcom-ui.css +1 -1
  2. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  3. package/dist/bromcom-ui/{p-c49b6287.entry.js → p-01416407.entry.js} +1 -1
  4. package/dist/bromcom-ui/p-0218b337.js +5 -0
  5. package/dist/bromcom-ui/p-055e4575.entry.js +5 -0
  6. package/dist/bromcom-ui/p-0a1c01fa.entry.js +5 -0
  7. package/dist/bromcom-ui/p-0d207b61.entry.js +5 -0
  8. package/dist/bromcom-ui/{p-a42fbe84.entry.js → p-183bc78f.entry.js} +1 -1
  9. package/dist/bromcom-ui/p-195c5945.entry.js +5 -0
  10. package/dist/bromcom-ui/p-1e793658.entry.js +5 -0
  11. package/dist/bromcom-ui/{p-e8eaa3bb.entry.js → p-28f78dd4.entry.js} +1 -1
  12. package/dist/bromcom-ui/p-2ab4e748.entry.js +5 -0
  13. package/dist/bromcom-ui/p-2fbae1fa.entry.js +5 -0
  14. package/dist/bromcom-ui/p-2fdde750.entry.js +5 -0
  15. package/dist/bromcom-ui/{p-a6aa173f.entry.js → p-3078fcd2.entry.js} +1 -1
  16. package/dist/bromcom-ui/p-30a06f92.js +5 -0
  17. package/dist/bromcom-ui/p-310cab1a.js +14 -0
  18. package/dist/bromcom-ui/p-3182df7e.js +10 -0
  19. package/dist/bromcom-ui/{p-1b558b0f.entry.js → p-3960cae8.entry.js} +1 -1
  20. package/dist/bromcom-ui/p-39eb3017.entry.js +5 -0
  21. package/dist/bromcom-ui/{p-59f7fa84.entry.js → p-3a06c6b1.entry.js} +1 -1
  22. package/dist/bromcom-ui/p-3dba7987.js +5 -0
  23. package/dist/bromcom-ui/{p-3f3579b5.entry.js → p-3e63aea1.entry.js} +1 -1
  24. package/dist/bromcom-ui/p-3f8853a8.entry.js +5 -0
  25. package/dist/bromcom-ui/p-4680865d.js +5 -0
  26. package/dist/bromcom-ui/p-4689c10d.entry.js +5 -0
  27. package/dist/bromcom-ui/{p-d01426b6.entry.js → p-4e33341b.entry.js} +1 -1
  28. package/dist/bromcom-ui/p-516eb821.entry.js +5 -0
  29. package/dist/bromcom-ui/{p-24906295.entry.js → p-54c2dc4e.entry.js} +1 -1
  30. package/dist/bromcom-ui/{p-a1e299af.entry.js → p-56fca120.entry.js} +1 -1
  31. package/dist/bromcom-ui/{p-b764ab86.entry.js → p-57d2c129.entry.js} +1 -1
  32. package/dist/bromcom-ui/{p-270e1b24.entry.js → p-59294a5a.entry.js} +1 -1
  33. package/dist/bromcom-ui/p-5a6caa99.entry.js +5 -0
  34. package/dist/bromcom-ui/{p-a34bc3d8.entry.js → p-5bea1cd3.entry.js} +1 -1
  35. package/dist/bromcom-ui/{p-7005fb55.entry.js → p-5e50d99c.entry.js} +1 -1
  36. package/dist/bromcom-ui/p-5f04686a.entry.js +5 -0
  37. package/dist/bromcom-ui/p-619d632d.entry.js +5 -0
  38. package/dist/bromcom-ui/p-626a65e9.js +5 -0
  39. package/dist/bromcom-ui/{p-fcf4b343.entry.js → p-67a6f0b1.entry.js} +1 -1
  40. package/dist/bromcom-ui/{p-dc62a5f7.entry.js → p-68fb3f60.entry.js} +1 -1
  41. package/dist/bromcom-ui/{p-c7caf94d.js → p-6b55a1fe.js} +1 -1
  42. package/dist/bromcom-ui/{p-a0d6d680.js → p-6b5ed4d8.js} +1 -1
  43. package/dist/bromcom-ui/p-70761906.entry.js +5 -0
  44. package/dist/bromcom-ui/{p-0bde4e71.entry.js → p-72bbcca6.entry.js} +1 -1
  45. package/dist/bromcom-ui/{p-06392358.entry.js → p-74cedefe.entry.js} +1 -1
  46. package/dist/bromcom-ui/p-76edf59f.js +7 -0
  47. package/dist/bromcom-ui/{p-5c70a918.entry.js → p-7c43d2ac.entry.js} +1 -1
  48. package/dist/bromcom-ui/{p-f9b59bcc.entry.js → p-7edab876.entry.js} +1 -1
  49. package/dist/bromcom-ui/{p-d59d9687.entry.js → p-7f1612df.entry.js} +1 -1
  50. package/dist/bromcom-ui/{p-61753299.js → p-816fbffd.js} +1 -1
  51. package/dist/bromcom-ui/p-86bfeae7.entry.js +5 -0
  52. package/dist/bromcom-ui/{p-a6142e74.entry.js → p-8858f845.entry.js} +1 -1
  53. package/dist/bromcom-ui/{p-08af4159.entry.js → p-89cffdc1.entry.js} +1 -1
  54. package/dist/bromcom-ui/{p-32c55505.entry.js → p-8c3535b6.entry.js} +1 -1
  55. package/dist/bromcom-ui/p-8de5e85a.entry.js +5 -0
  56. package/dist/bromcom-ui/p-8e2fc0fb.entry.js +5 -0
  57. package/dist/bromcom-ui/{p-3115008f.entry.js → p-8eec338f.entry.js} +1 -1
  58. package/dist/bromcom-ui/{p-4393b33e.entry.js → p-903d62ff.entry.js} +1 -1
  59. package/dist/bromcom-ui/{p-ce3b34da.entry.js → p-90b3e6b7.entry.js} +1 -1
  60. package/dist/bromcom-ui/{p-9589f69c.entry.js → p-91873347.entry.js} +1 -1
  61. package/dist/bromcom-ui/{p-bde67994.entry.js → p-91c0ab1c.entry.js} +1 -1
  62. package/dist/bromcom-ui/{p-3861fc92.entry.js → p-94fd1636.entry.js} +1 -1
  63. package/dist/bromcom-ui/p-a5830216.entry.js +5 -0
  64. package/dist/bromcom-ui/{p-5196912d.js → p-a8fd6d69.js} +1 -1
  65. package/dist/bromcom-ui/{p-d9fcd150.js → p-aaed6cc7.js} +1 -1
  66. package/dist/bromcom-ui/{p-c7aff122.js → p-b175108e.js} +1 -1
  67. package/dist/bromcom-ui/{p-77b1dbdd.entry.js → p-b284e383.entry.js} +1 -1
  68. package/dist/bromcom-ui/{p-e9333e52.entry.js → p-b378aff5.entry.js} +1 -1
  69. package/dist/bromcom-ui/{p-9b59c689.entry.js → p-b3fe26a3.entry.js} +1 -1
  70. package/dist/bromcom-ui/p-b4548f75.entry.js +5 -0
  71. package/dist/bromcom-ui/{p-77ef609e.entry.js → p-ba3c6657.entry.js} +1 -1
  72. package/dist/bromcom-ui/p-bba4602d.entry.js +5 -0
  73. package/dist/bromcom-ui/p-bd640601.entry.js +5 -0
  74. package/dist/bromcom-ui/{p-09318a64.js → p-be7e5e83.js} +1 -1
  75. package/dist/bromcom-ui/p-be970dce.entry.js +5 -0
  76. package/dist/bromcom-ui/p-bed627ab.js +11 -0
  77. package/dist/bromcom-ui/p-bf2dcc43.entry.js +5 -0
  78. package/dist/bromcom-ui/p-c1c4d275.entry.js +5 -0
  79. package/dist/bromcom-ui/{p-f56f2a2d.entry.js → p-c2620166.entry.js} +1 -1
  80. package/dist/bromcom-ui/p-c4b075da.entry.js +5 -0
  81. package/dist/bromcom-ui/{p-743731ac.js → p-c4d3aee2.js} +1 -1
  82. package/dist/bromcom-ui/{p-2d3ff3b8.entry.js → p-c7a3c347.entry.js} +1 -1
  83. package/dist/bromcom-ui/{p-81887469.entry.js → p-c9aa4a0d.entry.js} +1 -1
  84. package/dist/bromcom-ui/{p-c1761829.entry.js → p-cfffca09.entry.js} +1 -1
  85. package/dist/bromcom-ui/{p-1e377d82.js → p-d0dc95ae.js} +1 -1
  86. package/dist/bromcom-ui/{p-8b6d3a37.js → p-d2f863d9.js} +1 -1
  87. package/dist/bromcom-ui/{p-8a6fb2d5.entry.js → p-d9157255.entry.js} +1 -1
  88. package/dist/bromcom-ui/p-d971ec3b.entry.js +5 -0
  89. package/dist/bromcom-ui/p-de5a0e24.entry.js +5 -0
  90. package/dist/bromcom-ui/{p-a486613b.entry.js → p-df185078.entry.js} +1 -1
  91. package/dist/bromcom-ui/p-e0aa747b.entry.js +5 -0
  92. package/dist/bromcom-ui/{p-20b5c273.entry.js → p-e2e529ef.entry.js} +1 -1
  93. package/dist/bromcom-ui/{p-6657830f.js → p-e45c1546.js} +1 -1
  94. package/dist/bromcom-ui/p-e61cd999.entry.js +5 -0
  95. package/dist/bromcom-ui/{p-81cbc318.entry.js → p-e671e409.entry.js} +1 -1
  96. package/dist/bromcom-ui/{p-8ed054fe.js → p-e6755449.js} +1 -1
  97. package/dist/bromcom-ui/p-ebcb30ef.entry.js +5 -0
  98. package/dist/bromcom-ui/{p-375906b2.entry.js → p-ed1fb15d.entry.js} +1 -1
  99. package/dist/bromcom-ui/p-f06f42dc.entry.js +5 -0
  100. package/dist/bromcom-ui/{p-207c20c6.entry.js → p-f144de37.entry.js} +1 -1
  101. package/dist/bromcom-ui/{p-fc787048.entry.js → p-f1550bf5.entry.js} +1 -1
  102. package/dist/bromcom-ui/{p-887c26f8.entry.js → p-f9a7a32e.entry.js} +1 -1
  103. package/dist/bromcom-ui/{p-beaec5b8.js → p-fcc6f71e.js} +1 -1
  104. package/dist/bromcom-ui/p-fd8a6bb8.entry.js +5 -0
  105. package/dist/bromcom-ui/p-fe39eea8.js +5 -0
  106. package/dist/cjs/Overflow-7a86d378.js +2233 -0
  107. package/dist/cjs/bcm-accordion.cjs.entry.js +3 -3
  108. package/dist/cjs/bcm-alert.cjs.entry.js +3 -3
  109. package/dist/cjs/bcm-attendance-actions-comment.cjs.entry.js +7 -6
  110. package/dist/cjs/bcm-attendance-actions-dropdown.cjs.entry.js +7 -6
  111. package/dist/cjs/bcm-attendance-actions.cjs.entry.js +7 -6
  112. package/dist/cjs/bcm-attendance.cjs.entry.js +3 -3
  113. package/dist/cjs/bcm-avatar_2.cjs.entry.js +7 -6
  114. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +3 -3
  115. package/dist/cjs/bcm-button-group.cjs.entry.js +3 -3
  116. package/dist/cjs/bcm-button_11.cjs.entry.js +3340 -0
  117. package/dist/cjs/bcm-caption.cjs.entry.js +7 -6
  118. package/dist/cjs/bcm-card.cjs.entry.js +4 -4
  119. package/dist/cjs/bcm-checkbox-group.cjs.entry.js +3 -3
  120. package/dist/cjs/bcm-checkbox-lite_9.cjs.entry.js +3 -3
  121. package/dist/cjs/bcm-checkbox_2.cjs.entry.js +4 -4
  122. package/dist/cjs/bcm-chip-group.cjs.entry.js +7 -6
  123. package/dist/cjs/bcm-chip.cjs.entry.js +4 -4
  124. package/dist/cjs/bcm-collapse.cjs.entry.js +3 -3
  125. package/dist/cjs/bcm-color-input.cjs.entry.js +7 -6
  126. package/dist/cjs/bcm-date-picker.cjs.entry.js +182 -0
  127. package/dist/cjs/bcm-date.cjs.entry.js +182 -0
  128. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +1450 -0
  129. package/dist/cjs/bcm-default.cjs.entry.js +3 -3
  130. package/dist/cjs/bcm-drawer.cjs.entry.js +7 -6
  131. package/dist/cjs/bcm-dropdown.cjs.entry.js +4 -4
  132. package/dist/cjs/bcm-expansion-panel.cjs.entry.js +4 -4
  133. package/dist/cjs/bcm-form-2.cjs.entry.js +213 -0
  134. package/dist/cjs/bcm-input-custom.cjs.entry.js +3 -3
  135. package/dist/cjs/bcm-input-dropdown.cjs.entry.js +7 -6
  136. package/dist/cjs/bcm-item.cjs.entry.js +4 -4
  137. package/dist/cjs/bcm-items.cjs.entry.js +3 -3
  138. package/dist/cjs/bcm-list_3.cjs.entry.js +22 -20
  139. package/dist/cjs/bcm-menu.cjs.entry.js +8 -7
  140. package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +7 -6
  141. package/dist/cjs/bcm-modal-2-header.cjs.entry.js +7 -6
  142. package/dist/cjs/bcm-modal-2.cjs.entry.js +7 -6
  143. package/dist/cjs/bcm-modal.cjs.entry.js +3 -3
  144. package/dist/cjs/bcm-old-input.cjs.entry.js +397 -0
  145. package/dist/cjs/bcm-overlay_2.cjs.entry.js +1 -1
  146. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +4 -4
  147. package/dist/cjs/bcm-popconfirm.cjs.entry.js +3 -3
  148. package/dist/cjs/bcm-popover.cjs.entry.js +7 -6
  149. package/dist/cjs/bcm-progress.cjs.entry.js +4 -4
  150. package/dist/cjs/bcm-radio-group.cjs.entry.js +7 -6
  151. package/dist/cjs/bcm-radio.cjs.entry.js +8 -7
  152. package/dist/cjs/bcm-range.cjs.entry.js +3 -3
  153. package/dist/cjs/bcm-rc-picker.cjs.entry.js +9986 -0
  154. package/dist/cjs/bcm-shortcut.cjs.entry.js +7 -6
  155. package/dist/cjs/bcm-skeleton.cjs.entry.js +7 -6
  156. package/dist/cjs/bcm-step.cjs.entry.js +4 -4
  157. package/dist/cjs/bcm-stepper.cjs.entry.js +8 -7
  158. package/dist/cjs/bcm-switch.cjs.entry.js +3 -3
  159. package/dist/cjs/bcm-tab-group.cjs.entry.js +7 -6
  160. package/dist/cjs/bcm-tab-item-header.cjs.entry.js +7 -6
  161. package/dist/cjs/bcm-tab-item.cjs.entry.js +7 -6
  162. package/dist/cjs/bcm-table.cjs.entry.js +7 -6
  163. package/dist/cjs/bcm-tag.cjs.entry.js +4 -4
  164. package/dist/cjs/bcm-text.cjs.entry.js +2 -2
  165. package/dist/cjs/bcm-textarea.cjs.entry.js +4 -4
  166. package/dist/cjs/bcm-time-picker.cjs.entry.js +150 -0
  167. package/dist/cjs/bcm-toast.cjs.entry.js +3 -3
  168. package/dist/cjs/bromcom-ui.cjs.js +3 -3
  169. package/dist/cjs/{color-helper-c3a819ea.js → color-helper-dc98a2ca.js} +1 -1
  170. package/dist/cjs/{colors-078851ec.js → colors-250d0982.js} +13 -7
  171. package/dist/cjs/datetime-helper-eaf4fadb.js +11 -0
  172. package/dist/cjs/{generate-82c63a56.js → generate-c09a3ff3.js} +2 -2
  173. package/dist/cjs/{global-1e13ce25.js → global-6b15ed51.js} +1 -1
  174. package/dist/cjs/{Overflow-a821abd0.js → index-e05a7c6f.js} +87 -2311
  175. package/dist/cjs/{input-template-e0087a2b.js → input-template-8ca49c2e.js} +1 -1
  176. package/dist/cjs/{json-parse-decarator-e0946e2e.js → json-parse-decarator-d32b1b4a.js} +1 -1
  177. package/dist/cjs/loader.cjs.js +3 -3
  178. package/dist/cjs/moment-d06b012f.js +4601 -0
  179. package/dist/cjs/{number-helper-10017fcd.js → number-helper-243f0583.js} +1 -1
  180. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +4 -4
  181. package/dist/cjs/old-bcm-popover.cjs.entry.js +3 -3
  182. package/dist/cjs/{package-13f78ab4.js → package-6483ada2.js} +1 -1
  183. package/dist/cjs/{stepper-states-77438c3a.js → stepper-states-4e435c7d.js} +1 -1
  184. package/dist/cjs/{tooltip-helper-a2793290.js → tooltip-helper-31cc88d8.js} +5 -4
  185. package/dist/cjs/{validators-f4c3063b.js → validators-e7423b70.js} +1 -6
  186. package/dist/collection/collection-manifest.json +2 -0
  187. package/dist/collection/components/molecules/input/input.style.js +117 -0
  188. package/dist/collection/components/molecules/input/input2.js +918 -0
  189. package/dist/collection/components/molecules/number-input/number-input.js +776 -95
  190. package/dist/collection/components/molecules/number-input/react-input.js +96 -0
  191. package/dist/collection/components/molecules/radio/radio.js +1 -1
  192. package/dist/collection/components/organism/form/form.js +2 -2
  193. package/dist/collection/components/organism/form-2/bcm-form-components.js +2 -1
  194. package/dist/collection/components/organism/list/list.css +0 -1
  195. package/dist/components/bcm-form-2.js +2 -1
  196. package/dist/components/bcm-input-2.d.ts +11 -0
  197. package/dist/components/bcm-input-2.js +225 -0
  198. package/dist/components/bcm-number-input.js +295 -79
  199. package/dist/components/bcm-react-number.d.ts +11 -0
  200. package/dist/components/bcm-react-number.js +10 -0
  201. package/dist/components/colors2.js +13 -7
  202. package/dist/components/form.js +2 -2
  203. package/dist/components/generate.js +1 -1
  204. package/dist/components/index.d.ts +2 -0
  205. package/dist/components/index.js +2 -0
  206. package/dist/components/input.style.js +120 -0
  207. package/dist/components/list.js +1 -1
  208. package/dist/components/radio.js +1 -1
  209. package/dist/components/react-input.js +1242 -0
  210. package/dist/esm/Overflow-32a0ec34.js +2217 -0
  211. package/dist/esm/{_commonjsHelpers-82aa9212.js → _commonjsHelpers-be0d4ec8.js} +1 -1
  212. package/dist/esm/bcm-accordion.entry.js +4 -4
  213. package/dist/esm/bcm-alert.entry.js +6 -6
  214. package/dist/esm/bcm-attendance-actions-comment.entry.js +9 -8
  215. package/dist/esm/bcm-attendance-actions-dropdown.entry.js +10 -9
  216. package/dist/esm/bcm-attendance-actions.entry.js +10 -9
  217. package/dist/esm/bcm-attendance.entry.js +4 -4
  218. package/dist/esm/bcm-autocomplete.entry.js +2 -2
  219. package/dist/esm/bcm-avatar_2.entry.js +9 -8
  220. package/dist/esm/bcm-breadcrumb.entry.js +5 -5
  221. package/dist/esm/bcm-button-group.entry.js +6 -6
  222. package/dist/esm/bcm-button_11.entry.js +3326 -0
  223. package/dist/esm/bcm-caption.entry.js +11 -10
  224. package/dist/esm/bcm-card.entry.js +8 -8
  225. package/dist/esm/bcm-checkbox-group.entry.js +6 -6
  226. package/dist/esm/bcm-checkbox-lite_9.entry.js +5 -5
  227. package/dist/esm/bcm-checkbox_2.entry.js +9 -9
  228. package/dist/esm/bcm-chip-group.entry.js +12 -11
  229. package/dist/esm/bcm-chip.entry.js +6 -6
  230. package/dist/esm/bcm-collapse.entry.js +6 -6
  231. package/dist/esm/bcm-color-input.entry.js +9 -8
  232. package/dist/esm/bcm-colorpicker.entry.js +2 -2
  233. package/dist/esm/bcm-date-picker.entry.js +178 -0
  234. package/dist/esm/bcm-date.entry.js +178 -0
  235. package/dist/esm/bcm-datetime-picker.entry.js +1446 -0
  236. package/dist/esm/bcm-default.entry.js +4 -4
  237. package/dist/esm/bcm-drawer.entry.js +10 -9
  238. package/dist/esm/bcm-dropdown.entry.js +6 -6
  239. package/dist/esm/bcm-error-layout.entry.js +2 -2
  240. package/dist/esm/bcm-expansion-panel.entry.js +7 -7
  241. package/dist/esm/bcm-form-2.entry.js +209 -0
  242. package/dist/esm/bcm-input-custom.entry.js +5 -5
  243. package/dist/esm/bcm-input-dropdown.entry.js +11 -10
  244. package/dist/esm/bcm-item.entry.js +6 -6
  245. package/dist/esm/bcm-items.entry.js +5 -5
  246. package/dist/esm/bcm-link.entry.js +2 -2
  247. package/dist/esm/bcm-list_3.entry.js +17 -15
  248. package/dist/esm/bcm-menu.entry.js +11 -10
  249. package/dist/esm/bcm-message.entry.js +2 -2
  250. package/dist/esm/bcm-modal-2-footer.entry.js +10 -9
  251. package/dist/esm/bcm-modal-2-header.entry.js +9 -8
  252. package/dist/esm/bcm-modal-2.entry.js +10 -9
  253. package/dist/esm/bcm-modal.entry.js +7 -7
  254. package/dist/esm/bcm-notification.entry.js +2 -2
  255. package/dist/esm/bcm-old-input.entry.js +393 -0
  256. package/dist/esm/bcm-old-tag_2.entry.js +2 -2
  257. package/dist/esm/bcm-overlay_2.entry.js +3 -3
  258. package/dist/esm/bcm-popconfirm-box.entry.js +8 -8
  259. package/dist/esm/bcm-popconfirm.entry.js +5 -5
  260. package/dist/esm/bcm-popover.entry.js +9 -8
  261. package/dist/esm/bcm-progress.entry.js +6 -6
  262. package/dist/esm/bcm-radio-group.entry.js +11 -10
  263. package/dist/esm/bcm-radio.entry.js +11 -10
  264. package/dist/esm/bcm-range.entry.js +5 -5
  265. package/dist/esm/{bcm-button_15.entry.js → bcm-rc-picker.entry.js} +9 -8632
  266. package/dist/esm/bcm-result.entry.js +2 -2
  267. package/dist/esm/bcm-select-group.entry.js +2 -2
  268. package/dist/esm/bcm-select-option.entry.js +2 -2
  269. package/dist/esm/bcm-select.entry.js +3 -3
  270. package/dist/esm/bcm-shortcut.entry.js +10 -9
  271. package/dist/esm/bcm-skeleton.entry.js +9 -8
  272. package/dist/esm/bcm-step.entry.js +6 -6
  273. package/dist/esm/bcm-stepper.entry.js +11 -10
  274. package/dist/esm/bcm-switch.entry.js +6 -6
  275. package/dist/esm/bcm-tab-group.entry.js +9 -8
  276. package/dist/esm/bcm-tab-item-header.entry.js +10 -9
  277. package/dist/esm/bcm-tab-item.entry.js +9 -8
  278. package/dist/esm/bcm-tab-pane.entry.js +2 -2
  279. package/dist/esm/bcm-tab.entry.js +2 -2
  280. package/dist/esm/bcm-table.entry.js +10 -9
  281. package/dist/esm/bcm-tabs-content.entry.js +2 -2
  282. package/dist/esm/bcm-tabs.entry.js +2 -2
  283. package/dist/esm/bcm-tag.entry.js +6 -6
  284. package/dist/esm/bcm-text.entry.js +6 -6
  285. package/dist/esm/bcm-textarea.entry.js +7 -7
  286. package/dist/esm/bcm-time-picker.entry.js +146 -0
  287. package/dist/esm/bcm-timeline-item.entry.js +2 -2
  288. package/dist/esm/bcm-timeline.entry.js +2 -2
  289. package/dist/esm/bcm-toast.entry.js +6 -6
  290. package/dist/esm/bromcom-ui.js +3 -3
  291. package/dist/esm/{caption-template-fd7738eb.js → caption-template-5c43c733.js} +1 -1
  292. package/dist/esm/{color-helper-3b528349.js → color-helper-c0bb1d8a.js} +1 -1
  293. package/dist/esm/{colors-c530a5b8.js → colors-df32bb43.js} +14 -8
  294. package/dist/esm/datetime-helper-df25808a.js +9 -0
  295. package/dist/esm/{generate-b33f722f.js → generate-bcc4b036.js} +2 -2
  296. package/dist/esm/{global-d524a06a.js → global-158eb485.js} +1 -1
  297. package/dist/esm/{Overflow-2cffcda0.js → index-a6d9d0af.js} +89 -2298
  298. package/dist/esm/{index-f549811f.js → index-b84bc8c9.js} +1 -1
  299. package/dist/esm/{input-template-453bfff8.js → input-template-673e33b3.js} +2 -2
  300. package/dist/esm/{json-parse-decarator-1aa4119c.js → json-parse-decarator-c5dee289.js} +1 -1
  301. package/dist/esm/{label-template-374fbdcd.js → label-template-c15569c4.js} +1 -1
  302. package/dist/esm/loader.js +3 -3
  303. package/dist/esm/{lodash-4197be99.js → lodash-0a4396a7.js} +1 -1
  304. package/dist/esm/moment-15cd9198.js +4598 -0
  305. package/dist/esm/{number-helper-712eedd0.js → number-helper-f6f2817c.js} +1 -1
  306. package/dist/esm/old-bcm-popover-box.entry.js +8 -8
  307. package/dist/esm/old-bcm-popover.entry.js +5 -5
  308. package/dist/esm/{package-c604bd07.js → package-255a905d.js} +1 -1
  309. package/dist/esm/{popover-placement-d12fec40.js → popover-placement-2f5939ea.js} +1 -1
  310. package/dist/esm/{slot-template-2a19b2db.js → slot-template-7c36d3be.js} +1 -1
  311. package/dist/esm/{stepper-states-00eb7d7d.js → stepper-states-aef71cbc.js} +1 -1
  312. package/dist/esm/{string-helper-3592bdc2.js → string-helper-85990695.js} +1 -1
  313. package/dist/esm/{tooltip-helper-088013ec.js → tooltip-helper-b27db4cd.js} +6 -5
  314. package/dist/esm/{validators-ebf92486.js → validators-2052b679.js} +2 -6
  315. package/dist/types/components/molecules/input/input.style.d.ts +576 -0
  316. package/dist/types/components/molecules/input/input2.d.ts +64 -0
  317. package/dist/types/components/molecules/number-input/number-input.d.ts +66 -17
  318. package/dist/types/components/molecules/number-input/react-input.d.ts +16 -0
  319. package/dist/types/components.d.ts +203 -19
  320. package/package.json +3 -2
  321. package/dist/bromcom-ui/p-04068410.entry.js +0 -5
  322. package/dist/bromcom-ui/p-0d87846a.entry.js +0 -5
  323. package/dist/bromcom-ui/p-0ed34855.entry.js +0 -5
  324. package/dist/bromcom-ui/p-0f58e83a.js +0 -5
  325. package/dist/bromcom-ui/p-19283acb.entry.js +0 -5
  326. package/dist/bromcom-ui/p-2b4970f5.entry.js +0 -5
  327. package/dist/bromcom-ui/p-2e7107b8.entry.js +0 -5
  328. package/dist/bromcom-ui/p-346395fa.entry.js +0 -5
  329. package/dist/bromcom-ui/p-376a20ed.js +0 -5
  330. package/dist/bromcom-ui/p-3a43bf45.js +0 -5
  331. package/dist/bromcom-ui/p-41e75c88.entry.js +0 -5
  332. package/dist/bromcom-ui/p-4e44bab2.entry.js +0 -5
  333. package/dist/bromcom-ui/p-51b2e857.entry.js +0 -5
  334. package/dist/bromcom-ui/p-52a75efb.entry.js +0 -5
  335. package/dist/bromcom-ui/p-5fbb4950.entry.js +0 -5
  336. package/dist/bromcom-ui/p-630a4d45.entry.js +0 -5
  337. package/dist/bromcom-ui/p-65ac7386.entry.js +0 -5
  338. package/dist/bromcom-ui/p-7c512c4d.entry.js +0 -5
  339. package/dist/bromcom-ui/p-82d01088.entry.js +0 -5
  340. package/dist/bromcom-ui/p-82f0b161.js +0 -5
  341. package/dist/bromcom-ui/p-84b97f53.entry.js +0 -5
  342. package/dist/bromcom-ui/p-857628f6.js +0 -5
  343. package/dist/bromcom-ui/p-926f8ac4.entry.js +0 -5
  344. package/dist/bromcom-ui/p-950a341e.entry.js +0 -7
  345. package/dist/bromcom-ui/p-9810187e.entry.js +0 -5
  346. package/dist/bromcom-ui/p-9b5c86e1.entry.js +0 -5
  347. package/dist/bromcom-ui/p-a5208f05.entry.js +0 -5
  348. package/dist/bromcom-ui/p-aea1b034.entry.js +0 -5
  349. package/dist/bromcom-ui/p-b381e7f1.js +0 -19
  350. package/dist/bromcom-ui/p-b4da198b.entry.js +0 -5
  351. package/dist/bromcom-ui/p-cf011393.entry.js +0 -5
  352. package/dist/bromcom-ui/p-d098f115.entry.js +0 -5
  353. package/dist/bromcom-ui/p-e0ab7b38.js +0 -11
  354. package/dist/bromcom-ui/p-e3c69b3b.entry.js +0 -5
  355. package/dist/bromcom-ui/p-fe776e62.entry.js +0 -5
  356. package/dist/cjs/bcm-button_15.cjs.entry.js +0 -18623
  357. package/dist/cjs/bcm-number-input.cjs.entry.js +0 -108
  358. package/dist/collection/components/molecules/number-input/number-input.css +0 -137
  359. package/dist/collection/components/molecules/number-input/number-input.style.js +0 -45
  360. package/dist/esm/bcm-number-input.entry.js +0 -104
  361. package/dist/types/components/molecules/number-input/number-input.style.d.ts +0 -200
@@ -0,0 +1,3326 @@
1
+ /*!
2
+ * Built with Stencil
3
+ * Copyright (c) Bromcom.
4
+ */
5
+ import { h as h$1, r as registerInstance, c as createEvent, H as Host, g as getElement, a as getAssetPath } from './index-0615c2b8.js';
6
+ import { s as snq, G as Generate } from './generate-bcc4b036.js';
7
+ import { B as Bcm, a as Bcm$1 } from './bcm-a50d55ba.js';
8
+ import { c as classnames } from './index-b84bc8c9.js';
9
+ import { c as createStore } from './index-7e71bbc8.js';
10
+ import { S as SlotTemplate } from './slot-template-7c36d3be.js';
11
+ import { C as ColorHelper } from './color-helper-c0bb1d8a.js';
12
+ import { r as react, a as reactDom } from './index-a6d9d0af.js';
13
+ import { l as lodash } from './lodash-0a4396a7.js';
14
+ import { I as IsLoad } from './is-load-decorator-8277e3b8.js';
15
+ import { S as StringHelper } from './string-helper-85990695.js';
16
+ import { d as delay, g as getChildElements } from './utils-57652744.js';
17
+ import { N as NumberHelper } from './number-helper-f6f2817c.js';
18
+ import { V as Validators } from './validators-2052b679.js';
19
+ import { C as CaptionTemplate } from './caption-template-5c43c733.js';
20
+ import { I as InputTemplate } from './input-template-673e33b3.js';
21
+ import { c as ce } from './index-3bc8c6e3.js';
22
+ import { L as LabelTemplate } from './label-template-c15569c4.js';
23
+ import './datetime-helper-df25808a.js';
24
+ import './element-dragger-89bb52fd.js';
25
+ import { F as FloatingUI } from './floating-ui-3f4394da.js';
26
+ import './types-6f06fa1a.js';
27
+ import './types-9493a7ed.js';
28
+ import { T as Tooltip } from './tooltip-helper-b27db4cd.js';
29
+ import './package-255a905d.js';
30
+ import './colors-df32bb43.js';
31
+ import './_commonjsHelpers-be0d4ec8.js';
32
+ import './colors-1d7854ea.js';
33
+
34
+ const variantOptions = {
35
+ save: {
36
+ text: 'Save',
37
+ color: 'emerald',
38
+ icon: 'far fa-save',
39
+ iconPosition: 'prefix',
40
+ },
41
+ ok: {
42
+ text: 'Ok',
43
+ color: 'emerald',
44
+ icon: 'far fa-check',
45
+ iconPosition: 'prefix',
46
+ },
47
+ new: {
48
+ text: 'New',
49
+ color: 'emerald',
50
+ icon: 'far fa-plus',
51
+ iconPosition: 'prefix',
52
+ },
53
+ add: {
54
+ text: 'Add',
55
+ color: 'emerald',
56
+ icon: 'far fa-plus',
57
+ iconPosition: 'prefix',
58
+ },
59
+ create: {
60
+ text: 'Create',
61
+ color: 'emerald',
62
+ icon: 'far fa-plus',
63
+ iconPosition: 'prefix',
64
+ },
65
+ prev: {
66
+ text: 'Prev',
67
+ color: '',
68
+ icon: 'far fa-arrow-left',
69
+ iconPosition: 'prefix',
70
+ },
71
+ next: {
72
+ text: 'Next',
73
+ color: '',
74
+ icon: 'far fa-arrow-right',
75
+ iconPosition: 'suffix',
76
+ },
77
+ apply: {
78
+ text: 'Apply',
79
+ color: '',
80
+ icon: 'far fa-check-circle',
81
+ iconPosition: 'prefix',
82
+ },
83
+ submit: {
84
+ text: 'Submit',
85
+ color: '',
86
+ icon: 'far fa-save',
87
+ iconPosition: 'prefix',
88
+ },
89
+ send: {
90
+ text: 'Send',
91
+ color: 'emerald',
92
+ icon: 'far fa-paper-plane',
93
+ iconPosition: 'prefix',
94
+ },
95
+ delete: {
96
+ text: 'Delete',
97
+ color: 'red',
98
+ icon: 'far fa-trash',
99
+ iconPosition: 'prefix',
100
+ },
101
+ cancel: {
102
+ text: 'Cancel',
103
+ color: 'red',
104
+ icon: 'far fa-times',
105
+ iconPosition: 'prefix',
106
+ },
107
+ decline: {
108
+ text: 'Decline',
109
+ color: 'red',
110
+ icon: 'far fa-ban',
111
+ iconPosition: 'prefix',
112
+ },
113
+ close: {
114
+ text: 'Close',
115
+ color: 'red',
116
+ icon: 'far fa-times-circle',
117
+ iconPosition: 'prefix',
118
+ },
119
+ archive: {
120
+ text: 'Archive',
121
+ color: 'red',
122
+ icon: 'far fa-folder-open',
123
+ iconPosition: 'prefix',
124
+ },
125
+ remove: {
126
+ text: 'Remove',
127
+ color: 'red',
128
+ icon: 'far fa-minus-circle',
129
+ iconPosition: 'prefix',
130
+ },
131
+ edit: {
132
+ text: 'Edit',
133
+ color: '',
134
+ icon: 'far fa-edit',
135
+ iconPosition: 'prefix',
136
+ },
137
+ export: {
138
+ text: 'Export',
139
+ color: '',
140
+ icon: 'far fa-sign-out',
141
+ iconPosition: 'prefix',
142
+ },
143
+ import: {
144
+ text: 'Import',
145
+ color: '',
146
+ icon: 'far fa-sign-in',
147
+ iconPosition: 'prefix',
148
+ },
149
+ filter: {
150
+ text: 'Filter',
151
+ color: '',
152
+ icon: 'far fa-filter',
153
+ iconPosition: 'prefix',
154
+ },
155
+ update: {
156
+ text: 'Update',
157
+ color: '',
158
+ icon: 'far fa-sync',
159
+ iconPosition: 'prefix',
160
+ },
161
+ reset: {
162
+ text: "Reset",
163
+ color: "",
164
+ icon: 'far fa-sync',
165
+ iconPosition: "prefix",
166
+ },
167
+ download: {
168
+ text: 'Download',
169
+ color: '',
170
+ icon: 'far fa-download',
171
+ iconPosition: 'prefix',
172
+ },
173
+ };
174
+ var VariantProps;
175
+ (function (VariantProps) {
176
+ VariantProps["save"] = "save";
177
+ VariantProps["submit"] = "submit";
178
+ VariantProps["ok"] = "ok";
179
+ VariantProps["new"] = "new";
180
+ VariantProps["add"] = "add";
181
+ VariantProps["create"] = "create";
182
+ VariantProps["apply"] = "apply";
183
+ VariantProps["prev"] = "prev";
184
+ VariantProps["next"] = "next";
185
+ VariantProps["send"] = "send";
186
+ VariantProps["delete"] = "delete";
187
+ VariantProps["cancel"] = "cancel";
188
+ VariantProps["decline"] = "decline";
189
+ VariantProps["close"] = "close";
190
+ VariantProps["archive"] = "archive";
191
+ VariantProps["remove"] = "remove";
192
+ VariantProps["edit"] = "edit";
193
+ VariantProps["export"] = "export";
194
+ VariantProps["import"] = "import";
195
+ VariantProps["filter"] = "filter";
196
+ VariantProps["update"] = "update";
197
+ VariantProps["reset"] = "Reset";
198
+ VariantProps["download"] = "download";
199
+ })(VariantProps || (VariantProps = {}));
200
+
201
+ const { state } = createStore({
202
+ value: new Map(),
203
+ setData: {},
204
+ removeData: {}
205
+ });
206
+ const setValue = (val) => {
207
+ const data = Object.assign(Object.assign({}, val), (variantOptions[val.variant] && {
208
+ icon: variantOptions[val.variant].icon,
209
+ value: variantOptions[val.variant].text,
210
+ iconPosition: Bcm.IconPosition[variantOptions[val.variant].iconPosition],
211
+ variantColor: variantOptions[val.variant].color
212
+ }));
213
+ state.value.set(data.id, data);
214
+ };
215
+ const removeValue = (_id) => {
216
+ state.value.delete(_id);
217
+ };
218
+ const getValue = (id) => snq(() => state.value.get(id), {});
219
+ const buttonState = {
220
+ setValue,
221
+ removeValue,
222
+ getValue
223
+ };
224
+
225
+ const ButtonTemplate = ({ value, type, componentClass, disabled, href, target, loading, isIconOnly, icon, iconPosition, id }) => {
226
+ const ButtonTagType = (href) ? Bcm.HtmlElementType.a : Bcm.HtmlElementType.button;
227
+ return (h$1(ButtonTagType, Object.assign({ id: id }, (type == Bcm.HtmlElementType.button && { type }), { class: componentClass, disabled: disabled, href: href, target: target, tabindex: "0" }),
228
+ h$1("span", { hidden: true },
229
+ h$1("slot", null)),
230
+ loading && h$1("span", { class: "bcm-button__container-loading" },
231
+ " ",
232
+ h$1("span", { class: "bcm-button__container-icon" },
233
+ h$1("i", { class: "far fa-spinner-third fa-spin" }),
234
+ " ")),
235
+ icon && h$1("span", { class: `${iconPosition} bcm-button__container-icon` },
236
+ h$1("i", { class: `${icon}` })),
237
+ !isIconOnly && (h$1(SlotTemplate, { className: "bcm-button__container-text", value: value })),
238
+ h$1("slot", { name: "suffix" })));
239
+ };
240
+
241
+ const buttonCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}*{box-sizing:border-box}.bcm-button{display:inline-flex;width:fit-content;height:fit-content;--bcm-button-solid-color-default:var(--bcm-new-ds-color-white);--bcm-button-solid-background-color-default:var(--bcm-new-ds-color-blue-500);--bcm-button-solid-border-default:var(--bcm-new-ds-color-blue-500);--bcm-button-solid-color-hover:var(--bcm-new-ds-color-white);--bcm-button-solid-background-color-hover:var(--bcm-new-ds-color-blue-600);--bcm-button-solid-border-hover:var(--bcm-new-ds-color-blue-600);--bcm-button-solid-color-focus-visible:var(--bcm-new-ds-color-white);--bcm-button-solid-background-color-focus-visible:var(--bcm-new-ds-color-blue-800);--bcm-button-solid-border-focus-visible:var(--bcm-new-ds-color-blue-800);--bcm-button-solid-color-active:var(--bcm-new-ds-color-white);--bcm-button-solid-background-color-active:var(--bcm-new-ds-color-blue-700);--bcm-button-solid-border-active:var(--bcm-new-ds-color-blue-700);--bcm-button-solid-color-disabled:var(--bcm-new-ds-color-white);--bcm-button-solid-background-color-disabled:var(--bcm-new-ds-color-slate-400);--bcm-button-solid-border-disabled:var(--bcm-new-ds-color-slate-400);--bcm-button-ghost-color-default:var(--bcm-new-ds-color-slate-600);--bcm-button-ghost-background-color-default:var(--bcm-new-ds-color-slate-100);--bcm-button-ghost-border-default:var(--bcm-new-ds-color-slate-300);--bcm-button-ghost-color-hover:var(--bcm-new-ds-color-slate-600);--bcm-button-ghost-background-color-hover:var(--bcm-new-ds-color-slate-200);--bcm-button-ghost-border-hover:var(--bcm-new-ds-color-slate-400);--bcm-button-ghost-color-focus-visible:var(--bcm-new-ds-color-slate-600);--bcm-button-ghost-background-color-focus-visible:var(--bcm-new-ds-color-slate-400);--bcm-button-ghost-border-focus-visible:var(--bcm-new-ds-color-slate-600);--bcm-button-ghost-color-active:var(--bcm-new-ds-color-slate-600);--bcm-button-ghost-background-color-active:var(--bcm-new-ds-color-slate-300);--bcm-button-ghost-border-active:var(--bcm-new-ds-color-slate-500);--bcm-button-ghost-color-disabled:var(--bcm-new-ds-color-slate-300);--bcm-button-ghost-background-color-disabled:var(--bcm-new-ds-color-slate-50);--bcm-button-ghost-border-disabled:var(--bcm-new-ds-color-slate-200);--bcm-button-link-color-default:var(--bcm-new-ds-color-blue-500);--bcm-button-link-background-color-default:var(--bcm-new-ds-color-transparent);--bcm-button-link-border-default:var(--bcm-new-ds-color-transparent);--bcm-button-link-color-hover:var(--bcm-new-ds-color-blue-600);--bcm-button-link-background-color-hover:var(--bcm-new-ds-color-transparent);--bcm-button-link-border-hover:var(--bcm-new-ds-color-transparent);--bcm-button-link-color-focus-visible:var(--bcm-new-ds-color-blue-800);--bcm-button-link-background-color-focus-visible:var(--bcm-new-ds-color-slate-50);--bcm-button-link-border-focus-visible:var(--bcm-new-ds-color-slate-50);--bcm-button-link-color-active:var(--bcm-new-ds-color-blue-700);--bcm-button-link-background-color-active:var(--bcm-new-ds-color-slate-50);--bcm-button-link-border-active:var(--bcm-new-ds-color-slate-50);--bcm-button-link-color-disabled:var(--bcm-new-ds-color-slate-400);--bcm-button-link-background-color-disabled:var(--bcm-new-ds-color-transparent);--bcm-button-link-border-disabled:var(--bcm-new-ds-color-transparent);--bcm-button-ghost-link-color-default:var(--bcm-new-ds-color-slate-700);--bcm-button-ghost-link-background-color-default:var(--bcm-new-ds-color-transparent);--bcm-button-ghost-link-border-default:var(--bcm-new-ds-color-transparent);--bcm-button-ghost-link-color-hover:var(--bcm-new-ds-color-slate-700);--bcm-button-ghost-link-background-color-hover:var(--bcm-new-ds-color-slate-200);--bcm-button-ghost-link-border-hover:var(--bcm-new-ds-color-transparent);--bcm-button-ghost-link-color-focus-visible:var(--bcm-new-ds-color-slate-700);--bcm-button-ghost-link-background-color-focus-visible:var(--bcm-new-ds-color-slate-300);--bcm-button-ghost-link-border-focus-visible:var(--bcm-new-ds-color-transparent);--bcm-button-ghost-link-color-active:var(--bcm-new-ds-color-slate-700);--bcm-button-ghost-link-background-color-active:var(--bcm-new-ds-color-slate-300);--bcm-button-ghost-link-border-active:var(--bcm-new-ds-color-transparent);--bcm-button-ghost-link-color-disabled:var(--bcm-new-ds-color-slate-500);--bcm-button-ghost-link-background-color-disabled:var(--bcm-new-ds-color-transparent);--bcm-button-ghost-link-border-disabled:var(--bcm-new-ds-color-transparent)}.bcm-button.full-width{width:100%}.bcm-button.full-width .bcm-button__container{width:100%}.bcm-button:after,.bcm-button:before{content:\"\";clear:both}.bcm-button__container{border:none;color:inherit;background-color:inherit;padding:0;margin:0;font:inherit;cursor:pointer;outline:none;text-decoration:none;font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;font-weight:500;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:4px 12px;outline:none;border-radius:4px;transition:background-color 0.1s ease-in-out;position:relative;min-width:40px;border-width:1px;border-style:solid;border-color:initial}.bcm-button__container:hover,.bcm-button__container:focus,.bcm-button__container:active{outline:none;text-decoration:none}.bcm-button__container-loading{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:4px;display:flex;align-items:center;justify-content:center}.bcm-button__container-kind-solid{color:var(--bcm-button-solid-color-default);background-color:var(--bcm-button-solid-background-color-default);border-color:var(--bcm-button-solid-border-default)}.bcm-button__container-kind-solid:hover{color:var(--bcm-button-solid-color-hover);background-color:var(--bcm-button-solid-background-color-hover);border-color:var(--bcm-button-solid-border-hover)}.bcm-button__container-kind-solid:focus-visible{color:var(--bcm-button-solid-color-focus-visible);background-color:var(--bcm-button-solid-background-color-focus-visible);border-color:var(--bcm-button-solid-border-focus-visible)}.bcm-button__container-kind-solid:active{color:var(--bcm-button-solid-color-active);background-color:var(--bcm-button-solid-background-color-active);border-color:var(--bcm-button-solid-border-active)}.bcm-button__container-kind-solid:disabled{color:var(--bcm-button-solid-color-disabled);background-color:var(--bcm-button-solid-background-color-disabled);border-color:var(--bcm-button-solid-border-disabled)}.bcm-button__container-kind-solid.checked{color:var(--bcm-button-solid-color-active);background-color:var(--bcm-button-solid-background-color-active);border-color:var(--bcm-button-solid-border-active)}.bcm-button__container-kind-solid.disabled{color:var(--bcm-button-solid-color-disabled);background-color:var(--bcm-button-solid-background-color-disabled);border-color:var(--bcm-button-solid-border-disabled)}.bcm-button__container-kind-solid .bcm-button__container-loading{color:var(--bcm-button-solid-color-default);background-color:var(--bcm-button-solid-background-color-default);border-color:var(--bcm-button-solid-border-default)}.bcm-button__container-kind-ghost{color:var(--bcm-button-ghost-color-default);background-color:var(--bcm-button-ghost-background-color-default);border-color:var(--bcm-button-ghost-border-default)}.bcm-button__container-kind-ghost:not([disabled]) .bcm-icon{color:var(--bcm-new-ds-color-slate-500)}.bcm-button__container-kind-ghost:hover{color:var(--bcm-button-ghost-color-hover);background-color:var(--bcm-button-ghost-background-color-hover);border-color:var(--bcm-button-ghost-border-hover)}.bcm-button__container-kind-ghost:focus-visible{color:var(--bcm-button-ghost-color-focus-visible);background-color:var(--bcm-button-ghost-background-color-focus-visible);border-color:var(--bcm-button-ghost-border-focus-visible)}.bcm-button__container-kind-ghost:active{color:var(--bcm-button-ghost-color-active);background-color:var(--bcm-button-ghost-background-color-active);border-color:var(--bcm-button-ghost-border-active)}.bcm-button__container-kind-ghost:disabled{color:var(--bcm-button-ghost-color-disabled);background-color:var(--bcm-button-ghost-background-color-disabled);border-color:var(--bcm-button-ghost-border-disabled)}.bcm-button__container-kind-ghost.checked{color:var(--bcm-button-ghost-color-active);background-color:var(--bcm-button-ghost-background-color-active);border-color:var(--bcm-button-ghost-border-active)}.bcm-button__container-kind-ghost.disabled{color:var(--bcm-button-ghost-color-disabled);background-color:var(--bcm-button-ghost-background-color-disabled);border-color:var(--bcm-button-ghost-border-disabled)}.bcm-button__container-kind-ghost .bcm-button__container-loading{color:var(--bcm-button-ghost-color-default);background-color:var(--bcm-button-ghost-background-color-default);border-color:var(--bcm-button-ghost-border-default)}.bcm-button__container-kind-link{color:var(--bcm-button-link-color-default);background-color:var(--bcm-button-link-background-color-default);border-color:var(--bcm-button-link-border-default)}.bcm-button__container-kind-link:hover{color:var(--bcm-button-link-color-hover);background-color:var(--bcm-button-link-background-color-hover);border-color:var(--bcm-button-link-border-hover)}.bcm-button__container-kind-link:focus-visible{color:var(--bcm-button-link-color-focus-visible);background-color:var(--bcm-button-link-background-color-focus-visible);border-color:var(--bcm-button-link-border-focus-visible)}.bcm-button__container-kind-link:active{color:var(--bcm-button-link-color-active);background-color:var(--bcm-button-link-background-color-active);border-color:var(--bcm-button-link-border-active)}.bcm-button__container-kind-link:disabled{color:var(--bcm-button-link-color-disabled);background-color:var(--bcm-button-link-background-color-disabled);border-color:var(--bcm-button-link-border-disabled)}.bcm-button__container-kind-link.checked{color:var(--bcm-button-link-color-active);background-color:var(--bcm-button-link-background-color-active);border-color:var(--bcm-button-link-border-active)}.bcm-button__container-kind-link.disabled{color:var(--bcm-button-link-color-disabled);background-color:var(--bcm-button-link-background-color-disabled);border-color:var(--bcm-button-link-border-disabled)}.bcm-button__container-kind-link .bcm-button__container-loading{color:var(--bcm-button-link-color-default);background-color:var(--bcm-button-link-background-color-default);border-color:var(--bcm-button-link-border-default)}.bcm-button__container-kind-ghost-link{color:var(--bcm-button-ghost-link-color-default);background-color:var(--bcm-button-ghost-link-background-color-default);border-color:var(--bcm-button-ghost-link-border-default)}.bcm-button__container-kind-ghost-link:hover{color:var(--bcm-button-ghost-link-color-hover);background-color:var(--bcm-button-ghost-link-background-color-hover);border-color:var(--bcm-button-ghost-link-border-hover)}.bcm-button__container-kind-ghost-link:focus-visible{color:var(--bcm-button-ghost-link-color-focus-visible);background-color:var(--bcm-button-ghost-link-background-color-focus-visible);border-color:var(--bcm-button-ghost-link-border-focus-visible)}.bcm-button__container-kind-ghost-link:active{color:var(--bcm-button-ghost-link-color-active);background-color:var(--bcm-button-ghost-link-background-color-active);border-color:var(--bcm-button-ghost-link-border-active)}.bcm-button__container-kind-ghost-link:disabled{color:var(--bcm-button-ghost-link-color-disabled);background-color:var(--bcm-button-ghost-link-background-color-disabled);border-color:var(--bcm-button-ghost-link-border-disabled)}.bcm-button__container-kind-ghost-link.checked{color:var(--bcm-button-ghost-link-color-active);background-color:var(--bcm-button-ghost-link-background-color-active);border-color:var(--bcm-button-ghost-link-border-active)}.bcm-button__container-kind-ghost-link.disabled{color:var(--bcm-button-ghost-link-color-disabled);background-color:var(--bcm-button-ghost-link-background-color-disabled);border-color:var(--bcm-button-ghost-link-border-disabled)}.bcm-button__container-kind-ghost-link .bcm-button__container-loading{color:var(--bcm-button-ghost-link-color-default);background-color:var(--bcm-button-ghost-link-background-color-default);border-color:var(--bcm-button-ghost-link-border-default)}.bcm-button__container[disabled]{cursor:not-allowed}.bcm-button__container-text{order:3;display:flex;align-items:center;gap:8px;white-space:nowrap}.bcm-button__container-icon{min-height:calc(12px + 8px)}.bcm-button__container-icon.prefix{order:2}.bcm-button__container-icon.suffix{order:4}.bcm-button__container-size-small{font-size:12px;line-height:calc(12px + 8px);padding:calc(4px - 3px) 12px;min-height:calc(calc(12px + 8px) + calc(calc(4px - 2px)) * 2)}.bcm-button__container-size-small .bcm-button__container-icon{min-height:calc(12px + 8px)}.bcm-button__container-size-medium{font-size:calc(12px + 1px);line-height:calc(12px + 8px);padding:calc(4px + 1px) 12px;min-height:calc(calc(12px + 8px) + calc(calc(4px + 2px)) * 2)}.bcm-button__container-size-medium .bcm-button__container-icon{min-height:calc(12px + 8px)}.bcm-button__container-size-large{font-size:16px;line-height:calc(16px + 8px);padding:calc(8px - 1px) 12px;min-height:calc(calc(16px + 8px) + (calc(8px) * 2))}.bcm-button__container-size-large .bcm-button__container-icon{min-height:calc(16px + 8px)}";
242
+
243
+ const BcmButton = class {
244
+ constructor(hostRef) {
245
+ registerInstance(this, hostRef);
246
+ this.bcmClick = createEvent(this, "bcm-click", 7);
247
+ this._id = Generate.UID();
248
+ this.hidden = false;
249
+ this.type = Bcm.ButtonType.button;
250
+ this.size = Bcm.Size.medium;
251
+ this.disabled = false;
252
+ this.kind = Bcm.Kind.solid;
253
+ this.outline = false;
254
+ this.icon = undefined;
255
+ this.href = undefined;
256
+ this.target = undefined;
257
+ this.value = undefined;
258
+ this.loading = false;
259
+ this.variant = undefined;
260
+ this.dataDismiss = false;
261
+ this.fullWidth = false;
262
+ this.iconPosition = Bcm.IconPosition.prefix;
263
+ this.color = undefined;
264
+ this.checked = false;
265
+ }
266
+ handleOnClick(e) {
267
+ if (this.disabled) {
268
+ e.preventDefault();
269
+ e.stopPropagation();
270
+ return false;
271
+ }
272
+ }
273
+ componentWillRender() {
274
+ const { size, kind, icon, iconPosition, disabled, outline, href, type, target, loading, variant, fullWidth, hidden, value } = this;
275
+ buttonState.setValue({
276
+ id: this._id,
277
+ size,
278
+ type,
279
+ kind,
280
+ icon,
281
+ iconPosition,
282
+ disabled,
283
+ outline,
284
+ href,
285
+ target,
286
+ loading,
287
+ variant,
288
+ fullWidth,
289
+ hidden,
290
+ value,
291
+ isIconOnly: !!(this.isHaveChildNodes() && this.icon),
292
+ });
293
+ }
294
+ getStateData() {
295
+ return buttonState.getValue(this._id);
296
+ }
297
+ isHaveChildNodes() {
298
+ const childNodes = Array.from(this.el.childNodes);
299
+ return childNodes.find(node => node.nodeType === Node.TEXT_NODE) === undefined;
300
+ }
301
+ setColor(color = this.color) {
302
+ if (!color)
303
+ return;
304
+ const { kind } = this;
305
+ const prefix = `--bcm-button-${kind}`;
306
+ if (kind === 'solid') {
307
+ return {
308
+ [`${prefix}-color-default`]: ColorHelper.dsColor('white'),
309
+ [`${prefix}-color-hover`]: ColorHelper.dsColor('white'),
310
+ [`${prefix}-color-focus-visible`]: ColorHelper.dsColor('white'),
311
+ [`${prefix}-color-active`]: ColorHelper.dsColor('white'),
312
+ [`${prefix}-color-disabled`]: ColorHelper.dsColor('white'),
313
+ [`${prefix}-background-color-default`]: ColorHelper.dsColor(color + '-500'),
314
+ [`${prefix}-background-color-hover`]: ColorHelper.dsColor(color + '-600'),
315
+ [`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(color + '-700'),
316
+ [`${prefix}-background-color-active`]: ColorHelper.dsColor(color + '-800'),
317
+ [`${prefix}-background-color-disabled`]: ColorHelper.dsColor('slate-400'),
318
+ [`${prefix}-border-default`]: ColorHelper.dsColor(color + '-500'),
319
+ [`${prefix}-border-hover`]: ColorHelper.dsColor(color + '-600'),
320
+ [`${prefix}-border-focus-visible`]: ColorHelper.dsColor(color + '-700'),
321
+ [`${prefix}-border-active`]: ColorHelper.dsColor(color + '-800'),
322
+ [`${prefix}-border-disabled`]: ColorHelper.dsColor('slate-400')
323
+ };
324
+ }
325
+ else if (kind == 'link') {
326
+ return {
327
+ [`${prefix}-color-default`]: ColorHelper.dsColor(color + '-500'),
328
+ [`${prefix}-color-hover`]: ColorHelper.dsColor(color + '-600'),
329
+ [`${prefix}-color-focus-visible`]: ColorHelper.dsColor(color + '-800'),
330
+ [`${prefix}-color-active`]: ColorHelper.dsColor(color + '-700'),
331
+ [`${prefix}-color-disabled`]: ColorHelper.dsColor('slate-400'),
332
+ [`${prefix}-background-color-default`]: ColorHelper.dsColor('transparent'),
333
+ [`${prefix}-background-color-hover`]: ColorHelper.dsColor('transparent'),
334
+ [`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor('slate-50'),
335
+ [`${prefix}-background-color-active`]: ColorHelper.dsColor('slate-50'),
336
+ [`${prefix}-background-color-disabled`]: ColorHelper.dsColor('transparent'),
337
+ [`${prefix}-border-default`]: ColorHelper.dsColor('transparent'),
338
+ [`${prefix}-border-hover`]: ColorHelper.dsColor('transparent'),
339
+ [`${prefix}-border-focus-visible`]: ColorHelper.dsColor('slate-50'),
340
+ [`${prefix}-border-active`]: ColorHelper.dsColor('slate-50'),
341
+ [`${prefix}-border-disabled`]: ColorHelper.dsColor('transparent')
342
+ };
343
+ }
344
+ else if (kind == 'ghost') {
345
+ return {
346
+ [`${prefix}-color-default`]: ColorHelper.dsColor(color + '-600'),
347
+ [`${prefix}-color-hover`]: ColorHelper.dsColor(color + '-600'),
348
+ [`${prefix}-color-focus-visible`]: ColorHelper.dsColor(color + '-600'),
349
+ [`${prefix}-color-active`]: ColorHelper.dsColor(color + '-600'),
350
+ [`${prefix}-color-disabled`]: ColorHelper.dsColor(color + '-300'),
351
+ [`${prefix}-background-color-default`]: ColorHelper.dsColor(color + '-100'),
352
+ [`${prefix}-background-color-hover`]: ColorHelper.dsColor(color + '-200'),
353
+ [`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(color + '-400'),
354
+ [`${prefix}-background-color-active`]: ColorHelper.dsColor(color + '-300'),
355
+ [`${prefix}-background-color-disabled`]: ColorHelper.dsColor(color + '-50'),
356
+ [`${prefix}-border-default`]: ColorHelper.dsColor(color + '-300'),
357
+ [`${prefix}-border-hover`]: ColorHelper.dsColor(color + '-400'),
358
+ [`${prefix}-border-focus-visible`]: ColorHelper.dsColor(color + '-600'),
359
+ [`${prefix}-border-active`]: ColorHelper.dsColor(color + '-500'),
360
+ [`${prefix}-border-disabled`]: ColorHelper.dsColor(color + '-200'),
361
+ };
362
+ }
363
+ return;
364
+ }
365
+ render() {
366
+ const { size, kind, disabled, outline, type, href, target, loading, variantColor, fullWidth, hidden, icon, iconPosition, value, isIconOnly, iconSize } = this.getStateData();
367
+ const classPrefix = 'bcm-button';
368
+ let componentClass = classnames('bcm-button__container', `bcm-button__container-size-${size}`, `bcm-button__container-kind-${outline ? 'ghost' : kind}`, {
369
+ 'full-width': fullWidth,
370
+ 'checked': this.checked,
371
+ 'disabled': disabled,
372
+ });
373
+ const hostClasses = classnames(`${classPrefix}`, {
374
+ hidden,
375
+ 'full-width': fullWidth,
376
+ });
377
+ return (h$1(Host, { class: hostClasses, style: this.setColor(variantColor), onClick: () => !disabled && this.bcmClick.emit(this.el) }, h$1(ButtonTemplate, { type: type, value: value, componentClass: componentClass, disabled: disabled, href: href, target: target, icon: icon, loading: loading, iconSize: iconSize, isIconOnly: isIconOnly, iconPosition: iconPosition })));
378
+ }
379
+ get el() { return getElement(this); }
380
+ };
381
+ BcmButton.style = buttonCss;
382
+
383
+ function u(){return (u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);}return e}).apply(this,arguments)}function c(e,r){if(null==e)return {};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}function i(e){var t=react.useRef(e),n=react.useRef(function(e){t.current&&t.current(e);});return t.current=e,n.current}var s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},f=function(e){return "touches"in e},v=function(e){return e&&e.ownerDocument.defaultView||self},d=function(e,r,t){var n=e.getBoundingClientRect(),o=f(r)?function(e,r){for(var t=0;t<e.length;t++)if(e[t].identifier===r)return e[t];return e[0]}(r.touches,t):r;return {left:s((o.pageX-(n.left+v(e).pageXOffset))/n.width),top:s((o.pageY-(n.top+v(e).pageYOffset))/n.height)}},h=function(e){!f(e)&&e.preventDefault();},m=react.memo(function(o){var a=o.onMove,l=o.onKey,s=c(o,["onMove","onKey"]),m=react.useRef(null),g=i(a),p=i(l),b=react.useRef(null),_=react.useRef(!1),x=react.useMemo(function(){var e=function(e){h(e),(f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(d(m.current,e,b.current)):t(!1);},r=function(){return t(!1)};function t(t){var n=_.current,o=v(m.current),a=t?o.addEventListener:o.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",r);}return [function(e){var r=e.nativeEvent,n=m.current;if(n&&(h(r),!function(e,r){return r&&!f(e)}(r,_.current)&&n)){if(f(r)){_.current=!0;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier);}n.focus(),g(d(n,r,b.current)),t(!0);}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),p({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}));},t]},[p,g]),C=x[0],E=x[1],H=x[2];return react.useEffect(function(){return H},[H]),react.createElement("div",u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),g=function(e){return e.filter(Boolean).join(" ")},p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=g(["react-colorful__pointer",r.className]);return react.createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},react.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},b=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=Math.pow(10,r)),Math.round(t*e)/t},x=function(e){return L(C(e))},C=function(e){return "#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?b(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?b(parseInt(e.substring(6,8),16)/255,2):1}},w=function(e){return K(I(e))},y=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return {h:b(e.h),s:b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:b(o/2),a:b(n,2)}},q=function(e){var r=y(e);return "hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},I=function(e){var r=e.h,t=e.s,n=e.v,o=e.a;r=r/360*6,t/=100,n/=100;var a=Math.floor(r),l=n*(1-t),u=n*(1-(r-a)*t),c=n*(1-(1-r+a)*t),i=a%6;return {r:b(255*[n,u,l,l,c,n][i]),g:b(255*[c,n,n,u,l,l][i]),b:b(255*[l,l,c,n,n,u][i]),a:b(o,2)}},D=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},K=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=o<1?D(b(255*o)):"";return "#"+D(r)+D(t)+D(n)+a},L=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=Math.max(r,t,n),l=a-Math.min(r,t,n),u=l?a===r?(t-n)/l:a===t?2+(n-r)/l:4+(r-t)/l:0;return {h:b(60*(u<0?u+6:u)),s:b(a?l/a*100:0),v:b(a/255*100),a:o}},S=react.memo(function(r){var t=r.hue,n=r.onChange,o=g(["react-colorful__hue",r.className]);return react.createElement("div",{className:o},react.createElement(m,{onMove:function(e){n({h:360*e.left});},onKey:function(e){n({h:s(t+360*e.left,0,360)});},"aria-label":"Hue","aria-valuenow":b(t),"aria-valuemax":"360","aria-valuemin":"0"},react.createElement(p,{className:"react-colorful__hue-pointer",left:t/360,color:q({h:t,s:100,v:100,a:1})})))}),T=react.memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:q({h:t.h,s:100,v:100,a:1})};return react.createElement("div",{className:"react-colorful__saturation",style:o},react.createElement(m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top});},onKey:function(e){n({s:s(t.s+100*e.left,0,100),v:s(t.v-100*e.top,0,100)});},"aria-label":"Color","aria-valuetext":"Saturation "+b(t.s)+"%, Brightness "+b(t.v)+"%"},react.createElement(p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q(t)})))}),F=function(e,r){if(e===r)return !0;for(var t in e)if(e[t]!==r[t])return !1;return !0},X=function(e,r){return e.toLowerCase()===r.toLowerCase()||F(C(e),C(r))};function Y(e,t,l){var u=i(l),c=react.useState(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=react.useRef({color:t,hsva:s});react.useEffect(function(){if(!e.equal(t,v.current.color)){var r=e.toHsva(t);v.current={hsva:r,color:t},f(r);}},[t,e]),react.useEffect(function(){var r;F(s,v.current.hsva)||e.equal(r=e.fromHsva(s),v.current.color)||(v.current={hsva:s,color:r},u(r));},[s,e,u]);var d=react.useCallback(function(e){f(function(r){return Object.assign({},r,e)});},[]);return [s,d]}var V="undefined"!=typeof window?react.useLayoutEffect:react.useEffect,$=function(){return ("undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0)},J=new Map,Q=function(e){V(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!J.has(r)){var t=r.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',J.set(r,t);var n=$();n&&t.setAttribute("nonce",n),r.head.appendChild(t);}},[]);},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=c(t,["className","colorModel","color","onChange"]),f=react.useRef(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=g(["react-colorful",n]);return react.createElement("div",u({},s,{ref:f,className:m}),react.createElement(T,{hsva:d,onChange:h}),react.createElement(S,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},W={defaultColor:"000",toHsva:x,fromHsva:function(e){return w({h:e.h,s:e.s,v:e.v,a:1})},equal:X},Z=function(r){return react.createElement(U,u({},r,{colorModel:W}))};
384
+
385
+ const colorfulCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}.bcm-input[no-margin]{margin:0}.bcm-textarea[no-margin]{margin:0}.bcm-switch[no-margin]{margin:0}.bcm-checkbox[no-margin]{margin:0}.bcm-radio-group[no-margin]{margin:0}.bcm-checkbox-group[no-margin]{margin:0}.bcm-range[no-margin]{margin:0}.bcm-form[no-margin]{margin:0}.bcm-form-group[no-margin]{margin:0}.bcm-list[no-margin]{margin:0}.bcm-colorpicker[no-margin]{margin:0}.bcm-date-picker[no-margin]{margin:0}.bcm-time-picker[no-margin]{margin:0}.bcm-datetime-picker[no-margin]{margin:0}.bcm-select[no-margin]{margin:0}.bcm-listbox[no-margin]{margin:0}*{box-sizing:border-box}.bcm-input{display:inline-flex;flex-direction:column;width:100%;max-width:256px;margin-bottom:8px}.bcm-input.full-width{max-width:100%}.bcm-input.hidden{display:none}.bcm-input__container{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:flex;align-items:stretch;flex-direction:row;background-color:var(--bcm-new-ds-color-white);border:1px solid var(--bcm-new-ds-color-slate-300);border-radius:4px;box-sizing:border-box;cursor:text;padding:0 0 0 4px;position:relative;width:100%}.bcm-input__container.disabled{background-color:var(--bcm-new-ds-color-slate-50);cursor:not-allowed}.bcm-input__container.disabled .bcm-input-element{color:var(--bcm-new-ds-color-slate-500)}.bcm-input__container.readonly{background-color:var(--bcm-new-ds-color-slate-50);cursor:default}.bcm-input__container.readonly .bcm-input-element{color:var(--bcm-new-ds-color-slate-600)}.bcm-input__container:not(.disabled):hover .caret-container,.bcm-input__container:not(.disabled).focused .caret-container{opacity:1}.bcm-input__container:not(.disabled):hover .input-clear-button,.bcm-input__container:not(.disabled).focused .input-clear-button{opacity:1}.bcm-input__container:not(.disabled).focused{background-color:var(--bcm-new-ds-color-slate-50)}.bcm-input__container:not(.disabled):hover{border-color:var(--bcm-color-prime-blue-6)}.bcm-input__container.empty .input-clear-button{display:none}.bcm-input__container.invalid,.bcm-input__container.error{border-color:var(--bcm-new-ds-color-red-500)}.bcm-input__container .bcm-input-element{width:100%;color:var(--bcm-new-ds-color-slate-600);flex:1;border:none;background:transparent;box-shadow:unset;padding:0 4px;font-family:\"Inter\", sans-serif;cursor:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;text-overflow:ellipsis}.bcm-input__container .bcm-input-element::placeholder{font-family:\"Inter\", sans-serif;color:var(--bcm-new-ds-color-slate-300);user-select:none}.bcm-input__container .bcm-input-element::-webkit-search-decoration,.bcm-input__container .bcm-input-element::-webkit-search-cancel-button,.bcm-input__container .bcm-input-element::-webkit-search-results-button,.bcm-input__container .bcm-input-element::-webkit-search-results-decoration,.bcm-input__container .bcm-input-element::-webkit-calendar-picker-indicator,.bcm-input__container .bcm-input-element::-webkit-inner-spin-button,.bcm-input__container .bcm-input-element::-webkit-outer-spin-button{-webkit-appearance:none}.bcm-input__container .caret-container{width:30px;display:flex;flex-direction:column;justify-content:center;align-items:stretch;border-left:1px solid #D9D9D9;transition:0.2s opacity;user-select:none;box-sizing:border-box}.bcm-input__container .caret-container .bcm-input-caret{display:flex;align-items:center;justify-content:center;color:var(--bcm-color-grey-7);cursor:pointer;flex:1}.bcm-input__container .caret-container .bcm-input-caret bcm-icon{line-height:1}.bcm-input__container .caret-container .bcm-input-caret:hover{color:var(--bcm-color-prime-blue-6)}.bcm-input__container .caret-container .bcm-input-caret:active{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container .bcm-input-caret:last-child{border-top:1px solid #D9D9D9}.bcm-input__container .caret-container.disabled{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container.disabled .bcm-input-caret{cursor:not-allowed}.bcm-input__container .input-suffix-content{display:flex;align-items:center;justify-content:center}.bcm-input__container .input-prefix:not(:empty){padding-left:4px}.bcm-input__container .input-suffix:not(:empty){min-width:24px;padding-right:4px}.bcm-input__container .input-prefix:not(:empty),.bcm-input__container .input-suffix:not(:empty){display:flex;align-items:center;justify-content:center;cursor:default;color:#64748a}.bcm-input__container .input-prefix:not(:empty) .unit-prefix,.bcm-input__container .input-suffix:not(:empty) .unit-prefix{color:#64748a}.bcm-input__container .input-prefix-button:not(:empty),.bcm-input__container .input-suffix-button:not(:empty){cursor:pointer}.bcm-input__container .caret-container,.bcm-input__container .input-clear-button{opacity:0}.bcm-input__container--small{font-size:12px}.bcm-input__container--medium{font-size:14px}.bcm-input__container--large{font-size:16px}.bcm-input__textarea.clearable .bcm-input-element{padding-right:24px}.bcm-input__textarea .input-clear-button{position:absolute;top:4px;right:0}bcm-colorful{display:flex;flex-direction:column;width:256px;padding:8px;background-color:#fff;border-radius:4px}bcm-colorful .react-colorful{width:100%;gap:4px}bcm-colorful .react-colorful__saturation{margin:0 0 4px 0;border-radius:2px;border-bottom:none}bcm-colorful .react-colorful__hue,bcm-colorful .react-colorful__alpha{height:20px;border-radius:2px}bcm-colorful .react-colorful__hue-pointer,bcm-colorful .react-colorful__alpha-pointer{width:15px;height:15px}bcm-colorful .react-colorful__saturation-pointer{width:20px;height:20px}";
386
+
387
+ const BcmColorful = class {
388
+ constructor(hostRef) {
389
+ registerInstance(this, hostRef);
390
+ this.bcmChange = createEvent(this, "bcmChange", 7);
391
+ this.color = "#3b82f6";
392
+ }
393
+ handleChange(e) {
394
+ this.bcmChange.emit(e);
395
+ }
396
+ componentDidRender() {
397
+ const { color } = this;
398
+ reactDom.render(react.createElement(Z, {
399
+ color,
400
+ onChange: lodash.debounce(this.handleChange.bind(this), 150),
401
+ }), this.el);
402
+ }
403
+ get el() { return getElement(this); }
404
+ };
405
+ BcmColorful.style = colorfulCss;
406
+
407
+ // /**
408
+ // *
409
+ // * @param type
410
+ // */
411
+ // export const required = (value:any) => {
412
+ // if ( value || value != null ) {
413
+ // return true
414
+ // } else {
415
+ // return true
416
+ // }
417
+ // }
418
+ class rules {
419
+ constructor() { }
420
+ response(status, message) {
421
+ return Object.assign(Object.assign({ valid: status }, (message && { message })), (!status && { type: 'error' }));
422
+ }
423
+ required(value, componentValidation) {
424
+ let validation = this.response(true);
425
+ if (value == '' || value == "" || value == undefined || value == null || value === false) {
426
+ validation = this.response(false, 'This field is required');
427
+ }
428
+ if (componentValidation) {
429
+ if (!componentValidation.valid) {
430
+ validation = this.response(false, componentValidation.errorText);
431
+ }
432
+ if (value instanceof Object) {
433
+ if (value.isValid) {
434
+ if (value.isValid == false)
435
+ validation = this.response(false, 'This field is required');
436
+ }
437
+ }
438
+ }
439
+ return validation;
440
+ }
441
+ selfValidation(input) {
442
+ let validation = this.response(true);
443
+ if (input.captionError != null || input.captionType == 'error') {
444
+ validation = this.response(false, input.captionError);
445
+ }
446
+ return validation;
447
+ }
448
+ }
449
+ const validate = new rules;
450
+
451
+ const formCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}:host{display:block;margin-bottom:8px}:host(.hidden){display:none}";
452
+
453
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
454
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
455
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
456
+ r = Reflect.decorate(decorators, target, key, desc);
457
+ else
458
+ for (var i = decorators.length - 1; i >= 0; i--)
459
+ if (d = decorators[i])
460
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
461
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
462
+ };
463
+ const BcmForm = class {
464
+ constructor(hostRef) {
465
+ registerInstance(this, hostRef);
466
+ this.bcmForm = createEvent(this, "bcm-form", 7);
467
+ this.formData = {};
468
+ this.inputs = [];
469
+ this.duplicateInput = [];
470
+ this.isValid = true;
471
+ this.returnCaption = [];
472
+ this.Bromcom = {
473
+ errors: {
474
+ targetFormNotExist: 'target form is not exist --> ',
475
+ },
476
+ inputComponents: {
477
+ CHIP_GROUP: 'chip-group',
478
+ // Birbirinin aynısı
479
+ INPUT: 'input',
480
+ TEXTAREA: 'textarea',
481
+ //çok benzer
482
+ SWITCH: 'switch',
483
+ CHECKBOX: 'checkbox',
484
+ RADIO_GROUP: 'radio-group',
485
+ CHECKBOX_GROUP: 'checkbox-group',
486
+ RANGE: 'range',
487
+ // sadece value fırlatıyor
488
+ FORM: 'form',
489
+ FORM_GROUP: 'form-group',
490
+ // *En vakit alacak => içinde select, autocomplete, listbox, treeview özellikleri var
491
+ LIST: 'list',
492
+ //
493
+ COLORPICKER: 'colorpicker',
494
+ DATE: 'date',
495
+ // picker aslında tek komponent hepsi datetimepicker
496
+ DATE_PICKER: 'date-picker',
497
+ TIME_PICKER: 'time-picker',
498
+ DATETIME_PICKER: 'datetime-picker',
499
+ // silinecek komponentler
500
+ SELECT: 'select',
501
+ LISTBOX: 'listbox',
502
+ NUMBER_INPUT: 'number-input',
503
+ },
504
+ helpers: {
505
+ randomId: function () {
506
+ return Math.random().toString(16).slice(2, -1);
507
+ },
508
+ },
509
+ };
510
+ this._id = (Math.random() * 4).toString(16).replace('.', '');
511
+ this.hidden = false;
512
+ this.validation = false;
513
+ this.name = "";
514
+ this.value = undefined;
515
+ this.autocomplete = false;
516
+ }
517
+ handleSubmit() {
518
+ // if (lowercase(e.target.nodeName) === 'bcm-button') {
519
+ // if (e.target.type === 'submit') {
520
+ // this.submitFunction()
521
+ // }
522
+ // }
523
+ }
524
+ async submitFunction() {
525
+ this.formData = {};
526
+ this.inputs = [];
527
+ this.selector = this.el;
528
+ await this.getInputs();
529
+ await delay(10);
530
+ const usrFrmData = await this.userFormData();
531
+ var formData = { isValid: true, formData: usrFrmData };
532
+ if (this.name) {
533
+ formData = Object.assign(Object.assign({}, formData), { formName: this.name });
534
+ }
535
+ if (this.isValid) {
536
+ this.bcmForm.emit(formData);
537
+ return formData;
538
+ }
539
+ else {
540
+ this.returnCaption = { isValid: false, 'message': 'Please fill in all inputs', 'errorDetails': this.returnCaption, formData: usrFrmData };
541
+ if (this.name) {
542
+ this.returnCaption = Object.assign(Object.assign({}, this.returnCaption), { formName: this.name });
543
+ }
544
+ this.bcmForm.emit(this.returnCaption);
545
+ return this.returnCaption;
546
+ }
547
+ }
548
+ async submit() {
549
+ return Promise.resolve(this.submitFunction());
550
+ }
551
+ async set(data) {
552
+ var _a;
553
+ const validate = this.validation;
554
+ this.validation = false;
555
+ this.selector = this.el;
556
+ await this.getInputs();
557
+ if (data && ((_a = this.inputs) === null || _a === void 0 ? void 0 : _a.length) > 0) {
558
+ for (const key of Object.keys(data)) {
559
+ const item = this.inputs.find(item => item.name === key);
560
+ if (item) {
561
+ try {
562
+ await item.set(data[key]);
563
+ }
564
+ catch (error) {
565
+ console.log(item.nodeName, "set", error);
566
+ }
567
+ }
568
+ }
569
+ }
570
+ this.validation = validate;
571
+ }
572
+ async get() {
573
+ var _a;
574
+ let formData = {};
575
+ this.selector = this.el;
576
+ const inputsCache = this.inputs;
577
+ await this.getInputs();
578
+ ((_a = this.inputs) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.inputs.forEach(async (item) => {
579
+ try {
580
+ const value = await item.get();
581
+ formData = Object.assign(Object.assign({}, formData), { [item.name]: value });
582
+ }
583
+ catch (error) {
584
+ console.log(`${item.nodeName} get error`);
585
+ }
586
+ });
587
+ this.inputs = inputsCache;
588
+ await delay(10);
589
+ return Promise.resolve(formData);
590
+ }
591
+ async setClear() {
592
+ this.formData = {};
593
+ this.inputs = [];
594
+ this.selector = this.el;
595
+ let clear = [];
596
+ await this.getInputs();
597
+ this.inputs.forEach(async (item) => {
598
+ try {
599
+ clear.push(await item.setClear());
600
+ }
601
+ catch (error) {
602
+ console.log(error);
603
+ }
604
+ });
605
+ await Promise.all(clear).then(() => {
606
+ this.formData = {};
607
+ this.inputs = [];
608
+ this.duplicateInput = [];
609
+ this.isValid = true;
610
+ this.returnCaption = [];
611
+ });
612
+ await delay(10);
613
+ return Promise.resolve(true);
614
+ }
615
+ async resetCaption() {
616
+ await delay(10);
617
+ this.formData = {};
618
+ this.inputs = [];
619
+ this.selector = this.el;
620
+ await this.getInputs();
621
+ for (const item of this.inputs) {
622
+ try {
623
+ await item.resetCaption();
624
+ }
625
+ catch (error) {
626
+ console.log(item.nodeName, "rc p");
627
+ }
628
+ }
629
+ await delay(10);
630
+ return Promise.resolve();
631
+ }
632
+ async config(_config) {
633
+ if (_config['validation']) {
634
+ typeof _config['validation'] == 'boolean'
635
+ ? this.validation = _config['validation']
636
+ : this.validation = false;
637
+ }
638
+ return true;
639
+ }
640
+ async getInputs() {
641
+ var form = this.selector;
642
+ if (!form) {
643
+ console.warn(this.Bromcom.errors.targetFormNotExist + this.selector);
644
+ return;
645
+ }
646
+ const inputs = Array.from(form.querySelectorAll('bcm-' + Object.values(this.Bromcom.inputComponents).join(',bcm-')));
647
+ this.duplicateInput = [];
648
+ // s-hn: Stencil private flag that contains host web component
649
+ // https://github.com/ionic-team/stencil/blob/45388e95edb46ef357eb9ae37cd32bbb5bc1ed23/src/runtime/vdom/vdom-render.ts#L116
650
+ const rootInputs = inputs.filter((input) => { var _a; return !input['s-hn'] || ((_a = input['s-hn']) === null || _a === void 0 ? void 0 : _a.nodeName) !== 'BcmForm'; });
651
+ // debugger;
652
+ for (const item of rootInputs) {
653
+ if (StringHelper.lowercase(item.nodeName) == "bcm-checkbox-group") {
654
+ let checkboxs = item.querySelectorAll("bcm-checkbox");
655
+ if (checkboxs) {
656
+ for (const checkbox of checkboxs) {
657
+ this.duplicateInput.push(checkbox.name);
658
+ }
659
+ }
660
+ }
661
+ if (StringHelper.lowercase(item.nodeName) == "bcm-form") {
662
+ const groupInputs = Array.from(item.querySelectorAll('bcm-' + Object.values(this.Bromcom.inputComponents).join(',bcm-')));
663
+ let itemObject = {};
664
+ for (const element of groupInputs) {
665
+ var name = element.name;
666
+ var value = element.value;
667
+ itemObject = Object.assign(Object.assign({}, itemObject), { [name]: value });
668
+ this.duplicateInput.push(element.name);
669
+ }
670
+ item.value = itemObject;
671
+ let checkboxs = item.querySelectorAll("bcm-checkbox");
672
+ if (checkboxs) {
673
+ for (const checkbox of checkboxs) {
674
+ this.duplicateInput.push(checkbox.name);
675
+ }
676
+ }
677
+ }
678
+ }
679
+ await delay(10);
680
+ this.inputs = rootInputs;
681
+ }
682
+ getItemValue(item) {
683
+ const tagName = item.tagName.toLowerCase().replace('bcm-', '');
684
+ switch (tagName) {
685
+ /* case 'date-picker':
686
+ case 'datetime-picker':
687
+ return item.value.timestamp
688
+ case 'time-picker':
689
+ return item.value.time */
690
+ default:
691
+ return item.value;
692
+ }
693
+ }
694
+ isWrapperComponent(item) {
695
+ return ['bcm-datetime-picker', 'bcm-date-picker', 'bcm-time-picker'].includes(item.toLowerCase());
696
+ }
697
+ isGroupComponent(item) {
698
+ return ['bcm-checkbox-group'].includes(item.toLowerCase());
699
+ }
700
+ isListComponent(item) {
701
+ return ['bcm-list'].includes(item.toLowerCase());
702
+ }
703
+ async userFormData() {
704
+ this.formData = {};
705
+ this.isValid = true;
706
+ this.returnCaption = [];
707
+ for (const item of this.inputs) {
708
+ // const isListComponent = this.isListComponent(item.tagName);
709
+ const isGroupComponent = this.isGroupComponent(item.tagName);
710
+ const isWrapperComponent = this.isWrapperComponent(item.tagName);
711
+ const wrapperComponent = isWrapperComponent && item;
712
+ const input = isWrapperComponent
713
+ ? await item.getInput() && item
714
+ : item;
715
+ // input.caption = ''
716
+ // input.captionType = ''
717
+ if (this.validation) {
718
+ let valid = null;
719
+ // if (isListComponent) {
720
+ // valid = !(input.value && input.value.length > 0) && validate.required(input.value)
721
+ // } else
722
+ if (isWrapperComponent) {
723
+ const isPickerValid = await wrapperComponent.isValid();
724
+ valid = validate.required(input.value, isPickerValid);
725
+ if (valid) {
726
+ if (input.value instanceof Object) {
727
+ if (input.value["isValid"] == false) {
728
+ valid = validate.required("", isPickerValid);
729
+ }
730
+ }
731
+ else {
732
+ valid = validate.required(input.value, isPickerValid);
733
+ }
734
+ }
735
+ }
736
+ else if (isGroupComponent) {
737
+ const childsCheckbox = getChildElements(input, 'bcm-checkbox:not(#bcm-indeterminate-element)');
738
+ if (childsCheckbox && childsCheckbox.length > 0) {
739
+ for (const element of childsCheckbox) {
740
+ if (element && element.required === true) {
741
+ valid = validate.required(element.checked);
742
+ if (!valid['valid']) {
743
+ element.noCaption = false;
744
+ element.captionError = valid['message'];
745
+ element.captionType = valid['type'];
746
+ }
747
+ else {
748
+ element.noCaption = input.noCaption;
749
+ element.captionError = null;
750
+ element.captionType = "default";
751
+ }
752
+ }
753
+ }
754
+ }
755
+ }
756
+ else {
757
+ valid = validate.required(input.value);
758
+ }
759
+ if (input.required) {
760
+ if (!valid['valid']) {
761
+ input.captionError = valid['message'];
762
+ input.captionType = valid['type'];
763
+ }
764
+ else {
765
+ input.captionError = null;
766
+ input.captionType = "default";
767
+ }
768
+ await delay(10);
769
+ const selfValidation = validate.selfValidation(input);
770
+ if (valid['valid']) {
771
+ if (!selfValidation['valid']) {
772
+ input.captionError = selfValidation['message'];
773
+ input.captionType = selfValidation['type'];
774
+ }
775
+ }
776
+ }
777
+ let name = input.name;
778
+ let value = input.captionError;
779
+ !input.hidden && input.captionType == 'error' && (this.returnCaption = [...Array.from(this.returnCaption), { [name]: value }],
780
+ this.isValid = false);
781
+ }
782
+ if (input.name && !this.duplicateInput.includes(input.name)) {
783
+ var itemValue = this.getItemValue(input);
784
+ if (!itemValue || itemValue == undefined || itemValue == null) {
785
+ itemValue = null;
786
+ }
787
+ this.formData[input.name] = itemValue;
788
+ }
789
+ }
790
+ return this.formData;
791
+ }
792
+ async handleChange(e) {
793
+ const isWrapperComponent = this.isWrapperComponent(e.target.tagName);
794
+ const isGroupComponent = this.isGroupComponent(e.target.tagName);
795
+ let target;
796
+ if (isWrapperComponent) {
797
+ target = e.target.getInput && await e.target.getInput() || e.target;
798
+ }
799
+ else if (isGroupComponent) {
800
+ let req = false;
801
+ const childsCheckbox = getChildElements(e.target, 'bcm-checkbox:not(#bcm-indeterminate-element)');
802
+ childsCheckbox.length > 0 && (childsCheckbox.forEach((element) => {
803
+ if (element && element.required === true) {
804
+ req = true;
805
+ }
806
+ }));
807
+ target = Object.assign(Object.assign({}, e.target), { required: req });
808
+ }
809
+ else {
810
+ target = e.target;
811
+ }
812
+ const value = e.target.value;
813
+ const wrapperComponent = isWrapperComponent && e.target;
814
+ var isPickerValid;
815
+ if (isWrapperComponent) {
816
+ isPickerValid = await wrapperComponent.isValid();
817
+ }
818
+ const tick = setTimeout(() => {
819
+ if (target.required) {
820
+ let valid = null;
821
+ if (isWrapperComponent) {
822
+ valid = validate.required(value, isPickerValid);
823
+ if (valid) {
824
+ if (value instanceof Object) {
825
+ if (value["isValid"] == false) {
826
+ valid = validate.required("", isPickerValid);
827
+ }
828
+ }
829
+ else {
830
+ valid = validate.required(value, isPickerValid);
831
+ }
832
+ }
833
+ }
834
+ else if (isGroupComponent) {
835
+ const childsCheckbox = getChildElements(e.target, 'bcm-checkbox:not(#bcm-indeterminate-element)');
836
+ childsCheckbox.length > 0 && (childsCheckbox.forEach((element) => {
837
+ if (element && element.required === true) {
838
+ valid = validate.required(element.checked);
839
+ if (!valid['valid']) {
840
+ element.noCaption = false;
841
+ element.captionError = valid['message'];
842
+ element.captionType = valid['type'];
843
+ }
844
+ else {
845
+ element.noCaption = e.target.noCaption;
846
+ element.captionError = null;
847
+ element.captionType = "default";
848
+ }
849
+ }
850
+ }));
851
+ }
852
+ else {
853
+ valid = validate.required(value);
854
+ }
855
+ if (valid['valid']) {
856
+ target.captionError = null;
857
+ target.captionType = null;
858
+ }
859
+ else {
860
+ target.captionError = valid['message'];
861
+ target.captionType = valid['type'];
862
+ }
863
+ }
864
+ clearTimeout(tick);
865
+ });
866
+ this.value = await this.userFormData();
867
+ }
868
+ async handleSubmitForm(e) {
869
+ e.preventDefault();
870
+ }
871
+ render() {
872
+ const hostClasses = classnames(this.hidden ? 'hidden' : null);
873
+ return (h$1(Host, { class: hostClasses }, h$1("form", { class: "bcm-form", autocomplete: this.autocomplete ? "on" : "off" }, h$1("slot", null))));
874
+ }
875
+ get el() { return getElement(this); }
876
+ };
877
+ __decorate$3([
878
+ IsLoad()
879
+ ], BcmForm.prototype, "el", void 0);
880
+ BcmForm.style = formCss;
881
+
882
+ const iconCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}.bcm-icon.hidden{display:none}";
883
+
884
+ const customIconList = {
885
+ "message-bot": "message-bot.svg",
886
+ };
887
+ const BcmIcon = class {
888
+ constructor(hostRef) {
889
+ registerInstance(this, hostRef);
890
+ this.hidden = false;
891
+ this.icon = undefined;
892
+ }
893
+ getIcon() {
894
+ const { icon } = this;
895
+ if (icon in customIconList) {
896
+ const _icon = getAssetPath("./static/" + customIconList[icon]);
897
+ return (h$1("div", { class: "tw-flex tw-h-fit tw-w-fit tw-items-center tw-justify-center" }, h$1("img", { src: `${_icon}`, alt: icon, class: "tw-h-fit tw-w-fit" })));
898
+ }
899
+ return h$1("i", { class: `${icon}` });
900
+ }
901
+ render() {
902
+ const { /*icon,*/ hidden } = this;
903
+ return h$1(Host, { class: `bcm-icon fa ${hidden ? "hidden" : ""}` }, this.getIcon());
904
+ }
905
+ static get assetsDirs() { return ["static"]; }
906
+ get el() { return getElement(this); }
907
+ };
908
+ BcmIcon.style = iconCss;
909
+
910
+ const inputCss$1 = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}.bcm-input[no-margin]{margin:0}.bcm-textarea[no-margin]{margin:0}.bcm-switch[no-margin]{margin:0}.bcm-checkbox[no-margin]{margin:0}.bcm-radio-group[no-margin]{margin:0}.bcm-checkbox-group[no-margin]{margin:0}.bcm-range[no-margin]{margin:0}.bcm-form[no-margin]{margin:0}.bcm-form-group[no-margin]{margin:0}.bcm-list[no-margin]{margin:0}.bcm-colorpicker[no-margin]{margin:0}.bcm-date-picker[no-margin]{margin:0}.bcm-time-picker[no-margin]{margin:0}.bcm-datetime-picker[no-margin]{margin:0}.bcm-select[no-margin]{margin:0}.bcm-listbox[no-margin]{margin:0}*{box-sizing:border-box}.bcm-input{display:inline-flex;flex-direction:column;width:100%;max-width:256px;margin-bottom:8px}.bcm-input.full-width{max-width:100%}.bcm-input.hidden{display:none}.bcm-input__container{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:flex;align-items:stretch;flex-direction:row;background-color:var(--bcm-new-ds-color-white);border:1px solid var(--bcm-new-ds-color-slate-300);border-radius:4px;box-sizing:border-box;cursor:text;padding:0 0 0 4px;position:relative;width:100%}.bcm-input__container.disabled{background-color:var(--bcm-new-ds-color-slate-50);cursor:not-allowed}.bcm-input__container.disabled .bcm-input-element{color:var(--bcm-new-ds-color-slate-500)}.bcm-input__container.readonly{background-color:var(--bcm-new-ds-color-slate-50);cursor:default}.bcm-input__container.readonly .bcm-input-element{color:var(--bcm-new-ds-color-slate-600)}.bcm-input__container:not(.disabled):hover .caret-container,.bcm-input__container:not(.disabled).focused .caret-container{opacity:1}.bcm-input__container:not(.disabled):hover .input-clear-button,.bcm-input__container:not(.disabled).focused .input-clear-button{opacity:1}.bcm-input__container:not(.disabled).focused{background-color:var(--bcm-new-ds-color-slate-50)}.bcm-input__container:not(.disabled):hover{border-color:var(--bcm-color-prime-blue-6)}.bcm-input__container.empty .input-clear-button{display:none}.bcm-input__container.invalid,.bcm-input__container.error{border-color:var(--bcm-new-ds-color-red-500)}.bcm-input__container .bcm-input-element{width:100%;color:var(--bcm-new-ds-color-slate-600);flex:1;border:none;background:transparent;box-shadow:unset;padding:0 4px;font-family:\"Inter\", sans-serif;cursor:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;text-overflow:ellipsis}.bcm-input__container .bcm-input-element::placeholder{font-family:\"Inter\", sans-serif;color:var(--bcm-new-ds-color-slate-300);user-select:none}.bcm-input__container .bcm-input-element::-webkit-search-decoration,.bcm-input__container .bcm-input-element::-webkit-search-cancel-button,.bcm-input__container .bcm-input-element::-webkit-search-results-button,.bcm-input__container .bcm-input-element::-webkit-search-results-decoration,.bcm-input__container .bcm-input-element::-webkit-calendar-picker-indicator,.bcm-input__container .bcm-input-element::-webkit-inner-spin-button,.bcm-input__container .bcm-input-element::-webkit-outer-spin-button{-webkit-appearance:none}.bcm-input__container .caret-container{width:30px;display:flex;flex-direction:column;justify-content:center;align-items:stretch;border-left:1px solid #D9D9D9;transition:0.2s opacity;user-select:none;box-sizing:border-box}.bcm-input__container .caret-container .bcm-input-caret{display:flex;align-items:center;justify-content:center;color:var(--bcm-color-grey-7);cursor:pointer;flex:1}.bcm-input__container .caret-container .bcm-input-caret bcm-icon{line-height:1}.bcm-input__container .caret-container .bcm-input-caret:hover{color:var(--bcm-color-prime-blue-6)}.bcm-input__container .caret-container .bcm-input-caret:active{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container .bcm-input-caret:last-child{border-top:1px solid #D9D9D9}.bcm-input__container .caret-container.disabled{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container.disabled .bcm-input-caret{cursor:not-allowed}.bcm-input__container .input-suffix-content{display:flex;align-items:center;justify-content:center}.bcm-input__container .input-prefix:not(:empty){padding-left:4px}.bcm-input__container .input-suffix:not(:empty){min-width:24px;padding-right:4px}.bcm-input__container .input-prefix:not(:empty),.bcm-input__container .input-suffix:not(:empty){display:flex;align-items:center;justify-content:center;cursor:default;color:#64748a}.bcm-input__container .input-prefix:not(:empty) .unit-prefix,.bcm-input__container .input-suffix:not(:empty) .unit-prefix{color:#64748a}.bcm-input__container .input-prefix-button:not(:empty),.bcm-input__container .input-suffix-button:not(:empty){cursor:pointer}.bcm-input__container .caret-container,.bcm-input__container .input-clear-button{opacity:0}.bcm-input__container--small{font-size:12px}.bcm-input__container--medium{font-size:14px}.bcm-input__container--large{font-size:16px}.bcm-input__textarea.clearable .bcm-input-element{padding-right:24px}.bcm-input__textarea .input-clear-button{position:absolute;top:4px;right:0}";
911
+
912
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
913
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
914
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
915
+ r = Reflect.decorate(decorators, target, key, desc);
916
+ else
917
+ for (var i = decorators.length - 1; i >= 0; i--)
918
+ if (d = decorators[i])
919
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
920
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
921
+ };
922
+ const BcmInput = class {
923
+ constructor(hostRef) {
924
+ registerInstance(this, hostRef);
925
+ this.focus = createEvent(this, "bcm-focus", 7);
926
+ this.blur = createEvent(this, "bcm-blur", 7);
927
+ this.clear = createEvent(this, "bcm-clear", 7);
928
+ this.change = createEvent(this, "bcm-change", 7);
929
+ this.input = createEvent(this, "bcm-input", 7);
930
+ this.isBlur = false;
931
+ this._id = Generate.UID();
932
+ this._internal_id = Generate.UID();
933
+ this.value = '';
934
+ this.size = Bcm.Size.medium;
935
+ this.label = undefined;
936
+ this.pattern = undefined;
937
+ this.tooltip = undefined;
938
+ this.placeholder = undefined;
939
+ this.disabled = false;
940
+ this.readonly = false;
941
+ this.clearable = false;
942
+ this.autocomplete = false;
943
+ this.name = undefined;
944
+ this.type = Bcm.InputType.text;
945
+ this.hidden = false;
946
+ this.required = false;
947
+ this.fullWidth = false;
948
+ this.noDefaultIcon = undefined;
949
+ this.disableWatchValue = false // datetimepicker
950
+ ;
951
+ this.passwordToggle = false // type password
952
+ ;
953
+ this.maxLength = null;
954
+ this.minLength = null;
955
+ this.unitPrefix = null;
956
+ this.unit = undefined;
957
+ this.decimal = true;
958
+ this.min = undefined;
959
+ this.max = undefined;
960
+ this.step = undefined;
961
+ this.caption = undefined;
962
+ this.noCaption = false;
963
+ this.captionType = Bcm.Status.default;
964
+ this.captionError = undefined;
965
+ this.customErrorMessage = undefined;
966
+ this._prefix = undefined;
967
+ this._suffix = undefined;
968
+ this.captionCache = undefined;
969
+ this.captionTypeCache = undefined;
970
+ this.inValid = false;
971
+ this.valueCache = '';
972
+ this.focused = false;
973
+ this.isPasswordVisible = false;
974
+ }
975
+ connectedCallback() {
976
+ this.valueCache = this.value;
977
+ this.captionCache = this.caption;
978
+ this.captionTypeCache = this.captionType;
979
+ }
980
+ componentWillRender() {
981
+ const { type, isBlur, value } = this;
982
+ if (value) {
983
+ this.value.length > 0 && (this.checkPattern());
984
+ switch (type) {
985
+ case "number":
986
+ {
987
+ !this.checkValid("number") && (this.validationRange());
988
+ }
989
+ break;
990
+ case "email":
991
+ {
992
+ isBlur && (this.checkValid("email"));
993
+ }
994
+ break;
995
+ case "tel":
996
+ {
997
+ isBlur && (this.checkValid("phone"));
998
+ }
999
+ break;
1000
+ case "text":
1001
+ {
1002
+ isBlur && (this.checkLength());
1003
+ }
1004
+ break;
1005
+ }
1006
+ }
1007
+ else {
1008
+ !this.required && (this.resetCaption());
1009
+ }
1010
+ }
1011
+ async onBcmFocus() {
1012
+ this.inputElement.focus();
1013
+ }
1014
+ async onBcmBlur() {
1015
+ this.inputElement.blur();
1016
+ }
1017
+ async onBcmSelect() {
1018
+ this.inputElement.select();
1019
+ }
1020
+ async set(data) {
1021
+ await this.setValue(data);
1022
+ }
1023
+ async get() {
1024
+ return this.value || null;
1025
+ }
1026
+ async setValue(value) {
1027
+ this.inputElement.value = value;
1028
+ this.handleChange();
1029
+ return value;
1030
+ }
1031
+ async setClear() {
1032
+ this.inputElement.value = '';
1033
+ this.value = '';
1034
+ await delay(10);
1035
+ return Promise.resolve();
1036
+ }
1037
+ async resetCaption() {
1038
+ await delay(10);
1039
+ this.caption = this.captionCache;
1040
+ this.captionType = this.captionTypeCache;
1041
+ this.captionError = null;
1042
+ this.inValid = false;
1043
+ await delay(10);
1044
+ return Promise.resolve();
1045
+ }
1046
+ async getValue() {
1047
+ return this.value;
1048
+ }
1049
+ watchValue(newValue) {
1050
+ this.inputElement.value = newValue;
1051
+ if (!this.disableWatchValue && this.type != "number") {
1052
+ this.handleChange();
1053
+ }
1054
+ }
1055
+ listenKeyDown(e) {
1056
+ if (!this.disabled && !this.readonly) {
1057
+ this.onBcmFocus();
1058
+ if (this.type == "number") {
1059
+ var which = e.which || 0;
1060
+ var key = e.key;
1061
+ if (which == 38) { // up arrow
1062
+ e.preventDefault(),
1063
+ this.stepUpOrDown('up');
1064
+ }
1065
+ if (which == 40) { // down arrow
1066
+ e.preventDefault(),
1067
+ this.stepUpOrDown('down');
1068
+ }
1069
+ if ((which == 190 || which == 110 || key == ".") && this.value.indexOf(".") > -1) { //.
1070
+ e.preventDefault();
1071
+ }
1072
+ if ((which == 189 || which == 109 || key == "-")) { //-
1073
+ if (this.value.charAt(0) == '-' || this.value.indexOf("-") > -1) {
1074
+ e.preventDefault();
1075
+ }
1076
+ }
1077
+ }
1078
+ }
1079
+ }
1080
+ handleFocus() {
1081
+ this.focused = true;
1082
+ this.focus.emit();
1083
+ this.whatchHasFocus();
1084
+ }
1085
+ handleBlur() {
1086
+ this.focused = false;
1087
+ this.isBlur = true;
1088
+ this.whatchHasFocus();
1089
+ this.blur.emit();
1090
+ }
1091
+ handleChange() {
1092
+ this.valueSync();
1093
+ }
1094
+ handleInput() {
1095
+ if (this.type == "number" && this.maxLength) {
1096
+ const inputValue = this.inputElement.value;
1097
+ if (inputValue && inputValue.length > 0 && inputValue.length > this.maxLength) {
1098
+ this.inputElement.value = inputValue.substring(0, this.maxLength);
1099
+ }
1100
+ }
1101
+ this.valueSync();
1102
+ }
1103
+ valueSync() {
1104
+ if (this.value != this.inputElement.value) {
1105
+ this.value = this.inputElement.value;
1106
+ this.change.emit(this.value);
1107
+ return true;
1108
+ }
1109
+ this.input.emit(this.value);
1110
+ return false;
1111
+ }
1112
+ handleClear(e) {
1113
+ this.inputElement.value = '';
1114
+ this.value = '';
1115
+ this.inputElement.focus();
1116
+ this.clear.emit(e);
1117
+ this.change.emit(this.value);
1118
+ e.stopPropagation();
1119
+ }
1120
+ changePasswordVisibility() {
1121
+ this.isPasswordVisible = !this.isPasswordVisible;
1122
+ }
1123
+ setCaption(caption = null, captionType = null) {
1124
+ this.caption = caption || this.captionCache;
1125
+ this.captionType = captionType || this.captionTypeCache;
1126
+ this.captionError = captionType == "error" ? caption : null;
1127
+ }
1128
+ stepUpOrDown(type) {
1129
+ if (!this.inValid && !this.disabled && !this.readonly) {
1130
+ let step = +(this.step) || 1;
1131
+ let val = +(this.value);
1132
+ if (type == 'up') {
1133
+ val = +(val + step);
1134
+ }
1135
+ else {
1136
+ val = +(val - step);
1137
+ }
1138
+ this.value = val.toString();
1139
+ this.change.emit(this.value);
1140
+ }
1141
+ }
1142
+ validationRange() {
1143
+ const { min, max, value } = this;
1144
+ if (value !== undefined) {
1145
+ if ((min !== undefined) && (max !== undefined)) {
1146
+ if (value < min || value > max) {
1147
+ this.setCaption(StringHelper.getMessage('between', [min, max]), "error");
1148
+ return false;
1149
+ }
1150
+ }
1151
+ else if (min !== undefined) {
1152
+ if (value < min) {
1153
+ this.setCaption(StringHelper.getMessage('min', [min]), "error");
1154
+ return false;
1155
+ }
1156
+ }
1157
+ else if (max !== undefined) {
1158
+ if (value > max) {
1159
+ this.setCaption(StringHelper.getMessage('max', [max]), "error");
1160
+ return false;
1161
+ }
1162
+ }
1163
+ }
1164
+ this.setCaption();
1165
+ return true;
1166
+ }
1167
+ checkLength() {
1168
+ const { minLength, maxLength, value } = this;
1169
+ if (minLength && maxLength) {
1170
+ if (value.length < minLength || value.length > maxLength) {
1171
+ this.setCaption(StringHelper.getMessage('betweenlength', [minLength, maxLength]), "error");
1172
+ this.inValid = true;
1173
+ }
1174
+ else {
1175
+ this.setCaption();
1176
+ this.inValid = false;
1177
+ }
1178
+ }
1179
+ else if (minLength) {
1180
+ if (value.length < minLength) {
1181
+ this.setCaption(StringHelper.getMessage('minlength', [minLength]), "error");
1182
+ this.inValid = true;
1183
+ }
1184
+ else {
1185
+ this.setCaption();
1186
+ this.inValid = false;
1187
+ }
1188
+ }
1189
+ else if (maxLength) {
1190
+ if (value.length > maxLength) {
1191
+ this.setCaption(StringHelper.getMessage('maxlength', [maxLength]), "error");
1192
+ this.inValid = true;
1193
+ }
1194
+ else {
1195
+ this.setCaption();
1196
+ this.inValid = false;
1197
+ }
1198
+ }
1199
+ }
1200
+ checkPattern() {
1201
+ const { pattern, value } = this;
1202
+ if (pattern) {
1203
+ if (Validators.pattern(value, pattern)) {
1204
+ this.setCaption();
1205
+ this.inValid = false;
1206
+ }
1207
+ else {
1208
+ this.setCaption(StringHelper.getMessage('pattern'), "error");
1209
+ this.inValid = true;
1210
+ }
1211
+ }
1212
+ }
1213
+ checkValid(type) {
1214
+ const { value } = this;
1215
+ if (Validators.isValidate(value, type)) {
1216
+ this.setCaption();
1217
+ this.inValid = false;
1218
+ }
1219
+ else {
1220
+ this.setCaption(StringHelper.getMessage(type), "error");
1221
+ this.inValid = true;
1222
+ }
1223
+ return this.inValid;
1224
+ }
1225
+ whatchHasFocus() {
1226
+ const { type, focused, valueCache, inValid } = this;
1227
+ if (type == Bcm.InputType.number && inValid) {
1228
+ if (focused) {
1229
+ this.value = '';
1230
+ }
1231
+ else {
1232
+ if (!StringHelper.isNullOrEmpty(this.value)) {
1233
+ this.value = this.value ? this.fixToNumber(this.value) : '';
1234
+ }
1235
+ else {
1236
+ this.value = valueCache;
1237
+ }
1238
+ }
1239
+ }
1240
+ }
1241
+ fixToNumber(val) {
1242
+ if (val) {
1243
+ const decLen = NumberHelper.getDecimalLength(this.step);
1244
+ return decLen > 0 ? NumberHelper.parseFloatFixed(val, decLen) : val;
1245
+ }
1246
+ return val;
1247
+ }
1248
+ eyeDropper() {
1249
+ const eyeDropper = new window.EyeDropper();
1250
+ eyeDropper
1251
+ .open()
1252
+ .then((color) => {
1253
+ this.setValue(color.sRGBHex);
1254
+ })
1255
+ .catch((error) => {
1256
+ if (error.name === "NotAllowedError") {
1257
+ console.log("Permission to access sensor was denied.");
1258
+ }
1259
+ else if (error.name === "NotSupportedError") {
1260
+ console.log("Sensor not supported.");
1261
+ }
1262
+ });
1263
+ }
1264
+ isEyeDropperSupported() {
1265
+ return typeof window !== "undefined" && "EyeDropper" in window;
1266
+ }
1267
+ toggleLinked() {
1268
+ const linkedElement = document.getElementById(`${this._id}-linked`);
1269
+ if (linkedElement) {
1270
+ linkedElement.toggle();
1271
+ }
1272
+ }
1273
+ render() {
1274
+ const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable, passwordToggle, isPasswordVisible, noDefaultIcon, unit, inValid, focused, unitPrefix, noCaption, required, hidden, _id, autocomplete } = this;
1275
+ const isActiveClearable = (value === null || value === void 0 ? void 0 : value.length) > 0 && clearable;
1276
+ const hostClasses = classnames('bcm-input', `bcm-input__container--${size}`, {
1277
+ hidden,
1278
+ // 'no-margin': noMargin,
1279
+ 'full-width': fullWidth
1280
+ });
1281
+ return (h$1(Host, { onfocus: () => this.onBcmFocus(), class: hostClasses, onClick: () => this.onBcmFocus() }, label && h$1("bcm-label", { onClick: () => this.toggleLinked(), tooltip: this.tooltip, type: captionType, value: label, required: required, htmlFor: _id }), h$1(InputTemplate, { id: _id, type: type, value: value, pattern: this.pattern, placeholder: placeholder, disabled: disabled, readonly: readonly, clearable: isActiveClearable, passwordToggle: passwordToggle, isPasswordVisible: isPasswordVisible, noDefaultIcon: noDefaultIcon, focused: focused, inValid: inValid, unitPrefix: unitPrefix, maxLength: this.maxLength, internalId: this._internal_id, captionType: captionType, unit: unit, size: size, handleFocus: () => this.handleFocus(), handleBlur: () => this.handleBlur(), handleChange: () => this.handleChange(), handleInput: () => this.handleInput(), steps: (e) => this.stepUpOrDown(e), changePasswordVisibility: () => this.changePasswordVisibility(), handleClear: (e) => this.handleClear(e), eyeDropper: () => this.eyeDropper(), isEyeDropperSupported: () => this.isEyeDropperSupported(), ref: (el) => this.inputElement = el, _suffix: this._suffix, _prefix: this._prefix, autocomplete: autocomplete }), h$1(CaptionTemplate, { noCaption: noCaption, captionType: captionType, captionError: captionError, caption: caption, customErrorMessage: this.customErrorMessage }), type == Bcm.InputType.color &&
1282
+ h$1("bcm-linked", { targetId: this._id + "-container", id: this._id + "-linked" }, h$1("bcm-colorful", { id: this._id + "-picker", color: this.value, onBcmChange: e => this.setValue(e.detail) }))));
1283
+ }
1284
+ static get watchers() { return {
1285
+ "value": ["watchValue"]
1286
+ }; }
1287
+ };
1288
+ __decorate$2([
1289
+ IsLoad()
1290
+ ], BcmInput.prototype, "inputElement", void 0);
1291
+ BcmInput.style = inputCss$1;
1292
+
1293
+ const inputStyle = ce({
1294
+ slots: {
1295
+ host: "bcm-input2 bcm-ui-element tw-inline-flex tw-flex-col tw-w-full tw-max-w-64 tw-mb-2 ",
1296
+ base: "",
1297
+ inputContainer: ["bcm-input2__container", "tw-bg-color-base tw-border tw-border-solid tw-border-color tw-rounded", "tw-flex tw-items-center tw-justify-between tw-gap-2", "tw-px-3"],
1298
+ input: [
1299
+ "bcm-input2-element tw-w-full tw-h-full tw-flex-1 tw-outline-none tw-bg-transparent tw-border-0 tw-appearance-none tw-text-ellipsis",
1300
+ "tw-text-color-default placeholder:tw-text-color-placeholder",
1301
+ "[appearance:textfield][&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
1302
+ ],
1303
+ slotClass: "tw-flex tw-items-center tw-justify-between tw-gap-2 empty:tw-hidden tw-text-color-placeholder",
1304
+ clearButton: ["clear-button tw-cursor-pointer tw-appearance-none tw-border-0 tw-text-color-placeholder tw-text-size-inherit tw-bg-transparent tw-py-1 tw-px-2 -tw-mx-2", "hover:tw-text-color"],
1305
+ controls: "number-controls -tw-mr-3 tw-flex tw-h-full tw-w-fit tw-flex-col tw-items-center tw-justify-between",
1306
+ controlsBtn: [
1307
+ "number-control-button tw-w-7 tw-flex-1 tw-cursor-pointer tw-appearance-none tw-border-0 tw-border-l tw-border-solid tw-border-color tw-bg-transparent tw-p-0 tw-text-2 tw-leading-none tw-text-color-placeholder",
1308
+ ],
1309
+ controlsBtnUp: "number-control-up tw-rounded-tr-[3px]",
1310
+ controlsBtnDown: "number-control-down tw-rounded-br-[3px]",
1311
+ controlsDivider: "number-control-divider tw-h-0 tw-w-full tw-border-0 tw-border-b tw-border-solid tw-border-color",
1312
+ },
1313
+ variants: {
1314
+ size: {
1315
+ small: {
1316
+ host: "bcm-input2__container--small",
1317
+ inputContainer: "input2-size-small tw-h-6",
1318
+ input: "tw-text-2",
1319
+ },
1320
+ medium: {
1321
+ host: "bcm-input2__container--medium",
1322
+ inputContainer: "input2-size-medium tw-h-8",
1323
+ input: "tw-text-3",
1324
+ },
1325
+ large: {
1326
+ host: "bcm-input2__container--large",
1327
+ inputContainer: "input2-size-large tw-h-10",
1328
+ input: "tw-text-4",
1329
+ },
1330
+ },
1331
+ fullWidth: {
1332
+ true: {
1333
+ host: "full-width tw-max-w-full",
1334
+ },
1335
+ },
1336
+ noMargin: {
1337
+ true: {
1338
+ host: "no-margin tw-mb-0",
1339
+ },
1340
+ },
1341
+ hidden: {
1342
+ true: {
1343
+ host: "hidden tw-hidden",
1344
+ },
1345
+ },
1346
+ focused: {
1347
+ true: {
1348
+ host: "focused",
1349
+ },
1350
+ },
1351
+ clearable: {
1352
+ true: {
1353
+ host: "clearable",
1354
+ },
1355
+ },
1356
+ disabled: {
1357
+ true: {
1358
+ host: "disabled",
1359
+ input: "",
1360
+ inputContainer: "tw-bg-color-disabled tw-border-color-disabled tw-text-color-disabled tw-cursor-not-allowed",
1361
+ controlsBtn: "tw-pointer-events-none",
1362
+ },
1363
+ false: {
1364
+ controlsBtn: "hover:tw-bg-color-base-hover hover:tw-text-color",
1365
+ inputContainer: ["has-[:not([disabled]):focus]:tw-ring", "has-[:not([disabled]):hover]:tw-border-color-primaryInfo"],
1366
+ },
1367
+ },
1368
+ readonly: {
1369
+ true: {
1370
+ host: "readonly",
1371
+ },
1372
+ },
1373
+ invalid: {
1374
+ true: {
1375
+ host: "invalid",
1376
+ inputContainer: "tw-border-color-error has-[:not([disabled]):focus]:tw-ring-color-error has-[:not([disabled]):hover]:!tw-border-color-error",
1377
+ },
1378
+ },
1379
+ unit: {
1380
+ true: {
1381
+ host: "unit",
1382
+ },
1383
+ },
1384
+ error: {
1385
+ true: {
1386
+ host: "error",
1387
+ inputContainer: "tw-border-color-error",
1388
+ },
1389
+ },
1390
+ },
1391
+ defaultVariants: {
1392
+ size: "medium",
1393
+ noMargin: false,
1394
+ fullWidth: false,
1395
+ hidden: false,
1396
+ focused: false,
1397
+ clearable: false,
1398
+ disabled: false,
1399
+ readonly: false,
1400
+ invalid: false,
1401
+ unit: false,
1402
+ error: false,
1403
+ },
1404
+ });
1405
+
1406
+ const inputCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}.bcm-input[no-margin]{margin:0}.bcm-textarea[no-margin]{margin:0}.bcm-switch[no-margin]{margin:0}.bcm-checkbox[no-margin]{margin:0}.bcm-radio-group[no-margin]{margin:0}.bcm-checkbox-group[no-margin]{margin:0}.bcm-range[no-margin]{margin:0}.bcm-form[no-margin]{margin:0}.bcm-form-group[no-margin]{margin:0}.bcm-list[no-margin]{margin:0}.bcm-colorpicker[no-margin]{margin:0}.bcm-date-picker[no-margin]{margin:0}.bcm-time-picker[no-margin]{margin:0}.bcm-datetime-picker[no-margin]{margin:0}.bcm-select[no-margin]{margin:0}.bcm-listbox[no-margin]{margin:0}*{box-sizing:border-box}.bcm-input{display:inline-flex;flex-direction:column;width:100%;max-width:256px;margin-bottom:8px}.bcm-input.full-width{max-width:100%}.bcm-input.hidden{display:none}.bcm-input__container{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:flex;align-items:stretch;flex-direction:row;background-color:var(--bcm-new-ds-color-white);border:1px solid var(--bcm-new-ds-color-slate-300);border-radius:4px;box-sizing:border-box;cursor:text;padding:0 0 0 4px;position:relative;width:100%}.bcm-input__container.disabled{background-color:var(--bcm-new-ds-color-slate-50);cursor:not-allowed}.bcm-input__container.disabled .bcm-input-element{color:var(--bcm-new-ds-color-slate-500)}.bcm-input__container.readonly{background-color:var(--bcm-new-ds-color-slate-50);cursor:default}.bcm-input__container.readonly .bcm-input-element{color:var(--bcm-new-ds-color-slate-600)}.bcm-input__container:not(.disabled):hover .caret-container,.bcm-input__container:not(.disabled).focused .caret-container{opacity:1}.bcm-input__container:not(.disabled):hover .input-clear-button,.bcm-input__container:not(.disabled).focused .input-clear-button{opacity:1}.bcm-input__container:not(.disabled).focused{background-color:var(--bcm-new-ds-color-slate-50)}.bcm-input__container:not(.disabled):hover{border-color:var(--bcm-color-prime-blue-6)}.bcm-input__container.empty .input-clear-button{display:none}.bcm-input__container.invalid,.bcm-input__container.error{border-color:var(--bcm-new-ds-color-red-500)}.bcm-input__container .bcm-input-element{width:100%;color:var(--bcm-new-ds-color-slate-600);flex:1;border:none;background:transparent;box-shadow:unset;padding:0 4px;font-family:\"Inter\", sans-serif;cursor:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;text-overflow:ellipsis}.bcm-input__container .bcm-input-element::placeholder{font-family:\"Inter\", sans-serif;color:var(--bcm-new-ds-color-slate-300);user-select:none}.bcm-input__container .bcm-input-element::-webkit-search-decoration,.bcm-input__container .bcm-input-element::-webkit-search-cancel-button,.bcm-input__container .bcm-input-element::-webkit-search-results-button,.bcm-input__container .bcm-input-element::-webkit-search-results-decoration,.bcm-input__container .bcm-input-element::-webkit-calendar-picker-indicator,.bcm-input__container .bcm-input-element::-webkit-inner-spin-button,.bcm-input__container .bcm-input-element::-webkit-outer-spin-button{-webkit-appearance:none}.bcm-input__container .caret-container{width:30px;display:flex;flex-direction:column;justify-content:center;align-items:stretch;border-left:1px solid #D9D9D9;transition:0.2s opacity;user-select:none;box-sizing:border-box}.bcm-input__container .caret-container .bcm-input-caret{display:flex;align-items:center;justify-content:center;color:var(--bcm-color-grey-7);cursor:pointer;flex:1}.bcm-input__container .caret-container .bcm-input-caret bcm-icon{line-height:1}.bcm-input__container .caret-container .bcm-input-caret:hover{color:var(--bcm-color-prime-blue-6)}.bcm-input__container .caret-container .bcm-input-caret:active{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container .bcm-input-caret:last-child{border-top:1px solid #D9D9D9}.bcm-input__container .caret-container.disabled{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container.disabled .bcm-input-caret{cursor:not-allowed}.bcm-input__container .input-suffix-content{display:flex;align-items:center;justify-content:center}.bcm-input__container .input-prefix:not(:empty){padding-left:4px}.bcm-input__container .input-suffix:not(:empty){min-width:24px;padding-right:4px}.bcm-input__container .input-prefix:not(:empty),.bcm-input__container .input-suffix:not(:empty){display:flex;align-items:center;justify-content:center;cursor:default;color:#64748a}.bcm-input__container .input-prefix:not(:empty) .unit-prefix,.bcm-input__container .input-suffix:not(:empty) .unit-prefix{color:#64748a}.bcm-input__container .input-prefix-button:not(:empty),.bcm-input__container .input-suffix-button:not(:empty){cursor:pointer}.bcm-input__container .caret-container,.bcm-input__container .input-clear-button{opacity:0}.bcm-input__container--small{font-size:12px}.bcm-input__container--medium{font-size:14px}.bcm-input__container--large{font-size:16px}.bcm-input__textarea.clearable .bcm-input-element{padding-right:24px}.bcm-input__textarea .input-clear-button{position:absolute;top:4px;right:0}";
1407
+
1408
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1409
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1410
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1411
+ r = Reflect.decorate(decorators, target, key, desc);
1412
+ else
1413
+ for (var i = decorators.length - 1; i >= 0; i--)
1414
+ if (d = decorators[i])
1415
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1416
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1417
+ };
1418
+ const BcmInput2 = class {
1419
+ constructor(hostRef) {
1420
+ registerInstance(this, hostRef);
1421
+ this.focus = createEvent(this, "bcm-focus", 7);
1422
+ this.blur = createEvent(this, "bcm-blur", 7);
1423
+ this.clear = createEvent(this, "bcm-clear", 7);
1424
+ this.change = createEvent(this, "bcm-change", 7);
1425
+ this.input = createEvent(this, "bcm-input", 7);
1426
+ this._id = Generate.UID();
1427
+ this._internal_id = Generate.UID();
1428
+ this.value = "";
1429
+ this.size = Bcm.Size.medium;
1430
+ this.label = undefined;
1431
+ this.pattern = undefined;
1432
+ this.tooltip = undefined;
1433
+ this.placeholder = undefined;
1434
+ this.disabled = false;
1435
+ this.readonly = false;
1436
+ this.clearable = false;
1437
+ this.autocomplete = false;
1438
+ this.name = undefined;
1439
+ this.type = Bcm.InputType.text;
1440
+ this.hidden = false;
1441
+ this.required = false;
1442
+ this.fullWidth = false;
1443
+ this.noDefaultIcon = undefined;
1444
+ this.disableWatchValue = false;
1445
+ this.passwordToggle = false;
1446
+ this.maxLength = null;
1447
+ this.minLength = null;
1448
+ this.unitPrefix = null;
1449
+ this.unit = undefined;
1450
+ this.decimal = true;
1451
+ this.min = undefined;
1452
+ this.max = undefined;
1453
+ this.step = undefined;
1454
+ this.caption = undefined;
1455
+ this.noCaption = false;
1456
+ this.captionType = Bcm.Status.default;
1457
+ this.captionError = undefined;
1458
+ this.customErrorMessage = undefined;
1459
+ this._prefix = undefined;
1460
+ this._suffix = undefined;
1461
+ this.captionCache = undefined;
1462
+ this.captionTypeCache = undefined;
1463
+ this.inValid = false;
1464
+ this.valueCache = "";
1465
+ this.focused = false;
1466
+ this.isPasswordVisible = false;
1467
+ }
1468
+ async onBcmFocus() {
1469
+ this.inputElement.focus();
1470
+ }
1471
+ async onBcmBlur() {
1472
+ this.inputElement.blur();
1473
+ }
1474
+ async onBcmSelect() {
1475
+ this.inputElement.select();
1476
+ }
1477
+ handleClear(e) {
1478
+ this.inputElement.value = "";
1479
+ this.value = "";
1480
+ this.inputElement.focus();
1481
+ this.clear.emit(e);
1482
+ this.change.emit(this.value);
1483
+ e.stopPropagation();
1484
+ }
1485
+ handleInput(_e) {
1486
+ this.value = this.inputElement.value;
1487
+ this.input.emit(this.value);
1488
+ this.change.emit(this.value);
1489
+ }
1490
+ handleChange(_e) {
1491
+ this.value = this.inputElement.value;
1492
+ this.change.emit(this.value);
1493
+ }
1494
+ handleFocus(e) {
1495
+ this.focused = true;
1496
+ this.focus.emit(e);
1497
+ }
1498
+ handleBlur(e) {
1499
+ this.focused = false;
1500
+ this.blur.emit(e);
1501
+ }
1502
+ handleKeyUp(e) {
1503
+ if (e.key === "Enter") {
1504
+ this.blur.emit(e);
1505
+ }
1506
+ }
1507
+ render() {
1508
+ const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable,
1509
+ // passwordToggle,
1510
+ // isPasswordVisible,
1511
+ // noDefaultIcon,
1512
+ unit, inValid, focused,
1513
+ // unitPrefix,
1514
+ noCaption, required, hidden, _id, autocomplete, _prefix, _suffix, } = this;
1515
+ const isActiveClearable = (value === null || value === void 0 ? void 0 : value.length) > 0 && clearable;
1516
+ const { host, inputContainer, input, slotClass, clearButton, controls, controlsBtn, controlsBtnDown, controlsBtnUp, controlsDivider } = inputStyle({
1517
+ size,
1518
+ fullWidth,
1519
+ // şüpheli kısımlar
1520
+ focused: focused,
1521
+ clearable: isActiveClearable,
1522
+ disabled,
1523
+ readonly,
1524
+ invalid: inValid,
1525
+ unit: (unit === null || unit === void 0 ? void 0 : unit.length) > 0,
1526
+ // 'empty': value?.length < 1,
1527
+ error: captionType === "error",
1528
+ hidden,
1529
+ });
1530
+ return (h$1(Host, { class: host(), onClick: () => this.onBcmFocus() }, label && h$1("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required, htmlFor: _id }), h$1("div", { class: inputContainer() }, h$1("div", { class: slotClass() }, h$1("slot", { name: "prefix" }, _prefix && _prefix.length > 0 && h$1("span", { innerHTML: _prefix }))), h$1("input", { class: input(), id: _id, type: type, value: value, pattern: this.pattern, placeholder: placeholder, disabled: disabled, readonly: readonly, ref: el => (this.inputElement = el), onInput: event => this.handleInput(event), onChange: event => this.handleChange(event), onFocus: event => this.handleFocus(event), onBlur: event => this.handleBlur(event), onKeyUp: event => this.handleKeyUp(event), autoComplete: autocomplete ? "on" : "off", required: required }), h$1("div", { class: slotClass() }, isActiveClearable && (h$1("button", { type: "button", class: clearButton(), onClick: event => this.handleClear(event) }, h$1("i", { class: "far fa-times" }))), h$1("slot", { name: "suffix" }, _suffix && _suffix.length > 0 && h$1("span", { innerHTML: _suffix })), type === "number" && (h$1("div", { class: controls() }, h$1("button", { type: "button", onClick: () => this.onBcmFocus(), class: classnames(controlsBtn(), controlsBtnUp()) }, h$1("i", { class: "fas fa-caret-up" })), h$1("div", { class: controlsDivider() }), h$1("button", { type: "button", onClick: () => this.onBcmFocus(), class: classnames(controlsBtn(), controlsBtnDown()) }, h$1("i", { class: "fas fa-caret-down" })))))), h$1(CaptionTemplate, { noCaption: noCaption, captionType: captionType, captionError: captionError, caption: caption, customErrorMessage: this.customErrorMessage })));
1531
+ }
1532
+ };
1533
+ __decorate$1([
1534
+ IsLoad()
1535
+ ], BcmInput2.prototype, "inputElement", void 0);
1536
+ BcmInput2.style = inputCss;
1537
+
1538
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1539
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1540
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1541
+ r = Reflect.decorate(decorators, target, key, desc);
1542
+ else
1543
+ for (var i = decorators.length - 1; i >= 0; i--)
1544
+ if (d = decorators[i])
1545
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1546
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1547
+ };
1548
+ const BcmLabel = class {
1549
+ constructor(hostRef) {
1550
+ registerInstance(this, hostRef);
1551
+ this._id = Generate.UID();
1552
+ this.required = false;
1553
+ this.value = undefined;
1554
+ this.label = undefined;
1555
+ this.size = "medium";
1556
+ this.form = undefined;
1557
+ this.htmlFor = undefined;
1558
+ this.hidden = false;
1559
+ this.type = Bcm.Status.default;
1560
+ this.tooltip = undefined;
1561
+ }
1562
+ render() {
1563
+ const { required, value, label, size, form, htmlFor, type, tooltip } = this;
1564
+ return (h$1(Host, { class: "tw-inline-block tw-leading-none" }, h$1(LabelTemplate, { form: form, htmlFor: htmlFor, value: value || label, size: size, type: type, required: required, tooltip: tooltip })));
1565
+ }
1566
+ get el() { return getElement(this); }
1567
+ };
1568
+ __decorate([
1569
+ IsLoad()
1570
+ ], BcmLabel.prototype, "el", void 0);
1571
+
1572
+ const BcmLinked = class {
1573
+ constructor(hostRef) {
1574
+ registerInstance(this, hostRef);
1575
+ this.bcmOpen = createEvent(this, "bcm-open", 7);
1576
+ this._id = Generate.UID();
1577
+ this.placement = Bcm$1.Placement["bottom-start"];
1578
+ this.trigger = Bcm$1.TriggerType.click;
1579
+ this.targetId = "";
1580
+ this.height = undefined;
1581
+ this.maxHeight = undefined;
1582
+ this.minHeight = "50px";
1583
+ this.isOpen = false;
1584
+ this.hideDelay = 500;
1585
+ this.moveOverLayContainer = false;
1586
+ this.isMouseOverLink = false;
1587
+ window.addEventListener("scroll", () => this.calculatePosition(), true);
1588
+ window.addEventListener("wheel", () => this.calculatePosition(), true);
1589
+ window.addEventListener("resize", () => this.calculatePosition(), true);
1590
+ }
1591
+ target() {
1592
+ const target = document.querySelectorAll(`[id="${this.targetId}"]`);
1593
+ if (target.length > 0) {
1594
+ target.length > 1 && console.warn(`[bcm-linked] - Target id "${this.targetId}" is duplicated`);
1595
+ return target[0];
1596
+ }
1597
+ else {
1598
+ // console.warn(`[bcm-linked] - id="${this._id}" was removed from the dom because id="${this.targetId}" could not be found.`);
1599
+ this.el.remove();
1600
+ return null;
1601
+ }
1602
+ }
1603
+ detectClone() {
1604
+ const linked = document.querySelectorAll(`[target-id="${this.targetId}"]`);
1605
+ if (linked.length > 0) {
1606
+ linked.forEach((item) => {
1607
+ if (item.id !== this._id) {
1608
+ console.warn(`[bcm-linked] - id="${this._id}" was removed from the dom because id="${this.targetId}" is duplicated.`);
1609
+ item.remove();
1610
+ }
1611
+ });
1612
+ }
1613
+ }
1614
+ dismissEvent() {
1615
+ document.dispatchEvent(new CustomEvent("linked-data-dismiss", { detail: { id: this._id } }));
1616
+ }
1617
+ checkDataDismiss(e) {
1618
+ Generate.findEventPathHasAttribute(e, "data-dismiss") && this.dismissEvent();
1619
+ }
1620
+ hideChildLinked() {
1621
+ this.el.querySelectorAll("[is-linked][linked-is-open]").forEach(item => {
1622
+ var _a;
1623
+ (_a = document.querySelector(`#${item.getAttribute("is-linked")}[is-open]`)) === null || _a === void 0 ? void 0 : _a.hide(false);
1624
+ });
1625
+ }
1626
+ calculatePosition() {
1627
+ const el = this.el;
1628
+ if (el && this.target()) {
1629
+ if (this.isOpen) {
1630
+ FloatingUI({
1631
+ ref: this.target(),
1632
+ floating: el,
1633
+ placement: this.placement,
1634
+ offset: 4,
1635
+ autoHidden: el.getAttribute("main-linked") === "true" ? false : true,
1636
+ autoSize: true,
1637
+ style: {
1638
+ height: this.height,
1639
+ maxHeight: this.maxHeight,
1640
+ minHeight: this.minHeight,
1641
+ },
1642
+ });
1643
+ }
1644
+ else {
1645
+ el.style.visibility = "hidden";
1646
+ el.style.opacity = "0";
1647
+ }
1648
+ }
1649
+ }
1650
+ init() {
1651
+ const target = this.target();
1652
+ this.trigger === Bcm$1.TriggerType.hover && this.listenMouseOver();
1653
+ if (target) {
1654
+ target.setAttribute("is-linked", this.el.id);
1655
+ if (!Generate.getAncestor(target, "bcm-linked")) {
1656
+ this.el.setAttribute("main-linked", "true");
1657
+ }
1658
+ else {
1659
+ this.el.removeAttribute("main-linked");
1660
+ }
1661
+ if (this.moveOverLayContainer) {
1662
+ const bcmOverlayContainer = document.querySelector("#bcm-overlay-container");
1663
+ bcmOverlayContainer.appendChild(this.el);
1664
+ }
1665
+ }
1666
+ }
1667
+ componentDidLoad() {
1668
+ this.init();
1669
+ }
1670
+ triggerWatch(newValue) {
1671
+ if (newValue === Bcm$1.TriggerType.hover) {
1672
+ this.listenMouseOver();
1673
+ }
1674
+ }
1675
+ watchIsOpen() {
1676
+ this.bcmOpen.emit(this.isOpen);
1677
+ }
1678
+ onLinkedDataDismis() {
1679
+ this.hide(false);
1680
+ }
1681
+ onBcmFloatingIsHide(e) {
1682
+ if (e.detail.id === this._id) {
1683
+ this.hide(false);
1684
+ }
1685
+ }
1686
+ async show(wait = true) {
1687
+ wait && (await delay(50));
1688
+ this.detectClone();
1689
+ const target = this.target();
1690
+ if (target) {
1691
+ const bcmOverlayContainer = document.querySelector("#bcm-overlay-container");
1692
+ bcmOverlayContainer.appendChild(this.el);
1693
+ target.setAttribute("linked-is-open", "true");
1694
+ this.isOpen = true;
1695
+ this.calculatePosition();
1696
+ }
1697
+ else {
1698
+ this.hide(false);
1699
+ }
1700
+ return this.isOpen;
1701
+ }
1702
+ async hide(wait = true) {
1703
+ wait && (await delay(50));
1704
+ const target = this.target();
1705
+ this.isMouseOverLink = false;
1706
+ if (target) {
1707
+ target.removeAttribute("linked-is-open");
1708
+ this.hideChildLinked();
1709
+ this.isOpen = false;
1710
+ }
1711
+ return this.isOpen;
1712
+ }
1713
+ async toggle(wait = true) {
1714
+ return this.isOpen ? await this.hide(wait) : await this.show(wait);
1715
+ }
1716
+ clickListener(e) {
1717
+ if (!this.target())
1718
+ return;
1719
+ if (this.trigger === Bcm$1.TriggerType.hover || this.trigger === Bcm$1.TriggerType.custom)
1720
+ return;
1721
+ const isTarget = Generate.findEventPath(e, this.target());
1722
+ const isSelf = Generate.findEventPath(e, this.el);
1723
+ const isLinked = Generate.findEventPathWithNodeName(e, "BCM-LINKED");
1724
+ if (!isTarget && !isSelf && !isLinked) {
1725
+ this.hide();
1726
+ this.bcmOpen.emit(this.isOpen);
1727
+ return;
1728
+ }
1729
+ if (this.isOpen) {
1730
+ isTarget && this.hide(false);
1731
+ isSelf && this.checkDataDismiss(e);
1732
+ if (this.el.getAttribute("main-linked") === "true" && !isTarget && !isSelf && !isLinked) {
1733
+ this.dismissEvent();
1734
+ }
1735
+ }
1736
+ else {
1737
+ isTarget && this.show(false);
1738
+ }
1739
+ }
1740
+ listenMouseOver() {
1741
+ var _a, _b;
1742
+ this.el.addEventListener("mouseover", () => (this.isMouseOverLink = true));
1743
+ this.el.addEventListener("mouseleave", () => {
1744
+ this.isMouseOverLink = false;
1745
+ this.handleMouseLeave();
1746
+ });
1747
+ (_a = this.target()) === null || _a === void 0 ? void 0 : _a.addEventListener("mouseenter", this.handleMouseEnter.bind(this));
1748
+ (_b = this.target()) === null || _b === void 0 ? void 0 : _b.addEventListener("mouseleave", this.handleMouseLeave.bind(this));
1749
+ }
1750
+ handleMouseLeave() {
1751
+ setTimeout(() => {
1752
+ !this.isMouseOverLink && this.hide();
1753
+ }, this.hideDelay);
1754
+ }
1755
+ handleMouseEnter() {
1756
+ clearTimeout(this.timeoutId);
1757
+ this.isMouseOverLink = false;
1758
+ this.show();
1759
+ }
1760
+ render() {
1761
+ const openStyle = this.isOpen ? { visibility: "visible", opacity: "1" } : { visibility: "hidden", opacity: "0" };
1762
+ return (h$1(Host, { class: "tw-invisible tw-absolute tw-left-0 tw-top-0 tw-z-tooltip tw-block tw-overscroll-contain tw-scroll-smooth tw-rounded tw-bg-white tw-opacity-0 tw-shadow tw-transition-opacity tw-duration-100", style: Object.assign(Object.assign({}, openStyle), { overflow: "auto" }) }, h$1("slot", null)));
1763
+ }
1764
+ get el() { return getElement(this); }
1765
+ static get watchers() { return {
1766
+ "trigger": ["triggerWatch"],
1767
+ "isOpen": ["watchIsOpen"]
1768
+ }; }
1769
+ };
1770
+
1771
+ const NumberInput = class {
1772
+ constructor(hostRef) {
1773
+ registerInstance(this, hostRef);
1774
+ this.focus = createEvent(this, "bcm-focus", 3);
1775
+ this.blur = createEvent(this, "bcm-blur", 3);
1776
+ this.clear = createEvent(this, "bcm-clear", 3);
1777
+ this.change = createEvent(this, "bcm-change", 7);
1778
+ this.input = createEvent(this, "bcm-input", 3);
1779
+ this.beforeClear = createEvent(this, "bcm-input-before-clear", 3);
1780
+ this._onChange = createEvent(this, "bcm-onchange", 3);
1781
+ this.inValid = false;
1782
+ this.onInput = () => {
1783
+ var _a;
1784
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.addEventListener("input", (e) => {
1785
+ this.input.emit(e);
1786
+ });
1787
+ };
1788
+ this.onChange = () => {
1789
+ var _a;
1790
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.addEventListener("change", (e) => {
1791
+ this.change.emit(e);
1792
+ });
1793
+ };
1794
+ this.onFocus = () => {
1795
+ var _a;
1796
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.addEventListener("focus", e => {
1797
+ this.isFocus = true;
1798
+ this.focus.emit(e);
1799
+ });
1800
+ };
1801
+ this.onBlur = () => {
1802
+ var _a;
1803
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.addEventListener("blur", e => {
1804
+ this.isFocus = false;
1805
+ this.blur.emit(e);
1806
+ });
1807
+ };
1808
+ this.onKeydown = () => {
1809
+ var _a;
1810
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.addEventListener("keydown", (e) => {
1811
+ if (e.key === "ArrowUp") {
1812
+ e.preventDefault();
1813
+ this.up();
1814
+ }
1815
+ if (e.key === "ArrowDown") {
1816
+ e.preventDefault();
1817
+ this.down();
1818
+ }
1819
+ });
1820
+ };
1821
+ this.listener = () => {
1822
+ this.onInput();
1823
+ this.onChange();
1824
+ this.onFocus();
1825
+ this.onBlur();
1826
+ this.onKeydown();
1827
+ };
1828
+ this._id = Generate.UID();
1829
+ this.value = "";
1830
+ this.defaultValue = undefined;
1831
+ this._prefix = undefined;
1832
+ this._suffix = undefined;
1833
+ this.size = "medium";
1834
+ this.min = undefined;
1835
+ this.max = undefined;
1836
+ this.step = 1;
1837
+ this.label = undefined;
1838
+ this.name = undefined;
1839
+ this.fullWidth = false;
1840
+ this.clearable = false;
1841
+ this.readonly = false;
1842
+ this.disabled = false;
1843
+ this.required = false;
1844
+ this.mode = "none";
1845
+ this.placeholder = undefined;
1846
+ this.thousandSeparator = false;
1847
+ this.decimalSeparator = undefined;
1848
+ this.decimalScale = undefined;
1849
+ this.fixedDecimalScale = false;
1850
+ this.allowNegative = false;
1851
+ this.allowLeadingZeros = false;
1852
+ this.unitPrefix = undefined;
1853
+ this.unitSuffix = undefined;
1854
+ this.caption = undefined;
1855
+ this.noCaption = false;
1856
+ this.captionType = Bcm$1.Status.default;
1857
+ this.captionError = undefined;
1858
+ this.customErrorMessage = undefined;
1859
+ this.isFocus = false;
1860
+ this.captionCache = undefined;
1861
+ this.captionTypeCache = undefined;
1862
+ this.valueCache = "";
1863
+ }
1864
+ connectedCallback() {
1865
+ if (this.defaultValue)
1866
+ this.value = +this.defaultValue;
1867
+ this.valueCache = this.value;
1868
+ this.captionCache = this.caption;
1869
+ this.captionTypeCache = this.captionType;
1870
+ }
1871
+ componentDidLoad() {
1872
+ this.listener();
1873
+ }
1874
+ up() {
1875
+ if (this.disabled)
1876
+ return;
1877
+ if (!this.value)
1878
+ this.value = Number(0);
1879
+ this.value = +this.value + +this.step;
1880
+ if (this.mode === "strict") {
1881
+ if (this.max && +this.value > +this.max) {
1882
+ this.value = this.max;
1883
+ }
1884
+ }
1885
+ }
1886
+ down() {
1887
+ if (this.disabled)
1888
+ return;
1889
+ if (!this.value)
1890
+ this.value = Number(0);
1891
+ this.value = +this.value - +this.step;
1892
+ if (this.mode === "strict") {
1893
+ if (this.min && +this.value < +this.min) {
1894
+ this.value = this.min;
1895
+ }
1896
+ }
1897
+ }
1898
+ handleClear(e) {
1899
+ if (this.disabled)
1900
+ return;
1901
+ const event = this.beforeClear.emit(e);
1902
+ if (event.defaultPrevented)
1903
+ return;
1904
+ this.value = "";
1905
+ this.clear.emit(e);
1906
+ }
1907
+ checkLength() {
1908
+ const { min, max, value } = this;
1909
+ const minLength = min;
1910
+ const maxLength = max;
1911
+ let valuePoint = value === null || value === void 0 ? void 0 : value.toString();
1912
+ if (min && max) {
1913
+ if (+valuePoint < +min || +valuePoint > +max) {
1914
+ this.setCaption(StringHelper.getMessage("betweenlength", [minLength, maxLength]), "error");
1915
+ this.inValid = true;
1916
+ }
1917
+ else {
1918
+ this.setCaption();
1919
+ this.inValid = false;
1920
+ }
1921
+ }
1922
+ else if (minLength) {
1923
+ if (+valuePoint < +minLength) {
1924
+ this.setCaption(StringHelper.getMessage("minlength", [minLength]), "error");
1925
+ this.inValid = true;
1926
+ }
1927
+ else {
1928
+ this.setCaption();
1929
+ this.inValid = false;
1930
+ }
1931
+ }
1932
+ else if (maxLength) {
1933
+ if (valuePoint > maxLength) {
1934
+ this.setCaption(StringHelper.getMessage("maxlength", [maxLength]), "error");
1935
+ this.inValid = true;
1936
+ }
1937
+ else {
1938
+ this.setCaption();
1939
+ this.inValid = false;
1940
+ }
1941
+ }
1942
+ }
1943
+ watchValue() {
1944
+ this.checkLength();
1945
+ }
1946
+ async onBcmFocus() {
1947
+ this.inputElement.focus();
1948
+ }
1949
+ async onBcmBlur() {
1950
+ this.inputElement.blur();
1951
+ }
1952
+ async onBcmSelect() {
1953
+ this.inputElement.select();
1954
+ }
1955
+ async set(data) {
1956
+ await this.setValue(data);
1957
+ }
1958
+ async get() {
1959
+ return this.value || null;
1960
+ }
1961
+ async setValue(value) {
1962
+ this.value = value;
1963
+ }
1964
+ async setClear() {
1965
+ this.value = null;
1966
+ await delay(10);
1967
+ return Promise.resolve();
1968
+ }
1969
+ async resetCaption() {
1970
+ await delay(10);
1971
+ this.caption = this.captionCache;
1972
+ this.captionType = this.captionTypeCache;
1973
+ this.captionError = null;
1974
+ this.inValid = false;
1975
+ await delay(10);
1976
+ return Promise.resolve();
1977
+ }
1978
+ setCaption(caption = null, captionType = null) {
1979
+ this.caption = caption || this.captionCache;
1980
+ this.captionType = captionType || this.captionTypeCache;
1981
+ this.captionError = captionType == "error" ? caption : null;
1982
+ return Promise.resolve();
1983
+ }
1984
+ disconnectedCallback() {
1985
+ var _a, _b, _c, _d, _e;
1986
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.removeEventListener("input", this.onInput.bind(this));
1987
+ (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.removeEventListener("change", this.onChange.bind(this));
1988
+ (_c = this.inputElement) === null || _c === void 0 ? void 0 : _c.removeEventListener("focus", this.onFocus.bind(this));
1989
+ (_d = this.inputElement) === null || _d === void 0 ? void 0 : _d.removeEventListener("blur", this.onBlur.bind(this));
1990
+ (_e = this.inputElement) === null || _e === void 0 ? void 0 : _e.removeEventListener("keydown", this.onKeydown.bind(this));
1991
+ }
1992
+ render() {
1993
+ const { _prefix, _suffix, noCaption, captionType, captionError, caption, required, _id, label, size, fullWidth, clearable, value, placeholder, thousandSeparator, decimalSeparator, decimalScale, fixedDecimalScale, allowNegative, allowLeadingZeros, unitPrefix, unitSuffix, min, max, step, defaultValue, disabled, mode, } = this;
1994
+ const isActiveClearable = (value === null || value === void 0 ? void 0 : value.toString().length) > 0 && clearable;
1995
+ const isInvalid = this.captionType == "error" || this.inValid;
1996
+ const { host, inputContainer, slotClass, clearButton, controls, controlsBtn, controlsBtnDown, controlsBtnUp, controlsDivider, input } = inputStyle({
1997
+ size,
1998
+ fullWidth,
1999
+ clearable: isActiveClearable,
2000
+ disabled,
2001
+ invalid: isInvalid,
2002
+ });
2003
+ const numericProps = {
2004
+ placeholder,
2005
+ thousandSeparator,
2006
+ decimalSeparator,
2007
+ decimalScale,
2008
+ fixedDecimalScale,
2009
+ allowNegative,
2010
+ allowLeadingZeros,
2011
+ prefix: unitPrefix,
2012
+ suffix: unitSuffix,
2013
+ };
2014
+ /* input props */
2015
+ const inputProps = {
2016
+ min,
2017
+ max,
2018
+ step,
2019
+ value,
2020
+ defaultValue,
2021
+ };
2022
+ const generalProps = Object.assign(Object.assign(Object.assign({ "id": _id + "-base-input", "name": this.name, disabled,
2023
+ mode, "aria-label": label, "aria-labelledby": _id + "-label", "getInputRef": el => {
2024
+ this.inputElement = el;
2025
+ }, "className": input() }, numericProps), inputProps), { "onValueChange": (e) => {
2026
+ const { floatValue } = e;
2027
+ this.value = floatValue;
2028
+ this._onChange.emit(e);
2029
+ } });
2030
+ return (h$1(Host, { class: host() }, label && h$1("bcm-label", { size: size, type: captionType, value: label, required: required, htmlFor: _id + "-base-input", id: _id + "-label" }), h$1("div", { class: inputContainer() }, h$1("div", { class: slotClass() }, h$1("slot", { name: "prefix" }, _prefix && _prefix.length > 0 && h$1("span", { innerHTML: _prefix }))), h$1("bcm-react-number", { disabled: disabled, class: "tw-flex-1", options: generalProps }), h$1("div", { class: slotClass() }, !disabled && isActiveClearable && (h$1("button", { class: clearButton(), onClick: event => this.handleClear(event) }, h$1("i", { class: "far fa-times" }))), h$1("slot", { name: "suffix" }, _suffix && _suffix.length > 0 && h$1("span", { innerHTML: _suffix })), h$1("div", { class: controls() }, h$1("button", { type: "button", disabled: disabled, class: classnames(controlsBtn(), controlsBtnUp()), onClick: this.up.bind(this), "aria-label": "Increase value" }, h$1("i", { class: "fas fa-caret-up" })), h$1("div", { class: controlsDivider() }), h$1("button", { type: "button", disabled: disabled, class: classnames(controlsBtn(), controlsBtnDown()), onClick: this.down.bind(this), "aria-label": "Decrease value" }, h$1("i", { class: "fas fa-caret-down" }))))), h$1(CaptionTemplate, { noCaption: noCaption, captionType: captionType, captionError: captionError, caption: caption, customErrorMessage: this.customErrorMessage })));
2031
+ }
2032
+ get el() { return getElement(this); }
2033
+ static get watchers() { return {
2034
+ "value": ["watchValue"]
2035
+ }; }
2036
+ };
2037
+
2038
+ /**
2039
+ * react-number-format - 5.3.1
2040
+ * Author : Sudhanshu Yadav
2041
+ * Copyright (c) 2016, 2023 to Sudhanshu Yadav, released under the MIT license.
2042
+ * https://github.com/s-yadav/react-number-format
2043
+ */
2044
+
2045
+ /******************************************************************************
2046
+ Copyright (c) Microsoft Corporation.
2047
+
2048
+ Permission to use, copy, modify, and/or distribute this software for any
2049
+ purpose with or without fee is hereby granted.
2050
+
2051
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2052
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2053
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2054
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2055
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2056
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2057
+ PERFORMANCE OF THIS SOFTWARE.
2058
+ ***************************************************************************** */
2059
+
2060
+ function __rest$1(s, e) {
2061
+ var t = {};
2062
+ for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2063
+ { t[p] = s[p]; } }
2064
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
2065
+ { for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2066
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2067
+ { t[p[i]] = s[p[i]]; }
2068
+ } }
2069
+ return t;
2070
+ }
2071
+
2072
+ var SourceType;
2073
+ (function (SourceType) {
2074
+ SourceType["event"] = "event";
2075
+ SourceType["props"] = "prop";
2076
+ })(SourceType || (SourceType = {}));
2077
+
2078
+ // basic noop function
2079
+ function noop() { }
2080
+ function memoizeOnce(cb) {
2081
+ var lastArgs;
2082
+ var lastValue = undefined;
2083
+ return function () {
2084
+ var args = [], len = arguments.length;
2085
+ while ( len-- ) args[ len ] = arguments[ len ];
2086
+
2087
+ if (lastArgs &&
2088
+ args.length === lastArgs.length &&
2089
+ args.every(function (value, index) { return value === lastArgs[index]; })) {
2090
+ return lastValue;
2091
+ }
2092
+ lastArgs = args;
2093
+ lastValue = cb.apply(void 0, args);
2094
+ return lastValue;
2095
+ };
2096
+ }
2097
+ function charIsNumber(char) {
2098
+ return !!(char || '').match(/\d/);
2099
+ }
2100
+ function isNil(val) {
2101
+ return val === null || val === undefined;
2102
+ }
2103
+ function isNanValue(val) {
2104
+ return typeof val === 'number' && isNaN(val);
2105
+ }
2106
+ function isNotValidValue(val) {
2107
+ return isNil(val) || isNanValue(val) || (typeof val === 'number' && !isFinite(val));
2108
+ }
2109
+ function escapeRegExp(str) {
2110
+ return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
2111
+ }
2112
+ function getThousandsGroupRegex(thousandsGroupStyle) {
2113
+ switch (thousandsGroupStyle) {
2114
+ case 'lakh':
2115
+ return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
2116
+ case 'wan':
2117
+ return /(\d)(?=(\d{4})+(?!\d))/g;
2118
+ case 'thousand':
2119
+ default:
2120
+ return /(\d)(?=(\d{3})+(?!\d))/g;
2121
+ }
2122
+ }
2123
+ function applyThousandSeparator(str, thousandSeparator, thousandsGroupStyle) {
2124
+ var thousandsGroupRegex = getThousandsGroupRegex(thousandsGroupStyle);
2125
+ var index = str.search(/[1-9]/);
2126
+ index = index === -1 ? str.length : index;
2127
+ return (str.substring(0, index) +
2128
+ str.substring(index, str.length).replace(thousandsGroupRegex, '$1' + thousandSeparator));
2129
+ }
2130
+ function usePersistentCallback(cb) {
2131
+ var callbackRef = react.useRef(cb);
2132
+ // keep the callback ref upto date
2133
+ callbackRef.current = cb;
2134
+ /**
2135
+ * initialize a persistent callback which never changes
2136
+ * through out the component lifecycle
2137
+ */
2138
+ var persistentCbRef = react.useRef(function () {
2139
+ var args = [], len = arguments.length;
2140
+ while ( len-- ) args[ len ] = arguments[ len ];
2141
+
2142
+ return callbackRef.current.apply(callbackRef, args);
2143
+ });
2144
+ return persistentCbRef.current;
2145
+ }
2146
+ //spilt a float number into different parts beforeDecimal, afterDecimal, and negation
2147
+ function splitDecimal(numStr, allowNegative) {
2148
+ if ( allowNegative === void 0 ) allowNegative = true;
2149
+
2150
+ var hasNegation = numStr[0] === '-';
2151
+ var addNegation = hasNegation && allowNegative;
2152
+ numStr = numStr.replace('-', '');
2153
+ var parts = numStr.split('.');
2154
+ var beforeDecimal = parts[0];
2155
+ var afterDecimal = parts[1] || '';
2156
+ return {
2157
+ beforeDecimal: beforeDecimal,
2158
+ afterDecimal: afterDecimal,
2159
+ hasNegation: hasNegation,
2160
+ addNegation: addNegation,
2161
+ };
2162
+ }
2163
+ function fixLeadingZero(numStr) {
2164
+ if (!numStr)
2165
+ { return numStr; }
2166
+ var isNegative = numStr[0] === '-';
2167
+ if (isNegative)
2168
+ { numStr = numStr.substring(1, numStr.length); }
2169
+ var parts = numStr.split('.');
2170
+ var beforeDecimal = parts[0].replace(/^0+/, '') || '0';
2171
+ var afterDecimal = parts[1] || '';
2172
+ return ("" + (isNegative ? '-' : '') + beforeDecimal + (afterDecimal ? ("." + afterDecimal) : ''));
2173
+ }
2174
+ /**
2175
+ * limit decimal numbers to given scale
2176
+ * Not used .fixedTo because that will break with big numbers
2177
+ */
2178
+ function limitToScale(numStr, scale, fixedDecimalScale) {
2179
+ var str = '';
2180
+ var filler = fixedDecimalScale ? '0' : '';
2181
+ for (var i = 0; i <= scale - 1; i++) {
2182
+ str += numStr[i] || filler;
2183
+ }
2184
+ return str;
2185
+ }
2186
+ function repeat(str, count) {
2187
+ return Array(count + 1).join(str);
2188
+ }
2189
+ function toNumericString(num) {
2190
+ var _num = num + ''; // typecast number to string
2191
+ // store the sign and remove it from the number.
2192
+ var sign = _num[0] === '-' ? '-' : '';
2193
+ if (sign)
2194
+ { _num = _num.substring(1); }
2195
+ // split the number into cofficient and exponent
2196
+ var ref = _num.split(/[eE]/g);
2197
+ var coefficient = ref[0];
2198
+ var exponent = ref[1];
2199
+ // covert exponent to number;
2200
+ exponent = Number(exponent);
2201
+ // if there is no exponent part or its 0, return the coffiecient with sign
2202
+ if (!exponent)
2203
+ { return sign + coefficient; }
2204
+ coefficient = coefficient.replace('.', '');
2205
+ /**
2206
+ * for scientific notation the current decimal index will be after first number (index 0)
2207
+ * So effective decimal index will always be 1 + exponent value
2208
+ */
2209
+ var decimalIndex = 1 + exponent;
2210
+ var coffiecientLn = coefficient.length;
2211
+ if (decimalIndex < 0) {
2212
+ // if decimal index is less then 0 add preceding 0s
2213
+ // add 1 as join will have
2214
+ coefficient = '0.' + repeat('0', Math.abs(decimalIndex)) + coefficient;
2215
+ }
2216
+ else if (decimalIndex >= coffiecientLn) {
2217
+ // if decimal index is less then 0 add leading 0s
2218
+ coefficient = coefficient + repeat('0', decimalIndex - coffiecientLn);
2219
+ }
2220
+ else {
2221
+ // else add decimal point at proper index
2222
+ coefficient =
2223
+ (coefficient.substring(0, decimalIndex) || '0') + '.' + coefficient.substring(decimalIndex);
2224
+ }
2225
+ return sign + coefficient;
2226
+ }
2227
+ /**
2228
+ * This method is required to round prop value to given scale.
2229
+ * Not used .round or .fixedTo because that will break with big numbers
2230
+ */
2231
+ function roundToPrecision(numStr, scale, fixedDecimalScale) {
2232
+ //if number is empty don't do anything return empty string
2233
+ if (['', '-'].indexOf(numStr) !== -1)
2234
+ { return numStr; }
2235
+ var shouldHaveDecimalSeparator = (numStr.indexOf('.') !== -1 || fixedDecimalScale) && scale;
2236
+ var ref = splitDecimal(numStr);
2237
+ var beforeDecimal = ref.beforeDecimal;
2238
+ var afterDecimal = ref.afterDecimal;
2239
+ var hasNegation = ref.hasNegation;
2240
+ var floatValue = parseFloat(("0." + (afterDecimal || '0')));
2241
+ var floatValueStr = afterDecimal.length <= scale ? ("0." + afterDecimal) : floatValue.toFixed(scale);
2242
+ var roundedDecimalParts = floatValueStr.split('.');
2243
+ var intPart = beforeDecimal
2244
+ .split('')
2245
+ .reverse()
2246
+ .reduce(function (roundedStr, current, idx) {
2247
+ if (roundedStr.length > idx) {
2248
+ return ((Number(roundedStr[0]) + Number(current)).toString() +
2249
+ roundedStr.substring(1, roundedStr.length));
2250
+ }
2251
+ return current + roundedStr;
2252
+ }, roundedDecimalParts[0]);
2253
+ var decimalPart = limitToScale(roundedDecimalParts[1] || '', scale, fixedDecimalScale);
2254
+ var negation = hasNegation ? '-' : '';
2255
+ var decimalSeparator = shouldHaveDecimalSeparator ? '.' : '';
2256
+ return ("" + negation + intPart + decimalSeparator + decimalPart);
2257
+ }
2258
+ /** set the caret positon in an input field **/
2259
+ function setCaretPosition(el, caretPos) {
2260
+ el.value = el.value;
2261
+ // ^ this is used to not only get 'focus', but
2262
+ // to make sure we don't have it everything -selected-
2263
+ // (it causes an issue in chrome, and having it doesn't hurt any other browser)
2264
+ if (el !== null) {
2265
+ /* @ts-ignore */
2266
+ if (el.createTextRange) {
2267
+ /* @ts-ignore */
2268
+ var range = el.createTextRange();
2269
+ range.move('character', caretPos);
2270
+ range.select();
2271
+ return true;
2272
+ }
2273
+ // (el.selectionStart === 0 added for Firefox bug)
2274
+ if (el.selectionStart || el.selectionStart === 0) {
2275
+ el.focus();
2276
+ el.setSelectionRange(caretPos, caretPos);
2277
+ return true;
2278
+ }
2279
+ // fail city, fortunately this never happens (as far as I've tested) :)
2280
+ el.focus();
2281
+ return false;
2282
+ }
2283
+ }
2284
+ var findChangeRange = memoizeOnce(function (prevValue, newValue) {
2285
+ var i = 0, j = 0;
2286
+ var prevLength = prevValue.length;
2287
+ var newLength = newValue.length;
2288
+ while (prevValue[i] === newValue[i] && i < prevLength)
2289
+ { i++; }
2290
+ //check what has been changed from last
2291
+ while (prevValue[prevLength - 1 - j] === newValue[newLength - 1 - j] &&
2292
+ newLength - j > i &&
2293
+ prevLength - j > i) {
2294
+ j++;
2295
+ }
2296
+ return {
2297
+ from: { start: i, end: prevLength - j },
2298
+ to: { start: i, end: newLength - j },
2299
+ };
2300
+ });
2301
+ /*
2302
+ Returns a number whose value is limited to the given range
2303
+ */
2304
+ function clamp(num, min, max) {
2305
+ return Math.min(Math.max(num, min), max);
2306
+ }
2307
+ function geInputCaretPosition(el) {
2308
+ /*Max of selectionStart and selectionEnd is taken for the patch of pixel and other mobile device caret bug*/
2309
+ return Math.max(el.selectionStart, el.selectionEnd);
2310
+ }
2311
+ function addInputMode() {
2312
+ return (typeof navigator !== 'undefined' &&
2313
+ !(navigator.platform && /iPhone|iPod/.test(navigator.platform)));
2314
+ }
2315
+ function getDefaultChangeMeta(value) {
2316
+ return {
2317
+ from: {
2318
+ start: 0,
2319
+ end: 0,
2320
+ },
2321
+ to: {
2322
+ start: 0,
2323
+ end: value.length,
2324
+ },
2325
+ lastValue: '',
2326
+ };
2327
+ }
2328
+ function defaultIsCharacterSame(ref) {
2329
+ var currentValue = ref.currentValue;
2330
+ var formattedValue = ref.formattedValue;
2331
+ var currentValueIndex = ref.currentValueIndex;
2332
+ var formattedValueIndex = ref.formattedValueIndex;
2333
+
2334
+ return currentValue[currentValueIndex] === formattedValue[formattedValueIndex];
2335
+ }
2336
+ function getCaretPosition(newFormattedValue, lastFormattedValue, curValue, curCaretPos, boundary, isValidInputCharacter,
2337
+ /**
2338
+ * format function can change the character, the caret engine relies on mapping old value and new value
2339
+ * In such case if character is changed, parent can tell which chars are equivalent
2340
+ * Some example, all allowedDecimalCharacters are updated to decimalCharacters, 2nd case if user is coverting
2341
+ * number to different numeric system.
2342
+ */
2343
+ isCharacterSame) {
2344
+ if ( isCharacterSame === void 0 ) isCharacterSame = defaultIsCharacterSame;
2345
+
2346
+ /**
2347
+ * if something got inserted on empty value, add the formatted character before the current value,
2348
+ * This is to avoid the case where typed character is present on format characters
2349
+ */
2350
+ var firstAllowedPosition = boundary.findIndex(function (b) { return b; });
2351
+ var prefixFormat = newFormattedValue.slice(0, firstAllowedPosition);
2352
+ if (!lastFormattedValue && !curValue.startsWith(prefixFormat)) {
2353
+ lastFormattedValue = prefixFormat;
2354
+ curValue = prefixFormat + curValue;
2355
+ curCaretPos = curCaretPos + prefixFormat.length;
2356
+ }
2357
+ var curValLn = curValue.length;
2358
+ var formattedValueLn = newFormattedValue.length;
2359
+ // create index map
2360
+ var addedIndexMap = {};
2361
+ var indexMap = new Array(curValLn);
2362
+ for (var i = 0; i < curValLn; i++) {
2363
+ indexMap[i] = -1;
2364
+ for (var j = 0, jLn = formattedValueLn; j < jLn; j++) {
2365
+ var isCharSame = isCharacterSame({
2366
+ currentValue: curValue,
2367
+ lastValue: lastFormattedValue,
2368
+ formattedValue: newFormattedValue,
2369
+ currentValueIndex: i,
2370
+ formattedValueIndex: j,
2371
+ });
2372
+ if (isCharSame && addedIndexMap[j] !== true) {
2373
+ indexMap[i] = j;
2374
+ addedIndexMap[j] = true;
2375
+ break;
2376
+ }
2377
+ }
2378
+ }
2379
+ /**
2380
+ * For current caret position find closest characters (left and right side)
2381
+ * which are properly mapped to formatted value.
2382
+ * The idea is that the new caret position will exist always in the boundary of
2383
+ * that mapped index
2384
+ */
2385
+ var pos = curCaretPos;
2386
+ while (pos < curValLn && (indexMap[pos] === -1 || !isValidInputCharacter(curValue[pos]))) {
2387
+ pos++;
2388
+ }
2389
+ // if the caret position is on last keep the endIndex as last for formatted value
2390
+ var endIndex = pos === curValLn || indexMap[pos] === -1 ? formattedValueLn : indexMap[pos];
2391
+ pos = curCaretPos - 1;
2392
+ while (pos > 0 && indexMap[pos] === -1)
2393
+ { pos--; }
2394
+ var startIndex = pos === -1 || indexMap[pos] === -1 ? 0 : indexMap[pos] + 1;
2395
+ /**
2396
+ * case where a char is added on suffix and removed from middle, example 2sq345 becoming $2,345 sq
2397
+ * there is still a mapping but the order of start index and end index is changed
2398
+ */
2399
+ if (startIndex > endIndex)
2400
+ { return endIndex; }
2401
+ /**
2402
+ * given the current caret position if it closer to startIndex
2403
+ * keep the new caret position on start index or keep it closer to endIndex
2404
+ */
2405
+ return curCaretPos - startIndex < endIndex - curCaretPos ? startIndex : endIndex;
2406
+ }
2407
+ /* This keeps the caret within typing area so people can't type in between prefix or suffix or format characters */
2408
+ function getCaretPosInBoundary(value, caretPos, boundary, direction) {
2409
+ var valLn = value.length;
2410
+ // clamp caret position to [0, value.length]
2411
+ caretPos = clamp(caretPos, 0, valLn);
2412
+ if (direction === 'left') {
2413
+ while (caretPos >= 0 && !boundary[caretPos])
2414
+ { caretPos--; }
2415
+ // if we don't find any suitable caret position on left, set it on first allowed position
2416
+ if (caretPos === -1)
2417
+ { caretPos = boundary.indexOf(true); }
2418
+ }
2419
+ else {
2420
+ while (caretPos <= valLn && !boundary[caretPos])
2421
+ { caretPos++; }
2422
+ // if we don't find any suitable caret position on right, set it on last allowed position
2423
+ if (caretPos > valLn)
2424
+ { caretPos = boundary.lastIndexOf(true); }
2425
+ }
2426
+ // if we still don't find caret position, set it at the end of value
2427
+ if (caretPos === -1)
2428
+ { caretPos = valLn; }
2429
+ return caretPos;
2430
+ }
2431
+ function caretUnknownFormatBoundary(formattedValue) {
2432
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
2433
+ for (var i = 0, ln = boundaryAry.length; i < ln; i++) {
2434
+ // consider caret to be in boundary if it is before or after numeric value
2435
+ boundaryAry[i] = Boolean(charIsNumber(formattedValue[i]) || charIsNumber(formattedValue[i - 1]));
2436
+ }
2437
+ return boundaryAry;
2438
+ }
2439
+ function useInternalValues(value, defaultValue, valueIsNumericString, format, removeFormatting, onValueChange) {
2440
+ if ( onValueChange === void 0 ) onValueChange = noop;
2441
+
2442
+ var getValues = usePersistentCallback(function (value, valueIsNumericString) {
2443
+ var formattedValue, numAsString;
2444
+ if (isNotValidValue(value)) {
2445
+ numAsString = '';
2446
+ formattedValue = '';
2447
+ }
2448
+ else if (typeof value === 'number' || valueIsNumericString) {
2449
+ numAsString = typeof value === 'number' ? toNumericString(value) : value;
2450
+ formattedValue = format(numAsString);
2451
+ }
2452
+ else {
2453
+ numAsString = removeFormatting(value, undefined);
2454
+ formattedValue = format(numAsString);
2455
+ }
2456
+ return { formattedValue: formattedValue, numAsString: numAsString };
2457
+ });
2458
+ var ref = react.useState(function () {
2459
+ return getValues(isNil(value) ? defaultValue : value, valueIsNumericString);
2460
+ });
2461
+ var values = ref[0];
2462
+ var setValues = ref[1];
2463
+ var _onValueChange = function (newValues, sourceInfo) {
2464
+ if (newValues.formattedValue !== values.formattedValue) {
2465
+ setValues({
2466
+ formattedValue: newValues.formattedValue,
2467
+ numAsString: newValues.value,
2468
+ });
2469
+ }
2470
+ // call parent on value change if only if formatted value is changed
2471
+ onValueChange(newValues, sourceInfo);
2472
+ };
2473
+ // if value is switch from controlled to uncontrolled, use the internal state's value to format with new props
2474
+ var _value = value;
2475
+ var _valueIsNumericString = valueIsNumericString;
2476
+ if (isNil(value)) {
2477
+ _value = values.numAsString;
2478
+ _valueIsNumericString = true;
2479
+ }
2480
+ var newValues = getValues(_value, _valueIsNumericString);
2481
+ react.useMemo(function () {
2482
+ setValues(newValues);
2483
+ }, [newValues.formattedValue]);
2484
+ return [values, _onValueChange];
2485
+ }
2486
+
2487
+ function defaultRemoveFormatting(value) {
2488
+ return value.replace(/[^0-9]/g, '');
2489
+ }
2490
+ function defaultFormat(value) {
2491
+ return value;
2492
+ }
2493
+ function NumberFormatBase(props) {
2494
+ var type = props.type; if ( type === void 0 ) type = 'text';
2495
+ var displayType = props.displayType; if ( displayType === void 0 ) displayType = 'input';
2496
+ var customInput = props.customInput;
2497
+ var renderText = props.renderText;
2498
+ var getInputRef = props.getInputRef;
2499
+ var format = props.format; if ( format === void 0 ) format = defaultFormat;
2500
+ var removeFormatting = props.removeFormatting; if ( removeFormatting === void 0 ) removeFormatting = defaultRemoveFormatting;
2501
+ var defaultValue = props.defaultValue;
2502
+ var valueIsNumericString = props.valueIsNumericString;
2503
+ var onValueChange = props.onValueChange;
2504
+ var isAllowed = props.isAllowed;
2505
+ var onChange = props.onChange; if ( onChange === void 0 ) onChange = noop;
2506
+ var onKeyDown = props.onKeyDown; if ( onKeyDown === void 0 ) onKeyDown = noop;
2507
+ var onMouseUp = props.onMouseUp; if ( onMouseUp === void 0 ) onMouseUp = noop;
2508
+ var onFocus = props.onFocus; if ( onFocus === void 0 ) onFocus = noop;
2509
+ var onBlur = props.onBlur; if ( onBlur === void 0 ) onBlur = noop;
2510
+ var propValue = props.value;
2511
+ var getCaretBoundary = props.getCaretBoundary; if ( getCaretBoundary === void 0 ) getCaretBoundary = caretUnknownFormatBoundary;
2512
+ var isValidInputCharacter = props.isValidInputCharacter; if ( isValidInputCharacter === void 0 ) isValidInputCharacter = charIsNumber;
2513
+ var isCharacterSame = props.isCharacterSame;
2514
+ var otherProps = __rest$1(props, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]);
2515
+ var ref = useInternalValues(propValue, defaultValue, Boolean(valueIsNumericString), format, removeFormatting, onValueChange);
2516
+ var ref_0 = ref[0];
2517
+ var formattedValue = ref_0.formattedValue;
2518
+ var numAsString = ref_0.numAsString;
2519
+ var onFormattedValueChange = ref[1];
2520
+ var lastUpdatedValue = react.useRef({ formattedValue: formattedValue, numAsString: numAsString });
2521
+ var _onValueChange = function (values, source) {
2522
+ lastUpdatedValue.current = { formattedValue: values.formattedValue, numAsString: values.value };
2523
+ onFormattedValueChange(values, source);
2524
+ };
2525
+ var ref$1 = react.useState(false);
2526
+ var mounted = ref$1[0];
2527
+ var setMounted = ref$1[1];
2528
+ var focusedElm = react.useRef(null);
2529
+ var timeout = react.useRef({
2530
+ setCaretTimeout: null,
2531
+ focusTimeout: null,
2532
+ });
2533
+ react.useEffect(function () {
2534
+ setMounted(true);
2535
+ return function () {
2536
+ clearTimeout(timeout.current.setCaretTimeout);
2537
+ clearTimeout(timeout.current.focusTimeout);
2538
+ };
2539
+ }, []);
2540
+ var _format = format;
2541
+ var getValueObject = function (formattedValue, numAsString) {
2542
+ var floatValue = parseFloat(numAsString);
2543
+ return {
2544
+ formattedValue: formattedValue,
2545
+ value: numAsString,
2546
+ floatValue: isNaN(floatValue) ? undefined : floatValue,
2547
+ };
2548
+ };
2549
+ var setPatchedCaretPosition = function (el, caretPos, currentValue) {
2550
+ // don't reset the caret position when the whole input content is selected
2551
+ if (el.selectionStart === 0 && el.selectionEnd === el.value.length)
2552
+ { return; }
2553
+ /* setting caret position within timeout of 0ms is required for mobile chrome,
2554
+ otherwise browser resets the caret position after we set it
2555
+ We are also setting it without timeout so that in normal browser we don't see the flickering */
2556
+ setCaretPosition(el, caretPos);
2557
+ timeout.current.setCaretTimeout = setTimeout(function () {
2558
+ if (el.value === currentValue && el.selectionStart !== el.selectionEnd) {
2559
+ setCaretPosition(el, caretPos);
2560
+ }
2561
+ }, 0);
2562
+ };
2563
+ /* This keeps the caret within typing area so people can't type in between prefix or suffix */
2564
+ var correctCaretPosition = function (value, caretPos, direction) {
2565
+ return getCaretPosInBoundary(value, caretPos, getCaretBoundary(value), direction);
2566
+ };
2567
+ var getNewCaretPosition = function (inputValue, newFormattedValue, caretPos) {
2568
+ var caretBoundary = getCaretBoundary(newFormattedValue);
2569
+ var updatedCaretPos = getCaretPosition(newFormattedValue, formattedValue, inputValue, caretPos, caretBoundary, isValidInputCharacter, isCharacterSame);
2570
+ //correct caret position if its outside of editable area
2571
+ updatedCaretPos = getCaretPosInBoundary(newFormattedValue, updatedCaretPos, caretBoundary);
2572
+ return updatedCaretPos;
2573
+ };
2574
+ var updateValueAndCaretPosition = function (params) {
2575
+ var newFormattedValue = params.formattedValue; if ( newFormattedValue === void 0 ) newFormattedValue = '';
2576
+ var input = params.input;
2577
+ var setCaretPosition = params.setCaretPosition; if ( setCaretPosition === void 0 ) setCaretPosition = true;
2578
+ var source = params.source;
2579
+ var event = params.event;
2580
+ var numAsString = params.numAsString;
2581
+ var caretPos = params.caretPos;
2582
+ if (input) {
2583
+ //calculate caret position if not defined
2584
+ if (caretPos === undefined && setCaretPosition) {
2585
+ var inputValue = params.inputValue || input.value;
2586
+ var currentCaretPosition = geInputCaretPosition(input);
2587
+ /**
2588
+ * set the value imperatively, this is required for IE fix
2589
+ * This is also required as if new caret position is beyond the previous value.
2590
+ * Caret position will not be set correctly
2591
+ */
2592
+ input.value = newFormattedValue;
2593
+ //get the caret position
2594
+ caretPos = getNewCaretPosition(inputValue, newFormattedValue, currentCaretPosition);
2595
+ }
2596
+ /**
2597
+ * set the value imperatively, as we set the caret position as well imperatively.
2598
+ * This is to keep value and caret position in sync
2599
+ */
2600
+ input.value = newFormattedValue;
2601
+ //set caret position, and value imperatively when element is provided
2602
+ if (setCaretPosition && caretPos !== undefined) {
2603
+ //set caret position
2604
+ setPatchedCaretPosition(input, caretPos, newFormattedValue);
2605
+ }
2606
+ }
2607
+ if (newFormattedValue !== formattedValue) {
2608
+ // trigger onValueChange synchronously, so parent is updated along with the number format. Fix for #277, #287
2609
+ _onValueChange(getValueObject(newFormattedValue, numAsString), { event: event, source: source });
2610
+ }
2611
+ };
2612
+ /**
2613
+ * if the formatted value is not synced to parent, or if the formatted value is different from last synced value sync it
2614
+ * we also don't need to sync to the parent if no formatting is applied
2615
+ * if the formatting props is removed, in which case last formatted value will be different from the numeric string value
2616
+ * in such case we need to inform the parent.
2617
+ */
2618
+ react.useEffect(function () {
2619
+ var ref = lastUpdatedValue.current;
2620
+ var lastFormattedValue = ref.formattedValue;
2621
+ var lastNumAsString = ref.numAsString;
2622
+ if (formattedValue !== lastFormattedValue &&
2623
+ (formattedValue !== numAsString || lastFormattedValue !== lastNumAsString)) {
2624
+ _onValueChange(getValueObject(formattedValue, numAsString), {
2625
+ event: undefined,
2626
+ source: SourceType.props,
2627
+ });
2628
+ }
2629
+ }, [formattedValue, numAsString]);
2630
+ // also if formatted value is changed from the props, we need to update the caret position
2631
+ // keep the last caret position if element is focused
2632
+ var currentCaretPosition = focusedElm.current
2633
+ ? geInputCaretPosition(focusedElm.current)
2634
+ : undefined;
2635
+ // needed to prevent warning with useLayoutEffect on server
2636
+ var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
2637
+ useIsomorphicLayoutEffect(function () {
2638
+ var input = focusedElm.current;
2639
+ if (formattedValue !== lastUpdatedValue.current.formattedValue && input) {
2640
+ var caretPos = getNewCaretPosition(lastUpdatedValue.current.formattedValue, formattedValue, currentCaretPosition);
2641
+ /**
2642
+ * set the value imperatively, as we set the caret position as well imperatively.
2643
+ * This is to keep value and caret position in sync
2644
+ */
2645
+ input.value = formattedValue;
2646
+ setPatchedCaretPosition(input, caretPos, formattedValue);
2647
+ }
2648
+ }, [formattedValue]);
2649
+ var formatInputValue = function (inputValue, event, source) {
2650
+ var changeRange = findChangeRange(formattedValue, inputValue);
2651
+ var changeMeta = Object.assign(Object.assign({}, changeRange), { lastValue: formattedValue });
2652
+ var _numAsString = removeFormatting(inputValue, changeMeta);
2653
+ var _formattedValue = _format(_numAsString);
2654
+ // formatting can remove some of the number chars, so we need to fine number string again
2655
+ _numAsString = removeFormatting(_formattedValue, undefined);
2656
+ if (isAllowed && !isAllowed(getValueObject(_formattedValue, _numAsString))) {
2657
+ //reset the caret position
2658
+ var input = event.target;
2659
+ var currentCaretPosition = geInputCaretPosition(input);
2660
+ var caretPos = getNewCaretPosition(inputValue, formattedValue, currentCaretPosition);
2661
+ input.value = formattedValue;
2662
+ setPatchedCaretPosition(input, caretPos, formattedValue);
2663
+ return false;
2664
+ }
2665
+ updateValueAndCaretPosition({
2666
+ formattedValue: _formattedValue,
2667
+ numAsString: _numAsString,
2668
+ inputValue: inputValue,
2669
+ event: event,
2670
+ source: source,
2671
+ setCaretPosition: true,
2672
+ input: event.target,
2673
+ });
2674
+ return true;
2675
+ };
2676
+ var _onChange = function (e) {
2677
+ var el = e.target;
2678
+ var inputValue = el.value;
2679
+ var changed = formatInputValue(inputValue, e, SourceType.event);
2680
+ if (changed)
2681
+ { onChange(e); }
2682
+ };
2683
+ var _onKeyDown = function (e) {
2684
+ var el = e.target;
2685
+ var key = e.key;
2686
+ var selectionStart = el.selectionStart;
2687
+ var selectionEnd = el.selectionEnd;
2688
+ var value = el.value; if ( value === void 0 ) value = '';
2689
+ var expectedCaretPosition;
2690
+ //Handle backspace and delete against non numerical/decimal characters or arrow keys
2691
+ if (key === 'ArrowLeft' || key === 'Backspace') {
2692
+ expectedCaretPosition = Math.max(selectionStart - 1, 0);
2693
+ }
2694
+ else if (key === 'ArrowRight') {
2695
+ expectedCaretPosition = Math.min(selectionStart + 1, value.length);
2696
+ }
2697
+ else if (key === 'Delete') {
2698
+ expectedCaretPosition = selectionStart;
2699
+ }
2700
+ //if expectedCaretPosition is not set it means we don't want to Handle keyDown
2701
+ // also if multiple characters are selected don't handle
2702
+ if (expectedCaretPosition === undefined || selectionStart !== selectionEnd) {
2703
+ onKeyDown(e);
2704
+ return;
2705
+ }
2706
+ var newCaretPosition = expectedCaretPosition;
2707
+ if (key === 'ArrowLeft' || key === 'ArrowRight') {
2708
+ var direction = key === 'ArrowLeft' ? 'left' : 'right';
2709
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, direction);
2710
+ // arrow left or right only moves the caret, so no need to handle the event, if we are handling it manually
2711
+ if (newCaretPosition !== expectedCaretPosition) {
2712
+ e.preventDefault();
2713
+ }
2714
+ }
2715
+ else if (key === 'Delete' && !isValidInputCharacter(value[expectedCaretPosition])) {
2716
+ // in case of delete go to closest caret boundary on the right side
2717
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, 'right');
2718
+ }
2719
+ else if (key === 'Backspace' && !isValidInputCharacter(value[expectedCaretPosition])) {
2720
+ // in case of backspace go to closest caret boundary on the left side
2721
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, 'left');
2722
+ }
2723
+ if (newCaretPosition !== expectedCaretPosition) {
2724
+ setPatchedCaretPosition(el, newCaretPosition, value);
2725
+ }
2726
+ /* NOTE: this is just required for unit test as we need to get the newCaretPosition,
2727
+ Remove this when you find different solution */
2728
+ /* @ts-ignore */
2729
+ if (e.isUnitTestRun) {
2730
+ setPatchedCaretPosition(el, newCaretPosition, value);
2731
+ }
2732
+ onKeyDown(e);
2733
+ };
2734
+ /** required to handle the caret position when click anywhere within the input **/
2735
+ var _onMouseUp = function (e) {
2736
+ var el = e.target;
2737
+ /**
2738
+ * NOTE: we have to give default value for value as in case when custom input is provided
2739
+ * value can come as undefined when nothing is provided on value prop.
2740
+ */
2741
+ var selectionStart = el.selectionStart;
2742
+ var selectionEnd = el.selectionEnd;
2743
+ var value = el.value; if ( value === void 0 ) value = '';
2744
+ if (selectionStart === selectionEnd) {
2745
+ var caretPosition = correctCaretPosition(value, selectionStart);
2746
+ if (caretPosition !== selectionStart) {
2747
+ setPatchedCaretPosition(el, caretPosition, value);
2748
+ }
2749
+ }
2750
+ onMouseUp(e);
2751
+ };
2752
+ var _onFocus = function (e) {
2753
+ // Workaround Chrome and Safari bug https://bugs.chromium.org/p/chromium/issues/detail?id=779328
2754
+ // (onFocus event target selectionStart is always 0 before setTimeout)
2755
+ if (e.persist)
2756
+ { e.persist(); }
2757
+ var el = e.target;
2758
+ focusedElm.current = el;
2759
+ timeout.current.focusTimeout = setTimeout(function () {
2760
+ var selectionStart = el.selectionStart;
2761
+ var selectionEnd = el.selectionEnd;
2762
+ var value = el.value; if ( value === void 0 ) value = '';
2763
+ var caretPosition = correctCaretPosition(value, selectionStart);
2764
+ //setPatchedCaretPosition only when everything is not selected on focus (while tabbing into the field)
2765
+ if (caretPosition !== selectionStart &&
2766
+ !(selectionStart === 0 && selectionEnd === value.length)) {
2767
+ setPatchedCaretPosition(el, caretPosition, value);
2768
+ }
2769
+ onFocus(e);
2770
+ }, 0);
2771
+ };
2772
+ var _onBlur = function (e) {
2773
+ focusedElm.current = null;
2774
+ clearTimeout(timeout.current.focusTimeout);
2775
+ clearTimeout(timeout.current.setCaretTimeout);
2776
+ onBlur(e);
2777
+ };
2778
+ // add input mode on element based on format prop and device once the component is mounted
2779
+ var inputMode = mounted && addInputMode() ? 'numeric' : undefined;
2780
+ var inputProps = Object.assign({ inputMode: inputMode }, otherProps, {
2781
+ type: type,
2782
+ value: formattedValue,
2783
+ onChange: _onChange,
2784
+ onKeyDown: _onKeyDown,
2785
+ onMouseUp: _onMouseUp,
2786
+ onFocus: _onFocus,
2787
+ onBlur: _onBlur,
2788
+ });
2789
+ if (displayType === 'text') {
2790
+ return renderText ? (react.createElement(react.Fragment, null, renderText(formattedValue, otherProps) || null)) : (react.createElement("span", Object.assign({}, otherProps, { ref: getInputRef }), formattedValue));
2791
+ }
2792
+ else if (customInput) {
2793
+ var CustomInput = customInput;
2794
+ /* @ts-ignore */
2795
+ return react.createElement(CustomInput, Object.assign({}, inputProps, { ref: getInputRef }));
2796
+ }
2797
+ return react.createElement("input", Object.assign({}, inputProps, { ref: getInputRef }));
2798
+ }
2799
+
2800
+ function format(numStr, props) {
2801
+ var decimalScale = props.decimalScale;
2802
+ var fixedDecimalScale = props.fixedDecimalScale;
2803
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
2804
+ var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
2805
+ var allowNegative = props.allowNegative;
2806
+ var thousandsGroupStyle = props.thousandsGroupStyle; if ( thousandsGroupStyle === void 0 ) thousandsGroupStyle = 'thousand';
2807
+ // don't apply formatting on empty string or '-'
2808
+ if (numStr === '' || numStr === '-') {
2809
+ return numStr;
2810
+ }
2811
+ var ref = getSeparators(props);
2812
+ var thousandSeparator = ref.thousandSeparator;
2813
+ var decimalSeparator = ref.decimalSeparator;
2814
+ /**
2815
+ * Keep the decimal separator
2816
+ * when decimalScale is not defined or non zero and the numStr has decimal in it
2817
+ * Or if decimalScale is > 0 and fixeDecimalScale is true (even if numStr has no decimal)
2818
+ */
2819
+ var hasDecimalSeparator = (decimalScale !== 0 && numStr.indexOf('.') !== -1) || (decimalScale && fixedDecimalScale);
2820
+ var ref$1 = splitDecimal(numStr, allowNegative);
2821
+ var beforeDecimal = ref$1.beforeDecimal;
2822
+ var afterDecimal = ref$1.afterDecimal;
2823
+ var addNegation = ref$1.addNegation; // eslint-disable-line prefer-const
2824
+ //apply decimal precision if its defined
2825
+ if (decimalScale !== undefined) {
2826
+ afterDecimal = limitToScale(afterDecimal, decimalScale, !!fixedDecimalScale);
2827
+ }
2828
+ if (thousandSeparator) {
2829
+ beforeDecimal = applyThousandSeparator(beforeDecimal, thousandSeparator, thousandsGroupStyle);
2830
+ }
2831
+ //add prefix and suffix when there is a number present
2832
+ if (prefix)
2833
+ { beforeDecimal = prefix + beforeDecimal; }
2834
+ if (suffix)
2835
+ { afterDecimal = afterDecimal + suffix; }
2836
+ //restore negation sign
2837
+ if (addNegation)
2838
+ { beforeDecimal = '-' + beforeDecimal; }
2839
+ numStr = beforeDecimal + ((hasDecimalSeparator && decimalSeparator) || '') + afterDecimal;
2840
+ return numStr;
2841
+ }
2842
+ function getSeparators(props) {
2843
+ var decimalSeparator = props.decimalSeparator; if ( decimalSeparator === void 0 ) decimalSeparator = '.';
2844
+ var thousandSeparator = props.thousandSeparator;
2845
+ var allowedDecimalSeparators = props.allowedDecimalSeparators;
2846
+ if (thousandSeparator === true) {
2847
+ thousandSeparator = ',';
2848
+ }
2849
+ if (!allowedDecimalSeparators) {
2850
+ allowedDecimalSeparators = [decimalSeparator, '.'];
2851
+ }
2852
+ return {
2853
+ decimalSeparator: decimalSeparator,
2854
+ thousandSeparator: thousandSeparator,
2855
+ allowedDecimalSeparators: allowedDecimalSeparators,
2856
+ };
2857
+ }
2858
+ function handleNegation(value, allowNegative) {
2859
+ if ( value === void 0 ) value = '';
2860
+
2861
+ var negationRegex = new RegExp('(-)');
2862
+ var doubleNegationRegex = new RegExp('(-)(.)*(-)');
2863
+ // Check number has '-' value
2864
+ var hasNegation = negationRegex.test(value);
2865
+ // Check number has 2 or more '-' values
2866
+ var removeNegation = doubleNegationRegex.test(value);
2867
+ //remove negation
2868
+ value = value.replace(/-/g, '');
2869
+ if (hasNegation && !removeNegation && allowNegative) {
2870
+ value = '-' + value;
2871
+ }
2872
+ return value;
2873
+ }
2874
+ function getNumberRegex(decimalSeparator, global) {
2875
+ return new RegExp(("(^-)|[0-9]|" + (escapeRegExp(decimalSeparator))), global ? 'g' : undefined);
2876
+ }
2877
+ function isNumericString(val, prefix, suffix) {
2878
+ // for empty value we can always treat it as numeric string
2879
+ if (val === '')
2880
+ { return true; }
2881
+ return (!(prefix === null || prefix === void 0 ? void 0 : prefix.match(/\d/)) && !(suffix === null || suffix === void 0 ? void 0 : suffix.match(/\d/)) && typeof val === 'string' && !isNaN(Number(val)));
2882
+ }
2883
+ function removeFormatting(value, changeMeta, props) {
2884
+ var assign;
2885
+
2886
+ if ( changeMeta === void 0 ) changeMeta = getDefaultChangeMeta(value);
2887
+ var allowNegative = props.allowNegative;
2888
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
2889
+ var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
2890
+ var decimalScale = props.decimalScale;
2891
+ var from = changeMeta.from;
2892
+ var to = changeMeta.to;
2893
+ var start = to.start;
2894
+ var end = to.end;
2895
+ var ref = getSeparators(props);
2896
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
2897
+ var decimalSeparator = ref.decimalSeparator;
2898
+ var isBeforeDecimalSeparator = value[end] === decimalSeparator;
2899
+ /**
2900
+ * If only a number is added on empty input which matches with the prefix or suffix,
2901
+ * then don't remove it, just return the same
2902
+ */
2903
+ if (charIsNumber(value) &&
2904
+ (value === prefix || value === suffix) &&
2905
+ changeMeta.lastValue === '') {
2906
+ return value;
2907
+ }
2908
+ /** Check for any allowed decimal separator is added in the numeric format and replace it with decimal separator */
2909
+ if (end - start === 1 && allowedDecimalSeparators.indexOf(value[start]) !== -1) {
2910
+ var separator = decimalScale === 0 ? '' : decimalSeparator;
2911
+ value = value.substring(0, start) + separator + value.substring(start + 1, value.length);
2912
+ }
2913
+ var stripNegation = function (value, start, end) {
2914
+ /**
2915
+ * if prefix starts with - we don't allow negative number to avoid confusion
2916
+ * if suffix starts with - and the value length is same as suffix length, then the - sign is from the suffix
2917
+ * In other cases, if the value starts with - then it is a negation
2918
+ */
2919
+ var hasNegation = false;
2920
+ var hasDoubleNegation = false;
2921
+ if (prefix.startsWith('-')) {
2922
+ hasNegation = false;
2923
+ }
2924
+ else if (value.startsWith('--')) {
2925
+ hasNegation = false;
2926
+ hasDoubleNegation = true;
2927
+ }
2928
+ else if (suffix.startsWith('-') && value.length === suffix.length) {
2929
+ hasNegation = false;
2930
+ }
2931
+ else if (value[0] === '-') {
2932
+ hasNegation = true;
2933
+ }
2934
+ var charsToRemove = hasNegation ? 1 : 0;
2935
+ if (hasDoubleNegation)
2936
+ { charsToRemove = 2; }
2937
+ // remove negation/double negation from start to simplify prefix logic as negation comes before prefix
2938
+ if (charsToRemove) {
2939
+ value = value.substring(charsToRemove);
2940
+ // account for the removal of the negation for start and end index
2941
+ start -= charsToRemove;
2942
+ end -= charsToRemove;
2943
+ }
2944
+ return { value: value, start: start, end: end, hasNegation: hasNegation };
2945
+ };
2946
+ var toMetadata = stripNegation(value, start, end);
2947
+ var hasNegation = toMetadata.hasNegation;
2948
+ ((assign = toMetadata, value = assign.value, start = assign.start, end = assign.end));
2949
+ var ref$1 = stripNegation(changeMeta.lastValue, from.start, from.end);
2950
+ var fromStart = ref$1.start;
2951
+ var fromEnd = ref$1.end;
2952
+ var lastValue = ref$1.value;
2953
+ // if only prefix and suffix part is updated reset the value to last value
2954
+ // if the changed range is from suffix in the updated value, and the the suffix starts with the same characters, allow the change
2955
+ var updatedSuffixPart = value.substring(start, end);
2956
+ if (value.length &&
2957
+ lastValue.length &&
2958
+ (fromStart > lastValue.length - suffix.length || fromEnd < prefix.length) &&
2959
+ !(updatedSuffixPart && suffix.startsWith(updatedSuffixPart))) {
2960
+ value = lastValue;
2961
+ }
2962
+ /**
2963
+ * remove prefix
2964
+ * Remove whole prefix part if its present on the value
2965
+ * If the prefix is partially deleted (in which case change start index will be less the prefix length)
2966
+ * Remove only partial part of prefix.
2967
+ */
2968
+ var startIndex = 0;
2969
+ if (value.startsWith(prefix))
2970
+ { startIndex += prefix.length; }
2971
+ else if (start < prefix.length)
2972
+ { startIndex = start; }
2973
+ value = value.substring(startIndex);
2974
+ // account for deleted prefix for end
2975
+ end -= startIndex;
2976
+ /**
2977
+ * Remove suffix
2978
+ * Remove whole suffix part if its present on the value
2979
+ * If the suffix is partially deleted (in which case change end index will be greater than the suffixStartIndex)
2980
+ * remove the partial part of suffix
2981
+ */
2982
+ var endIndex = value.length;
2983
+ var suffixStartIndex = value.length - suffix.length;
2984
+ if (value.endsWith(suffix))
2985
+ { endIndex = suffixStartIndex; }
2986
+ // if the suffix is removed from the end
2987
+ else if (end > suffixStartIndex)
2988
+ { endIndex = end; }
2989
+ // if the suffix is removed from start
2990
+ else if (end > value.length - suffix.length)
2991
+ { endIndex = end; }
2992
+ value = value.substring(0, endIndex);
2993
+ // add the negation back and handle for double negation
2994
+ value = handleNegation(hasNegation ? ("-" + value) : value, allowNegative);
2995
+ // remove non numeric characters
2996
+ value = (value.match(getNumberRegex(decimalSeparator, true)) || []).join('');
2997
+ // replace the decimalSeparator with ., and only keep the first separator, ignore following ones
2998
+ var firstIndex = value.indexOf(decimalSeparator);
2999
+ value = value.replace(new RegExp(escapeRegExp(decimalSeparator), 'g'), function (match, index) {
3000
+ return index === firstIndex ? '.' : '';
3001
+ });
3002
+ //check if beforeDecimal got deleted and there is nothing after decimal,
3003
+ //clear all numbers in such case while keeping the - sign
3004
+ var ref$2 = splitDecimal(value, allowNegative);
3005
+ var beforeDecimal = ref$2.beforeDecimal;
3006
+ var afterDecimal = ref$2.afterDecimal;
3007
+ var addNegation = ref$2.addNegation; // eslint-disable-line prefer-const
3008
+ //clear only if something got deleted before decimal (cursor is before decimal)
3009
+ if (to.end - to.start < from.end - from.start &&
3010
+ beforeDecimal === '' &&
3011
+ isBeforeDecimalSeparator &&
3012
+ !parseFloat(afterDecimal)) {
3013
+ value = addNegation ? '-' : '';
3014
+ }
3015
+ return value;
3016
+ }
3017
+ function getCaretBoundary(formattedValue, props) {
3018
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
3019
+ var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
3020
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
3021
+ var hasNegation = formattedValue[0] === '-';
3022
+ // fill for prefix and negation
3023
+ boundaryAry.fill(false, 0, prefix.length + (hasNegation ? 1 : 0));
3024
+ // fill for suffix
3025
+ var valLn = formattedValue.length;
3026
+ boundaryAry.fill(false, valLn - suffix.length + 1, valLn + 1);
3027
+ return boundaryAry;
3028
+ }
3029
+ function validateAndUpdateProps(props) {
3030
+ var ref = getSeparators(props);
3031
+ var thousandSeparator = ref.thousandSeparator;
3032
+ var decimalSeparator = ref.decimalSeparator;
3033
+ // eslint-disable-next-line prefer-const
3034
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
3035
+ var allowNegative = props.allowNegative; if ( allowNegative === void 0 ) allowNegative = true;
3036
+ if (thousandSeparator === decimalSeparator) {
3037
+ throw new Error(("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: " + thousandSeparator + " (thousandSeparator = {true} is same as thousandSeparator = \",\")\n decimalSeparator: " + decimalSeparator + " (default value for decimalSeparator is .)\n "));
3038
+ }
3039
+ if (prefix.startsWith('-') && allowNegative) {
3040
+ // TODO: throw error in next major version
3041
+ console.error(("\n Prefix can't start with '-' when allowNegative is true.\n prefix: " + prefix + "\n allowNegative: " + allowNegative + "\n "));
3042
+ allowNegative = false;
3043
+ }
3044
+ return Object.assign(Object.assign({}, props), { allowNegative: allowNegative });
3045
+ }
3046
+ function useNumericFormat(props) {
3047
+ // validate props
3048
+ props = validateAndUpdateProps(props);
3049
+ var suffix = props.suffix;
3050
+ var allowNegative = props.allowNegative;
3051
+ var allowLeadingZeros = props.allowLeadingZeros;
3052
+ var onKeyDown = props.onKeyDown; if ( onKeyDown === void 0 ) onKeyDown = noop;
3053
+ var onBlur = props.onBlur; if ( onBlur === void 0 ) onBlur = noop;
3054
+ var thousandSeparator = props.thousandSeparator;
3055
+ var decimalScale = props.decimalScale;
3056
+ var fixedDecimalScale = props.fixedDecimalScale;
3057
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
3058
+ var defaultValue = props.defaultValue;
3059
+ var value = props.value;
3060
+ var valueIsNumericString = props.valueIsNumericString;
3061
+ var onValueChange = props.onValueChange;
3062
+ var restProps = __rest$1(props, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]);
3063
+ // get derived decimalSeparator and allowedDecimalSeparators
3064
+ var ref = getSeparators(props);
3065
+ var decimalSeparator = ref.decimalSeparator;
3066
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
3067
+ var _format = function (numStr) { return format(numStr, props); };
3068
+ var _removeFormatting = function (inputValue, changeMeta) { return removeFormatting(inputValue, changeMeta, props); };
3069
+ var _value = isNil(value) ? defaultValue : value;
3070
+ // try to figure out isValueNumericString based on format prop and value
3071
+ var _valueIsNumericString = valueIsNumericString !== null && valueIsNumericString !== void 0 ? valueIsNumericString : isNumericString(_value, prefix, suffix);
3072
+ if (!isNil(value)) {
3073
+ _valueIsNumericString = _valueIsNumericString || typeof value === 'number';
3074
+ }
3075
+ else if (!isNil(defaultValue)) {
3076
+ _valueIsNumericString = _valueIsNumericString || typeof defaultValue === 'number';
3077
+ }
3078
+ var roundIncomingValueToPrecision = function (value) {
3079
+ if (isNotValidValue(value))
3080
+ { return value; }
3081
+ if (typeof value === 'number') {
3082
+ value = toNumericString(value);
3083
+ }
3084
+ /**
3085
+ * only round numeric or float string values coming through props,
3086
+ * we don't need to do it for onChange events, as we want to prevent typing there
3087
+ */
3088
+ if (_valueIsNumericString && typeof decimalScale === 'number') {
3089
+ return roundToPrecision(value, decimalScale, Boolean(fixedDecimalScale));
3090
+ }
3091
+ return value;
3092
+ };
3093
+ var ref$1 = useInternalValues(roundIncomingValueToPrecision(value), roundIncomingValueToPrecision(defaultValue), Boolean(_valueIsNumericString), _format, _removeFormatting, onValueChange);
3094
+ var ref$1_0 = ref$1[0];
3095
+ var numAsString = ref$1_0.numAsString;
3096
+ var formattedValue = ref$1_0.formattedValue;
3097
+ var _onValueChange = ref$1[1];
3098
+ var _onKeyDown = function (e) {
3099
+ var el = e.target;
3100
+ var key = e.key;
3101
+ var selectionStart = el.selectionStart;
3102
+ var selectionEnd = el.selectionEnd;
3103
+ var value = el.value; if ( value === void 0 ) value = '';
3104
+ // if multiple characters are selected and user hits backspace, no need to handle anything manually
3105
+ if (selectionStart !== selectionEnd) {
3106
+ onKeyDown(e);
3107
+ return;
3108
+ }
3109
+ // if user hits backspace, while the cursor is before prefix, and the input has negation, remove the negation
3110
+ if (key === 'Backspace' &&
3111
+ value[0] === '-' &&
3112
+ selectionStart === prefix.length + 1 &&
3113
+ allowNegative) {
3114
+ // bring the cursor to after negation
3115
+ setCaretPosition(el, 1);
3116
+ }
3117
+ // don't allow user to delete decimal separator when decimalScale and fixedDecimalScale is set
3118
+ if (decimalScale && fixedDecimalScale) {
3119
+ if (key === 'Backspace' && value[selectionStart - 1] === decimalSeparator) {
3120
+ setCaretPosition(el, selectionStart - 1);
3121
+ e.preventDefault();
3122
+ }
3123
+ else if (key === 'Delete' && value[selectionStart] === decimalSeparator) {
3124
+ e.preventDefault();
3125
+ }
3126
+ }
3127
+ // if user presses the allowed decimal separator before the separator, move the cursor after the separator
3128
+ if ((allowedDecimalSeparators === null || allowedDecimalSeparators === void 0 ? void 0 : allowedDecimalSeparators.includes(key)) && value[selectionStart] === decimalSeparator) {
3129
+ setCaretPosition(el, selectionStart + 1);
3130
+ }
3131
+ var _thousandSeparator = thousandSeparator === true ? ',' : thousandSeparator;
3132
+ // move cursor when delete or backspace is pressed before/after thousand separator
3133
+ if (key === 'Backspace' && value[selectionStart - 1] === _thousandSeparator) {
3134
+ setCaretPosition(el, selectionStart - 1);
3135
+ }
3136
+ if (key === 'Delete' && value[selectionStart] === _thousandSeparator) {
3137
+ setCaretPosition(el, selectionStart + 1);
3138
+ }
3139
+ onKeyDown(e);
3140
+ };
3141
+ var _onBlur = function (e) {
3142
+ var _value = numAsString;
3143
+ // if there no no numeric value, clear the input
3144
+ if (!_value.match(/\d/g)) {
3145
+ _value = '';
3146
+ }
3147
+ // clear leading 0s
3148
+ if (!allowLeadingZeros) {
3149
+ _value = fixLeadingZero(_value);
3150
+ }
3151
+ // apply fixedDecimalScale on blur event
3152
+ if (fixedDecimalScale && decimalScale) {
3153
+ _value = roundToPrecision(_value, decimalScale, fixedDecimalScale);
3154
+ }
3155
+ if (_value !== numAsString) {
3156
+ var formattedValue = format(_value, props);
3157
+ _onValueChange({
3158
+ formattedValue: formattedValue,
3159
+ value: _value,
3160
+ floatValue: parseFloat(_value),
3161
+ }, {
3162
+ event: e,
3163
+ source: SourceType.event,
3164
+ });
3165
+ }
3166
+ onBlur(e);
3167
+ };
3168
+ var isValidInputCharacter = function (inputChar) {
3169
+ if (inputChar === decimalSeparator)
3170
+ { return true; }
3171
+ return charIsNumber(inputChar);
3172
+ };
3173
+ var isCharacterSame = function (ref) {
3174
+ var currentValue = ref.currentValue;
3175
+ var lastValue = ref.lastValue;
3176
+ var formattedValue = ref.formattedValue;
3177
+ var currentValueIndex = ref.currentValueIndex;
3178
+ var formattedValueIndex = ref.formattedValueIndex;
3179
+
3180
+ var curChar = currentValue[currentValueIndex];
3181
+ var newChar = formattedValue[formattedValueIndex];
3182
+ /**
3183
+ * NOTE: as thousand separator and allowedDecimalSeparators can be same, we need to check on
3184
+ * typed range if we have typed any character from allowedDecimalSeparators, in that case we
3185
+ * consider different characters like , and . same within the range of updated value.
3186
+ */
3187
+ var typedRange = findChangeRange(lastValue, currentValue);
3188
+ var to = typedRange.to;
3189
+ if (currentValueIndex >= to.start &&
3190
+ currentValueIndex < to.end &&
3191
+ allowedDecimalSeparators &&
3192
+ allowedDecimalSeparators.includes(curChar) &&
3193
+ newChar === decimalSeparator) {
3194
+ return true;
3195
+ }
3196
+ return curChar === newChar;
3197
+ };
3198
+ return Object.assign(Object.assign({}, restProps), { value: formattedValue, valueIsNumericString: false, isValidInputCharacter: isValidInputCharacter,
3199
+ isCharacterSame: isCharacterSame, onValueChange: _onValueChange, format: _format, removeFormatting: _removeFormatting, getCaretBoundary: function (formattedValue) { return getCaretBoundary(formattedValue, props); }, onKeyDown: _onKeyDown, onBlur: _onBlur });
3200
+ }
3201
+ function NumericFormat(props) {
3202
+ var numericFormatProps = useNumericFormat(props);
3203
+ return react.createElement(NumberFormatBase, Object.assign({}, numericFormatProps));
3204
+ }
3205
+
3206
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
3207
+ var t = {};
3208
+ for (var p in s)
3209
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3210
+ t[p] = s[p];
3211
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
3212
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3213
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3214
+ t[p[i]] = s[p[i]];
3215
+ }
3216
+ return t;
3217
+ };
3218
+ const BcmReactNumber = class {
3219
+ constructor(hostRef) {
3220
+ registerInstance(this, hostRef);
3221
+ this.isRange = (value, min, max) => {
3222
+ if (value === undefined) {
3223
+ return true;
3224
+ }
3225
+ const minValid = min === undefined || value >= min;
3226
+ const maxValid = max === undefined || value <= max;
3227
+ return minValid && maxValid;
3228
+ };
3229
+ this.disabled = false;
3230
+ this.options = undefined;
3231
+ }
3232
+ componentWillRender() {
3233
+ this.init();
3234
+ }
3235
+ componentDidLoad() {
3236
+ this.init();
3237
+ }
3238
+ init() {
3239
+ const _a = this.options, { min, max, mode } = _a, rest = __rest(_a, ["min", "max", "mode"]);
3240
+ const render = react.createElement(NumericFormat, Object.assign(Object.assign({}, rest), { isAllowed: (values) => {
3241
+ if (mode === "strict") {
3242
+ return this.isRange(values.floatValue, +min, +max);
3243
+ }
3244
+ return true;
3245
+ }, onValueChange: e => {
3246
+ if (this.options.onValueChange) {
3247
+ this.options.onValueChange(e);
3248
+ }
3249
+ } }));
3250
+ reactDom.render(render, this.el);
3251
+ }
3252
+ get el() { return getElement(this); }
3253
+ };
3254
+
3255
+ const BcmTooltip = class {
3256
+ constructor(hostRef) {
3257
+ registerInstance(this, hostRef);
3258
+ this.bcmTooltipShow = createEvent(this, "bcmTooltipShow", 7);
3259
+ this.bcmTooltipHide = createEvent(this, "bcmTooltipHide", 7);
3260
+ this._id = Generate.UID();
3261
+ this.message = "";
3262
+ this.placement = Bcm$1.Placement.top;
3263
+ this.trigger = Bcm$1.TriggerType.click;
3264
+ this.open = false;
3265
+ this.color = "slate";
3266
+ this.size = Bcm$1.Size.medium;
3267
+ this.openDelay = 0;
3268
+ this.closeDelay = 0;
3269
+ this.autoHide = false;
3270
+ this.targetId = undefined;
3271
+ this.tooltip = undefined;
3272
+ }
3273
+ emitShow() {
3274
+ this.bcmTooltipShow.emit();
3275
+ }
3276
+ emitHide() {
3277
+ this.bcmTooltipHide.emit();
3278
+ }
3279
+ connectedCallback() {
3280
+ this.tooltip = new Tooltip({
3281
+ targetId: this.targetId || this._id,
3282
+ message: this.message,
3283
+ placement: this.placement,
3284
+ color: this.color,
3285
+ trigger: this.trigger,
3286
+ size: this.size,
3287
+ openDelay: this.openDelay,
3288
+ closeDelay: this.closeDelay,
3289
+ autoHide: this.autoHide,
3290
+ emitShow: () => this.emitShow(),
3291
+ emitHide: () => this.emitHide(),
3292
+ });
3293
+ }
3294
+ componentDidLoad() {
3295
+ this.tooltip.listener();
3296
+ }
3297
+ componentDidRender() {
3298
+ this.tooltip.message = this.message;
3299
+ this.tooltip.placement = this.placement;
3300
+ this.tooltip.color = this.color;
3301
+ this.tooltip.trigger = this.trigger;
3302
+ this.tooltip.size = this.size;
3303
+ this.tooltip.openDelay = this.openDelay;
3304
+ this.tooltip.closeDelay = this.closeDelay;
3305
+ this.tooltip.autoHide = this.autoHide;
3306
+ this.tooltip.update();
3307
+ }
3308
+ disconnectedCallback() {
3309
+ this.tooltip.destroy();
3310
+ }
3311
+ async show() {
3312
+ this.tooltip.show();
3313
+ }
3314
+ async hide() {
3315
+ this.tooltip.hide();
3316
+ }
3317
+ async toggle() {
3318
+ this.tooltip.toggle();
3319
+ }
3320
+ render() {
3321
+ return (h$1(Host, { class: "tw-inline-flex tw-h-fit tw-w-fit", role: "tooltip", "aria-hidden": "true" }, h$1("slot", null)));
3322
+ }
3323
+ get el() { return getElement(this); }
3324
+ };
3325
+
3326
+ export { BcmButton as bcm_button, BcmColorful as bcm_colorful, BcmForm as bcm_form, BcmIcon as bcm_icon, BcmInput as bcm_input, BcmInput2 as bcm_input_2, BcmLabel as bcm_label, BcmLinked as bcm_linked, NumberInput as bcm_number_input, BcmReactNumber as bcm_react_number, BcmTooltip as bcm_tooltip };