@descope/web-components-ui 1.0.239 → 1.0.240
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +1418 -894
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1401 -877
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1438.js +374 -0
- package/dist/umd/1438.js.LICENSE.txt +5 -0
- package/dist/umd/1940.js +303 -0
- package/dist/umd/{849.js → 4595.js} +5 -5
- package/dist/umd/63.js +2 -0
- package/dist/umd/63.js.LICENSE.txt +5 -0
- package/dist/umd/6687.js +9 -0
- package/dist/umd/6687.js.LICENSE.txt +5 -0
- package/dist/umd/7583.js +113 -0
- package/dist/umd/{5977.js.LICENSE.txt → 7583.js.LICENSE.txt} +0 -6
- package/dist/umd/8866.js +183 -0
- package/dist/umd/8866.js.LICENSE.txt +11 -0
- package/dist/umd/9558.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +1 -1
- package/dist/umd/descope-grid-index-js.js +1 -1
- package/dist/umd/descope-modal-index-js.js +1 -1
- package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
- package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
- package/package.json +2 -1
- package/src/components/descope-multi-select-combo-box/MultiSelectComboBoxClass.js +488 -0
- package/src/components/descope-multi-select-combo-box/index.js +6 -0
- package/src/theme/components/index.js +2 -0
- package/src/theme/components/inputWrapper.js +4 -4
- package/src/theme/components/multiSelectComboBox.js +57 -0
- package/dist/umd/1932.js +0 -310
- package/dist/umd/5977.js +0 -294
- /package/dist/umd/{1932.js.LICENSE.txt → 1940.js.LICENSE.txt} +0 -0
- /package/dist/umd/{849.js.LICENSE.txt → 4595.js.LICENSE.txt} +0 -0
@@ -0,0 +1,488 @@
|
|
1
|
+
import { compose } from '../../helpers';
|
2
|
+
import {
|
3
|
+
forwardAttrs,
|
4
|
+
getComponentName,
|
5
|
+
observeAttributes,
|
6
|
+
observeChildren,
|
7
|
+
} from '../../helpers/componentHelpers';
|
8
|
+
import {
|
9
|
+
resetInputLabelPosition,
|
10
|
+
resetInputCursor,
|
11
|
+
resetInputPlaceholder,
|
12
|
+
resetInputReadonlyStyle,
|
13
|
+
useHostExternalPadding,
|
14
|
+
} from '../../helpers/themeHelpers/resetHelpers';
|
15
|
+
import {
|
16
|
+
createStyleMixin,
|
17
|
+
draggableMixin,
|
18
|
+
createProxy,
|
19
|
+
componentNameValidationMixin,
|
20
|
+
portalMixin,
|
21
|
+
proxyInputMixin,
|
22
|
+
} from '../../mixins';
|
23
|
+
|
24
|
+
export const componentName = getComponentName('multi-select-combo-box');
|
25
|
+
|
26
|
+
const MultiSelectComboBoxMixin = (superclass) =>
|
27
|
+
class MultiSelectComboBoxMixinClass extends superclass {
|
28
|
+
// eslint-disable-next-line class-methods-use-this
|
29
|
+
#renderItem = ({ displayName, value, label }) => {
|
30
|
+
return `<span data-name="${label}" data-id="${value}">${displayName || label}</span>`;
|
31
|
+
};
|
32
|
+
|
33
|
+
#data;
|
34
|
+
|
35
|
+
get defaultValues() {
|
36
|
+
const defaultValuesAttr = this.getAttribute('default-values');
|
37
|
+
if (defaultValuesAttr) {
|
38
|
+
try {
|
39
|
+
const defaultValues = JSON.parse(defaultValuesAttr);
|
40
|
+
if (this.isValidDataType(defaultValues)) {
|
41
|
+
return defaultValues;
|
42
|
+
}
|
43
|
+
} catch (e) {
|
44
|
+
// eslint-disable-next-line no-console
|
45
|
+
console.error('could not parse data string from attribute "default-values" -', e.message);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return [];
|
49
|
+
}
|
50
|
+
|
51
|
+
get renderItem() {
|
52
|
+
return this.#renderItem;
|
53
|
+
}
|
54
|
+
|
55
|
+
set renderItem(renderFn) {
|
56
|
+
this.#renderItem = renderFn;
|
57
|
+
this.renderItems();
|
58
|
+
}
|
59
|
+
|
60
|
+
get data() {
|
61
|
+
if (this.#data) return this.#data;
|
62
|
+
|
63
|
+
const dataAttr = this.getAttribute('data');
|
64
|
+
|
65
|
+
if (dataAttr) {
|
66
|
+
try {
|
67
|
+
const data = JSON.parse(dataAttr);
|
68
|
+
if (this.isValidDataType(data)) {
|
69
|
+
return data;
|
70
|
+
}
|
71
|
+
} catch (e) {
|
72
|
+
// eslint-disable-next-line no-console
|
73
|
+
console.error('could not parse data string from attribute "data" -', e.message);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
return [];
|
78
|
+
}
|
79
|
+
|
80
|
+
set data(data) {
|
81
|
+
if (this.isValidDataType(data)) {
|
82
|
+
this.#data = data;
|
83
|
+
this.renderItems();
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
get allowCustomValue() {
|
88
|
+
return this.getAttribute('allow-custom-value') === 'true';
|
89
|
+
}
|
90
|
+
|
91
|
+
// eslint-disable-next-line class-methods-use-this
|
92
|
+
isValidDataType(data) {
|
93
|
+
const isValid = Array.isArray(data);
|
94
|
+
if (!isValid) {
|
95
|
+
// eslint-disable-next-line no-console
|
96
|
+
console.error('data and default-values must be an array, received:', data);
|
97
|
+
}
|
98
|
+
|
99
|
+
return isValid;
|
100
|
+
}
|
101
|
+
|
102
|
+
getItemsTemplate() {
|
103
|
+
return this.data?.reduce?.((acc, item) => acc + (this.renderItem?.(item || {}) || ''), '');
|
104
|
+
}
|
105
|
+
|
106
|
+
renderItems() {
|
107
|
+
const template = this.getItemsTemplate();
|
108
|
+
if (template) this.innerHTML = template;
|
109
|
+
}
|
110
|
+
|
111
|
+
handleSelectedItems() {
|
112
|
+
const currentSelected =
|
113
|
+
this.baseElement.selectedItems?.map((item) => item.getAttribute('data-id')) || [];
|
114
|
+
|
115
|
+
this.baseElement.selectedItems = [];
|
116
|
+
|
117
|
+
// if previously selected item ID exists in current children, set it as selected
|
118
|
+
if (currentSelected.length > 0) {
|
119
|
+
this.value = currentSelected;
|
120
|
+
}
|
121
|
+
|
122
|
+
// otherwise, if default value is specified, set default value as selected item
|
123
|
+
if (this.value.length === 0) {
|
124
|
+
this.setDefaultValues();
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
// eslint-disable-next-line class-methods-use-this
|
129
|
+
customValueTransformFn(val) {
|
130
|
+
return val;
|
131
|
+
}
|
132
|
+
|
133
|
+
// We want to override Vaadin's Combo Box value setter. This is needed since Vaadin couples between the
|
134
|
+
// field that it searches the value, and the finaly display value of the input.
|
135
|
+
// We provide a custom transform function to override that behavior.
|
136
|
+
setComboBoxDescriptor() {
|
137
|
+
const valueDescriptor = Object.getOwnPropertyDescriptor(
|
138
|
+
this.inputElement.constructor.prototype,
|
139
|
+
'value'
|
140
|
+
);
|
141
|
+
|
142
|
+
const comboBox = this;
|
143
|
+
|
144
|
+
Object.defineProperties(this.inputElement, {
|
145
|
+
value: {
|
146
|
+
...valueDescriptor,
|
147
|
+
set(val) {
|
148
|
+
const transformedValue = comboBox.customValueTransformFn(val) || '';
|
149
|
+
|
150
|
+
if (transformedValue === this.value) {
|
151
|
+
return;
|
152
|
+
}
|
153
|
+
|
154
|
+
valueDescriptor.set.call(this, transformedValue);
|
155
|
+
},
|
156
|
+
},
|
157
|
+
});
|
158
|
+
}
|
159
|
+
|
160
|
+
// vaadin api is to set props on their combo box node,
|
161
|
+
// in order to avoid it, we are passing the children of this component
|
162
|
+
// to the items & renderer props, so it will be used as the combo box items
|
163
|
+
#onChildrenChange() {
|
164
|
+
const items = Array.from(this.children);
|
165
|
+
|
166
|
+
// we want the data-name attribute to be accessible as an object attribute
|
167
|
+
if (items.length) {
|
168
|
+
this.removeAttribute('has-no-options');
|
169
|
+
|
170
|
+
items.forEach((node) => {
|
171
|
+
Object.defineProperty(node, 'data-name', {
|
172
|
+
value: node.getAttribute('data-name'),
|
173
|
+
configurable: true,
|
174
|
+
writable: true,
|
175
|
+
});
|
176
|
+
Object.defineProperty(node, 'data-id', {
|
177
|
+
value: node.getAttribute('data-id'),
|
178
|
+
configurable: true,
|
179
|
+
writable: true,
|
180
|
+
});
|
181
|
+
});
|
182
|
+
|
183
|
+
this.baseElement.items = items;
|
184
|
+
|
185
|
+
setTimeout(() => {
|
186
|
+
// set timeout to ensure this runs after customValueTransformFn had the chance to be overriden
|
187
|
+
this.handleSelectedItems();
|
188
|
+
}, 0);
|
189
|
+
} else {
|
190
|
+
this.baseElement.items = [];
|
191
|
+
this.setAttribute('has-no-options', '');
|
192
|
+
}
|
193
|
+
|
194
|
+
// use vaadin combobox custom renderer to render options as HTML
|
195
|
+
// and not via default renderer, which renders only the data-name's value
|
196
|
+
// in its own HTML template
|
197
|
+
this.baseElement.renderer = (root, combo, model) => {
|
198
|
+
// eslint-disable-next-line no-param-reassign
|
199
|
+
root.innerHTML = model.item.outerHTML;
|
200
|
+
};
|
201
|
+
}
|
202
|
+
|
203
|
+
// the default vaadin behavior is to attach the overlay to the body when opened
|
204
|
+
// we do not want that because it's difficult to style the overlay in this way
|
205
|
+
// so we override it to open inside the shadow DOM
|
206
|
+
#overrideOverlaySettings() {
|
207
|
+
const overlay = this.baseElement.shadowRoot
|
208
|
+
.querySelector('vaadin-multi-select-combo-box-internal')
|
209
|
+
.shadowRoot.querySelector('vaadin-multi-select-combo-box-overlay');
|
210
|
+
overlay._attachOverlay = () => {
|
211
|
+
overlay.bringToFront();
|
212
|
+
};
|
213
|
+
overlay._detachOverlay = () => {};
|
214
|
+
overlay._enterModalState = () => {};
|
215
|
+
}
|
216
|
+
|
217
|
+
#handleCustomValues() {
|
218
|
+
if (this.allowCustomValue) {
|
219
|
+
this.baseElement.addEventListener('custom-value-set', (e) => {
|
220
|
+
const newItemHtml = this.#renderItem({
|
221
|
+
label: e.detail,
|
222
|
+
displayName: e.detail,
|
223
|
+
value: e.detail,
|
224
|
+
});
|
225
|
+
this.innerHTML += newItemHtml;
|
226
|
+
// The value needs to be set with a timeout because it needs to execute after
|
227
|
+
// the custom value is added to items by the children change observer
|
228
|
+
setTimeout(() => {
|
229
|
+
this.value = [...this.value, e.detail];
|
230
|
+
}, 0);
|
231
|
+
});
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
init() {
|
236
|
+
super.init?.();
|
237
|
+
|
238
|
+
// eslint-disable-next-line func-names
|
239
|
+
this.getValidity = function () {
|
240
|
+
if (!this.value.length && this.isRequired) {
|
241
|
+
return {
|
242
|
+
valueMissing: true,
|
243
|
+
};
|
244
|
+
}
|
245
|
+
return {};
|
246
|
+
};
|
247
|
+
|
248
|
+
this.setComboBoxDescriptor();
|
249
|
+
|
250
|
+
this.#overrideOverlaySettings();
|
251
|
+
|
252
|
+
this.#handleCustomValues();
|
253
|
+
|
254
|
+
this.renderItems();
|
255
|
+
|
256
|
+
observeAttributes(this, this.renderItems.bind(this), { includeAttrs: ['data'] });
|
257
|
+
|
258
|
+
observeChildren(this, this.#onChildrenChange.bind(this));
|
259
|
+
|
260
|
+
// Note: we need to forward the `placeholder` because the vaadin component observes it and
|
261
|
+
// tries to override it, causing us to lose the user set placeholder.
|
262
|
+
forwardAttrs(this, this.baseElement, { includeAttrs: ['placeholder'] });
|
263
|
+
|
264
|
+
this.setDefaultValues();
|
265
|
+
}
|
266
|
+
|
267
|
+
setDefaultValues() {
|
268
|
+
this.value = this.defaultValues;
|
269
|
+
}
|
270
|
+
|
271
|
+
set value(vals) {
|
272
|
+
if (vals && vals.length > 0) {
|
273
|
+
const children = this.baseElement.items?.filter((item) => vals.includes(item['data-id']));
|
274
|
+
|
275
|
+
if (children?.length > 0) {
|
276
|
+
this.baseElement.selectedItems = children;
|
277
|
+
}
|
278
|
+
} else {
|
279
|
+
this.baseElement.selectedItems = [];
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
get value() {
|
284
|
+
return this.baseElement.selectedItems.map((elem) => elem.getAttribute('data-id')) || [];
|
285
|
+
}
|
286
|
+
};
|
287
|
+
|
288
|
+
const {
|
289
|
+
host,
|
290
|
+
inputField,
|
291
|
+
inputElement,
|
292
|
+
placeholder,
|
293
|
+
toggle,
|
294
|
+
label,
|
295
|
+
requiredIndicator,
|
296
|
+
helperText,
|
297
|
+
errorMessage,
|
298
|
+
chip,
|
299
|
+
chipLabel,
|
300
|
+
overflowChipFirstBorder,
|
301
|
+
overflowChipSecondBorder,
|
302
|
+
} = {
|
303
|
+
host: { selector: () => ':host' },
|
304
|
+
inputField: { selector: '::part(input-field)' },
|
305
|
+
inputElement: { selector: 'input' },
|
306
|
+
placeholder: { selector: '> input:placeholder-shown' },
|
307
|
+
toggle: { selector: '::part(toggle-button)' },
|
308
|
+
label: { selector: '::part(label)' },
|
309
|
+
requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
|
310
|
+
helperText: { selector: '::part(helper-text)' },
|
311
|
+
errorMessage: { selector: '::part(error-message)' },
|
312
|
+
chip: { selector: 'vaadin-multi-select-combo-box-chip' },
|
313
|
+
chipLabel: { selector: 'vaadin-multi-select-combo-box-chip::part(label)' },
|
314
|
+
overflowChipFirstBorder: {
|
315
|
+
selector: "vaadin-multi-select-combo-box-chip[slot='overflow']::before",
|
316
|
+
},
|
317
|
+
overflowChipSecondBorder: {
|
318
|
+
selector: "vaadin-multi-select-combo-box-chip[slot='overflow']::after",
|
319
|
+
},
|
320
|
+
};
|
321
|
+
|
322
|
+
export const MultiSelectComboBoxClass = compose(
|
323
|
+
createStyleMixin({
|
324
|
+
mappings: {
|
325
|
+
hostWidth: { ...host, property: 'width' },
|
326
|
+
hostDirection: { ...host, property: 'direction' },
|
327
|
+
// we apply font-size also on the host so we can set its width with em
|
328
|
+
fontSize: [{}, host],
|
329
|
+
chipFontSize: { ...chipLabel, property: 'font-size' },
|
330
|
+
fontFamily: [label, placeholder, inputField, helperText, errorMessage, chipLabel],
|
331
|
+
labelTextColor: [
|
332
|
+
{ ...label, property: 'color' },
|
333
|
+
{ ...requiredIndicator, property: 'color' },
|
334
|
+
],
|
335
|
+
errorMessageTextColor: { ...errorMessage, property: 'color' },
|
336
|
+
inputHeight: { ...inputField, property: 'min-height' },
|
337
|
+
inputBackgroundColor: { ...inputField, property: 'background-color' },
|
338
|
+
inputBorderColor: { ...inputField, property: 'border-color' },
|
339
|
+
inputBorderWidth: { ...inputField, property: 'border-width' },
|
340
|
+
inputBorderStyle: { ...inputField, property: 'border-style' },
|
341
|
+
inputBorderRadius: { ...inputField, property: 'border-radius' },
|
342
|
+
labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
|
343
|
+
inputValueTextColor: { ...inputField, property: 'color' },
|
344
|
+
inputPlaceholderTextColor: { ...placeholder, property: 'color' },
|
345
|
+
inputDropdownButtonCursor: { ...toggle, property: 'cursor' },
|
346
|
+
inputDropdownButtonColor: { ...toggle, property: 'color' },
|
347
|
+
inputDropdownButtonSize: { ...toggle, property: 'font-size' },
|
348
|
+
inputDropdownButtonOffset: [
|
349
|
+
{ ...toggle, property: 'margin-right' },
|
350
|
+
{ ...toggle, property: 'margin-left' },
|
351
|
+
],
|
352
|
+
inputOutlineColor: { ...inputField, property: 'outline-color' },
|
353
|
+
inputOutlineWidth: { ...inputField, property: 'outline-width' },
|
354
|
+
inputOutlineStyle: { ...inputField, property: 'outline-style' },
|
355
|
+
inputOutlineOffset: { ...inputField, property: 'outline-offset' },
|
356
|
+
inputHorizontalPadding: [
|
357
|
+
{ ...inputElement, property: 'padding-left' },
|
358
|
+
{ ...inputElement, property: 'padding-right' },
|
359
|
+
{ ...inputField, property: 'padding-inline-start' },
|
360
|
+
],
|
361
|
+
inputVerticalPadding: [
|
362
|
+
{ ...inputField, property: 'padding-top' },
|
363
|
+
{ ...inputField, property: 'padding-bottom' },
|
364
|
+
],
|
365
|
+
chipTextColor: { ...chipLabel, property: 'color' },
|
366
|
+
chipBackgroundColor: [
|
367
|
+
{ ...chip, property: 'background-color' },
|
368
|
+
{ ...overflowChipFirstBorder, property: 'border-color' },
|
369
|
+
{ ...overflowChipSecondBorder, property: 'border-color' },
|
370
|
+
],
|
371
|
+
|
372
|
+
// we need to use the variables from the portal mixin
|
373
|
+
// so we need to use an arrow function on the selector
|
374
|
+
// for that to work, because ComboBox is not available
|
375
|
+
// at this time.
|
376
|
+
overlayBackground: {
|
377
|
+
property: () => MultiSelectComboBoxClass.cssVarList.overlay.backgroundColor,
|
378
|
+
},
|
379
|
+
overlayBorder: { property: () => MultiSelectComboBoxClass.cssVarList.overlay.border },
|
380
|
+
overlayFontSize: { property: () => MultiSelectComboBoxClass.cssVarList.overlay.fontSize },
|
381
|
+
overlayFontFamily: { property: () => MultiSelectComboBoxClass.cssVarList.overlay.fontFamily },
|
382
|
+
overlayCursor: { property: () => MultiSelectComboBoxClass.cssVarList.overlay.cursor },
|
383
|
+
overlayItemBoxShadow: {
|
384
|
+
property: () => MultiSelectComboBoxClass.cssVarList.overlay.itemBoxShadow,
|
385
|
+
},
|
386
|
+
overlayItemPaddingInlineStart: {
|
387
|
+
property: () => MultiSelectComboBoxClass.cssVarList.overlay.itemPaddingInlineStart,
|
388
|
+
},
|
389
|
+
overlayItemPaddingInlineEnd: {
|
390
|
+
property: () => MultiSelectComboBoxClass.cssVarList.overlay.itemPaddingInlineEnd,
|
391
|
+
},
|
392
|
+
},
|
393
|
+
}),
|
394
|
+
draggableMixin,
|
395
|
+
portalMixin({
|
396
|
+
name: 'overlay',
|
397
|
+
selector: 'vaadin-multi-select-combo-box-internal',
|
398
|
+
mappings: {
|
399
|
+
backgroundColor: { selector: 'vaadin-multi-select-combo-box-scroller' },
|
400
|
+
minHeight: { selector: 'vaadin-multi-select-combo-box-overlay' },
|
401
|
+
margin: { selector: 'vaadin-multi-select-combo-box-overlay' },
|
402
|
+
cursor: { selector: 'vaadin-multi-select-combo-box-item' },
|
403
|
+
fontFamily: { selector: 'vaadin-multi-select-combo-box-item' },
|
404
|
+
fontSize: { selector: 'vaadin-multi-select-combo-box-item' },
|
405
|
+
itemBoxShadow: { selector: 'vaadin-multi-select-combo-box-item', property: 'box-shadow' },
|
406
|
+
itemPaddingInlineStart: {
|
407
|
+
selector: 'vaadin-multi-select-combo-box-item',
|
408
|
+
property: 'padding-inline-start',
|
409
|
+
},
|
410
|
+
itemPaddingInlineEnd: {
|
411
|
+
selector: 'vaadin-multi-select-combo-box-item',
|
412
|
+
property: 'padding-inline-end',
|
413
|
+
},
|
414
|
+
},
|
415
|
+
forward: {
|
416
|
+
include: false,
|
417
|
+
attributes: ['size'],
|
418
|
+
},
|
419
|
+
}),
|
420
|
+
proxyInputMixin({ proxyProps: ['selectionStart'], inputEvent: 'selected-items-changed' }),
|
421
|
+
componentNameValidationMixin,
|
422
|
+
MultiSelectComboBoxMixin
|
423
|
+
)(
|
424
|
+
createProxy({
|
425
|
+
slots: ['', 'prefix'],
|
426
|
+
wrappedEleName: 'vaadin-multi-select-combo-box',
|
427
|
+
style: () => `
|
428
|
+
:host {
|
429
|
+
display: inline-flex;
|
430
|
+
box-sizing: border-box;
|
431
|
+
-webkit-mask-image: none;
|
432
|
+
}
|
433
|
+
${useHostExternalPadding(MultiSelectComboBoxClass.cssVarList)}
|
434
|
+
${resetInputReadonlyStyle('vaadin-multi-select-combo-box')}
|
435
|
+
${resetInputPlaceholder('vaadin-multi-select-combo-box')}
|
436
|
+
${resetInputCursor('vaadin-multi-select-combo-box')}
|
437
|
+
|
438
|
+
vaadin-multi-select-combo-box {
|
439
|
+
padding: 0;
|
440
|
+
width: 100%;
|
441
|
+
}
|
442
|
+
vaadin-multi-select-combo-box::before {
|
443
|
+
height: initial;
|
444
|
+
}
|
445
|
+
vaadin-multi-select-combo-box [slot="input"] {
|
446
|
+
-webkit-mask-image: none;
|
447
|
+
min-height: 0;
|
448
|
+
align-self: center;
|
449
|
+
box-sizing: border-box;
|
450
|
+
}
|
451
|
+
|
452
|
+
::part(input-field) {
|
453
|
+
padding: 0;
|
454
|
+
box-shadow: none;
|
455
|
+
}
|
456
|
+
${resetInputLabelPosition('vaadin-multi-select-combo-box')}
|
457
|
+
:host([has-label]) vaadin-multi-select-combo-box-chip::part(label) {
|
458
|
+
display: block;
|
459
|
+
}
|
460
|
+
|
461
|
+
vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::before,
|
462
|
+
vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::after {
|
463
|
+
left: -4px;
|
464
|
+
right: -4px;
|
465
|
+
border-left-width: 0;
|
466
|
+
border-inline-start-style: solid;
|
467
|
+
border-inline-start-width: 2px;
|
468
|
+
}
|
469
|
+
vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::after {
|
470
|
+
left: -8px;
|
471
|
+
right: -8px;
|
472
|
+
}
|
473
|
+
|
474
|
+
:host([has-no-options][allow-custom-value='true']) ::part(toggle-button) {
|
475
|
+
display: none;
|
476
|
+
}
|
477
|
+
`,
|
478
|
+
// Note: we exclude `size` to avoid overriding Vaadin's ComboBox property
|
479
|
+
// with the same name. Including it will cause Vaadin to calculate NaN size,
|
480
|
+
// and reset items to an empty array, and opening the list box with no items
|
481
|
+
// to display.
|
482
|
+
// Note: we exclude `placeholder` because the vaadin component observes it and
|
483
|
+
// tries to override it, causing us to lose the user set placeholder.
|
484
|
+
excludeAttrsSync: ['tabindex', 'size', 'data', 'placeholder'],
|
485
|
+
componentName,
|
486
|
+
includeForwardProps: ['items', 'renderer', 'selectedItems'],
|
487
|
+
})
|
488
|
+
);
|
@@ -26,6 +26,7 @@ import * as buttonSelectionGroup from './buttonSelectionGroup/buttonSelectionGro
|
|
26
26
|
import * as modal from './modal';
|
27
27
|
import * as grid from './grid';
|
28
28
|
import * as notificationCard from './notificationCard';
|
29
|
+
import * as multiSelectComboBox from './multiSelectComboBox';
|
29
30
|
import * as badge from './badge';
|
30
31
|
|
31
32
|
const components = {
|
@@ -58,6 +59,7 @@ const components = {
|
|
58
59
|
modal,
|
59
60
|
grid,
|
60
61
|
notificationCard,
|
62
|
+
multiSelectComboBox,
|
61
63
|
badge,
|
62
64
|
};
|
63
65
|
|
@@ -35,10 +35,10 @@ const [theme, refs, vars] = createHelperVars(
|
|
35
35
|
direction: globalRefs.direction,
|
36
36
|
|
37
37
|
size: {
|
38
|
-
xs: { fontSize: '12px' },
|
39
|
-
sm: { fontSize: '14px' },
|
40
|
-
md: { fontSize: '16px' },
|
41
|
-
lg: { fontSize: '18px' },
|
38
|
+
xs: { fontSize: '12px', chipFontSize: '10px' },
|
39
|
+
sm: { fontSize: '14px', chipFontSize: '12px' },
|
40
|
+
md: { fontSize: '16px', chipFontSize: '14px' },
|
41
|
+
lg: { fontSize: '18px', chipFontSize: '16px' },
|
42
42
|
},
|
43
43
|
|
44
44
|
_fullWidth: {
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import globals from '../globals';
|
2
|
+
import { MultiSelectComboBoxClass } from '../../components/descope-multi-select-combo-box/MultiSelectComboBoxClass';
|
3
|
+
import { getThemeRefs } from '../../helpers/themeHelpers';
|
4
|
+
import { refs } from './inputWrapper';
|
5
|
+
|
6
|
+
const globalRefs = getThemeRefs(globals);
|
7
|
+
const vars = MultiSelectComboBoxClass.cssVarList;
|
8
|
+
|
9
|
+
export const multiSelectComboBox = {
|
10
|
+
[vars.hostWidth]: refs.width,
|
11
|
+
[vars.hostDirection]: refs.direction,
|
12
|
+
[vars.fontSize]: refs.fontSize,
|
13
|
+
[vars.fontFamily]: refs.fontFamily,
|
14
|
+
[vars.labelTextColor]: refs.labelTextColor,
|
15
|
+
[vars.errorMessageTextColor]: refs.errorMessageTextColor,
|
16
|
+
[vars.inputBorderColor]: refs.borderColor,
|
17
|
+
[vars.inputBorderWidth]: refs.borderWidth,
|
18
|
+
[vars.inputBorderStyle]: refs.borderStyle,
|
19
|
+
[vars.inputBorderRadius]: refs.borderRadius,
|
20
|
+
[vars.inputOutlineColor]: refs.outlineColor,
|
21
|
+
[vars.inputOutlineOffset]: refs.outlineOffset,
|
22
|
+
[vars.inputOutlineWidth]: refs.outlineWidth,
|
23
|
+
[vars.inputOutlineStyle]: refs.outlineStyle,
|
24
|
+
[vars.labelRequiredIndicator]: refs.requiredIndicator,
|
25
|
+
[vars.inputValueTextColor]: refs.valueTextColor,
|
26
|
+
[vars.inputPlaceholderTextColor]: refs.placeholderTextColor,
|
27
|
+
[vars.inputBackgroundColor]: refs.backgroundColor,
|
28
|
+
[vars.inputHorizontalPadding]: refs.horizontalPadding,
|
29
|
+
[vars.inputVerticalPadding]: refs.verticalPadding,
|
30
|
+
[vars.inputHeight]: refs.inputHeight,
|
31
|
+
[vars.inputDropdownButtonColor]: globalRefs.colors.surface.contrast,
|
32
|
+
[vars.inputDropdownButtonCursor]: 'pointer',
|
33
|
+
[vars.inputDropdownButtonSize]: refs.toggleButtonSize,
|
34
|
+
[vars.inputDropdownButtonOffset]: globalRefs.spacing.xs,
|
35
|
+
[vars.overlayItemPaddingInlineStart]: globalRefs.spacing.xs,
|
36
|
+
[vars.overlayItemPaddingInlineEnd]: globalRefs.spacing.lg,
|
37
|
+
[vars.chipFontSize]: refs.chipFontSize,
|
38
|
+
[vars.chipTextColor]: refs.valueTextColor,
|
39
|
+
[vars.chipBackgroundColor]: globalRefs.colors.surface.main,
|
40
|
+
|
41
|
+
_readonly: {
|
42
|
+
[vars.inputDropdownButtonCursor]: 'default',
|
43
|
+
},
|
44
|
+
|
45
|
+
// Overlay theme exposed via the component:
|
46
|
+
[vars.overlayFontSize]: refs.fontSize,
|
47
|
+
[vars.overlayFontFamily]: refs.fontFamily,
|
48
|
+
[vars.overlayCursor]: 'pointer',
|
49
|
+
[vars.overlayItemBoxShadow]: 'none',
|
50
|
+
|
51
|
+
// Overlay direct theme:
|
52
|
+
[vars.overlay.minHeight]: '400px',
|
53
|
+
[vars.overlay.margin]: '0',
|
54
|
+
};
|
55
|
+
|
56
|
+
export default multiSelectComboBox;
|
57
|
+
export { vars };
|