@synergy-design-system/mcp 2.2.0 → 2.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1164](https://github.com/synergy-design-system/synergy-design-system/pull/1164) [`c9fb440`](https://github.com/synergy-design-system/synergy-design-system/commit/c9fb4405c0a1eb3499e4753447ac643ae632ff56) Thanks [@kirchsuSICKAG](https://github.com/kirchsuSICKAG)! - Released on: 2026-02-05
8
+
9
+ feat: ✨ syn-combobox multiple (#627)
10
+
11
+ Adds multiple selection functionality to the `syn-combobox` component, enabling users to select multiple options simultaneously.
12
+
13
+ **Properties Added:**
14
+ - `multiple`: Enables multiple selection mode
15
+ - `delimiter`: Customizable value separator (default: ` ` (space))
16
+ - `max-options-visible`: Controls visible tag limit with overflow handling
17
+ - `getTag`: Custom tag rendering function
18
+
3
19
  ## 2.2.0
4
20
 
5
21
  ### Minor Changes
@@ -1 +1 @@
1
- 3007b6dfa99e8c9fc41b50602aa8e10e
1
+ 1a29dc1518c723ce97428da6e384beb8
@@ -27,12 +27,15 @@ import type { SynErrorEvent } from '@synergy-design-system/components';
27
27
  import '@synergy-design-system/components/components/combobox/combobox.js';
28
28
 
29
29
  /**
30
- * @summary Comboboxes allow you to choose items from a menu of predefined options.
30
+ * @summary A combobox component that combines the functionality of a text input with a dropdown listbox,
31
+ * allowing users to either select from predefined options or enter custom values (when not restricted).
32
+ *
31
33
  * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-combobox--docs
32
34
  * @status stable
33
35
  *
34
36
  * @dependency syn-icon
35
37
  * @dependency syn-popup
38
+ * @dependency syn-tag
36
39
  *
37
40
  * @slot - The listbox options. Must be `<syn-option>` elements.
38
41
  * You can use `<syn-optgroup>`'s to group items visually.
@@ -62,7 +65,7 @@ import '@synergy-design-system/components/components/combobox/combobox.js';
62
65
  * @csspart form-control-label - The label's wrapper.
63
66
  * @csspart form-control-input - The combobox's wrapper.
64
67
  * @csspart form-control-help-text - The help text's wrapper.
65
- * @csspart combobox - The container the wraps the prefix, combobox, clear icon, and expand button.
68
+ * @csspart combobox - The container that wraps the prefix, combobox, clear icon, and expand button.
66
69
  * @csspart prefix - The container that wraps the prefix slot.
67
70
  * @csspart suffix - The container that wraps the suffix slot.
68
71
  * @csspart display-input - The element that displays the selected option's label,
@@ -75,6 +78,12 @@ import '@synergy-design-system/components/components/combobox/combobox.js';
75
78
  * @csspart popup - The popup's exported `popup` part.
76
79
  * Use this to target the tooltip's popup container.
77
80
  * @csspart no-results - The container that wraps the "no results" message.
81
+ * @csspart tags - The container that houses option tags when `multiple` is used.
82
+ * @csspart tag - The individual tags that represent each selected option in `multiple`.
83
+ * @csspart tag__base - The tag's base part.
84
+ * @csspart tag__content - The tag's content part.
85
+ * @csspart tag__remove-button - The tag's remove button.
86
+ * @csspart tag__remove-button__base - The tag's remove button base part.
78
87
  *
79
88
  * @animation combobox.show - The animation to use when showing the combobox.
80
89
  * @animation combobox.hide - The animation to use when hiding the combobox.
@@ -168,17 +177,6 @@ export class SynComboboxComponent {
168
177
  return this.nativeElement.name;
169
178
  }
170
179
 
171
- /**
172
- * The current value of the combobox, submitted as a name/value pair with form data.
173
- */
174
- @Input()
175
- set value(v: SynCombobox['value']) {
176
- this._ngZone.runOutsideAngular(() => (this.nativeElement.value = v));
177
- }
178
- get value(): SynCombobox['value'] {
179
- return this.nativeElement.value;
180
- }
181
-
182
180
  /**
183
181
  * The combobox's size.
184
182
  */
@@ -308,6 +306,7 @@ The form must be in the same document or shadow root for this to work.
308
306
  /**
309
307
  * When set to `true`, restricts the combobox to only allow selection from the available options.
310
308
  Users will not be able to enter custom values that are not present in the list.
309
+ This will always be true, if `multiple` is active.
311
310
  */
312
311
  @Input()
313
312
  set restricted(v: '' | SynCombobox['restricted']) {
@@ -319,6 +318,20 @@ Users will not be able to enter custom values that are not present in the list.
319
318
  return this.nativeElement.restricted;
320
319
  }
321
320
 
321
+ /**
322
+ * Allows more than one option to be selected.
323
+ If `multiple` is set, the combobox will always be `restricted` to the available options
324
+ */
325
+ @Input()
326
+ set multiple(v: '' | SynCombobox['multiple']) {
327
+ this._ngZone.runOutsideAngular(
328
+ () => (this.nativeElement.multiple = v === '' || v),
329
+ );
330
+ }
331
+ get multiple(): SynCombobox['multiple'] {
332
+ return this.nativeElement.multiple;
333
+ }
334
+
322
335
  /**
323
336
  * A function that customizes the rendered option.
324
337
  * The first argument is the option, the second
@@ -347,6 +360,64 @@ The default filter method is a case- and diacritic-insensitive string comparison
347
360
  return this.nativeElement.filter;
348
361
  }
349
362
 
363
+ /**
364
+ * The delimiter to use when setting the value when `multiple` is enabled.
365
+ The default is a space ' ', but you can set it to a comma or other character(s).
366
+ */
367
+ @Input()
368
+ set delimiter(v: SynCombobox['delimiter']) {
369
+ this._ngZone.runOutsideAngular(() => (this.nativeElement.delimiter = v));
370
+ }
371
+ get delimiter(): SynCombobox['delimiter'] {
372
+ return this.nativeElement.delimiter;
373
+ }
374
+
375
+ /**
376
+ * The maximum number of selected options to show when `multiple` is true.
377
+ * After the maximum, "+n" will be shown to
378
+ indicate the number of additional items that are selected.
379
+ * Set to 0 to remove the limit.
380
+ */
381
+ @Input()
382
+ set maxOptionsVisible(v: SynCombobox['maxOptionsVisible']) {
383
+ this._ngZone.runOutsideAngular(
384
+ () => (this.nativeElement.maxOptionsVisible = v),
385
+ );
386
+ }
387
+ get maxOptionsVisible(): SynCombobox['maxOptionsVisible'] {
388
+ return this.nativeElement.maxOptionsVisible;
389
+ }
390
+
391
+ /**
392
+ * A function that customizes the tags to be rendered when `multiple` is true.
393
+ * The first argument is the option, the second
394
+ is the current tag's index.
395
+ * The function should return either a Lit TemplateResult or a string containing trusted HTML of the symbol to render at
396
+ the specified value.
397
+ */
398
+ @Input()
399
+ set getTag(v: SynCombobox['getTag']) {
400
+ this._ngZone.runOutsideAngular(() => (this.nativeElement.getTag = v));
401
+ }
402
+ get getTag(): SynCombobox['getTag'] {
403
+ return this.nativeElement.getTag;
404
+ }
405
+
406
+ /**
407
+ * The current value of the combobox, submitted as a name/value pair with form data.
408
+ * When `multiple` is enabled, the
409
+ value attribute will be a list of values separated by the delimiter, based on the options selected, and the value property will
410
+ be an array.
411
+ * **For this reason, values must not contain the delimiter character.**
412
+ */
413
+ @Input()
414
+ set value(v: SynCombobox['value']) {
415
+ this._ngZone.runOutsideAngular(() => (this.nativeElement.value = v));
416
+ }
417
+ get value(): SynCombobox['value'] {
418
+ return this.nativeElement.value;
419
+ }
420
+
350
421
  /**
351
422
  * Emitted when the control's value changes.
352
423
  */
@@ -2,6 +2,13 @@ import { css } from 'lit';
2
2
  import sharedOptionSize from '../option/option-size.styles.js';
3
3
 
4
4
  export default css`
5
+
6
+ .combobox__display-input {
7
+ flex: 1;
8
+ min-width: var(--syn-spacing-2x-large);
9
+ width: unset;
10
+ }
11
+
5
12
  .combobox:not(.combobox--disabled) .combobox__display-input {
6
13
  cursor: text;
7
14
  }
@@ -31,5 +38,85 @@ export default css`
31
38
  padding: 0 var(--syn-spacing-large) 0 68px;
32
39
  }
33
40
 
41
+ /* Multi Select */
42
+ .combobox__tags {
43
+ align-items: center;
44
+ display: flex;
45
+ flex-wrap: wrap;
46
+ margin-inline-start: var(--syn-spacing-2x-small);
47
+ }
48
+
49
+ .combobox__tags::slotted(syn-tag) {
50
+ cursor: pointer !important;
51
+ }
52
+
53
+ .combobox--disabled .combobox__tags,
54
+ .combobox--disabled .combobox__tags::slotted(syn-tag) {
55
+ cursor: not-allowed !important;
56
+ }
57
+
58
+ .combobox--small .combobox__tags {
59
+ gap: var(--syn-spacing-2x-small);
60
+ }
61
+
62
+ .combobox--medium .combobox__tags {
63
+ gap: var(--syn-spacing-x-small);
64
+ }
65
+
66
+ .combobox--large .combobox__tags {
67
+ gap: var(--syn-spacing-small);
68
+ }
69
+
70
+ .combobox--tags-visible.combobox--small .combobox__tags {
71
+ margin-inline-end: var(--syn-spacing-x-small);
72
+ }
73
+
74
+ .combobox--tags-visible.combobox--medium .combobox__tags {
75
+ margin-inline-end: var(--syn-input-spacing-small);
76
+ }
77
+
78
+ .combobox--tags-visible.combobox--large .combobox__tags {
79
+ margin-inline-end: var(--syn-input-spacing-medium);
80
+ }
81
+
82
+ /**
83
+ * #850: Allow to measure the size of the combobox.
84
+ * This is needed so we can automatically size and truncate the tags in the <syn-combobox multiple> component.
85
+ * Scoped to multiple to not break the single select per accident.
86
+ * Scoped to when placeholder is not visible to not break the placeholder visualization
87
+ */
88
+ :host([multiple]) :not(.combobox--placeholder-visible).combobox--tags-visible > .combobox__inputs > .combobox__tags {
89
+ min-width: 85px;
90
+ overflow: hidden;
91
+ }
92
+
93
+ :host([multiple]) .combobox__tags > div {
94
+ display: contents;
95
+ }
96
+
97
+ :host([multiple]) .combobox__tags > div > syn-tag {
98
+ --syn-tag-position-adjustment: var(--syn-spacing-3x-small);
99
+
100
+ max-width: var(--syn-select-tag-max-width);
101
+ }
102
+
103
+ :host([multiple]) .combobox__tags > div > syn-tag::part(content) {
104
+ display: initial;
105
+ overflow: hidden;
106
+ text-overflow: ellipsis;
107
+ white-space: nowrap;
108
+ }
109
+
110
+ /*
111
+ This class is needed to be able to hide the options as long as the popup close animation is running.
112
+ As otherwise the listbox would flicker because the options are shown again when the value is reset to empty string.
113
+ */
114
+ .options__hide {
115
+ /* We need to set the slot to something different than display: contents to be able to hide it. Also it should not take any space so we remove the height */
116
+ display: block;
117
+ height: 0;
118
+ opacity: 0;
119
+ }
120
+
34
121
  ${sharedOptionSize}
35
122
  `;
@@ -24,12 +24,15 @@ const tagName = 'syn-combobox';
24
24
  Component.define('syn-combobox');
25
25
 
26
26
  /**
27
- * @summary Comboboxes allow you to choose items from a menu of predefined options.
27
+ * @summary A combobox component that combines the functionality of a text input with a dropdown listbox,
28
+ * allowing users to either select from predefined options or enter custom values (when not restricted).
29
+ *
28
30
  * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-combobox--docs
29
31
  * @status stable
30
32
  *
31
33
  * @dependency syn-icon
32
34
  * @dependency syn-popup
35
+ * @dependency syn-tag
33
36
  *
34
37
  * @slot - The listbox options. Must be `<syn-option>` elements.
35
38
  * You can use `<syn-optgroup>`'s to group items visually.
@@ -59,7 +62,7 @@ Component.define('syn-combobox');
59
62
  * @csspart form-control-label - The label's wrapper.
60
63
  * @csspart form-control-input - The combobox's wrapper.
61
64
  * @csspart form-control-help-text - The help text's wrapper.
62
- * @csspart combobox - The container the wraps the prefix, combobox, clear icon, and expand button.
65
+ * @csspart combobox - The container that wraps the prefix, combobox, clear icon, and expand button.
63
66
  * @csspart prefix - The container that wraps the prefix slot.
64
67
  * @csspart suffix - The container that wraps the suffix slot.
65
68
  * @csspart display-input - The element that displays the selected option's label,
@@ -72,6 +75,12 @@ Component.define('syn-combobox');
72
75
  * @csspart popup - The popup's exported `popup` part.
73
76
  * Use this to target the tooltip's popup container.
74
77
  * @csspart no-results - The container that wraps the "no results" message.
78
+ * @csspart tags - The container that houses option tags when `multiple` is used.
79
+ * @csspart tag - The individual tags that represent each selected option in `multiple`.
80
+ * @csspart tag__base - The tag's base part.
81
+ * @csspart tag__content - The tag's content part.
82
+ * @csspart tag__remove-button - The tag's remove button.
83
+ * @csspart tag__remove-button__base - The tag's remove button base part.
75
84
  *
76
85
  * @animation combobox.show - The animation to use when showing the combobox.
77
86
  * @animation combobox.hide - The animation to use when hiding the combobox.
@@ -367,32 +367,4 @@ export default css`
367
367
  .combobox__listbox ::slotted(syn-optgroup:first-of-type) {
368
368
  --display-divider: none;
369
369
  }
370
-
371
- /**
372
- * #850: Allow to measure the size of the combobox.
373
- * This is needed so we can automatically size and truncate the tags in the <syn-combobox multiple> component.
374
- * Scoped to multiple to not break the single combobox per accident.
375
- * Scoped to when placeholder is not visible to not break the placeholder visualization
376
- */
377
- :host([multiple]) :not(.combobox--placeholder-visible) > .combobox__inputs > .combobox__tags {
378
- min-width: 100px;
379
- overflow: hidden;
380
- }
381
-
382
- :host([multiple]) .combobox__tags > div {
383
- display: contents;
384
- }
385
-
386
- :host([multiple]) .combobox__tags > div > syn-tag {
387
- --syn-tag-position-adjustment: var(--syn-spacing-3x-small);
388
-
389
- max-width: var(--syn-combobox-tag-max-width);
390
- }
391
-
392
- :host([multiple]) .combobox__tags > div > syn-tag::part(content) {
393
- display: initial;
394
- overflow: hidden;
395
- text-overflow: ellipsis;
396
- white-space: nowrap;
397
- }
398
370
  `;