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