bromcom-ui 2.8.1 → 2.9.0-rc.1

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 (240) 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-0d4a552d.entry.js → p-043beeb5.entry.js} +1 -1
  4. package/dist/bromcom-ui/{p-80a43b79.js → p-08fb3095.js} +1 -1
  5. package/dist/bromcom-ui/{p-d011a407.entry.js → p-0a28fd61.entry.js} +1 -1
  6. package/dist/bromcom-ui/{p-a49ded35.entry.js → p-0c07940d.entry.js} +1 -1
  7. package/dist/bromcom-ui/{p-02afc93f.entry.js → p-0d9741fc.entry.js} +1 -1
  8. package/dist/bromcom-ui/{p-a8a4460a.entry.js → p-11629904.entry.js} +1 -1
  9. package/dist/bromcom-ui/{p-274465b7.entry.js → p-11e7f04b.entry.js} +1 -1
  10. package/dist/bromcom-ui/{p-87df3ffb.js → p-12543c4f.js} +1 -1
  11. package/dist/bromcom-ui/{p-90894817.entry.js → p-139b0cfc.entry.js} +1 -1
  12. package/dist/bromcom-ui/{p-0d693b8b.entry.js → p-195c4c41.entry.js} +1 -1
  13. package/dist/bromcom-ui/{p-9c9babdd.entry.js → p-1b8982a8.entry.js} +1 -1
  14. package/dist/bromcom-ui/p-24aefda6.js +1 -1
  15. package/dist/bromcom-ui/{p-24a733ff.entry.js → p-25cfdc1c.entry.js} +1 -1
  16. package/dist/bromcom-ui/p-27a8f8cc.entry.js +5 -0
  17. package/dist/bromcom-ui/{p-160ef457.entry.js → p-3731f4fb.entry.js} +1 -1
  18. package/dist/bromcom-ui/{p-2ea24a6e.js → p-431b023c.js} +1 -1
  19. package/dist/bromcom-ui/{p-236def30.entry.js → p-43bb2a7c.entry.js} +1 -1
  20. package/dist/bromcom-ui/p-440afdfa.entry.js +5 -0
  21. package/dist/bromcom-ui/{p-e7028542.entry.js → p-465c6839.entry.js} +1 -1
  22. package/dist/bromcom-ui/{p-56896e3a.entry.js → p-49105365.entry.js} +1 -1
  23. package/dist/bromcom-ui/{p-e0618f5d.entry.js → p-4be5dbb6.entry.js} +1 -1
  24. package/dist/bromcom-ui/p-4fcc0d21.entry.js +5 -0
  25. package/dist/bromcom-ui/{p-b94fa326.js → p-54bcf02f.js} +1 -1
  26. package/dist/bromcom-ui/{p-0ee1ff83.entry.js → p-61f2613f.entry.js} +1 -1
  27. package/dist/bromcom-ui/{p-8864e6af.entry.js → p-62adb1ff.entry.js} +1 -1
  28. package/dist/bromcom-ui/{p-94293d46.entry.js → p-68e2ddc3.entry.js} +1 -1
  29. package/dist/bromcom-ui/{p-251bfa4c.entry.js → p-78bfd81b.entry.js} +1 -1
  30. package/dist/bromcom-ui/{p-f902b559.js → p-799af572.js} +1 -1
  31. package/dist/bromcom-ui/{p-cf7af1fc.entry.js → p-7b09e9b1.entry.js} +1 -1
  32. package/dist/bromcom-ui/{p-d1598dd5.entry.js → p-7ce49866.entry.js} +1 -1
  33. package/dist/bromcom-ui/p-8d0ca8c2.js +1 -1
  34. package/dist/bromcom-ui/{p-89f7a5c7.entry.js → p-908e7c36.entry.js} +1 -1
  35. package/dist/bromcom-ui/p-92bf3f86.js +5 -0
  36. package/dist/bromcom-ui/{p-7658ec26.entry.js → p-9bdcbb1a.entry.js} +1 -1
  37. package/dist/bromcom-ui/{p-f4f4e410.entry.js → p-9be7f6be.entry.js} +1 -1
  38. package/dist/bromcom-ui/{p-c15e0e77.entry.js → p-a104f436.entry.js} +1 -1
  39. package/dist/bromcom-ui/{p-be6d0712.entry.js → p-a1b02a4a.entry.js} +1 -1
  40. package/dist/bromcom-ui/p-a429e85b.js +1 -1
  41. package/dist/bromcom-ui/{p-dcb2ae7f.entry.js → p-abd0ebef.entry.js} +1 -1
  42. package/dist/bromcom-ui/p-b0353da0.entry.js +19 -0
  43. package/dist/bromcom-ui/p-b60bcecf.js +1 -1
  44. package/dist/bromcom-ui/{p-72b7fda0.entry.js → p-b640b81a.entry.js} +1 -1
  45. package/dist/bromcom-ui/{p-e6ce5ec8.entry.js → p-b7d6857f.entry.js} +1 -1
  46. package/dist/bromcom-ui/{p-e82340a2.entry.js → p-bad06cf8.entry.js} +1 -1
  47. package/dist/bromcom-ui/{p-625af6e2.entry.js → p-c41e87a2.entry.js} +1 -1
  48. package/dist/bromcom-ui/p-c6c6529b.entry.js +5 -0
  49. package/dist/bromcom-ui/p-cb0afdd3.entry.js +5 -0
  50. package/dist/bromcom-ui/{p-e0f440b4.js → p-cb6d3c4e.js} +1 -1
  51. package/dist/bromcom-ui/{p-a3aa9b2a.entry.js → p-cc470d2a.entry.js} +1 -1
  52. package/dist/bromcom-ui/{p-47b69111.entry.js → p-d0b8b715.entry.js} +1 -1
  53. package/dist/bromcom-ui/p-d18196f9.entry.js +5 -0
  54. package/dist/bromcom-ui/{p-4899fba4.entry.js → p-d5b645ba.entry.js} +1 -1
  55. package/dist/bromcom-ui/{p-dce2079e.entry.js → p-d78958e3.entry.js} +1 -1
  56. package/dist/bromcom-ui/p-ded0661d.entry.js +5 -0
  57. package/dist/bromcom-ui/{p-9eb2a75d.entry.js → p-e150d373.entry.js} +1 -1
  58. package/dist/bromcom-ui/{p-4dac52f8.entry.js → p-f053aa86.entry.js} +1 -1
  59. package/dist/bromcom-ui/{p-140b10d1.entry.js → p-f589ac2d.entry.js} +1 -1
  60. package/dist/bromcom-ui/{p-2fc1ab9a.entry.js → p-f606f90c.entry.js} +1 -1
  61. package/dist/bromcom-ui/{p-334e3147.entry.js → p-ff488369.entry.js} +1 -1
  62. package/dist/cjs/{bcm-634604e3.js → bcm-ab921827.js} +4 -4
  63. package/dist/cjs/bcm-accordion.cjs.entry.js +1 -1
  64. package/dist/cjs/bcm-alert.cjs.entry.js +3 -3
  65. package/dist/cjs/bcm-attendance.cjs.entry.js +1 -1
  66. package/dist/cjs/{bcm-colorful_2.cjs.entry.js → bcm-avatar_15.cjs.entry.js} +6180 -76
  67. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +1 -1
  68. package/dist/cjs/bcm-button-group.cjs.entry.js +6 -6
  69. package/dist/cjs/bcm-card.cjs.entry.js +4 -4
  70. package/dist/cjs/bcm-checkbox-group.cjs.entry.js +416 -0
  71. package/dist/cjs/bcm-checkbox-lite_9.cjs.entry.js +5 -5
  72. package/dist/cjs/bcm-checkbox_2.cjs.entry.js +193 -0
  73. package/dist/cjs/bcm-collapse.cjs.entry.js +1 -1
  74. package/dist/cjs/bcm-color-input.cjs.entry.js +5 -5
  75. package/dist/cjs/bcm-date-picker.cjs.entry.js +3 -3
  76. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +8 -8
  77. package/dist/cjs/bcm-default.cjs.entry.js +1 -1
  78. package/dist/cjs/bcm-drawer.cjs.entry.js +7 -7
  79. package/dist/cjs/bcm-dropdown.cjs.entry.js +6 -6
  80. package/dist/cjs/bcm-expansion-panel.cjs.entry.js +3 -3
  81. package/dist/cjs/bcm-form-2.cjs.entry.js +5 -4
  82. package/dist/cjs/bcm-input-custom.cjs.entry.js +1 -1
  83. package/dist/cjs/bcm-item.cjs.entry.js +3 -3
  84. package/dist/cjs/bcm-items.cjs.entry.js +3 -3
  85. package/dist/cjs/bcm-link.cjs.entry.js +3 -3
  86. package/dist/cjs/bcm-menu.cjs.entry.js +7 -7
  87. package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +5 -5
  88. package/dist/cjs/bcm-modal-2-header.cjs.entry.js +5 -5
  89. package/dist/cjs/bcm-modal-2.cjs.entry.js +6 -6
  90. package/dist/cjs/bcm-modal.cjs.entry.js +6 -6
  91. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +4 -4
  92. package/dist/cjs/bcm-popconfirm.cjs.entry.js +4 -4
  93. package/dist/cjs/bcm-popover.cjs.entry.js +8 -8
  94. package/dist/cjs/bcm-progress.cjs.entry.js +3 -3
  95. package/dist/cjs/bcm-radio-group.cjs.entry.js +9 -9
  96. package/dist/cjs/bcm-radio.cjs.entry.js +12 -12
  97. package/dist/cjs/bcm-range.cjs.entry.js +5 -5
  98. package/dist/cjs/bcm-select.cjs.entry.js +2 -2
  99. package/dist/cjs/bcm-skeleton.cjs.entry.js +1 -1
  100. package/dist/cjs/bcm-step.cjs.entry.js +2 -2
  101. package/dist/cjs/bcm-stepper.cjs.entry.js +8 -8
  102. package/dist/cjs/bcm-switch.cjs.entry.js +8 -8
  103. package/dist/cjs/bcm-tab-group.cjs.entry.js +6 -6
  104. package/dist/cjs/bcm-tab-item-header.cjs.entry.js +9 -9
  105. package/dist/cjs/bcm-tab-item.cjs.entry.js +5 -5
  106. package/dist/cjs/bcm-tag.cjs.entry.js +14 -14
  107. package/dist/cjs/bcm-text.cjs.entry.js +3 -3
  108. package/dist/cjs/bcm-textarea.cjs.entry.js +6 -6
  109. package/dist/cjs/bcm-time-picker.cjs.entry.js +3 -3
  110. package/dist/cjs/bcm-toast.cjs.entry.js +10 -10
  111. package/dist/cjs/bromcom-ui.cjs.js +1 -1
  112. package/dist/cjs/{floating-ui-74eb26d6.js → floating-ui-c9fc2202.js} +2 -2
  113. package/dist/cjs/{generate-21143214.js → generate-de243a66.js} +1 -1
  114. package/dist/cjs/{input-template-4617f909.js → input-template-4c532c3a.js} +6 -6
  115. package/dist/cjs/{json-parse-decarator-8dbf0b0e.js → json-parse-decarator-f61061cf.js} +1 -1
  116. package/dist/cjs/{label-template-cc69bc21.js → label-template-4d5f99a5.js} +3 -3
  117. package/dist/cjs/loader.cjs.js +1 -1
  118. package/dist/cjs/{number-helper-08a7ff70.js → number-helper-dedd64eb.js} +1 -1
  119. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +6 -6
  120. package/dist/cjs/old-bcm-popover.cjs.entry.js +4 -4
  121. package/dist/cjs/{popover-placement-3c8f3a72.js → popover-placement-ccb40073.js} +1 -1
  122. package/dist/cjs/{slot-template-3e59d7d8.js → slot-template-d70ea082.js} +1 -1
  123. package/dist/cjs/{stepper-states-9b6818aa.js → stepper-states-faff7944.js} +1 -1
  124. package/dist/cjs/{string-helper-45cffee0.js → string-helper-d681e5c7.js} +2 -2
  125. package/dist/cjs/{tooltip-helper-2e8b879b.js → tooltip-helper-edce6fd0.js} +9 -9
  126. package/dist/cjs/{validators-6a0077a8.js → validators-e5a6ef69.js} +1 -1
  127. package/dist/collection/collection-manifest.json +1 -0
  128. package/dist/collection/components/atoms/chip/chip-group.css +127 -0
  129. package/dist/collection/components/atoms/chip/chip-group.js +336 -0
  130. package/dist/collection/components/atoms/chip/chip.css +9 -0
  131. package/dist/collection/components/atoms/chip/chip.js +109 -26
  132. package/dist/collection/components/organism/form/form.js +1 -0
  133. package/dist/collection/components/organism/form-2/bcm-form-components.js +1 -0
  134. package/dist/collection/components/organism/list/list.css +3 -0
  135. package/dist/components/bcm-chip-group.d.ts +11 -0
  136. package/dist/components/bcm-chip-group.js +194 -0
  137. package/dist/components/bcm-chip.js +1 -100
  138. package/dist/components/bcm-form-2.js +1 -0
  139. package/dist/components/bcm-form.js +1 -0
  140. package/dist/components/bcm-list.js +1 -1702
  141. package/dist/components/chip.js +149 -0
  142. package/dist/components/generate.js +1 -1
  143. package/dist/components/index.d.ts +1 -0
  144. package/dist/components/index.js +1 -0
  145. package/dist/{esm/bcm-list.entry.js → components/list.js} +136 -31
  146. package/dist/esm/bcm-9f50af9c.js +1 -1
  147. package/dist/esm/bcm-accordion.entry.js +1 -1
  148. package/dist/esm/bcm-alert.entry.js +1 -1
  149. package/dist/esm/bcm-attendance.entry.js +1 -1
  150. package/dist/esm/{bcm-colorful_2.entry.js → bcm-avatar_15.entry.js} +6164 -73
  151. package/dist/esm/bcm-breadcrumb.entry.js +1 -1
  152. package/dist/esm/bcm-button-group.entry.js +2 -2
  153. package/dist/esm/bcm-card.entry.js +1 -1
  154. package/dist/esm/bcm-checkbox-group.entry.js +412 -0
  155. package/dist/esm/bcm-checkbox-lite_9.entry.js +2 -2
  156. package/dist/esm/bcm-checkbox_2.entry.js +188 -0
  157. package/dist/esm/bcm-collapse.entry.js +1 -1
  158. package/dist/esm/bcm-color-input.entry.js +3 -3
  159. package/dist/esm/bcm-date-picker.entry.js +2 -2
  160. package/dist/esm/bcm-datetime-picker.entry.js +2 -2
  161. package/dist/esm/bcm-default.entry.js +1 -1
  162. package/dist/esm/bcm-drawer.entry.js +4 -4
  163. package/dist/esm/bcm-dropdown.entry.js +3 -3
  164. package/dist/esm/bcm-expansion-panel.entry.js +1 -1
  165. package/dist/esm/bcm-form-2.entry.js +3 -2
  166. package/dist/esm/bcm-input-custom.entry.js +1 -1
  167. package/dist/esm/bcm-item.entry.js +2 -2
  168. package/dist/esm/bcm-items.entry.js +1 -1
  169. package/dist/esm/bcm-link.entry.js +1 -1
  170. package/dist/esm/bcm-menu.entry.js +4 -4
  171. package/dist/esm/bcm-modal-2-footer.entry.js +3 -3
  172. package/dist/esm/bcm-modal-2-header.entry.js +3 -3
  173. package/dist/esm/bcm-modal-2.entry.js +4 -4
  174. package/dist/esm/bcm-modal.entry.js +2 -2
  175. package/dist/esm/bcm-popconfirm-box.entry.js +1 -1
  176. package/dist/esm/bcm-popconfirm.entry.js +2 -2
  177. package/dist/esm/bcm-popover.entry.js +4 -4
  178. package/dist/esm/bcm-progress.entry.js +2 -2
  179. package/dist/esm/bcm-radio-group.entry.js +4 -4
  180. package/dist/esm/bcm-radio.entry.js +4 -4
  181. package/dist/esm/bcm-range.entry.js +2 -2
  182. package/dist/esm/bcm-skeleton.entry.js +1 -1
  183. package/dist/esm/bcm-step.entry.js +2 -2
  184. package/dist/esm/bcm-stepper.entry.js +5 -5
  185. package/dist/esm/bcm-switch.entry.js +2 -2
  186. package/dist/esm/bcm-tab-group.entry.js +4 -4
  187. package/dist/esm/bcm-tab-item-header.entry.js +4 -4
  188. package/dist/esm/bcm-tab-item.entry.js +3 -3
  189. package/dist/esm/bcm-tag.entry.js +3 -3
  190. package/dist/esm/bcm-textarea.entry.js +3 -3
  191. package/dist/esm/bcm-time-picker.entry.js +2 -2
  192. package/dist/esm/bcm-toast.entry.js +2 -2
  193. package/dist/esm/bromcom-ui.js +1 -1
  194. package/dist/esm/floating-ui-e7341329.js +1 -1
  195. package/dist/esm/{generate-a39b1045.js → generate-61676bf1.js} +1 -1
  196. package/dist/esm/{input-template-e1df6efd.js → input-template-606f7441.js} +2 -2
  197. package/dist/esm/{json-parse-decarator-b1ceb8c8.js → json-parse-decarator-2303670f.js} +1 -1
  198. package/dist/esm/label-template-d74fe788.js +1 -1
  199. package/dist/esm/loader.js +1 -1
  200. package/dist/esm/{number-helper-fa8e8000.js → number-helper-4ef4df19.js} +1 -1
  201. package/dist/esm/old-bcm-popover-box.entry.js +2 -2
  202. package/dist/esm/old-bcm-popover.entry.js +2 -2
  203. package/dist/esm/{stepper-states-44849ee8.js → stepper-states-9bb5528f.js} +1 -1
  204. package/dist/esm/string-helper-6bd24967.js +1 -1
  205. package/dist/esm/{tooltip-helper-10b64c23.js → tooltip-helper-79e225e7.js} +4 -4
  206. package/dist/esm/{validators-dd70be40.js → validators-c4a5912c.js} +1 -1
  207. package/dist/types/components/atoms/chip/chip-group.d.ts +26 -0
  208. package/dist/types/components/atoms/chip/chip.d.ts +18 -13
  209. package/dist/types/components.d.ts +49 -4
  210. package/package.json +1 -1
  211. package/dist/bromcom-ui/p-111c4b6a.entry.js +0 -5
  212. package/dist/bromcom-ui/p-121eca04.entry.js +0 -5
  213. package/dist/bromcom-ui/p-1eabd5dc.js +0 -10
  214. package/dist/bromcom-ui/p-55837df1.entry.js +0 -5
  215. package/dist/bromcom-ui/p-86b8672d.entry.js +0 -5
  216. package/dist/bromcom-ui/p-8c62e1ca.entry.js +0 -5
  217. package/dist/bromcom-ui/p-9d23288e.entry.js +0 -5
  218. package/dist/bromcom-ui/p-b4f40047.entry.js +0 -5
  219. package/dist/bromcom-ui/p-b5ba17a4.entry.js +0 -13
  220. package/dist/bromcom-ui/p-b85bdadc.entry.js +0 -5
  221. package/dist/bromcom-ui/p-cbb3c1f0.entry.js +0 -5
  222. package/dist/bromcom-ui/p-d155cf69.entry.js +0 -5
  223. package/dist/bromcom-ui/p-d3cb8d25.js +0 -5
  224. package/dist/bromcom-ui/p-f3d550ed.entry.js +0 -5
  225. package/dist/bromcom-ui/p-fdc8effc.entry.js +0 -5
  226. package/dist/cjs/bcm-avatar_2.cjs.entry.js +0 -139
  227. package/dist/cjs/bcm-button_7.cjs.entry.js +0 -1521
  228. package/dist/cjs/bcm-chip.cjs.entry.js +0 -74
  229. package/dist/cjs/bcm-input.cjs.entry.js +0 -370
  230. package/dist/cjs/bcm-list.cjs.entry.js +0 -1607
  231. package/dist/cjs/bcm-rc-overflow_2.cjs.entry.js +0 -2443
  232. package/dist/cjs/bcm-typography.cjs.entry.js +0 -21
  233. package/dist/cjs/index-906fb4e5.js +0 -540
  234. package/dist/esm/bcm-avatar_2.entry.js +0 -134
  235. package/dist/esm/bcm-button_7.entry.js +0 -1511
  236. package/dist/esm/bcm-chip.entry.js +0 -70
  237. package/dist/esm/bcm-input.entry.js +0 -366
  238. package/dist/esm/bcm-rc-overflow_2.entry.js +0 -2438
  239. package/dist/esm/bcm-typography.entry.js +0 -17
  240. package/dist/esm/index-6310a048.js +0 -537
