bromcom-ui 2.9.0-rc.4 → 2.9.0-rc.6
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.
- package/dist/bromcom-ui/bromcom-ui.css +1 -1
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/{p-cb344455.entry.js → p-0641597e.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8c9d109c.entry.js → p-15758356.entry.js} +1 -1
- package/dist/bromcom-ui/{p-fc07ca8a.entry.js → p-16dd7db9.entry.js} +1 -1
- package/dist/bromcom-ui/p-17264523.js +5 -0
- package/dist/bromcom-ui/p-17af6738.js +5 -0
- package/dist/bromcom-ui/{p-00d7bbed.js → p-184b7d3b.js} +1 -1
- package/dist/bromcom-ui/{p-5648b456.entry.js → p-1b1f4b44.entry.js} +1 -1
- package/dist/bromcom-ui/p-1eabd5dc.js +10 -0
- package/dist/bromcom-ui/{p-224d392c.entry.js → p-1fbd8af5.entry.js} +1 -1
- package/dist/bromcom-ui/{p-3adc157d.entry.js → p-24b8154c.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6478455c.entry.js → p-24d8e9d6.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8ae4bdb2.entry.js → p-2afdec61.entry.js} +1 -1
- package/dist/bromcom-ui/{p-50c3df61.js → p-2b13dd48.js} +1 -1
- package/dist/bromcom-ui/p-2b88c7bb.entry.js +5 -0
- package/dist/bromcom-ui/p-2fc584c4.js +5 -0
- package/dist/bromcom-ui/{p-f48e5337.entry.js → p-31eabaf3.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6a087ad5.js → p-3215d598.js} +1 -1
- package/dist/bromcom-ui/{p-15347028.entry.js → p-3baf677c.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8c018ae0.js → p-3c7a0345.js} +1 -1
- package/dist/bromcom-ui/p-459212eb.entry.js +5 -0
- package/dist/bromcom-ui/p-57f8802e.entry.js +5 -0
- package/dist/bromcom-ui/{p-7e44e6b5.js → p-5ae0a59b.js} +1 -1
- package/dist/bromcom-ui/{p-4cd8a7c8.entry.js → p-5c3e9ac9.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6cb648f0.entry.js → p-5c468c5b.entry.js} +1 -1
- package/dist/bromcom-ui/{p-70aa6e00.entry.js → p-6272ecb4.entry.js} +1 -1
- package/dist/bromcom-ui/p-663766cf.entry.js +5 -0
- package/dist/bromcom-ui/p-6a5ac874.entry.js +13 -0
- package/dist/bromcom-ui/{p-6e9b23ed.entry.js → p-6b861832.entry.js} +1 -1
- package/dist/bromcom-ui/{p-30788121.entry.js → p-6c3e9e10.entry.js} +1 -1
- package/dist/bromcom-ui/{p-ba47106f.entry.js → p-7a394115.entry.js} +1 -1
- package/dist/bromcom-ui/{p-0d6623c0.entry.js → p-81b2dffb.entry.js} +1 -1
- package/dist/bromcom-ui/p-891de348.entry.js +5 -0
- package/dist/bromcom-ui/{p-1647559e.entry.js → p-8bcfe3b3.entry.js} +1 -1
- package/dist/bromcom-ui/{p-fd7243a7.entry.js → p-8d7bbe30.entry.js} +1 -1
- package/dist/bromcom-ui/{p-c8695c8b.entry.js → p-8de9d6b6.entry.js} +1 -1
- package/dist/bromcom-ui/p-8fc8b4ff.entry.js +5 -0
- package/dist/bromcom-ui/{p-20aa2ba8.entry.js → p-9099a1bf.entry.js} +1 -1
- package/dist/bromcom-ui/p-9773e744.entry.js +5 -0
- package/dist/bromcom-ui/{p-08d4cd65.entry.js → p-a512ca45.entry.js} +1 -1
- package/dist/bromcom-ui/{p-18696519.entry.js → p-b10265d7.entry.js} +1 -1
- package/dist/bromcom-ui/{p-30a3320f.entry.js → p-b1c83bb8.entry.js} +1 -1
- package/dist/bromcom-ui/{p-afb4a0e7.entry.js → p-b26ded9b.entry.js} +1 -1
- package/dist/bromcom-ui/{p-159b67a7.entry.js → p-b45b54b5.entry.js} +1 -1
- package/dist/bromcom-ui/{p-9fff4f7d.entry.js → p-b47e4417.entry.js} +1 -1
- package/dist/bromcom-ui/{p-e12e563a.entry.js → p-c2cbb810.entry.js} +1 -1
- package/dist/bromcom-ui/{p-ea23f0aa.entry.js → p-c387f0fb.entry.js} +1 -1
- package/dist/bromcom-ui/{p-4ea7331b.entry.js → p-c3a91954.entry.js} +1 -1
- package/dist/bromcom-ui/{p-3992dd70.entry.js → p-ca6cd989.entry.js} +1 -1
- package/dist/bromcom-ui/p-ccaabc2e.entry.js +5 -0
- package/dist/bromcom-ui/p-cf0ab7f0.entry.js +5 -0
- package/dist/bromcom-ui/{p-09c4a42a.entry.js → p-d37502f9.entry.js} +1 -1
- package/dist/bromcom-ui/p-dbdb10d5.js +5 -0
- package/dist/bromcom-ui/p-dd422dd1.js +5 -0
- package/dist/bromcom-ui/{p-8d14232d.entry.js → p-dd43bcd9.entry.js} +1 -1
- package/dist/bromcom-ui/{p-50066349.entry.js → p-de850d57.entry.js} +1 -1
- package/dist/bromcom-ui/{p-28649759.entry.js → p-e0c60c5d.entry.js} +1 -1
- package/dist/bromcom-ui/{p-21783e29.entry.js → p-e520d2a2.entry.js} +1 -1
- package/dist/bromcom-ui/{p-119fc842.entry.js → p-e86e4968.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8ce0f5f8.entry.js → p-eaad2239.entry.js} +1 -1
- package/dist/bromcom-ui/{p-dc9466d6.entry.js → p-ebee9f45.entry.js} +1 -1
- package/dist/bromcom-ui/{p-b321e86d.entry.js → p-ee4b8753.entry.js} +1 -1
- package/dist/bromcom-ui/p-ee50f5e2.entry.js +5 -0
- package/dist/bromcom-ui/{p-4e6292fd.entry.js → p-ee5da693.entry.js} +1 -1
- package/dist/bromcom-ui/{p-2df6dc86.entry.js → p-f0fa1c29.entry.js} +1 -1
- package/dist/bromcom-ui/{p-68abefd2.entry.js → p-f331e009.entry.js} +1 -1
- package/dist/bromcom-ui/{p-cf307549.entry.js → p-fe37e88f.entry.js} +1 -1
- package/dist/cjs/bcm-accordion.cjs.entry.js +1 -1
- package/dist/cjs/bcm-alert.cjs.entry.js +1 -1
- package/dist/cjs/bcm-attendance.cjs.entry.js +1 -1
- package/dist/cjs/bcm-avatar.cjs.entry.js +126 -0
- package/dist/cjs/bcm-badge_15.cjs.entry.js +1738 -0
- package/dist/cjs/bcm-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/bcm-button-group.cjs.entry.js +1 -1
- package/dist/cjs/bcm-card.cjs.entry.js +2 -2
- package/dist/cjs/bcm-checkbox-group.cjs.entry.js +17 -17
- package/dist/cjs/bcm-checkbox-lite_9.cjs.entry.js +1 -1
- package/dist/cjs/{bcm-checkbox_2.cjs.entry.js → bcm-checkbox.cjs.entry.js} +2 -13
- package/dist/cjs/bcm-chip-group.cjs.entry.js +128 -0
- package/dist/cjs/bcm-chip.cjs.entry.js +90 -0
- package/dist/cjs/bcm-collapse.cjs.entry.js +1 -1
- package/dist/cjs/bcm-color-input.cjs.entry.js +4 -4
- package/dist/cjs/{bcm-avatar_15.cjs.entry.js → bcm-colorful.cjs.entry.js} +3 -6332
- package/dist/cjs/bcm-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/bcm-datetime-picker.cjs.entry.js +1 -1
- package/dist/cjs/bcm-default.cjs.entry.js +1 -1
- package/dist/cjs/bcm-drawer.cjs.entry.js +4 -4
- package/dist/cjs/bcm-expansion-panel.cjs.entry.js +2 -2
- package/dist/cjs/bcm-form-2.cjs.entry.js +1 -1
- package/dist/cjs/bcm-form.cjs.entry.js +488 -0
- package/dist/cjs/bcm-input-custom.cjs.entry.js +1 -1
- package/dist/cjs/bcm-input.cjs.entry.js +370 -0
- package/dist/cjs/bcm-label.cjs.entry.js +44 -0
- package/dist/cjs/bcm-list_3.cjs.entry.js +4025 -0
- package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +4 -4
- package/dist/cjs/bcm-modal-2-header.cjs.entry.js +4 -4
- package/dist/cjs/bcm-modal-2.cjs.entry.js +4 -4
- package/dist/cjs/bcm-modal.cjs.entry.js +1 -1
- package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +2 -2
- package/dist/cjs/bcm-popconfirm.cjs.entry.js +1 -1
- package/dist/cjs/bcm-progress.cjs.entry.js +2 -2
- package/dist/cjs/bcm-radio-group.cjs.entry.js +4 -4
- package/dist/cjs/bcm-radio.cjs.entry.js +4 -4
- package/dist/cjs/bcm-range.cjs.entry.js +1 -1
- package/dist/cjs/bcm-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/bcm-step.cjs.entry.js +2 -2
- package/dist/cjs/bcm-stepper.cjs.entry.js +5 -5
- package/dist/cjs/bcm-switch.cjs.entry.js +1 -1
- package/dist/cjs/bcm-tag.cjs.entry.js +2 -2
- package/dist/cjs/bcm-textarea.cjs.entry.js +2 -2
- package/dist/cjs/bcm-time-picker.cjs.entry.js +1 -1
- package/dist/cjs/bcm-toast.cjs.entry.js +1 -1
- package/dist/cjs/bromcom-ui.cjs.js +1 -1
- package/dist/cjs/{color-helper-d6d2028b.js → color-helper-7ab15732.js} +27 -1
- package/dist/cjs/{generate-d246df02.js → generate-d3f8c970.js} +55 -5
- package/dist/cjs/index-906fb4e5.js +540 -0
- package/dist/cjs/index-b08b037a.js +52 -0
- package/dist/cjs/{input-template-22c31e2b.js → input-template-22725c68.js} +1 -1
- package/dist/cjs/{json-parse-decarator-bf157b28.js → json-parse-decarator-22c236ad.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{number-helper-26df0c91.js → number-helper-66fe9479.js} +1 -1
- package/dist/cjs/old-bcm-popover-box.cjs.entry.js +2 -2
- package/dist/cjs/old-bcm-popover.cjs.entry.js +1 -1
- package/dist/cjs/{stepper-states-1a1a63cb.js → stepper-states-43daae37.js} +1 -1
- package/dist/cjs/{validators-095e7611.js → validators-aa39e3ec.js} +1 -1
- package/dist/collection/components/atoms/avatar/avatar.js +95 -80
- package/dist/collection/components/atoms/avatar/avatar.style.js +39 -0
- package/dist/collection/components/atoms/badge/badge.js +29 -90
- package/dist/collection/components/atoms/badge/badge.style.js +39 -0
- package/dist/collection/components/molecules/input/input.js +4 -4
- package/dist/collection/components/molecules/items/items.js +1 -1
- package/dist/collection/components/molecules/menu/menu.js +1 -0
- package/dist/collection/components/molecules/popover/popover.js +1 -1
- package/dist/collection/components/molecules/tab-group/tab-group.js +5 -1
- package/dist/collection/components/molecules/tab-group/tab-item-header.js +11 -26
- package/dist/collection/components/molecules/tooltip/tooltip.js +1 -1
- package/dist/collection/components/other/typography/typography.js +1 -1
- package/dist/collection/helper/color-helper.js +27 -1
- package/dist/collection/helper/generate.js +54 -4
- package/dist/collection/helper/popover-helper.js +13 -9
- package/dist/collection/helper/tooltip-helper.js +12 -4
- package/dist/components/avatar.js +91 -52
- package/dist/components/badge.js +109 -46
- package/dist/components/bcm-items.js +1 -1
- package/dist/components/bcm-popover.js +14 -10
- package/dist/components/bcm-tab-group.js +5 -1
- package/dist/components/bcm-tab-item-header.js +11 -26
- package/dist/components/color-helper.js +27 -1
- package/dist/components/generate.js +55 -5
- package/dist/components/input.js +4 -4
- package/dist/components/menu.js +1 -0
- package/dist/components/tooltip-helper.js +12 -4
- package/dist/components/tooltip.js +1 -1
- package/dist/components/typography.js +1 -1
- package/dist/esm/bcm-accordion.entry.js +1 -1
- package/dist/esm/bcm-alert.entry.js +1 -1
- package/dist/esm/bcm-attendance.entry.js +1 -1
- package/dist/esm/bcm-avatar.entry.js +122 -0
- package/dist/esm/bcm-badge_15.entry.js +1720 -0
- package/dist/esm/bcm-breadcrumb.entry.js +1 -1
- package/dist/esm/bcm-button-group.entry.js +1 -1
- package/dist/esm/bcm-card.entry.js +3 -3
- package/dist/esm/bcm-checkbox-group.entry.js +8 -8
- package/dist/esm/bcm-checkbox-lite_9.entry.js +2 -2
- package/dist/esm/{bcm-checkbox_2.entry.js → bcm-checkbox.entry.js} +4 -14
- package/dist/esm/bcm-chip-group.entry.js +124 -0
- package/dist/esm/bcm-chip.entry.js +86 -0
- package/dist/esm/bcm-collapse-group.entry.js +1 -1
- package/dist/esm/bcm-collapse.entry.js +1 -1
- package/dist/esm/bcm-color-input.entry.js +6 -6
- package/dist/esm/{bcm-avatar_15.entry.js → bcm-colorful.entry.js} +4 -6319
- package/dist/esm/bcm-colorpicker.entry.js +2 -2
- package/dist/esm/bcm-date-picker.entry.js +2 -2
- package/dist/esm/bcm-datetime-picker.entry.js +3 -3
- package/dist/esm/bcm-default.entry.js +1 -1
- package/dist/esm/bcm-drawer.entry.js +6 -6
- package/dist/esm/bcm-expansion-panel.entry.js +3 -3
- package/dist/esm/bcm-form-2.entry.js +1 -1
- package/dist/esm/bcm-form.entry.js +484 -0
- package/dist/esm/bcm-input-custom.entry.js +1 -1
- package/dist/esm/bcm-input.entry.js +366 -0
- package/dist/esm/bcm-label.entry.js +40 -0
- package/dist/esm/bcm-list_3.entry.js +4019 -0
- package/dist/esm/bcm-modal-2-footer.entry.js +6 -6
- package/dist/esm/bcm-modal-2-header.entry.js +6 -6
- package/dist/esm/bcm-modal-2.entry.js +6 -6
- package/dist/esm/bcm-modal.entry.js +1 -1
- package/dist/esm/bcm-old-input.entry.js +1 -1
- package/dist/esm/bcm-old-tag_2.entry.js +1 -1
- package/dist/esm/bcm-popconfirm-box.entry.js +3 -3
- package/dist/esm/bcm-popconfirm.entry.js +1 -1
- package/dist/esm/bcm-progress.entry.js +3 -3
- package/dist/esm/bcm-radio-group.entry.js +6 -6
- package/dist/esm/bcm-radio.entry.js +6 -6
- package/dist/esm/bcm-range.entry.js +2 -2
- package/dist/esm/bcm-select.entry.js +1 -1
- package/dist/esm/bcm-skeleton.entry.js +1 -1
- package/dist/esm/bcm-step.entry.js +2 -2
- package/dist/esm/bcm-stepper.entry.js +7 -7
- package/dist/esm/bcm-switch.entry.js +2 -2
- package/dist/esm/bcm-table.entry.js +1 -1
- package/dist/esm/bcm-tabs-content.entry.js +1 -1
- package/dist/esm/bcm-tabs.entry.js +1 -1
- package/dist/esm/bcm-tag.entry.js +3 -3
- package/dist/esm/bcm-textarea.entry.js +3 -3
- package/dist/esm/bcm-time-picker.entry.js +2 -2
- package/dist/esm/bcm-toast.entry.js +2 -2
- package/dist/esm/bromcom-ui.js +1 -1
- package/dist/esm/{color-helper-e8ce23d7.js → color-helper-116755ed.js} +28 -2
- package/dist/esm/{element-dragger-89bb52fd.js → element-dragger-7ea06c76.js} +1 -1
- package/dist/esm/{generate-e7435a13.js → generate-786bd626.js} +55 -5
- package/dist/esm/index-6310a048.js +537 -0
- package/dist/esm/index-962dec74.js +50 -0
- package/dist/esm/{input-template-e1e850b5.js → input-template-88fba8d7.js} +1 -1
- package/dist/esm/{json-parse-decarator-2bcd4584.js → json-parse-decarator-e85e0fea.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{number-helper-cb2563aa.js → number-helper-d9b73e76.js} +1 -1
- package/dist/esm/old-bcm-popover-box.entry.js +4 -4
- package/dist/esm/old-bcm-popover.entry.js +1 -1
- package/dist/esm/{stepper-states-29463262.js → stepper-states-026cdd66.js} +1 -1
- package/dist/esm/{utils-57652744.js → utils-b3338faf.js} +1 -1
- package/dist/esm/{validators-0a4134a4.js → validators-0b019b63.js} +1 -1
- package/dist/types/components/atoms/avatar/avatar.d.ts +8 -10
- package/dist/types/components/atoms/avatar/avatar.style.d.ts +5 -0
- package/dist/types/components/atoms/badge/badge.d.ts +3 -7
- package/dist/types/components/atoms/badge/badge.style.d.ts +4 -0
- package/dist/types/components.d.ts +11 -13
- package/dist/types/helper/color-helper.d.ts +22 -2
- package/dist/types/helper/generate.d.ts +21 -1
- package/dist/types/helper/popover-helper.d.ts +0 -5
- package/dist/types/helper/tooltip-helper.d.ts +0 -1
- package/package.json +7 -4
- package/dist/bromcom-ui/p-0ab46a99.js +0 -5
- package/dist/bromcom-ui/p-0b0660a0.js +0 -5
- package/dist/bromcom-ui/p-1a3d281e.entry.js +0 -5
- package/dist/bromcom-ui/p-2b4677a8.entry.js +0 -5
- package/dist/bromcom-ui/p-3ae615ef.entry.js +0 -5
- package/dist/bromcom-ui/p-61c51804.entry.js +0 -5
- package/dist/bromcom-ui/p-632bbc11.entry.js +0 -5
- package/dist/bromcom-ui/p-6c34860e.entry.js +0 -5
- package/dist/bromcom-ui/p-843905c8.js +0 -5
- package/dist/bromcom-ui/p-92831a1d.js +0 -5
- package/dist/bromcom-ui/p-a9a9bf8f.js +0 -5
- package/dist/bromcom-ui/p-b17ba740.entry.js +0 -19
- package/dist/bromcom-ui/p-b8cfa9ab.entry.js +0 -5
- package/dist/bromcom-ui/p-c5de4c76.entry.js +0 -5
- package/dist/bromcom-ui/p-d832cf50.entry.js +0 -5
- package/dist/bromcom-ui/p-d888c814.entry.js +0 -5
- package/dist/bromcom-ui/p-fb96c1cd.entry.js +0 -5
- package/dist/cjs/bcm-dropdown.cjs.entry.js +0 -118
- package/dist/cjs/bcm-item.cjs.entry.js +0 -71
- package/dist/cjs/bcm-items.cjs.entry.js +0 -48
- package/dist/cjs/bcm-menu.cjs.entry.js +0 -149
- package/dist/cjs/bcm-popover.cjs.entry.js +0 -225
- package/dist/cjs/bcm-tab-group.cjs.entry.js +0 -205
- package/dist/cjs/bcm-tab-item-header.cjs.entry.js +0 -73
- package/dist/cjs/bcm-tab-item.cjs.entry.js +0 -90
- package/dist/cjs/bcm-text.cjs.entry.js +0 -49
- package/dist/cjs/tooltip-helper-c822010b.js +0 -150
- package/dist/collection/components/atoms/avatar/avatar.css +0 -198
- package/dist/collection/components/atoms/badge/badge.css +0 -231
- package/dist/esm/bcm-dropdown.entry.js +0 -114
- package/dist/esm/bcm-item.entry.js +0 -67
- package/dist/esm/bcm-items.entry.js +0 -44
- package/dist/esm/bcm-menu.entry.js +0 -145
- package/dist/esm/bcm-popover.entry.js +0 -221
- package/dist/esm/bcm-tab-group.entry.js +0 -201
- package/dist/esm/bcm-tab-item-header.entry.js +0 -69
- package/dist/esm/bcm-tab-item.entry.js +0 -86
- package/dist/esm/bcm-text.entry.js +0 -45
- package/dist/esm/tooltip-helper-f35d93d2.js +0 -148
|
@@ -0,0 +1,1720 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent, a as getAssetPath, f as forceUpdate } from './index-348b16ad.js';
|
|
6
|
+
import { C as ColorHelper } from './color-helper-116755ed.js';
|
|
7
|
+
import './datetime-helper-df25808a.js';
|
|
8
|
+
import { G as Generate, s as snq } from './generate-786bd626.js';
|
|
9
|
+
import './number-helper-d9b73e76.js';
|
|
10
|
+
import { S as StringHelper } from './string-helper-6bd24967.js';
|
|
11
|
+
import './validators-0b019b63.js';
|
|
12
|
+
import './element-dragger-7ea06c76.js';
|
|
13
|
+
import { B as Bcm, a as Bcm$1 } from './bcm-9f50af9c.js';
|
|
14
|
+
import { c as cva } from './index-962dec74.js';
|
|
15
|
+
import { c as classnames } from './index-ed9652af.js';
|
|
16
|
+
import { c as createStore } from './index-0052017c.js';
|
|
17
|
+
import { S as SlotTemplate } from './slot-template-672e941d.js';
|
|
18
|
+
import { I as IsLoad } from './is-load-decorator-07d3502a.js';
|
|
19
|
+
import { J as JsonParse } from './json-parse-decarator-e85e0fea.js';
|
|
20
|
+
import { d as delay } from './utils-b3338faf.js';
|
|
21
|
+
import { F as FloatingUI } from './floating-ui-e7341329.js';
|
|
22
|
+
import './colors-1d7854ea.js';
|
|
23
|
+
import './colors-44c95e7e.js';
|
|
24
|
+
import './_commonjsHelpers-3016b722.js';
|
|
25
|
+
|
|
26
|
+
class Tooltip {
|
|
27
|
+
constructor({ message, targetId, placement = "top", color = "slate-700", trigger = "none", size = "medium", openDelay = 0, closeDelay = 0, autoHide = false, emitShow = () => { }, emitHide = () => { }, }) {
|
|
28
|
+
this.destroy = () => {
|
|
29
|
+
this.el = document.getElementById(this.id);
|
|
30
|
+
if (this.el) {
|
|
31
|
+
this.el.remove();
|
|
32
|
+
this.emitHide();
|
|
33
|
+
}
|
|
34
|
+
this.removeListener();
|
|
35
|
+
};
|
|
36
|
+
this.target = () => document.getElementById(this.targetId);
|
|
37
|
+
this.sizeClass = () => {
|
|
38
|
+
switch (this.size) {
|
|
39
|
+
case Bcm.Size.small:
|
|
40
|
+
return "tw-text-1";
|
|
41
|
+
case Bcm.Size.medium:
|
|
42
|
+
return "tw-text-2";
|
|
43
|
+
case Bcm.Size.large:
|
|
44
|
+
return "tw-text-3";
|
|
45
|
+
default:
|
|
46
|
+
return "tw-text-2";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this.init = () => {
|
|
50
|
+
const { tone, colorName } = ColorHelper.parseColor(this.color, 700);
|
|
51
|
+
const dc = Generate.getTwColor({
|
|
52
|
+
color: colorName,
|
|
53
|
+
tones: {
|
|
54
|
+
[tone]: ["bg"],
|
|
55
|
+
},
|
|
56
|
+
variable: "--bcm-tooltip",
|
|
57
|
+
});
|
|
58
|
+
const style = Object.assign(Object.assign({}, dc), (dc["--bcm-tooltip-bg"] && { "--bcm-tooltip-text": ColorHelper.reverseColor(dc["--bcm-tooltip-bg"]) }));
|
|
59
|
+
this.el = Generate.createElement("div", {
|
|
60
|
+
"id": `${this.targetId}-tooltip-box`,
|
|
61
|
+
"class": `
|
|
62
|
+
tw-whitespace-normal tw-break-words tw-block tw-font-sans tw-pointer-events-none tw-max-w-xs tw-py-1 tw-px-2 tw-rounded tw-bg-[--bcm-tooltip-bg] tw-text-[--bcm-tooltip-text] ${this.sizeClass()} tw-absolute tw-top-0 tw-left-0 tw-z-tooltip tw-opacity-0 tw-transition-opacity tw-duration-300`,
|
|
63
|
+
"role": "tooltip",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
"style": ColorHelper.generateStyleString(style),
|
|
66
|
+
"innerHTML": StringHelper.trim(this.message),
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
this.update = () => {
|
|
70
|
+
this.el = document.getElementById(this.id);
|
|
71
|
+
if (this.el) {
|
|
72
|
+
this.hide();
|
|
73
|
+
this.show();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
this.listener = () => {
|
|
77
|
+
window.addEventListener("resize", this.calculatePosition.bind(this));
|
|
78
|
+
window.addEventListener("scroll", this.calculatePosition.bind(this), true);
|
|
79
|
+
window.addEventListener("wheel", this.calculatePosition.bind(this));
|
|
80
|
+
if (this.trigger && this.target()) {
|
|
81
|
+
switch (this.trigger) {
|
|
82
|
+
case "click":
|
|
83
|
+
this.target().addEventListener("click", this.toggle.bind(this));
|
|
84
|
+
this.autoHide && this.target().addEventListener("mouseleave", this.hide.bind(this));
|
|
85
|
+
break;
|
|
86
|
+
case "hover":
|
|
87
|
+
this.target().addEventListener("mouseenter", this.show.bind(this));
|
|
88
|
+
this.target().addEventListener("mouseleave", this.hide.bind(this));
|
|
89
|
+
break;
|
|
90
|
+
case "focus":
|
|
91
|
+
this.target().addEventListener("focus", this.show.bind(this), true);
|
|
92
|
+
this.target().addEventListener("blur", this.hide.bind(this), true);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this.calculatePosition();
|
|
97
|
+
};
|
|
98
|
+
this.removeListener = () => {
|
|
99
|
+
window.removeEventListener("resize", this.calculatePosition.bind(this));
|
|
100
|
+
window.removeEventListener("scroll", this.calculatePosition.bind(this), true);
|
|
101
|
+
window.removeEventListener("wheel", this.calculatePosition.bind(this));
|
|
102
|
+
if (this.target()) {
|
|
103
|
+
this.target().removeEventListener("click", this.toggle.bind(this));
|
|
104
|
+
this.target().removeEventListener("mouseenter", this.show.bind(this));
|
|
105
|
+
this.target().removeEventListener("mouseleave", this.hide.bind(this));
|
|
106
|
+
this.target().removeEventListener("focus", this.show.bind(this), true);
|
|
107
|
+
this.target().removeEventListener("blur", this.hide.bind(this), true);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
this.calculatePosition = () => {
|
|
111
|
+
this.el = document.getElementById(this.id);
|
|
112
|
+
if (this.el) {
|
|
113
|
+
FloatingUI({
|
|
114
|
+
ref: this.target(),
|
|
115
|
+
floating: this.el,
|
|
116
|
+
placement: this.placement,
|
|
117
|
+
offset: 8,
|
|
118
|
+
arrow: true,
|
|
119
|
+
arrowColor: `tw-bg-[--bcm-tooltip-bg]`,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
this.show = async () => {
|
|
124
|
+
if (this.message) {
|
|
125
|
+
this.init();
|
|
126
|
+
await delay(this.openDelay);
|
|
127
|
+
this.calculatePosition();
|
|
128
|
+
this.emitShow();
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.hide();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
this.hide = async () => {
|
|
135
|
+
this.el = document.getElementById(this.id);
|
|
136
|
+
if (this.el) {
|
|
137
|
+
await delay(this.closeDelay);
|
|
138
|
+
this.el && this.el.remove();
|
|
139
|
+
this.emitHide();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
this.toggle = () => {
|
|
143
|
+
this.el = document.getElementById(this.id);
|
|
144
|
+
if (this.el) {
|
|
145
|
+
this.hide();
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
this.show();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
this.message = message;
|
|
152
|
+
this.targetId = targetId;
|
|
153
|
+
this.placement = placement;
|
|
154
|
+
this.color = color;
|
|
155
|
+
this.id = targetId + "-tooltip-box";
|
|
156
|
+
this.trigger = trigger;
|
|
157
|
+
this.size = size;
|
|
158
|
+
this.openDelay = openDelay;
|
|
159
|
+
this.closeDelay = closeDelay;
|
|
160
|
+
this.autoHide = autoHide;
|
|
161
|
+
this.emitShow = emitShow;
|
|
162
|
+
this.emitHide = emitHide;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
class Popover {
|
|
167
|
+
constructor({ content, message, targetId, placement = "top", color = "slate-700", trigger = "none", openDelay = 0, closeDelay = 0, autoHide = false, emitShow = () => { }, emitHide = () => { } }) {
|
|
168
|
+
this.destroy = () => {
|
|
169
|
+
this.el = document.getElementById(this.id);
|
|
170
|
+
if (this.el) {
|
|
171
|
+
this.el.remove();
|
|
172
|
+
this.emitHide();
|
|
173
|
+
}
|
|
174
|
+
this.removeListener();
|
|
175
|
+
};
|
|
176
|
+
this.target = () => document.getElementById(this.targetId);
|
|
177
|
+
this.init = () => {
|
|
178
|
+
const { tone, colorName } = ColorHelper.parseColor(this.color, 700);
|
|
179
|
+
const dc = Generate.getTwColor({
|
|
180
|
+
color: colorName,
|
|
181
|
+
tones: {
|
|
182
|
+
[tone]: ["bg"],
|
|
183
|
+
},
|
|
184
|
+
variable: "--bcm-popover",
|
|
185
|
+
});
|
|
186
|
+
const style = Object.assign(Object.assign({}, dc), (dc["--bcm-popover-bg"] && { "--bcm-popover-text": ColorHelper.reverseColor(dc["--bcm-popover-bg"]) }));
|
|
187
|
+
const inner = `<div class="tw-z-[1] tw-rounded tw-py-2">
|
|
188
|
+
${this.message ? `<div class="tw-font-medium tw-w-full tw-pb-1 tw-px-4">${StringHelper.trim(this.message)}</div>` : ""}
|
|
189
|
+
${this.content ? `<div class="tw-font-normal tw-px-4">${StringHelper.trim(this.content)}</div>` : ""}
|
|
190
|
+
</div>`;
|
|
191
|
+
this.el = Generate.createElement("div", {
|
|
192
|
+
"id": `${this.targetId}-popover-box`,
|
|
193
|
+
"class": `
|
|
194
|
+
tw-whitespace-normal tw-break-words tw-block tw-font-sans tw-pointer-events-none tw-max-w-[256px] tw-rounded tw-bg-[--bcm-popover-bg] tw-text-[--bcm-popover-text] tw-text-3 tw-absolute tw-top-0 tw-left-0 tw-z-tooltip tw-opacity-0 tw-transition-opacity tw-duration-300
|
|
195
|
+
tw-shadow`,
|
|
196
|
+
"role": "popover",
|
|
197
|
+
"aria-hidden": "true",
|
|
198
|
+
"style": ColorHelper.generateStyleString(style),
|
|
199
|
+
"innerHTML": inner,
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
this.update = () => {
|
|
203
|
+
this.el = document.getElementById(this.id);
|
|
204
|
+
if (this.el) {
|
|
205
|
+
this.hide();
|
|
206
|
+
this.show();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
this.listener = () => {
|
|
210
|
+
window.addEventListener("resize", this.calculatePosition.bind(this));
|
|
211
|
+
window.addEventListener("scroll", this.calculatePosition.bind(this), true);
|
|
212
|
+
window.addEventListener("wheel", this.calculatePosition.bind(this));
|
|
213
|
+
if (this.trigger && this.target()) {
|
|
214
|
+
switch (this.trigger) {
|
|
215
|
+
case "click":
|
|
216
|
+
this.target().addEventListener("click", this.toggle.bind(this));
|
|
217
|
+
this.autoHide && this.target().addEventListener("mouseleave", this.hide.bind(this));
|
|
218
|
+
break;
|
|
219
|
+
case "hover":
|
|
220
|
+
this.target().addEventListener("mouseenter", this.show.bind(this));
|
|
221
|
+
this.target().addEventListener("mouseleave", this.hide.bind(this));
|
|
222
|
+
break;
|
|
223
|
+
case "focus":
|
|
224
|
+
this.target().addEventListener("focus", this.show.bind(this), true);
|
|
225
|
+
this.target().addEventListener("blur", this.hide.bind(this), true);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
this.calculatePosition();
|
|
230
|
+
};
|
|
231
|
+
this.removeListener = () => {
|
|
232
|
+
window.removeEventListener("resize", this.calculatePosition.bind(this));
|
|
233
|
+
window.removeEventListener("scroll", this.calculatePosition.bind(this), true);
|
|
234
|
+
window.removeEventListener("wheel", this.calculatePosition.bind(this));
|
|
235
|
+
if (this.target()) {
|
|
236
|
+
this.target().removeEventListener("click", this.toggle.bind(this));
|
|
237
|
+
this.target().removeEventListener("mouseenter", this.show.bind(this));
|
|
238
|
+
this.target().removeEventListener("mouseleave", this.hide.bind(this));
|
|
239
|
+
this.target().removeEventListener("focus", this.show.bind(this), true);
|
|
240
|
+
this.target().removeEventListener("blur", this.hide.bind(this), true);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
this.calculatePosition = () => {
|
|
244
|
+
this.el = document.getElementById(this.id);
|
|
245
|
+
if (this.el) {
|
|
246
|
+
FloatingUI({
|
|
247
|
+
ref: this.target(),
|
|
248
|
+
floating: this.el,
|
|
249
|
+
placement: this.placement,
|
|
250
|
+
offset: 8,
|
|
251
|
+
arrow: true,
|
|
252
|
+
arrowColor: `tw-bg-[--bcm-popover-bg]`,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
this.show = async () => {
|
|
257
|
+
if (this.message) {
|
|
258
|
+
this.init();
|
|
259
|
+
await delay(this.openDelay);
|
|
260
|
+
this.calculatePosition();
|
|
261
|
+
this.emitShow();
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
this.hide();
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
this.hide = async () => {
|
|
268
|
+
this.el = document.getElementById(this.id);
|
|
269
|
+
if (this.el) {
|
|
270
|
+
await delay(this.closeDelay);
|
|
271
|
+
this.el.remove();
|
|
272
|
+
this.emitHide();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
this.toggle = () => {
|
|
276
|
+
this.el = document.getElementById(this.id);
|
|
277
|
+
if (this.el) {
|
|
278
|
+
this.hide();
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
this.show();
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
this.content = content;
|
|
285
|
+
this.message = message;
|
|
286
|
+
this.targetId = targetId;
|
|
287
|
+
this.placement = placement;
|
|
288
|
+
this.color = color;
|
|
289
|
+
this.trigger = trigger;
|
|
290
|
+
this.id = targetId + "-popover-box";
|
|
291
|
+
this.openDelay = openDelay;
|
|
292
|
+
this.closeDelay = closeDelay;
|
|
293
|
+
this.autoHide = autoHide;
|
|
294
|
+
this.emitShow = emitShow;
|
|
295
|
+
this.emitHide = emitHide;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const badgeStyle = cva([
|
|
300
|
+
"bcm-badge__dot bcm-ui-element bcm-ui-content-display",
|
|
301
|
+
"tw-flex tw-items-center tw-justify-center tw-flex-row",
|
|
302
|
+
"tw-rounded-full tw-text-center",
|
|
303
|
+
"tw-bg-[--bcm-badge-bg] tw-text-[--bcm-badge-text]",
|
|
304
|
+
" tw-whitespace-nowrap [&>*:empty]:tw-hidden",
|
|
305
|
+
], {
|
|
306
|
+
variants: {
|
|
307
|
+
size: {
|
|
308
|
+
small: ["bcm-badge__dot-size-small tw-text-1 tw-min-w-1.5 tw-min-h-1.5 [&>*]:tw-px-1.5 [&>*]:tw-min-w-4"],
|
|
309
|
+
medium: ["bcm-badge__dot-size-medium tw-text-2 tw-min-w-2 tw-min-h-2 [&>*]:tw-px-1.5 [&>*]:tw-min-w-5"],
|
|
310
|
+
large: ["bcm-badge__dot-size-large tw-text-3 tw-min-w-2.5 tw-min-h-2.5 [&>*]:tw-px-2 [&>*]:tw-min-w-6"], //10
|
|
311
|
+
},
|
|
312
|
+
blink: {
|
|
313
|
+
true: [
|
|
314
|
+
"bcm-badge__dot-blink tw-relative",
|
|
315
|
+
"after:tw-content-[''] after:tw-absolute after:tw-top-0 after:tw-left-0 after:tw-z-[-1]",
|
|
316
|
+
"after:tw-w-full after:tw-h-full after:tw-bg-[--bcm-badge-bg] after:tw-opacity-75 after:tw-rounded-full",
|
|
317
|
+
"after:tw-animate-blink after:tw-pointer-events-none"
|
|
318
|
+
],
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
compoundVariants: [
|
|
322
|
+
{
|
|
323
|
+
size: "medium",
|
|
324
|
+
blink: false,
|
|
325
|
+
class: "",
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
defaultVariants: {
|
|
329
|
+
size: "medium",
|
|
330
|
+
blink: false,
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
const BcmBadge = class {
|
|
335
|
+
constructor(hostRef) {
|
|
336
|
+
registerInstance(this, hostRef);
|
|
337
|
+
this.statusColors = {
|
|
338
|
+
info: "blue",
|
|
339
|
+
error: "red",
|
|
340
|
+
warning: "amber",
|
|
341
|
+
success: "emerald",
|
|
342
|
+
};
|
|
343
|
+
this._id = Generate.UID();
|
|
344
|
+
this.blink = false;
|
|
345
|
+
this.value = undefined;
|
|
346
|
+
this.color = undefined;
|
|
347
|
+
this.size = Bcm.Size.medium;
|
|
348
|
+
this.status = undefined;
|
|
349
|
+
}
|
|
350
|
+
render() {
|
|
351
|
+
const { blink, value, size, color, status } = this;
|
|
352
|
+
const _color = this.statusColors[status] || color;
|
|
353
|
+
const { tone, colorName } = ColorHelper.parseColor(_color);
|
|
354
|
+
const dc = Generate.getTwColor({
|
|
355
|
+
color: colorName,
|
|
356
|
+
tones: {
|
|
357
|
+
[tone]: ["bg"],
|
|
358
|
+
},
|
|
359
|
+
variable: "--bcm-badge",
|
|
360
|
+
});
|
|
361
|
+
const style = Object.assign(Object.assign({}, dc), (dc["--bcm-badge-bg"] && { "--bcm-badge-text": ColorHelper.reverseColor(dc["--bcm-badge-bg"]) }));
|
|
362
|
+
return (h(Host, { class: "bcm-badge tw-inline-flex tw-items-center tw-justify-center", role: "status", "aria-live": "polite" }, h("div", { class: badgeStyle({ size, blink }), style: style }, h("span", { class: "bcm-badge__dot-text", role: "presentation", "aria-hidden": "true" }, h("slot", null, value)), h("span", { class: "tw-sr-only" }, value))));
|
|
363
|
+
}
|
|
364
|
+
get el() { return getElement(this); }
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
const variantOptions = {
|
|
368
|
+
save: {
|
|
369
|
+
text: 'Save',
|
|
370
|
+
color: 'emerald',
|
|
371
|
+
icon: 'far fa-save',
|
|
372
|
+
iconPosition: 'prefix',
|
|
373
|
+
},
|
|
374
|
+
ok: {
|
|
375
|
+
text: 'Ok',
|
|
376
|
+
color: 'emerald',
|
|
377
|
+
icon: 'far fa-check',
|
|
378
|
+
iconPosition: 'prefix',
|
|
379
|
+
},
|
|
380
|
+
new: {
|
|
381
|
+
text: 'New',
|
|
382
|
+
color: 'emerald',
|
|
383
|
+
icon: 'far fa-plus',
|
|
384
|
+
iconPosition: 'prefix',
|
|
385
|
+
},
|
|
386
|
+
add: {
|
|
387
|
+
text: 'Add',
|
|
388
|
+
color: 'emerald',
|
|
389
|
+
icon: 'far fa-plus',
|
|
390
|
+
iconPosition: 'prefix',
|
|
391
|
+
},
|
|
392
|
+
create: {
|
|
393
|
+
text: 'Create',
|
|
394
|
+
color: 'emerald',
|
|
395
|
+
icon: 'far fa-plus',
|
|
396
|
+
iconPosition: 'prefix',
|
|
397
|
+
},
|
|
398
|
+
prev: {
|
|
399
|
+
text: 'Prev',
|
|
400
|
+
color: '',
|
|
401
|
+
icon: 'far fa-arrow-left',
|
|
402
|
+
iconPosition: 'prefix',
|
|
403
|
+
},
|
|
404
|
+
next: {
|
|
405
|
+
text: 'Next',
|
|
406
|
+
color: '',
|
|
407
|
+
icon: 'far fa-arrow-right',
|
|
408
|
+
iconPosition: 'suffix',
|
|
409
|
+
},
|
|
410
|
+
apply: {
|
|
411
|
+
text: 'Apply',
|
|
412
|
+
color: '',
|
|
413
|
+
icon: 'far fa-check-circle',
|
|
414
|
+
iconPosition: 'prefix',
|
|
415
|
+
},
|
|
416
|
+
submit: {
|
|
417
|
+
text: 'Submit',
|
|
418
|
+
color: '',
|
|
419
|
+
icon: 'far fa-save',
|
|
420
|
+
iconPosition: 'prefix',
|
|
421
|
+
},
|
|
422
|
+
send: {
|
|
423
|
+
text: 'Send',
|
|
424
|
+
color: 'emerald',
|
|
425
|
+
icon: 'far fa-paper-plane',
|
|
426
|
+
iconPosition: 'prefix',
|
|
427
|
+
},
|
|
428
|
+
delete: {
|
|
429
|
+
text: 'Delete',
|
|
430
|
+
color: 'red',
|
|
431
|
+
icon: 'far fa-trash',
|
|
432
|
+
iconPosition: 'prefix',
|
|
433
|
+
},
|
|
434
|
+
cancel: {
|
|
435
|
+
text: 'Cancel',
|
|
436
|
+
color: 'red',
|
|
437
|
+
icon: 'far fa-times',
|
|
438
|
+
iconPosition: 'prefix',
|
|
439
|
+
},
|
|
440
|
+
decline: {
|
|
441
|
+
text: 'Decline',
|
|
442
|
+
color: 'red',
|
|
443
|
+
icon: 'far fa-ban',
|
|
444
|
+
iconPosition: 'prefix',
|
|
445
|
+
},
|
|
446
|
+
close: {
|
|
447
|
+
text: 'Close',
|
|
448
|
+
color: 'red',
|
|
449
|
+
icon: 'far fa-times-circle',
|
|
450
|
+
iconPosition: 'prefix',
|
|
451
|
+
},
|
|
452
|
+
archive: {
|
|
453
|
+
text: 'Archive',
|
|
454
|
+
color: 'red',
|
|
455
|
+
icon: 'far fa-folder-open',
|
|
456
|
+
iconPosition: 'prefix',
|
|
457
|
+
},
|
|
458
|
+
remove: {
|
|
459
|
+
text: 'Remove',
|
|
460
|
+
color: 'red',
|
|
461
|
+
icon: 'far fa-minus-circle',
|
|
462
|
+
iconPosition: 'prefix',
|
|
463
|
+
},
|
|
464
|
+
edit: {
|
|
465
|
+
text: 'Edit',
|
|
466
|
+
color: '',
|
|
467
|
+
icon: 'far fa-edit',
|
|
468
|
+
iconPosition: 'prefix',
|
|
469
|
+
},
|
|
470
|
+
export: {
|
|
471
|
+
text: 'Export',
|
|
472
|
+
color: '',
|
|
473
|
+
icon: 'far fa-sign-out',
|
|
474
|
+
iconPosition: 'prefix',
|
|
475
|
+
},
|
|
476
|
+
import: {
|
|
477
|
+
text: 'Import',
|
|
478
|
+
color: '',
|
|
479
|
+
icon: 'far fa-sign-in',
|
|
480
|
+
iconPosition: 'prefix',
|
|
481
|
+
},
|
|
482
|
+
filter: {
|
|
483
|
+
text: 'Filter',
|
|
484
|
+
color: '',
|
|
485
|
+
icon: 'far fa-filter',
|
|
486
|
+
iconPosition: 'prefix',
|
|
487
|
+
},
|
|
488
|
+
update: {
|
|
489
|
+
text: 'Update',
|
|
490
|
+
color: '',
|
|
491
|
+
icon: 'far fa-sync',
|
|
492
|
+
iconPosition: 'prefix',
|
|
493
|
+
},
|
|
494
|
+
reset: {
|
|
495
|
+
text: "Reset",
|
|
496
|
+
color: "",
|
|
497
|
+
icon: 'far fa-sync',
|
|
498
|
+
iconPosition: "prefix",
|
|
499
|
+
},
|
|
500
|
+
download: {
|
|
501
|
+
text: 'Download',
|
|
502
|
+
color: '',
|
|
503
|
+
icon: 'far fa-download',
|
|
504
|
+
iconPosition: 'prefix',
|
|
505
|
+
},
|
|
506
|
+
};
|
|
507
|
+
var VariantProps;
|
|
508
|
+
(function (VariantProps) {
|
|
509
|
+
VariantProps["save"] = "save";
|
|
510
|
+
VariantProps["submit"] = "submit";
|
|
511
|
+
VariantProps["ok"] = "ok";
|
|
512
|
+
VariantProps["new"] = "new";
|
|
513
|
+
VariantProps["add"] = "add";
|
|
514
|
+
VariantProps["create"] = "create";
|
|
515
|
+
VariantProps["apply"] = "apply";
|
|
516
|
+
VariantProps["prev"] = "prev";
|
|
517
|
+
VariantProps["next"] = "next";
|
|
518
|
+
VariantProps["send"] = "send";
|
|
519
|
+
VariantProps["delete"] = "delete";
|
|
520
|
+
VariantProps["cancel"] = "cancel";
|
|
521
|
+
VariantProps["decline"] = "decline";
|
|
522
|
+
VariantProps["close"] = "close";
|
|
523
|
+
VariantProps["archive"] = "archive";
|
|
524
|
+
VariantProps["remove"] = "remove";
|
|
525
|
+
VariantProps["edit"] = "edit";
|
|
526
|
+
VariantProps["export"] = "export";
|
|
527
|
+
VariantProps["import"] = "import";
|
|
528
|
+
VariantProps["filter"] = "filter";
|
|
529
|
+
VariantProps["update"] = "update";
|
|
530
|
+
VariantProps["reset"] = "Reset";
|
|
531
|
+
VariantProps["download"] = "download";
|
|
532
|
+
})(VariantProps || (VariantProps = {}));
|
|
533
|
+
|
|
534
|
+
const { state } = createStore({
|
|
535
|
+
value: new Map(),
|
|
536
|
+
setData: {},
|
|
537
|
+
removeData: {}
|
|
538
|
+
});
|
|
539
|
+
const setValue = (val) => {
|
|
540
|
+
const data = Object.assign(Object.assign({}, val), (variantOptions[val.variant] && {
|
|
541
|
+
icon: variantOptions[val.variant].icon,
|
|
542
|
+
value: variantOptions[val.variant].text,
|
|
543
|
+
iconPosition: Bcm$1.IconPosition[variantOptions[val.variant].iconPosition],
|
|
544
|
+
variantColor: variantOptions[val.variant].color
|
|
545
|
+
}));
|
|
546
|
+
state.value.set(data.id, data);
|
|
547
|
+
};
|
|
548
|
+
const removeValue = (_id) => {
|
|
549
|
+
state.value.delete(_id);
|
|
550
|
+
};
|
|
551
|
+
const getValue = (id) => snq(() => state.value.get(id), {});
|
|
552
|
+
const buttonState = {
|
|
553
|
+
setValue,
|
|
554
|
+
removeValue,
|
|
555
|
+
getValue
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
const ButtonTemplate = ({ value, type, componentClass, disabled, href, target, loading, isIconOnly, icon, iconPosition, id }) => {
|
|
559
|
+
const ButtonTagType = (href) ? Bcm$1.HtmlElementType.a : Bcm$1.HtmlElementType.button;
|
|
560
|
+
return (h(ButtonTagType, Object.assign({ id: id }, (type == Bcm$1.HtmlElementType.button && { type }), { class: componentClass, disabled: disabled, href: href, target: target, tabindex: "0" }),
|
|
561
|
+
h("span", { hidden: true },
|
|
562
|
+
h("slot", null)),
|
|
563
|
+
loading && h("span", { class: "bcm-button__container-loading" },
|
|
564
|
+
" ",
|
|
565
|
+
h("span", { class: "bcm-button__container-icon" },
|
|
566
|
+
h("i", { class: "far fa-spinner-third fa-spin" }),
|
|
567
|
+
" ")),
|
|
568
|
+
icon && h("span", { class: `${iconPosition} bcm-button__container-icon` },
|
|
569
|
+
h("i", { class: `${icon}` })),
|
|
570
|
+
!isIconOnly && (h(SlotTemplate, { className: "bcm-button__container-text", value: value })),
|
|
571
|
+
h("slot", { name: "suffix" })));
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
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)}";
|
|
575
|
+
|
|
576
|
+
const BcmButton = class {
|
|
577
|
+
constructor(hostRef) {
|
|
578
|
+
registerInstance(this, hostRef);
|
|
579
|
+
this.bcmClick = createEvent(this, "bcm-click", 7);
|
|
580
|
+
this._id = Generate.UID();
|
|
581
|
+
this.hidden = false;
|
|
582
|
+
this.type = Bcm$1.ButtonType.button;
|
|
583
|
+
this.size = Bcm$1.Size.medium;
|
|
584
|
+
this.disabled = false;
|
|
585
|
+
this.kind = Bcm$1.Kind.solid;
|
|
586
|
+
this.outline = false;
|
|
587
|
+
this.icon = undefined;
|
|
588
|
+
this.href = undefined;
|
|
589
|
+
this.target = undefined;
|
|
590
|
+
this.value = undefined;
|
|
591
|
+
this.loading = false;
|
|
592
|
+
this.variant = undefined;
|
|
593
|
+
this.dataDismiss = false;
|
|
594
|
+
this.fullWidth = false;
|
|
595
|
+
this.iconPosition = Bcm$1.IconPosition.prefix;
|
|
596
|
+
this.color = undefined;
|
|
597
|
+
this.checked = false;
|
|
598
|
+
}
|
|
599
|
+
handleOnClick(e) {
|
|
600
|
+
if (this.disabled) {
|
|
601
|
+
e.preventDefault();
|
|
602
|
+
e.stopPropagation();
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
componentWillRender() {
|
|
607
|
+
const { size, kind, icon, iconPosition, disabled, outline, href, type, target, loading, variant, fullWidth, hidden, value } = this;
|
|
608
|
+
buttonState.setValue({
|
|
609
|
+
id: this._id,
|
|
610
|
+
size,
|
|
611
|
+
type,
|
|
612
|
+
kind,
|
|
613
|
+
icon,
|
|
614
|
+
iconPosition,
|
|
615
|
+
disabled,
|
|
616
|
+
outline,
|
|
617
|
+
href,
|
|
618
|
+
target,
|
|
619
|
+
loading,
|
|
620
|
+
variant,
|
|
621
|
+
fullWidth,
|
|
622
|
+
hidden,
|
|
623
|
+
value,
|
|
624
|
+
isIconOnly: !!(this.isHaveChildNodes() && this.icon),
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
getStateData() {
|
|
628
|
+
return buttonState.getValue(this._id);
|
|
629
|
+
}
|
|
630
|
+
isHaveChildNodes() {
|
|
631
|
+
const childNodes = Array.from(this.el.childNodes);
|
|
632
|
+
return childNodes.find(node => node.nodeType === Node.TEXT_NODE) === undefined;
|
|
633
|
+
}
|
|
634
|
+
setColor(color = this.color) {
|
|
635
|
+
if (!color)
|
|
636
|
+
return;
|
|
637
|
+
const { kind } = this;
|
|
638
|
+
const prefix = `--bcm-button-${kind}`;
|
|
639
|
+
if (kind === 'solid') {
|
|
640
|
+
return {
|
|
641
|
+
[`${prefix}-color-default`]: ColorHelper.dsColor('white'),
|
|
642
|
+
[`${prefix}-color-hover`]: ColorHelper.dsColor('white'),
|
|
643
|
+
[`${prefix}-color-focus-visible`]: ColorHelper.dsColor('white'),
|
|
644
|
+
[`${prefix}-color-active`]: ColorHelper.dsColor('white'),
|
|
645
|
+
[`${prefix}-color-disabled`]: ColorHelper.dsColor('white'),
|
|
646
|
+
[`${prefix}-background-color-default`]: ColorHelper.dsColor(color + '-500'),
|
|
647
|
+
[`${prefix}-background-color-hover`]: ColorHelper.dsColor(color + '-600'),
|
|
648
|
+
[`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(color + '-700'),
|
|
649
|
+
[`${prefix}-background-color-active`]: ColorHelper.dsColor(color + '-800'),
|
|
650
|
+
[`${prefix}-background-color-disabled`]: ColorHelper.dsColor('slate-400'),
|
|
651
|
+
[`${prefix}-border-default`]: ColorHelper.dsColor(color + '-500'),
|
|
652
|
+
[`${prefix}-border-hover`]: ColorHelper.dsColor(color + '-600'),
|
|
653
|
+
[`${prefix}-border-focus-visible`]: ColorHelper.dsColor(color + '-700'),
|
|
654
|
+
[`${prefix}-border-active`]: ColorHelper.dsColor(color + '-800'),
|
|
655
|
+
[`${prefix}-border-disabled`]: ColorHelper.dsColor('slate-400')
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
else if (kind == 'link') {
|
|
659
|
+
return {
|
|
660
|
+
[`${prefix}-color-default`]: ColorHelper.dsColor(color + '-500'),
|
|
661
|
+
[`${prefix}-color-hover`]: ColorHelper.dsColor(color + '-600'),
|
|
662
|
+
[`${prefix}-color-focus-visible`]: ColorHelper.dsColor(color + '-800'),
|
|
663
|
+
[`${prefix}-color-active`]: ColorHelper.dsColor(color + '-700'),
|
|
664
|
+
[`${prefix}-color-disabled`]: ColorHelper.dsColor('slate-400'),
|
|
665
|
+
[`${prefix}-background-color-default`]: ColorHelper.dsColor('transparent'),
|
|
666
|
+
[`${prefix}-background-color-hover`]: ColorHelper.dsColor('transparent'),
|
|
667
|
+
[`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor('slate-50'),
|
|
668
|
+
[`${prefix}-background-color-active`]: ColorHelper.dsColor('slate-50'),
|
|
669
|
+
[`${prefix}-background-color-disabled`]: ColorHelper.dsColor('transparent'),
|
|
670
|
+
[`${prefix}-border-default`]: ColorHelper.dsColor('transparent'),
|
|
671
|
+
[`${prefix}-border-hover`]: ColorHelper.dsColor('transparent'),
|
|
672
|
+
[`${prefix}-border-focus-visible`]: ColorHelper.dsColor('slate-50'),
|
|
673
|
+
[`${prefix}-border-active`]: ColorHelper.dsColor('slate-50'),
|
|
674
|
+
[`${prefix}-border-disabled`]: ColorHelper.dsColor('transparent')
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
else if (kind == 'ghost') {
|
|
678
|
+
return {
|
|
679
|
+
[`${prefix}-color-default`]: ColorHelper.dsColor(color + '-600'),
|
|
680
|
+
[`${prefix}-color-hover`]: ColorHelper.dsColor(color + '-600'),
|
|
681
|
+
[`${prefix}-color-focus-visible`]: ColorHelper.dsColor(color + '-600'),
|
|
682
|
+
[`${prefix}-color-active`]: ColorHelper.dsColor(color + '-600'),
|
|
683
|
+
[`${prefix}-color-disabled`]: ColorHelper.dsColor(color + '-300'),
|
|
684
|
+
[`${prefix}-background-color-default`]: ColorHelper.dsColor(color + '-100'),
|
|
685
|
+
[`${prefix}-background-color-hover`]: ColorHelper.dsColor(color + '-200'),
|
|
686
|
+
[`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(color + '-400'),
|
|
687
|
+
[`${prefix}-background-color-active`]: ColorHelper.dsColor(color + '-300'),
|
|
688
|
+
[`${prefix}-background-color-disabled`]: ColorHelper.dsColor(color + '-50'),
|
|
689
|
+
[`${prefix}-border-default`]: ColorHelper.dsColor(color + '-300'),
|
|
690
|
+
[`${prefix}-border-hover`]: ColorHelper.dsColor(color + '-400'),
|
|
691
|
+
[`${prefix}-border-focus-visible`]: ColorHelper.dsColor(color + '-600'),
|
|
692
|
+
[`${prefix}-border-active`]: ColorHelper.dsColor(color + '-500'),
|
|
693
|
+
[`${prefix}-border-disabled`]: ColorHelper.dsColor(color + '-200'),
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
render() {
|
|
699
|
+
const { size, kind, disabled, outline, type, href, target, loading, variantColor, fullWidth, hidden, icon, iconPosition, value, isIconOnly, iconSize } = this.getStateData();
|
|
700
|
+
const classPrefix = 'bcm-button';
|
|
701
|
+
let componentClass = classnames('bcm-button__container', `bcm-button__container-size-${size}`, `bcm-button__container-kind-${outline ? 'ghost' : kind}`, {
|
|
702
|
+
'full-width': fullWidth,
|
|
703
|
+
'checked': this.checked,
|
|
704
|
+
'disabled': disabled,
|
|
705
|
+
});
|
|
706
|
+
const hostClasses = classnames(`${classPrefix}`, {
|
|
707
|
+
hidden,
|
|
708
|
+
'full-width': fullWidth,
|
|
709
|
+
});
|
|
710
|
+
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 })));
|
|
711
|
+
}
|
|
712
|
+
get el() { return getElement(this); }
|
|
713
|
+
};
|
|
714
|
+
BcmButton.style = buttonCss;
|
|
715
|
+
|
|
716
|
+
const dropdownCss = "@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-dropdown{width:fit-content;display:inline-flex;flex-direction:row}.bcm-dropdown.hidden{display:none}.bcm-dropdown.no-style{cursor:pointer}.bcm-dropdown.full-width{width:100%}.bcm-dropdown.full-width .bcm-button__container-text{flex:1;justify-content:space-between}.bcm-dropdown__type-split .main-button .bcm-button__container{border-top-right-radius:0;border-bottom-right-radius:0}.bcm-dropdown__type-split .split-button .bcm-button__container{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:1px;min-width:auto}.bcm-dropdown__icon{display:flex;flex-direction:row;align-items:center;justify-content:center;flex-wrap:nowrap;transform:rotate(0deg);transition:transform 0.2s ease}.bcm-dropdown__icon--open{transform:rotate(180deg)}";
|
|
717
|
+
|
|
718
|
+
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
719
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
720
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
721
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
722
|
+
else
|
|
723
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
724
|
+
if (d = decorators[i])
|
|
725
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
726
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
727
|
+
};
|
|
728
|
+
const BcmDropdown = class {
|
|
729
|
+
constructor(hostRef) {
|
|
730
|
+
registerInstance(this, hostRef);
|
|
731
|
+
this.bcmClick = createEvent(this, "bcm-click", 7);
|
|
732
|
+
this.bcmDropdownChange = createEvent(this, "bcm-dropdown-change", 7);
|
|
733
|
+
this.isOpen = undefined;
|
|
734
|
+
this._id = Generate.UID();
|
|
735
|
+
this.menuId = Generate.UID();
|
|
736
|
+
this.hidden = false;
|
|
737
|
+
this.type = 'dropdown';
|
|
738
|
+
this.size = Bcm$1.Size.medium;
|
|
739
|
+
this.disabled = false;
|
|
740
|
+
this.kind = Bcm$1.Kind.solid;
|
|
741
|
+
this.icon = undefined;
|
|
742
|
+
this.href = undefined;
|
|
743
|
+
this.target = undefined;
|
|
744
|
+
this.value = undefined;
|
|
745
|
+
this.noStyle = false;
|
|
746
|
+
this.dropdownIcon = 'fas fa-angle-down';
|
|
747
|
+
this.linkedComponent = undefined;
|
|
748
|
+
this.loading = false;
|
|
749
|
+
this.variant = undefined;
|
|
750
|
+
this.dataDismiss = false;
|
|
751
|
+
this.fullWidth = false;
|
|
752
|
+
this.iconPosition = Bcm$1.IconPosition.prefix;
|
|
753
|
+
this.placement = undefined;
|
|
754
|
+
this.height = undefined;
|
|
755
|
+
this.maxHeight = '500px';
|
|
756
|
+
this.minHeight = '50px';
|
|
757
|
+
this.stopDeepClean = false;
|
|
758
|
+
this.selectable = true;
|
|
759
|
+
this.gap = '4px';
|
|
760
|
+
this.color = undefined;
|
|
761
|
+
this.activeItem = null;
|
|
762
|
+
this.data = [];
|
|
763
|
+
}
|
|
764
|
+
async dataChanged(newValue) {
|
|
765
|
+
if (newValue) {
|
|
766
|
+
this.data = newValue;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
async setActive(id = null) {
|
|
770
|
+
var _a, _b;
|
|
771
|
+
(_b = (_a = document
|
|
772
|
+
.getElementById(`${this.menuId}`)) === null || _a === void 0 ? void 0 : _a.querySelectorAll('bcm-menu')) === null || _b === void 0 ? void 0 : _b.forEach(item => {
|
|
773
|
+
item.setActive(id);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
async getActive() {
|
|
777
|
+
return this.activeItem;
|
|
778
|
+
}
|
|
779
|
+
handleSlotItems({ detail }) {
|
|
780
|
+
this.data = detail;
|
|
781
|
+
}
|
|
782
|
+
setActiveAttribute(e) {
|
|
783
|
+
if (e.detail) {
|
|
784
|
+
this.bcmDropdownChange.emit(e.detail);
|
|
785
|
+
this.activeItem = e.detail;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
;
|
|
789
|
+
render() {
|
|
790
|
+
const { size, kind, disabled, icon, color, href, target, loading, type, variant, fullWidth, isOpen } = this;
|
|
791
|
+
const hostClasses = classnames('bcm-dropdown', 'bcm-dropdown__type-' + type, {
|
|
792
|
+
'full-width': fullWidth,
|
|
793
|
+
'no-style': this.noStyle,
|
|
794
|
+
'hidden': this.hidden || this.linkedComponent,
|
|
795
|
+
});
|
|
796
|
+
const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (disabled && { disabled })), (loading && { loading })), (kind && { kind })), (size && { size })), (variant && { variant })), (color && { color })), (this.menuId && { 'menu-id': this.menuId }));
|
|
797
|
+
const iconClasses = classnames('bcm-dropdown__icon', {
|
|
798
|
+
'bcm-dropdown__icon--open': isOpen,
|
|
799
|
+
});
|
|
800
|
+
const dropdownIcon = (h("span", { class: iconClasses }, h("bcm-icon", { icon: this.dropdownIcon })));
|
|
801
|
+
return (h(Host, { class: hostClasses }, h("span", { hidden: true }, h("slot", null)), this.noStyle && h("slot", null), !this.noStyle && (h("bcm-button", Object.assign({ class: "main-button", id: `${this._id}-button` }, attributes, (icon && { icon }), (href && type === 'split' && { href }), (target && type === 'split' && { target }), (fullWidth && { fullWidth })), h("slot", null), type === 'dropdown' && dropdownIcon)), !this.noStyle && type === 'split' && (h("bcm-button", Object.assign({ id: `${this._id}-button-split`, class: "split-button" }, attributes), dropdownIcon)), h("bcm-linked", { id: `${this.menuId}`, "target-id": `${this._id}-button${type === 'split' ? '-split' : ''}`, placement: this.placement || (type === 'dropdown' ? 'bottom-start' : 'bottom-end'), "max-height": this.maxHeight, "min-height": this.minHeight, height: this.height, "on-bcm-open": e => { var _a; return ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.id) == this.menuId && (this.isOpen = e.detail); } }, this.data && this.data.length > 0 && h("bcm-menu", { data: this.data, selectable: this.selectable, "on-bcm-click": e => this.bcmClick.emit(e.detail), "onBcm-menu-change": e => this.setActiveAttribute(e), gap: this.gap, dropdown: true }), h("slot", { name: "content" }))));
|
|
802
|
+
}
|
|
803
|
+
get el() { return getElement(this); }
|
|
804
|
+
static get watchers() { return {
|
|
805
|
+
"data": ["dataChanged"]
|
|
806
|
+
}; }
|
|
807
|
+
};
|
|
808
|
+
__decorate$1([
|
|
809
|
+
IsLoad()
|
|
810
|
+
], BcmDropdown.prototype, "el", void 0);
|
|
811
|
+
__decorate$1([
|
|
812
|
+
JsonParse('data', true)
|
|
813
|
+
], BcmDropdown.prototype, "dataChanged", null);
|
|
814
|
+
BcmDropdown.style = dropdownCss;
|
|
815
|
+
|
|
816
|
+
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}";
|
|
817
|
+
|
|
818
|
+
const customIconList = {
|
|
819
|
+
"message-bot": "message-bot.svg",
|
|
820
|
+
};
|
|
821
|
+
const BcmIcon = class {
|
|
822
|
+
constructor(hostRef) {
|
|
823
|
+
registerInstance(this, hostRef);
|
|
824
|
+
this.hidden = false;
|
|
825
|
+
this.icon = undefined;
|
|
826
|
+
}
|
|
827
|
+
getIcon() {
|
|
828
|
+
const { icon } = this;
|
|
829
|
+
if (icon in customIconList) {
|
|
830
|
+
const _icon = getAssetPath("./static/" + customIconList[icon]);
|
|
831
|
+
return (h("div", { class: "tw-flex tw-h-fit tw-w-fit tw-items-center tw-justify-center" }, h("img", { src: `${_icon}`, alt: icon, class: "tw-h-fit tw-w-fit" })));
|
|
832
|
+
}
|
|
833
|
+
return h("i", { class: `${icon}` });
|
|
834
|
+
}
|
|
835
|
+
render() {
|
|
836
|
+
const { /*icon,*/ hidden } = this;
|
|
837
|
+
return h(Host, { class: `bcm-icon fa ${hidden ? "hidden" : ""}` }, this.getIcon());
|
|
838
|
+
}
|
|
839
|
+
static get assetsDirs() { return ["static"]; }
|
|
840
|
+
get el() { return getElement(this); }
|
|
841
|
+
};
|
|
842
|
+
BcmIcon.style = iconCss;
|
|
843
|
+
|
|
844
|
+
const itemCss = "@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-item{box-sizing:border-box;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;flex-wrap:nowrap;--bcm-item-color-default:var(--bcm-new-ds-color-white);--bcm-item-background-color-default:var(--bcm-new-ds-color-blue-500);--bcm-item-color-hover:var(--bcm-new-ds-color-white);--bcm-item-background-color-hover:var(--bcm-new-ds-color-blue-600);--bcm-item-color-focus-visible:var(--bcm-new-ds-color-white);--bcm-item-background-color-focus-visible:var(--bcm-new-ds-color-blue-800);--bcm-item-color-active:var(--bcm-new-ds-color-white);--bcm-item-background-color-active:var(--bcm-new-ds-color-blue-700);--bcm-item-color-disabled:var(--bcm-new-ds-color-white);--bcm-item-background-color-disabled:var(--bcm-new-ds-color-slate-400);font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;border-radius:4px;outline:none;color:var(--bcm-item-color-default);background-color:var(--bcm-item-background-color-default)}.bcm-item-size-small{font-size:12px;line-height:calc(12px + 8px);padding:2px 12px;min-height:calc(calc(12px + 8px) + calc(2px) * 2)}.bcm-item-size-medium{font-size:14px;line-height:calc(14px + 8px);padding:5px 12px;min-height:calc(calc(14px + 8px) + calc(5px) * 2)}.bcm-item-size-large{font-size:16px;line-height:calc(16px + 8px);padding:8px 12px;min-height:calc(calc(16px + 8px) + calc(8px) * 2)}.bcm-item:default{color:var(--bcm-item-color-default);background-color:var(--bcm-item-background-color-default)}.bcm-item:hover{color:var(--bcm-item-color-hover);background-color:var(--bcm-item-background-color-hover)}.bcm-item:focus-visible{color:var(--bcm-item-color-focus-visible);background-color:var(--bcm-item-background-color-focus-visible)}.bcm-item:active{color:var(--bcm-item-color-active);background-color:var(--bcm-item-background-color-active)}.bcm-item:disabled{color:var(--bcm-item-color-disabled);background-color:var(--bcm-item-background-color-disabled)}.bcm-item:not(.static):hover{cursor:pointer}";
|
|
845
|
+
|
|
846
|
+
const BcmItem = class {
|
|
847
|
+
constructor(hostRef) {
|
|
848
|
+
registerInstance(this, hostRef);
|
|
849
|
+
this._id = Generate.UID();
|
|
850
|
+
this.size = Bcm$1.Size.medium;
|
|
851
|
+
this.color = undefined;
|
|
852
|
+
this.static = false;
|
|
853
|
+
}
|
|
854
|
+
setColor(color = this.color) {
|
|
855
|
+
if (!color)
|
|
856
|
+
return;
|
|
857
|
+
const prefix = `--bcm-item`;
|
|
858
|
+
if (color == "white") {
|
|
859
|
+
return {
|
|
860
|
+
[`${prefix}-color-default`]: ColorHelper.dsColor('slate-600'),
|
|
861
|
+
[`${prefix}-color-hover`]: ColorHelper.dsColor('slate-600'),
|
|
862
|
+
[`${prefix}-color-focus-visible`]: ColorHelper.dsColor('slate-600'),
|
|
863
|
+
[`${prefix}-color-active`]: ColorHelper.dsColor('slate-600'),
|
|
864
|
+
[`${prefix}-color-disabled`]: ColorHelper.dsColor('white'),
|
|
865
|
+
[`${prefix}-background-color-default`]: ColorHelper.dsColor(this.static ? 'white' : 'white'),
|
|
866
|
+
[`${prefix}-background-color-hover`]: ColorHelper.dsColor(this.static ? 'white' : 'slate-100'),
|
|
867
|
+
[`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(this.static ? 'white' : 'slate-200'),
|
|
868
|
+
[`${prefix}-background-color-active`]: ColorHelper.dsColor(this.static ? 'white' : 'slate-300'),
|
|
869
|
+
[`${prefix}-background-color-disabled`]: ColorHelper.dsColor('slate-400'),
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
return {
|
|
873
|
+
[`${prefix}-color-default`]: ColorHelper.dsColor('white'),
|
|
874
|
+
[`${prefix}-color-hover`]: ColorHelper.dsColor('white'),
|
|
875
|
+
[`${prefix}-color-focus-visible`]: ColorHelper.dsColor('white'),
|
|
876
|
+
[`${prefix}-color-active`]: ColorHelper.dsColor('white'),
|
|
877
|
+
[`${prefix}-color-disabled`]: ColorHelper.dsColor('white'),
|
|
878
|
+
[`${prefix}-background-color-default`]: ColorHelper.dsColor(color + '-500'),
|
|
879
|
+
[`${prefix}-background-color-hover`]: ColorHelper.dsColor(color + '-600'),
|
|
880
|
+
[`${prefix}-background-color-focus-visible`]: ColorHelper.dsColor(color + '-700'),
|
|
881
|
+
[`${prefix}-background-color-active`]: ColorHelper.dsColor(color + '-800'),
|
|
882
|
+
[`${prefix}-background-color-disabled`]: ColorHelper.dsColor('slate-400'),
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
disconnectedCallback() {
|
|
886
|
+
// this.el.remove()
|
|
887
|
+
}
|
|
888
|
+
render() {
|
|
889
|
+
const hostClasses = classnames('bcm-item', `bcm-item-size-${this.size}`);
|
|
890
|
+
return (h(Host, { class: hostClasses, style: this.setColor() }, h("slot", null)));
|
|
891
|
+
}
|
|
892
|
+
get el() { return getElement(this); }
|
|
893
|
+
};
|
|
894
|
+
BcmItem.style = itemCss;
|
|
895
|
+
|
|
896
|
+
const BcmItems = class {
|
|
897
|
+
constructor(hostRef) {
|
|
898
|
+
registerInstance(this, hostRef);
|
|
899
|
+
this.bcmItems = createEvent(this, "bcm-items", 7);
|
|
900
|
+
this._id = Generate.UID();
|
|
901
|
+
}
|
|
902
|
+
connectedCallback() {
|
|
903
|
+
if (this.el.children && this.el.children.length > 0) {
|
|
904
|
+
let slots = this.nestedItems(this.el);
|
|
905
|
+
this.bcmItems.emit(slots);
|
|
906
|
+
this.el.remove();
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
mapItems(element) {
|
|
910
|
+
var _a;
|
|
911
|
+
const item = element;
|
|
912
|
+
const textContent = (_a = item === null || item === void 0 ? void 0 : item.innerHTML) === null || _a === void 0 ? void 0 : _a.replace(/<bcm-item>.*<\/bcm-item>/g, '').replace(/<bcm-item .*>.*<\/bcm-item>/g, '').replace(/<!--(.|\s)*?-->/g, '').trim();
|
|
913
|
+
const checkAttr = (attr) => StringHelper.elementBooleanCheck(element.getAttribute(attr));
|
|
914
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id: element.getAttribute('id') || Generate.UID(), text: element.getAttribute('text') || textContent }, (element.innerHTML.trim() && { isHtmlContent: element.textContent.length > 0 ? (element.innerHTML.trim()) : null })), (checkAttr('disabled') && { disabled: checkAttr('disabled') })), (checkAttr('selected') && { selected: checkAttr('selected') })), (checkAttr('hidden') && { hidden: checkAttr('hidden') })), (checkAttr('checked') && { checked: checkAttr('checked') })), (checkAttr('readonly') && { readonly: checkAttr('readonly') })), (checkAttr('active') && { active: checkAttr('active') })), (checkAttr('icon') && { icon: element.getAttribute('icon') })), (checkAttr('link') && { link: element.getAttribute('link') }));
|
|
915
|
+
}
|
|
916
|
+
nestedItems(element) {
|
|
917
|
+
return snq(() => Array.from(element === null || element === void 0 ? void 0 : element.children).map((child) => {
|
|
918
|
+
var _a;
|
|
919
|
+
return (Object.assign(Object.assign({}, (((_a = child === null || child === void 0 ? void 0 : child.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'bcm-item' && this.mapItems(child))), { items: this.nestedItems(child) }));
|
|
920
|
+
}), []);
|
|
921
|
+
}
|
|
922
|
+
render() {
|
|
923
|
+
return h("slot", null);
|
|
924
|
+
}
|
|
925
|
+
get el() { return getElement(this); }
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
const BcmLinked = class {
|
|
929
|
+
constructor(hostRef) {
|
|
930
|
+
registerInstance(this, hostRef);
|
|
931
|
+
this.bcmOpen = createEvent(this, "bcm-open", 7);
|
|
932
|
+
this._id = Generate.UID();
|
|
933
|
+
this.placement = Bcm.Placement["bottom-start"];
|
|
934
|
+
this.trigger = Bcm.TriggerType.click;
|
|
935
|
+
this.targetId = "";
|
|
936
|
+
this.height = undefined;
|
|
937
|
+
this.maxHeight = undefined;
|
|
938
|
+
this.minHeight = "50px";
|
|
939
|
+
this.isOpen = false;
|
|
940
|
+
this.hideDelay = 500;
|
|
941
|
+
this.isMouseOverLink = false;
|
|
942
|
+
}
|
|
943
|
+
target() {
|
|
944
|
+
const target = document.querySelectorAll(`[id="${this.targetId}"]`);
|
|
945
|
+
if (target.length > 0) {
|
|
946
|
+
target.length > 1 && console.warn(`[bcm-linked] - Target id "${this.targetId}" is duplicated`);
|
|
947
|
+
return target[0];
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
// console.warn(`[bcm-linked] - id="${this._id}" was removed from the dom because id="${this.targetId}" could not be found.`);
|
|
951
|
+
this.el.remove();
|
|
952
|
+
return null;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
detectClone() {
|
|
956
|
+
const linked = document.querySelectorAll(`[target-id="${this.targetId}"]`);
|
|
957
|
+
if (linked.length > 0) {
|
|
958
|
+
linked.forEach((item) => {
|
|
959
|
+
if (item.id !== this._id) {
|
|
960
|
+
console.warn(`[bcm-linked] - id="${this._id}" was removed from the dom because id="${this.targetId}" is duplicated.`);
|
|
961
|
+
item.remove();
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
dismissEvent() {
|
|
967
|
+
document.dispatchEvent(new CustomEvent("linked-data-dismiss", { detail: { id: this._id } }));
|
|
968
|
+
}
|
|
969
|
+
checkDataDismiss(e) {
|
|
970
|
+
Generate.findEventPathHasAttribute(e, "data-dismiss") && this.dismissEvent();
|
|
971
|
+
}
|
|
972
|
+
hideChildLinked() {
|
|
973
|
+
this.el.querySelectorAll("[is-linked][linked-is-open]").forEach(item => {
|
|
974
|
+
var _a;
|
|
975
|
+
(_a = document.querySelector(`#${item.getAttribute("is-linked")}[is-open]`)) === null || _a === void 0 ? void 0 : _a.hide(false);
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
calculatePosition() {
|
|
979
|
+
const el = this.el;
|
|
980
|
+
if (el && this.target()) {
|
|
981
|
+
if (this.isOpen) {
|
|
982
|
+
FloatingUI({
|
|
983
|
+
ref: this.target(),
|
|
984
|
+
floating: el,
|
|
985
|
+
placement: this.placement,
|
|
986
|
+
offset: 4,
|
|
987
|
+
autoHidden: el.getAttribute("main-linked") === "true" ? false : true,
|
|
988
|
+
autoSize: true,
|
|
989
|
+
style: {
|
|
990
|
+
height: this.height,
|
|
991
|
+
maxHeight: this.maxHeight,
|
|
992
|
+
minHeight: this.minHeight,
|
|
993
|
+
},
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
el.style.visibility = "hidden";
|
|
998
|
+
el.style.opacity = "0";
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
init() {
|
|
1003
|
+
const target = this.target();
|
|
1004
|
+
this.trigger === Bcm.TriggerType.hover && this.listenMouseOver();
|
|
1005
|
+
if (target) {
|
|
1006
|
+
target.setAttribute("is-linked", this.el.id);
|
|
1007
|
+
if (!Generate.getAncestor(target, "bcm-linked")) {
|
|
1008
|
+
this.el.setAttribute("main-linked", "true");
|
|
1009
|
+
}
|
|
1010
|
+
else {
|
|
1011
|
+
this.el.removeAttribute("main-linked");
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
componentDidLoad() {
|
|
1016
|
+
this.init();
|
|
1017
|
+
}
|
|
1018
|
+
triggerWatch(newValue) {
|
|
1019
|
+
if (newValue === Bcm.TriggerType.hover) {
|
|
1020
|
+
this.listenMouseOver();
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
watchIsOpen() {
|
|
1024
|
+
this.bcmOpen.emit(this.isOpen);
|
|
1025
|
+
}
|
|
1026
|
+
onLinkedDataDismis() {
|
|
1027
|
+
this.hide(false);
|
|
1028
|
+
}
|
|
1029
|
+
onBcmFloatingIsHide(e) {
|
|
1030
|
+
if (e.detail.id === this._id) {
|
|
1031
|
+
this.hide(false);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
async show(wait = true) {
|
|
1035
|
+
wait && (await delay(50));
|
|
1036
|
+
this.detectClone();
|
|
1037
|
+
const target = this.target();
|
|
1038
|
+
if (target) {
|
|
1039
|
+
const bcmOverlayContainer = document.querySelector("#bcm-overlay-container");
|
|
1040
|
+
bcmOverlayContainer.appendChild(this.el);
|
|
1041
|
+
target.setAttribute("linked-is-open", "true");
|
|
1042
|
+
this.isOpen = true;
|
|
1043
|
+
this.calculatePosition();
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
this.hide(false);
|
|
1047
|
+
}
|
|
1048
|
+
return this.isOpen;
|
|
1049
|
+
}
|
|
1050
|
+
async hide(wait = true) {
|
|
1051
|
+
wait && (await delay(50));
|
|
1052
|
+
const target = this.target();
|
|
1053
|
+
this.isMouseOverLink = false;
|
|
1054
|
+
if (target) {
|
|
1055
|
+
target.removeAttribute("linked-is-open");
|
|
1056
|
+
this.hideChildLinked();
|
|
1057
|
+
this.isOpen = false;
|
|
1058
|
+
}
|
|
1059
|
+
return this.isOpen;
|
|
1060
|
+
}
|
|
1061
|
+
async toggle(wait = true) {
|
|
1062
|
+
return this.isOpen ? await this.hide(wait) : await this.show(wait);
|
|
1063
|
+
}
|
|
1064
|
+
clickListener(e) {
|
|
1065
|
+
if (!this.target())
|
|
1066
|
+
return;
|
|
1067
|
+
if (this.trigger === Bcm.TriggerType.hover)
|
|
1068
|
+
return;
|
|
1069
|
+
const isTarget = Generate.findEventPath(e, this.target());
|
|
1070
|
+
const isSelf = Generate.findEventPath(e, this.el);
|
|
1071
|
+
const isLinked = Generate.findEventPathWithNodeName(e, "BCM-LINKED");
|
|
1072
|
+
if (!isTarget && !isSelf && !isLinked) {
|
|
1073
|
+
this.hide();
|
|
1074
|
+
this.bcmOpen.emit(this.isOpen);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
if (this.isOpen) {
|
|
1078
|
+
isTarget && this.hide(false);
|
|
1079
|
+
isSelf && this.checkDataDismiss(e);
|
|
1080
|
+
if (this.el.getAttribute("main-linked") === "true" && !isTarget && !isSelf && !isLinked) {
|
|
1081
|
+
this.dismissEvent();
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
else {
|
|
1085
|
+
isTarget && this.show(false);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
resizeListener() {
|
|
1089
|
+
this.calculatePosition();
|
|
1090
|
+
}
|
|
1091
|
+
scrollListener() {
|
|
1092
|
+
this.calculatePosition();
|
|
1093
|
+
}
|
|
1094
|
+
wheelListener() {
|
|
1095
|
+
this.calculatePosition();
|
|
1096
|
+
}
|
|
1097
|
+
listenMouseOver() {
|
|
1098
|
+
var _a, _b;
|
|
1099
|
+
this.el.addEventListener("mouseover", () => (this.isMouseOverLink = true));
|
|
1100
|
+
this.el.addEventListener("mouseleave", () => {
|
|
1101
|
+
this.isMouseOverLink = false;
|
|
1102
|
+
this.handleMouseLeave();
|
|
1103
|
+
});
|
|
1104
|
+
(_a = this.target()) === null || _a === void 0 ? void 0 : _a.addEventListener("mouseenter", this.handleMouseEnter.bind(this));
|
|
1105
|
+
(_b = this.target()) === null || _b === void 0 ? void 0 : _b.addEventListener("mouseleave", this.handleMouseLeave.bind(this));
|
|
1106
|
+
}
|
|
1107
|
+
handleMouseLeave() {
|
|
1108
|
+
setTimeout(() => {
|
|
1109
|
+
!this.isMouseOverLink && this.hide();
|
|
1110
|
+
}, this.hideDelay);
|
|
1111
|
+
}
|
|
1112
|
+
handleMouseEnter() {
|
|
1113
|
+
clearTimeout(this.timeoutId);
|
|
1114
|
+
this.isMouseOverLink = false;
|
|
1115
|
+
this.show();
|
|
1116
|
+
}
|
|
1117
|
+
render() {
|
|
1118
|
+
const openStyle = this.isOpen ? { visibility: "visible", opacity: "1" } : { visibility: "hidden", opacity: "0" };
|
|
1119
|
+
return (h(Host, { class: "tw-invisible tw-absolute tw-left-0 tw-top-0 tw-z-tooltip tw-block tw-overscroll-contain tw-scroll-smooth tw-rounded tw-bg-white tw-opacity-0 tw-shadow tw-transition-opacity tw-duration-100", style: Object.assign(Object.assign({}, openStyle), { overflow: "auto" }) }, h("slot", null)));
|
|
1120
|
+
}
|
|
1121
|
+
get el() { return getElement(this); }
|
|
1122
|
+
static get watchers() { return {
|
|
1123
|
+
"trigger": ["triggerWatch"],
|
|
1124
|
+
"isOpen": ["watchIsOpen"]
|
|
1125
|
+
}; }
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
const menuCss = "@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-menu{--bcm-menu-color-default:var(--bcm-new-ds-color-slate-700);--bcm-menu-background-color-default:var(--bcm-new-ds-color-transparent);--bcm-menu-icon-color-default:var(--bcm-new-ds-color-slate-600);--bcm-menu-color-hover:var(--bcm-new-ds-color-slate-800);--bcm-menu-background-color-hover:var(--bcm-new-ds-color-slate-50);--bcm-menu-icon-color-hover:var(--bcm-new-ds-color-slate-700);--bcm-menu-color-active:var(--bcm-new-ds-color-white);--bcm-menu-background-color-active:var(--bcm-color-primary-500);--bcm-menu-icon-color-active:var(--bcm-new-ds-color-white);--bcm-menu-color-focus-visible:var(--bcm-new-ds-color-white);--bcm-menu-background-color-focus-visible:var(--bcm-color-primary-600);--bcm-menu-icon-color-focus-visible:var(--bcm-new-ds-color-white);--bcm-menu-color-disabled:var(--bcm-new-ds-color-slate-50);--bcm-menu-background-color-disabled:var(--bcm-new-ds-color-slate-300);--bcm-menu-icon-color-disabled:var(--bcm-new-ds-color-slate-50);--bcm-menu-color-dropdownDisabled:var(--bcm-new-ds-color-slate-400);--bcm-menu-background-color-dropdownDisabled:var(--bcm-new-ds-color-transparent);--bcm-menu-icon-color-dropdownDisabled:var(--bcm-new-ds-color-slate-400);--bcm-menu-color-active-hover:var(--bcm-new-ds-color-white);--bcm-menu-background-color-active-hover:var(--bcm-color-primary-400);--bcm-menu-icon-color-active-hover:var(--bcm-new-ds-color-white);--bcm-menu-color-active-focus-visible:var(--bcm-new-ds-color-white);--bcm-menu-background-color-active-focus-visible:var(--bcm-color-primary-700);--bcm-menu-icon-color-active-focus-visible:var(--bcm-new-ds-color-white);--bcm-menu-color-active-active:var(--bcm-new-ds-color-white);--bcm-menu-background-color-active-active:var(--bcm-color-primary-800);--bcm-menu-icon-color-active-active:var(--bcm-new-ds-color-white);font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:inline-block;position:relative;width:210px;box-shadow:0 2px 6px 1px rgba(17, 24, 38, 0.1);border-radius:8px;background-color:var(--bcm-new-ds-color-white);transition:background-color 0.1s ease-in-out, width 0.3s ease-in-out}.bcm-menu__container{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;flex-wrap:nowrap}.bcm-menu__item{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;flex-wrap:nowrap;font:inherit;cursor:pointer;color:inherit;background-color:inherit;padding:0;margin:0;border:none;outline:none;text-decoration:none}.bcm-menu__item:hover,.bcm-menu__item:focus,.bcm-menu__item:active{outline:none;text-decoration:none}.bcm-menu__item--is-sub{color:var(--bcm-menu-color-hover);background-color:var(--bcm-menu-background-color-hover);border-radius:4px}.bcm-menu__item--is-sub .bcm-menu__item-link-icon,.bcm-menu__item--is-sub .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-hover)}.bcm-menu__item-link{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;flex-wrap:nowrap;gap:8px;padding:4px 8px;border-radius:4px;transition:background-color 0.1s ease-in-out, padding 0.3s ease-in-out;color:var(--bcm-menu-color-default);background-color:var(--bcm-menu-background-color-default)}.bcm-menu__item-link-icon{display:flex;flex-direction:row;align-items:center;justify-content:center;flex-wrap:nowrap;min-width:24px;max-width:24px}.bcm-menu__item-link-text{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1}.bcm-menu__item-link-text--collapse{opacity:0}.bcm-menu__item-link-toggle{display:flex;flex-direction:row;align-items:center;justify-content:center;flex-wrap:nowrap;font-size:10px;height:100%;order:0;width:24px;transform:rotate(0deg);transition:transform 0.2s ease-in-out;margin-right:-8px}.bcm-menu__item-link-toggle--collapse{transform:rotate(-180deg)}.bcm-menu__item-link .bcm-menu__item-link-icon,.bcm-menu__item-link .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-default)}.bcm-menu__item-link:hover:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active){color:var(--bcm-menu-color-hover);background-color:var(--bcm-menu-background-color-hover)}.bcm-menu__item-link:hover:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-icon,.bcm-menu__item-link:hover:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-hover)}.bcm-menu__item-link:active:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active){color:var(--bcm-menu-color-active);background-color:var(--bcm-menu-background-color-active)}.bcm-menu__item-link:active:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-icon,.bcm-menu__item-link:active:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-active)}.bcm-menu__item-link:focus-visible:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active){color:var(--bcm-menu-color-focus-visible);background-color:var(--bcm-menu-background-color-focus-visible)}.bcm-menu__item-link:focus-visible:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-icon,.bcm-menu__item-link:focus-visible:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-focus-visible)}.bcm-menu__item-link:disabled:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active){color:var(--bcm-menu-color-disabled);background-color:var(--bcm-menu-background-color-disabled)}.bcm-menu__item-link:disabled:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-icon,.bcm-menu__item-link:disabled:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-disabled)}.bcm-menu__item-link:dropdownDisabled:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active){color:var(--bcm-menu-color-dropdownDisabled);background-color:var(--bcm-menu-background-color-dropdownDisabled)}.bcm-menu__item-link:dropdownDisabled:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-icon,.bcm-menu__item-link:dropdownDisabled:not(.bcm-menu__item-link--disabled):not(.bcm-menu__item-link--active) .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-dropdownDisabled)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled){color:var(--bcm-menu-color-active);background-color:var(--bcm-menu-background-color-active)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled) .bcm-menu__item-link-icon,.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled) .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-active)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):hover{color:var(--bcm-menu-color-active-hover);background-color:var(--bcm-menu-background-color-active-hover)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):hover .bcm-menu__item-link-icon,.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):hover .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-active-hover)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):focus-visible{color:var(--bcm-menu-color-active-focus-visible);background-color:var(--bcm-menu-background-color-active-focus-visible)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):focus-visible .bcm-menu__item-link-icon,.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):focus-visible .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-active-focus-visible)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):active{color:var(--bcm-menu-color-active-active);background-color:var(--bcm-menu-background-color-active-active)}.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):active .bcm-menu__item-link-icon,.bcm-menu__item-link--active:not(.bcm-menu__item-link--disabled):active .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-active-active)}.bcm-menu__item-link--disabled{cursor:not-allowed;color:var(--bcm-menu-color-disabled);background-color:var(--bcm-menu-background-color-disabled)}.bcm-menu__item-link--disabled .bcm-menu__item-link-icon,.bcm-menu__item-link--disabled .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-disabled)}.bcm-menu__item-submenu{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;flex-wrap:nowrap;gap:4px;padding:12px;display:none}.bcm-menu__item-submenu .bcm-menu__item-link{--bcm-menu-background-color-default:var(--bcm-new-ds-color-white);--bcm-menu-background-color-hover:var(--bcm-new-ds-color-slate-100)}.bcm-menu__item-submenu--open{display:flex}.bcm-menu__size-small{padding:8px;font-size:12px;line-height:calc(14px + 8px)}.bcm-menu__size-medium{padding:16px;font-size:14px;line-height:calc(16px + 8px)}.bcm-menu__size-large{padding:16px;font-size:16px;line-height:calc(18px + 8px)}.bcm-menu__collapse-button{color:var(--bcm-menu-color-active);background-color:var(--bcm-menu-background-color-active);display:flex;flex-direction:row;align-items:center;justify-content:center;flex-wrap:nowrap;font-size:14px;border-radius:100px;position:absolute;top:23px;right:-8px;width:18px;height:18px;cursor:pointer;transition:background-color 0.1s ease-in-out, transform 0.3s ease}.bcm-menu__collapse-button:hover{color:var(--bcm-menu-color-active-hover);background-color:var(--bcm-menu-background-color-active-hover)}.bcm-menu__collapse-button:focus-visible{color:var(--bcm-menu-color-active-focus-visible);background-color:var(--bcm-menu-background-color-active-focus-visible)}.bcm-menu__collapse-button:active{color:var(--bcm-menu-color-active-active);background-color:var(--bcm-menu-background-color-active-active)}.bcm-menu__collapse-button--collapsed{transform:rotate(-180deg)}.bcm-menu__collapse{width:64px}.bcm-menu__collapse .bcm-menu__item-link{padding:4px}.bcm-menu--linked{position:absolute;z-index:10800;top:0;left:0;opacity:0;visibility:hidden;width:fit-content;min-height:50px;max-height:500px;height:auto;overflow-y:auto;padding:12px}.bcm-menu--linked.bcm-menu__open{opacity:1;visibility:visible}.bcm-menu--linked .bcm-menu__container{gap:4px}.bcm-menu--linked .bcm-menu__item-link{--bcm-menu-background-color-default:var(--bcm-new-ds-color-slate-50);--bcm-menu-background-color-hover:var(--bcm-new-ds-color-slate-100)}.bcm-menu--linked .bcm-menu__item .bcm-menu__item-submenu .bcm-menu__item-link{--bcm-menu-background-color-default:var(--bcm-new-ds-color-white);--bcm-menu-background-color-hover:var(--bcm-new-ds-color-slate-100)}.bcm-menu--linked .bcm-menu__item-submenu-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-submenu-link:not(.bcm-menu--linked .bcm-menu__item-submenu-link--active){background-color:var(--bcm-menu-background-color-default)}.bcm-menu--linked .bcm-menu__item-submenu-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-submenu-link:not(.bcm-menu--linked .bcm-menu__item-submenu-link--active):hover{color:var(--bcm-menu-color-hover);background-color:var(--bcm-menu-background-color-hover)}.bcm-menu--linked .bcm-menu__item-submenu-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-submenu-link:not(.bcm-menu--linked .bcm-menu__item-submenu-link--active):focus-visible{color:var(--bcm-menu-color-focus-visible);background-color:var(--bcm-menu-background-color-focus-visible)}.bcm-menu--linked .bcm-menu__item-submenu-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-submenu-link:not(.bcm-menu--linked .bcm-menu__item-submenu-link--active):active{color:var(--bcm-menu-color-active);background-color:var(--bcm-menu-background-color-active)}.bcm-menu--linked .bcm-menu__item-submenu-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-submenu-link:not(.bcm-menu--linked .bcm-menu__item-submenu-link--active) .bcm-menu__item-link--disabled{cursor:not-allowed;color:var(--bcm-menu-color-disabled);background-color:var(--bcm-menu-background-color-disabled)}.bcm-menu--linked .bcm-menu__item-submenu-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-submenu-link:not(.bcm-menu--linked .bcm-menu__item-submenu-link--active) .bcm-menu__item-link--disabled .bcm-menu__item-link-icon,.bcm-menu--linked .bcm-menu__item-submenu-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-submenu-link:not(.bcm-menu--linked .bcm-menu__item-submenu-link--active) .bcm-menu__item-link--disabled .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-disabled)}.bcm-menu--linked .bcm-menu__item-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-link:not(.bcm-menu--linked .bcm-menu__item-link--active){background-color:var(--bcm-menu-background-color-default)}.bcm-menu--linked .bcm-menu__item-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-link:not(.bcm-menu--linked .bcm-menu__item-link--active):hover{color:var(--bcm-menu-color-hover);background-color:var(--bcm-menu-background-color-hover)}.bcm-menu--linked .bcm-menu__item-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-link:not(.bcm-menu--linked .bcm-menu__item-link--active):focus-visible{color:var(--bcm-menu-color-focus-visible);background-color:var(--bcm-menu-background-color-focus-visible)}.bcm-menu--linked .bcm-menu__item-link:not(:disabled) .bcm-menu--linked .bcm-menu__item-link:not(.bcm-menu--linked .bcm-menu__item-link--active):active{color:var(--bcm-menu-color-active);background-color:var(--bcm-menu-background-color-active)}.bcm-menu__dropdown{width:auto;max-width:210px}.bcm-menu__dropdown .bcm-menu__item-link--disabled{color:var(--bcm-menu-color-dropdownDisabled);background-color:var(--bcm-menu-background-color-dropdownDisabled)}.bcm-menu__dropdown .bcm-menu__item-link--disabled .bcm-menu__item-link-icon,.bcm-menu__dropdown .bcm-menu__item-link--disabled .bcm-menu__item-link-toggle{color:var(--bcm-menu-icon-color-dropdownDisabled)}";
|
|
1129
|
+
|
|
1130
|
+
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1131
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1132
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1133
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1134
|
+
else
|
|
1135
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1136
|
+
if (d = decorators[i])
|
|
1137
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1138
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1139
|
+
};
|
|
1140
|
+
const BcmMenu = class {
|
|
1141
|
+
constructor(hostRef) {
|
|
1142
|
+
registerInstance(this, hostRef);
|
|
1143
|
+
this.bcmClick = createEvent(this, "bcm-click", 7);
|
|
1144
|
+
this.bcmExpanded = createEvent(this, "bcm-expanded", 7);
|
|
1145
|
+
this.bcmMenuChange = createEvent(this, "bcm-menu-change", 7);
|
|
1146
|
+
this._id = Generate.UID();
|
|
1147
|
+
this.size = 'medium';
|
|
1148
|
+
this.collapsible = false;
|
|
1149
|
+
this.collapse = false;
|
|
1150
|
+
this.mode = 'inline';
|
|
1151
|
+
this.disabled = false;
|
|
1152
|
+
this.hidden = false;
|
|
1153
|
+
this.linkedComponent = undefined;
|
|
1154
|
+
this.height = 'auto';
|
|
1155
|
+
this.maxHeight = '500px';
|
|
1156
|
+
this.minHeight = '150px';
|
|
1157
|
+
this.selectable = true;
|
|
1158
|
+
this.gap = "16px";
|
|
1159
|
+
this.dropdown = false;
|
|
1160
|
+
this.placement = 'bottom-start';
|
|
1161
|
+
this.activeItemId = undefined;
|
|
1162
|
+
this.data = [];
|
|
1163
|
+
}
|
|
1164
|
+
async setActive(param) {
|
|
1165
|
+
this.activeItemId = null;
|
|
1166
|
+
const recursive = (data) => {
|
|
1167
|
+
data.forEach(item => {
|
|
1168
|
+
if (item.id == param) {
|
|
1169
|
+
item.active = true;
|
|
1170
|
+
this.activeItemId = item.id;
|
|
1171
|
+
this.bcmClick.emit(item);
|
|
1172
|
+
}
|
|
1173
|
+
else {
|
|
1174
|
+
item.active = false;
|
|
1175
|
+
if (item.items) {
|
|
1176
|
+
recursive(item.items);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
};
|
|
1181
|
+
recursive(this.data);
|
|
1182
|
+
}
|
|
1183
|
+
async getActive() {
|
|
1184
|
+
return this.activeItem;
|
|
1185
|
+
}
|
|
1186
|
+
handleSlotItems({ detail }) {
|
|
1187
|
+
this.data = detail;
|
|
1188
|
+
}
|
|
1189
|
+
handleClickItem(item) {
|
|
1190
|
+
if (item.items && item.items.length > 0) {
|
|
1191
|
+
item.isOpen = !item.isOpen;
|
|
1192
|
+
forceUpdate(this);
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
this.activeItemId = item.id;
|
|
1196
|
+
document.dispatchEvent(new CustomEvent('linked-data-dismiss', { detail: { id: this._id } }));
|
|
1197
|
+
}
|
|
1198
|
+
// this.data = this.data.map(menuItem => ({ ...menuItem, active: menuItem.id === item.id }));
|
|
1199
|
+
this.bcmClick.emit(item);
|
|
1200
|
+
}
|
|
1201
|
+
getTooltip(id, text) {
|
|
1202
|
+
return new Tooltip({ message: text, targetId: 'bcm-menu__item-' + this._id + '-' + id, placement: 'right' });
|
|
1203
|
+
}
|
|
1204
|
+
render() {
|
|
1205
|
+
const { data, collapsible, collapse } = this;
|
|
1206
|
+
const hostClasses = classnames('bcm-menu', `bcm-menu__size-${this.size}`, {
|
|
1207
|
+
'bcm-menu__collapse': collapse,
|
|
1208
|
+
'bcm-menu__dropdown': this.dropdown,
|
|
1209
|
+
});
|
|
1210
|
+
const MenuLinkTemplate = (item, index) => {
|
|
1211
|
+
if (!item.text)
|
|
1212
|
+
return;
|
|
1213
|
+
if (!item.id)
|
|
1214
|
+
item.id = Generate.UID();
|
|
1215
|
+
const subItems = !!(item.items && item.items.length);
|
|
1216
|
+
if (this.selectable && (this.activeItemId ? this.activeItemId === item.id : item.active)) {
|
|
1217
|
+
this.bcmMenuChange.emit(item);
|
|
1218
|
+
this.activeItem = item;
|
|
1219
|
+
}
|
|
1220
|
+
return (h("a", { id: 'bcm-menu__item-' + this._id + '-' + item.id, onMouseEnter: () => this.collapse && this.getTooltip(item.id, item.text).show(), onMouseLeave: () => this.collapse && this.getTooltip(item.id, item.text).hide(), key: index, href: !item.disabled ? item.link || 'javascript:void(0)' : 'javascript:void(0)', tabindex: item.disabled ? '-1' : '0', class: classnames('bcm-menu__item', {
|
|
1221
|
+
'bcm-menu__item--is-sub': subItems && item.isOpen,
|
|
1222
|
+
'hidden tw-hidden': item.hidden,
|
|
1223
|
+
}) }, h("span", { class: classnames('bcm-menu__item-link', `bcm-menu__item-link--${this.mode}`, {
|
|
1224
|
+
'bcm-menu__item-link--active': this.selectable && (this.activeItemId ? this.activeItemId === item.id : item.active),
|
|
1225
|
+
'bcm-menu__item-link--disabled': item.disabled,
|
|
1226
|
+
}), onClick: () => {
|
|
1227
|
+
!this.disabled && !item.disabled && this.handleClickItem(item);
|
|
1228
|
+
} }, item.icon && (h("span", { class: "bcm-menu__item-link-icon" }, h("i", { class: item.icon || 'far fa-angle-left' }))), h("span", { class: classnames('bcm-menu__item-link-text', {
|
|
1229
|
+
'bcm-menu__item-link-text--collapse': collapse,
|
|
1230
|
+
}), innerHTML: item.text }), subItems && (h("div", { class: classnames('bcm-menu__item-link-toggle', {
|
|
1231
|
+
'bcm-menu__item-link-toggle--collapse': item.isOpen,
|
|
1232
|
+
}) }, h("i", { class: "fas fa-chevron-down" })))), subItems && (h("div", { class: classnames('bcm-menu__item-submenu', {
|
|
1233
|
+
'bcm-menu__item-submenu--collapse': collapse,
|
|
1234
|
+
'bcm-menu__item-submenu--open': item.isOpen,
|
|
1235
|
+
}) }, item.items.map((subItem, subIndex) => MenuLinkTemplate(subItem, subIndex))))));
|
|
1236
|
+
};
|
|
1237
|
+
return (h(Host, { class: hostClasses, disabled: this.disabled }, h("div", { class: "bcm-menu__container", style: { gap: this.gap } }, h("slot", null), (data === null || data === void 0 ? void 0 : data.length) > 0 && data.map((item, index) => MenuLinkTemplate(item, index)), collapsible && (h("div", { class: classnames('bcm-menu__collapse-button', {
|
|
1238
|
+
'bcm-menu__collapse-button--collapsed': collapse,
|
|
1239
|
+
}), onClick: () => {
|
|
1240
|
+
this.collapse = !collapse;
|
|
1241
|
+
collapsible && this.bcmExpanded.emit(collapse);
|
|
1242
|
+
} }, h("i", { class: "far fa-angle-left" }))))));
|
|
1243
|
+
}
|
|
1244
|
+
get el() { return getElement(this); }
|
|
1245
|
+
};
|
|
1246
|
+
__decorate([
|
|
1247
|
+
IsLoad()
|
|
1248
|
+
], BcmMenu.prototype, "el", void 0);
|
|
1249
|
+
BcmMenu.style = menuCss;
|
|
1250
|
+
|
|
1251
|
+
const BcmPopover = class {
|
|
1252
|
+
constructor(hostRef) {
|
|
1253
|
+
registerInstance(this, hostRef);
|
|
1254
|
+
this.bcmPopoverShow = createEvent(this, "bcmPopoverShow", 7);
|
|
1255
|
+
this.bcmPopoverHide = createEvent(this, "bcmPopoverHide", 7);
|
|
1256
|
+
this._id = Generate.UID();
|
|
1257
|
+
this.message = "";
|
|
1258
|
+
this.content = "";
|
|
1259
|
+
this.placement = Bcm.Placement.top;
|
|
1260
|
+
this.trigger = Bcm.TriggerType.click;
|
|
1261
|
+
this.open = false;
|
|
1262
|
+
this.color = "white";
|
|
1263
|
+
this.openDelay = 0;
|
|
1264
|
+
this.closeDelay = 0;
|
|
1265
|
+
this.autoHide = false;
|
|
1266
|
+
this.targetId = undefined;
|
|
1267
|
+
this.popover = undefined;
|
|
1268
|
+
}
|
|
1269
|
+
emitShow() {
|
|
1270
|
+
this.bcmPopoverShow.emit();
|
|
1271
|
+
}
|
|
1272
|
+
emitHide() {
|
|
1273
|
+
this.bcmPopoverHide.emit();
|
|
1274
|
+
}
|
|
1275
|
+
connectedCallback() {
|
|
1276
|
+
this.popover = new Popover({
|
|
1277
|
+
targetId: this.targetId || this._id,
|
|
1278
|
+
content: this.content,
|
|
1279
|
+
message: this.message,
|
|
1280
|
+
placement: this.placement,
|
|
1281
|
+
color: this.color,
|
|
1282
|
+
trigger: this.trigger,
|
|
1283
|
+
openDelay: this.openDelay,
|
|
1284
|
+
closeDelay: this.closeDelay,
|
|
1285
|
+
autoHide: this.autoHide,
|
|
1286
|
+
emitShow: () => this.emitShow(),
|
|
1287
|
+
emitHide: () => this.emitHide(),
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
componentDidLoad() {
|
|
1291
|
+
this.popover.listener();
|
|
1292
|
+
}
|
|
1293
|
+
componentDidRender() {
|
|
1294
|
+
const { content, message, placement, color, trigger } = this;
|
|
1295
|
+
this.popover.content = content;
|
|
1296
|
+
this.popover.message = message;
|
|
1297
|
+
this.popover.placement = placement;
|
|
1298
|
+
this.popover.color = color;
|
|
1299
|
+
this.popover.trigger = trigger;
|
|
1300
|
+
this.popover.openDelay = this.openDelay;
|
|
1301
|
+
this.popover.closeDelay = this.closeDelay;
|
|
1302
|
+
this.popover.autoHide = this.autoHide;
|
|
1303
|
+
this.popover.update();
|
|
1304
|
+
}
|
|
1305
|
+
disconnectedCallback() {
|
|
1306
|
+
this.popover.destroy();
|
|
1307
|
+
}
|
|
1308
|
+
async show() {
|
|
1309
|
+
this.popover.show();
|
|
1310
|
+
}
|
|
1311
|
+
async hide() {
|
|
1312
|
+
this.popover.hide();
|
|
1313
|
+
}
|
|
1314
|
+
async toggle() {
|
|
1315
|
+
this.popover.toggle();
|
|
1316
|
+
}
|
|
1317
|
+
render() {
|
|
1318
|
+
return (h(Host, { class: "tw-inline-flex tw-h-fit tw-w-fit", role: "tooltip", "aria-hidden": "true" }, h("slot", null)));
|
|
1319
|
+
}
|
|
1320
|
+
get el() { return getElement(this); }
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
const BcmTabGroup = class {
|
|
1324
|
+
constructor(hostRef) {
|
|
1325
|
+
registerInstance(this, hostRef);
|
|
1326
|
+
this.tabChange = createEvent(this, "bcm-tab-change", 7);
|
|
1327
|
+
this._id = Generate.UID();
|
|
1328
|
+
this.active = "1";
|
|
1329
|
+
this.color = "blue";
|
|
1330
|
+
this.size = Bcm.Size.medium;
|
|
1331
|
+
}
|
|
1332
|
+
get tabItems() {
|
|
1333
|
+
return this.el.querySelectorAll("bcm-tab-item");
|
|
1334
|
+
}
|
|
1335
|
+
get tabItemHeaders() {
|
|
1336
|
+
return this.el.querySelectorAll("bcm-tab-item-header");
|
|
1337
|
+
}
|
|
1338
|
+
setTabAttributes() {
|
|
1339
|
+
this.tabItems.forEach((tab, index) => {
|
|
1340
|
+
const itemActive = tab.hasAttribute("active") ? true : false;
|
|
1341
|
+
const itemDisabled = tab.hasAttribute("disabled") ? true : false;
|
|
1342
|
+
const itemIndex = index + 1;
|
|
1343
|
+
tab.setAttribute("index", `${itemIndex}`);
|
|
1344
|
+
tab.setAttribute("size", this.size);
|
|
1345
|
+
tab.setAttribute("color", this.color);
|
|
1346
|
+
tab.removeAttribute("active");
|
|
1347
|
+
tab.removeAttribute("disabled");
|
|
1348
|
+
if (itemActive) {
|
|
1349
|
+
tab.setAttribute("active", "");
|
|
1350
|
+
this.active = itemIndex.toString();
|
|
1351
|
+
}
|
|
1352
|
+
if (itemDisabled) {
|
|
1353
|
+
tab.setAttribute("disabled", "");
|
|
1354
|
+
}
|
|
1355
|
+
// const headerElement = tab.querySelector("bcm-tab-item-header");
|
|
1356
|
+
// if (headerElement) {
|
|
1357
|
+
// this.setHeaderTabAttributes(headerElement, tab);
|
|
1358
|
+
// }
|
|
1359
|
+
});
|
|
1360
|
+
const isHasActiveTab = Array.from(this.tabItems).some((tab) => tab.hasAttribute("active"));
|
|
1361
|
+
if (!isHasActiveTab) {
|
|
1362
|
+
this.tabItems[0].setAttribute("active", "");
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
componentWillLoad() {
|
|
1366
|
+
this.setTabAttributes();
|
|
1367
|
+
}
|
|
1368
|
+
handleTabClick(index) {
|
|
1369
|
+
var _a, _b;
|
|
1370
|
+
if (index) {
|
|
1371
|
+
this.active = index.toString();
|
|
1372
|
+
}
|
|
1373
|
+
if ((_a = this.tabItems) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1374
|
+
this.tabItems.forEach(tab => {
|
|
1375
|
+
tab.removeAttribute("active");
|
|
1376
|
+
tab.setAttribute("size", this.size);
|
|
1377
|
+
tab.setAttribute("color", this.color);
|
|
1378
|
+
if (tab.getAttribute("index") == this.active) {
|
|
1379
|
+
tab.setAttribute("active", "");
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
if ((_b = this.tabItemHeaders) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1384
|
+
this.tabItemHeaders.forEach(tabHeader => {
|
|
1385
|
+
tabHeader.removeAttribute("active");
|
|
1386
|
+
tabHeader.setAttribute("size", this.size);
|
|
1387
|
+
tabHeader.setAttribute("color", this.color);
|
|
1388
|
+
if (tabHeader.getAttribute("index") == this.active) {
|
|
1389
|
+
tabHeader.setAttribute("active", "");
|
|
1390
|
+
// tabHeader.scrollIntoView({
|
|
1391
|
+
// behavior: "smooth",
|
|
1392
|
+
// block: "start",
|
|
1393
|
+
// inline: "center",
|
|
1394
|
+
// });
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
this.tabChange.emit(this.active);
|
|
1399
|
+
}
|
|
1400
|
+
componentDidRender() {
|
|
1401
|
+
this.inkBarControl();
|
|
1402
|
+
this.handleTabClick();
|
|
1403
|
+
}
|
|
1404
|
+
componentDidLoad() {
|
|
1405
|
+
this.inkBarControl();
|
|
1406
|
+
this.observeTabItem();
|
|
1407
|
+
}
|
|
1408
|
+
async setActive(index) {
|
|
1409
|
+
if (index > 0 && index <= this.tabItems.length && index != +this.active) {
|
|
1410
|
+
this.handleTabClick(index);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
async refresh() {
|
|
1414
|
+
await delay(100);
|
|
1415
|
+
forceUpdate(this);
|
|
1416
|
+
}
|
|
1417
|
+
inkBarControl() {
|
|
1418
|
+
var _a;
|
|
1419
|
+
const inkBar = this.el.querySelector("#ink-bar");
|
|
1420
|
+
if (!inkBar || !((_a = this.tabItemHeaders) === null || _a === void 0 ? void 0 : _a.length))
|
|
1421
|
+
return;
|
|
1422
|
+
for (let i = 0; i < this.tabItemHeaders.length; i++) {
|
|
1423
|
+
const tab = this.tabItemHeaders[i];
|
|
1424
|
+
const tabIndex = tab.getAttribute("index");
|
|
1425
|
+
if (tabIndex === this.active) {
|
|
1426
|
+
inkBar.style.width = `${tab.offsetWidth}px`;
|
|
1427
|
+
// inkBar.style.top = `${tab.offsetHeight}px`;
|
|
1428
|
+
inkBar.style.transform = `translateX(${tab.offsetLeft}px)`;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
activeChanged(newVal, _oldVal) {
|
|
1433
|
+
var _a;
|
|
1434
|
+
if (!((_a = this.tabItems) === null || _a === void 0 ? void 0 : _a.length))
|
|
1435
|
+
return;
|
|
1436
|
+
const isHasActiveTab = Array.from(this.tabItems).some(tab => tab.getAttribute("index") == newVal);
|
|
1437
|
+
if (!isHasActiveTab) {
|
|
1438
|
+
this.active = "1";
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
observeTabItem() {
|
|
1442
|
+
const callback = (mutationsList, _observer) => {
|
|
1443
|
+
for (const mutation of mutationsList) {
|
|
1444
|
+
if (mutation.type === "childList") {
|
|
1445
|
+
// for (const node of mutation.addedNodes) {
|
|
1446
|
+
// if (node.nodeName === "BCM-TAB-ITEM") {
|
|
1447
|
+
// // Do something when a bcm-tab-item is added
|
|
1448
|
+
// }
|
|
1449
|
+
// }
|
|
1450
|
+
for (const node of mutation.removedNodes) {
|
|
1451
|
+
if (node.nodeName === "BCM-TAB-ITEM") {
|
|
1452
|
+
// Do something when a bcm-tab-item is removed
|
|
1453
|
+
// console.log("A bcm-tab-item was removed.", node);
|
|
1454
|
+
if (node === null || node === void 0 ? void 0 : node.active) {
|
|
1455
|
+
this.active = "1";
|
|
1456
|
+
}
|
|
1457
|
+
this.tabProcess();
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
this.observer = new MutationObserver(callback);
|
|
1464
|
+
this.observer.observe(this.el, { childList: true });
|
|
1465
|
+
}
|
|
1466
|
+
tabProcess() {
|
|
1467
|
+
this.updateTabHeaders();
|
|
1468
|
+
this.regenerateIndex();
|
|
1469
|
+
this.refresh();
|
|
1470
|
+
this.inkBarControl();
|
|
1471
|
+
}
|
|
1472
|
+
updateTabHeaders() {
|
|
1473
|
+
const tabIds = Array.from(this.tabItems).map(tab => tab.getAttribute("id"));
|
|
1474
|
+
const tabHeaderElements = Array.from(this.el.querySelector("#tab-header").querySelectorAll("bcm-tab-item-header"));
|
|
1475
|
+
if (tabIds.length !== tabHeaderElements.length) {
|
|
1476
|
+
tabHeaderElements.forEach(tabHeader => {
|
|
1477
|
+
const tabId = tabHeader.getAttribute("tab-id");
|
|
1478
|
+
if (!tabIds.includes(tabId)) {
|
|
1479
|
+
tabHeader.remove();
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
regenerateIndex() {
|
|
1485
|
+
this.tabItems.forEach((tab, index) => {
|
|
1486
|
+
const itemIndex = index + 1;
|
|
1487
|
+
tab.setAttribute("index", `${itemIndex}`);
|
|
1488
|
+
const headerElement = this.el.querySelector(`bcm-tab-item-header[tab-id="${tab.getAttribute("id")}"]`);
|
|
1489
|
+
if (headerElement) {
|
|
1490
|
+
headerElement.setAttribute("index", `${itemIndex}`);
|
|
1491
|
+
headerElement.style.order = `${itemIndex}`;
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
render() {
|
|
1496
|
+
const { color } = this;
|
|
1497
|
+
const dc = Generate.getTwColor({
|
|
1498
|
+
color: color,
|
|
1499
|
+
tones: [500]
|
|
1500
|
+
});
|
|
1501
|
+
return (h(Host, { role: "tablist", "aria-label": "Tab Group", class: "tw-flex tw-w-full tw-flex-col tw-items-center tw-font-sans" }, h("div", { class: `tw-relative tw-flex tw-w-full tw-flex-row tw-items-end tw-justify-between`, id: "tab-header", style: dc }, h("div", { id: "ink-bar", class: `tw-bg-default-500 tw-absolute tw-bottom-0 tw-left-0 tw-mt-[-2px] tw-h-[2px] tw-rounded-sm tw-transition-transform` })), h("slot", null)));
|
|
1502
|
+
}
|
|
1503
|
+
get el() { return getElement(this); }
|
|
1504
|
+
static get watchers() { return {
|
|
1505
|
+
"active": ["activeChanged"]
|
|
1506
|
+
}; }
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
const BcmTabItem = class {
|
|
1510
|
+
constructor(hostRef) {
|
|
1511
|
+
registerInstance(this, hostRef);
|
|
1512
|
+
this._id = Generate.UID();
|
|
1513
|
+
this.active = false;
|
|
1514
|
+
this.disabled = false;
|
|
1515
|
+
this.index = undefined;
|
|
1516
|
+
}
|
|
1517
|
+
componentWillLoad() {
|
|
1518
|
+
this.indexControl();
|
|
1519
|
+
}
|
|
1520
|
+
componentDidRender() {
|
|
1521
|
+
this.headerMove();
|
|
1522
|
+
}
|
|
1523
|
+
getHeaderItem() {
|
|
1524
|
+
const headerItem = this.el.querySelector("bcm-tab-item-header");
|
|
1525
|
+
if (headerItem) {
|
|
1526
|
+
headerItem.setAttribute("index", `${this.index}`);
|
|
1527
|
+
headerItem.setAttribute("active", `${this.active}`);
|
|
1528
|
+
headerItem.setAttribute("disabled", `${this.disabled}`);
|
|
1529
|
+
headerItem.setAttribute("tab-id", `${this._id}`);
|
|
1530
|
+
headerItem.style.order = `${this.index}`;
|
|
1531
|
+
}
|
|
1532
|
+
return headerItem;
|
|
1533
|
+
}
|
|
1534
|
+
getParentTabGroup() {
|
|
1535
|
+
return Generate.findParentElement(this.el, "bcm-tab-group");
|
|
1536
|
+
}
|
|
1537
|
+
getFindHeaderItem() {
|
|
1538
|
+
var _a, _b;
|
|
1539
|
+
return (_b = (_a = this.getParentTabGroup()) === null || _a === void 0 ? void 0 : _a.querySelector("#tab-header")) === null || _b === void 0 ? void 0 : _b.querySelector(`bcm-tab-item-header[tab-id="${this._id}"]`);
|
|
1540
|
+
}
|
|
1541
|
+
headerMove() {
|
|
1542
|
+
var _a, _b, _c, _d;
|
|
1543
|
+
if (this.getHeaderItem()) {
|
|
1544
|
+
(_a = this.getFindHeaderItem()) === null || _a === void 0 ? void 0 : _a.remove();
|
|
1545
|
+
(_c = (_b = this.getParentTabGroup()) === null || _b === void 0 ? void 0 : _b.querySelector("#tab-header")) === null || _c === void 0 ? void 0 : _c.appendChild(this.getHeaderItem());
|
|
1546
|
+
(_d = this.el.parentElement) === null || _d === void 0 ? void 0 : _d.refresh();
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
indexControl() {
|
|
1550
|
+
var _a;
|
|
1551
|
+
if (!this.index) {
|
|
1552
|
+
(_a = Generate.findParentElement(this.el, "bcm-tab-group")) === null || _a === void 0 ? void 0 : _a.querySelectorAll("bcm-tab-item").forEach((item, index) => {
|
|
1553
|
+
if (item === this.el) {
|
|
1554
|
+
item.setAttribute("index", `${index + 1}`);
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
componentDidLoad() {
|
|
1560
|
+
const observer = new MutationObserver(() => {
|
|
1561
|
+
this.headerMove();
|
|
1562
|
+
});
|
|
1563
|
+
observer.observe(this.el, { childList: true, subtree: true });
|
|
1564
|
+
}
|
|
1565
|
+
render() {
|
|
1566
|
+
return (h(Host, { id: this._id, role: "tabpanel", "aria-labelledby": `tab-${this._id}`, "aria-hidden": `${!this.active}`, class: {
|
|
1567
|
+
"tw-block": this.active,
|
|
1568
|
+
"tw-hidden": !this.active,
|
|
1569
|
+
"tw-opacity-50": this.disabled,
|
|
1570
|
+
"tw-w-full": true,
|
|
1571
|
+
} }, h("slot", null)));
|
|
1572
|
+
}
|
|
1573
|
+
get el() { return getElement(this); }
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
const BcmTabItemHeader = class {
|
|
1577
|
+
constructor(hostRef) {
|
|
1578
|
+
registerInstance(this, hostRef);
|
|
1579
|
+
this._id = Generate.UID();
|
|
1580
|
+
this.active = false;
|
|
1581
|
+
this.disabled = false;
|
|
1582
|
+
this.index = undefined;
|
|
1583
|
+
this.color = "blue";
|
|
1584
|
+
this.size = Bcm.Size.medium;
|
|
1585
|
+
}
|
|
1586
|
+
handleClick() {
|
|
1587
|
+
var _a;
|
|
1588
|
+
if (!this.disabled) {
|
|
1589
|
+
(_a = Generate.findParentElement(this.el, "bcm-tab-group")) === null || _a === void 0 ? void 0 : _a.setActive(this.index);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
render() {
|
|
1593
|
+
const { color, size, active, disabled } = this;
|
|
1594
|
+
const disabledClass = "tw-cursor-not-allowed tw-text-gray-400 tw-opacity-50";
|
|
1595
|
+
const dc = Generate.getTwColor({
|
|
1596
|
+
color: color,
|
|
1597
|
+
tones: [500, 600, 700, 800]
|
|
1598
|
+
});
|
|
1599
|
+
return (h(Host, { onClick: () => this.handleClick(), class: classnames(`tw-flex tw-flex-1 tw-items-center tw-justify-center tw-border-b-[2px] tw-border-b-slate-300 tw-transition-font tw-focus:outline-none`, {
|
|
1600
|
+
"tw-text-2 tw-py-1 tw-gap-2": size === Bcm.Size.small,
|
|
1601
|
+
"tw-text-3 tw-py-2 tw-gap-3": size === Bcm.Size.medium,
|
|
1602
|
+
"tw-text-4 tw-py-3 tw-gap-4": size === Bcm.Size.large,
|
|
1603
|
+
}, disabled ? disabledClass : "tw-cursor-pointer", active
|
|
1604
|
+
? `tw-text-default-500 enabled:hover:tw-text-default-600 enabled:active:tw-text-default-700 enabled:focus-visible:tw-text-default-800`
|
|
1605
|
+
: "tw-text-slate-400 enabled:hover:tw-text-slate-500 enabled:focus-visible:tw-text-slate-700 enabled:active:tw-text-slate-600"), style: dc }));
|
|
1606
|
+
}
|
|
1607
|
+
get el() { return getElement(this); }
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
const textCss = "@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-text{display:inline;font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400}.bcm-text.hidden{display:none}.bcm-text__paragraph{margin:0;padding:0}.bcm-text__font-size-1{font-size:10px;line-height:calc(10px + 8px)}.bcm-text__font-size-2{font-size:12px;line-height:calc(12px + 8px)}.bcm-text__font-size-3{font-size:14px;line-height:calc(14px + 8px)}.bcm-text__font-size-4{font-size:16px;line-height:calc(16px + 8px)}.bcm-text__font-size-5{font-size:18px;line-height:calc(18px + 8px)}.bcm-text__font-size-6{font-size:20px;line-height:calc(20px + 8px)}.bcm-text__font-size-7{font-size:24px;line-height:calc(24px + 8px)}.bcm-text__font-size-8{font-size:32px;line-height:calc(32px + 8px)}.bcm-text__font-size-9{font-size:40px;line-height:calc(40px + 8px)}";
|
|
1611
|
+
|
|
1612
|
+
const BcmText = class {
|
|
1613
|
+
constructor(hostRef) {
|
|
1614
|
+
registerInstance(this, hostRef);
|
|
1615
|
+
this.hidden = false;
|
|
1616
|
+
this.scale = undefined;
|
|
1617
|
+
this.weight = "400";
|
|
1618
|
+
this.color = "slate";
|
|
1619
|
+
this.text = undefined;
|
|
1620
|
+
this.fontSize = 4;
|
|
1621
|
+
}
|
|
1622
|
+
render() {
|
|
1623
|
+
const { hidden, scale, weight, color, fontSize } = this;
|
|
1624
|
+
const hostClasses = classnames('bcm-text', {
|
|
1625
|
+
hidden
|
|
1626
|
+
});
|
|
1627
|
+
const classes = classnames('bcm-text__paragraph', `bcm-text__font-size-${fontSize}`, scale);
|
|
1628
|
+
const fontWeight = +weight || 400;
|
|
1629
|
+
const style = {
|
|
1630
|
+
color: ColorHelper.dsColor(color),
|
|
1631
|
+
fontWeight
|
|
1632
|
+
};
|
|
1633
|
+
return (h(Host, { class: hostClasses }, h("span", { hidden: true }, h("slot", null)), h("p", { class: classes, style: Object.assign({}, style) }, h(SlotTemplate, { value: this.text }))));
|
|
1634
|
+
}
|
|
1635
|
+
get el() { return getElement(this); }
|
|
1636
|
+
};
|
|
1637
|
+
BcmText.style = textCss;
|
|
1638
|
+
|
|
1639
|
+
const BcmTooltip = class {
|
|
1640
|
+
constructor(hostRef) {
|
|
1641
|
+
registerInstance(this, hostRef);
|
|
1642
|
+
this.bcmTooltipShow = createEvent(this, "bcmTooltipShow", 7);
|
|
1643
|
+
this.bcmTooltipHide = createEvent(this, "bcmTooltipHide", 7);
|
|
1644
|
+
this._id = Generate.UID();
|
|
1645
|
+
this.message = "";
|
|
1646
|
+
this.placement = Bcm.Placement.top;
|
|
1647
|
+
this.trigger = Bcm.TriggerType.click;
|
|
1648
|
+
this.open = false;
|
|
1649
|
+
this.color = "slate";
|
|
1650
|
+
this.size = Bcm.Size.medium;
|
|
1651
|
+
this.openDelay = 0;
|
|
1652
|
+
this.closeDelay = 0;
|
|
1653
|
+
this.autoHide = false;
|
|
1654
|
+
this.targetId = undefined;
|
|
1655
|
+
this.tooltip = undefined;
|
|
1656
|
+
}
|
|
1657
|
+
emitShow() {
|
|
1658
|
+
this.bcmTooltipShow.emit();
|
|
1659
|
+
}
|
|
1660
|
+
emitHide() {
|
|
1661
|
+
this.bcmTooltipHide.emit();
|
|
1662
|
+
}
|
|
1663
|
+
connectedCallback() {
|
|
1664
|
+
this.tooltip = new Tooltip({
|
|
1665
|
+
targetId: this.targetId || this._id,
|
|
1666
|
+
message: this.message,
|
|
1667
|
+
placement: this.placement,
|
|
1668
|
+
color: this.color,
|
|
1669
|
+
trigger: this.trigger,
|
|
1670
|
+
size: this.size,
|
|
1671
|
+
openDelay: this.openDelay,
|
|
1672
|
+
closeDelay: this.closeDelay,
|
|
1673
|
+
autoHide: this.autoHide,
|
|
1674
|
+
emitShow: () => this.emitShow(),
|
|
1675
|
+
emitHide: () => this.emitHide(),
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
componentDidLoad() {
|
|
1679
|
+
this.tooltip.listener();
|
|
1680
|
+
}
|
|
1681
|
+
componentDidRender() {
|
|
1682
|
+
this.tooltip.message = this.message;
|
|
1683
|
+
this.tooltip.placement = this.placement;
|
|
1684
|
+
this.tooltip.color = this.color;
|
|
1685
|
+
this.tooltip.trigger = this.trigger;
|
|
1686
|
+
this.tooltip.size = this.size;
|
|
1687
|
+
this.tooltip.openDelay = this.openDelay;
|
|
1688
|
+
this.tooltip.closeDelay = this.closeDelay;
|
|
1689
|
+
this.tooltip.autoHide = this.autoHide;
|
|
1690
|
+
this.tooltip.update();
|
|
1691
|
+
}
|
|
1692
|
+
disconnectedCallback() {
|
|
1693
|
+
this.tooltip.destroy();
|
|
1694
|
+
}
|
|
1695
|
+
async show() {
|
|
1696
|
+
this.tooltip.show();
|
|
1697
|
+
}
|
|
1698
|
+
async hide() {
|
|
1699
|
+
this.tooltip.hide();
|
|
1700
|
+
}
|
|
1701
|
+
async toggle() {
|
|
1702
|
+
this.tooltip.toggle();
|
|
1703
|
+
}
|
|
1704
|
+
render() {
|
|
1705
|
+
return (h(Host, { class: "tw-inline-flex tw-h-fit tw-w-fit", role: "tooltip", "aria-hidden": "true" }, h("slot", null)));
|
|
1706
|
+
}
|
|
1707
|
+
get el() { return getElement(this); }
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
const BcmTypography = class {
|
|
1711
|
+
constructor(hostRef) {
|
|
1712
|
+
registerInstance(this, hostRef);
|
|
1713
|
+
}
|
|
1714
|
+
render() {
|
|
1715
|
+
return (h(Host, { class: "bcm-ui-element bcm-ui-content-display" }, h("slot", null)));
|
|
1716
|
+
}
|
|
1717
|
+
get el() { return getElement(this); }
|
|
1718
|
+
};
|
|
1719
|
+
|
|
1720
|
+
export { BcmBadge as bcm_badge, BcmButton as bcm_button, BcmDropdown as bcm_dropdown, BcmIcon as bcm_icon, BcmItem as bcm_item, BcmItems as bcm_items, BcmLinked as bcm_linked, BcmMenu as bcm_menu, BcmPopover as bcm_popover, BcmTabGroup as bcm_tab_group, BcmTabItem as bcm_tab_item, BcmTabItemHeader as bcm_tab_item_header, BcmText as bcm_text, BcmTooltip as bcm_tooltip, BcmTypography as bcm_typography };
|