bromcom-ui 2.9.0-rc.4 → 2.9.0-rc.5
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-0543a86f.js +5 -0
- package/dist/bromcom-ui/{p-d888c814.entry.js → p-0a528362.entry.js} +1 -1
- package/dist/bromcom-ui/{p-3992dd70.entry.js → p-0c549bd0.entry.js} +1 -1
- package/dist/bromcom-ui/{p-08d4cd65.entry.js → p-0d4372c9.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8c9d109c.entry.js → p-15758356.entry.js} +1 -1
- package/dist/bromcom-ui/{p-2df6dc86.entry.js → p-179af180.entry.js} +1 -1
- package/dist/bromcom-ui/p-1a04159f.entry.js +5 -0
- package/dist/bromcom-ui/{p-6478455c.entry.js → p-1a405289.entry.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-24cffc16.entry.js +13 -0
- package/dist/bromcom-ui/{p-20aa2ba8.entry.js → p-25f9928a.entry.js} +1 -1
- package/dist/bromcom-ui/p-285722ad.entry.js +5 -0
- package/dist/bromcom-ui/{p-3adc157d.entry.js → p-29a12785.entry.js} +1 -1
- package/dist/bromcom-ui/{p-f48e5337.entry.js → p-2a02b473.entry.js} +1 -1
- package/dist/bromcom-ui/p-2fc584c4.js +5 -0
- package/dist/bromcom-ui/{p-fd7243a7.entry.js → p-365eec45.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6a087ad5.js → p-38972c46.js} +1 -1
- package/dist/bromcom-ui/{p-8c018ae0.js → p-3c7a0345.js} +1 -1
- package/dist/bromcom-ui/p-53448351.js +5 -0
- package/dist/bromcom-ui/{p-09c4a42a.entry.js → p-546f5f82.entry.js} +1 -1
- package/dist/bromcom-ui/{p-70aa6e00.entry.js → p-5855b125.entry.js} +1 -1
- 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-4e6292fd.entry.js → p-61172e12.entry.js} +1 -1
- package/dist/bromcom-ui/{p-224d392c.entry.js → p-65318f25.entry.js} +1 -1
- package/dist/bromcom-ui/p-663766cf.entry.js +5 -0
- package/dist/bromcom-ui/{p-30788121.entry.js → p-6c3e9e10.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6e9b23ed.entry.js → p-721e0cb5.entry.js} +1 -1
- package/dist/bromcom-ui/{p-fc07ca8a.entry.js → p-7bff7371.entry.js} +1 -1
- package/dist/bromcom-ui/{p-50066349.entry.js → p-8260eda6.entry.js} +1 -1
- package/dist/bromcom-ui/{p-1647559e.entry.js → p-8bcfe3b3.entry.js} +1 -1
- package/dist/bromcom-ui/{p-21783e29.entry.js → p-8e2e77ca.entry.js} +1 -1
- package/dist/bromcom-ui/p-90e5c655.js +5 -0
- package/dist/bromcom-ui/p-947c78e3.js +5 -0
- package/dist/bromcom-ui/{p-0d6623c0.entry.js → p-96614f57.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6cb648f0.entry.js → p-9d98d32d.entry.js} +1 -1
- package/dist/bromcom-ui/{p-ea23f0aa.entry.js → p-9e05f845.entry.js} +1 -1
- package/dist/bromcom-ui/{p-c8695c8b.entry.js → p-a02c333f.entry.js} +1 -1
- package/dist/bromcom-ui/{p-4ea7331b.entry.js → p-a1335bd5.entry.js} +1 -1
- package/dist/bromcom-ui/{p-b321e86d.entry.js → p-a3b54a22.entry.js} +1 -1
- package/dist/bromcom-ui/{p-18696519.entry.js → p-a4731c71.entry.js} +1 -1
- package/dist/bromcom-ui/p-a5953ecd.entry.js +5 -0
- package/dist/bromcom-ui/{p-50c3df61.js → p-a8aaa382.js} +1 -1
- package/dist/bromcom-ui/{p-30a3320f.entry.js → p-b1c83bb8.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8d14232d.entry.js → p-ba89e3c7.entry.js} +1 -1
- package/dist/bromcom-ui/{p-119fc842.entry.js → p-c1de1367.entry.js} +1 -1
- package/dist/bromcom-ui/{p-15347028.entry.js → p-ca32c1b9.entry.js} +1 -1
- package/dist/bromcom-ui/p-cf0ab7f0.entry.js +5 -0
- package/dist/bromcom-ui/p-d37379d4.entry.js +5 -0
- package/dist/bromcom-ui/{p-afb4a0e7.entry.js → p-d58107e2.entry.js} +1 -1
- package/dist/bromcom-ui/p-dd422dd1.js +5 -0
- package/dist/bromcom-ui/{p-cf307549.entry.js → p-e92d9879.entry.js} +1 -1
- package/dist/bromcom-ui/{p-159b67a7.entry.js → p-e9c963b3.entry.js} +1 -1
- package/dist/bromcom-ui/{p-dc9466d6.entry.js → p-ebee9f45.entry.js} +1 -1
- package/dist/bromcom-ui/{p-ba47106f.entry.js → p-ef8bbaf3.entry.js} +1 -1
- package/dist/bromcom-ui/p-f0350c0c.entry.js +5 -0
- package/dist/bromcom-ui/p-f302cbdf.entry.js +5 -0
- package/dist/bromcom-ui/{p-68abefd2.entry.js → p-f331e009.entry.js} +1 -1
- package/dist/bromcom-ui/{p-28649759.entry.js → p-f3b546c6.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8ae4bdb2.entry.js → p-f532862e.entry.js} +1 -1
- package/dist/bromcom-ui/{p-e12e563a.entry.js → p-f889d1b6.entry.js} +1 -1
- package/dist/bromcom-ui/p-f8bf531f.entry.js +5 -0
- package/dist/bromcom-ui/{p-9fff4f7d.entry.js → p-f8cbdade.entry.js} +1 -1
- package/dist/bromcom-ui/{p-cb344455.entry.js → p-fb22bc06.entry.js} +1 -1
- package/dist/bromcom-ui/p-fceaf172.entry.js +5 -0
- 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-d0470117.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-e1d297ed.js} +1 -1
- package/dist/cjs/{json-parse-decarator-bf157b28.js → json-parse-decarator-026354f1.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{number-helper-26df0c91.js → number-helper-b3d57233.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-09cd4bed.js} +1 -1
- package/dist/cjs/{validators-095e7611.js → validators-39ca1c93.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/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/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-abec36e5.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-a02d00ff.js} +1 -1
- package/dist/esm/{json-parse-decarator-2bcd4584.js → json-parse-decarator-268fe3de.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{number-helper-cb2563aa.js → number-helper-cf26accd.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-cf443480.js} +1 -1
- package/dist/esm/{utils-57652744.js → utils-b3338faf.js} +1 -1
- package/dist/esm/{validators-0a4134a4.js → validators-63753298.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-00d7bbed.js +0 -5
- 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-8ce0f5f8.entry.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-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
|
@@ -6,6 +6,26 @@ import { ColorPalette } from '../global/variables/colors';
|
|
|
6
6
|
import { extractColor } from '../utils/utils';
|
|
7
7
|
import tailwindColor from 'tailwindcss/colors';
|
|
8
8
|
export class ColorHelper {
|
|
9
|
+
/**
|
|
10
|
+
* @param color - color string in format of `colorName-tone` or `colorName` (default tone is 600)
|
|
11
|
+
* @return `{ tone: number, colorName: string }`
|
|
12
|
+
* @description
|
|
13
|
+
* Parse color string to get color name and tone
|
|
14
|
+
* @example
|
|
15
|
+
* parseColor("red-500") // { tone: 500, colorName: "red" }
|
|
16
|
+
* parseColor("red") // { tone: 600, colorName: "red" }
|
|
17
|
+
* parseColor(null) // { tone: null, colorName: null }
|
|
18
|
+
*/
|
|
19
|
+
static parseColor(color, defaultTone = 600) {
|
|
20
|
+
if (!color)
|
|
21
|
+
return { tone: null, colorName: null };
|
|
22
|
+
const [colorName, tone] = color.split("-");
|
|
23
|
+
const parsedTone = tone ? parseInt(tone) : defaultTone;
|
|
24
|
+
return {
|
|
25
|
+
tone: parsedTone,
|
|
26
|
+
colorName,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
9
29
|
}
|
|
10
30
|
ColorHelper.isHex = (str) => /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(str);
|
|
11
31
|
ColorHelper.isRgb = (str) => /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.test(str);
|
|
@@ -42,7 +62,7 @@ ColorHelper.reverseColor = (color) => {
|
|
|
42
62
|
const g = parseInt(hexColor.substring(3, 5), 16);
|
|
43
63
|
const b = parseInt(hexColor.substring(5, 7), 16);
|
|
44
64
|
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
|
45
|
-
return yiq >= 200 ? '#
|
|
65
|
+
return yiq >= 200 ? '#334155' : '#fff';
|
|
46
66
|
}
|
|
47
67
|
};
|
|
48
68
|
ColorHelper.dsColor = (color) => 'var(--bcm-new-ds-color-' + color + ')';
|
|
@@ -79,3 +99,9 @@ ColorHelper.twColor = (colorName, tone = '500') => {
|
|
|
79
99
|
return 'blue-500';
|
|
80
100
|
};
|
|
81
101
|
ColorHelper.twColorReverse = (color) => ColorHelper.reverseColor(ColorHelper.getTwColorToHex(color));
|
|
102
|
+
/**
|
|
103
|
+
* @param object
|
|
104
|
+
* @return string
|
|
105
|
+
* @description Convert style object to string
|
|
106
|
+
*/
|
|
107
|
+
ColorHelper.generateStyleString = (obj) => Object.keys(obj).reduce((acc, key) => { return `${acc}${key}:${obj[key]};`; }, "");
|
|
@@ -33,15 +33,65 @@ if (isAllowedDomain()) {
|
|
|
33
33
|
}
|
|
34
34
|
})();
|
|
35
35
|
export class Generate {
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
const dc = Generate.getTwColor({
|
|
38
|
+
color: "blue",
|
|
39
|
+
tones: {
|
|
40
|
+
200: ["text"],
|
|
41
|
+
700: ["bg", "border"],
|
|
42
|
+
800: ["bg-hover", "border-hover"],
|
|
43
|
+
},
|
|
44
|
+
variable: "--bcm-avatar",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
--bcm-avatar-text: --tw-blue-200;
|
|
49
|
+
--bcm-avatar-bg: --tw-blue-700;
|
|
50
|
+
--bcm-avatar-bg-hover: --tw-blue-800;
|
|
51
|
+
--bcm-avatar-border: --tw-blue-700;
|
|
52
|
+
--bcm-avatar-border-hover: --tw-blue-800;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
*/
|
|
56
|
+
static getTwColor(args) {
|
|
57
|
+
const { color, variable, tones } = (args = Object.assign({
|
|
58
|
+
variable: "--bcm-color-default",
|
|
59
|
+
defaultTone: "600",
|
|
60
|
+
tones: {
|
|
61
|
+
50: {},
|
|
62
|
+
100: {},
|
|
63
|
+
200: {},
|
|
64
|
+
300: {},
|
|
65
|
+
400: {},
|
|
66
|
+
500: {},
|
|
67
|
+
600: {},
|
|
68
|
+
700: {},
|
|
69
|
+
800: {},
|
|
70
|
+
900: {},
|
|
71
|
+
950: {},
|
|
72
|
+
},
|
|
73
|
+
}, args));
|
|
37
74
|
if (!color || !colors[color]) {
|
|
38
75
|
return false;
|
|
39
76
|
}
|
|
40
|
-
const colorObj = colors[color];
|
|
41
77
|
const result = {};
|
|
42
|
-
|
|
43
|
-
result[
|
|
78
|
+
if (typeof colors[color] === "string") {
|
|
79
|
+
result[variable] = colors[color];
|
|
80
|
+
return result;
|
|
44
81
|
}
|
|
82
|
+
const toneList = Array.isArray(tones) ? tones : Object.keys(tones);
|
|
83
|
+
toneList.forEach(tone => {
|
|
84
|
+
if (colors[color][tone]) {
|
|
85
|
+
if (Array.isArray(tones[tone])) {
|
|
86
|
+
tones[tone].forEach(item => {
|
|
87
|
+
result[`${variable}-${item}`] = colors[color][tone];
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
result[`${variable}-${tone}`] = colors[color][tone];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
45
95
|
return result;
|
|
46
96
|
}
|
|
47
97
|
}
|
|
@@ -14,25 +14,29 @@ export class Popover {
|
|
|
14
14
|
}
|
|
15
15
|
this.removeListener();
|
|
16
16
|
};
|
|
17
|
-
this.bgColor = () => ColorHelper.twColor(this.color, 700);
|
|
18
|
-
this.exepcitonColors = {
|
|
19
|
-
white: "slate-300",
|
|
20
|
-
black: "slate-700",
|
|
21
|
-
};
|
|
22
17
|
this.target = () => document.getElementById(this.targetId);
|
|
23
18
|
this.init = () => {
|
|
24
|
-
const
|
|
19
|
+
const { tone, colorName } = ColorHelper.parseColor(this.color, 700);
|
|
20
|
+
const dc = Generate.getTwColor({
|
|
21
|
+
color: colorName,
|
|
22
|
+
tones: {
|
|
23
|
+
[tone]: ["bg"],
|
|
24
|
+
},
|
|
25
|
+
variable: "--bcm-popover",
|
|
26
|
+
});
|
|
27
|
+
const style = Object.assign(Object.assign({}, dc), (dc["--bcm-popover-bg"] && { "--bcm-popover-text": ColorHelper.reverseColor(dc["--bcm-popover-bg"]) }));
|
|
28
|
+
const inner = `<div class="tw-z-[1] tw-rounded tw-py-2">
|
|
25
29
|
${this.message ? `<div class="tw-font-medium tw-w-full tw-pb-1 tw-px-4">${StringHelper.trim(this.message)}</div>` : ""}
|
|
26
30
|
${this.content ? `<div class="tw-font-normal tw-px-4">${StringHelper.trim(this.content)}</div>` : ""}
|
|
27
31
|
</div>`;
|
|
28
32
|
this.el = Generate.createElement("div", {
|
|
29
33
|
"id": `${this.targetId}-popover-box`,
|
|
30
34
|
"class": `
|
|
31
|
-
tw-whitespace-normal tw-break-words tw-block tw-font-sans tw-pointer-events-none tw-max-w-[256px] tw-rounded tw-bg
|
|
35
|
+
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
|
|
32
36
|
tw-shadow`,
|
|
33
37
|
"role": "popover",
|
|
34
38
|
"aria-hidden": "true",
|
|
35
|
-
"style":
|
|
39
|
+
"style": ColorHelper.generateStyleString(style),
|
|
36
40
|
"innerHTML": inner,
|
|
37
41
|
});
|
|
38
42
|
};
|
|
@@ -88,7 +92,7 @@ export class Popover {
|
|
|
88
92
|
placement: this.placement,
|
|
89
93
|
offset: 8,
|
|
90
94
|
arrow: true,
|
|
91
|
-
arrowColor: `tw-bg
|
|
95
|
+
arrowColor: `tw-bg-[--bcm-popover-bg]`,
|
|
92
96
|
});
|
|
93
97
|
}
|
|
94
98
|
};
|
|
@@ -15,7 +15,6 @@ export class Tooltip {
|
|
|
15
15
|
}
|
|
16
16
|
this.removeListener();
|
|
17
17
|
};
|
|
18
|
-
this.bgColor = () => ColorHelper.twColor(this.color, 700);
|
|
19
18
|
this.target = () => document.getElementById(this.targetId);
|
|
20
19
|
this.sizeClass = () => {
|
|
21
20
|
switch (this.size) {
|
|
@@ -30,13 +29,22 @@ export class Tooltip {
|
|
|
30
29
|
}
|
|
31
30
|
};
|
|
32
31
|
this.init = () => {
|
|
32
|
+
const { tone, colorName } = ColorHelper.parseColor(this.color, 700);
|
|
33
|
+
const dc = Generate.getTwColor({
|
|
34
|
+
color: colorName,
|
|
35
|
+
tones: {
|
|
36
|
+
[tone]: ["bg"],
|
|
37
|
+
},
|
|
38
|
+
variable: "--bcm-tooltip",
|
|
39
|
+
});
|
|
40
|
+
const style = Object.assign(Object.assign({}, dc), (dc["--bcm-tooltip-bg"] && { "--bcm-tooltip-text": ColorHelper.reverseColor(dc["--bcm-tooltip-bg"]) }));
|
|
33
41
|
this.el = Generate.createElement("div", {
|
|
34
42
|
"id": `${this.targetId}-tooltip-box`,
|
|
35
43
|
"class": `
|
|
36
|
-
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
|
|
44
|
+
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`,
|
|
37
45
|
"role": "tooltip",
|
|
38
46
|
"aria-hidden": "true",
|
|
39
|
-
"style":
|
|
47
|
+
"style": ColorHelper.generateStyleString(style),
|
|
40
48
|
"innerHTML": StringHelper.trim(this.message),
|
|
41
49
|
});
|
|
42
50
|
};
|
|
@@ -92,7 +100,7 @@ export class Tooltip {
|
|
|
92
100
|
placement: this.placement,
|
|
93
101
|
offset: 8,
|
|
94
102
|
arrow: true,
|
|
95
|
-
arrowColor: `tw-bg
|
|
103
|
+
arrowColor: `tw-bg-[--bcm-tooltip-bg]`,
|
|
96
104
|
});
|
|
97
105
|
}
|
|
98
106
|
};
|
|
@@ -3,89 +3,128 @@
|
|
|
3
3
|
* Copyright (c) Bromcom.
|
|
4
4
|
*/
|
|
5
5
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
6
|
-
import
|
|
6
|
+
import './color-helper.js';
|
|
7
7
|
import './validators.js';
|
|
8
8
|
import { G as Generate } from './generate.js';
|
|
9
|
-
import
|
|
9
|
+
import './number-helper.js';
|
|
10
10
|
import './string-helper.js';
|
|
11
11
|
import './element-dragger.js';
|
|
12
12
|
import { a as Bcm } from './bcm.js';
|
|
13
|
-
import { c as
|
|
14
|
-
import { d as defineCustomElement$2 } from './badge.js';
|
|
13
|
+
import { c as cva, d as defineCustomElement$2 } from './badge.js';
|
|
15
14
|
import { d as defineCustomElement$1 } from './icon.js';
|
|
16
15
|
|
|
17
|
-
const
|
|
16
|
+
const avatarStyle = cva([
|
|
17
|
+
"bcm-avatar bcm-ui-element bcm-ui-content-display",
|
|
18
|
+
"tw-uppercase tw-inline-flex tw-items-center tw-justify-center",
|
|
19
|
+
"tw-bg-[--bcm-avatar-bg] tw-text-[--bcm-avatar-text]",
|
|
20
|
+
"[&>img]:tw-w-full [&>img]:tw-h-full",
|
|
21
|
+
], {
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
small: ["bcm-avatar__size-small tw-text-1 tw-w-6 tw-h-6"],
|
|
25
|
+
medium: ["bcm-avatar__size-medium tw-text-2 tw-w-8 tw-h-8"],
|
|
26
|
+
large: ["bcm-avatar__size-large tw-text-3 tw-w-10 tw-h-10"],
|
|
27
|
+
},
|
|
28
|
+
shape: {
|
|
29
|
+
ellipse: ["bcm-avatar__shape-ellipse tw-rounded-full", "[&>.bcm-badge]:tw-top-0 [&>.bcm-badge]:tw-right-0", "[&>img]:tw-rounded-full"],
|
|
30
|
+
square: ["bcm-avatar__shape-square tw-rounded", "[&>.bcm-badge]:tw--top-0.5 [&>.bcm-badge]:tw--right-0.5", "[&>img]:tw-rounded"],
|
|
31
|
+
},
|
|
32
|
+
status: {
|
|
33
|
+
true: ["bcm-avatar__status tw-relative [&>.bcm-badge]:tw-absolute"],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
compoundVariants: [
|
|
37
|
+
{
|
|
38
|
+
size: "medium",
|
|
39
|
+
shape: "ellipse",
|
|
40
|
+
status: false,
|
|
41
|
+
class: "",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
size: "medium",
|
|
46
|
+
shape: "ellipse",
|
|
47
|
+
status: false,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
18
50
|
|
|
19
51
|
const BcmAvatar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
20
52
|
constructor() {
|
|
21
53
|
super();
|
|
22
54
|
this.__registerHost();
|
|
23
55
|
this._id = Generate.UID();
|
|
24
|
-
this.hidden = false;
|
|
25
56
|
this.image = undefined;
|
|
26
57
|
this.name = undefined;
|
|
27
58
|
this.alt = undefined;
|
|
28
59
|
this.shape = Bcm.Shape.ellipse;
|
|
29
60
|
this.size = Bcm.Size.medium;
|
|
30
61
|
this.color = undefined;
|
|
62
|
+
this.icon = "fas fa-user";
|
|
31
63
|
this.status = undefined;
|
|
64
|
+
this.blink = false;
|
|
32
65
|
this.isFallback = false;
|
|
33
66
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.isFallback = true;
|
|
67
|
+
getFirstLetters(name) {
|
|
68
|
+
const words = name.split(" ");
|
|
69
|
+
const initials = words.map(word => word.charAt(0).toUpperCase()).join("");
|
|
70
|
+
return initials.substring(0, 2);
|
|
39
71
|
}
|
|
40
|
-
|
|
41
|
-
|
|
72
|
+
renderContent() {
|
|
73
|
+
if (this.isFallback) {
|
|
74
|
+
if (this.name) {
|
|
75
|
+
return this.getFirstLetters(this.name);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return this.renderDefaultIcon();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (this.image) {
|
|
82
|
+
return this.renderImage();
|
|
83
|
+
}
|
|
84
|
+
else if (this.name) {
|
|
85
|
+
return this.getFirstLetters(this.name);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return this.renderDefaultIcon();
|
|
89
|
+
}
|
|
42
90
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (splitted.length === 1)
|
|
46
|
-
return splitted[0].substring(0, 2);
|
|
47
|
-
return splitted[0].charAt(0) + splitted[splitted.length - 1].charAt(0);
|
|
91
|
+
renderDefaultIcon() {
|
|
92
|
+
return h("bcm-icon", { icon: this.icon });
|
|
48
93
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let { color } = this;
|
|
52
|
-
!color && (color = 'slate');
|
|
53
|
-
let height = NumberHelper.toNumber(size);
|
|
54
|
-
let fontSize = Math.round(parseInt(height) / 3);
|
|
55
|
-
const prefix = `--bcm-avatar`;
|
|
56
|
-
return {
|
|
57
|
-
[`${prefix}-color`]: ColorHelper.dsColor(`${color}-600`),
|
|
58
|
-
[`${prefix}-background-color`]: ColorHelper.dsColor(`${color}-100`),
|
|
59
|
-
[`${prefix}-height`]: `${height}px`,
|
|
60
|
-
[`${prefix}-font-size`]: `${fontSize}px`
|
|
61
|
-
};
|
|
94
|
+
renderImage() {
|
|
95
|
+
return h("img", { onError: () => (this.isFallback = true), src: this.image, alt: this.alt });
|
|
62
96
|
}
|
|
63
97
|
render() {
|
|
64
|
-
const {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
98
|
+
const { shape, size, status, color, blink } = this;
|
|
99
|
+
const dc = Generate.getTwColor({
|
|
100
|
+
color: color,
|
|
101
|
+
tones: {
|
|
102
|
+
200: ["bg"],
|
|
103
|
+
700: ["text"],
|
|
104
|
+
},
|
|
105
|
+
variable: "--bcm-avatar",
|
|
69
106
|
});
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
:
|
|
75
|
-
|
|
107
|
+
const customSize = !Object.keys(Bcm.BaseSize).includes(size)
|
|
108
|
+
? {
|
|
109
|
+
width: `${size}px`,
|
|
110
|
+
height: `${size}px`,
|
|
111
|
+
fontSize: `${+size / 3}px`,
|
|
112
|
+
}
|
|
113
|
+
: {};
|
|
114
|
+
return (h(Host, { role: "img", "aria-label": this.alt || this.name || "Avatar", class: avatarStyle({ size, shape, status: !!status }), style: Object.assign(Object.assign({}, dc), customSize) }, this.renderContent(), status && h("bcm-badge", { status: status, blink: blink, "aria-hidden": "true" }), h("slot", null)));
|
|
76
115
|
}
|
|
77
116
|
get el() { return this; }
|
|
78
|
-
static get style() { return avatarCss; }
|
|
79
117
|
}, [4, "bcm-avatar", {
|
|
80
|
-
"_id": [
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"status": [
|
|
118
|
+
"_id": [513, "id"],
|
|
119
|
+
"image": [1],
|
|
120
|
+
"name": [1],
|
|
121
|
+
"alt": [1],
|
|
122
|
+
"shape": [1],
|
|
123
|
+
"size": [1],
|
|
124
|
+
"color": [1],
|
|
125
|
+
"icon": [1],
|
|
126
|
+
"status": [1],
|
|
127
|
+
"blink": [4],
|
|
89
128
|
"isFallback": [32]
|
|
90
129
|
}]);
|
|
91
130
|
function defineCustomElement() {
|
package/dist/components/badge.js
CHANGED
|
@@ -3,70 +3,133 @@
|
|
|
3
3
|
* Copyright (c) Bromcom.
|
|
4
4
|
*/
|
|
5
5
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
6
|
-
import { c as classnames } from './index2.js';
|
|
7
|
-
import { a as Bcm } from './bcm.js';
|
|
8
|
-
import { G as Generate } from './generate.js';
|
|
9
|
-
import { S as SlotTemplate } from './slot-template.js';
|
|
10
6
|
import { C as ColorHelper } from './color-helper.js';
|
|
7
|
+
import './validators.js';
|
|
8
|
+
import { G as Generate } from './generate.js';
|
|
9
|
+
import './number-helper.js';
|
|
10
|
+
import './string-helper.js';
|
|
11
|
+
import './element-dragger.js';
|
|
12
|
+
import { a as Bcm } from './bcm.js';
|
|
13
|
+
|
|
14
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
15
|
+
|
|
16
|
+
const falsyToString = (value)=>typeof value === "boolean" ? "".concat(value) : value === 0 ? "0" : value;
|
|
17
|
+
const cx = clsx;
|
|
18
|
+
const cva = (base, config)=>{
|
|
19
|
+
return (props)=>{
|
|
20
|
+
var ref;
|
|
21
|
+
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
22
|
+
const { variants , defaultVariants } = config;
|
|
23
|
+
const getVariantClassNames = Object.keys(variants).map((variant)=>{
|
|
24
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
25
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
26
|
+
if (variantProp === null) return null;
|
|
27
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
28
|
+
return variants[variant][variantKey];
|
|
29
|
+
});
|
|
30
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
|
|
31
|
+
let [key, value] = param;
|
|
32
|
+
if (value === undefined) {
|
|
33
|
+
return acc;
|
|
34
|
+
}
|
|
35
|
+
acc[key] = value;
|
|
36
|
+
return acc;
|
|
37
|
+
}, {});
|
|
38
|
+
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1)=>{
|
|
39
|
+
let { class: cvClass , className: cvClassName , ...compoundVariantOptions } = param1;
|
|
40
|
+
return Object.entries(compoundVariantOptions).every((param)=>{
|
|
41
|
+
let [key, value] = param;
|
|
42
|
+
return Array.isArray(value) ? value.includes({
|
|
43
|
+
...defaultVariants,
|
|
44
|
+
...propsWithoutUndefined
|
|
45
|
+
}[key]) : ({
|
|
46
|
+
...defaultVariants,
|
|
47
|
+
...propsWithoutUndefined
|
|
48
|
+
})[key] === value;
|
|
49
|
+
}) ? [
|
|
50
|
+
...acc,
|
|
51
|
+
cvClass,
|
|
52
|
+
cvClassName
|
|
53
|
+
] : acc;
|
|
54
|
+
}, []);
|
|
55
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
56
|
+
};
|
|
57
|
+
};
|
|
11
58
|
|
|
12
|
-
const
|
|
59
|
+
const badgeStyle = cva([
|
|
60
|
+
"bcm-badge__dot bcm-ui-element bcm-ui-content-display",
|
|
61
|
+
"tw-flex tw-items-center tw-justify-center tw-flex-row",
|
|
62
|
+
"tw-rounded-full tw-text-center",
|
|
63
|
+
"tw-bg-[--bcm-badge-bg] tw-text-[--bcm-badge-text]",
|
|
64
|
+
" tw-whitespace-nowrap [&>*:empty]:tw-hidden",
|
|
65
|
+
], {
|
|
66
|
+
variants: {
|
|
67
|
+
size: {
|
|
68
|
+
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"],
|
|
69
|
+
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"],
|
|
70
|
+
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
|
|
71
|
+
},
|
|
72
|
+
blink: {
|
|
73
|
+
true: [
|
|
74
|
+
"bcm-badge__dot-blink tw-relative",
|
|
75
|
+
"after:tw-content-[''] after:tw-absolute after:tw-top-0 after:tw-left-0 after:tw-z-[-1]",
|
|
76
|
+
"after:tw-w-full after:tw-h-full after:tw-bg-[--bcm-badge-bg] after:tw-opacity-75 after:tw-rounded-full",
|
|
77
|
+
"after:tw-animate-blink after:tw-pointer-events-none"
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
compoundVariants: [
|
|
82
|
+
{
|
|
83
|
+
size: "medium",
|
|
84
|
+
blink: false,
|
|
85
|
+
class: "",
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
size: "medium",
|
|
90
|
+
blink: false,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
13
93
|
|
|
14
94
|
const BcmBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
15
95
|
constructor() {
|
|
16
96
|
super();
|
|
17
97
|
this.__registerHost();
|
|
98
|
+
this.statusColors = {
|
|
99
|
+
info: "blue",
|
|
100
|
+
error: "red",
|
|
101
|
+
warning: "amber",
|
|
102
|
+
success: "emerald",
|
|
103
|
+
};
|
|
18
104
|
this._id = Generate.UID();
|
|
19
|
-
this.hidden = false;
|
|
20
105
|
this.blink = false;
|
|
21
106
|
this.value = undefined;
|
|
22
107
|
this.color = undefined;
|
|
23
108
|
this.size = Bcm.Size.medium;
|
|
24
109
|
this.status = undefined;
|
|
25
|
-
this._slot = undefined;
|
|
26
|
-
}
|
|
27
|
-
setStyleVariables() {
|
|
28
|
-
const { status, value } = this;
|
|
29
|
-
let { color } = this;
|
|
30
|
-
const statusColors = {
|
|
31
|
-
'info': 'blue',
|
|
32
|
-
'error': 'red',
|
|
33
|
-
'warning': 'amber',
|
|
34
|
-
'success': 'emerald',
|
|
35
|
-
'default': 'slate'
|
|
36
|
-
};
|
|
37
|
-
!!status && (color = statusColors[status]);
|
|
38
|
-
!color && (color = 'slate');
|
|
39
|
-
const prefix = `--bcm-badge`;
|
|
40
|
-
const spacing = !!value && value.length > 1 ? '8' : '4';
|
|
41
|
-
return {
|
|
42
|
-
[`${prefix}-color`]: ColorHelper.reverseColor(ColorHelper.dsColor(`${color}`)),
|
|
43
|
-
[`${prefix}-background-color`]: ColorHelper.dsColor(`${color}`),
|
|
44
|
-
[`${prefix}-spacing`]: `${spacing}px`
|
|
45
|
-
};
|
|
46
110
|
}
|
|
47
111
|
render() {
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
112
|
+
const { blink, value, size, color, status } = this;
|
|
113
|
+
const _color = this.statusColors[status] || color;
|
|
114
|
+
const { tone, colorName } = ColorHelper.parseColor(_color);
|
|
115
|
+
const dc = Generate.getTwColor({
|
|
116
|
+
color: colorName,
|
|
117
|
+
tones: {
|
|
118
|
+
[tone]: ["bg"],
|
|
119
|
+
},
|
|
120
|
+
variable: "--bcm-badge",
|
|
56
121
|
});
|
|
57
|
-
|
|
122
|
+
const style = Object.assign(Object.assign({}, dc), (dc["--bcm-badge-bg"] && { "--bcm-badge-text": ColorHelper.reverseColor(dc["--bcm-badge-bg"]) }));
|
|
123
|
+
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))));
|
|
58
124
|
}
|
|
59
125
|
get el() { return this; }
|
|
60
|
-
static get style() { return badgeCss; }
|
|
61
126
|
}, [4, "bcm-badge", {
|
|
62
|
-
"_id": [
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"status": [1025],
|
|
69
|
-
"_slot": [1032, "slot"]
|
|
127
|
+
"_id": [513, "id"],
|
|
128
|
+
"blink": [4],
|
|
129
|
+
"value": [1],
|
|
130
|
+
"color": [8],
|
|
131
|
+
"size": [1],
|
|
132
|
+
"status": [1]
|
|
70
133
|
}]);
|
|
71
134
|
function defineCustomElement() {
|
|
72
135
|
if (typeof customElements === "undefined") {
|
|
@@ -82,4 +145,4 @@ function defineCustomElement() {
|
|
|
82
145
|
} });
|
|
83
146
|
}
|
|
84
147
|
|
|
85
|
-
export { BcmBadge as B, defineCustomElement as d };
|
|
148
|
+
export { BcmBadge as B, cva as c, defineCustomElement as d };
|
|
@@ -25,7 +25,7 @@ const BcmItems$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
25
25
|
const item = element;
|
|
26
26
|
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();
|
|
27
27
|
const checkAttr = (attr) => StringHelper.elementBooleanCheck(element.getAttribute(attr));
|
|
28
|
-
return 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('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') }));
|
|
28
|
+
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') }));
|
|
29
29
|
}
|
|
30
30
|
nestedItems(element) {
|
|
31
31
|
return snq(() => Array.from(element === null || element === void 0 ? void 0 : element.children).map((child) => {
|
|
@@ -23,25 +23,29 @@ class Popover {
|
|
|
23
23
|
}
|
|
24
24
|
this.removeListener();
|
|
25
25
|
};
|
|
26
|
-
this.bgColor = () => ColorHelper.twColor(this.color, 700);
|
|
27
|
-
this.exepcitonColors = {
|
|
28
|
-
white: "slate-300",
|
|
29
|
-
black: "slate-700",
|
|
30
|
-
};
|
|
31
26
|
this.target = () => document.getElementById(this.targetId);
|
|
32
27
|
this.init = () => {
|
|
33
|
-
const
|
|
28
|
+
const { tone, colorName } = ColorHelper.parseColor(this.color, 700);
|
|
29
|
+
const dc = Generate.getTwColor({
|
|
30
|
+
color: colorName,
|
|
31
|
+
tones: {
|
|
32
|
+
[tone]: ["bg"],
|
|
33
|
+
},
|
|
34
|
+
variable: "--bcm-popover",
|
|
35
|
+
});
|
|
36
|
+
const style = Object.assign(Object.assign({}, dc), (dc["--bcm-popover-bg"] && { "--bcm-popover-text": ColorHelper.reverseColor(dc["--bcm-popover-bg"]) }));
|
|
37
|
+
const inner = `<div class="tw-z-[1] tw-rounded tw-py-2">
|
|
34
38
|
${this.message ? `<div class="tw-font-medium tw-w-full tw-pb-1 tw-px-4">${StringHelper.trim(this.message)}</div>` : ""}
|
|
35
39
|
${this.content ? `<div class="tw-font-normal tw-px-4">${StringHelper.trim(this.content)}</div>` : ""}
|
|
36
40
|
</div>`;
|
|
37
41
|
this.el = Generate.createElement("div", {
|
|
38
42
|
"id": `${this.targetId}-popover-box`,
|
|
39
43
|
"class": `
|
|
40
|
-
tw-whitespace-normal tw-break-words tw-block tw-font-sans tw-pointer-events-none tw-max-w-[256px] tw-rounded tw-bg
|
|
44
|
+
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
|
|
41
45
|
tw-shadow`,
|
|
42
46
|
"role": "popover",
|
|
43
47
|
"aria-hidden": "true",
|
|
44
|
-
"style":
|
|
48
|
+
"style": ColorHelper.generateStyleString(style),
|
|
45
49
|
"innerHTML": inner,
|
|
46
50
|
});
|
|
47
51
|
};
|
|
@@ -95,7 +99,7 @@ class Popover {
|
|
|
95
99
|
placement: this.placement,
|
|
96
100
|
offset: 8,
|
|
97
101
|
arrow: true,
|
|
98
|
-
arrowColor: `tw-bg
|
|
102
|
+
arrowColor: `tw-bg-[--bcm-popover-bg]`,
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
105
|
};
|
|
@@ -210,7 +214,7 @@ const BcmPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
210
214
|
this.popover.toggle();
|
|
211
215
|
}
|
|
212
216
|
render() {
|
|
213
|
-
return (h(Host, {
|
|
217
|
+
return (h(Host, { class: "tw-inline-flex tw-h-fit tw-w-fit", role: "tooltip", "aria-hidden": "true" }, h("slot", null)));
|
|
214
218
|
}
|
|
215
219
|
get el() { return this; }
|
|
216
220
|
}, [4, "bcm-popover", {
|