@@ -1,1511 +0,0 @@
1
- /*!
2
- * Built with Stencil
3
- * Copyright (c) Bromcom.
4
- */
5
- import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-39133086.js';
6
- import { s as snq, G as Generate } from './generate-a39b1045.js';
7
- import { B as Bcm, a as Bcm$1 } from './bcm-9f50af9c.js';
8
- import { c as classnames } from './index-ed9652af.js';
9
- import { c as createStore } from './index-93e36fdb.js';
10
- import { S as SlotTemplate } from './slot-template-5b2db362.js';
11
- import { C as ColorHelper } from './color-helper-e8ce23d7.js';
12
- import { C as CaptionTemplate } from './caption-template-da16ba7b.js';
13
- import { d as delay, g as getChildElements } from './utils-57652744.js';
14
- import { I as IsLoad } from './is-load-decorator-bc14ec4b.js';
15
- import { L as LabelTemplate } from './label-template-d74fe788.js';
16
- import { S as StringHelper } from './string-helper-6bd24967.js';
17
- import './datetime-helper-df25808a.js';
18
- import './number-helper-fa8e8000.js';
19
- import './validators-dd70be40.js';
20
- import { T as Tooltip } from './tooltip-helper-10b64c23.js';
21
- import './element-dragger-89bb52fd.js';
22
- import './colors-44c95e7e.js';
23
- import './_commonjsHelpers-3016b722.js';
24
- import './colors-1d7854ea.js';
25
- import './floating-ui-e7341329.js';
26
-
27
- const variantOptions = {
28
- save: {
29
- text: 'Save',
30
- color: 'emerald',
31
- icon: 'far fa-save',
32
- iconPosition: 'prefix',
33
- },
34
- ok: {
35
- text: 'Ok',
36
- color: 'emerald',
37
- icon: 'far fa-check',
38
- iconPosition: 'prefix',
39
- },
40
- new: {
41
- text: 'New',
42
- color: 'emerald',
43
- icon: 'far fa-plus',
44
- iconPosition: 'prefix',
45
- },
46
- add: {
47
- text: 'Add',
48
- color: 'emerald',
49
- icon: 'far fa-plus',
50
- iconPosition: 'prefix',
51
- },
52
- create: {
53
- text: 'Create',
54
- color: 'emerald',
55
- icon: 'far fa-plus',
56
- iconPosition: 'prefix',
57
- },
58
- prev: {
59
- text: 'Prev',
60
- color: '',
61
- icon: 'far fa-arrow-left',
62
- iconPosition: 'prefix',
63
- },
64
- next: {
65
- text: 'Next',
66
- color: '',
67
- icon: 'far fa-arrow-right',
68
- iconPosition: 'suffix',
69
- },
70
- apply: {
71
- text: 'Apply',
72
- color: '',
73
- icon: 'far fa-check-circle',
74
- iconPosition: 'prefix',
75
- },
76
- submit: {
77
- text: 'Submit',
78
- color: '',
79
- icon: 'far fa-save',
80
- iconPosition: 'prefix',
81
- },
82
- send: {
83
- text: 'Send',
84
- color: 'emerald',
85
- icon: 'far fa-paper-plane',
86
- iconPosition: 'prefix',
87
- },
88
- delete: {
89
- text: 'Delete',
90
- color: 'red',
91
- icon: 'far fa-trash',
92
- iconPosition: 'prefix',
93
- },
94
- cancel: {
95
- text: 'Cancel',
96
- color: 'red',
97
- icon: 'far fa-times',
98
- iconPosition: 'prefix',
99
- },
100
- decline: {
101
- text: 'Decline',
102
- color: 'red',
103
- icon: 'far fa-ban',
104
- iconPosition: 'prefix',
105
- },
106
- close: {
107
- text: 'Close',
108
- color: 'red',
109
- icon: 'far fa-times-circle',
110
- iconPosition: 'prefix',
111
- },
112
- archive: {
113
- text: 'Archive',
114
- color: 'red',
115
- icon: 'far fa-folder-open',
116
- iconPosition: 'prefix',
117
- },
118
- remove: {
119
- text: 'Remove',
120
- color: 'red',
121
- icon: 'far fa-minus-circle',
122
- iconPosition: 'prefix',
123
- },
124
- edit: {
125
- text: 'Edit',
126
- color: '',
127
- icon: 'far fa-edit',
128
- iconPosition: 'prefix',
129
- },
130
- export: {
131
- text: 'Export',
132
- color: '',
133
- icon: 'far fa-sign-out',
134
- iconPosition: 'prefix',
135
- },
136
- import: {
137
- text: 'Import',
138
- color: '',
139
- icon: 'far fa-sign-in',
140
- iconPosition: 'prefix',
141
- },
142
- filter: {
143
- text: 'Filter',
144
- color: '',
145
- icon: 'far fa-filter',
146
- iconPosition: 'prefix',
147
- },
148
- update: {
149
- text: 'Update',
150
- color: '',
151
- icon: 'far fa-sync',
152
- iconPosition: 'prefix',
153
- },
154
- reset: {
155
- text: "Reset",
156
- color: "",
157
- icon: 'far fa-sync',
158
- iconPosition: "prefix",
159
- },
160
- download: {
161
- text: 'Download',
162
- color: '',
163
- icon: 'far fa-download',
164
- iconPosition: 'prefix',
165
- },
166
- };
167
- var VariantProps;
168
- (function (VariantProps) {
169
- VariantProps["save"] = "save";
170
- VariantProps["submit"] = "submit";
171
- VariantProps["ok"] = "ok";
172
- VariantProps["new"] = "new";
173
- VariantProps["add"] = "add";
174
- VariantProps["create"] = "create";
175
- VariantProps["apply"] = "apply";
176
- VariantProps["prev"] = "prev";
177
- VariantProps["next"] = "next";
178
- VariantProps["send"] = "send";
179
- VariantProps["delete"] = "delete";
180
- VariantProps["cancel"] = "cancel";
181
- VariantProps["decline"] = "decline";
182
- VariantProps["close"] = "close";
183
- VariantProps["archive"] = "archive";
184
- VariantProps["remove"] = "remove";
185
- VariantProps["edit"] = "edit";
186
- VariantProps["export"] = "export";
187
- VariantProps["import"] = "import";
188
- VariantProps["filter"] = "filter";
189
- VariantProps["update"] = "update";
190
- VariantProps["reset"] = "Reset";
191
- VariantProps["download"] = "download";
192
- })(VariantProps || (VariantProps = {}));
193
-
194
- const { state: state$1 } = createStore({
195
- value: new Map(),
196
- setData: {},
197
- removeData: {}
198
- });
199
- const setValue$1 = (val) => {
200
- const data = Object.assign(Object.assign({}, val), (variantOptions[val.variant] && {
201
- icon: variantOptions[val.variant].icon,
202
- value: variantOptions[val.variant].text,
203
- iconPosition: Bcm.IconPosition[variantOptions[val.variant].iconPosition],
204
- variantColor: variantOptions[val.variant].color
205
- }));
206
- state$1.value.set(data.id, data);
207
- };
208
- const removeValue = (_id) => {
209
- state$1.value.delete(_id);
210
- };
211
- const getValue$1 = (id) => snq(() => state$1.value.get(id), {});
212
- const buttonState = {
213
- setValue: setValue$1,
214
- removeValue,
215
- getValue: getValue$1
216
- };
217
-
218
- const ButtonTemplate = ({ value, type, componentClass, disabled, href, target, loading, isIconOnly, icon, iconPosition, id }) => {
219
- const ButtonTagType = (href) ? Bcm.HtmlElementType.a : Bcm.HtmlElementType.button;
220
- return (h(ButtonTagType, Object.assign({ id: id }, (type == Bcm.HtmlElementType.button && { type }), { class: componentClass, disabled: disabled, href: href, target: target, tabindex: "0" }),
221
- h("span", { hidden: true },
222
- h("slot", null)),
223
- loading && h("span", { class: "bcm-button__container-loading" },
224
- " ",
225
- h("span", { class: "bcm-button__container-icon" },
226
- h("i", { class: "far fa-spinner-third fa-spin" }),
227
- " ")),
228
- icon && h("span", { class: `${iconPosition} bcm-button__container-icon` },
229
- h("i", { class: `${icon}` })),
230
- !isIconOnly && (h(SlotTemplate, { className: "bcm-button__container-text", value: value })),
231
- h("slot", { name: "suffix" })));
232
- };
233
-
234
- 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.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[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)}";
235
-
236
- const BcmButton = class {
237
- constructor(hostRef) {
238
- registerInstance(this, hostRef);
239
- this.bcmClick = createEvent(this, "bcm-click", 7);
240
- this._id = Generate.UID();
241
- this.hidden = false;
242
- this.type = Bcm.ButtonType.button;
243
- this.size = Bcm.Size.medium;
244
- this.disabled = false;
245
- this.kind = Bcm.Kind.solid;
246
- this.outline = false;
247
- this.icon = undefined;
248
- this.href = undefined;
249
- this.target = undefined;
250
- this.value = undefined;
251
- this.loading = false;
252
- this.variant = undefined;
253
- this.dataDismiss = false;
254
- this.fullWidth = false;
255
- this.iconPosition = Bcm.IconPosition.prefix;
256
- this.color = undefined;
257
- this.checked = false;
258
- }
259
- handleOnClick(e) {
260
- if (this.disabled) {
261
- e.preventDefault();
262
- e.stopPropagation();
263
- return false;
264
- }
265
- }
266
- componentWillRender() {
267
- const { size, kind, icon, iconPosition, disabled, outline, href, type, target, loading, variant, fullWidth, hidden, value } = this;
268
- buttonState.setValue({
269
- id: this._id,
270
- size,
271
- type,
272
- kind,
273
- icon,
274
- iconPosition,
275
- disabled,
276
- outline,
277
- href,
278
- target,
279
- loading,
280
- variant,
281
- fullWidth,
282
- hidden,
283
- value,
284
- isIconOnly: !!(this.isHaveChildNodes() && this.icon),
285
- });
286
- }
287
- getStateData() {
288
- return buttonState.getValue(this._id);
289
- }
290
- isHaveChildNodes() {
291
- const childNodes = Array.from(this.el.childNodes);
292
- return childNodes.find(node => node.nodeType === Node.TEXT_NODE) === undefined;
293
- }
294
- setColor(color = this.color) {
295
- if (!color)
296
- return;
297
- const { kind } = this;
298
- const prefix = `--bcm-button-${kind}`;
299
- if (kind === 'solid') {
300
- return {
301
- [`${prefix}-color-default`]: ColorHelper.dsColor('white'),
302
- [`${prefix}-color-hover`]: ColorHelper.dsColor('white'),
303
- [`${prefix}-color-focus-visible`]: ColorHelper.dsColor('white'),
304
- [`${prefix}-color-active`]: ColorHelper.dsColor('white'),
305
- [`${prefix}-color-disabled`]: ColorHelper.dsColor('white'),
306
- [`${prefix}-background-color-default`]: ColorHelper.dsColor(color + '-500'),
307
- [`${prefix}-background-color-hover`]: ColorHelper.dsColor(color + '-600'),
308
- [`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(color + '-700'),
309
- [`${prefix}-background-color-active`]: ColorHelper.dsColor(color + '-800'),
310
- [`${prefix}-background-color-disabled`]: ColorHelper.dsColor('slate-400'),
311
- [`${prefix}-border-default`]: ColorHelper.dsColor(color + '-500'),
312
- [`${prefix}-border-hover`]: ColorHelper.dsColor(color + '-600'),
313
- [`${prefix}-border-focus-visible`]: ColorHelper.dsColor(color + '-700'),
314
- [`${prefix}-border-active`]: ColorHelper.dsColor(color + '-800'),
315
- [`${prefix}-border-disabled`]: ColorHelper.dsColor('slate-400')
316
- };
317
- }
318
- else if (kind == 'link') {
319
- return {
320
- [`${prefix}-color-default`]: ColorHelper.dsColor(color + '-500'),
321
- [`${prefix}-color-hover`]: ColorHelper.dsColor(color + '-600'),
322
- [`${prefix}-color-focus-visible`]: ColorHelper.dsColor(color + '-800'),
323
- [`${prefix}-color-active`]: ColorHelper.dsColor(color + '-700'),
324
- [`${prefix}-color-disabled`]: ColorHelper.dsColor('slate-400'),
325
- [`${prefix}-background-color-default`]: ColorHelper.dsColor('transparent'),
326
- [`${prefix}-background-color-hover`]: ColorHelper.dsColor('transparent'),
327
- [`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor('slate-50'),
328
- [`${prefix}-background-color-active`]: ColorHelper.dsColor('slate-50'),
329
- [`${prefix}-background-color-disabled`]: ColorHelper.dsColor('transparent'),
330
- [`${prefix}-border-default`]: ColorHelper.dsColor('transparent'),
331
- [`${prefix}-border-hover`]: ColorHelper.dsColor('transparent'),
332
- [`${prefix}-border-focus-visible`]: ColorHelper.dsColor('slate-50'),
333
- [`${prefix}-border-active`]: ColorHelper.dsColor('slate-50'),
334
- [`${prefix}-border-disabled`]: ColorHelper.dsColor('transparent')
335
- };
336
- }
337
- else if (kind == 'ghost') {
338
- return {
339
- [`${prefix}-color-default`]: ColorHelper.dsColor(color + '-600'),
340
- [`${prefix}-color-hover`]: ColorHelper.dsColor(color + '-600'),
341
- [`${prefix}-color-focus-visible`]: ColorHelper.dsColor(color + '-600'),
342
- [`${prefix}-color-active`]: ColorHelper.dsColor(color + '-600'),
343
- [`${prefix}-color-disabled`]: ColorHelper.dsColor(color + '-300'),
344
- [`${prefix}-background-color-default`]: ColorHelper.dsColor(color + '-100'),
345
- [`${prefix}-background-color-hover`]: ColorHelper.dsColor(color + '-200'),
346
- [`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(color + '-400'),
347
- [`${prefix}-background-color-active`]: ColorHelper.dsColor(color + '-300'),
348
- [`${prefix}-background-color-disabled`]: ColorHelper.dsColor(color + '-50'),
349
- [`${prefix}-border-default`]: ColorHelper.dsColor(color + '-300'),
350
- [`${prefix}-border-hover`]: ColorHelper.dsColor(color + '-400'),
351
- [`${prefix}-border-focus-visible`]: ColorHelper.dsColor(color + '-600'),
352
- [`${prefix}-border-active`]: ColorHelper.dsColor(color + '-500'),
353
- [`${prefix}-border-disabled`]: ColorHelper.dsColor(color + '-200'),
354
- };
355
- }
356
- return;
357
- }
358
- render() {
359
- const { size, kind, disabled, outline, type, href, target, loading, variantColor, fullWidth, hidden, icon, iconPosition, value, isIconOnly, iconSize } = this.getStateData();
360
- const classPrefix = 'bcm-button';
361
- let componentClass = classnames('bcm-button__container', `bcm-button__container-size-${size}`, `bcm-button__container-kind-${outline ? 'ghost' : kind}`, {
362
- 'full-width': fullWidth,
363
- 'checked': this.checked,
364
- 'disabled': disabled,
365
- });
366
- const hostClasses = classnames(`${classPrefix}`, {
367
- hidden,
368
- 'full-width': fullWidth,
369
- });
370
- return (h(Host, { class: hostClasses, style: this.setColor(variantColor), onClick: () => !disabled && this.bcmClick.emit(this.el) }, h(ButtonTemplate, { type: type, value: value, componentClass: componentClass, disabled: disabled, href: href, target: target, icon: icon, loading: loading, iconSize: iconSize, isIconOnly: isIconOnly, iconPosition: iconPosition })));
371
- }
372
- get el() { return getElement(this); }
373
- };
374
- BcmButton.style = buttonCss;
375
-
376
- const checkboxCss = "@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\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @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-caption-area{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;font-size:12px;line-height:calc(12px + 8px);color:var(--bcm-new-ds-color-slate-400);display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;flex-wrap:nowrap;margin-top:2px}.bcm-caption-area__text{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.default{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.info{color:var(--bcm-new-ds-color-blue-500)}.bcm-caption-area__text.success{color:var(--bcm-new-ds-color-emerald-500)}.bcm-caption-area__text.warning{color:var(--bcm-new-ds-color-amber-500)}.bcm-caption-area__text.error{color:var(--bcm-new-ds-color-red-500)}.bcm-caption-area__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-caption-area__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-caption-area__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}*{box-sizing:border-box}.bcm-label{display:inline-flex;align-items:flex-start;grid-gap:2px}.bcm-label__text{margin-bottom:2px;font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:inline-block;color:var(--bcm-new-ds-color-slate-600)}.bcm-label__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-label__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-label__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 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-checkbox{outline:none;border:none;--bcm-checkbox-primary-color-default:var(--bcm-new-ds-color-blue-500);--bcm-checkbox-secondary-color-default:var(--bcm-new-ds-color-white);--bcm-checkbox-primary-color-hover:var(--bcm-new-ds-color-blue-600);--bcm-checkbox-secondary-color-hover:var(--bcm-new-ds-color-slate-50);--bcm-checkbox-primary-color-focus-visible:var(--bcm-new-ds-color-blue-800);--bcm-checkbox-secondary-color-focus-visible:var(--bcm-new-ds-color-slate-50);--bcm-checkbox-primary-color-active:var(--bcm-new-ds-color-blue-700);--bcm-checkbox-secondary-color-active:var(--bcm-new-ds-color-slate-50);--bcm-checkbox-primary-color-disabled:var(--bcm-new-ds-color-slate-300);--bcm-checkbox-secondary-color-disabled:var(--bcm-new-ds-color-slate-200);display:inline-flex;width:fit-content;flex-direction:column;margin-bottom:8px}.bcm-checkbox:focus,.bcm-checkbox:hover,.bcm-checkbox:active{outline:none;border:none}.bcm-checkbox *{box-sizing:border-box}.bcm-checkbox input[type=radio],.bcm-checkbox input[type=checkbox]{-webkit-appearance:none;appearance:none;background-color:#fff;margin:0;display:none}.bcm-checkbox__input{display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;flex-wrap:nowrap;padding-top:4px}.bcm-checkbox.hidden{display:none}.bcm-checkbox :hover{cursor:pointer}.bcm-checkbox[disabled] :hover,.bcm-checkbox.disabled :hover{cursor:not-allowed}.bcm-checkbox .slot{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;font-weight:500;color:var(--bcm-new-ds-color-slate-600)}.bcm-checkbox .slot:not(:empty){margin-left:8px;margin-right:8px}.bcm-checkbox-size-small .slot{font-size:12px;line-height:calc(12px + 8px);margin-top:-2.5px}.bcm-checkbox-size-small .bcm-checkbox__input{min-height:calc(24px - 4px)}.bcm-checkbox-size-small .bcm-checkbox__label-icon{width:14px;height:14px;min-width:14px;font-size:calc(10px - 2px)}.bcm-checkbox-size-medium .slot{font-size:calc(12px + 1px);line-height:calc(12px + 8px);margin-top:-1.5px}.bcm-checkbox-size-medium .bcm-checkbox__input{min-height:calc(32px - 4px)}.bcm-checkbox-size-medium .bcm-checkbox__label-icon{width:16px;height:16px;min-width:16px;font-size:10px}.bcm-checkbox-size-large .slot{font-size:16px;line-height:calc(16px + 8px);margin-top:-1.5px}.bcm-checkbox-size-large .bcm-checkbox__input{min-height:calc(32px - 4px)}.bcm-checkbox-size-large .bcm-checkbox__label-icon{width:18px;height:18px;min-width:18px;font-size:12px}.bcm-checkbox__label{display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;flex-wrap:nowrap}.bcm-checkbox__label-icon{display:flex;flex-direction:column;align-items:center;justify-content:center;flex-wrap:nowrap;border-width:1px;border-style:solid;border-radius:2px}.bcm-checkbox__label-icon-indeterminate{position:relative}.bcm-checkbox__label-icon-indeterminate:after{content:\"\";display:block;position:absolute;width:70%;height:1.5px;background:var(--bcm-new-ds-color-white)}.bcm-checkbox__label-icon.bcm-radio__icon{width:16px;height:16px;box-sizing:border-box;border-radius:100px}.bcm-checkbox__label-icon.bcm-radio__icon .bcm-radio__icon-inner{width:10px;height:10px;border-radius:100px;background-color:var(--bcm-new-ds-color-white)}.bcm-checkbox .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-default);color:var(--bcm-checkbox-secondary-color-default);border-color:var(--bcm-new-ds-color-slate-300)}.bcm-checkbox .bcm-checkbox__label-icon-checked,.bcm-checkbox .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-default);border-color:var(--bcm-checkbox-primary-color-default)}.bcm-checkbox .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-default);background-color:var(--bcm-checkbox-secondary-color-default)}.bcm-checkbox .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-default)}.bcm-checkbox .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-default)}.bcm-checkbox:hover .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-hover);color:var(--bcm-checkbox-secondary-color-hover);border-color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-checked,.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-hover);border-color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-hover);background-color:var(--bcm-checkbox-secondary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-focus-visible);color:var(--bcm-checkbox-secondary-color-focus-visible);border-color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-checked,.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-focus-visible);border-color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-focus-visible);background-color:var(--bcm-checkbox-secondary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:active .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-active);color:var(--bcm-checkbox-secondary-color-active);border-color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-checked,.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-active);border-color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-active);background-color:var(--bcm-checkbox-secondary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon,.bcm-checkbox.disabled .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-disabled);color:var(--bcm-checkbox-secondary-color-disabled);border-color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-checked,.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate,.bcm-checkbox.disabled .bcm-checkbox__label-icon-checked,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-disabled);border-color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon,.bcm-checkbox.disabled .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-disabled);background-color:var(--bcm-checkbox-secondary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox.disabled .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[no-margin] .bcm-checkbox__input{margin:0;min-height:0;padding:0}";
377
-
378
- var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
379
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
380
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
381
- r = Reflect.decorate(decorators, target, key, desc);
382
- else
383
- for (var i = decorators.length - 1; i >= 0; i--)
384
- if (d = decorators[i])
385
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
386
- return c > 3 && r && Object.defineProperty(target, key, r), r;
387
- };
388
- const BcmCheckbox = class {
389
- constructor(hostRef) {
390
- registerInstance(this, hostRef);
391
- this.blur = createEvent(this, "bcm-blur", 7);
392
- this.focus = createEvent(this, "bcm-focus", 7);
393
- this.change = createEvent(this, "bcm-change", 7);
394
- this.changeCheckbox = createEvent(this, "bcm-change-checkbox", 7);
395
- this._id = Generate.UID();
396
- this.inGroup = false;
397
- this.value = false;
398
- this.checked = false;
399
- this.name = undefined;
400
- this.disabled = false;
401
- this.hidden = false;
402
- this.required = false;
403
- this.label = undefined;
404
- this.readonly = false;
405
- this.size = Bcm.Size.medium;
406
- this.indeterminate = null;
407
- this.color = "blue";
408
- this.caption = undefined;
409
- this.noCaption = false;
410
- this.captionError = undefined;
411
- this.captionType = Bcm.Status.default;
412
- this.captionCache = undefined;
413
- this.captionTypeCache = undefined;
414
- }
415
- connectedCallback() {
416
- this.captionCache = this.caption;
417
- this.captionTypeCache = this.captionType;
418
- this.value = this.checked;
419
- }
420
- componentDidRender() {
421
- this.inputElement.checked = this.checked;
422
- }
423
- async onBcmFocus() {
424
- this.el.focus();
425
- }
426
- async onBcmBlur() {
427
- this.el.blur();
428
- }
429
- async setClear() {
430
- this.check(false);
431
- this.handleChange();
432
- await delay(10);
433
- return Promise.resolve();
434
- }
435
- async resetCaption() {
436
- await delay(10);
437
- this.caption = this.captionCache;
438
- this.captionType = this.captionTypeCache;
439
- this.captionError = null;
440
- await delay(10);
441
- return Promise.resolve();
442
- }
443
- handleChange() {
444
- this.checked = this.inputElement.checked;
445
- this.value = this.checked;
446
- if (!this.indeterminate) {
447
- this.changeCheckbox.emit();
448
- this.change.emit({
449
- name: this.name,
450
- value: this.checked
451
- });
452
- }
453
- }
454
- watchIndeterminate(newValue, oldValue) {
455
- if (newValue != oldValue) {
456
- this.inputElement.checked = this.indeterminate == Bcm.IndeterminateType.determinate ? true : false;
457
- this.handleChange();
458
- }
459
- }
460
- async set(data) {
461
- if (typeof data === 'boolean') {
462
- await this.check(data);
463
- }
464
- }
465
- async get() {
466
- return this.checked || false;
467
- }
468
- async check(uncheck = true) {
469
- this.inputElement.checked = uncheck;
470
- this.handleChange();
471
- }
472
- handleKeyUp(ev) {
473
- if (ev.keyCode == Bcm.KeyCode.space || ev.keyCode == Bcm.KeyCode.enter) {
474
- if (!this.disabled && !this.readonly) {
475
- this.inputElement.checked = !this.inputElement.checked;
476
- this.handleChange();
477
- }
478
- ev.stopPropagation();
479
- ev.preventDefault();
480
- return false;
481
- }
482
- }
483
- watchChecked() {
484
- if (this.checked) {
485
- this.resetCaption();
486
- }
487
- this.value = this.checked;
488
- }
489
- setColor(color = this.color) {
490
- if (!color)
491
- return;
492
- const prefix = `--bcm-checkbox`;
493
- return {
494
- [`${prefix}-primary-color-default`]: ColorHelper.dsColor(color + '-500'),
495
- [`${prefix}-primary-color-hover`]: ColorHelper.dsColor(color + '-600'),
496
- [`${prefix}-primary-color-focus-visible`]: ColorHelper.dsColor(color + '-800'),
497
- [`${prefix}-primary-color-active`]: ColorHelper.dsColor(color + '-700'),
498
- // [`${prefix}-primary-color-disabled`]: ColorHelper.dsColor(color + '-300'),
499
- [`${prefix}-secondary-color-default`]: ColorHelper.dsColor('white'),
500
- [`${prefix}-secondary-color-hover`]: ColorHelper.dsColor('slate-50'),
501
- [`${prefix}-secondary-color-focus-visible`]: ColorHelper.dsColor('slate-50'),
502
- [`${prefix}-secondary-color-active`]: ColorHelper.dsColor('slate-50'),
503
- // [`${prefix}-secondary-color-disabled`]: ColorHelper.dsColor('slate-200')
504
- };
505
- }
506
- render() {
507
- const { label, _id, indeterminate, hidden, disabled, checked, readonly, required, caption, captionError, captionType, noCaption, size } = this;
508
- //////
509
- const bcmCheckboxClass = classnames('bcm-checkbox', `bcm-checkbox-size-${size}`, {
510
- 'error': captionType == Bcm.Status.error,
511
- hidden,
512
- checked,
513
- disabled,
514
- required,
515
- readonly,
516
- });
517
- const bcmCheckboxIconClass = classnames('bcm-checkbox__label-icon', 'bcm-checkbox__label-icon-lite', 'bcm-checkbox__label-icon-' + indeterminate, {
518
- 'bcm-checkbox__label-icon-checked': checked,
519
- });
520
- const bcmCheckboxLabelClass = classnames('bcm-checkbox__label');
521
- const bcmCheckboxInputClass = classnames('bcm-checkbox__input');
522
- return (h(Host, { tabindex: "0", onFocus: () => this.focus.emit(this.el), onBlur: () => this.blur.emit(this.el), style: this.setColor(this.color), class: bcmCheckboxClass, disabled: disabled }, h("span", { hidden: true }, h("slot", null)), label && h("bcm-label", { htmlFor: `input-${_id}`, type: captionType, value: label, required: required }), h("div", { class: bcmCheckboxInputClass }, h("input", { id: `input-${_id}`, type: "checkbox", checked: checked, disabled: disabled, required: required, readonly: readonly, onChange: () => { !disabled && !readonly && (this.handleChange()); }, ref: el => (this.inputElement = el) }), h("label", { class: bcmCheckboxLabelClass, htmlFor: `input-${_id}` }, h("span", { class: bcmCheckboxIconClass }, h("bcm-icon", { icon: "far fa-check" })), h(SlotTemplate, { className: "slot" }))), h(CaptionTemplate, { noCaption: noCaption, captionType: captionType, captionError: captionError, caption: caption })));
523
- }
524
- get el() { return getElement(this); }
525
- static get watchers() { return {
526
- "indeterminate": ["watchIndeterminate"],
527
- "checked": ["watchChecked"]
528
- }; }
529
- };
530
- __decorate$2([
531
- IsLoad()
532
- ], BcmCheckbox.prototype, "el", void 0);
533
- BcmCheckbox.style = checkboxCss;
534
-
535
- const { state } = createStore({
536
- group: new Map(),
537
- allChecked: true,
538
- allUnchecked: true,
539
- changeInderminate: {},
540
- });
541
- const setValue = async ({ fullWidth, optionType, buttonStyle, size, defaultCheckedItems, el, id, label, required, captionType, hidden, direction, childs, indeterminate, gap, noCaption, }) => {
542
- if (el) {
543
- state.group.set(id, {
544
- fullWidth,
545
- optionType,
546
- buttonStyle,
547
- size,
548
- defaultCheckedItems,
549
- label,
550
- required,
551
- captionType,
552
- hidden,
553
- direction,
554
- indeterminate,
555
- gap,
556
- noCaption,
557
- childs: childs === null || childs === void 0 ? void 0 : childs.map(child => {
558
- child.checked && (state.allUnchecked = false);
559
- !child.checked && (state.allChecked = false);
560
- // fullWidth && (fullWidth == 'flex' ? (child.style.flex = 'auto') : (child.style.width = '100%'));
561
- optionType && (child.optionType = optionType);
562
- buttonStyle && (child.buttonStyle = buttonStyle);
563
- size && (child.size = size);
564
- defaultCheckedItems && defaultCheckedItems.find(e => e === child.name) && (child.checked = true);
565
- child.noCaption = noCaption;
566
- return {
567
- id: child.id || Generate.UID(),
568
- checked: child.checked || false,
569
- name: child.name,
570
- size: child.size,
571
- buttonStyle: child.buttonStyle,
572
- optionType: child.optionType,
573
- style: child.style,
574
- noCaption: child.noCaption,
575
- color: child.color,
576
- disabled: child.disabled,
577
- readonly: child.readonly,
578
- label: child.label || child.name,
579
- slot: child.slot || snq(() => child.querySelector('.slot').textContent, child.textContent),
580
- required: child.required || required,
581
- el: child,
582
- captionType,
583
- hidden,
584
- };
585
- }),
586
- indeterminateState: !state.allChecked && !state.allUnchecked ? 'indeterminate' : state.allChecked ? 'determinate' : 'uncheck',
587
- });
588
- }
589
- };
590
- const getProperty = id => {
591
- return snq(() => state.group.get(id), {});
592
- };
593
- const getValue = (id, name) => {
594
- var _a;
595
- const group = getProperty(id);
596
- let value = {};
597
- (_a = group.childs) === null || _a === void 0 ? void 0 : _a.map(child => {
598
- if (name) {
599
- if (child.name === name) {
600
- value[child.name] = {
601
- value: !!child.checked,
602
- name: child.name,
603
- };
604
- }
605
- }
606
- else {
607
- value[child.name] = {
608
- value: !!child.checked,
609
- name: child.name,
610
- };
611
- }
612
- });
613
- return value;
614
- };
615
- const getCheckedList = id => {
616
- var _a;
617
- const group = getProperty(id);
618
- let value = {};
619
- (_a = group.childs) === null || _a === void 0 ? void 0 : _a.map(child => {
620
- if (child.checked === true) {
621
- value[child.name] = {
622
- value: !!child.checked,
623
- name: child.name,
624
- };
625
- }
626
- });
627
- return value;
628
- };
629
- const setClear = id => {
630
- var _a;
631
- (_a = getProperty(id).childs) === null || _a === void 0 ? void 0 : _a.forEach(child => {
632
- child.checked = false;
633
- });
634
- checkInderminate(id);
635
- };
636
- const setCheckedItems = (id, items, checked, reset) => {
637
- var _a;
638
- const checkedItems = items && (typeof items == 'string' ? JSON.parse(items) : items);
639
- (_a = getProperty(id).childs) === null || _a === void 0 ? void 0 : _a.forEach(child => {
640
- if (checkedItems) {
641
- const checkedItem = checkedItems.find(e => e === child.name || e.name === child.name);
642
- if (checkedItem) {
643
- if (typeof checkedItem == 'object') {
644
- Object.keys(checkedItem).map(key => {
645
- if (key === 'checked') {
646
- child.checked = checkedItem[key];
647
- }
648
- else {
649
- child.checked = checked;
650
- }
651
- });
652
- }
653
- else {
654
- child.checked = checked;
655
- }
656
- }
657
- else {
658
- reset && (child.checked = false);
659
- }
660
- }
661
- else {
662
- child.checked = false;
663
- }
664
- });
665
- checkInderminate(id);
666
- };
667
- const resetCaption = id => {
668
- var _a;
669
- // const noCaption = getProperty(id).noCaption;
670
- (_a = getProperty(id).childs) === null || _a === void 0 ? void 0 : _a.forEach(child => {
671
- child.resetCaption();
672
- // child.noCaption = noCaption;
673
- });
674
- };
675
- const changeIndeterminate = id => {
676
- var _a;
677
- const group = getProperty(id);
678
- if (!group.disabled) {
679
- let checkAll = true;
680
- if (group.indeterminateState === 'determinate') {
681
- checkAll = false;
682
- }
683
- (_a = getProperty(id).childs) === null || _a === void 0 ? void 0 : _a.map(child => {
684
- child.checked = checkAll;
685
- });
686
- checkInderminate(id);
687
- }
688
- };
689
- const checkInderminate = id => {
690
- var _a;
691
- const group = getProperty(id);
692
- let allChecked = true;
693
- let allUnchecked = true;
694
- (_a = group.childs) === null || _a === void 0 ? void 0 : _a.map(child => {
695
- child.checked && (allUnchecked = false);
696
- !child.checked && (allChecked = false);
697
- });
698
- group.indeterminateState = !allChecked && !allUnchecked ? 'indeterminate' : allChecked ? 'determinate' : 'uncheck';
699
- };
700
- const onChange = (obj) => {
701
- var _a;
702
- (_a = getProperty(obj.id).childs) === null || _a === void 0 ? void 0 : _a.map(child => {
703
- child.checked = child.id === obj.childId ? !child.checked : child.checked;
704
- });
705
- checkInderminate(obj.id);
706
- };
707
- const removeState = id => {
708
- return Promise.resolve(state.group.delete(id));
709
- };
710
- const getStatesKeys = id => {
711
- return Object.keys(state.group.get(id));
712
- };
713
- const checkBoxGroupState = {
714
- setValue,
715
- getValue,
716
- setCheckedItems,
717
- getCheckedList,
718
- getProperty,
719
- setClear,
720
- resetCaption,
721
- onChange,
722
- getStatesKeys,
723
- state,
724
- removeState,
725
- changeIndeterminate,
726
- };
727
-
728
- const CheckboxGroupTemplate = ({ customStyle, groupContainerClasses, onBcmSelect, items }) => {
729
- return (h("div", { class: groupContainerClasses, style: customStyle }, items.childs && items.childs.map((checkbox) => {
730
- return (h("bcm-checkbox", { id: checkbox.id, name: checkbox.name, color: checkbox.color, checked: checkbox.checked, disabled: checkbox.disabled, readonly: checkbox.readonly, required: checkbox.required, noCaption: checkbox.noCaption, "no-margin": true, size: checkbox.size, "full-width": checkbox.fullWidth, onClick: (e) => { !checkbox.disabled && !checkbox.readonly && (onBcmSelect(checkbox.id), e.preventDefault()); } }, checkbox.slot || checkbox.label));
731
- })));
732
- };
733
-
734
- const groupCss = "@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-checkbox-group{display:flex;flex-direction:column;align-items:flex-start;width:100%;margin-bottom:8px}.bcm-checkbox-group.hidden{display:none}.bcm-checkbox-group__container{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:flex-start;width:100%}.bcm-checkbox-group__container.full-width{max-width:100%}.bcm-checkbox-group__container.vertical{gap:8px;flex-direction:column}.bcm-checkbox-group__container.button{gap:unset}.bcm-checkbox-group__container.indeterminate{padding-top:16px;margin-top:16px;border-top:1px solid #efefef}";
735
-
736
- var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
737
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
738
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
739
- r = Reflect.decorate(decorators, target, key, desc);
740
- else
741
- for (var i = decorators.length - 1; i >= 0; i--)
742
- if (d = decorators[i])
743
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
744
- return c > 3 && r && Object.defineProperty(target, key, r), r;
745
- };
746
- const BcmCheckboxGroup = class {
747
- constructor(hostRef) {
748
- registerInstance(this, hostRef);
749
- this.change = createEvent(this, "bcm-change", 7);
750
- this.groupCheckedList = createEvent(this, "bcm-group-checked-list", 7);
751
- this._id = Generate.UID();
752
- this.direction = Bcm.Direction.horizontal;
753
- this.items = [];
754
- this.indeterminate = false;
755
- this.name = undefined;
756
- this.value = undefined;
757
- this.disabled = false;
758
- this.readonly = false;
759
- this.hidden = false;
760
- this.required = false;
761
- this.label = undefined;
762
- this.gap = undefined;
763
- this.defaultValue = undefined;
764
- this.fullWidth = false;
765
- this.optionType = 'default';
766
- this.buttonStyle = 'solid';
767
- this.size = Bcm.Size.medium;
768
- this.caption = undefined;
769
- this.noCaption = false;
770
- this.captionType = Bcm.Status.default;
771
- this.tick = {};
772
- }
773
- componentDidLoad() {
774
- this.initState();
775
- }
776
- disconnectedCallback() {
777
- checkBoxGroupState.removeState(this._id);
778
- }
779
- componentShouldUpdate(newVal, oldVal, propName) {
780
- if (propName == 'tick' && newVal !== oldVal) {
781
- const isHaveChild = snq(() => checkBoxGroupState.getProperty(this._id).childs.length > 0, false);
782
- if (isHaveChild) {
783
- this.getValue().then(values => this.value = values);
784
- }
785
- }
786
- if (this.getOptions().indexOf(propName) > -1 && newVal !== oldVal) {
787
- this.initState();
788
- }
789
- }
790
- getOptions() {
791
- return snq(() => checkBoxGroupState.getStatesKeys(this._id), []);
792
- }
793
- async initState() {
794
- const { fullWidth, optionType, buttonStyle, size, noCaption, defaultValue, label, required, captionType, hidden, direction, indeterminate, gap, items } = this;
795
- const defaultCheckedItems = defaultValue && (typeof defaultValue == 'string' ? JSON.parse(defaultValue) : defaultValue);
796
- const childElements = items.length > 0 ? items : await this.getCheckboxes();
797
- await checkBoxGroupState.setValue({
798
- id: this._id,
799
- el: this.el,
800
- indeterminate,
801
- fullWidth,
802
- optionType,
803
- buttonStyle,
804
- size,
805
- defaultCheckedItems,
806
- label,
807
- noCaption,
808
- required,
809
- captionType,
810
- hidden,
811
- gap,
812
- direction,
813
- childs: childElements
814
- });
815
- const slotArea = this.el.querySelector(`#bcm-checkbox-group__items-${this._id}`);
816
- if (slotArea) {
817
- slotArea.innerHTML && (slotArea.innerHTML = '');
818
- }
819
- this.value = await this.getValue();
820
- }
821
- async markForCheck() {
822
- await delay(10);
823
- this.tick = Generate.UID();
824
- }
825
- async onBcmFocus() {
826
- //focus first item
827
- const childs = this.getCheckboxes();
828
- if (childs.length > 0) {
829
- childs[0].onBcmFocus();
830
- }
831
- }
832
- async onBcmBlur() {
833
- this.el.blur();
834
- }
835
- async setClear() {
836
- checkBoxGroupState.setClear(this._id);
837
- await delay(10);
838
- this.getCheckboxes().forEach(item => {
839
- item.setClear();
840
- });
841
- this.markForCheck();
842
- await delay(10);
843
- return Promise.resolve();
844
- }
845
- async resetCaption() {
846
- await delay(10);
847
- this.getCheckboxes().forEach(item => {
848
- item.resetCaption();
849
- });
850
- await delay(10);
851
- return Promise.resolve();
852
- }
853
- async set(data) {
854
- if (Array.isArray(data)) {
855
- await this.check(data, true, true);
856
- }
857
- }
858
- async get() {
859
- const checklist = await this.getCheckedList() && Object.keys(await this.getCheckedList());
860
- return checklist.length > 0 ? checklist : [];
861
- }
862
- async check(items, checked = true, reset = false) {
863
- checkBoxGroupState.setCheckedItems(this._id, items, checked, reset);
864
- this.markForCheck();
865
- }
866
- async getValue(name) {
867
- return Promise.resolve(checkBoxGroupState.getValue(this._id, name));
868
- }
869
- async getCheckedList() {
870
- return checkBoxGroupState.getCheckedList(this._id);
871
- }
872
- handleItemsChange() {
873
- this.initState();
874
- }
875
- getCheckboxes() {
876
- return getChildElements(this.el, 'bcm-checkbox:not(#bcm-indeterminate-element)');
877
- }
878
- async getCheckbox(id) {
879
- const element = this.el.querySelector(`bcm-checkbox[id="${id}"]`);
880
- if (element) {
881
- const name = element["name"];
882
- const value = await this.getValue(name);
883
- return { element, event: snq(() => value[name], null) };
884
- }
885
- return {};
886
- }
887
- async indeterminateClick() {
888
- checkBoxGroupState.changeIndeterminate(this._id);
889
- this.markForCheck();
890
- }
891
- async changeCheckBox(id) {
892
- checkBoxGroupState.onChange({ id: this._id, childId: id });
893
- this.markForCheck();
894
- await delay(10);
895
- this.value = await this.getValue();
896
- this.change.emit({ value: this.value, changed: Object.assign({}, await this.getCheckbox(id)) });
897
- this.groupCheckedList.emit(await this.getCheckedList());
898
- }
899
- getItems() {
900
- return checkBoxGroupState.getProperty(this._id);
901
- }
902
- render() {
903
- const items = this.getItems();
904
- const { disabled, captionType, label, indeterminate, indeterminateState, required, direction, optionType, hidden, fullWidth, gap } = items;
905
- const bcmChechboxGroup = classnames('bcm-checkbox-group', direction, optionType, {
906
- hidden,
907
- 'full-width': fullWidth
908
- });
909
- const bcmChechboxGroupContainer = classnames('bcm-checkbox-group__container', optionType, {
910
- [direction]: optionType === 'default',
911
- indeterminate,
912
- hidden,
913
- 'full-width': fullWidth
914
- });
915
- return (h(Host, { class: bcmChechboxGroup }, h("span", { hidden: true, id: `bcm-checkbox-group__items-${this._id}` }, h("slot", null)), h("div", { class: "bcm-checkbox-group__label" }, label &&
916
- h("div", null, h(LabelTemplate, { size: this.size, type: captionType, value: label, required: required }))), indeterminate &&
917
- h("bcm-checkbox", { onClick: (e) => { this.indeterminateClick(), e.preventDefault(); }, "no-caption": true, id: "bcm-indeterminate-element", indeterminate: indeterminateState, disabled: disabled }, "Check All"), h(CheckboxGroupTemplate, { items: items, groupContainerClasses: bcmChechboxGroupContainer, customStyle: gap && ({ 'gap': gap }), onBcmSelect: (id) => this.changeCheckBox(id) })));
918
- }
919
- get el() { return getElement(this); }
920
- static get watchers() { return {
921
- "items": ["handleItemsChange"]
922
- }; }
923
- };
924
- __decorate$1([
925
- IsLoad()
926
- ], BcmCheckboxGroup.prototype, "el", void 0);
927
- BcmCheckboxGroup.style = groupCss;
928
-
929
- // /**
930
- // *
931
- // * @param type
932
- // */
933
- // export const required = (value:any) => {
934
- // if ( value || value != null ) {
935
- // return true
936
- // } else {
937
- // return true
938
- // }
939
- // }
940
- class rules {
941
- constructor() { }
942
- response(status, message) {
943
- return Object.assign(Object.assign({ valid: status }, (message && { message })), (!status && { type: 'error' }));
944
- }
945
- required(value, componentValidation) {
946
- let validation = this.response(true);
947
- if (value == '' || value == "" || value == undefined || value == null || value === false) {
948
- validation = this.response(false, 'This field is required.');
949
- }
950
- if (componentValidation) {
951
- if (!componentValidation.valid) {
952
- validation = this.response(false, componentValidation.errorText);
953
- }
954
- if (value instanceof Object) {
955
- if (value.isValid) {
956
- if (value.isValid == false)
957
- validation = this.response(false, 'This field is required.');
958
- }
959
- }
960
- }
961
- return validation;
962
- }
963
- selfValidation(input) {
964
- let validation = this.response(true);
965
- if (input.captionError != null || input.captionType == 'error') {
966
- validation = this.response(false, input.captionError);
967
- }
968
- return validation;
969
- }
970
- }
971
- const validate = new rules;
972
-
973
- 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}";
974
-
975
- var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
976
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
977
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
978
- r = Reflect.decorate(decorators, target, key, desc);
979
- else
980
- for (var i = decorators.length - 1; i >= 0; i--)
981
- if (d = decorators[i])
982
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
983
- return c > 3 && r && Object.defineProperty(target, key, r), r;
984
- };
985
- const BcmForm = class {
986
- constructor(hostRef) {
987
- registerInstance(this, hostRef);
988
- this.bcmForm = createEvent(this, "bcm-form", 7);
989
- this.formData = {};
990
- this.inputs = [];
991
- this.duplicateInput = [];
992
- this.isValid = true;
993
- this.returnCaption = [];
994
- this.Bromcom = {
995
- errors: {
996
- targetFormNotExist: 'target form is not exist --> ',
997
- },
998
- inputComponents: {
999
- // Birbirinin aynısı
1000
- INPUT: 'input',
1001
- TEXTAREA: 'textarea',
1002
- //çok benzer
1003
- SWITCH: 'switch',
1004
- CHECKBOX: 'checkbox',
1005
- RADIO_GROUP: 'radio-group',
1006
- CHECKBOX_GROUP: 'checkbox-group',
1007
- RANGE: 'range',
1008
- // sadece value fırlatıyor
1009
- FORM: 'form',
1010
- FORM_GROUP: 'form-group',
1011
- // *En vakit alacak => içinde select, autocomplete, listbox, treeview özellikleri var
1012
- LIST: 'list',
1013
- //
1014
- COLORPICKER: 'colorpicker',
1015
- // picker aslında tek komponent hepsi datetimepicker
1016
- DATE_PICKER: 'date-picker',
1017
- TIME_PICKER: 'time-picker',
1018
- DATETIME_PICKER: 'datetime-picker',
1019
- // silinecek komponentler
1020
- SELECT: 'select',
1021
- LISTBOX: 'listbox'
1022
- },
1023
- helpers: {
1024
- randomId: function () {
1025
- return Math.random().toString(16).slice(2, -1);
1026
- },
1027
- },
1028
- };
1029
- this._id = (Math.random() * 4).toString(16).replace('.', '');
1030
- this.hidden = false;
1031
- this.validation = false;
1032
- this.name = "";
1033
- this.value = undefined;
1034
- this.autocomplete = false;
1035
- }
1036
- handleSubmit() {
1037
- // if (lowercase(e.target.nodeName) === 'bcm-button') {
1038
- // if (e.target.type === 'submit') {
1039
- // this.submitFunction()
1040
- // }
1041
- // }
1042
- }
1043
- async submitFunction() {
1044
- this.formData = {};
1045
- this.inputs = [];
1046
- this.selector = this.el;
1047
- await this.getInputs();
1048
- await delay(10);
1049
- const usrFrmData = await this.userFormData();
1050
- var formData = { isValid: true, formData: usrFrmData };
1051
- if (this.name) {
1052
- formData = Object.assign(Object.assign({}, formData), { formName: this.name });
1053
- }
1054
- if (this.isValid) {
1055
- this.bcmForm.emit(formData);
1056
- return formData;
1057
- }
1058
- else {
1059
- this.returnCaption = { isValid: false, 'message': 'Please fill in all inputs', 'errorDetails': this.returnCaption, formData: usrFrmData };
1060
- if (this.name) {
1061
- this.returnCaption = Object.assign(Object.assign({}, this.returnCaption), { formName: this.name });
1062
- }
1063
- this.bcmForm.emit(this.returnCaption);
1064
- return this.returnCaption;
1065
- }
1066
- }
1067
- async submit() {
1068
- return Promise.resolve(this.submitFunction());
1069
- }
1070
- async set(data) {
1071
- var _a;
1072
- const validate = this.validation;
1073
- this.validation = false;
1074
- // debugger
1075
- this.selector = this.el;
1076
- await this.getInputs();
1077
- if (data && ((_a = this.inputs) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1078
- for (const key of Object.keys(data)) {
1079
- const item = this.inputs.find(item => item.name === key);
1080
- if (item) {
1081
- try {
1082
- await item.set(data[key]);
1083
- }
1084
- catch (error) {
1085
- console.log(item.nodeName, "set", error);
1086
- }
1087
- }
1088
- }
1089
- }
1090
- this.validation = validate;
1091
- }
1092
- async get() {
1093
- var _a;
1094
- let formData = {};
1095
- this.selector = this.el;
1096
- const inputsCache = this.inputs;
1097
- await this.getInputs();
1098
- ((_a = this.inputs) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.inputs.forEach(async (item) => {
1099
- try {
1100
- const value = await item.get();
1101
- formData = Object.assign(Object.assign({}, formData), { [item.name]: value });
1102
- }
1103
- catch (error) {
1104
- console.log(`${item.nodeName} get error`);
1105
- }
1106
- });
1107
- this.inputs = inputsCache;
1108
- await delay(10);
1109
- return Promise.resolve(formData);
1110
- }
1111
- async setClear() {
1112
- this.formData = {};
1113
- this.inputs = [];
1114
- this.selector = this.el;
1115
- let clear = [];
1116
- await this.getInputs();
1117
- this.inputs.forEach(async (item) => {
1118
- try {
1119
- clear.push(await item.setClear());
1120
- }
1121
- catch (error) {
1122
- console.log(error);
1123
- }
1124
- });
1125
- await Promise.all(clear).then(() => {
1126
- this.formData = {};
1127
- this.inputs = [];
1128
- this.duplicateInput = [];
1129
- this.isValid = true;
1130
- this.returnCaption = [];
1131
- });
1132
- await delay(10);
1133
- return Promise.resolve(true);
1134
- }
1135
- async resetCaption() {
1136
- await delay(10);
1137
- this.formData = {};
1138
- this.inputs = [];
1139
- this.selector = this.el;
1140
- await this.getInputs();
1141
- for (const item of this.inputs) {
1142
- try {
1143
- await item.resetCaption();
1144
- }
1145
- catch (error) {
1146
- console.log(item.nodeName, "rc p");
1147
- }
1148
- }
1149
- await delay(10);
1150
- return Promise.resolve();
1151
- }
1152
- async config(_config) {
1153
- if (_config['validation']) {
1154
- typeof _config['validation'] == 'boolean'
1155
- ? this.validation = _config['validation']
1156
- : this.validation = false;
1157
- }
1158
- return true;
1159
- }
1160
- async getInputs() {
1161
- var form = this.selector;
1162
- if (!form) {
1163
- console.warn(this.Bromcom.errors.targetFormNotExist + this.selector);
1164
- return;
1165
- }
1166
- const inputs = Array.from(form.querySelectorAll('bcm-' + Object.values(this.Bromcom.inputComponents).join(',bcm-')));
1167
- this.duplicateInput = [];
1168
- // s-hn: Stencil private flag that contains host web component
1169
- // https://github.com/ionic-team/stencil/blob/45388e95edb46ef357eb9ae37cd32bbb5bc1ed23/src/runtime/vdom/vdom-render.ts#L116
1170
- const rootInputs = inputs.filter((input) => { var _a; return !input['s-hn'] || ((_a = input['s-hn']) === null || _a === void 0 ? void 0 : _a.nodeName) !== 'BcmForm'; });
1171
- // debugger;
1172
- for (const item of rootInputs) {
1173
- if (StringHelper.lowercase(item.nodeName) == "bcm-checkbox-group") {
1174
- let checkboxs = item.querySelectorAll("bcm-checkbox");
1175
- if (checkboxs) {
1176
- for (const checkbox of checkboxs) {
1177
- this.duplicateInput.push(checkbox.name);
1178
- }
1179
- }
1180
- }
1181
- if (StringHelper.lowercase(item.nodeName) == "bcm-form") {
1182
- const groupInputs = Array.from(item.querySelectorAll('bcm-' + Object.values(this.Bromcom.inputComponents).join(',bcm-')));
1183
- let itemObject = {};
1184
- for (const element of groupInputs) {
1185
- var name = element.name;
1186
- var value = element.value;
1187
- itemObject = Object.assign(Object.assign({}, itemObject), { [name]: value });
1188
- this.duplicateInput.push(element.name);
1189
- }
1190
- item.value = itemObject;
1191
- let checkboxs = item.querySelectorAll("bcm-checkbox");
1192
- if (checkboxs) {
1193
- for (const checkbox of checkboxs) {
1194
- this.duplicateInput.push(checkbox.name);
1195
- }
1196
- }
1197
- }
1198
- }
1199
- await delay(10);
1200
- this.inputs = rootInputs;
1201
- }
1202
- getItemValue(item) {
1203
- const tagName = item.tagName.toLowerCase().replace('bcm-', '');
1204
- switch (tagName) {
1205
- /* case 'date-picker':
1206
- case 'datetime-picker':
1207
- return item.value.timestamp
1208
- case 'time-picker':
1209
- return item.value.time */
1210
- default:
1211
- return item.value;
1212
- }
1213
- }
1214
- isWrapperComponent(item) {
1215
- return ['bcm-datetime-picker', 'bcm-date-picker', 'bcm-time-picker'].includes(item.toLowerCase());
1216
- }
1217
- isGroupComponent(item) {
1218
- return ['bcm-checkbox-group'].includes(item.toLowerCase());
1219
- }
1220
- isListComponent(item) {
1221
- return ['bcm-list'].includes(item.toLowerCase());
1222
- }
1223
- async userFormData() {
1224
- this.formData = {};
1225
- this.isValid = true;
1226
- this.returnCaption = [];
1227
- for (const item of this.inputs) {
1228
- // const isListComponent = this.isListComponent(item.tagName);
1229
- const isGroupComponent = this.isGroupComponent(item.tagName);
1230
- const isWrapperComponent = this.isWrapperComponent(item.tagName);
1231
- const wrapperComponent = isWrapperComponent && item;
1232
- const input = isWrapperComponent
1233
- ? await item.getInput() && item
1234
- : item;
1235
- // input.caption = ''
1236
- // input.captionType = ''
1237
- if (this.validation) {
1238
- let valid = null;
1239
- // if (isListComponent) {
1240
- // valid = !(input.value && input.value.length > 0) && validate.required(input.value)
1241
- // } else
1242
- if (isWrapperComponent) {
1243
- const isPickerValid = await wrapperComponent.isValid();
1244
- valid = validate.required(input.value, isPickerValid);
1245
- if (valid) {
1246
- if (input.value instanceof Object) {
1247
- if (input.value["isValid"] == false) {
1248
- valid = validate.required("", isPickerValid);
1249
- }
1250
- }
1251
- else {
1252
- valid = validate.required(input.value, isPickerValid);
1253
- }
1254
- }
1255
- }
1256
- else if (isGroupComponent) {
1257
- const childsCheckbox = getChildElements(input, 'bcm-checkbox:not(#bcm-indeterminate-element)');
1258
- if (childsCheckbox && childsCheckbox.length > 0) {
1259
- for (const element of childsCheckbox) {
1260
- if (element && element.required === true) {
1261
- valid = validate.required(element.checked);
1262
- if (!valid['valid']) {
1263
- element.noCaption = false;
1264
- element.captionError = valid['message'];
1265
- element.captionType = valid['type'];
1266
- }
1267
- else {
1268
- element.noCaption = input.noCaption;
1269
- element.captionError = null;
1270
- element.captionType = "default";
1271
- }
1272
- }
1273
- }
1274
- }
1275
- }
1276
- else {
1277
- valid = validate.required(input.value);
1278
- }
1279
- if (input.required) {
1280
- if (!valid['valid']) {
1281
- input.captionError = valid['message'];
1282
- input.captionType = valid['type'];
1283
- }
1284
- else {
1285
- input.captionError = null;
1286
- input.captionType = "default";
1287
- }
1288
- await delay(10);
1289
- const selfValidation = validate.selfValidation(input);
1290
- if (valid['valid']) {
1291
- if (!selfValidation['valid']) {
1292
- input.captionError = selfValidation['message'];
1293
- input.captionType = selfValidation['type'];
1294
- }
1295
- }
1296
- }
1297
- let name = input.name;
1298
- let value = input.captionError;
1299
- !input.hidden && input.captionType == 'error' && (this.returnCaption = [...Array.from(this.returnCaption), { [name]: value }],
1300
- this.isValid = false);
1301
- }
1302
- if (input.name && !this.duplicateInput.includes(input.name)) {
1303
- var itemValue = this.getItemValue(input);
1304
- if (!itemValue || itemValue == undefined || itemValue == null) {
1305
- itemValue = null;
1306
- }
1307
- this.formData[input.name] = itemValue;
1308
- }
1309
- }
1310
- return this.formData;
1311
- }
1312
- async handleChange(e) {
1313
- const isWrapperComponent = this.isWrapperComponent(e.target.tagName);
1314
- const isGroupComponent = this.isGroupComponent(e.target.tagName);
1315
- let target;
1316
- if (isWrapperComponent) {
1317
- target = e.target.getInput && await e.target.getInput() || e.target;
1318
- }
1319
- else if (isGroupComponent) {
1320
- let req = false;
1321
- const childsCheckbox = getChildElements(e.target, 'bcm-checkbox:not(#bcm-indeterminate-element)');
1322
- childsCheckbox.length > 0 && (childsCheckbox.forEach((element) => {
1323
- if (element && element.required === true) {
1324
- req = true;
1325
- }
1326
- }));
1327
- target = Object.assign(Object.assign({}, e.target), { required: req });
1328
- }
1329
- else {
1330
- target = e.target;
1331
- }
1332
- const value = e.target.value;
1333
- const wrapperComponent = isWrapperComponent && e.target;
1334
- var isPickerValid;
1335
- if (isWrapperComponent) {
1336
- isPickerValid = await wrapperComponent.isValid();
1337
- }
1338
- const tick = setTimeout(() => {
1339
- if (target.required) {
1340
- let valid = null;
1341
- if (isWrapperComponent) {
1342
- valid = validate.required(value, isPickerValid);
1343
- if (valid) {
1344
- if (value instanceof Object) {
1345
- if (value["isValid"] == false) {
1346
- valid = validate.required("", isPickerValid);
1347
- }
1348
- }
1349
- else {
1350
- valid = validate.required(value, isPickerValid);
1351
- }
1352
- }
1353
- }
1354
- else if (isGroupComponent) {
1355
- const childsCheckbox = getChildElements(e.target, 'bcm-checkbox:not(#bcm-indeterminate-element)');
1356
- childsCheckbox.length > 0 && (childsCheckbox.forEach((element) => {
1357
- if (element && element.required === true) {
1358
- valid = validate.required(element.checked);
1359
- if (!valid['valid']) {
1360
- element.noCaption = false;
1361
- element.captionError = valid['message'];
1362
- element.captionType = valid['type'];
1363
- }
1364
- else {
1365
- element.noCaption = e.target.noCaption;
1366
- element.captionError = null;
1367
- element.captionType = "default";
1368
- }
1369
- }
1370
- }));
1371
- }
1372
- else {
1373
- valid = validate.required(value);
1374
- }
1375
- if (valid['valid']) {
1376
- target.captionError = null;
1377
- target.captionType = null;
1378
- }
1379
- else {
1380
- target.captionError = valid['message'];
1381
- target.captionType = valid['type'];
1382
- }
1383
- }
1384
- clearTimeout(tick);
1385
- });
1386
- this.value = await this.userFormData();
1387
- }
1388
- render() {
1389
- const hostClasses = classnames(this.hidden ? 'hidden' : null);
1390
- return (h(Host, { class: hostClasses }, h("form", { class: "bcm-form", autocomplete: this.autocomplete ? "on" : "off" }, h("slot", null))));
1391
- }
1392
- get el() { return getElement(this); }
1393
- };
1394
- __decorate([
1395
- IsLoad()
1396
- ], BcmForm.prototype, "el", void 0);
1397
- BcmForm.style = formCss;
1398
-
1399
- 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}";
1400
-
1401
- const BcmIcon = class {
1402
- constructor(hostRef) {
1403
- registerInstance(this, hostRef);
1404
- this.hidden = false;
1405
- this.icon = undefined;
1406
- }
1407
- render() {
1408
- const { icon, hidden } = this;
1409
- return (h(Host, { class: `bcm-icon fa ${hidden ? 'hidden' : ''}` }, h("i", { class: `${icon}` })));
1410
- }
1411
- get el() { return getElement(this); }
1412
- };
1413
- BcmIcon.style = iconCss;
1414
-
1415
- const labelCss = "@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-label{display:inline-flex;align-items:flex-start;grid-gap:2px}.bcm-label__text{margin-bottom:2px;font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:inline-block;color:var(--bcm-new-ds-color-slate-600)}.bcm-label__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-label__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-label__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}";
1416
-
1417
- const BcmLabel = class {
1418
- constructor(hostRef) {
1419
- registerInstance(this, hostRef);
1420
- this._id = Generate.UID();
1421
- this.required = false;
1422
- this.value = undefined;
1423
- this.size = "medium";
1424
- this.form = undefined;
1425
- this.htmlFor = undefined;
1426
- this.hidden = false;
1427
- this.type = Bcm.Status.default;
1428
- this.tooltip = undefined;
1429
- }
1430
- render() {
1431
- const { required, value, size, form, htmlFor, hidden, type, tooltip } = this;
1432
- const hostClasses = classnames('bcm-label', { hidden });
1433
- const Label = (h(LabelTemplate, { form: form, htmlFor: htmlFor, value: value, size: size, type: type, required: required }));
1434
- return (h(Host, { class: hostClasses }, Label, tooltip && (h("bcm-tooltip", { message: tooltip, placement: 'top', trigger: 'hover' }, h("bcm-icon", { icon: "far fa-question-circle" })))));
1435
- }
1436
- get el() { return getElement(this); }
1437
- };
1438
- BcmLabel.style = labelCss;
1439
-
1440
- const BcmTooltip = class {
1441
- constructor(hostRef) {
1442
- registerInstance(this, hostRef);
1443
- this.bcmTooltipShow = createEvent(this, "bcmTooltipShow", 7);
1444
- this.bcmTooltipHide = createEvent(this, "bcmTooltipHide", 7);
1445
- this._id = Generate.UID();
1446
- this.message = "";
1447
- this.placement = Bcm$1.Placement.top;
1448
- this.trigger = Bcm$1.TriggerType.click;
1449
- this.open = false;
1450
- this.color = "slate";
1451
- this.size = Bcm$1.Size.medium;
1452
- this.openDelay = 0;
1453
- this.closeDelay = 0;
1454
- this.autoHide = false;
1455
- this.targetId = undefined;
1456
- this.tooltip = undefined;
1457
- }
1458
- emitShow() {
1459
- this.bcmTooltipShow.emit();
1460
- }
1461
- emitHide() {
1462
- this.bcmTooltipHide.emit();
1463
- }
1464
- connectedCallback() {
1465
- this.tooltip = new Tooltip({
1466
- targetId: this.targetId || this._id,
1467
- message: this.message,
1468
- placement: this.placement,
1469
- color: this.color,
1470
- trigger: this.trigger,
1471
- size: this.size,
1472
- openDelay: this.openDelay,
1473
- closeDelay: this.closeDelay,
1474
- autoHide: this.autoHide,
1475
- emitShow: () => this.emitShow(),
1476
- emitHide: () => this.emitHide(),
1477
- });
1478
- }
1479
- componentDidLoad() {
1480
- this.tooltip.listener();
1481
- }
1482
- componentDidRender() {
1483
- this.tooltip.message = this.message;
1484
- this.tooltip.placement = this.placement;
1485
- this.tooltip.color = this.color;
1486
- this.tooltip.trigger = this.trigger;
1487
- this.tooltip.size = this.size;
1488
- this.tooltip.openDelay = this.openDelay;
1489
- this.tooltip.closeDelay = this.closeDelay;
1490
- this.tooltip.autoHide = this.autoHide;
1491
- this.tooltip.update();
1492
- }
1493
- disconnectedCallback() {
1494
- this.tooltip.destroy();
1495
- }
1496
- async show() {
1497
- this.tooltip.show();
1498
- }
1499
- async hide() {
1500
- this.tooltip.hide();
1501
- }
1502
- async toggle() {
1503
- this.tooltip.toggle();
1504
- }
1505
- render() {
1506
- return (h(Host, { "aria-describedby": "tooltip", class: "tw-inline-flex tw-h-fit tw-w-fit" }, h("slot", null)));
1507
- }
1508
- get el() { return getElement(this); }
1509
- };
1510
-
1511
- export { BcmButton as bcm_button, BcmCheckbox as bcm_checkbox, BcmCheckboxGroup as bcm_checkbox_group, BcmForm as bcm_form, BcmIcon as bcm_icon, BcmLabel as bcm_label, BcmTooltip as bcm_tooltip };