bromcom-ui 2.11.2-test.0 → 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 (359) 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-f7e70814.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-894c02ef.entry.js → p-54c2dc4e.entry.js} +1 -1
  30. package/dist/bromcom-ui/{p-b66e0388.entry.js → p-56fca120.entry.js} +1 -1
  31. package/dist/bromcom-ui/{p-69c64256.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-9098db35.entry.js → p-5bea1cd3.entry.js} +1 -1
  35. package/dist/bromcom-ui/{p-666d9883.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-8b3eafe7.entry.js → p-67a6f0b1.entry.js} +1 -1
  40. package/dist/bromcom-ui/{p-695d8d34.entry.js → p-68fb3f60.entry.js} +1 -1
  41. package/dist/bromcom-ui/{p-80a43d63.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-6c6beb41.entry.js → p-72bbcca6.entry.js} +1 -1
  45. package/dist/bromcom-ui/{p-70c2412a.entry.js → p-74cedefe.entry.js} +1 -1
  46. package/dist/bromcom-ui/p-76edf59f.js +7 -0
  47. package/dist/bromcom-ui/{p-fc27c9ca.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-0cd4e8a1.entry.js → p-8858f845.entry.js} +1 -1
  53. package/dist/bromcom-ui/{p-2270e612.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-c6b86846.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-f2e06aca.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-50926f4c.entry.js → p-91c0ab1c.entry.js} +1 -1
  62. package/dist/bromcom-ui/{p-b6e6027b.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-d51f76b2.js → p-aaed6cc7.js} +1 -1
  66. package/dist/bromcom-ui/{p-4757735e.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-ad8d9e10.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-543457d1.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-f6169b46.js → p-c4d3aee2.js} +1 -1
  82. package/dist/bromcom-ui/{p-195c1819.entry.js → p-c7a3c347.entry.js} +1 -1
  83. package/dist/bromcom-ui/{p-00c28e19.entry.js → p-c9aa4a0d.entry.js} +1 -1
  84. package/dist/bromcom-ui/{p-79153d4a.entry.js → p-cfffca09.entry.js} +1 -1
  85. package/dist/bromcom-ui/{p-3b38d001.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-86384d20.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-b85fd5f4.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-34740cfd.entry.js → p-e671e409.entry.js} +1 -1
  96. package/dist/bromcom-ui/{p-ccbb5a6b.js → p-e6755449.js} +1 -1
  97. package/dist/bromcom-ui/p-ebcb30ef.entry.js +5 -0
  98. package/dist/bromcom-ui/{p-ef4baf81.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-b3f7b64d.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 +21 -19
  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-64f84d95.js → generate-c09a3ff3.js} +2 -2
  173. package/dist/cjs/{global-895f2946.js → global-6b15ed51.js} +1 -1
  174. package/dist/cjs/{Overflow-a821abd0.js → index-e05a7c6f.js} +87 -2311
  175. package/dist/cjs/{input-template-9c106337.js → input-template-8ca49c2e.js} +1 -1
  176. package/dist/cjs/{json-parse-decarator-9db107be.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-f9323233.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-992c024f.js → package-6483ada2.js} +1 -1
  183. package/dist/cjs/{stepper-states-b3496b3f.js → stepper-states-4e435c7d.js} +1 -1
  184. package/dist/cjs/{tooltip-helper-cb99c02e.js → tooltip-helper-31cc88d8.js} +5 -4
  185. package/dist/cjs/{validators-abb0434a.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/components/bcm-form-2.js +2 -1
  195. package/dist/components/bcm-input-2.d.ts +11 -0
  196. package/dist/components/bcm-input-2.js +225 -0
  197. package/dist/components/bcm-number-input.js +295 -79
  198. package/dist/components/bcm-react-number.d.ts +11 -0
  199. package/dist/components/bcm-react-number.js +10 -0
  200. package/dist/components/colors2.js +13 -7
  201. package/dist/components/form.js +2 -2
  202. package/dist/components/generate.js +1 -1
  203. package/dist/components/index.d.ts +2 -0
  204. package/dist/components/index.js +2 -0
  205. package/dist/components/input.style.js +120 -0
  206. package/dist/components/radio.js +1 -1
  207. package/dist/components/react-input.js +1242 -0
  208. package/dist/esm/Overflow-32a0ec34.js +2217 -0
  209. package/dist/esm/{_commonjsHelpers-82aa9212.js → _commonjsHelpers-be0d4ec8.js} +1 -1
  210. package/dist/esm/bcm-accordion.entry.js +4 -4
  211. package/dist/esm/bcm-alert.entry.js +6 -6
  212. package/dist/esm/bcm-attendance-actions-comment.entry.js +9 -8
  213. package/dist/esm/bcm-attendance-actions-dropdown.entry.js +10 -9
  214. package/dist/esm/bcm-attendance-actions.entry.js +10 -9
  215. package/dist/esm/bcm-attendance.entry.js +4 -4
  216. package/dist/esm/bcm-autocomplete.entry.js +2 -2
  217. package/dist/esm/bcm-avatar_2.entry.js +9 -8
  218. package/dist/esm/bcm-breadcrumb.entry.js +5 -5
  219. package/dist/esm/bcm-button-group.entry.js +6 -6
  220. package/dist/esm/bcm-button_11.entry.js +3326 -0
  221. package/dist/esm/bcm-caption.entry.js +11 -10
  222. package/dist/esm/bcm-card.entry.js +8 -8
  223. package/dist/esm/bcm-checkbox-group.entry.js +6 -6
  224. package/dist/esm/bcm-checkbox-lite_9.entry.js +5 -5
  225. package/dist/esm/bcm-checkbox_2.entry.js +9 -9
  226. package/dist/esm/bcm-chip-group.entry.js +12 -11
  227. package/dist/esm/bcm-chip.entry.js +6 -6
  228. package/dist/esm/bcm-collapse.entry.js +6 -6
  229. package/dist/esm/bcm-color-input.entry.js +9 -8
  230. package/dist/esm/bcm-colorpicker.entry.js +2 -2
  231. package/dist/esm/bcm-date-picker.entry.js +178 -0
  232. package/dist/esm/bcm-date.entry.js +178 -0
  233. package/dist/esm/bcm-datetime-picker.entry.js +1446 -0
  234. package/dist/esm/bcm-default.entry.js +4 -4
  235. package/dist/esm/bcm-drawer.entry.js +10 -9
  236. package/dist/esm/bcm-dropdown.entry.js +6 -6
  237. package/dist/esm/bcm-error-layout.entry.js +2 -2
  238. package/dist/esm/bcm-expansion-panel.entry.js +7 -7
  239. package/dist/esm/bcm-form-2.entry.js +209 -0
  240. package/dist/esm/bcm-input-custom.entry.js +5 -5
  241. package/dist/esm/bcm-input-dropdown.entry.js +11 -10
  242. package/dist/esm/bcm-item.entry.js +6 -6
  243. package/dist/esm/bcm-items.entry.js +5 -5
  244. package/dist/esm/bcm-link.entry.js +2 -2
  245. package/dist/esm/bcm-list_3.entry.js +16 -14
  246. package/dist/esm/bcm-menu.entry.js +11 -10
  247. package/dist/esm/bcm-message.entry.js +2 -2
  248. package/dist/esm/bcm-modal-2-footer.entry.js +10 -9
  249. package/dist/esm/bcm-modal-2-header.entry.js +9 -8
  250. package/dist/esm/bcm-modal-2.entry.js +10 -9
  251. package/dist/esm/bcm-modal.entry.js +7 -7
  252. package/dist/esm/bcm-notification.entry.js +2 -2
  253. package/dist/esm/bcm-old-input.entry.js +393 -0
  254. package/dist/esm/bcm-old-tag_2.entry.js +2 -2
  255. package/dist/esm/bcm-overlay_2.entry.js +3 -3
  256. package/dist/esm/bcm-popconfirm-box.entry.js +8 -8
  257. package/dist/esm/bcm-popconfirm.entry.js +5 -5
  258. package/dist/esm/bcm-popover.entry.js +9 -8
  259. package/dist/esm/bcm-progress.entry.js +6 -6
  260. package/dist/esm/bcm-radio-group.entry.js +11 -10
  261. package/dist/esm/bcm-radio.entry.js +11 -10
  262. package/dist/esm/bcm-range.entry.js +5 -5
  263. package/dist/esm/{bcm-button_15.entry.js → bcm-rc-picker.entry.js} +9 -8632
  264. package/dist/esm/bcm-result.entry.js +2 -2
  265. package/dist/esm/bcm-select-group.entry.js +2 -2
  266. package/dist/esm/bcm-select-option.entry.js +2 -2
  267. package/dist/esm/bcm-select.entry.js +3 -3
  268. package/dist/esm/bcm-shortcut.entry.js +10 -9
  269. package/dist/esm/bcm-skeleton.entry.js +9 -8
  270. package/dist/esm/bcm-step.entry.js +6 -6
  271. package/dist/esm/bcm-stepper.entry.js +11 -10
  272. package/dist/esm/bcm-switch.entry.js +6 -6
  273. package/dist/esm/bcm-tab-group.entry.js +9 -8
  274. package/dist/esm/bcm-tab-item-header.entry.js +10 -9
  275. package/dist/esm/bcm-tab-item.entry.js +9 -8
  276. package/dist/esm/bcm-tab-pane.entry.js +2 -2
  277. package/dist/esm/bcm-tab.entry.js +2 -2
  278. package/dist/esm/bcm-table.entry.js +10 -9
  279. package/dist/esm/bcm-tabs-content.entry.js +2 -2
  280. package/dist/esm/bcm-tabs.entry.js +2 -2
  281. package/dist/esm/bcm-tag.entry.js +6 -6
  282. package/dist/esm/bcm-text.entry.js +6 -6
  283. package/dist/esm/bcm-textarea.entry.js +7 -7
  284. package/dist/esm/bcm-time-picker.entry.js +146 -0
  285. package/dist/esm/bcm-timeline-item.entry.js +2 -2
  286. package/dist/esm/bcm-timeline.entry.js +2 -2
  287. package/dist/esm/bcm-toast.entry.js +6 -6
  288. package/dist/esm/bromcom-ui.js +3 -3
  289. package/dist/esm/{caption-template-fd7738eb.js → caption-template-5c43c733.js} +1 -1
  290. package/dist/esm/{color-helper-3b528349.js → color-helper-c0bb1d8a.js} +1 -1
  291. package/dist/esm/{colors-c530a5b8.js → colors-df32bb43.js} +14 -8
  292. package/dist/esm/datetime-helper-df25808a.js +9 -0
  293. package/dist/esm/{generate-56856b63.js → generate-bcc4b036.js} +2 -2
  294. package/dist/esm/{global-c0272f2f.js → global-158eb485.js} +1 -1
  295. package/dist/esm/{Overflow-2cffcda0.js → index-a6d9d0af.js} +89 -2298
  296. package/dist/esm/{index-f549811f.js → index-b84bc8c9.js} +1 -1
  297. package/dist/esm/{input-template-19a34625.js → input-template-673e33b3.js} +2 -2
  298. package/dist/esm/{json-parse-decarator-c9a132f1.js → json-parse-decarator-c5dee289.js} +1 -1
  299. package/dist/esm/{label-template-374fbdcd.js → label-template-c15569c4.js} +1 -1
  300. package/dist/esm/loader.js +3 -3
  301. package/dist/esm/{lodash-4197be99.js → lodash-0a4396a7.js} +1 -1
  302. package/dist/esm/moment-15cd9198.js +4598 -0
  303. package/dist/esm/{number-helper-0501b786.js → number-helper-f6f2817c.js} +1 -1
  304. package/dist/esm/old-bcm-popover-box.entry.js +8 -8
  305. package/dist/esm/old-bcm-popover.entry.js +5 -5
  306. package/dist/esm/{package-a9b6e2c6.js → package-255a905d.js} +1 -1
  307. package/dist/esm/{popover-placement-d12fec40.js → popover-placement-2f5939ea.js} +1 -1
  308. package/dist/esm/{slot-template-2a19b2db.js → slot-template-7c36d3be.js} +1 -1
  309. package/dist/esm/{stepper-states-a4b1efb3.js → stepper-states-aef71cbc.js} +1 -1
  310. package/dist/esm/{string-helper-3592bdc2.js → string-helper-85990695.js} +1 -1
  311. package/dist/esm/{tooltip-helper-de7eb9a3.js → tooltip-helper-b27db4cd.js} +6 -5
  312. package/dist/esm/{validators-be951131.js → validators-2052b679.js} +2 -6
  313. package/dist/types/components/molecules/input/input.style.d.ts +576 -0
  314. package/dist/types/components/molecules/input/input2.d.ts +64 -0
  315. package/dist/types/components/molecules/number-input/number-input.d.ts +66 -17
  316. package/dist/types/components/molecules/number-input/react-input.d.ts +16 -0
  317. package/dist/types/components.d.ts +203 -19
  318. package/package.json +3 -2
  319. package/dist/bromcom-ui/p-0533a1b0.entry.js +0 -5
  320. package/dist/bromcom-ui/p-0a44db90.entry.js +0 -5
  321. package/dist/bromcom-ui/p-19783732.entry.js +0 -5
  322. package/dist/bromcom-ui/p-1e5df686.entry.js +0 -5
  323. package/dist/bromcom-ui/p-350719ca.entry.js +0 -5
  324. package/dist/bromcom-ui/p-376a20ed.js +0 -5
  325. package/dist/bromcom-ui/p-385a50b0.entry.js +0 -5
  326. package/dist/bromcom-ui/p-3a43bf45.js +0 -5
  327. package/dist/bromcom-ui/p-3c04d0f7.entry.js +0 -5
  328. package/dist/bromcom-ui/p-3e2fb868.entry.js +0 -5
  329. package/dist/bromcom-ui/p-44faabe9.entry.js +0 -5
  330. package/dist/bromcom-ui/p-4d5eb722.entry.js +0 -5
  331. package/dist/bromcom-ui/p-58ca54dc.js +0 -5
  332. package/dist/bromcom-ui/p-60dd2172.entry.js +0 -5
  333. package/dist/bromcom-ui/p-6146d180.entry.js +0 -5
  334. package/dist/bromcom-ui/p-62804f2c.entry.js +0 -5
  335. package/dist/bromcom-ui/p-6e961eb9.entry.js +0 -7
  336. package/dist/bromcom-ui/p-7175c984.entry.js +0 -5
  337. package/dist/bromcom-ui/p-7222a8db.entry.js +0 -5
  338. package/dist/bromcom-ui/p-75e4f799.entry.js +0 -5
  339. package/dist/bromcom-ui/p-76f6db61.entry.js +0 -5
  340. package/dist/bromcom-ui/p-7b9e8f58.entry.js +0 -5
  341. package/dist/bromcom-ui/p-8b00d553.entry.js +0 -5
  342. package/dist/bromcom-ui/p-a516049b.entry.js +0 -5
  343. package/dist/bromcom-ui/p-a62adacd.js +0 -5
  344. package/dist/bromcom-ui/p-aaf36d5c.entry.js +0 -5
  345. package/dist/bromcom-ui/p-ab2dcd70.entry.js +0 -5
  346. package/dist/bromcom-ui/p-b12c8235.js +0 -5
  347. package/dist/bromcom-ui/p-b2c6659a.entry.js +0 -5
  348. package/dist/bromcom-ui/p-b381e7f1.js +0 -19
  349. package/dist/bromcom-ui/p-b4755ed0.entry.js +0 -5
  350. package/dist/bromcom-ui/p-cc449a87.entry.js +0 -5
  351. package/dist/bromcom-ui/p-d43d75d2.entry.js +0 -5
  352. package/dist/bromcom-ui/p-e0ab7b38.js +0 -11
  353. package/dist/bromcom-ui/p-f2b520a4.entry.js +0 -5
  354. package/dist/cjs/bcm-button_15.cjs.entry.js +0 -18623
  355. package/dist/cjs/bcm-number-input.cjs.entry.js +0 -108
  356. package/dist/collection/components/molecules/number-input/number-input.css +0 -137
  357. package/dist/collection/components/molecules/number-input/number-input.style.js +0 -45
  358. package/dist/esm/bcm-number-input.entry.js +0 -104
  359. package/dist/types/components/molecules/number-input/number-input.style.d.ts +0 -200
@@ -0,0 +1,1242 @@
1
+ /*!
2
+ * Built with Stencil
3
+ * Copyright (c) Bromcom.
4
+ */
5
+ import { proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
6
+ import { r as react, a as reactDom } from './index3.js';
7
+
8
+ /**
9
+ * react-number-format - 5.3.1
10
+ * Author : Sudhanshu Yadav
11
+ * Copyright (c) 2016, 2023 to Sudhanshu Yadav, released under the MIT license.
12
+ * https://github.com/s-yadav/react-number-format
13
+ */
14
+
15
+ /******************************************************************************
16
+ Copyright (c) Microsoft Corporation.
17
+
18
+ Permission to use, copy, modify, and/or distribute this software for any
19
+ purpose with or without fee is hereby granted.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
22
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
24
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
25
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
+ PERFORMANCE OF THIS SOFTWARE.
28
+ ***************************************************************************** */
29
+
30
+ function __rest$1(s, e) {
31
+ var t = {};
32
+ for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
33
+ { t[p] = s[p]; } }
34
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
35
+ { for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
36
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
37
+ { t[p[i]] = s[p[i]]; }
38
+ } }
39
+ return t;
40
+ }
41
+
42
+ var SourceType;
43
+ (function (SourceType) {
44
+ SourceType["event"] = "event";
45
+ SourceType["props"] = "prop";
46
+ })(SourceType || (SourceType = {}));
47
+
48
+ // basic noop function
49
+ function noop() { }
50
+ function memoizeOnce(cb) {
51
+ var lastArgs;
52
+ var lastValue = undefined;
53
+ return function () {
54
+ var args = [], len = arguments.length;
55
+ while ( len-- ) args[ len ] = arguments[ len ];
56
+
57
+ if (lastArgs &&
58
+ args.length === lastArgs.length &&
59
+ args.every(function (value, index) { return value === lastArgs[index]; })) {
60
+ return lastValue;
61
+ }
62
+ lastArgs = args;
63
+ lastValue = cb.apply(void 0, args);
64
+ return lastValue;
65
+ };
66
+ }
67
+ function charIsNumber(char) {
68
+ return !!(char || '').match(/\d/);
69
+ }
70
+ function isNil(val) {
71
+ return val === null || val === undefined;
72
+ }
73
+ function isNanValue(val) {
74
+ return typeof val === 'number' && isNaN(val);
75
+ }
76
+ function isNotValidValue(val) {
77
+ return isNil(val) || isNanValue(val) || (typeof val === 'number' && !isFinite(val));
78
+ }
79
+ function escapeRegExp(str) {
80
+ return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
81
+ }
82
+ function getThousandsGroupRegex(thousandsGroupStyle) {
83
+ switch (thousandsGroupStyle) {
84
+ case 'lakh':
85
+ return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
86
+ case 'wan':
87
+ return /(\d)(?=(\d{4})+(?!\d))/g;
88
+ case 'thousand':
89
+ default:
90
+ return /(\d)(?=(\d{3})+(?!\d))/g;
91
+ }
92
+ }
93
+ function applyThousandSeparator(str, thousandSeparator, thousandsGroupStyle) {
94
+ var thousandsGroupRegex = getThousandsGroupRegex(thousandsGroupStyle);
95
+ var index = str.search(/[1-9]/);
96
+ index = index === -1 ? str.length : index;
97
+ return (str.substring(0, index) +
98
+ str.substring(index, str.length).replace(thousandsGroupRegex, '$1' + thousandSeparator));
99
+ }
100
+ function usePersistentCallback(cb) {
101
+ var callbackRef = react.useRef(cb);
102
+ // keep the callback ref upto date
103
+ callbackRef.current = cb;
104
+ /**
105
+ * initialize a persistent callback which never changes
106
+ * through out the component lifecycle
107
+ */
108
+ var persistentCbRef = react.useRef(function () {
109
+ var args = [], len = arguments.length;
110
+ while ( len-- ) args[ len ] = arguments[ len ];
111
+
112
+ return callbackRef.current.apply(callbackRef, args);
113
+ });
114
+ return persistentCbRef.current;
115
+ }
116
+ //spilt a float number into different parts beforeDecimal, afterDecimal, and negation
117
+ function splitDecimal(numStr, allowNegative) {
118
+ if ( allowNegative === void 0 ) allowNegative = true;
119
+
120
+ var hasNegation = numStr[0] === '-';
121
+ var addNegation = hasNegation && allowNegative;
122
+ numStr = numStr.replace('-', '');
123
+ var parts = numStr.split('.');
124
+ var beforeDecimal = parts[0];
125
+ var afterDecimal = parts[1] || '';
126
+ return {
127
+ beforeDecimal: beforeDecimal,
128
+ afterDecimal: afterDecimal,
129
+ hasNegation: hasNegation,
130
+ addNegation: addNegation,
131
+ };
132
+ }
133
+ function fixLeadingZero(numStr) {
134
+ if (!numStr)
135
+ { return numStr; }
136
+ var isNegative = numStr[0] === '-';
137
+ if (isNegative)
138
+ { numStr = numStr.substring(1, numStr.length); }
139
+ var parts = numStr.split('.');
140
+ var beforeDecimal = parts[0].replace(/^0+/, '') || '0';
141
+ var afterDecimal = parts[1] || '';
142
+ return ("" + (isNegative ? '-' : '') + beforeDecimal + (afterDecimal ? ("." + afterDecimal) : ''));
143
+ }
144
+ /**
145
+ * limit decimal numbers to given scale
146
+ * Not used .fixedTo because that will break with big numbers
147
+ */
148
+ function limitToScale(numStr, scale, fixedDecimalScale) {
149
+ var str = '';
150
+ var filler = fixedDecimalScale ? '0' : '';
151
+ for (var i = 0; i <= scale - 1; i++) {
152
+ str += numStr[i] || filler;
153
+ }
154
+ return str;
155
+ }
156
+ function repeat(str, count) {
157
+ return Array(count + 1).join(str);
158
+ }
159
+ function toNumericString(num) {
160
+ var _num = num + ''; // typecast number to string
161
+ // store the sign and remove it from the number.
162
+ var sign = _num[0] === '-' ? '-' : '';
163
+ if (sign)
164
+ { _num = _num.substring(1); }
165
+ // split the number into cofficient and exponent
166
+ var ref = _num.split(/[eE]/g);
167
+ var coefficient = ref[0];
168
+ var exponent = ref[1];
169
+ // covert exponent to number;
170
+ exponent = Number(exponent);
171
+ // if there is no exponent part or its 0, return the coffiecient with sign
172
+ if (!exponent)
173
+ { return sign + coefficient; }
174
+ coefficient = coefficient.replace('.', '');
175
+ /**
176
+ * for scientific notation the current decimal index will be after first number (index 0)
177
+ * So effective decimal index will always be 1 + exponent value
178
+ */
179
+ var decimalIndex = 1 + exponent;
180
+ var coffiecientLn = coefficient.length;
181
+ if (decimalIndex < 0) {
182
+ // if decimal index is less then 0 add preceding 0s
183
+ // add 1 as join will have
184
+ coefficient = '0.' + repeat('0', Math.abs(decimalIndex)) + coefficient;
185
+ }
186
+ else if (decimalIndex >= coffiecientLn) {
187
+ // if decimal index is less then 0 add leading 0s
188
+ coefficient = coefficient + repeat('0', decimalIndex - coffiecientLn);
189
+ }
190
+ else {
191
+ // else add decimal point at proper index
192
+ coefficient =
193
+ (coefficient.substring(0, decimalIndex) || '0') + '.' + coefficient.substring(decimalIndex);
194
+ }
195
+ return sign + coefficient;
196
+ }
197
+ /**
198
+ * This method is required to round prop value to given scale.
199
+ * Not used .round or .fixedTo because that will break with big numbers
200
+ */
201
+ function roundToPrecision(numStr, scale, fixedDecimalScale) {
202
+ //if number is empty don't do anything return empty string
203
+ if (['', '-'].indexOf(numStr) !== -1)
204
+ { return numStr; }
205
+ var shouldHaveDecimalSeparator = (numStr.indexOf('.') !== -1 || fixedDecimalScale) && scale;
206
+ var ref = splitDecimal(numStr);
207
+ var beforeDecimal = ref.beforeDecimal;
208
+ var afterDecimal = ref.afterDecimal;
209
+ var hasNegation = ref.hasNegation;
210
+ var floatValue = parseFloat(("0." + (afterDecimal || '0')));
211
+ var floatValueStr = afterDecimal.length <= scale ? ("0." + afterDecimal) : floatValue.toFixed(scale);
212
+ var roundedDecimalParts = floatValueStr.split('.');
213
+ var intPart = beforeDecimal
214
+ .split('')
215
+ .reverse()
216
+ .reduce(function (roundedStr, current, idx) {
217
+ if (roundedStr.length > idx) {
218
+ return ((Number(roundedStr[0]) + Number(current)).toString() +
219
+ roundedStr.substring(1, roundedStr.length));
220
+ }
221
+ return current + roundedStr;
222
+ }, roundedDecimalParts[0]);
223
+ var decimalPart = limitToScale(roundedDecimalParts[1] || '', scale, fixedDecimalScale);
224
+ var negation = hasNegation ? '-' : '';
225
+ var decimalSeparator = shouldHaveDecimalSeparator ? '.' : '';
226
+ return ("" + negation + intPart + decimalSeparator + decimalPart);
227
+ }
228
+ /** set the caret positon in an input field **/
229
+ function setCaretPosition(el, caretPos) {
230
+ el.value = el.value;
231
+ // ^ this is used to not only get 'focus', but
232
+ // to make sure we don't have it everything -selected-
233
+ // (it causes an issue in chrome, and having it doesn't hurt any other browser)
234
+ if (el !== null) {
235
+ /* @ts-ignore */
236
+ if (el.createTextRange) {
237
+ /* @ts-ignore */
238
+ var range = el.createTextRange();
239
+ range.move('character', caretPos);
240
+ range.select();
241
+ return true;
242
+ }
243
+ // (el.selectionStart === 0 added for Firefox bug)
244
+ if (el.selectionStart || el.selectionStart === 0) {
245
+ el.focus();
246
+ el.setSelectionRange(caretPos, caretPos);
247
+ return true;
248
+ }
249
+ // fail city, fortunately this never happens (as far as I've tested) :)
250
+ el.focus();
251
+ return false;
252
+ }
253
+ }
254
+ var findChangeRange = memoizeOnce(function (prevValue, newValue) {
255
+ var i = 0, j = 0;
256
+ var prevLength = prevValue.length;
257
+ var newLength = newValue.length;
258
+ while (prevValue[i] === newValue[i] && i < prevLength)
259
+ { i++; }
260
+ //check what has been changed from last
261
+ while (prevValue[prevLength - 1 - j] === newValue[newLength - 1 - j] &&
262
+ newLength - j > i &&
263
+ prevLength - j > i) {
264
+ j++;
265
+ }
266
+ return {
267
+ from: { start: i, end: prevLength - j },
268
+ to: { start: i, end: newLength - j },
269
+ };
270
+ });
271
+ /*
272
+ Returns a number whose value is limited to the given range
273
+ */
274
+ function clamp(num, min, max) {
275
+ return Math.min(Math.max(num, min), max);
276
+ }
277
+ function geInputCaretPosition(el) {
278
+ /*Max of selectionStart and selectionEnd is taken for the patch of pixel and other mobile device caret bug*/
279
+ return Math.max(el.selectionStart, el.selectionEnd);
280
+ }
281
+ function addInputMode() {
282
+ return (typeof navigator !== 'undefined' &&
283
+ !(navigator.platform && /iPhone|iPod/.test(navigator.platform)));
284
+ }
285
+ function getDefaultChangeMeta(value) {
286
+ return {
287
+ from: {
288
+ start: 0,
289
+ end: 0,
290
+ },
291
+ to: {
292
+ start: 0,
293
+ end: value.length,
294
+ },
295
+ lastValue: '',
296
+ };
297
+ }
298
+ function defaultIsCharacterSame(ref) {
299
+ var currentValue = ref.currentValue;
300
+ var formattedValue = ref.formattedValue;
301
+ var currentValueIndex = ref.currentValueIndex;
302
+ var formattedValueIndex = ref.formattedValueIndex;
303
+
304
+ return currentValue[currentValueIndex] === formattedValue[formattedValueIndex];
305
+ }
306
+ function getCaretPosition(newFormattedValue, lastFormattedValue, curValue, curCaretPos, boundary, isValidInputCharacter,
307
+ /**
308
+ * format function can change the character, the caret engine relies on mapping old value and new value
309
+ * In such case if character is changed, parent can tell which chars are equivalent
310
+ * Some example, all allowedDecimalCharacters are updated to decimalCharacters, 2nd case if user is coverting
311
+ * number to different numeric system.
312
+ */
313
+ isCharacterSame) {
314
+ if ( isCharacterSame === void 0 ) isCharacterSame = defaultIsCharacterSame;
315
+
316
+ /**
317
+ * if something got inserted on empty value, add the formatted character before the current value,
318
+ * This is to avoid the case where typed character is present on format characters
319
+ */
320
+ var firstAllowedPosition = boundary.findIndex(function (b) { return b; });
321
+ var prefixFormat = newFormattedValue.slice(0, firstAllowedPosition);
322
+ if (!lastFormattedValue && !curValue.startsWith(prefixFormat)) {
323
+ lastFormattedValue = prefixFormat;
324
+ curValue = prefixFormat + curValue;
325
+ curCaretPos = curCaretPos + prefixFormat.length;
326
+ }
327
+ var curValLn = curValue.length;
328
+ var formattedValueLn = newFormattedValue.length;
329
+ // create index map
330
+ var addedIndexMap = {};
331
+ var indexMap = new Array(curValLn);
332
+ for (var i = 0; i < curValLn; i++) {
333
+ indexMap[i] = -1;
334
+ for (var j = 0, jLn = formattedValueLn; j < jLn; j++) {
335
+ var isCharSame = isCharacterSame({
336
+ currentValue: curValue,
337
+ lastValue: lastFormattedValue,
338
+ formattedValue: newFormattedValue,
339
+ currentValueIndex: i,
340
+ formattedValueIndex: j,
341
+ });
342
+ if (isCharSame && addedIndexMap[j] !== true) {
343
+ indexMap[i] = j;
344
+ addedIndexMap[j] = true;
345
+ break;
346
+ }
347
+ }
348
+ }
349
+ /**
350
+ * For current caret position find closest characters (left and right side)
351
+ * which are properly mapped to formatted value.
352
+ * The idea is that the new caret position will exist always in the boundary of
353
+ * that mapped index
354
+ */
355
+ var pos = curCaretPos;
356
+ while (pos < curValLn && (indexMap[pos] === -1 || !isValidInputCharacter(curValue[pos]))) {
357
+ pos++;
358
+ }
359
+ // if the caret position is on last keep the endIndex as last for formatted value
360
+ var endIndex = pos === curValLn || indexMap[pos] === -1 ? formattedValueLn : indexMap[pos];
361
+ pos = curCaretPos - 1;
362
+ while (pos > 0 && indexMap[pos] === -1)
363
+ { pos--; }
364
+ var startIndex = pos === -1 || indexMap[pos] === -1 ? 0 : indexMap[pos] + 1;
365
+ /**
366
+ * case where a char is added on suffix and removed from middle, example 2sq345 becoming $2,345 sq
367
+ * there is still a mapping but the order of start index and end index is changed
368
+ */
369
+ if (startIndex > endIndex)
370
+ { return endIndex; }
371
+ /**
372
+ * given the current caret position if it closer to startIndex
373
+ * keep the new caret position on start index or keep it closer to endIndex
374
+ */
375
+ return curCaretPos - startIndex < endIndex - curCaretPos ? startIndex : endIndex;
376
+ }
377
+ /* This keeps the caret within typing area so people can't type in between prefix or suffix or format characters */
378
+ function getCaretPosInBoundary(value, caretPos, boundary, direction) {
379
+ var valLn = value.length;
380
+ // clamp caret position to [0, value.length]
381
+ caretPos = clamp(caretPos, 0, valLn);
382
+ if (direction === 'left') {
383
+ while (caretPos >= 0 && !boundary[caretPos])
384
+ { caretPos--; }
385
+ // if we don't find any suitable caret position on left, set it on first allowed position
386
+ if (caretPos === -1)
387
+ { caretPos = boundary.indexOf(true); }
388
+ }
389
+ else {
390
+ while (caretPos <= valLn && !boundary[caretPos])
391
+ { caretPos++; }
392
+ // if we don't find any suitable caret position on right, set it on last allowed position
393
+ if (caretPos > valLn)
394
+ { caretPos = boundary.lastIndexOf(true); }
395
+ }
396
+ // if we still don't find caret position, set it at the end of value
397
+ if (caretPos === -1)
398
+ { caretPos = valLn; }
399
+ return caretPos;
400
+ }
401
+ function caretUnknownFormatBoundary(formattedValue) {
402
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
403
+ for (var i = 0, ln = boundaryAry.length; i < ln; i++) {
404
+ // consider caret to be in boundary if it is before or after numeric value
405
+ boundaryAry[i] = Boolean(charIsNumber(formattedValue[i]) || charIsNumber(formattedValue[i - 1]));
406
+ }
407
+ return boundaryAry;
408
+ }
409
+ function useInternalValues(value, defaultValue, valueIsNumericString, format, removeFormatting, onValueChange) {
410
+ if ( onValueChange === void 0 ) onValueChange = noop;
411
+
412
+ var getValues = usePersistentCallback(function (value, valueIsNumericString) {
413
+ var formattedValue, numAsString;
414
+ if (isNotValidValue(value)) {
415
+ numAsString = '';
416
+ formattedValue = '';
417
+ }
418
+ else if (typeof value === 'number' || valueIsNumericString) {
419
+ numAsString = typeof value === 'number' ? toNumericString(value) : value;
420
+ formattedValue = format(numAsString);
421
+ }
422
+ else {
423
+ numAsString = removeFormatting(value, undefined);
424
+ formattedValue = format(numAsString);
425
+ }
426
+ return { formattedValue: formattedValue, numAsString: numAsString };
427
+ });
428
+ var ref = react.useState(function () {
429
+ return getValues(isNil(value) ? defaultValue : value, valueIsNumericString);
430
+ });
431
+ var values = ref[0];
432
+ var setValues = ref[1];
433
+ var _onValueChange = function (newValues, sourceInfo) {
434
+ if (newValues.formattedValue !== values.formattedValue) {
435
+ setValues({
436
+ formattedValue: newValues.formattedValue,
437
+ numAsString: newValues.value,
438
+ });
439
+ }
440
+ // call parent on value change if only if formatted value is changed
441
+ onValueChange(newValues, sourceInfo);
442
+ };
443
+ // if value is switch from controlled to uncontrolled, use the internal state's value to format with new props
444
+ var _value = value;
445
+ var _valueIsNumericString = valueIsNumericString;
446
+ if (isNil(value)) {
447
+ _value = values.numAsString;
448
+ _valueIsNumericString = true;
449
+ }
450
+ var newValues = getValues(_value, _valueIsNumericString);
451
+ react.useMemo(function () {
452
+ setValues(newValues);
453
+ }, [newValues.formattedValue]);
454
+ return [values, _onValueChange];
455
+ }
456
+
457
+ function defaultRemoveFormatting(value) {
458
+ return value.replace(/[^0-9]/g, '');
459
+ }
460
+ function defaultFormat(value) {
461
+ return value;
462
+ }
463
+ function NumberFormatBase(props) {
464
+ var type = props.type; if ( type === void 0 ) type = 'text';
465
+ var displayType = props.displayType; if ( displayType === void 0 ) displayType = 'input';
466
+ var customInput = props.customInput;
467
+ var renderText = props.renderText;
468
+ var getInputRef = props.getInputRef;
469
+ var format = props.format; if ( format === void 0 ) format = defaultFormat;
470
+ var removeFormatting = props.removeFormatting; if ( removeFormatting === void 0 ) removeFormatting = defaultRemoveFormatting;
471
+ var defaultValue = props.defaultValue;
472
+ var valueIsNumericString = props.valueIsNumericString;
473
+ var onValueChange = props.onValueChange;
474
+ var isAllowed = props.isAllowed;
475
+ var onChange = props.onChange; if ( onChange === void 0 ) onChange = noop;
476
+ var onKeyDown = props.onKeyDown; if ( onKeyDown === void 0 ) onKeyDown = noop;
477
+ var onMouseUp = props.onMouseUp; if ( onMouseUp === void 0 ) onMouseUp = noop;
478
+ var onFocus = props.onFocus; if ( onFocus === void 0 ) onFocus = noop;
479
+ var onBlur = props.onBlur; if ( onBlur === void 0 ) onBlur = noop;
480
+ var propValue = props.value;
481
+ var getCaretBoundary = props.getCaretBoundary; if ( getCaretBoundary === void 0 ) getCaretBoundary = caretUnknownFormatBoundary;
482
+ var isValidInputCharacter = props.isValidInputCharacter; if ( isValidInputCharacter === void 0 ) isValidInputCharacter = charIsNumber;
483
+ var isCharacterSame = props.isCharacterSame;
484
+ 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"]);
485
+ var ref = useInternalValues(propValue, defaultValue, Boolean(valueIsNumericString), format, removeFormatting, onValueChange);
486
+ var ref_0 = ref[0];
487
+ var formattedValue = ref_0.formattedValue;
488
+ var numAsString = ref_0.numAsString;
489
+ var onFormattedValueChange = ref[1];
490
+ var lastUpdatedValue = react.useRef({ formattedValue: formattedValue, numAsString: numAsString });
491
+ var _onValueChange = function (values, source) {
492
+ lastUpdatedValue.current = { formattedValue: values.formattedValue, numAsString: values.value };
493
+ onFormattedValueChange(values, source);
494
+ };
495
+ var ref$1 = react.useState(false);
496
+ var mounted = ref$1[0];
497
+ var setMounted = ref$1[1];
498
+ var focusedElm = react.useRef(null);
499
+ var timeout = react.useRef({
500
+ setCaretTimeout: null,
501
+ focusTimeout: null,
502
+ });
503
+ react.useEffect(function () {
504
+ setMounted(true);
505
+ return function () {
506
+ clearTimeout(timeout.current.setCaretTimeout);
507
+ clearTimeout(timeout.current.focusTimeout);
508
+ };
509
+ }, []);
510
+ var _format = format;
511
+ var getValueObject = function (formattedValue, numAsString) {
512
+ var floatValue = parseFloat(numAsString);
513
+ return {
514
+ formattedValue: formattedValue,
515
+ value: numAsString,
516
+ floatValue: isNaN(floatValue) ? undefined : floatValue,
517
+ };
518
+ };
519
+ var setPatchedCaretPosition = function (el, caretPos, currentValue) {
520
+ // don't reset the caret position when the whole input content is selected
521
+ if (el.selectionStart === 0 && el.selectionEnd === el.value.length)
522
+ { return; }
523
+ /* setting caret position within timeout of 0ms is required for mobile chrome,
524
+ otherwise browser resets the caret position after we set it
525
+ We are also setting it without timeout so that in normal browser we don't see the flickering */
526
+ setCaretPosition(el, caretPos);
527
+ timeout.current.setCaretTimeout = setTimeout(function () {
528
+ if (el.value === currentValue && el.selectionStart !== el.selectionEnd) {
529
+ setCaretPosition(el, caretPos);
530
+ }
531
+ }, 0);
532
+ };
533
+ /* This keeps the caret within typing area so people can't type in between prefix or suffix */
534
+ var correctCaretPosition = function (value, caretPos, direction) {
535
+ return getCaretPosInBoundary(value, caretPos, getCaretBoundary(value), direction);
536
+ };
537
+ var getNewCaretPosition = function (inputValue, newFormattedValue, caretPos) {
538
+ var caretBoundary = getCaretBoundary(newFormattedValue);
539
+ var updatedCaretPos = getCaretPosition(newFormattedValue, formattedValue, inputValue, caretPos, caretBoundary, isValidInputCharacter, isCharacterSame);
540
+ //correct caret position if its outside of editable area
541
+ updatedCaretPos = getCaretPosInBoundary(newFormattedValue, updatedCaretPos, caretBoundary);
542
+ return updatedCaretPos;
543
+ };
544
+ var updateValueAndCaretPosition = function (params) {
545
+ var newFormattedValue = params.formattedValue; if ( newFormattedValue === void 0 ) newFormattedValue = '';
546
+ var input = params.input;
547
+ var setCaretPosition = params.setCaretPosition; if ( setCaretPosition === void 0 ) setCaretPosition = true;
548
+ var source = params.source;
549
+ var event = params.event;
550
+ var numAsString = params.numAsString;
551
+ var caretPos = params.caretPos;
552
+ if (input) {
553
+ //calculate caret position if not defined
554
+ if (caretPos === undefined && setCaretPosition) {
555
+ var inputValue = params.inputValue || input.value;
556
+ var currentCaretPosition = geInputCaretPosition(input);
557
+ /**
558
+ * set the value imperatively, this is required for IE fix
559
+ * This is also required as if new caret position is beyond the previous value.
560
+ * Caret position will not be set correctly
561
+ */
562
+ input.value = newFormattedValue;
563
+ //get the caret position
564
+ caretPos = getNewCaretPosition(inputValue, newFormattedValue, currentCaretPosition);
565
+ }
566
+ /**
567
+ * set the value imperatively, as we set the caret position as well imperatively.
568
+ * This is to keep value and caret position in sync
569
+ */
570
+ input.value = newFormattedValue;
571
+ //set caret position, and value imperatively when element is provided
572
+ if (setCaretPosition && caretPos !== undefined) {
573
+ //set caret position
574
+ setPatchedCaretPosition(input, caretPos, newFormattedValue);
575
+ }
576
+ }
577
+ if (newFormattedValue !== formattedValue) {
578
+ // trigger onValueChange synchronously, so parent is updated along with the number format. Fix for #277, #287
579
+ _onValueChange(getValueObject(newFormattedValue, numAsString), { event: event, source: source });
580
+ }
581
+ };
582
+ /**
583
+ * if the formatted value is not synced to parent, or if the formatted value is different from last synced value sync it
584
+ * we also don't need to sync to the parent if no formatting is applied
585
+ * if the formatting props is removed, in which case last formatted value will be different from the numeric string value
586
+ * in such case we need to inform the parent.
587
+ */
588
+ react.useEffect(function () {
589
+ var ref = lastUpdatedValue.current;
590
+ var lastFormattedValue = ref.formattedValue;
591
+ var lastNumAsString = ref.numAsString;
592
+ if (formattedValue !== lastFormattedValue &&
593
+ (formattedValue !== numAsString || lastFormattedValue !== lastNumAsString)) {
594
+ _onValueChange(getValueObject(formattedValue, numAsString), {
595
+ event: undefined,
596
+ source: SourceType.props,
597
+ });
598
+ }
599
+ }, [formattedValue, numAsString]);
600
+ // also if formatted value is changed from the props, we need to update the caret position
601
+ // keep the last caret position if element is focused
602
+ var currentCaretPosition = focusedElm.current
603
+ ? geInputCaretPosition(focusedElm.current)
604
+ : undefined;
605
+ // needed to prevent warning with useLayoutEffect on server
606
+ var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
607
+ useIsomorphicLayoutEffect(function () {
608
+ var input = focusedElm.current;
609
+ if (formattedValue !== lastUpdatedValue.current.formattedValue && input) {
610
+ var caretPos = getNewCaretPosition(lastUpdatedValue.current.formattedValue, formattedValue, currentCaretPosition);
611
+ /**
612
+ * set the value imperatively, as we set the caret position as well imperatively.
613
+ * This is to keep value and caret position in sync
614
+ */
615
+ input.value = formattedValue;
616
+ setPatchedCaretPosition(input, caretPos, formattedValue);
617
+ }
618
+ }, [formattedValue]);
619
+ var formatInputValue = function (inputValue, event, source) {
620
+ var changeRange = findChangeRange(formattedValue, inputValue);
621
+ var changeMeta = Object.assign(Object.assign({}, changeRange), { lastValue: formattedValue });
622
+ var _numAsString = removeFormatting(inputValue, changeMeta);
623
+ var _formattedValue = _format(_numAsString);
624
+ // formatting can remove some of the number chars, so we need to fine number string again
625
+ _numAsString = removeFormatting(_formattedValue, undefined);
626
+ if (isAllowed && !isAllowed(getValueObject(_formattedValue, _numAsString))) {
627
+ //reset the caret position
628
+ var input = event.target;
629
+ var currentCaretPosition = geInputCaretPosition(input);
630
+ var caretPos = getNewCaretPosition(inputValue, formattedValue, currentCaretPosition);
631
+ input.value = formattedValue;
632
+ setPatchedCaretPosition(input, caretPos, formattedValue);
633
+ return false;
634
+ }
635
+ updateValueAndCaretPosition({
636
+ formattedValue: _formattedValue,
637
+ numAsString: _numAsString,
638
+ inputValue: inputValue,
639
+ event: event,
640
+ source: source,
641
+ setCaretPosition: true,
642
+ input: event.target,
643
+ });
644
+ return true;
645
+ };
646
+ var _onChange = function (e) {
647
+ var el = e.target;
648
+ var inputValue = el.value;
649
+ var changed = formatInputValue(inputValue, e, SourceType.event);
650
+ if (changed)
651
+ { onChange(e); }
652
+ };
653
+ var _onKeyDown = function (e) {
654
+ var el = e.target;
655
+ var key = e.key;
656
+ var selectionStart = el.selectionStart;
657
+ var selectionEnd = el.selectionEnd;
658
+ var value = el.value; if ( value === void 0 ) value = '';
659
+ var expectedCaretPosition;
660
+ //Handle backspace and delete against non numerical/decimal characters or arrow keys
661
+ if (key === 'ArrowLeft' || key === 'Backspace') {
662
+ expectedCaretPosition = Math.max(selectionStart - 1, 0);
663
+ }
664
+ else if (key === 'ArrowRight') {
665
+ expectedCaretPosition = Math.min(selectionStart + 1, value.length);
666
+ }
667
+ else if (key === 'Delete') {
668
+ expectedCaretPosition = selectionStart;
669
+ }
670
+ //if expectedCaretPosition is not set it means we don't want to Handle keyDown
671
+ // also if multiple characters are selected don't handle
672
+ if (expectedCaretPosition === undefined || selectionStart !== selectionEnd) {
673
+ onKeyDown(e);
674
+ return;
675
+ }
676
+ var newCaretPosition = expectedCaretPosition;
677
+ if (key === 'ArrowLeft' || key === 'ArrowRight') {
678
+ var direction = key === 'ArrowLeft' ? 'left' : 'right';
679
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, direction);
680
+ // arrow left or right only moves the caret, so no need to handle the event, if we are handling it manually
681
+ if (newCaretPosition !== expectedCaretPosition) {
682
+ e.preventDefault();
683
+ }
684
+ }
685
+ else if (key === 'Delete' && !isValidInputCharacter(value[expectedCaretPosition])) {
686
+ // in case of delete go to closest caret boundary on the right side
687
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, 'right');
688
+ }
689
+ else if (key === 'Backspace' && !isValidInputCharacter(value[expectedCaretPosition])) {
690
+ // in case of backspace go to closest caret boundary on the left side
691
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, 'left');
692
+ }
693
+ if (newCaretPosition !== expectedCaretPosition) {
694
+ setPatchedCaretPosition(el, newCaretPosition, value);
695
+ }
696
+ /* NOTE: this is just required for unit test as we need to get the newCaretPosition,
697
+ Remove this when you find different solution */
698
+ /* @ts-ignore */
699
+ if (e.isUnitTestRun) {
700
+ setPatchedCaretPosition(el, newCaretPosition, value);
701
+ }
702
+ onKeyDown(e);
703
+ };
704
+ /** required to handle the caret position when click anywhere within the input **/
705
+ var _onMouseUp = function (e) {
706
+ var el = e.target;
707
+ /**
708
+ * NOTE: we have to give default value for value as in case when custom input is provided
709
+ * value can come as undefined when nothing is provided on value prop.
710
+ */
711
+ var selectionStart = el.selectionStart;
712
+ var selectionEnd = el.selectionEnd;
713
+ var value = el.value; if ( value === void 0 ) value = '';
714
+ if (selectionStart === selectionEnd) {
715
+ var caretPosition = correctCaretPosition(value, selectionStart);
716
+ if (caretPosition !== selectionStart) {
717
+ setPatchedCaretPosition(el, caretPosition, value);
718
+ }
719
+ }
720
+ onMouseUp(e);
721
+ };
722
+ var _onFocus = function (e) {
723
+ // Workaround Chrome and Safari bug https://bugs.chromium.org/p/chromium/issues/detail?id=779328
724
+ // (onFocus event target selectionStart is always 0 before setTimeout)
725
+ if (e.persist)
726
+ { e.persist(); }
727
+ var el = e.target;
728
+ focusedElm.current = el;
729
+ timeout.current.focusTimeout = setTimeout(function () {
730
+ var selectionStart = el.selectionStart;
731
+ var selectionEnd = el.selectionEnd;
732
+ var value = el.value; if ( value === void 0 ) value = '';
733
+ var caretPosition = correctCaretPosition(value, selectionStart);
734
+ //setPatchedCaretPosition only when everything is not selected on focus (while tabbing into the field)
735
+ if (caretPosition !== selectionStart &&
736
+ !(selectionStart === 0 && selectionEnd === value.length)) {
737
+ setPatchedCaretPosition(el, caretPosition, value);
738
+ }
739
+ onFocus(e);
740
+ }, 0);
741
+ };
742
+ var _onBlur = function (e) {
743
+ focusedElm.current = null;
744
+ clearTimeout(timeout.current.focusTimeout);
745
+ clearTimeout(timeout.current.setCaretTimeout);
746
+ onBlur(e);
747
+ };
748
+ // add input mode on element based on format prop and device once the component is mounted
749
+ var inputMode = mounted && addInputMode() ? 'numeric' : undefined;
750
+ var inputProps = Object.assign({ inputMode: inputMode }, otherProps, {
751
+ type: type,
752
+ value: formattedValue,
753
+ onChange: _onChange,
754
+ onKeyDown: _onKeyDown,
755
+ onMouseUp: _onMouseUp,
756
+ onFocus: _onFocus,
757
+ onBlur: _onBlur,
758
+ });
759
+ if (displayType === 'text') {
760
+ return renderText ? (react.createElement(react.Fragment, null, renderText(formattedValue, otherProps) || null)) : (react.createElement("span", Object.assign({}, otherProps, { ref: getInputRef }), formattedValue));
761
+ }
762
+ else if (customInput) {
763
+ var CustomInput = customInput;
764
+ /* @ts-ignore */
765
+ return react.createElement(CustomInput, Object.assign({}, inputProps, { ref: getInputRef }));
766
+ }
767
+ return react.createElement("input", Object.assign({}, inputProps, { ref: getInputRef }));
768
+ }
769
+
770
+ function format(numStr, props) {
771
+ var decimalScale = props.decimalScale;
772
+ var fixedDecimalScale = props.fixedDecimalScale;
773
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
774
+ var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
775
+ var allowNegative = props.allowNegative;
776
+ var thousandsGroupStyle = props.thousandsGroupStyle; if ( thousandsGroupStyle === void 0 ) thousandsGroupStyle = 'thousand';
777
+ // don't apply formatting on empty string or '-'
778
+ if (numStr === '' || numStr === '-') {
779
+ return numStr;
780
+ }
781
+ var ref = getSeparators(props);
782
+ var thousandSeparator = ref.thousandSeparator;
783
+ var decimalSeparator = ref.decimalSeparator;
784
+ /**
785
+ * Keep the decimal separator
786
+ * when decimalScale is not defined or non zero and the numStr has decimal in it
787
+ * Or if decimalScale is > 0 and fixeDecimalScale is true (even if numStr has no decimal)
788
+ */
789
+ var hasDecimalSeparator = (decimalScale !== 0 && numStr.indexOf('.') !== -1) || (decimalScale && fixedDecimalScale);
790
+ var ref$1 = splitDecimal(numStr, allowNegative);
791
+ var beforeDecimal = ref$1.beforeDecimal;
792
+ var afterDecimal = ref$1.afterDecimal;
793
+ var addNegation = ref$1.addNegation; // eslint-disable-line prefer-const
794
+ //apply decimal precision if its defined
795
+ if (decimalScale !== undefined) {
796
+ afterDecimal = limitToScale(afterDecimal, decimalScale, !!fixedDecimalScale);
797
+ }
798
+ if (thousandSeparator) {
799
+ beforeDecimal = applyThousandSeparator(beforeDecimal, thousandSeparator, thousandsGroupStyle);
800
+ }
801
+ //add prefix and suffix when there is a number present
802
+ if (prefix)
803
+ { beforeDecimal = prefix + beforeDecimal; }
804
+ if (suffix)
805
+ { afterDecimal = afterDecimal + suffix; }
806
+ //restore negation sign
807
+ if (addNegation)
808
+ { beforeDecimal = '-' + beforeDecimal; }
809
+ numStr = beforeDecimal + ((hasDecimalSeparator && decimalSeparator) || '') + afterDecimal;
810
+ return numStr;
811
+ }
812
+ function getSeparators(props) {
813
+ var decimalSeparator = props.decimalSeparator; if ( decimalSeparator === void 0 ) decimalSeparator = '.';
814
+ var thousandSeparator = props.thousandSeparator;
815
+ var allowedDecimalSeparators = props.allowedDecimalSeparators;
816
+ if (thousandSeparator === true) {
817
+ thousandSeparator = ',';
818
+ }
819
+ if (!allowedDecimalSeparators) {
820
+ allowedDecimalSeparators = [decimalSeparator, '.'];
821
+ }
822
+ return {
823
+ decimalSeparator: decimalSeparator,
824
+ thousandSeparator: thousandSeparator,
825
+ allowedDecimalSeparators: allowedDecimalSeparators,
826
+ };
827
+ }
828
+ function handleNegation(value, allowNegative) {
829
+ if ( value === void 0 ) value = '';
830
+
831
+ var negationRegex = new RegExp('(-)');
832
+ var doubleNegationRegex = new RegExp('(-)(.)*(-)');
833
+ // Check number has '-' value
834
+ var hasNegation = negationRegex.test(value);
835
+ // Check number has 2 or more '-' values
836
+ var removeNegation = doubleNegationRegex.test(value);
837
+ //remove negation
838
+ value = value.replace(/-/g, '');
839
+ if (hasNegation && !removeNegation && allowNegative) {
840
+ value = '-' + value;
841
+ }
842
+ return value;
843
+ }
844
+ function getNumberRegex(decimalSeparator, global) {
845
+ return new RegExp(("(^-)|[0-9]|" + (escapeRegExp(decimalSeparator))), global ? 'g' : undefined);
846
+ }
847
+ function isNumericString(val, prefix, suffix) {
848
+ // for empty value we can always treat it as numeric string
849
+ if (val === '')
850
+ { return true; }
851
+ 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)));
852
+ }
853
+ function removeFormatting(value, changeMeta, props) {
854
+ var assign;
855
+
856
+ if ( changeMeta === void 0 ) changeMeta = getDefaultChangeMeta(value);
857
+ var allowNegative = props.allowNegative;
858
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
859
+ var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
860
+ var decimalScale = props.decimalScale;
861
+ var from = changeMeta.from;
862
+ var to = changeMeta.to;
863
+ var start = to.start;
864
+ var end = to.end;
865
+ var ref = getSeparators(props);
866
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
867
+ var decimalSeparator = ref.decimalSeparator;
868
+ var isBeforeDecimalSeparator = value[end] === decimalSeparator;
869
+ /**
870
+ * If only a number is added on empty input which matches with the prefix or suffix,
871
+ * then don't remove it, just return the same
872
+ */
873
+ if (charIsNumber(value) &&
874
+ (value === prefix || value === suffix) &&
875
+ changeMeta.lastValue === '') {
876
+ return value;
877
+ }
878
+ /** Check for any allowed decimal separator is added in the numeric format and replace it with decimal separator */
879
+ if (end - start === 1 && allowedDecimalSeparators.indexOf(value[start]) !== -1) {
880
+ var separator = decimalScale === 0 ? '' : decimalSeparator;
881
+ value = value.substring(0, start) + separator + value.substring(start + 1, value.length);
882
+ }
883
+ var stripNegation = function (value, start, end) {
884
+ /**
885
+ * if prefix starts with - we don't allow negative number to avoid confusion
886
+ * if suffix starts with - and the value length is same as suffix length, then the - sign is from the suffix
887
+ * In other cases, if the value starts with - then it is a negation
888
+ */
889
+ var hasNegation = false;
890
+ var hasDoubleNegation = false;
891
+ if (prefix.startsWith('-')) {
892
+ hasNegation = false;
893
+ }
894
+ else if (value.startsWith('--')) {
895
+ hasNegation = false;
896
+ hasDoubleNegation = true;
897
+ }
898
+ else if (suffix.startsWith('-') && value.length === suffix.length) {
899
+ hasNegation = false;
900
+ }
901
+ else if (value[0] === '-') {
902
+ hasNegation = true;
903
+ }
904
+ var charsToRemove = hasNegation ? 1 : 0;
905
+ if (hasDoubleNegation)
906
+ { charsToRemove = 2; }
907
+ // remove negation/double negation from start to simplify prefix logic as negation comes before prefix
908
+ if (charsToRemove) {
909
+ value = value.substring(charsToRemove);
910
+ // account for the removal of the negation for start and end index
911
+ start -= charsToRemove;
912
+ end -= charsToRemove;
913
+ }
914
+ return { value: value, start: start, end: end, hasNegation: hasNegation };
915
+ };
916
+ var toMetadata = stripNegation(value, start, end);
917
+ var hasNegation = toMetadata.hasNegation;
918
+ ((assign = toMetadata, value = assign.value, start = assign.start, end = assign.end));
919
+ var ref$1 = stripNegation(changeMeta.lastValue, from.start, from.end);
920
+ var fromStart = ref$1.start;
921
+ var fromEnd = ref$1.end;
922
+ var lastValue = ref$1.value;
923
+ // if only prefix and suffix part is updated reset the value to last value
924
+ // if the changed range is from suffix in the updated value, and the the suffix starts with the same characters, allow the change
925
+ var updatedSuffixPart = value.substring(start, end);
926
+ if (value.length &&
927
+ lastValue.length &&
928
+ (fromStart > lastValue.length - suffix.length || fromEnd < prefix.length) &&
929
+ !(updatedSuffixPart && suffix.startsWith(updatedSuffixPart))) {
930
+ value = lastValue;
931
+ }
932
+ /**
933
+ * remove prefix
934
+ * Remove whole prefix part if its present on the value
935
+ * If the prefix is partially deleted (in which case change start index will be less the prefix length)
936
+ * Remove only partial part of prefix.
937
+ */
938
+ var startIndex = 0;
939
+ if (value.startsWith(prefix))
940
+ { startIndex += prefix.length; }
941
+ else if (start < prefix.length)
942
+ { startIndex = start; }
943
+ value = value.substring(startIndex);
944
+ // account for deleted prefix for end
945
+ end -= startIndex;
946
+ /**
947
+ * Remove suffix
948
+ * Remove whole suffix part if its present on the value
949
+ * If the suffix is partially deleted (in which case change end index will be greater than the suffixStartIndex)
950
+ * remove the partial part of suffix
951
+ */
952
+ var endIndex = value.length;
953
+ var suffixStartIndex = value.length - suffix.length;
954
+ if (value.endsWith(suffix))
955
+ { endIndex = suffixStartIndex; }
956
+ // if the suffix is removed from the end
957
+ else if (end > suffixStartIndex)
958
+ { endIndex = end; }
959
+ // if the suffix is removed from start
960
+ else if (end > value.length - suffix.length)
961
+ { endIndex = end; }
962
+ value = value.substring(0, endIndex);
963
+ // add the negation back and handle for double negation
964
+ value = handleNegation(hasNegation ? ("-" + value) : value, allowNegative);
965
+ // remove non numeric characters
966
+ value = (value.match(getNumberRegex(decimalSeparator, true)) || []).join('');
967
+ // replace the decimalSeparator with ., and only keep the first separator, ignore following ones
968
+ var firstIndex = value.indexOf(decimalSeparator);
969
+ value = value.replace(new RegExp(escapeRegExp(decimalSeparator), 'g'), function (match, index) {
970
+ return index === firstIndex ? '.' : '';
971
+ });
972
+ //check if beforeDecimal got deleted and there is nothing after decimal,
973
+ //clear all numbers in such case while keeping the - sign
974
+ var ref$2 = splitDecimal(value, allowNegative);
975
+ var beforeDecimal = ref$2.beforeDecimal;
976
+ var afterDecimal = ref$2.afterDecimal;
977
+ var addNegation = ref$2.addNegation; // eslint-disable-line prefer-const
978
+ //clear only if something got deleted before decimal (cursor is before decimal)
979
+ if (to.end - to.start < from.end - from.start &&
980
+ beforeDecimal === '' &&
981
+ isBeforeDecimalSeparator &&
982
+ !parseFloat(afterDecimal)) {
983
+ value = addNegation ? '-' : '';
984
+ }
985
+ return value;
986
+ }
987
+ function getCaretBoundary(formattedValue, props) {
988
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
989
+ var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
990
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
991
+ var hasNegation = formattedValue[0] === '-';
992
+ // fill for prefix and negation
993
+ boundaryAry.fill(false, 0, prefix.length + (hasNegation ? 1 : 0));
994
+ // fill for suffix
995
+ var valLn = formattedValue.length;
996
+ boundaryAry.fill(false, valLn - suffix.length + 1, valLn + 1);
997
+ return boundaryAry;
998
+ }
999
+ function validateAndUpdateProps(props) {
1000
+ var ref = getSeparators(props);
1001
+ var thousandSeparator = ref.thousandSeparator;
1002
+ var decimalSeparator = ref.decimalSeparator;
1003
+ // eslint-disable-next-line prefer-const
1004
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
1005
+ var allowNegative = props.allowNegative; if ( allowNegative === void 0 ) allowNegative = true;
1006
+ if (thousandSeparator === decimalSeparator) {
1007
+ 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 "));
1008
+ }
1009
+ if (prefix.startsWith('-') && allowNegative) {
1010
+ // TODO: throw error in next major version
1011
+ console.error(("\n Prefix can't start with '-' when allowNegative is true.\n prefix: " + prefix + "\n allowNegative: " + allowNegative + "\n "));
1012
+ allowNegative = false;
1013
+ }
1014
+ return Object.assign(Object.assign({}, props), { allowNegative: allowNegative });
1015
+ }
1016
+ function useNumericFormat(props) {
1017
+ // validate props
1018
+ props = validateAndUpdateProps(props);
1019
+ var suffix = props.suffix;
1020
+ var allowNegative = props.allowNegative;
1021
+ var allowLeadingZeros = props.allowLeadingZeros;
1022
+ var onKeyDown = props.onKeyDown; if ( onKeyDown === void 0 ) onKeyDown = noop;
1023
+ var onBlur = props.onBlur; if ( onBlur === void 0 ) onBlur = noop;
1024
+ var thousandSeparator = props.thousandSeparator;
1025
+ var decimalScale = props.decimalScale;
1026
+ var fixedDecimalScale = props.fixedDecimalScale;
1027
+ var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
1028
+ var defaultValue = props.defaultValue;
1029
+ var value = props.value;
1030
+ var valueIsNumericString = props.valueIsNumericString;
1031
+ var onValueChange = props.onValueChange;
1032
+ var restProps = __rest$1(props, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]);
1033
+ // get derived decimalSeparator and allowedDecimalSeparators
1034
+ var ref = getSeparators(props);
1035
+ var decimalSeparator = ref.decimalSeparator;
1036
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
1037
+ var _format = function (numStr) { return format(numStr, props); };
1038
+ var _removeFormatting = function (inputValue, changeMeta) { return removeFormatting(inputValue, changeMeta, props); };
1039
+ var _value = isNil(value) ? defaultValue : value;
1040
+ // try to figure out isValueNumericString based on format prop and value
1041
+ var _valueIsNumericString = valueIsNumericString !== null && valueIsNumericString !== void 0 ? valueIsNumericString : isNumericString(_value, prefix, suffix);
1042
+ if (!isNil(value)) {
1043
+ _valueIsNumericString = _valueIsNumericString || typeof value === 'number';
1044
+ }
1045
+ else if (!isNil(defaultValue)) {
1046
+ _valueIsNumericString = _valueIsNumericString || typeof defaultValue === 'number';
1047
+ }
1048
+ var roundIncomingValueToPrecision = function (value) {
1049
+ if (isNotValidValue(value))
1050
+ { return value; }
1051
+ if (typeof value === 'number') {
1052
+ value = toNumericString(value);
1053
+ }
1054
+ /**
1055
+ * only round numeric or float string values coming through props,
1056
+ * we don't need to do it for onChange events, as we want to prevent typing there
1057
+ */
1058
+ if (_valueIsNumericString && typeof decimalScale === 'number') {
1059
+ return roundToPrecision(value, decimalScale, Boolean(fixedDecimalScale));
1060
+ }
1061
+ return value;
1062
+ };
1063
+ var ref$1 = useInternalValues(roundIncomingValueToPrecision(value), roundIncomingValueToPrecision(defaultValue), Boolean(_valueIsNumericString), _format, _removeFormatting, onValueChange);
1064
+ var ref$1_0 = ref$1[0];
1065
+ var numAsString = ref$1_0.numAsString;
1066
+ var formattedValue = ref$1_0.formattedValue;
1067
+ var _onValueChange = ref$1[1];
1068
+ var _onKeyDown = function (e) {
1069
+ var el = e.target;
1070
+ var key = e.key;
1071
+ var selectionStart = el.selectionStart;
1072
+ var selectionEnd = el.selectionEnd;
1073
+ var value = el.value; if ( value === void 0 ) value = '';
1074
+ // if multiple characters are selected and user hits backspace, no need to handle anything manually
1075
+ if (selectionStart !== selectionEnd) {
1076
+ onKeyDown(e);
1077
+ return;
1078
+ }
1079
+ // if user hits backspace, while the cursor is before prefix, and the input has negation, remove the negation
1080
+ if (key === 'Backspace' &&
1081
+ value[0] === '-' &&
1082
+ selectionStart === prefix.length + 1 &&
1083
+ allowNegative) {
1084
+ // bring the cursor to after negation
1085
+ setCaretPosition(el, 1);
1086
+ }
1087
+ // don't allow user to delete decimal separator when decimalScale and fixedDecimalScale is set
1088
+ if (decimalScale && fixedDecimalScale) {
1089
+ if (key === 'Backspace' && value[selectionStart - 1] === decimalSeparator) {
1090
+ setCaretPosition(el, selectionStart - 1);
1091
+ e.preventDefault();
1092
+ }
1093
+ else if (key === 'Delete' && value[selectionStart] === decimalSeparator) {
1094
+ e.preventDefault();
1095
+ }
1096
+ }
1097
+ // if user presses the allowed decimal separator before the separator, move the cursor after the separator
1098
+ if ((allowedDecimalSeparators === null || allowedDecimalSeparators === void 0 ? void 0 : allowedDecimalSeparators.includes(key)) && value[selectionStart] === decimalSeparator) {
1099
+ setCaretPosition(el, selectionStart + 1);
1100
+ }
1101
+ var _thousandSeparator = thousandSeparator === true ? ',' : thousandSeparator;
1102
+ // move cursor when delete or backspace is pressed before/after thousand separator
1103
+ if (key === 'Backspace' && value[selectionStart - 1] === _thousandSeparator) {
1104
+ setCaretPosition(el, selectionStart - 1);
1105
+ }
1106
+ if (key === 'Delete' && value[selectionStart] === _thousandSeparator) {
1107
+ setCaretPosition(el, selectionStart + 1);
1108
+ }
1109
+ onKeyDown(e);
1110
+ };
1111
+ var _onBlur = function (e) {
1112
+ var _value = numAsString;
1113
+ // if there no no numeric value, clear the input
1114
+ if (!_value.match(/\d/g)) {
1115
+ _value = '';
1116
+ }
1117
+ // clear leading 0s
1118
+ if (!allowLeadingZeros) {
1119
+ _value = fixLeadingZero(_value);
1120
+ }
1121
+ // apply fixedDecimalScale on blur event
1122
+ if (fixedDecimalScale && decimalScale) {
1123
+ _value = roundToPrecision(_value, decimalScale, fixedDecimalScale);
1124
+ }
1125
+ if (_value !== numAsString) {
1126
+ var formattedValue = format(_value, props);
1127
+ _onValueChange({
1128
+ formattedValue: formattedValue,
1129
+ value: _value,
1130
+ floatValue: parseFloat(_value),
1131
+ }, {
1132
+ event: e,
1133
+ source: SourceType.event,
1134
+ });
1135
+ }
1136
+ onBlur(e);
1137
+ };
1138
+ var isValidInputCharacter = function (inputChar) {
1139
+ if (inputChar === decimalSeparator)
1140
+ { return true; }
1141
+ return charIsNumber(inputChar);
1142
+ };
1143
+ var isCharacterSame = function (ref) {
1144
+ var currentValue = ref.currentValue;
1145
+ var lastValue = ref.lastValue;
1146
+ var formattedValue = ref.formattedValue;
1147
+ var currentValueIndex = ref.currentValueIndex;
1148
+ var formattedValueIndex = ref.formattedValueIndex;
1149
+
1150
+ var curChar = currentValue[currentValueIndex];
1151
+ var newChar = formattedValue[formattedValueIndex];
1152
+ /**
1153
+ * NOTE: as thousand separator and allowedDecimalSeparators can be same, we need to check on
1154
+ * typed range if we have typed any character from allowedDecimalSeparators, in that case we
1155
+ * consider different characters like , and . same within the range of updated value.
1156
+ */
1157
+ var typedRange = findChangeRange(lastValue, currentValue);
1158
+ var to = typedRange.to;
1159
+ if (currentValueIndex >= to.start &&
1160
+ currentValueIndex < to.end &&
1161
+ allowedDecimalSeparators &&
1162
+ allowedDecimalSeparators.includes(curChar) &&
1163
+ newChar === decimalSeparator) {
1164
+ return true;
1165
+ }
1166
+ return curChar === newChar;
1167
+ };
1168
+ return Object.assign(Object.assign({}, restProps), { value: formattedValue, valueIsNumericString: false, isValidInputCharacter: isValidInputCharacter,
1169
+ isCharacterSame: isCharacterSame, onValueChange: _onValueChange, format: _format, removeFormatting: _removeFormatting, getCaretBoundary: function (formattedValue) { return getCaretBoundary(formattedValue, props); }, onKeyDown: _onKeyDown, onBlur: _onBlur });
1170
+ }
1171
+ function NumericFormat(props) {
1172
+ var numericFormatProps = useNumericFormat(props);
1173
+ return react.createElement(NumberFormatBase, Object.assign({}, numericFormatProps));
1174
+ }
1175
+
1176
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
1177
+ var t = {};
1178
+ for (var p in s)
1179
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1180
+ t[p] = s[p];
1181
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1182
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1183
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1184
+ t[p[i]] = s[p[i]];
1185
+ }
1186
+ return t;
1187
+ };
1188
+ const BcmReactNumber = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
1189
+ constructor() {
1190
+ super();
1191
+ this.__registerHost();
1192
+ this.isRange = (value, min, max) => {
1193
+ if (value === undefined) {
1194
+ return true;
1195
+ }
1196
+ const minValid = min === undefined || value >= min;
1197
+ const maxValid = max === undefined || value <= max;
1198
+ return minValid && maxValid;
1199
+ };
1200
+ this.disabled = false;
1201
+ this.options = undefined;
1202
+ }
1203
+ componentWillRender() {
1204
+ this.init();
1205
+ }
1206
+ componentDidLoad() {
1207
+ this.init();
1208
+ }
1209
+ init() {
1210
+ const _a = this.options, { min, max, mode } = _a, rest = __rest(_a, ["min", "max", "mode"]);
1211
+ const render = react.createElement(NumericFormat, Object.assign(Object.assign({}, rest), { isAllowed: (values) => {
1212
+ if (mode === "strict") {
1213
+ return this.isRange(values.floatValue, +min, +max);
1214
+ }
1215
+ return true;
1216
+ }, onValueChange: e => {
1217
+ if (this.options.onValueChange) {
1218
+ this.options.onValueChange(e);
1219
+ }
1220
+ } }));
1221
+ reactDom.render(render, this.el);
1222
+ }
1223
+ get el() { return this; }
1224
+ }, [0, "bcm-react-number", {
1225
+ "disabled": [516],
1226
+ "options": [1040]
1227
+ }]);
1228
+ function defineCustomElement() {
1229
+ if (typeof customElements === "undefined") {
1230
+ return;
1231
+ }
1232
+ const components = ["bcm-react-number"];
1233
+ components.forEach(tagName => { switch (tagName) {
1234
+ case "bcm-react-number":
1235
+ if (!customElements.get(tagName)) {
1236
+ customElements.define(tagName, BcmReactNumber);
1237
+ }
1238
+ break;
1239
+ } });
1240
+ }
1241
+
1242
+ export { BcmReactNumber as B, defineCustomElement as d };