bromcom-ui 2.11.1 → 2.12.0-test.0

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