bromcom-ui 2.3.66 → 2.3.70

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 (218) hide show
  1. package/dist/bromcom-ui/{index-43956e3c.js → _commonjsHelpers-2088bffa.js} +1 -56
  2. package/dist/bromcom-ui/bcm-ad02f9c9.js +453 -0
  3. package/dist/bromcom-ui/bcm-alert.entry.js +53 -58
  4. package/dist/bromcom-ui/bcm-autocomplete.entry.js +4 -3
  5. package/dist/bromcom-ui/bcm-avatar.entry.js +27 -28
  6. package/dist/bromcom-ui/bcm-badge.entry.js +60 -31
  7. package/dist/bromcom-ui/bcm-breadcrumb.entry.js +26 -32
  8. package/dist/bromcom-ui/bcm-button.entry.js +92 -215
  9. package/dist/bromcom-ui/bcm-card-footer.entry.js +1 -1
  10. package/dist/bromcom-ui/bcm-card-header.entry.js +1 -1
  11. package/dist/bromcom-ui/bcm-card.entry.js +5 -4
  12. package/dist/bromcom-ui/bcm-checkbox-group.entry.js +253 -227
  13. package/dist/bromcom-ui/bcm-checkbox-lite.entry.js +29 -26
  14. package/dist/bromcom-ui/bcm-checkbox.entry.js +85 -89
  15. package/dist/bromcom-ui/bcm-collapse-group.entry.js +11 -16
  16. package/dist/bromcom-ui/bcm-collapse.entry.js +31 -18
  17. package/dist/bromcom-ui/bcm-colorpicker.entry.js +7 -6
  18. package/dist/bromcom-ui/bcm-comment-editor.entry.js +4 -3
  19. package/dist/bromcom-ui/bcm-comment-group.entry.js +4 -3
  20. package/dist/bromcom-ui/bcm-comment.entry.js +5 -4
  21. package/dist/bromcom-ui/bcm-date-picker.entry.js +31 -34
  22. package/dist/bromcom-ui/bcm-datetime-picker.entry.js +20 -46
  23. package/dist/bromcom-ui/bcm-divider.entry.js +11 -11
  24. package/dist/bromcom-ui/bcm-dropdown-button.entry.js +35 -61
  25. package/dist/bromcom-ui/bcm-dropdown-item.entry.js +66 -16
  26. package/dist/bromcom-ui/bcm-dropdown-list.entry.js +31 -49
  27. package/dist/bromcom-ui/bcm-dropdown.entry.js +17 -46
  28. package/dist/bromcom-ui/bcm-empty.entry.js +14 -45
  29. package/dist/bromcom-ui/bcm-error-layout.entry.js +20 -34
  30. package/dist/bromcom-ui/bcm-form-group.entry.js +3 -3
  31. package/dist/bromcom-ui/bcm-form.entry.js +31 -16
  32. package/dist/bromcom-ui/bcm-icon.entry.js +55 -35
  33. package/dist/bromcom-ui/bcm-input.entry.js +170 -276
  34. package/dist/bromcom-ui/bcm-label.entry.js +12 -549
  35. package/dist/bromcom-ui/bcm-link.entry.js +26 -5
  36. package/dist/bromcom-ui/bcm-list-2.entry.js +1063 -0
  37. package/dist/bromcom-ui/bcm-list-item.entry.js +4 -3
  38. package/dist/bromcom-ui/bcm-list-select.entry.js +14 -13
  39. package/dist/bromcom-ui/bcm-list.entry.js +10 -5
  40. package/dist/bromcom-ui/bcm-listbox-group.entry.js +5 -4
  41. package/dist/bromcom-ui/bcm-listbox-item.entry.js +5 -4
  42. package/dist/bromcom-ui/bcm-listbox.entry.js +17 -14
  43. package/dist/bromcom-ui/bcm-menu-group.entry.js +4 -3
  44. package/dist/bromcom-ui/bcm-menu-item.entry.js +4 -3
  45. package/dist/bromcom-ui/bcm-menu.entry.js +4 -3
  46. package/dist/bromcom-ui/bcm-message.entry.js +54 -50
  47. package/dist/bromcom-ui/bcm-modal.entry.js +47 -160
  48. package/dist/bromcom-ui/bcm-notification.entry.js +59 -47
  49. package/dist/bromcom-ui/bcm-popconfirm-box.entry.js +61 -21
  50. package/dist/bromcom-ui/bcm-popconfirm.entry.js +49 -93
  51. package/dist/bromcom-ui/bcm-popover-box.entry.js +44 -16
  52. package/dist/bromcom-ui/bcm-popover.entry.js +61 -101
  53. package/dist/bromcom-ui/bcm-progress.entry.js +77 -63
  54. package/dist/bromcom-ui/bcm-pulldown-group.entry.js +5 -4
  55. package/dist/bromcom-ui/bcm-pulldown-item.entry.js +4 -3
  56. package/dist/bromcom-ui/bcm-pulldown.entry.js +5 -4
  57. package/dist/bromcom-ui/bcm-radio-group.entry.js +183 -85
  58. package/dist/bromcom-ui/bcm-radio.entry.js +59 -79
  59. package/dist/bromcom-ui/bcm-range.entry.js +161 -0
  60. package/dist/bromcom-ui/bcm-result.entry.js +62 -38
  61. package/dist/bromcom-ui/bcm-search-2.entry.js +219 -0
  62. package/dist/bromcom-ui/bcm-search.entry.js +5 -4
  63. package/dist/bromcom-ui/bcm-select-box.entry.js +4 -3
  64. package/dist/bromcom-ui/bcm-select-group.entry.js +4 -3
  65. package/dist/bromcom-ui/bcm-select-option.entry.js +5 -4
  66. package/dist/bromcom-ui/bcm-select.entry.js +11 -12
  67. package/dist/bromcom-ui/bcm-selecto.entry.js +3 -2
  68. package/dist/bromcom-ui/bcm-slider.entry.js +4 -3
  69. package/dist/bromcom-ui/bcm-sub-comment.entry.js +5 -4
  70. package/dist/bromcom-ui/bcm-switch.entry.js +48 -37
  71. package/dist/bromcom-ui/bcm-tab-pane.entry.js +4 -3
  72. package/dist/bromcom-ui/bcm-tab.entry.js +8 -8
  73. package/dist/bromcom-ui/bcm-tabs-content.entry.js +5 -4
  74. package/dist/bromcom-ui/bcm-tabs.entry.js +6 -5
  75. package/dist/bromcom-ui/bcm-tag.entry.js +48 -44
  76. package/dist/bromcom-ui/bcm-text.entry.js +16 -10
  77. package/dist/bromcom-ui/bcm-textarea.entry.js +45 -68
  78. package/dist/bromcom-ui/bcm-time-picker.entry.js +4 -3
  79. package/dist/bromcom-ui/bcm-timeline-item.entry.js +10 -24
  80. package/dist/bromcom-ui/bcm-timeline.entry.js +11 -33
  81. package/dist/bromcom-ui/bcm-tooltip-box.entry.js +54 -16
  82. package/dist/bromcom-ui/bcm-tooltip.entry.js +48 -99
  83. package/dist/bromcom-ui/bcm-treeview-group.entry.js +1 -1
  84. package/dist/bromcom-ui/bcm-treeview-item.entry.js +5 -4
  85. package/dist/bromcom-ui/bcm-treeview.entry.js +6 -5
  86. package/dist/bromcom-ui/bcm-upload.entry.js +5 -4
  87. package/dist/bromcom-ui/bromcom-ui.css +40153 -35
  88. package/dist/bromcom-ui/bromcom-ui.esm.js +2 -2
  89. package/dist/bromcom-ui/caption-template-2d4ffc88.js +25 -0
  90. package/dist/bromcom-ui/color-helper-19448077.js +35 -0
  91. package/dist/bromcom-ui/{element-dragger-e40f0410.js → element-dragger-2a215f47.js} +1 -1
  92. package/dist/bromcom-ui/generate-8e440fc4.js +91 -0
  93. package/dist/bromcom-ui/index-55174f2a.js +58 -0
  94. package/dist/bromcom-ui/{index-9dbea026.js → index-dbc63c66.js} +2 -2
  95. package/dist/bromcom-ui/index-dd5c1283.js +187 -0
  96. package/dist/bromcom-ui/input-template-487d3243.js +83 -0
  97. package/dist/bromcom-ui/json-parse-decarator-223ea680.js +21 -0
  98. package/dist/bromcom-ui/label-template-501216fc.js +19 -0
  99. package/dist/bromcom-ui/number-helper-fea1966f.js +13 -0
  100. package/dist/bromcom-ui/{popover-placement-fb1f91e9.js → popover-placement-f7a6551c.js} +25 -17
  101. package/dist/bromcom-ui/property-decorators-21b15487.js +36 -0
  102. package/dist/bromcom-ui/slot-template-f79b82ee.js +9 -0
  103. package/dist/bromcom-ui/snq.es5-946822b8.js +14 -0
  104. package/dist/bromcom-ui/string-helper-35840f91.js +109 -0
  105. package/dist/bromcom-ui/types-6b2a6629.js +172 -0
  106. package/dist/bromcom-ui/{utils-1feb01eb.js → utils-333ded7f.js} +4 -1
  107. package/dist/types/components/atoms/avatar/avatar.d.ts +9 -5
  108. package/dist/types/components/atoms/badge/badge.d.ts +14 -9
  109. package/dist/types/components/atoms/button/button.d.ts +17 -10
  110. package/dist/types/components/atoms/button/types.d.ts +0 -22
  111. package/dist/types/components/atoms/divider/divider.d.ts +2 -2
  112. package/dist/types/components/atoms/icon/icon.d.ts +14 -9
  113. package/dist/types/components/atoms/label/label.d.ts +1 -2
  114. package/dist/types/components/atoms/link/link.d.ts +6 -1
  115. package/dist/types/components/atoms/states/badge.states.d.ts +7 -0
  116. package/dist/types/components/atoms/states/button.states.d.ts +7 -0
  117. package/dist/types/components/atoms/tag/tag.d.ts +14 -11
  118. package/dist/types/components/atoms/text/text.d.ts +4 -3
  119. package/dist/types/components/molecules/alert/alert.d.ts +15 -37
  120. package/dist/types/components/molecules/breadcrumb/breadcrumb.d.ts +9 -22
  121. package/dist/types/components/molecules/breadcrumb/types.d.ts +10 -0
  122. package/dist/types/components/molecules/checkbox/checkbox-lite.d.ts +7 -22
  123. package/dist/types/components/molecules/checkbox/checkbox.d.ts +26 -31
  124. package/dist/types/components/molecules/checkbox/group.d.ts +24 -83
  125. package/dist/types/components/molecules/collapse/collapse.d.ts +9 -6
  126. package/dist/types/components/molecules/collapse/group.d.ts +4 -2
  127. package/dist/types/components/molecules/dropdown/dropdown-button.d.ts +18 -31
  128. package/dist/types/components/molecules/dropdown/dropdown-item.d.ts +17 -16
  129. package/dist/types/components/molecules/dropdown/dropdown-list.d.ts +12 -35
  130. package/dist/types/components/molecules/dropdown/dropdown.d.ts +5 -30
  131. package/dist/types/components/molecules/empty/empty.d.ts +7 -24
  132. package/dist/types/components/molecules/empty/types.d.ts +0 -15
  133. package/dist/types/components/molecules/error-layout/error-layout.d.ts +6 -18
  134. package/dist/types/components/molecules/input/input.d.ts +39 -45
  135. package/dist/types/components/molecules/input/types.d.ts +13 -0
  136. package/dist/types/components/molecules/list/list-select.d.ts +0 -1
  137. package/dist/types/components/molecules/list/list.d.ts +0 -1
  138. package/dist/types/components/molecules/message/message.d.ts +13 -25
  139. package/dist/types/components/molecules/modal/modal.d.ts +12 -65
  140. package/dist/types/components/molecules/notification/notification.d.ts +14 -21
  141. package/dist/types/components/molecules/popconfirm/popconfirm-box.d.ts +14 -12
  142. package/dist/types/components/molecules/popconfirm/popconfirm.d.ts +10 -14
  143. package/dist/types/components/molecules/popover/popover-box.d.ts +10 -10
  144. package/dist/types/components/molecules/popover/popover.d.ts +13 -19
  145. package/dist/types/components/molecules/progress/progress.d.ts +8 -6
  146. package/dist/types/components/molecules/progress/types.d.ts +24 -0
  147. package/dist/types/components/molecules/radio/group.d.ts +28 -22
  148. package/dist/types/components/molecules/radio/radio.d.ts +13 -17
  149. package/dist/types/components/molecules/range/range.d.ts +36 -0
  150. package/dist/types/components/molecules/result/result.d.ts +14 -8
  151. package/dist/types/components/molecules/search-2/search-2.d.ts +30 -0
  152. package/dist/types/components/molecules/select/select.d.ts +4 -5
  153. package/dist/types/components/molecules/states/alert.states.d.ts +7 -0
  154. package/dist/types/components/molecules/states/checkbox-group.states.d.ts +53 -0
  155. package/dist/types/components/molecules/states/message.states.d.ts +7 -0
  156. package/dist/types/components/molecules/states/notification.states.d.ts +7 -0
  157. package/dist/types/components/molecules/states/radio-group.states.d.ts +47 -0
  158. package/dist/types/components/molecules/states/result.states.d.ts +7 -0
  159. package/dist/types/components/molecules/states/search.states.d.ts +13 -0
  160. package/dist/types/components/molecules/switch/switch.d.ts +18 -15
  161. package/dist/types/components/molecules/textarea/textarea.d.ts +23 -23
  162. package/dist/types/components/molecules/textarea/types.d.ts +9 -0
  163. package/dist/types/components/molecules/timeline/timeline-item.d.ts +0 -12
  164. package/dist/types/components/molecules/timeline/timeline.d.ts +2 -19
  165. package/dist/types/components/molecules/tooltip/tooltip-box.d.ts +11 -8
  166. package/dist/types/components/molecules/tooltip/tooltip.d.ts +13 -17
  167. package/dist/types/components/organism/colorpicker/colorpicker.d.ts +1 -2
  168. package/dist/types/components/organism/date-picker/date-picker.d.ts +7 -11
  169. package/dist/types/components/organism/datetime-picker/datetime-picker.d.ts +4 -5
  170. package/dist/types/components/organism/form/form.d.ts +2 -1
  171. package/dist/types/components/organism/list-2/list-2.d.ts +109 -0
  172. package/dist/types/components/organism/listbox/listbox.d.ts +1 -2
  173. package/dist/types/components/organism/states/bcm-list2.states.d.ts +24 -0
  174. package/dist/types/components/organism/tabs/tab.d.ts +2 -1
  175. package/dist/types/components/organism/time-picker/time-picker.d.ts +1 -1
  176. package/dist/types/components.d.ts +554 -511
  177. package/dist/types/decorators/json-parse-decarator.d.ts +4 -0
  178. package/dist/types/decorators/property-decorators.d.ts +6 -0
  179. package/dist/types/global/variables/colors.d.ts +0 -1
  180. package/dist/types/helper/generate.d.ts +4 -1
  181. package/dist/types/helper/number-helper.d.ts +9 -0
  182. package/dist/types/helper/string-helper.d.ts +3 -0
  183. package/dist/types/models/bcm.d.ts +1 -1
  184. package/dist/types/models/states/Atoms/bcm-Atoms-state.d.ts +34 -0
  185. package/dist/types/models/states/molecules/bcm-molecules-state.d.ts +78 -0
  186. package/dist/types/models/states/organisms/bcm-organisms-state.d.ts +71 -0
  187. package/dist/types/templates/button-template.d.ts +16 -0
  188. package/dist/types/templates/checkbox-group-template.d.ts +10 -0
  189. package/dist/types/templates/checkbox-template.d.ts +13 -0
  190. package/dist/types/templates/info-footer-template.d.ts +10 -0
  191. package/dist/types/templates/input-template.d.ts +30 -0
  192. package/dist/types/templates/list-item-template.d.ts +11 -0
  193. package/dist/types/templates/list-template.d.ts +23 -0
  194. package/dist/types/templates/tag-template.d.ts +17 -0
  195. package/dist/types/types/index.d.ts +1 -1
  196. package/dist/types/utils/popover-placement.d.ts +3 -3
  197. package/dist/types/utils/utils.d.ts +1 -0
  198. package/package.json +1 -1
  199. package/dist/bromcom-ui/bcm-content.entry.js +0 -15
  200. package/dist/bromcom-ui/bcm-dropdown-group.entry.js +0 -58
  201. package/dist/bromcom-ui/bcm-footer.entry.js +0 -15
  202. package/dist/bromcom-ui/bcm-header.entry.js +0 -15
  203. package/dist/bromcom-ui/datetime-helper-c373f888.js +0 -5
  204. package/dist/bromcom-ui/types-0e4b533d.js +0 -14
  205. package/dist/bromcom-ui/types-911a8837.js +0 -21
  206. package/dist/types/components/atoms/badge/types.d.ts +0 -4
  207. package/dist/types/components/molecules/checkbox/types.d.ts +0 -29
  208. package/dist/types/components/molecules/dropdown/dropdown-group.d.ts +0 -28
  209. package/dist/types/components/molecules/dropdown/types.d.ts +0 -20
  210. package/dist/types/components/molecules/error-layout/types.d.ts +0 -4
  211. package/dist/types/components/molecules/message/types.d.ts +0 -13
  212. package/dist/types/components/molecules/modal/modal-content.d.ts +0 -4
  213. package/dist/types/components/molecules/modal/modal-header.d.ts +0 -4
  214. package/dist/types/components/molecules/modal/model-footer.d.ts +0 -4
  215. package/dist/types/components/molecules/modal/types.d.ts +0 -41
  216. package/dist/types/components/molecules/notification/types.d.ts +0 -14
  217. package/dist/types/components/molecules/result/types.d.ts +0 -19
  218. package/dist/types/helper/datetime-helper.d.ts +0 -3
