bromcom-ui 3.0.0-alpha.2 → 3.0.0-alpha.4
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-c47463b1.entry.js → p-0b7de283.entry.js} +1 -1
- package/dist/bromcom-ui/{p-a141b2bc.entry.js → p-0e75f6ba.entry.js} +1 -1
- package/dist/bromcom-ui/{p-9d41ff2a.entry.js → p-112b9a62.entry.js} +1 -1
- package/dist/bromcom-ui/p-1535f9b1.js +5 -0
- package/dist/bromcom-ui/{p-2a0b6273.entry.js → p-32ce6cf6.entry.js} +1 -1
- package/dist/bromcom-ui/{p-46628fcd.entry.js → p-33b2ed75.entry.js} +1 -1
- package/dist/bromcom-ui/{p-7416d1f6.entry.js → p-4545a13d.entry.js} +1 -1
- package/dist/bromcom-ui/p-45b811ef.entry.js +5 -0
- package/dist/bromcom-ui/{p-369948e7.entry.js → p-5532696c.entry.js} +1 -1
- package/dist/bromcom-ui/{p-8363990a.entry.js → p-69adb859.entry.js} +1 -1
- package/dist/bromcom-ui/{p-d4e4aeee.js → p-6ce02d0a.js} +1 -1
- package/dist/bromcom-ui/p-7c08789d.entry.js +5 -0
- package/dist/bromcom-ui/{p-22e3161d.entry.js → p-803739bc.entry.js} +1 -1
- package/dist/bromcom-ui/{p-14b04371.entry.js → p-8390dd02.entry.js} +1 -1
- package/dist/bromcom-ui/{p-217934a4.entry.js → p-8e7274e4.entry.js} +1 -1
- package/dist/bromcom-ui/p-91197b04.js +5 -0
- package/dist/bromcom-ui/{p-cbeaa059.entry.js → p-9e0dd503.entry.js} +3 -3
- package/dist/bromcom-ui/p-a320cde8.entry.js +5 -0
- package/dist/bromcom-ui/p-a80e6310.entry.js +5 -0
- package/dist/bromcom-ui/{p-b85227c8.entry.js → p-acab07ec.entry.js} +1 -1
- package/dist/bromcom-ui/{p-51ba3626.entry.js → p-b333a3d7.entry.js} +1 -1
- package/dist/bromcom-ui/{p-a080c8ea.entry.js → p-b7787c11.entry.js} +1 -1
- package/dist/bromcom-ui/{p-6f224017.entry.js → p-b7c56cbe.entry.js} +1 -1
- package/dist/bromcom-ui/{p-e7c31126.entry.js → p-c36a7889.entry.js} +1 -1
- package/dist/bromcom-ui/p-ce0ab4e3.entry.js +5 -0
- package/dist/bromcom-ui/{p-367bc8e0.js → p-d3cf91a9.js} +1 -1
- package/dist/bromcom-ui/{p-5bf051b9.entry.js → p-d7a619c5.entry.js} +1 -1
- package/dist/bromcom-ui/p-ddd9e192.entry.js +5 -0
- package/dist/bromcom-ui/{p-9015080d.entry.js → p-e36b6b08.entry.js} +1 -1
- package/dist/bromcom-ui/{p-acfceb2b.entry.js → p-f15c1d3d.entry.js} +1 -1
- package/dist/bromcom-ui/{p-858cee66.js → p-fc29c94d.js} +1 -1
- package/dist/cjs/{bcm-accordion_68.cjs.entry.js → bcm-accordion_69.cjs.entry.js} +120 -43
- package/dist/cjs/bcm-attendance-actions-comment.cjs.entry.js +4 -4
- package/dist/cjs/bcm-attendance-actions-dropdown.cjs.entry.js +4 -4
- package/dist/cjs/bcm-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/bcm-caption.cjs.entry.js +4 -4
- package/dist/cjs/bcm-card.cjs.entry.js +2 -2
- package/dist/cjs/bcm-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/bcm-datetime-picker.cjs.entry.js +2 -2
- package/dist/cjs/bcm-default.cjs.entry.js +2 -2
- package/dist/cjs/bcm-form-2.cjs.entry.js +2 -2
- package/dist/cjs/bcm-input-2.cjs.entry.js +2 -2
- package/dist/cjs/bcm-input-custom.cjs.entry.js +2 -2
- package/dist/cjs/bcm-input-dropdown.cjs.entry.js +4 -4
- 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-number-input.cjs.entry.js +4 -4
- package/dist/cjs/bcm-segment.cjs.entry.js +51 -0
- package/dist/cjs/bcm-segmented-picker.cjs.entry.js +158 -0
- package/dist/cjs/bcm-skeleton.cjs.entry.js +4 -4
- package/dist/cjs/bcm-table.cjs.entry.js +4 -4
- package/dist/cjs/bcm-tag.cjs.entry.js +3 -3
- package/dist/cjs/bcm-time-picker.cjs.entry.js +2 -2
- package/dist/cjs/bcm-toast.cjs.entry.js +17 -11
- package/dist/cjs/bromcom-ui.cjs.js +3 -3
- package/dist/cjs/{generate-a25d8fc8.js → generate-9d1bf6b3.js} +1 -1
- package/dist/cjs/{global-08c079a8.js → global-d69a64ec.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{number-helper-3a56812f.js → number-helper-ae28b255.js} +1 -1
- package/dist/cjs/old-bcm-popover-box.cjs.entry.js +3 -3
- package/dist/cjs/old-bcm-popover.cjs.entry.js +2 -2
- package/dist/cjs/{package-6afe17f3.js → package-6de220be.js} +1 -1
- package/dist/cjs/{validators-78797513.js → validators-3381bee2.js} +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/molecules/color-input/color-input.css +127 -0
- package/dist/collection/components/molecules/color-input/color-input.js +34 -13
- package/dist/collection/components/molecules/color-palette/color-palette.js +114 -0
- package/dist/collection/components/molecules/color-palette/color-palette.style.js +25 -0
- package/dist/collection/components/organism/list/list.js +74 -20
- package/dist/collection/components/other/segmented-picker/segment.component.js +200 -0
- package/dist/collection/components/other/segmented-picker/segment.css +28 -0
- package/dist/collection/components/other/segmented-picker/segmented-picker.component.js +365 -0
- package/dist/collection/components/other/segmented-picker/segmented-picker.css +16 -0
- package/dist/collection/components/other/segmented-picker/types.js +1 -0
- package/dist/collection/components/other/toast/toast.js +15 -9
- package/dist/collection/templates/list-item-template.js +4 -4
- package/dist/collection/templates/list-template.js +2 -2
- package/dist/components/bcm-color-input.js +18 -15
- package/dist/components/bcm-color-palette.d.ts +11 -0
- package/dist/components/bcm-color-palette.js +10 -0
- package/dist/components/bcm-segment.d.ts +11 -0
- package/dist/components/bcm-segment.js +71 -0
- package/dist/components/bcm-segmented-picker.d.ts +11 -0
- package/dist/components/bcm-segmented-picker.js +182 -0
- package/dist/components/bcm-toast.js +15 -9
- package/dist/components/color-palette.js +71 -0
- package/dist/components/generate.js +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/list.js +64 -27
- package/dist/esm/{bcm-accordion_68.entry.js → bcm-accordion_69.entry.js} +120 -44
- package/dist/esm/bcm-attendance-actions-comment.entry.js +4 -4
- package/dist/esm/bcm-attendance-actions-dropdown.entry.js +4 -4
- package/dist/esm/bcm-breadcrumb.entry.js +2 -2
- package/dist/esm/bcm-caption.entry.js +4 -4
- package/dist/esm/bcm-card.entry.js +2 -2
- package/dist/esm/bcm-date-picker.entry.js +2 -2
- package/dist/esm/bcm-datetime-picker.entry.js +2 -2
- package/dist/esm/bcm-default.entry.js +2 -2
- package/dist/esm/bcm-form-2.entry.js +2 -2
- package/dist/esm/bcm-input-2.entry.js +2 -2
- package/dist/esm/bcm-input-custom.entry.js +2 -2
- package/dist/esm/bcm-input-dropdown.entry.js +4 -4
- package/dist/esm/bcm-modal-2-footer.entry.js +4 -4
- package/dist/esm/bcm-modal-2-header.entry.js +4 -4
- package/dist/esm/bcm-modal-2.entry.js +4 -4
- package/dist/esm/bcm-number-input.entry.js +4 -4
- package/dist/esm/bcm-segment.entry.js +47 -0
- package/dist/esm/bcm-segmented-picker.entry.js +154 -0
- package/dist/esm/bcm-skeleton.entry.js +4 -4
- package/dist/esm/bcm-table.entry.js +4 -4
- package/dist/esm/bcm-tag.entry.js +3 -3
- package/dist/esm/bcm-time-picker.entry.js +2 -2
- package/dist/esm/bcm-toast.entry.js +17 -11
- package/dist/esm/bromcom-ui.js +3 -3
- package/dist/esm/{generate-a4b85775.js → generate-56d49b70.js} +1 -1
- package/dist/esm/{global-1baa11cd.js → global-97c42a5f.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{number-helper-872d5482.js → number-helper-455ab41e.js} +1 -1
- package/dist/esm/old-bcm-popover-box.entry.js +3 -3
- package/dist/esm/old-bcm-popover.entry.js +2 -2
- package/dist/esm/{package-1d6f13ed.js → package-edee14d5.js} +1 -1
- package/dist/esm/{validators-e9800e9a.js → validators-cc882165.js} +1 -1
- package/dist/types/components/molecules/color-input/color-input.d.ts +5 -4
- package/dist/types/components/molecules/color-palette/color-palette.d.ts +36 -0
- package/dist/types/components/molecules/color-palette/color-palette.style.d.ts +76 -0
- package/dist/types/components/organism/list/list.d.ts +4 -0
- package/dist/types/components/other/segmented-picker/segment.component.d.ts +42 -0
- package/dist/types/components/other/segmented-picker/segmented-picker.component.d.ts +86 -0
- package/dist/types/components/other/segmented-picker/types.d.ts +1 -0
- package/dist/types/components/other/toast/toast.d.ts +1 -0
- package/dist/types/components.d.ts +281 -0
- package/dist/types/templates/list-item-template.d.ts +2 -0
- package/dist/types/templates/list-template.d.ts +2 -0
- package/package.json +1 -1
- package/dist/bromcom-ui/p-485ed6c1.entry.js +0 -5
- package/dist/bromcom-ui/p-5c4939a7.js +0 -5
- package/dist/bromcom-ui/p-8457670e.entry.js +0 -5
- package/dist/bromcom-ui/p-dcd69786.entry.js +0 -5
- package/dist/bromcom-ui/p-e9a43560.js +0 -5
- package/dist/bromcom-ui/p-ea24a822.entry.js +0 -5
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
6
|
+
import { c as classnames } from './index2.js';
|
|
7
|
+
|
|
8
|
+
const segmentCss = "bcm-segment{display:flex;align-items:center;position:relative;width:100%}.bcm-segment__button{white-space:nowrap;flex:1;width:100%}.bcm-segment__divider{position:absolute;right:0;top:50%;transform:translateY(-50%);width:1px;height:20px;background-color:var(--bcm-ui-color-border-default);transition:opacity 800ms cubic-bezier(0.4, 0, 0.2, 1);pointer-events:none}.bcm-segment__divider--hidden{opacity:0}";
|
|
9
|
+
|
|
10
|
+
const BcmSegment$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.__registerHost();
|
|
14
|
+
this.bcmSegmentClick = createEvent(this, "bcm-segment-click", 5);
|
|
15
|
+
this.handleClick = () => {
|
|
16
|
+
if (!this.disabled) {
|
|
17
|
+
this.bcmSegmentClick.emit(this.value);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this.value = undefined;
|
|
21
|
+
this.disabled = false;
|
|
22
|
+
this.selected = false;
|
|
23
|
+
this.size = 'medium';
|
|
24
|
+
this.index = 0;
|
|
25
|
+
this.activeIndex = 0;
|
|
26
|
+
this.totalSegments = 0;
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
const isLastSegment = this.totalSegments > 0 && this.index === this.totalSegments - 1;
|
|
30
|
+
const hideDivider = isLastSegment || this.selected || this.index === this.activeIndex - 1;
|
|
31
|
+
return (h(Host, { role: "radio", "aria-checked": this.selected.toString() }, h("button", { class: classnames("bcm-ui-element bcm-segment__button tw-relative tw-z-20 tw-px-3 tw-text-center tw-font-medium tw-transition-colors tw-border-none tw-bg-transparent tw-select-none", {
|
|
32
|
+
"tw-text-2 tw-py-px": this.size === "small",
|
|
33
|
+
"tw-text-3 tw-py-1": this.size === "medium",
|
|
34
|
+
"tw-text-4 tw-py-2": this.size === "large",
|
|
35
|
+
}, {
|
|
36
|
+
"tw-text-color-header": this.selected,
|
|
37
|
+
"tw-text-color-helper": !this.selected,
|
|
38
|
+
}, {
|
|
39
|
+
"tw-cursor-not-allowed tw-opacity-50": this.disabled,
|
|
40
|
+
"tw-cursor-pointer hover:tw-text-color-header": !this.disabled,
|
|
41
|
+
}), onClick: this.handleClick, disabled: this.disabled, type: "button" }, h("slot", null)), h("div", { class: `bcm-segment__divider ${hideDivider ? 'bcm-segment__divider--hidden' : ''}` })));
|
|
42
|
+
}
|
|
43
|
+
get el() { return this; }
|
|
44
|
+
static get style() { return segmentCss; }
|
|
45
|
+
}, [4, "bcm-segment", {
|
|
46
|
+
"value": [513],
|
|
47
|
+
"disabled": [516],
|
|
48
|
+
"selected": [1540],
|
|
49
|
+
"size": [1025],
|
|
50
|
+
"index": [1026],
|
|
51
|
+
"activeIndex": [1026, "active-index"],
|
|
52
|
+
"totalSegments": [1026, "total-segments"]
|
|
53
|
+
}]);
|
|
54
|
+
function defineCustomElement$1() {
|
|
55
|
+
if (typeof customElements === "undefined") {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const components = ["bcm-segment"];
|
|
59
|
+
components.forEach(tagName => { switch (tagName) {
|
|
60
|
+
case "bcm-segment":
|
|
61
|
+
if (!customElements.get(tagName)) {
|
|
62
|
+
customElements.define(tagName, BcmSegment$1);
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
} });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const BcmSegment = BcmSegment$1;
|
|
69
|
+
const defineCustomElement = defineCustomElement$1;
|
|
70
|
+
|
|
71
|
+
export { BcmSegment, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BcmSegmentedPicker extends Components.BcmSegmentedPicker, HTMLElement {}
|
|
4
|
+
export const BcmSegmentedPicker: {
|
|
5
|
+
prototype: BcmSegmentedPicker;
|
|
6
|
+
new (): BcmSegmentedPicker;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
6
|
+
import { c as classnames } from './index2.js';
|
|
7
|
+
|
|
8
|
+
const segmentedPickerCss = "bcm-segmented-picker{display:block}.bcm-segmented-picker__container{--indicator-left:0%;--indicator-width:0%}.bcm-segmented-picker__indicator{left:var(--indicator-left);width:var(--indicator-width);transition:all 200ms cubic-bezier(0.4, 0, 0.2, 1)}";
|
|
9
|
+
|
|
10
|
+
const BcmSegmentedPicker$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.__registerHost();
|
|
14
|
+
this.bcmSegmentChange = createEvent(this, "bcm-segment-change", 1);
|
|
15
|
+
this.segmentElements = [];
|
|
16
|
+
this.value = undefined;
|
|
17
|
+
this.name = undefined;
|
|
18
|
+
this.required = false;
|
|
19
|
+
this.size = 'medium';
|
|
20
|
+
this.fullWidth = false;
|
|
21
|
+
this.disabled = false;
|
|
22
|
+
this.shadow = false;
|
|
23
|
+
this.segments = [];
|
|
24
|
+
this.activeIndex = 0;
|
|
25
|
+
}
|
|
26
|
+
componentWillLoad() {
|
|
27
|
+
this.discoverSegments();
|
|
28
|
+
this.updateActiveIndex();
|
|
29
|
+
this.propagatePropsToSegments();
|
|
30
|
+
this.updateSegmentStates();
|
|
31
|
+
}
|
|
32
|
+
componentDidLoad() {
|
|
33
|
+
this.updateCSSVariables();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Discovers all bcm-segment children
|
|
37
|
+
*/
|
|
38
|
+
discoverSegments() {
|
|
39
|
+
this.segmentElements = Array.from(this.el.querySelectorAll('bcm-segment'));
|
|
40
|
+
this.segments = this.segmentElements.map((segment) => ({
|
|
41
|
+
value: segment.value,
|
|
42
|
+
disabled: segment.disabled || false,
|
|
43
|
+
}));
|
|
44
|
+
// Set initial value if not provided
|
|
45
|
+
if (!this.value && this.segments.length > 0) {
|
|
46
|
+
const firstEnabledSegment = this.segments.find(s => !s.disabled);
|
|
47
|
+
if (firstEnabledSegment) {
|
|
48
|
+
this.value = firstEnabledSegment.value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Updates the active index based on current value
|
|
54
|
+
*/
|
|
55
|
+
updateActiveIndex() {
|
|
56
|
+
const index = this.segments.findIndex(s => s.value === this.value);
|
|
57
|
+
this.activeIndex = index >= 0 ? index : 0;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Updates selected state of all segment elements
|
|
61
|
+
*/
|
|
62
|
+
updateSegmentStates() {
|
|
63
|
+
this.segmentElements.forEach((segment) => {
|
|
64
|
+
segment.selected = segment.value === this.value;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Updates CSS custom properties for indicator positioning
|
|
69
|
+
*/
|
|
70
|
+
updateCSSVariables() {
|
|
71
|
+
const container = this.el.querySelector('.bcm-segmented-picker__container');
|
|
72
|
+
if (container && this.segments.length > 0) {
|
|
73
|
+
const segmentWidth = 100 / this.segments.length;
|
|
74
|
+
const leftPosition = this.activeIndex * segmentWidth;
|
|
75
|
+
container.style.setProperty('--indicator-left', `${leftPosition}%`);
|
|
76
|
+
container.style.setProperty('--indicator-width', `${segmentWidth}%`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
handleValueChange(newValue, oldValue) {
|
|
80
|
+
this.updateActiveIndex();
|
|
81
|
+
this.propagatePropsToSegments();
|
|
82
|
+
this.updateSegmentStates();
|
|
83
|
+
this.updateCSSVariables();
|
|
84
|
+
if (oldValue !== undefined && oldValue !== newValue) {
|
|
85
|
+
this.bcmSegmentChange.emit({
|
|
86
|
+
value: newValue,
|
|
87
|
+
previousValue: oldValue,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
handleSizeChange() {
|
|
92
|
+
this.propagatePropsToSegments();
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Propagates parent props to child segments
|
|
96
|
+
*/
|
|
97
|
+
propagatePropsToSegments() {
|
|
98
|
+
const total = this.segmentElements.length;
|
|
99
|
+
this.segmentElements.forEach((segment, index) => {
|
|
100
|
+
segment.size = this.size;
|
|
101
|
+
segment.index = index;
|
|
102
|
+
segment.activeIndex = this.activeIndex;
|
|
103
|
+
segment.totalSegments = total;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Handles segment click events from children
|
|
108
|
+
*/
|
|
109
|
+
handleSegmentClick(event) {
|
|
110
|
+
const clickedValue = event.detail;
|
|
111
|
+
const segment = this.segments.find(s => s.value === clickedValue);
|
|
112
|
+
if (segment && !segment.disabled && !this.disabled) {
|
|
113
|
+
this.value = clickedValue;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Public method to programmatically set active segment
|
|
118
|
+
*/
|
|
119
|
+
async setValue(value) {
|
|
120
|
+
const segment = this.segments.find(s => s.value === value);
|
|
121
|
+
if (segment && !segment.disabled) {
|
|
122
|
+
this.value = value;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Public method to get active segment value
|
|
127
|
+
*/
|
|
128
|
+
async getValue() {
|
|
129
|
+
return this.value;
|
|
130
|
+
}
|
|
131
|
+
render() {
|
|
132
|
+
return (h(Host, null, h("div", { class: classnames("bcm-ui-element bcm-segmented-picker__container tw-inline-flex tw-relative tw-rounded-lg tw-border tw-border-solid tw-border-color tw-bg-color-default tw-overflow-hidden", {
|
|
133
|
+
"tw-text-2": this.size === "small",
|
|
134
|
+
"tw-text-3": this.size === "medium",
|
|
135
|
+
"tw-text-4": this.size === "large",
|
|
136
|
+
}, {
|
|
137
|
+
"tw-w-full": this.fullWidth,
|
|
138
|
+
"tw-w-auto": !this.fullWidth,
|
|
139
|
+
}, {
|
|
140
|
+
"tw-shadow-md": this.shadow,
|
|
141
|
+
}, {
|
|
142
|
+
"tw-opacity-50 tw-cursor-not-allowed": this.disabled,
|
|
143
|
+
"tw-cursor-pointer": !this.disabled,
|
|
144
|
+
}), role: "radiogroup", "aria-disabled": this.disabled }, h("div", { class: "bcm-segmented-picker__indicator tw-absolute tw-inset-y-0 tw-bg-color-base tw-rounded tw-shadow-sm tw-z-20" }), h("div", { class: "bcm-segmented-picker__grid tw-grid tw-grid-flow-col tw-auto-cols-fr tw-relative tw-w-full" }, h("slot", null)))));
|
|
145
|
+
}
|
|
146
|
+
get el() { return this; }
|
|
147
|
+
static get watchers() { return {
|
|
148
|
+
"value": ["handleValueChange"],
|
|
149
|
+
"size": ["handleSizeChange"]
|
|
150
|
+
}; }
|
|
151
|
+
static get style() { return segmentedPickerCss; }
|
|
152
|
+
}, [4, "bcm-segmented-picker", {
|
|
153
|
+
"value": [1537],
|
|
154
|
+
"name": [513],
|
|
155
|
+
"required": [516],
|
|
156
|
+
"size": [513],
|
|
157
|
+
"fullWidth": [516, "full-width"],
|
|
158
|
+
"disabled": [516],
|
|
159
|
+
"shadow": [516],
|
|
160
|
+
"segments": [32],
|
|
161
|
+
"activeIndex": [32],
|
|
162
|
+
"setValue": [64],
|
|
163
|
+
"getValue": [64]
|
|
164
|
+
}, [[0, "bcm-segment-click", "handleSegmentClick"]]]);
|
|
165
|
+
function defineCustomElement$1() {
|
|
166
|
+
if (typeof customElements === "undefined") {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const components = ["bcm-segmented-picker"];
|
|
170
|
+
components.forEach(tagName => { switch (tagName) {
|
|
171
|
+
case "bcm-segmented-picker":
|
|
172
|
+
if (!customElements.get(tagName)) {
|
|
173
|
+
customElements.define(tagName, BcmSegmentedPicker$1);
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
} });
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const BcmSegmentedPicker = BcmSegmentedPicker$1;
|
|
180
|
+
const defineCustomElement = defineCustomElement$1;
|
|
181
|
+
|
|
182
|
+
export { BcmSegmentedPicker, defineCustomElement };
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
6
6
|
import { c as classnames } from './index2.js';
|
|
7
7
|
import { G as Generate } from './generate.js';
|
|
8
|
-
import { S as StringHelper } from './string-helper.js';
|
|
9
8
|
import { a as Bcm } from './bcm.js';
|
|
10
9
|
import { d as delay } from './utils.js';
|
|
11
10
|
|
|
@@ -29,6 +28,13 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
29
28
|
this.visible = false;
|
|
30
29
|
this.visibleContainer = false;
|
|
31
30
|
}
|
|
31
|
+
renderMultiline(text) {
|
|
32
|
+
if (!text) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const lines = text.split("\n");
|
|
36
|
+
return lines.map((line, index) => [index > 0 && h("br", null), line]);
|
|
37
|
+
}
|
|
32
38
|
async show() {
|
|
33
39
|
const toast = document.getElementById(this._id + "-container");
|
|
34
40
|
if (toast) {
|
|
@@ -84,7 +90,7 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
84
90
|
return container;
|
|
85
91
|
}
|
|
86
92
|
render() {
|
|
87
|
-
return (h(Host, { class: "tw-hidden" }, h("div", { class: classnames({ "tw-hidden": !this.visible }), id: this._id + "-container", onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: classnames("tw-pointer-events-auto tw-transform tw-transition tw-duration-300 tw-ease-in-out", "tw-flex tw-min-w-[256px] tw-max-w-[420px] tw-flex-col tw-gap-2 tw-rounded-lg tw-border tw-font-sans tw-font-normal tw-shadow-2", "tw-border-
|
|
93
|
+
return (h(Host, { class: "tw-hidden" }, h("div", { class: classnames({ "tw-hidden": !this.visible }), id: this._id + "-container", onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: classnames("tw-pointer-events-auto tw-transform tw-transition tw-duration-300 tw-ease-in-out", "tw-flex tw-min-w-[256px] tw-max-w-[420px] tw-flex-col tw-gap-2 tw-rounded-lg tw-border tw-font-sans tw-font-normal tw-shadow-2", "tw-border-gray-300 tw-bg-white tw-text-slate-600", {
|
|
88
94
|
"tw-p-4": !this.description,
|
|
89
95
|
"tw-p-6": this.description,
|
|
90
96
|
}, "tw-transform tw-transition tw-duration-300 tw-ease-in-out ", {
|
|
@@ -92,11 +98,11 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
92
98
|
"tw-opacity-0": !this.visibleContainer,
|
|
93
99
|
"tw-translate-y-[-100%]": !this.visibleContainer && this.position.split("-")[0] === "top",
|
|
94
100
|
"tw-translate-y-[100%]": !this.visibleContainer && this.position.split("-")[0] === "bottom",
|
|
95
|
-
}) }, h("div", { class: "tw-flex tw-items-
|
|
96
|
-
"tw-text-
|
|
97
|
-
"tw-text-
|
|
98
|
-
"tw-text-
|
|
99
|
-
"tw-text-
|
|
101
|
+
}) }, h("div", { class: "tw-flex tw-items-start tw-justify-between tw-gap-5" }, h("div", { class: "tw-flex tw-items-start tw-gap-3 " }, this.status && (h("i", { class: classnames("tw-text-6 tw-pt-0.5", this.messageIcon ? this.messageIcon : "far", {
|
|
102
|
+
"tw-text-emerald-500": this.status === "success",
|
|
103
|
+
"tw-text-red-500": this.status === "error",
|
|
104
|
+
"tw-text-amber-500": this.status === "warning",
|
|
105
|
+
"tw-text-blue-500": this.status === "info",
|
|
100
106
|
}, {
|
|
101
107
|
"fa-check-circle": !this.messageIcon && this.status === "success",
|
|
102
108
|
"fa-exclamation-circle": !this.messageIcon && this.status === "error",
|
|
@@ -105,9 +111,9 @@ const BcmToast$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
105
111
|
}) })), h("span", { class: classnames({
|
|
106
112
|
"tw-text-4": !this.description,
|
|
107
113
|
"tw-text-6 tw-font-medium": this.description,
|
|
108
|
-
}) },
|
|
114
|
+
}) }, this.renderMultiline(this.message))), h("div", { class: "tw-flex tw-items-baseline tw-gap-2" }, this.viewButton && (h("button", { onClick: () => this.bcmToastView.emit(), title: "View details", class: classnames("tw-cursor-pointer tw-rounded tw-bg-transparent tw-p-0 tw-px-1 tw-text-4 tw-text-inherit", "hover:tw-bg-gray-100 hover:tw-text-slate-800", "active:tw-bg-gray-200", "tw-transition tw-duration-300 tw-ease-in-out", {
|
|
109
115
|
"tw-font-medium": this.description,
|
|
110
|
-
}) }, "View")), this.closeButton && (h("button", { title: "Close", onClick: () => this.hide(), class: classnames("tw-
|
|
116
|
+
}) }, "View")), this.closeButton && (h("button", { title: "Close", onClick: () => this.hide(), class: classnames("tw-rounded tw-bg-transparent tw-p-0", "tw-flex tw-h-6 tw-w-6 tw-cursor-pointer tw-items-center tw-justify-center tw-text-3 tw-text-inherit", "hover:tw-bg-gray-100 hover:tw-text-slate-800", "active:tw-bg-gray-200") }, h("i", { class: "fal fa-times" }))))), this.description && h("div", { class: "tw-text-3 " }, this.renderMultiline(this.description)), h("slot", null)))));
|
|
111
117
|
}
|
|
112
118
|
get el() { return this; }
|
|
113
119
|
}, [4, "bcm-toast", {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
6
|
+
import { C as ColorHelper } from './color-helper.js';
|
|
7
|
+
import { c as ce } from './index4.js';
|
|
8
|
+
|
|
9
|
+
const colorPaletteStyle = ce({
|
|
10
|
+
slots: {
|
|
11
|
+
host: "tw-flex tw-gap-4 tw-p-3 tw-bg-color-base tw-border tw-rounded-md tw-box-border tw-w-fit tw-h-fit",
|
|
12
|
+
column: "tw-flex tw-flex-col tw-gap-4",
|
|
13
|
+
box: "tw-w-6 tw-h-6 tw-rounded-md tw-cursor-pointer tw-transition-all tw-duration-200 tw-relative tw-flex tw-items-center tw-justify-center tw-border",
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
selected: {
|
|
17
|
+
true: {
|
|
18
|
+
box: "tw-z-10 tw-ring-2 tw-ring-primary tw-ring-offset-2 tw-scale-100 tw-border-transparent",
|
|
19
|
+
},
|
|
20
|
+
false: {
|
|
21
|
+
box: "tw-border-transparent hover:tw-border-black/10 hover:tw-scale-110",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
selected: false,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const BcmColorPalette = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
this.__registerHost();
|
|
34
|
+
this.bcmChange = createEvent(this, "bcm-change", 7);
|
|
35
|
+
this.onColorChange = (hex) => {
|
|
36
|
+
this.value = hex;
|
|
37
|
+
this.bcmChange.emit(hex);
|
|
38
|
+
};
|
|
39
|
+
this.value = undefined;
|
|
40
|
+
this.paletteKeys = ["orange", "yellow", "lime", "green", "teal", "cyan", "sky", "indigo", "violet", "purple", "fuchsia", "pink", "rose", "stone", "slate"];
|
|
41
|
+
this.shades = [950, 900, 800, 700, 600, 400, 300, 200, 100, 50];
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
const { host, column, box } = colorPaletteStyle();
|
|
45
|
+
return (h(Host, { class: host() }, this.paletteKeys.map((colorName) => (h("div", { class: column(), key: colorName }, this.shades.map((shade) => {
|
|
46
|
+
const colorKey = `${colorName}-${shade}`;
|
|
47
|
+
const hex = ColorHelper.getTwColorToHex(colorKey);
|
|
48
|
+
const isSelected = this.value === hex;
|
|
49
|
+
return (h("div", { key: colorKey, class: box({ selected: isSelected }), style: { backgroundColor: hex }, onClick: () => this.onColorChange(hex) }));
|
|
50
|
+
}))))));
|
|
51
|
+
}
|
|
52
|
+
}, [0, "bcm-color-palette", {
|
|
53
|
+
"value": [1537],
|
|
54
|
+
"paletteKeys": [16],
|
|
55
|
+
"shades": [16]
|
|
56
|
+
}]);
|
|
57
|
+
function defineCustomElement() {
|
|
58
|
+
if (typeof customElements === "undefined") {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const components = ["bcm-color-palette"];
|
|
62
|
+
components.forEach(tagName => { switch (tagName) {
|
|
63
|
+
case "bcm-color-palette":
|
|
64
|
+
if (!customElements.get(tagName)) {
|
|
65
|
+
customElements.define(tagName, BcmColorPalette);
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
} });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { BcmColorPalette as B, defineCustomElement as d };
|
|
@@ -22,6 +22,7 @@ export { BcmChipGroup as BcmChipGroup } from '../types/components/atoms/chip/chi
|
|
|
22
22
|
export { BcmCollapse as BcmCollapse } from '../types/components/other_deprecated/collapse/collapse';
|
|
23
23
|
export { BcmCollapseGroup as BcmCollapseGroup } from '../types/components/other_deprecated/collapse/group';
|
|
24
24
|
export { BcmColorInput as BcmColorInput } from '../types/components/molecules/color-input/color-input';
|
|
25
|
+
export { BcmColorPalette as BcmColorPalette } from '../types/components/molecules/color-palette/color-palette';
|
|
25
26
|
export { BcmColorful as BcmColorful } from '../types/components/third-parts/colorful/colorful';
|
|
26
27
|
export { BcmColorPicker as BcmColorpicker } from '../types/components/other_deprecated/colorpicker/colorpicker';
|
|
27
28
|
export { BcmContent as BcmContent } from '../types/components/other/content/content';
|
|
@@ -77,6 +78,8 @@ export { BcmReactNumber as BcmReactNumber } from '../types/components/molecules/
|
|
|
77
78
|
export { BcmResult as BcmResult } from '../types/components/molecules/result/result';
|
|
78
79
|
export { BcmScrollArea as BcmScrollArea } from '../types/components/other/scroll-area/scroll-area';
|
|
79
80
|
export { BcmSearch as BcmSearch } from '../types/components/molecules/search/search';
|
|
81
|
+
export { BcmSegment as BcmSegment } from '../types/components/other/segmented-picker/segment.component';
|
|
82
|
+
export { BcmSegmentedPicker as BcmSegmentedPicker } from '../types/components/other/segmented-picker/segmented-picker.component';
|
|
80
83
|
export { BcmSelect as BcmSelect } from '../types/components/other_deprecated/select/select';
|
|
81
84
|
export { BcmSelectBox as BcmSelectBox } from '../types/components/other_deprecated/select/select-box';
|
|
82
85
|
export { BcmSelectGroup as BcmSelectGroup } from '../types/components/other_deprecated/select/group';
|
package/dist/components/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { BcmChipGroup, defineCustomElement as defineCustomElementBcmChipGroup }
|
|
|
30
30
|
export { BcmCollapse, defineCustomElement as defineCustomElementBcmCollapse } from './bcm-collapse.js';
|
|
31
31
|
export { BcmCollapseGroup, defineCustomElement as defineCustomElementBcmCollapseGroup } from './bcm-collapse-group.js';
|
|
32
32
|
export { BcmColorInput, defineCustomElement as defineCustomElementBcmColorInput } from './bcm-color-input.js';
|
|
33
|
+
export { BcmColorPalette, defineCustomElement as defineCustomElementBcmColorPalette } from './bcm-color-palette.js';
|
|
33
34
|
export { BcmColorful, defineCustomElement as defineCustomElementBcmColorful } from './bcm-colorful.js';
|
|
34
35
|
export { BcmColorpicker, defineCustomElement as defineCustomElementBcmColorpicker } from './bcm-colorpicker.js';
|
|
35
36
|
export { BcmContent, defineCustomElement as defineCustomElementBcmContent } from './bcm-content.js';
|
|
@@ -85,6 +86,8 @@ export { BcmReactNumber, defineCustomElement as defineCustomElementBcmReactNumbe
|
|
|
85
86
|
export { BcmResult, defineCustomElement as defineCustomElementBcmResult } from './bcm-result.js';
|
|
86
87
|
export { BcmScrollArea, defineCustomElement as defineCustomElementBcmScrollArea } from './bcm-scroll-area.js';
|
|
87
88
|
export { BcmSearch, defineCustomElement as defineCustomElementBcmSearch } from './bcm-search.js';
|
|
89
|
+
export { BcmSegment, defineCustomElement as defineCustomElementBcmSegment } from './bcm-segment.js';
|
|
90
|
+
export { BcmSegmentedPicker, defineCustomElement as defineCustomElementBcmSegmentedPicker } from './bcm-segmented-picker.js';
|
|
88
91
|
export { BcmSelect, defineCustomElement as defineCustomElementBcmSelect } from './bcm-select.js';
|
|
89
92
|
export { BcmSelectBox, defineCustomElement as defineCustomElementBcmSelectBox } from './bcm-select-box.js';
|
|
90
93
|
export { BcmSelectGroup, defineCustomElement as defineCustomElementBcmSelectGroup } from './bcm-select-group.js';
|