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,365 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { h, Host } from '@stencil/core';
|
|
6
|
+
import cs from "classnames";
|
|
7
|
+
/**
|
|
8
|
+
* Modern Segmented Picker component with CSS Grid-based indicator
|
|
9
|
+
* @slot - Default slot for bcm-segment components
|
|
10
|
+
*/
|
|
11
|
+
export class BcmSegmentedPicker {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.segmentElements = [];
|
|
14
|
+
this.value = undefined;
|
|
15
|
+
this.name = undefined;
|
|
16
|
+
this.required = false;
|
|
17
|
+
this.size = 'medium';
|
|
18
|
+
this.fullWidth = false;
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this.shadow = false;
|
|
21
|
+
this.segments = [];
|
|
22
|
+
this.activeIndex = 0;
|
|
23
|
+
}
|
|
24
|
+
componentWillLoad() {
|
|
25
|
+
this.discoverSegments();
|
|
26
|
+
this.updateActiveIndex();
|
|
27
|
+
this.propagatePropsToSegments();
|
|
28
|
+
this.updateSegmentStates();
|
|
29
|
+
}
|
|
30
|
+
componentDidLoad() {
|
|
31
|
+
this.updateCSSVariables();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Discovers all bcm-segment children
|
|
35
|
+
*/
|
|
36
|
+
discoverSegments() {
|
|
37
|
+
this.segmentElements = Array.from(this.el.querySelectorAll('bcm-segment'));
|
|
38
|
+
this.segments = this.segmentElements.map((segment) => ({
|
|
39
|
+
value: segment.value,
|
|
40
|
+
disabled: segment.disabled || false,
|
|
41
|
+
}));
|
|
42
|
+
// Set initial value if not provided
|
|
43
|
+
if (!this.value && this.segments.length > 0) {
|
|
44
|
+
const firstEnabledSegment = this.segments.find(s => !s.disabled);
|
|
45
|
+
if (firstEnabledSegment) {
|
|
46
|
+
this.value = firstEnabledSegment.value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Updates the active index based on current value
|
|
52
|
+
*/
|
|
53
|
+
updateActiveIndex() {
|
|
54
|
+
const index = this.segments.findIndex(s => s.value === this.value);
|
|
55
|
+
this.activeIndex = index >= 0 ? index : 0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Updates selected state of all segment elements
|
|
59
|
+
*/
|
|
60
|
+
updateSegmentStates() {
|
|
61
|
+
this.segmentElements.forEach((segment) => {
|
|
62
|
+
segment.selected = segment.value === this.value;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Updates CSS custom properties for indicator positioning
|
|
67
|
+
*/
|
|
68
|
+
updateCSSVariables() {
|
|
69
|
+
const container = this.el.querySelector('.bcm-segmented-picker__container');
|
|
70
|
+
if (container && this.segments.length > 0) {
|
|
71
|
+
const segmentWidth = 100 / this.segments.length;
|
|
72
|
+
const leftPosition = this.activeIndex * segmentWidth;
|
|
73
|
+
container.style.setProperty('--indicator-left', `${leftPosition}%`);
|
|
74
|
+
container.style.setProperty('--indicator-width', `${segmentWidth}%`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
handleValueChange(newValue, oldValue) {
|
|
78
|
+
this.updateActiveIndex();
|
|
79
|
+
this.propagatePropsToSegments();
|
|
80
|
+
this.updateSegmentStates();
|
|
81
|
+
this.updateCSSVariables();
|
|
82
|
+
if (oldValue !== undefined && oldValue !== newValue) {
|
|
83
|
+
this.bcmSegmentChange.emit({
|
|
84
|
+
value: newValue,
|
|
85
|
+
previousValue: oldValue,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
handleSizeChange() {
|
|
90
|
+
this.propagatePropsToSegments();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Propagates parent props to child segments
|
|
94
|
+
*/
|
|
95
|
+
propagatePropsToSegments() {
|
|
96
|
+
const total = this.segmentElements.length;
|
|
97
|
+
this.segmentElements.forEach((segment, index) => {
|
|
98
|
+
segment.size = this.size;
|
|
99
|
+
segment.index = index;
|
|
100
|
+
segment.activeIndex = this.activeIndex;
|
|
101
|
+
segment.totalSegments = total;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Handles segment click events from children
|
|
106
|
+
*/
|
|
107
|
+
handleSegmentClick(event) {
|
|
108
|
+
const clickedValue = event.detail;
|
|
109
|
+
const segment = this.segments.find(s => s.value === clickedValue);
|
|
110
|
+
if (segment && !segment.disabled && !this.disabled) {
|
|
111
|
+
this.value = clickedValue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Public method to programmatically set active segment
|
|
116
|
+
*/
|
|
117
|
+
async setValue(value) {
|
|
118
|
+
const segment = this.segments.find(s => s.value === value);
|
|
119
|
+
if (segment && !segment.disabled) {
|
|
120
|
+
this.value = value;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Public method to get active segment value
|
|
125
|
+
*/
|
|
126
|
+
async getValue() {
|
|
127
|
+
return this.value;
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
130
|
+
return (h(Host, null, h("div", { class: cs("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", {
|
|
131
|
+
"tw-text-2": this.size === "small",
|
|
132
|
+
"tw-text-3": this.size === "medium",
|
|
133
|
+
"tw-text-4": this.size === "large",
|
|
134
|
+
}, {
|
|
135
|
+
"tw-w-full": this.fullWidth,
|
|
136
|
+
"tw-w-auto": !this.fullWidth,
|
|
137
|
+
}, {
|
|
138
|
+
"tw-shadow-md": this.shadow,
|
|
139
|
+
}, {
|
|
140
|
+
"tw-opacity-50 tw-cursor-not-allowed": this.disabled,
|
|
141
|
+
"tw-cursor-pointer": !this.disabled,
|
|
142
|
+
}), 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)))));
|
|
143
|
+
}
|
|
144
|
+
static get is() { return "bcm-segmented-picker"; }
|
|
145
|
+
static get originalStyleUrls() {
|
|
146
|
+
return {
|
|
147
|
+
"$": ["segmented-picker.css"]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
static get styleUrls() {
|
|
151
|
+
return {
|
|
152
|
+
"$": ["segmented-picker.css"]
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
static get properties() {
|
|
156
|
+
return {
|
|
157
|
+
"value": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"mutable": true,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "string",
|
|
162
|
+
"resolved": "string",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": false,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [],
|
|
169
|
+
"text": "Selected segment value"
|
|
170
|
+
},
|
|
171
|
+
"attribute": "value",
|
|
172
|
+
"reflect": true
|
|
173
|
+
},
|
|
174
|
+
"name": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"mutable": false,
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "string",
|
|
179
|
+
"resolved": "string",
|
|
180
|
+
"references": {}
|
|
181
|
+
},
|
|
182
|
+
"required": false,
|
|
183
|
+
"optional": false,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": "Name attribute for form association"
|
|
187
|
+
},
|
|
188
|
+
"attribute": "name",
|
|
189
|
+
"reflect": true
|
|
190
|
+
},
|
|
191
|
+
"required": {
|
|
192
|
+
"type": "boolean",
|
|
193
|
+
"mutable": false,
|
|
194
|
+
"complexType": {
|
|
195
|
+
"original": "boolean",
|
|
196
|
+
"resolved": "boolean",
|
|
197
|
+
"references": {}
|
|
198
|
+
},
|
|
199
|
+
"required": false,
|
|
200
|
+
"optional": false,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [],
|
|
203
|
+
"text": "Whether this field is required in a form"
|
|
204
|
+
},
|
|
205
|
+
"attribute": "required",
|
|
206
|
+
"reflect": true,
|
|
207
|
+
"defaultValue": "false"
|
|
208
|
+
},
|
|
209
|
+
"size": {
|
|
210
|
+
"type": "string",
|
|
211
|
+
"mutable": false,
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "'small' | 'medium' | 'large'",
|
|
214
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
215
|
+
"references": {}
|
|
216
|
+
},
|
|
217
|
+
"required": false,
|
|
218
|
+
"optional": false,
|
|
219
|
+
"docs": {
|
|
220
|
+
"tags": [],
|
|
221
|
+
"text": "Size variant"
|
|
222
|
+
},
|
|
223
|
+
"attribute": "size",
|
|
224
|
+
"reflect": true,
|
|
225
|
+
"defaultValue": "'medium'"
|
|
226
|
+
},
|
|
227
|
+
"fullWidth": {
|
|
228
|
+
"type": "boolean",
|
|
229
|
+
"mutable": false,
|
|
230
|
+
"complexType": {
|
|
231
|
+
"original": "boolean",
|
|
232
|
+
"resolved": "boolean",
|
|
233
|
+
"references": {}
|
|
234
|
+
},
|
|
235
|
+
"required": false,
|
|
236
|
+
"optional": false,
|
|
237
|
+
"docs": {
|
|
238
|
+
"tags": [],
|
|
239
|
+
"text": "Full width flag"
|
|
240
|
+
},
|
|
241
|
+
"attribute": "full-width",
|
|
242
|
+
"reflect": true,
|
|
243
|
+
"defaultValue": "false"
|
|
244
|
+
},
|
|
245
|
+
"disabled": {
|
|
246
|
+
"type": "boolean",
|
|
247
|
+
"mutable": false,
|
|
248
|
+
"complexType": {
|
|
249
|
+
"original": "boolean",
|
|
250
|
+
"resolved": "boolean",
|
|
251
|
+
"references": {}
|
|
252
|
+
},
|
|
253
|
+
"required": false,
|
|
254
|
+
"optional": false,
|
|
255
|
+
"docs": {
|
|
256
|
+
"tags": [],
|
|
257
|
+
"text": "Disabled state"
|
|
258
|
+
},
|
|
259
|
+
"attribute": "disabled",
|
|
260
|
+
"reflect": true,
|
|
261
|
+
"defaultValue": "false"
|
|
262
|
+
},
|
|
263
|
+
"shadow": {
|
|
264
|
+
"type": "boolean",
|
|
265
|
+
"mutable": false,
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "boolean",
|
|
268
|
+
"resolved": "boolean",
|
|
269
|
+
"references": {}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": false,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": "Enable shadow on container"
|
|
276
|
+
},
|
|
277
|
+
"attribute": "shadow",
|
|
278
|
+
"reflect": true,
|
|
279
|
+
"defaultValue": "false"
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
static get states() {
|
|
284
|
+
return {
|
|
285
|
+
"segments": {},
|
|
286
|
+
"activeIndex": {}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
static get events() {
|
|
290
|
+
return [{
|
|
291
|
+
"method": "bcmSegmentChange",
|
|
292
|
+
"name": "bcm-segment-change",
|
|
293
|
+
"bubbles": false,
|
|
294
|
+
"cancelable": true,
|
|
295
|
+
"composed": false,
|
|
296
|
+
"docs": {
|
|
297
|
+
"tags": [],
|
|
298
|
+
"text": "Emits when selected segment changes"
|
|
299
|
+
},
|
|
300
|
+
"complexType": {
|
|
301
|
+
"original": "{ value: string; previousValue: string }",
|
|
302
|
+
"resolved": "{ value: string; previousValue: string; }",
|
|
303
|
+
"references": {}
|
|
304
|
+
}
|
|
305
|
+
}];
|
|
306
|
+
}
|
|
307
|
+
static get methods() {
|
|
308
|
+
return {
|
|
309
|
+
"setValue": {
|
|
310
|
+
"complexType": {
|
|
311
|
+
"signature": "(value: string) => Promise<void>",
|
|
312
|
+
"parameters": [{
|
|
313
|
+
"tags": [],
|
|
314
|
+
"text": ""
|
|
315
|
+
}],
|
|
316
|
+
"references": {
|
|
317
|
+
"Promise": {
|
|
318
|
+
"location": "global"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"return": "Promise<void>"
|
|
322
|
+
},
|
|
323
|
+
"docs": {
|
|
324
|
+
"text": "Public method to programmatically set active segment",
|
|
325
|
+
"tags": []
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
"getValue": {
|
|
329
|
+
"complexType": {
|
|
330
|
+
"signature": "() => Promise<string>",
|
|
331
|
+
"parameters": [],
|
|
332
|
+
"references": {
|
|
333
|
+
"Promise": {
|
|
334
|
+
"location": "global"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"return": "Promise<string>"
|
|
338
|
+
},
|
|
339
|
+
"docs": {
|
|
340
|
+
"text": "Public method to get active segment value",
|
|
341
|
+
"tags": []
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
static get elementRef() { return "el"; }
|
|
347
|
+
static get watchers() {
|
|
348
|
+
return [{
|
|
349
|
+
"propName": "value",
|
|
350
|
+
"methodName": "handleValueChange"
|
|
351
|
+
}, {
|
|
352
|
+
"propName": "size",
|
|
353
|
+
"methodName": "handleSizeChange"
|
|
354
|
+
}];
|
|
355
|
+
}
|
|
356
|
+
static get listeners() {
|
|
357
|
+
return [{
|
|
358
|
+
"name": "bcm-segment-click",
|
|
359
|
+
"method": "handleSegmentClick",
|
|
360
|
+
"target": undefined,
|
|
361
|
+
"capture": false,
|
|
362
|
+
"passive": false
|
|
363
|
+
}];
|
|
364
|
+
}
|
|
365
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
bcm-segmented-picker {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.bcm-segmented-picker__container {
|
|
6
|
+
/* CSS Variables for indicator positioning */
|
|
7
|
+
--indicator-left: 0%;
|
|
8
|
+
--indicator-width: 0%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Indicator transitions */
|
|
12
|
+
.bcm-segmented-picker__indicator {
|
|
13
|
+
left: var(--indicator-left);
|
|
14
|
+
width: var(--indicator-width);
|
|
15
|
+
transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { Host, h } from "@stencil/core";
|
|
6
6
|
import cs from "classnames";
|
|
7
7
|
import { Generate } from "../../../helper/generate";
|
|
8
|
-
import { StringHelper } from "../../../helper/string-helper";
|
|
9
8
|
import Bcm from "../../../models/bcm";
|
|
10
9
|
import { delay } from "../../../utils/utils";
|
|
11
10
|
export class BcmToast {
|
|
@@ -23,6 +22,13 @@ export class BcmToast {
|
|
|
23
22
|
this.visible = false;
|
|
24
23
|
this.visibleContainer = false;
|
|
25
24
|
}
|
|
25
|
+
renderMultiline(text) {
|
|
26
|
+
if (!text) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const lines = text.split("\n");
|
|
30
|
+
return lines.map((line, index) => [index > 0 && h("br", null), line]);
|
|
31
|
+
}
|
|
26
32
|
async show() {
|
|
27
33
|
const toast = document.getElementById(this._id + "-container");
|
|
28
34
|
if (toast) {
|
|
@@ -78,7 +84,7 @@ export class BcmToast {
|
|
|
78
84
|
return container;
|
|
79
85
|
}
|
|
80
86
|
render() {
|
|
81
|
-
return (h(Host, { class: "tw-hidden" }, h("div", { class: cs({ "tw-hidden": !this.visible }), id: this._id + "-container", onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: cs("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-
|
|
87
|
+
return (h(Host, { class: "tw-hidden" }, h("div", { class: cs({ "tw-hidden": !this.visible }), id: this._id + "-container", onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: cs("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", {
|
|
82
88
|
"tw-p-4": !this.description,
|
|
83
89
|
"tw-p-6": this.description,
|
|
84
90
|
}, "tw-transform tw-transition tw-duration-300 tw-ease-in-out ", {
|
|
@@ -86,11 +92,11 @@ export class BcmToast {
|
|
|
86
92
|
"tw-opacity-0": !this.visibleContainer,
|
|
87
93
|
"tw-translate-y-[-100%]": !this.visibleContainer && this.position.split("-")[0] === "top",
|
|
88
94
|
"tw-translate-y-[100%]": !this.visibleContainer && this.position.split("-")[0] === "bottom",
|
|
89
|
-
}) }, h("div", { class: "tw-flex tw-items-
|
|
90
|
-
"tw-text-
|
|
91
|
-
"tw-text-
|
|
92
|
-
"tw-text-
|
|
93
|
-
"tw-text-
|
|
95
|
+
}) }, 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: cs("tw-text-6 tw-pt-0.5", this.messageIcon ? this.messageIcon : "far", {
|
|
96
|
+
"tw-text-emerald-500": this.status === "success",
|
|
97
|
+
"tw-text-red-500": this.status === "error",
|
|
98
|
+
"tw-text-amber-500": this.status === "warning",
|
|
99
|
+
"tw-text-blue-500": this.status === "info",
|
|
94
100
|
}, {
|
|
95
101
|
"fa-check-circle": !this.messageIcon && this.status === "success",
|
|
96
102
|
"fa-exclamation-circle": !this.messageIcon && this.status === "error",
|
|
@@ -99,9 +105,9 @@ export class BcmToast {
|
|
|
99
105
|
}) })), h("span", { class: cs({
|
|
100
106
|
"tw-text-4": !this.description,
|
|
101
107
|
"tw-text-6 tw-font-medium": this.description,
|
|
102
|
-
}) },
|
|
108
|
+
}) }, 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: cs("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", {
|
|
103
109
|
"tw-font-medium": this.description,
|
|
104
|
-
}) }, "View")), this.closeButton && (h("button", { title: "Close", onClick: () => this.hide(), class: cs("tw-
|
|
110
|
+
}) }, "View")), this.closeButton && (h("button", { title: "Close", onClick: () => this.hide(), class: cs("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)))));
|
|
105
111
|
}
|
|
106
112
|
static get is() { return "bcm-toast"; }
|
|
107
113
|
static get properties() {
|
|
@@ -6,7 +6,7 @@ import { h } from '@stencil/core';
|
|
|
6
6
|
import cs from 'classnames';
|
|
7
7
|
import { CheckboxTemplate } from './checkbox-template';
|
|
8
8
|
import { StringHelper } from '@bcm/helpers';
|
|
9
|
-
export const ListItemTemplate = ({ item, treeview, highlight, checkboxes, size, selectedItem, openGroup, checkedItem, focusItem, searchIsOnlyChilds }) => {
|
|
9
|
+
export const ListItemTemplate = ({ item, treeview, highlight, checkboxes, size, selectedItem, openGroup, checkedItem, focusItem, searchIsOnlyChilds, disabled: parentDisabled, readonly: parentReadonly }) => {
|
|
10
10
|
const isHaveChildren = item.items && item.items.length > 0;
|
|
11
11
|
var text = StringHelper.htmlEntities(item.text);
|
|
12
12
|
let intersection = [];
|
|
@@ -25,8 +25,8 @@ export const ListItemTemplate = ({ item, treeview, highlight, checkboxes, size,
|
|
|
25
25
|
}
|
|
26
26
|
text = item.isHtmlContent ? item.isHtmlContent : item.template && intersection.length > 0 ? StringHelper.templateParser(item.template, Object.assign(Object.assign({}, item.itemObject), { text })) : text;
|
|
27
27
|
const unClickable = !treeview && item.type == "group" && !item.clickable;
|
|
28
|
-
const disabled = item.disabled;
|
|
29
|
-
const readonly = item.readonly;
|
|
28
|
+
const disabled = item.disabled || parentDisabled;
|
|
29
|
+
const readonly = item.readonly || parentReadonly;
|
|
30
30
|
const itemClick = (event) => {
|
|
31
31
|
let path = event.path || event.composedPath();
|
|
32
32
|
if (path.filter(x => x.attributes && x.attributes.getNamedItem("unlinked"))[0]) {
|
|
@@ -49,6 +49,6 @@ export const ListItemTemplate = ({ item, treeview, highlight, checkboxes, size,
|
|
|
49
49
|
'bcm-list__item-' + size, {
|
|
50
50
|
'bcm-list__item--group': !treeview && item.type == 'group',
|
|
51
51
|
'bcm-list__item--readonly': readonly,
|
|
52
|
-
}) }, h("div", { class: cs('bcm-list__item-content', !checkboxes && item.selected && 'selected', { disabled, readonly }) }, treeview && (h("div", { class: "bcm-list__item-content-collapse-icon", onClick: () => collapseClick() }, isHaveChildren && h("bcm-icon", { icon: cs('fas fa-caret-' + (item.isSearching || item.open ? 'down' : 'right')) }))), h("div", { class: cs('bcm-list__item-content-text', { treeview }), onClick: (e) => itemClick(e) }, checkboxes && (treeview || (!treeview && item.type != 'group')) && (h("div", { class: "bcm-list__item-content-text-checkbox" }, h(CheckboxTemplate, { indeterminate: item.indeterminate, checked: item.checked, disabled:
|
|
52
|
+
}) }, h("div", { class: cs('bcm-list__item-content', !checkboxes && item.selected && 'selected', { disabled, readonly }) }, treeview && (h("div", { class: "bcm-list__item-content-collapse-icon", onClick: () => collapseClick() }, isHaveChildren && h("bcm-icon", { icon: cs('fas fa-caret-' + (item.isSearching || item.open ? 'down' : 'right')) }))), h("div", { class: cs('bcm-list__item-content-text', { treeview }), onClick: (e) => itemClick(e) }, checkboxes && (treeview || (!treeview && item.type != 'group')) && (h("div", { class: "bcm-list__item-content-text-checkbox" }, h(CheckboxTemplate, { indeterminate: item.indeterminate, checked: item.checked, disabled: disabled }))), h("span", Object.assign({ class: "bcm-list__item-content-text-inner" }, (item.title && { "title": item.title }), { innerHTML: text })))), (treeview || !treeview && item.type == "group") && isHaveChildren && (h("div", { class: "bcm-list__item-childs" }, (item.isSearching || item.open || (!treeview && item.type == "group")) &&
|
|
53
53
|
item.items.map((item) => (h(ListItemTemplate, { highlight: highlight, item: item, searchIsOnlyChilds: searchIsOnlyChilds, treeview: treeview, checkboxes: checkboxes, size: size, selectedItem: selectedItem, checkedItem: checkedItem, openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId) })))))));
|
|
54
54
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { h } from '@stencil/core';
|
|
6
6
|
import { InfoFooterTemplate } from './info-footer-template';
|
|
7
7
|
import { ListItemTemplate } from './list-item-template';
|
|
8
|
-
export const ListTemplate = ({ type, highlight, selectAllItem, bcmListContainer, treeview, checkboxes, checkAll, infoFooter, value, totalData, searchFound, variableText, _id, tempId, data, width, height, size, searchPlaceholder, minSearchLength, selectedItem, openGroup, checkedItem, onScrollEvent, focusItem, items, searchable, searchIsOnlyChilds, emptyText, emptyIcon, handleTransitionEnd, }) => {
|
|
8
|
+
export const ListTemplate = ({ type, highlight, selectAllItem, bcmListContainer, treeview, checkboxes, checkAll, infoFooter, value, totalData, searchFound, variableText, _id, tempId, data, width, height, size, searchPlaceholder, minSearchLength, selectedItem, openGroup, checkedItem, onScrollEvent, focusItem, items, searchable, searchIsOnlyChilds, emptyText, emptyIcon, handleTransitionEnd, disabled, readonly, }) => {
|
|
9
9
|
const showSelectAll = !(treeview && searchFound > 0) && !(searchFound > 0);
|
|
10
10
|
const setScrollHeight = () => {
|
|
11
11
|
const itemHeight = size === 'small' ? 28 : size === 'medium' ? 36 : 48;
|
|
@@ -13,5 +13,5 @@ export const ListTemplate = ({ type, highlight, selectAllItem, bcmListContainer,
|
|
|
13
13
|
const scrollHeight = itemCount * itemHeight || 0;
|
|
14
14
|
return Object.assign(Object.assign({ 'min-height': `${scrollHeight}px` }, (type === 'select' && { 'overscroll-behavior': 'none' })), { 'height': '100%', 'display': 'flex', 'flex-direction': 'column' });
|
|
15
15
|
};
|
|
16
|
-
return (h("div", { id: `bcm-list-${_id}`, class: bcmListContainer, "temp-id": `bcm-list-${tempId}`, style: { '--height': height, '--width': width }, onTransitionEnd: e => handleTransitionEnd(e) }, data && searchable && (h("section", { class: "bcm-list__container-search" }, h("bcm-search", { size: size, id: `bcm-list-${_id}-search`, data: data, clearable: true, placeholder: searchPlaceholder, "min-search-length": minSearchLength, searchIsOnlyChilds: searchIsOnlyChilds }))), h("main", { onScroll: e => onScrollEvent(e), class: "scrolling", style: Object.assign({}, (type === 'select' && { 'overscroll-behavior': 'none' })) }, h("div", { style: setScrollHeight() }, checkAll && searchFound != 0 && items && items.length > 0 && checkboxes && showSelectAll && (h("section", { class: "bcm-list__container-select-all" }, h(ListItemTemplate, { size: size, item: selectAllItem, treeview: false, checkboxes: true, selectedItem: itemId => selectedItem(itemId), checkedItem: itemId => checkedItem(itemId), openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId) }))), items.map((item) => (h(ListItemTemplate, { highlight: highlight, size: size, item: item, searchIsOnlyChilds: searchIsOnlyChilds, treeview: treeview, checkboxes: checkboxes, selectedItem: itemId => selectedItem(itemId), checkedItem: itemId => checkedItem(itemId), openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId) }))), (!items || items.length === 0) && searchFound != 0 && (h("section", { class: "bcm-list__container-no-data" }, h("bcm-empty", { style: { height: 'auto' }, icon: emptyIcon }, h("span", { innerHTML: emptyText || 'No data' })))), searchFound == 0 && (h("section", { class: "bcm-list__container-no-data" }, h("bcm-empty", { style: { height: 'auto' }, icon: emptyIcon }, h("span", { innerHTML: emptyText || 'No Data Found' })))))), infoFooter && data && data.length > 0 && (h(InfoFooterTemplate, { selected: value === null || value === void 0 ? void 0 : value.length, total: totalData, found: searchFound, multiple: checkboxes, variableText: variableText }))));
|
|
16
|
+
return (h("div", { id: `bcm-list-${_id}`, class: bcmListContainer, "temp-id": `bcm-list-${tempId}`, style: { '--height': height, '--width': width }, onTransitionEnd: e => handleTransitionEnd(e) }, data && searchable && (h("section", { class: "bcm-list__container-search" }, h("bcm-search", { size: size, id: `bcm-list-${_id}-search`, data: data, clearable: true, placeholder: searchPlaceholder, "min-search-length": minSearchLength, searchIsOnlyChilds: searchIsOnlyChilds }))), h("main", { onScroll: e => onScrollEvent(e), class: "scrolling", style: Object.assign({}, (type === 'select' && { 'overscroll-behavior': 'none' })) }, h("div", { style: setScrollHeight() }, checkAll && searchFound != 0 && items && items.length > 0 && checkboxes && showSelectAll && (h("section", { class: "bcm-list__container-select-all" }, h(ListItemTemplate, { size: size, item: selectAllItem, treeview: false, checkboxes: true, selectedItem: itemId => selectedItem(itemId), checkedItem: itemId => checkedItem(itemId), openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId), disabled: disabled, readonly: readonly }))), items.map((item) => (h(ListItemTemplate, { highlight: highlight, size: size, item: item, searchIsOnlyChilds: searchIsOnlyChilds, treeview: treeview, checkboxes: checkboxes, selectedItem: itemId => selectedItem(itemId), checkedItem: itemId => checkedItem(itemId), openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId), disabled: disabled, readonly: readonly }))), (!items || items.length === 0) && searchFound != 0 && (h("section", { class: "bcm-list__container-no-data" }, h("bcm-empty", { style: { height: 'auto' }, icon: emptyIcon }, h("span", { innerHTML: emptyText || 'No data' })))), searchFound == 0 && (h("section", { class: "bcm-list__container-no-data" }, h("bcm-empty", { style: { height: 'auto' }, icon: emptyIcon }, h("span", { innerHTML: emptyText || 'No Data Found' })))))), infoFooter && data && data.length > 0 && (h(InfoFooterTemplate, { selected: value === null || value === void 0 ? void 0 : value.length, total: totalData, found: searchFound, multiple: checkboxes, variableText: variableText }))));
|
|
17
17
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Built with Stencil
|
|
3
3
|
* Copyright (c) Bromcom.
|
|
4
4
|
*/
|
|
5
|
-
import { proxyCustomElement, HTMLElement,
|
|
5
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
6
6
|
import './color-helper.js';
|
|
7
7
|
import './validators.js';
|
|
8
8
|
import { G as Generate } from './generate.js';
|
|
@@ -10,6 +10,7 @@ import './number-helper.js';
|
|
|
10
10
|
import './string-helper.js';
|
|
11
11
|
import './element-dragger.js';
|
|
12
12
|
import './bcm.js';
|
|
13
|
+
import { d as defineCustomElement$8 } from './color-palette.js';
|
|
13
14
|
import { d as defineCustomElement$7 } from './colorful.js';
|
|
14
15
|
import { d as defineCustomElement$6 } from './icon.js';
|
|
15
16
|
import { d as defineCustomElement$5 } from './input.js';
|
|
@@ -17,6 +18,8 @@ import { d as defineCustomElement$4 } from './label.js';
|
|
|
17
18
|
import { d as defineCustomElement$3 } from './linked.js';
|
|
18
19
|
import { d as defineCustomElement$2 } from './tooltip.js';
|
|
19
20
|
|
|
21
|
+
const colorInputCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}:host{display:block}";
|
|
22
|
+
|
|
20
23
|
const BcmColorInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
21
24
|
constructor() {
|
|
22
25
|
super();
|
|
@@ -29,20 +32,13 @@ const BcmColorInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
29
32
|
this.disabled = false;
|
|
30
33
|
this.readonly = false;
|
|
31
34
|
this.fullWidth = false;
|
|
35
|
+
this.type = 'default';
|
|
32
36
|
}
|
|
33
37
|
handleChange(color) {
|
|
34
38
|
this.value = color;
|
|
35
|
-
this.getInputElement().setValue(color);
|
|
36
|
-
forceUpdate(this.el);
|
|
37
|
-
}
|
|
38
|
-
getInputElement() {
|
|
39
|
-
return this.el.querySelector(`bcm-input`);
|
|
40
|
-
}
|
|
41
|
-
getPickerElement() {
|
|
42
|
-
return document.querySelector("#" + this._id + "-picker");
|
|
43
39
|
}
|
|
44
|
-
handleInputChanged(
|
|
45
|
-
this.
|
|
40
|
+
handleInputChanged(value) {
|
|
41
|
+
this.value = value;
|
|
46
42
|
}
|
|
47
43
|
eyeDropper() {
|
|
48
44
|
const eyeDropper = new window.EyeDropper();
|
|
@@ -64,11 +60,12 @@ const BcmColorInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
64
60
|
return typeof window !== "undefined" && "EyeDropper" in window;
|
|
65
61
|
}
|
|
66
62
|
render() {
|
|
67
|
-
return (h(Host, { class: "tw-block" }, h("bcm-input", { id: this._id + "-color", fullWidth: this.fullWidth, label: this.label, placeholder: this.placeholder, type: "text", "onBcm-change":
|
|
63
|
+
return (h(Host, { class: "tw-block" }, h("bcm-input", { id: this._id + "-color", fullWidth: this.fullWidth, label: this.label, placeholder: this.placeholder, type: "text", disabled: this.disabled, readonly: this.readonly, "onBcm-change": ({ detail }) => this.handleInputChanged(detail), value: this.value }, h("i", { slot: "prefix", class: "tw-flex tw-h-4 tw-w-4 tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-solid tw-border-color-default", style: {
|
|
68
64
|
backgroundColor: this.value,
|
|
69
|
-
} }), this.isEyeDropperSupported() && h("i", { slot: "suffix", class: "far fa-eye-dropper", onClick: () => this.eyeDropper() })), h("bcm-linked", { targetId: this._id + "-color-container" }, h("bcm-colorful", { id: this._id + "-picker", color: this.value, onBcmChange:
|
|
65
|
+
} }), this.isEyeDropperSupported() && h("i", { slot: "suffix", class: "far fa-eye-dropper", onClick: () => this.eyeDropper() })), h("bcm-linked", { targetId: this._id + "-color-container" }, this.type === 'palette' ? (h("bcm-color-palette", { id: this._id + "-picker", value: this.value, "onBcm-change": ({ detail }) => this.handleChange(detail) })) : (h("bcm-colorful", { id: this._id + "-picker", color: this.value, onBcmChange: ({ detail }) => this.handleChange(detail) })))));
|
|
70
66
|
}
|
|
71
67
|
get el() { return this; }
|
|
68
|
+
static get style() { return colorInputCss; }
|
|
72
69
|
}, [0, "bcm-color-input", {
|
|
73
70
|
"_id": [1537, "id"],
|
|
74
71
|
"label": [1],
|
|
@@ -77,19 +74,25 @@ const BcmColorInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
77
74
|
"required": [4],
|
|
78
75
|
"disabled": [4],
|
|
79
76
|
"readonly": [4],
|
|
80
|
-
"fullWidth": [4, "full-width"]
|
|
77
|
+
"fullWidth": [4, "full-width"],
|
|
78
|
+
"type": [1]
|
|
81
79
|
}]);
|
|
82
80
|
function defineCustomElement$1() {
|
|
83
81
|
if (typeof customElements === "undefined") {
|
|
84
82
|
return;
|
|
85
83
|
}
|
|
86
|
-
const components = ["bcm-color-input", "bcm-colorful", "bcm-icon", "bcm-input", "bcm-label", "bcm-linked", "bcm-tooltip"];
|
|
84
|
+
const components = ["bcm-color-input", "bcm-color-palette", "bcm-colorful", "bcm-icon", "bcm-input", "bcm-label", "bcm-linked", "bcm-tooltip"];
|
|
87
85
|
components.forEach(tagName => { switch (tagName) {
|
|
88
86
|
case "bcm-color-input":
|
|
89
87
|
if (!customElements.get(tagName)) {
|
|
90
88
|
customElements.define(tagName, BcmColorInput$1);
|
|
91
89
|
}
|
|
92
90
|
break;
|
|
91
|
+
case "bcm-color-palette":
|
|
92
|
+
if (!customElements.get(tagName)) {
|
|
93
|
+
defineCustomElement$8();
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
93
96
|
case "bcm-colorful":
|
|
94
97
|
if (!customElements.get(tagName)) {
|
|
95
98
|
defineCustomElement$7();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BcmColorPalette extends Components.BcmColorPalette, HTMLElement {}
|
|
4
|
+
export const BcmColorPalette: {
|
|
5
|
+
prototype: BcmColorPalette;
|
|
6
|
+
new (): BcmColorPalette;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { B as BcmColorPalette$1, d as defineCustomElement$1 } from './color-palette.js';
|
|
6
|
+
|
|
7
|
+
const BcmColorPalette = BcmColorPalette$1;
|
|
8
|
+
const defineCustomElement = defineCustomElement$1;
|
|
9
|
+
|
|
10
|
+
export { BcmColorPalette, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BcmSegment extends Components.BcmSegment, HTMLElement {}
|
|
4
|
+
export const BcmSegment: {
|
|
5
|
+
prototype: BcmSegment;
|
|
6
|
+
new (): BcmSegment;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|