@@ -1,20 +1,36 @@
1
- import { r as registerInstance, e as createEvent, h, f as Host } from './index-9dbea026.js';
2
- import { c as classnames } from './index-43956e3c.js';
1
+ import { r as registerInstance, e as createEvent, h, f as Host } from './index-dbc63c66.js';
2
+ import { G as Generate } from './generate-8e440fc4.js';
3
+ import './_commonjsHelpers-2088bffa.js';
4
+ import { c as classnames } from './index-55174f2a.js';
5
+ import './snq.es5-946822b8.js';
6
+ import { B as Bcm } from './bcm-ad02f9c9.js';
7
+ import { S as StringHelper } from './string-helper-35840f91.js';
8
+ import { C as CaptionTemplate } from './caption-template-2d4ffc88.js';
9
+ import { I as InputTemplate } from './input-template-487d3243.js';
10
+ import { N as NumberHelper } from './number-helper-fea1966f.js';
3
11
 
4
- const inputCss = "@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}.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}:host{display:inline-block;width:100%;margin:0 0 8px 0}:host(.hidden){display:none}:host(.no-margin){margin:0}.input-container{display:flex;flex-direction:column;width:100%;max-width:256px}.input-container.full-width{max-width:100%}.input-base{flex:1 1 auto;display:inline-flex;align-items:stretch;justify-content:start;position:relative;background-color:var(--bcm-color-grey-1);border:1px solid var(--bcm-color-grey-5);border-radius:2px;vertical-align:middle;overflow:hidden;padding:0 4px;cursor:text}.input-base.focused:not(.disabled){border-color:var(--bcm-color-prime-blue-5);box-shadow:0px 0px 4px var(--bcm-color-prime-blue-6)}.input-base.focused:not(.disabled) .caret-container{opacity:1}.input-base.focused:not(.disabled) .input-clear-button{opacity:1}.input-base:hover:not(.disabled){border-color:var(--bcm-color-prime-blue-6)}.input-base:hover:not(.disabled) .caret-container{opacity:1}.input-base:hover:not(.disabled) .input-clear-button{opacity:1}.input-base.disabled{background-color:var(--bcm-color-grey-3);cursor:not-allowed}.input-base.empty .input-clear-button{display:none}.input-base.invalid{border-color:var(--bcm-color-red-6)}.error .label{color:var(--bcm-color-red-6) !important}.error .input-base{border:1px solid var(--bcm-color-red-6) !important}.input-base input{color:var(--bcm-color-grey-8);flex:1 1 auto;width:0%;border:none;border-radius:2px;background:none;box-shadow:none;padding:0;margin:0 4px;font-family:\"Roboto\", sans-serif;cursor:inherit;-webkit-appearance:none;appearance:none}.input-base input::-webkit-search-decoration,.input-base input::-webkit-search-cancel-button,.input-base input::-webkit-search-results-button,.input-base input::-webkit-search-results-decoration{-webkit-appearance:none}.input-base input::placeholder{color:var(--bcm-color-grey-6);user-select:none}.input-base input:focus{outline:none}input::-webkit-calendar-picker-indicator{-webkit-appearance:none;display:none}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}input[type=number]{-moz-appearance:textfield}.input-prefix,.input-suffix{display:inline-flex;align-items:center;justify-content:center;cursor:default;color:var(--bcm-color-grey-7)}.input-prefix ::slotted(*),.input-prefix>span{margin-left:4px}.input-suffix ::slotted(*),.input-suffix>span{margin-right:4px}.input-clear-button,.input-password-toggle{display:inline-flex;align-items:center;border:none;background:none;padding:0;cursor:pointer;margin-right:4px;transition:0.2s opacity}.input-clear-button:last-child,.input-clear-button:last-of-type,.input-password-toggle:last-child,.input-password-toggle:last-of-type{margin-right:8px}.input-clear-button:focus,.input-password-toggle:focus{outline:none}.input-clear-button{opacity:0}.label{display:flex;flex-direction:column;color:var(--bcm-color-grey-9);margin-bottom:4px}.caption-area{min-height:20px}.input-caption{display:block}.unit.input-suffix{width:24px}.unit-prefix{display:inline-flex;flex:0 0 auto;align-items:center;cursor:default;color:var(--bcm-color-grey-8)}.caret-container{opacity:0;width:30px;display:flex;flex-direction:column;justify-content:center;align-items:center;border-left:1px solid #D9D9D9;border-right:1px solid #D9D9D9;transition:0.2s opacity;user-select:none;box-sizing:border-box;margin-right:4px}.caret-container:last-of-type{margin-right:-4px;border-right:none}.caret-container .caret{display:inline-flex;height:50%;width:100%;align-items:center;justify-content:center;color:var(--bcm-color-grey-7);cursor:pointer}.caret-container .caret:hover{color:var(--bcm-color-prime-blue-6)}.caret-container .caret:active{background-color:var(--bcm-color-grey-3)}.caret-container .caret:last-child{border-top:1px solid #D9D9D9}.caret-container.disabled{background-color:var(--bcm-color-grey-3)}.caret-container.disabled .caret{cursor:not-allowed}.default-icon{margin-right:8px}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}.input-large{height:38px}.input-medium{height:30px}.input-small{height:20px}";
5
-
6
- let id = 0;
7
- const defaultIcons = {
8
- email: 'mail',
9
- tel: 'phone',
10
- search: 'search',
11
- url: 'link'
12
- };
13
- const iconSizes = {
14
- 'small': 14,
15
- 'medium': 16,
16
- 'large': 18
12
+ class Validators {
13
+ }
14
+ Validators.isEmailValid = (str) => /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(str);
15
+ Validators.isUrlValid = (str) => /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(str);
16
+ Validators.isNumberValid = (str) => /^\d+$/.test(str);
17
+ Validators.isNumberFloatValid = (str) => /^\d+(\.\d+)?$/.test(str);
18
+ Validators.isPhoneValid = (str) => /^(?=.*[0-9])[- +()0-9]+$/.test(str);
19
+ Validators.isValidate = (str, type) => {
20
+ switch (type) {
21
+ case 'email':
22
+ return Validators.isEmailValid(str);
23
+ case 'url':
24
+ return Validators.isUrlValid(str);
25
+ case 'number':
26
+ return Validators.isNumberValid(str) || Validators.isNumberFloatValid(str);
27
+ case 'phone':
28
+ return Validators.isPhoneValid(str);
29
+ default:
30
+ return true;
31
+ }
17
32
  };
33
+
18
34
  const BcmInput = class {
19
35
  constructor(hostRef) {
20
36
  registerInstance(this, hostRef);
@@ -23,40 +39,68 @@ const BcmInput = class {
23
39
  this.clear = createEvent(this, "bcm-clear", 7);
24
40
  this.change = createEvent(this, "bcm-change", 7);
25
41
  this.input = createEvent(this, "bcm-input", 7);
26
- this.inputId = `input-${++id}`;
27
- this.type = 'text';
42
+ /** Props **/
43
+ this._id = Generate.UID();
44
+ this._internal_id = Generate.UID();
28
45
  this.value = '';
29
- this.size = "medium";
30
- this.noCaption = false;
31
- this.noMargin = false;
32
- this.captionType = 'default';
33
- this.fullWidth = false;
46
+ this.size = Bcm.Size.medium;
34
47
  this.disabled = false;
35
48
  this.readonly = false;
36
49
  this.clearable = false;
37
- this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
38
- this.unit = null;
39
- this.unitPrefix = null;
40
- this.min = null;
41
- this.max = null;
42
- this.step = null;
50
+ this.type = Bcm.InputType.text;
43
51
  this.hidden = false;
44
52
  this.required = false;
45
- this.disableWatchValue = false;
53
+ this.fullWidth = false;
54
+ this.noMargin = false;
55
+ this.disableWatchValue = false; // datetimepicker
56
+ this.passwordToggle = false; // type password
46
57
  this.maxLength = null;
58
+ this.unitPrefix = null;
59
+ this.decimal = true;
60
+ this.noCaption = false;
61
+ this.captionType = Bcm.Status.default;
62
+ /** initial States **/
47
63
  this.inValid = false;
48
- this.hasFocus = false;
49
- this.isBlur = false;
64
+ this.valueCache = '';
65
+ this.focused = false;
50
66
  this.isPasswordVisible = false;
67
+ this.isBlur = false;
68
+ }
69
+ connectedCallback() {
70
+ this.valueCache = this.value;
71
+ this.captionCache = this.caption;
72
+ this.captionTypeCache = this.captionType;
73
+ }
74
+ componentWillRender() {
75
+ const { type, isBlur, value } = this;
76
+ if (value) {
77
+ switch (type) {
78
+ case "number":
79
+ {
80
+ !this.checkValid("number") && (this.validationRange());
81
+ }
82
+ break;
83
+ case "email":
84
+ {
85
+ isBlur && (this.checkValid("email"));
86
+ }
87
+ break;
88
+ case "tel":
89
+ {
90
+ isBlur && (this.checkValid("phone"));
91
+ }
92
+ break;
93
+ }
94
+ }
51
95
  }
52
- async setFocus() {
96
+ async onBcmFocus() {
53
97
  this.inputElement.focus();
54
98
  }
55
- async removeFocus() {
99
+ async onBcmBlur() {
56
100
  this.inputElement.blur();
57
101
  }
58
- async select() {
59
- return this.inputElement.select();
102
+ async onBcmSelect() {
103
+ this.inputElement.select();
60
104
  }
61
105
  async setValue(value) {
62
106
  this.inputElement.value = value;
@@ -67,7 +111,6 @@ const BcmInput = class {
67
111
  async setClear() {
68
112
  this.inputElement.value = '';
69
113
  this.value = '';
70
- return Promise.resolve();
71
114
  }
72
115
  async resetCaption() {
73
116
  this.caption = this.captionCache;
@@ -77,19 +120,45 @@ const BcmInput = class {
77
120
  async getValue() {
78
121
  return this.value;
79
122
  }
123
+ watchValue() {
124
+ if (!this.disableWatchValue && this.type != 'number') {
125
+ this.handleChange();
126
+ }
127
+ }
128
+ listenKeyDown(e) {
129
+ if (!this.disabled && !this.readonly) {
130
+ this.onBcmFocus();
131
+ if (this.type == "number") {
132
+ var which = e.which || 0;
133
+ var key = e.key;
134
+ if (which == 38) { // up arrow
135
+ e.preventDefault(),
136
+ this.stepUpOrDown('up');
137
+ }
138
+ if (which == 40) { // down arrow
139
+ e.preventDefault(),
140
+ this.stepUpOrDown('down');
141
+ }
142
+ if ((which == 190 || which == 110 || key == ".") && this.value.indexOf(".") > -1) { //.
143
+ e.preventDefault();
144
+ }
145
+ if ((which == 189 || which == 109 || key == "-")) { //-
146
+ if (this.value.charAt(0) == '-' || this.value.indexOf("-") > -1) {
147
+ e.preventDefault();
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
80
153
  handleFocus() {
81
- this.hasFocus = true;
154
+ this.focused = true;
82
155
  this.focus.emit();
156
+ this.whatchHasFocus();
83
157
  }
84
158
  handleBlur() {
85
- this.hasFocus = false;
159
+ this.focused = false;
86
160
  this.isBlur = true;
87
- if (this.type == "email") {
88
- this.isEmailValid();
89
- }
90
- if (this.type == "tel") {
91
- this.isTelValid();
92
- }
161
+ this.whatchHasFocus();
93
162
  this.blur.emit();
94
163
  }
95
164
  handleChange() {
@@ -97,15 +166,6 @@ const BcmInput = class {
97
166
  this.change.emit(this.value);
98
167
  }
99
168
  handleInput() {
100
- if (this.type == "number") {
101
- if (this.decimal == "false") {
102
- this.inputElement.value = this.inputElement.value.replace(/[^0-9-]/g, '');
103
- }
104
- else {
105
- this.inputElement.value = this.inputElement.value.replace(/[^0-9.,-]/g, '');
106
- }
107
- this.inputElement.value = this.inputElement.value.replace(/(\..*)\./g, '$1').replace(/(\-.*)\-/g, '$1');
108
- }
109
169
  this.value = this.inputElement.value;
110
170
  this.input.emit(this.value);
111
171
  }
@@ -113,268 +173,102 @@ const BcmInput = class {
113
173
  this.inputElement.value = '';
114
174
  this.value = '';
115
175
  this.inputElement.focus();
116
- this.change.emit(this.value);
117
176
  this.clear.emit(e);
118
177
  e.stopPropagation();
119
178
  }
120
179
  changePasswordVisibility() {
121
180
  this.isPasswordVisible = !this.isPasswordVisible;
122
181
  }
123
- incrementNumber() {
124
- if (!this.inValid && !this.disabled && !this.readonly) {
125
- let step = this.getNumberStep();
126
- let val = Number(this.value) + Number(step);
127
- this.value = this.numberDecimal(val);
128
- }
129
- }
130
- decrementNumber() {
131
- if (!this.inValid && !this.disabled && !this.readonly) {
132
- let step = this.getNumberStep();
133
- let val = Number(this.value) - Number(step);
134
- this.value = this.numberDecimal(val);
135
- }
136
- }
137
- getNumberStep(step = Number(this.step)) {
138
- let returnStep = 1;
139
- if (step && Number(step) == step)
140
- returnStep = step;
141
- return Number(returnStep);
142
- }
143
- connectedCallback() {
144
- this.changePasswordVisibility = this.changePasswordVisibility.bind(this);
145
- this.handleChange = this.handleChange.bind(this);
146
- this.handleBlur = this.handleBlur.bind(this);
147
- this.handleFocus = this.handleFocus.bind(this);
148
- this.handleInput = this.handleInput.bind(this);
149
- this.handleClear = this.handleClear.bind(this);
150
- this.incrementNumber = this.incrementNumber.bind(this);
151
- this.decrementNumber = this.decrementNumber.bind(this);
152
- this.valueCache = this.value;
153
- this.captionCache = this.caption;
154
- this.captionTypeCache = this.captionType;
155
- }
156
- validationRange(val = JSON.stringify({
157
- "value": this.value,
158
- "min": this.min,
159
- "max": this.max
160
- })) {
161
- let cap = null;
162
- let capType = null;
163
- let returnValidation = true;
164
- let item = JSON.parse(val);
165
- let { length, value, min, max } = item;
166
- length = parseFloat(length);
167
- value = parseFloat(value);
168
- min = parseFloat(min);
169
- max = parseFloat(max);
170
- length !== 0 && (value && (min && max && ((value < min || value > max) && (cap = "Please enter a value between " + min + " and " + max + ".",
171
- capType = "error",
172
- returnValidation = false)) || min && !max && (value < min && (cap = "Please enter a value greater than or equal to " + min + ".",
173
- capType = "error",
174
- returnValidation = false)) || !min && max && (value > max && (cap = "Please enter a value less than or equal to " + max + ".",
175
- capType = "error",
176
- returnValidation = false))));
177
- this.setCaption(cap, capType);
178
- return returnValidation;
179
- }
180
182
  setCaption(caption = null, captionType = null) {
181
- this.caption = caption ? caption : this.captionCache;
182
- this.captionType = captionType ? captionType : this.captionTypeCache;
183
+ this.caption = caption || this.captionCache;
184
+ this.captionType = captionType || this.captionTypeCache;
183
185
  this.captionError = captionType == "error" ? caption : null;
184
186
  }
185
- isEmailValid() {
186
- const { value } = this;
187
- const regexp = new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
188
- let cap = null;
189
- let capType = null;
190
- if (value && !regexp.test(value)) {
191
- cap = "Please enter a valid email address.",
192
- capType = "error",
193
- this.inValid = true;
194
- }
195
- else {
196
- this.inValid = false;
197
- }
198
- this.setCaption(cap, capType);
199
- return this.inValid;
200
- }
201
- isTelValid() {
202
- const { value } = this;
203
- const regexp = new RegExp(/^(?=.*[0-9])[- +()0-9]+$/);
204
- let cap = null;
205
- let capType = null;
206
- if (value && !regexp.test(value)) {
207
- cap = "Please enter a valid phone number.",
208
- capType = "error",
209
- this.inValid = true;
210
- }
211
- else {
212
- this.inValid = false;
213
- }
214
- this.setCaption(cap, capType);
215
- return this.inValid;
216
- }
217
- isNumberValid(caption = "Invalid number", captionType = "error") {
218
- const { value } = this;
219
- if (value && Number(value) != value) {
220
- this.inValid = true;
221
- this.setCaption(caption, captionType);
222
- return true;
223
- }
224
- this.inValid = false;
225
- return false;
226
- }
227
- setNumberUnit() {
228
- const { value, unit } = this;
229
- if (Number(value) == value && (unit === null || unit === void 0 ? void 0 : unit.length) > 0 && !value)
230
- this.value = 0;
231
- }
232
- numberDecimal(val = '') {
233
- let decLen = this.getDecimalLength();
234
- if (val && decLen)
235
- return parseFloat(val).toFixed(decLen);
236
- return val;
237
- }
238
- numberNotDecimal(val = 0) {
239
- return Math.trunc(val);
240
- }
241
- getDecimalLength() {
242
- const { step } = this;
243
- var decimalNumber = null;
244
- let returnDecimalLength = 0, splitted, splitDec;
245
- if (decimalNumber && Number(decimalNumber) == decimalNumber) {
246
- returnDecimalLength = decimalNumber;
247
- }
248
- else if (!decimalNumber && step && Number(step) == step) {
249
- if (String(step).includes(".")) {
250
- splitted = String(step).split('.');
251
- splitDec = splitted[splitted.length - 1].length;
187
+ stepUpOrDown(type) {
188
+ if (!this.inValid && !this.disabled && !this.readonly) {
189
+ let step = +(this.step) || 1;
190
+ let val = +(this.value);
191
+ if (type == 'up') {
192
+ val = +(val + step);
252
193
  }
253
194
  else {
254
- splitDec = 0;
195
+ val = +(val - step);
255
196
  }
256
- returnDecimalLength = splitDec;
197
+ this.value = val;
257
198
  }
258
- return Number(returnDecimalLength);
259
199
  }
260
- componentWillRender() {
261
- const { type } = this;
262
- if (type == "number" && this.value) {
263
- if (!this.isNumberValid()) {
264
- this.validationRange();
200
+ validationRange() {
201
+ const { min, max, value } = this;
202
+ if (value) {
203
+ if (min && max) {
204
+ if (value < min || value > max) {
205
+ this.setCaption(StringHelper.getMessage('between', [min, max]), "error");
206
+ return false;
207
+ }
265
208
  }
266
- }
267
- if (this.isBlur) {
268
- if (type == "email" && this.value) {
269
- this.isEmailValid();
209
+ else if (min) {
210
+ if (value < min) {
211
+ this.setCaption(StringHelper.getMessage('min', [min]), "error");
212
+ return false;
213
+ }
270
214
  }
271
- if (type == "tel" && this.value) {
272
- this.isTelValid();
215
+ else if (max) {
216
+ if (value > max) {
217
+ this.setCaption(StringHelper.getMessage('max', [max]), "error");
218
+ return false;
219
+ }
273
220
  }
274
221
  }
222
+ this.setCaption();
223
+ return true;
275
224
  }
276
- componentWillLoad() {
277
- const { type, value } = this;
278
- if (type == "number" && Number(value) == value) {
279
- this.value = this.numberDecimal(value);
225
+ checkValid(type) {
226
+ const { value } = this;
227
+ if (Validators.isValidate(value, type)) {
228
+ this.setCaption();
229
+ this.inValid = false;
280
230
  }
281
- }
282
- numberControl(e) {
283
- if (!this.disabled && !this.readonly) {
284
- if (this.type == "number") {
285
- var which = e.which || 0;
286
- var key = e.key;
287
- which == 38 && ( // up arrow
288
- e.preventDefault(),
289
- this.incrementNumber());
290
- which == 40 && ( // down arrow
291
- e.preventDefault(),
292
- this.decrementNumber());
293
- key == "." && String(this.value).includes(".") && ( // dot: shouldn't be more than one
294
- e.preventDefault());
295
- if (which == 8 || //backspace / delete
296
- which == 9 || //tab
297
- which == 13 || //enter
298
- which == 16 || //shift
299
- which == 17 || //ctrl
300
- which == 18 || //alt
301
- which == 46 || //delete
302
- (which == 110 && (this.type == 'number' && this.decimal != false)) || //decimal point
303
- // (which == 188 && key == ",") || //comma
304
- (which == 190 && key == "." && (this.type == 'number' && this.decimal != false)) || //period
305
- (which == 189 && this.inputElement.value.length == 0) || //-
306
- (which == 109 && this.inputElement.value.length == 0) || //-
307
- (which >= 35 && which <= 40) || //end, home, left arrow, up arrow, right arrow, down arrow
308
- (which >= 48 && which <= 57) || //0-9
309
- (which >= 96 && which <= 105) //0-9(numpad)
310
- )
311
- return true;
312
- e.preventDefault();
313
- if (this.decimal == true) {
314
- this.value = this.numberDecimal(this.value);
315
- }
316
- else if (this.decimal == false) {
317
- this.value = this.numberNotDecimal(this.value);
318
- }
319
- }
231
+ else {
232
+ this.setCaption(StringHelper.getMessage(type), "error");
233
+ this.inValid = true;
320
234
  }
235
+ return this.inValid;
321
236
  }
322
237
  whatchHasFocus() {
323
- const { type, hasFocus, value, valueCache, inValid } = this;
324
- if (type == "number") {
325
- this.isNumberValid();
326
- let inValidState = false;
327
- if (hasFocus == true) {
328
- if (inValid == true) {
329
- this.value = '';
330
- inValidState = true;
331
- }
238
+ const { type, focused, valueCache, inValid } = this;
239
+ if (type == Bcm.InputType.number && inValid) {
240
+ if (focused) {
241
+ this.value = '';
332
242
  }
333
243
  else {
334
- if (this.value == '' && inValid == false) {
335
- this.value = valueCache;
336
- inValidState = true;
244
+ if (!StringHelper.isNullOrEmpty(this.value)) {
245
+ this.value = this.value ? this.fixToNumber(this.value) : '';
337
246
  }
338
- if (value != valueCache && inValid == false && inValidState == false) {
339
- this.value = value ? this.numberDecimal(value) : '';
247
+ else {
248
+ this.value = valueCache;
340
249
  }
341
250
  }
342
251
  }
343
252
  }
344
- watchValue() {
345
- if (!this.disableWatchValue && this.type != 'number') {
346
- this.handleChange();
253
+ fixToNumber(val) {
254
+ if (val) {
255
+ const decLen = NumberHelper.getDecimalLength(this.step);
256
+ return decLen > 0 ? NumberHelper.parseFloatFixed(val, decLen) : val;
347
257
  }
258
+ return val;
348
259
  }
349
260
  render() {
350
- const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable, passwordToggle, isPasswordVisible, noDefaultIcon, unit, inValid, hasFocus, unitPrefix, noCaption, required } = this;
351
- const containerClasses = classnames('input-container', {
261
+ const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable, passwordToggle, isPasswordVisible, noDefaultIcon, unit, inValid, focused, unitPrefix, noCaption, required, hidden, noMargin, _id } = this;
262
+ const hostClasses = classnames('bcm-input', {
263
+ hidden,
264
+ 'no-margin': noMargin,
352
265
  'full-width': fullWidth,
353
- 'error': captionType == 'error' ? true : false
354
- });
355
- const baseClasses = classnames('input-base', 'input-' + size, {
356
- 'invalid': inValid,
357
- 'unit': (unit === null || unit === void 0 ? void 0 : unit.length) > 0,
358
- 'focused': hasFocus,
359
- 'disabled': disabled,
360
- 'readonly': readonly,
361
- 'empty': (value === null || value === void 0 ? void 0 : value.length) < 1
362
266
  });
363
- const inputClass = size === 'large' ? 'size-3' : 'size-2';
364
- const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
365
- const hostClasses = classnames(this.hidden ? 'hidden' : null, this.noMargin ? 'no-margin' : null);
366
- return (h(Host, { class: hostClasses }, h("div", { class: containerClasses }, label && h("div", null, h("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required, htmlFor: this.inputId })), h("div", { class: baseClasses }, h("span", { class: "input-prefix" }, h("slot", { name: "prefix" }), unitPrefix && h("span", { class: classnames(inputClass, 'unit-prefix') }, unitPrefix)), h("input", { "bcm-internal-id": this._id, id: this.inputId, class: inputClass, ref: el => (this.inputElement = el), onFocus: this.handleFocus, onBlur: this.handleBlur, onChange: this.handleChange, onInput: this.handleInput, maxLength: this.maxLength, type: type === 'password' && isPasswordVisible ? 'text' :
367
- type === 'number' ? 'text' : type, placeholder: placeholder, value: type === 'number' && !this.hasFocus
368
- ? value + (value && (unit === null || unit === void 0 ? void 0 : unit.length) > 0 ? ' ' + unit : '')
369
- : value, disabled: this.disabled, readonly: this.readonly }), clearable && !this.disabled && (h("button", { class: "input-clear-button", onClick: this.handleClear }, h("bcm-icon", { icon: "close-circle", type: "fill", size: iconSizes[size], color: "grey-7" }))), type === 'password' && passwordToggle && (h("button", { class: "input-password-toggle", onClick: this.changePasswordVisibility }, h("bcm-icon", { icon: isPasswordVisible ? "eye-invisible" : "eye", type: "outlined", size: iconSizes[size], color: "grey-7" }))), Object.keys(defaultIcons).includes(type) && !noDefaultIcon && (h("span", { class: "input-suffix default-icon" }, h("bcm-icon", { icon: defaultIcons[type], type: "outlined", size: iconSizes[size], color: "grey-7" }))), type === 'number' && (h("div", { class: classnames('caret-container', { 'unit': (unit === null || unit === void 0 ? void 0 : unit.length) > 0 }, { 'disabled': inValid }, { 'disabled': readonly }) }, h("span", { class: "caret", onClick: inValid == false && this.incrementNumber }, h("bcm-icon", { icon: "caret-up", type: "outlined", color: "grey-7", size: 8 })), h("span", { class: "caret", onClick: inValid == false && this.decrementNumber }, h("bcm-icon", { icon: "caret-down", type: "outlined", color: "grey-7", size: 8 })))), type !== 'number' && (h("span", { class: "input-suffix" }, h("slot", { name: "suffix" })))), !noCaption && (h("div", { class: "caption-area" }, captionType == "error"
370
- ? h("span", { class: captionClasses }, " ", captionError, " ")
371
- : caption && h("span", { class: captionClasses }, " ", caption, " "))))));
267
+ return (h(Host, { tabindex: "1", onfocus: () => this.onBcmFocus(), class: hostClasses, onClick: () => this.onBcmFocus() }, label && h("bcm-label", { type: captionType, value: label, required: required, htmlFor: _id }), h(InputTemplate, { id: _id, type: type, value: value, placeholder: placeholder, disabled: disabled, readonly: readonly, clearable: clearable, 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), ref: (el) => this.inputElement = el }), h(CaptionTemplate, { noCaption: noCaption, captionType: captionType, captionError: captionError, caption: caption })));
372
268
  }
373
269
  static get watchers() { return {
374
- "hasFocus": ["whatchHasFocus"],
375
270
  "value": ["watchValue"]
376
271
  }; }
377
272
  };
378
- BcmInput.style = inputCss;
379
273
 
380
274
  export { BcmInput as bcm_input };