@synergy-design-system/mcp 1.6.0 → 1.6.1
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 +7 -0
- package/metadata/checksum.txt +1 -1
- package/metadata/packages/components/components/syn-combobox/component.angular.ts +2 -0
- package/metadata/packages/components/components/syn-combobox/component.ts +1 -0
- package/metadata/packages/components/components/syn-combobox/component.vue +2 -0
- package/metadata/packages/components/components/syn-dropdown/component.angular.ts +2 -0
- package/metadata/packages/components/components/syn-dropdown/component.ts +1 -0
- package/metadata/packages/components/components/syn-dropdown/component.vue +2 -0
- package/metadata/packages/components/components/syn-popup/component.angular.ts +3 -0
- package/metadata/packages/components/components/syn-popup/component.custom.styles.ts +18 -0
- package/metadata/packages/components/components/syn-popup/component.ts +17 -4
- package/metadata/packages/components/components/syn-popup/component.vue +3 -0
- package/metadata/packages/components/components/syn-select/component.angular.ts +2 -0
- package/metadata/packages/components/components/syn-select/component.ts +1 -0
- package/metadata/packages/components/components/syn-select/component.vue +2 -0
- package/metadata/packages/components/components/syn-tooltip/component.angular.ts +2 -0
- package/metadata/packages/components/components/syn-tooltip/component.ts +1 -0
- package/metadata/packages/components/components/syn-tooltip/component.vue +2 -0
- package/metadata/packages/components/static/CHANGELOG.md +7 -0
- package/metadata/packages/tokens/CHANGELOG.md +7 -0
- package/metadata/packages/tokens/dark.css +1 -1
- package/metadata/packages/tokens/index.js +1 -1
- package/metadata/packages/tokens/light.css +1 -1
- package/metadata/packages/tokens/sick2018_dark.css +1 -1
- package/metadata/packages/tokens/sick2018_light.css +1 -1
- package/metadata/packages/tokens/sick2025_dark.css +1 -1
- package/metadata/packages/tokens/sick2025_light.css +1 -1
- package/metadata/static/components/syn-popup/docs.md +831 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@synergy-design-system/mcp-v1.6.1](https://github.com/synergy-design-system/synergy-design-system/compare/mcp/1.6.0...mcp/1.6.1) (2025-09-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 🐛 Synergy element which use syn-popup may break if used in a stacking context ([#1034](https://github.com/synergy-design-system/synergy-design-system/issues/1034)) ([8d23dc7](https://github.com/synergy-design-system/synergy-design-system/commit/8d23dc737e36065a0208bc01a98981541540d0ef))
|
|
7
|
+
|
|
1
8
|
# [@synergy-design-system/mcp-v1.6.0](https://github.com/synergy-design-system/synergy-design-system/compare/mcp/1.5.0...mcp/1.6.0) (2025-09-24)
|
|
2
9
|
|
|
3
10
|
|
package/metadata/checksum.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
265c7f6e05d6b1c319e3d8accbb4f950
|
|
@@ -246,6 +246,8 @@ and `hide()` methods and this attribute will reflect the combobox's open state.
|
|
|
246
246
|
* Enable this option to prevent the listbox from being clipped,
|
|
247
247
|
when the component is placed inside a container with `overflow: auto|scroll`.
|
|
248
248
|
Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
249
|
+
|
|
250
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
249
251
|
*/
|
|
250
252
|
@Input()
|
|
251
253
|
set hoist(v: '' | SynCombobox['hoist']) {
|
|
@@ -173,6 +173,7 @@ export default class SynCombobox extends SynergyElement implements SynergyFormCo
|
|
|
173
173
|
* Enable this option to prevent the listbox from being clipped,
|
|
174
174
|
* when the component is placed inside a container with `overflow: auto|scroll`.
|
|
175
175
|
* Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
176
|
+
* @deprecated This property is deprecated and will be removed in the next major version.
|
|
176
177
|
*/
|
|
177
178
|
@property({ type: Boolean }) hoist = false;
|
|
178
179
|
|
|
@@ -124,6 +124,8 @@ and `hide()` methods and this attribute will reflect the combobox's open state.
|
|
|
124
124
|
* Enable this option to prevent the listbox from being clipped,
|
|
125
125
|
when the component is placed inside a container with `overflow: auto|scroll`.
|
|
126
126
|
Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
127
|
+
|
|
128
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
127
129
|
*/
|
|
128
130
|
hoist?: SynCombobox['hoist'];
|
|
129
131
|
|
|
@@ -158,6 +158,8 @@ dropdowns that allow for multiple interactions.
|
|
|
158
158
|
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
159
159
|
`overflow: auto|scroll`.
|
|
160
160
|
* Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
161
|
+
|
|
162
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
161
163
|
*/
|
|
162
164
|
@Input()
|
|
163
165
|
set hoist(v: '' | SynDropdown['hoist']) {
|
|
@@ -111,6 +111,7 @@ export default class SynDropdown extends SynergyElement {
|
|
|
111
111
|
/**
|
|
112
112
|
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
113
113
|
* `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
114
|
+
* @deprecated This property is deprecated and will be removed in the next major version.
|
|
114
115
|
*/
|
|
115
116
|
@property({ type: Boolean }) hoist = false;
|
|
116
117
|
|
|
@@ -88,6 +88,8 @@ dropdowns that allow for multiple interactions.
|
|
|
88
88
|
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
89
89
|
`overflow: auto|scroll`.
|
|
90
90
|
* Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
91
|
+
|
|
92
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
91
93
|
*/
|
|
92
94
|
hoist?: SynDropdown['hoist'];
|
|
93
95
|
|
|
@@ -112,6 +112,9 @@ panel inside of the viewport.
|
|
|
112
112
|
* Determines how the popup is positioned.
|
|
113
113
|
* The `absolute` strategy works well in most cases, but if overflow is
|
|
114
114
|
clipped, using a `fixed` position strategy can often workaround it.
|
|
115
|
+
|
|
116
|
+
@deprecated The strategy property is deprecated and will be removed in future versions.
|
|
117
|
+
* Modern browsers support the popover element which is used internally instead.
|
|
115
118
|
*/
|
|
116
119
|
@Input()
|
|
117
120
|
set strategy(v: SynPopup['strategy']) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
.popup {
|
|
5
|
+
/* Clear UA styles for [popover] */
|
|
6
|
+
:where(&) {
|
|
7
|
+
background: unset;
|
|
8
|
+
border: unset;
|
|
9
|
+
color: unset;
|
|
10
|
+
height: unset;
|
|
11
|
+
inset: unset;
|
|
12
|
+
margin: unset;
|
|
13
|
+
overflow: unset;
|
|
14
|
+
padding: unset;
|
|
15
|
+
width: unset;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
/* eslint-disable */
|
|
9
9
|
import { arrow, autoUpdate, computePosition, flip, offset, platform, shift, size } from '@floating-ui/dom';
|
|
10
10
|
import { classMap } from 'lit/directives/class-map.js';
|
|
11
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
12
|
import { html } from 'lit';
|
|
12
13
|
import { LocalizeController } from '../../utilities/localize.js';
|
|
13
14
|
import { offsetParent } from 'composed-offset-position';
|
|
@@ -15,8 +16,11 @@ import { property, query } from 'lit/decorators.js';
|
|
|
15
16
|
import componentStyles from '../../styles/component.styles.js';
|
|
16
17
|
import SynergyElement from '../../internal/synergy-element.js';
|
|
17
18
|
import styles from './popup.styles.js';
|
|
19
|
+
import customStyles from './popup.custom.styles.js';
|
|
18
20
|
import type { CSSResultGroup } from 'lit';
|
|
19
21
|
|
|
22
|
+
const SUPPORTS_POPOVER = globalThis?.HTMLElement?.prototype.hasOwnProperty('popover');
|
|
23
|
+
|
|
20
24
|
export interface VirtualElement {
|
|
21
25
|
getBoundingClientRect: () => DOMRect;
|
|
22
26
|
contextElement?: Element;
|
|
@@ -61,7 +65,7 @@ function isVirtualElement(e: unknown): e is VirtualElement {
|
|
|
61
65
|
* available when using `auto-size`.
|
|
62
66
|
*/
|
|
63
67
|
export default class SynPopup extends SynergyElement {
|
|
64
|
-
static styles: CSSResultGroup = [componentStyles, styles];
|
|
68
|
+
static styles: CSSResultGroup = [componentStyles, styles, customStyles];
|
|
65
69
|
|
|
66
70
|
private anchorEl: Element | VirtualElement | null;
|
|
67
71
|
private cleanup: ReturnType<typeof autoUpdate> | undefined;
|
|
@@ -105,6 +109,7 @@ export default class SynPopup extends SynergyElement {
|
|
|
105
109
|
/**
|
|
106
110
|
* Determines how the popup is positioned. The `absolute` strategy works well in most cases, but if overflow is
|
|
107
111
|
* clipped, using a `fixed` position strategy can often workaround it.
|
|
112
|
+
* @deprecated The strategy property is deprecated and will be removed in future versions. Modern browsers support the popover element which is used internally instead.
|
|
108
113
|
*/
|
|
109
114
|
@property({ reflect: true }) strategy: 'absolute' | 'fixed' = 'absolute';
|
|
110
115
|
|
|
@@ -285,6 +290,10 @@ export default class SynPopup extends SynergyElement {
|
|
|
285
290
|
return;
|
|
286
291
|
}
|
|
287
292
|
|
|
293
|
+
if (SUPPORTS_POPOVER) {
|
|
294
|
+
this.popup.showPopover?.();
|
|
295
|
+
}
|
|
296
|
+
|
|
288
297
|
this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {
|
|
289
298
|
this.reposition();
|
|
290
299
|
});
|
|
@@ -292,6 +301,9 @@ export default class SynPopup extends SynergyElement {
|
|
|
292
301
|
|
|
293
302
|
private async stop(): Promise<void> {
|
|
294
303
|
return new Promise(resolve => {
|
|
304
|
+
if (SUPPORTS_POPOVER) {
|
|
305
|
+
this.popup.hidePopover?.();
|
|
306
|
+
}
|
|
295
307
|
if (this.cleanup) {
|
|
296
308
|
this.cleanup();
|
|
297
309
|
this.cleanup = undefined;
|
|
@@ -404,14 +416,14 @@ export default class SynPopup extends SynergyElement {
|
|
|
404
416
|
// More info: https://github.com/shoelace-style/shoelace/issues/1135
|
|
405
417
|
//
|
|
406
418
|
const getOffsetParent =
|
|
407
|
-
this.strategy === 'absolute'
|
|
419
|
+
SUPPORTS_POPOVER || this.strategy === 'absolute'
|
|
408
420
|
? (element: Element) => platform.getOffsetParent(element, offsetParent)
|
|
409
421
|
: platform.getOffsetParent;
|
|
410
422
|
|
|
411
423
|
computePosition(this.anchorEl, this.popup, {
|
|
412
424
|
placement: this.placement,
|
|
413
425
|
middleware,
|
|
414
|
-
strategy: this.strategy,
|
|
426
|
+
strategy: SUPPORTS_POPOVER ? 'absolute' : this.strategy,
|
|
415
427
|
platform: {
|
|
416
428
|
...platform,
|
|
417
429
|
getOffsetParent
|
|
@@ -568,10 +580,11 @@ export default class SynPopup extends SynergyElement {
|
|
|
568
580
|
|
|
569
581
|
<div
|
|
570
582
|
part="popup"
|
|
583
|
+
popover=${ifDefined(SUPPORTS_POPOVER ? 'manual' : undefined)}
|
|
571
584
|
class=${classMap({
|
|
572
585
|
popup: true,
|
|
573
586
|
'popup--active': this.active,
|
|
574
|
-
'popup--fixed': this.strategy === 'fixed',
|
|
587
|
+
'popup--fixed': !SUPPORTS_POPOVER && this.strategy === 'fixed',
|
|
575
588
|
'popup--has-arrow': this.arrow
|
|
576
589
|
})}
|
|
577
590
|
>
|
|
@@ -76,6 +76,9 @@ panel inside of the viewport.
|
|
|
76
76
|
* Determines how the popup is positioned.
|
|
77
77
|
* The `absolute` strategy works well in most cases, but if overflow is
|
|
78
78
|
clipped, using a `fixed` position strategy can often workaround it.
|
|
79
|
+
|
|
80
|
+
@deprecated The strategy property is deprecated and will be removed in future versions.
|
|
81
|
+
* Modern browsers support the popover element which is used internally instead.
|
|
79
82
|
*/
|
|
80
83
|
strategy?: SynPopup['strategy'];
|
|
81
84
|
|
|
@@ -267,6 +267,8 @@ use the `show()` and `hide()` methods and this attribute will reflect the select
|
|
|
267
267
|
* Enable this option to prevent the listbox from being clipped when the component is placed inside a container with
|
|
268
268
|
`overflow: auto|scroll`.
|
|
269
269
|
* Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
270
|
+
|
|
271
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
270
272
|
*/
|
|
271
273
|
@Input()
|
|
272
274
|
set hoist(v: '' | SynSelect['hoist']) {
|
|
@@ -187,6 +187,7 @@ export default class SynSelect extends SynergyElement implements SynergyFormCont
|
|
|
187
187
|
/**
|
|
188
188
|
* Enable this option to prevent the listbox from being clipped when the component is placed inside a container with
|
|
189
189
|
* `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
190
|
+
* @deprecated This property is deprecated and will be removed in the next major version.
|
|
190
191
|
*/
|
|
191
192
|
@property({ type: Boolean }) hoist = false;
|
|
192
193
|
|
|
@@ -132,6 +132,8 @@ use the `show()` and `hide()` methods and this attribute will reflect the select
|
|
|
132
132
|
* Enable this option to prevent the listbox from being clipped when the component is placed inside a container with
|
|
133
133
|
`overflow: auto|scroll`.
|
|
134
134
|
* Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
135
|
+
|
|
136
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
135
137
|
*/
|
|
136
138
|
hoist?: SynSelect['hoist'];
|
|
137
139
|
|
|
@@ -174,6 +174,8 @@ programmatically.
|
|
|
174
174
|
`overflow: auto|hidden|scroll`.
|
|
175
175
|
* Hoisting uses a fixed positioning strategy that works in many, but not all,
|
|
176
176
|
scenarios.
|
|
177
|
+
|
|
178
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
177
179
|
*/
|
|
178
180
|
@Input()
|
|
179
181
|
set hoist(v: '' | SynTooltip['hoist']) {
|
|
@@ -105,6 +105,7 @@ export default class SynTooltip extends SynergyElement {
|
|
|
105
105
|
* Enable this option to prevent the tooltip from being clipped when the component is placed inside a container with
|
|
106
106
|
* `overflow: auto|hidden|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all,
|
|
107
107
|
* scenarios.
|
|
108
|
+
* @deprecated This property is deprecated and will be removed in the next major version.
|
|
108
109
|
*/
|
|
109
110
|
@property({ type: Boolean }) hoist = false;
|
|
110
111
|
|
|
@@ -100,6 +100,8 @@ programmatically.
|
|
|
100
100
|
`overflow: auto|hidden|scroll`.
|
|
101
101
|
* Hoisting uses a fixed positioning strategy that works in many, but not all,
|
|
102
102
|
scenarios.
|
|
103
|
+
|
|
104
|
+
@deprecated This property is deprecated and will be removed in the next major version.
|
|
103
105
|
*/
|
|
104
106
|
hoist?: SynTooltip['hoist'];
|
|
105
107
|
}>();
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@synergy-design-system/components-v2.45.1](https://github.com/synergy-design-system/synergy-design-system/compare/components/2.45.0...components/2.45.1) (2025-09-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 🐛 Synergy element which use syn-popup may break if used in a stacking context ([#1034](https://github.com/synergy-design-system/synergy-design-system/issues/1034)) ([8d23dc7](https://github.com/synergy-design-system/synergy-design-system/commit/8d23dc737e36065a0208bc01a98981541540d0ef))
|
|
7
|
+
|
|
1
8
|
# [@synergy-design-system/components-v2.45.0](https://github.com/synergy-design-system/synergy-design-system/compare/components/2.44.0...components/2.45.0) (2025-09-24)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@synergy-design-system/tokens-v2.26.1](https://github.com/synergy-design-system/synergy-design-system/compare/tokens/2.26.0...tokens/2.26.1) (2025-09-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 🐛 Synergy element which use syn-popup may break if used in a stacking context ([#1034](https://github.com/synergy-design-system/synergy-design-system/issues/1034)) ([8d23dc7](https://github.com/synergy-design-system/synergy-design-system/commit/8d23dc737e36065a0208bc01a98981541540d0ef))
|
|
7
|
+
|
|
1
8
|
# [@synergy-design-system/tokens-v2.26.0](https://github.com/synergy-design-system/synergy-design-system/compare/tokens/2.25.0...tokens/2.26.0) (2025-09-24)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,831 @@
|
|
|
1
|
+
## Default
|
|
2
|
+
|
|
3
|
+
Popup is a utility that lets you declaratively anchor “popup” containers to another element.This component’s name is inspired by <popup>. It uses Floating UI under the hood to provide a well-tested, lightweight, and fully declarative positioning utility for tooltips, dropdowns, and more.Popup doesn’t provide any styles — just positioning! The popup’s preferred placement, distance, and skidding (offset) can be configured using attributes. An arrow that points to the anchor can be shown and customized to your liking. Additional positioning options are available and described in more detail below.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<div class="popup-default">
|
|
7
|
+
<syn-popup active="" arrow-padding="10" placement="top" strategy="absolute">
|
|
8
|
+
<div class="box"></div>
|
|
9
|
+
<span slot="anchor"></span>
|
|
10
|
+
</syn-popup>
|
|
11
|
+
</div>
|
|
12
|
+
<style>
|
|
13
|
+
.popup-default span[slot="anchor"] {
|
|
14
|
+
display: inline-block;
|
|
15
|
+
width: 150px;
|
|
16
|
+
height: 150px;
|
|
17
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
18
|
+
margin: 50px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.popup-default .box {
|
|
22
|
+
width: 100px;
|
|
23
|
+
height: 50px;
|
|
24
|
+
background: var(--syn-color-primary-600);
|
|
25
|
+
border-radius: var(--syn-border-radius-medium);
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Activating
|
|
33
|
+
|
|
34
|
+
Popups are inactive and hidden until the active attribute is applied.
|
|
35
|
+
Removing the attribute will tear down all positioning logic and listeners,
|
|
36
|
+
meaning you can have many idle popups on the page without affecting performance.
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<div class="popup-active">
|
|
40
|
+
<syn-popup placement="top" active="" strategy="absolute">
|
|
41
|
+
<span slot="anchor"></span>
|
|
42
|
+
<div class="box"></div>
|
|
43
|
+
</syn-popup>
|
|
44
|
+
|
|
45
|
+
<br />
|
|
46
|
+
<syn-switch checked="" title="" size="medium" form="">Active</syn-switch>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
.popup-active span[slot="anchor"] {
|
|
51
|
+
display: inline-block;
|
|
52
|
+
width: 150px;
|
|
53
|
+
height: 150px;
|
|
54
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
55
|
+
margin: 50px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.popup-active .box {
|
|
59
|
+
width: 100px;
|
|
60
|
+
height: 50px;
|
|
61
|
+
background: var(--syn-color-primary-600);
|
|
62
|
+
border-radius: var(--syn-border-radius-medium);
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## External Anchors
|
|
70
|
+
|
|
71
|
+
By default, anchors are slotted into the popup using the anchor slot.
|
|
72
|
+
If your anchor needs to live outside of the popup,
|
|
73
|
+
you can pass the anchor's id to the anchor attribute.
|
|
74
|
+
Alternatively, you can pass an element reference
|
|
75
|
+
to the anchor property to achieve the same effect without using an id.
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<span id="external-anchor"></span>
|
|
79
|
+
|
|
80
|
+
<syn-popup
|
|
81
|
+
anchor="external-anchor"
|
|
82
|
+
placement="top"
|
|
83
|
+
active=""
|
|
84
|
+
strategy="absolute"
|
|
85
|
+
>
|
|
86
|
+
<div class="box"></div>
|
|
87
|
+
</syn-popup>
|
|
88
|
+
|
|
89
|
+
<style>
|
|
90
|
+
#external-anchor {
|
|
91
|
+
display: inline-block;
|
|
92
|
+
width: 150px;
|
|
93
|
+
height: 150px;
|
|
94
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
95
|
+
margin: 50px 0 0 50px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#external-anchor ~ syn-popup .box {
|
|
99
|
+
width: 100px;
|
|
100
|
+
height: 50px;
|
|
101
|
+
background: var(--syn-color-primary-600);
|
|
102
|
+
border-radius: var(--syn-border-radius-medium);
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Placement
|
|
110
|
+
|
|
111
|
+
Use the placement attribute to tell the popup the preferred placement of the popup.
|
|
112
|
+
Note that the actual position will vary to ensure the panel remains in the viewport
|
|
113
|
+
if you're using positioning features such as flip and shift.
|
|
114
|
+
Since placement is preferred when using flip, you can observe the popup's current placement
|
|
115
|
+
when it's active by looking at the data-current-placement attribute.
|
|
116
|
+
This attribute will update as the popup flips to find
|
|
117
|
+
available space and it will be removed when the popup is deactivated.
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<div class="popup-placement">
|
|
121
|
+
<syn-popup placement="top" active="" strategy="absolute">
|
|
122
|
+
<span slot="anchor"></span>
|
|
123
|
+
<div class="box"></div>
|
|
124
|
+
</syn-popup>
|
|
125
|
+
|
|
126
|
+
<syn-select
|
|
127
|
+
label="Placement"
|
|
128
|
+
value="top"
|
|
129
|
+
size="medium"
|
|
130
|
+
placement="bottom"
|
|
131
|
+
form=""
|
|
132
|
+
>
|
|
133
|
+
<syn-option
|
|
134
|
+
value="top"
|
|
135
|
+
role="option"
|
|
136
|
+
aria-selected="true"
|
|
137
|
+
aria-disabled="false"
|
|
138
|
+
>top</syn-option
|
|
139
|
+
>
|
|
140
|
+
<syn-option
|
|
141
|
+
value="top-start"
|
|
142
|
+
role="option"
|
|
143
|
+
aria-selected="false"
|
|
144
|
+
aria-disabled="false"
|
|
145
|
+
>top-start</syn-option
|
|
146
|
+
>
|
|
147
|
+
<syn-option
|
|
148
|
+
value="top-end"
|
|
149
|
+
role="option"
|
|
150
|
+
aria-selected="false"
|
|
151
|
+
aria-disabled="false"
|
|
152
|
+
>top-end</syn-option
|
|
153
|
+
>
|
|
154
|
+
<syn-option
|
|
155
|
+
value="bottom"
|
|
156
|
+
role="option"
|
|
157
|
+
aria-selected="false"
|
|
158
|
+
aria-disabled="false"
|
|
159
|
+
>bottom</syn-option
|
|
160
|
+
>
|
|
161
|
+
<syn-option
|
|
162
|
+
value="bottom-start"
|
|
163
|
+
role="option"
|
|
164
|
+
aria-selected="false"
|
|
165
|
+
aria-disabled="false"
|
|
166
|
+
>bottom-start</syn-option
|
|
167
|
+
>
|
|
168
|
+
<syn-option
|
|
169
|
+
value="bottom-end"
|
|
170
|
+
role="option"
|
|
171
|
+
aria-selected="false"
|
|
172
|
+
aria-disabled="false"
|
|
173
|
+
>bottom-end</syn-option
|
|
174
|
+
>
|
|
175
|
+
<syn-option
|
|
176
|
+
value="right"
|
|
177
|
+
role="option"
|
|
178
|
+
aria-selected="false"
|
|
179
|
+
aria-disabled="false"
|
|
180
|
+
>right</syn-option
|
|
181
|
+
>
|
|
182
|
+
<syn-option
|
|
183
|
+
value="right-start"
|
|
184
|
+
role="option"
|
|
185
|
+
aria-selected="false"
|
|
186
|
+
aria-disabled="false"
|
|
187
|
+
>right-start</syn-option
|
|
188
|
+
>
|
|
189
|
+
<syn-option
|
|
190
|
+
value="right-end"
|
|
191
|
+
role="option"
|
|
192
|
+
aria-selected="false"
|
|
193
|
+
aria-disabled="false"
|
|
194
|
+
>right-end</syn-option
|
|
195
|
+
>
|
|
196
|
+
<syn-option
|
|
197
|
+
value="left"
|
|
198
|
+
role="option"
|
|
199
|
+
aria-selected="false"
|
|
200
|
+
aria-disabled="false"
|
|
201
|
+
>left</syn-option
|
|
202
|
+
>
|
|
203
|
+
<syn-option
|
|
204
|
+
value="left-start"
|
|
205
|
+
role="option"
|
|
206
|
+
aria-selected="false"
|
|
207
|
+
aria-disabled="false"
|
|
208
|
+
>left-start</syn-option
|
|
209
|
+
>
|
|
210
|
+
<syn-option
|
|
211
|
+
value="left-end"
|
|
212
|
+
role="option"
|
|
213
|
+
aria-selected="false"
|
|
214
|
+
aria-disabled="false"
|
|
215
|
+
>left-end</syn-option
|
|
216
|
+
>
|
|
217
|
+
</syn-select>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<style>
|
|
221
|
+
.popup-placement span[slot="anchor"] {
|
|
222
|
+
display: inline-block;
|
|
223
|
+
width: 150px;
|
|
224
|
+
height: 150px;
|
|
225
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
226
|
+
margin: 50px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.popup-placement .box {
|
|
230
|
+
width: 100px;
|
|
231
|
+
height: 50px;
|
|
232
|
+
background: var(--syn-color-primary-600);
|
|
233
|
+
border-radius: var(--syn-border-radius-medium);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.popup-placement syn-select {
|
|
237
|
+
max-width: 280px;
|
|
238
|
+
}
|
|
239
|
+
</style>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Distance
|
|
245
|
+
|
|
246
|
+
Use the distance attribute to change the distance between the popup and its anchor.
|
|
247
|
+
A positive value will move the popup further away and a negative value will move it closer.
|
|
248
|
+
|
|
249
|
+
```html
|
|
250
|
+
<div class="popup-distance">
|
|
251
|
+
<syn-popup placement="top" distance="0" active="" strategy="absolute">
|
|
252
|
+
<span slot="anchor"></span>
|
|
253
|
+
<div class="box"></div>
|
|
254
|
+
</syn-popup>
|
|
255
|
+
|
|
256
|
+
<syn-range
|
|
257
|
+
min="-50"
|
|
258
|
+
max="50"
|
|
259
|
+
step="1"
|
|
260
|
+
value="0"
|
|
261
|
+
label="Distance"
|
|
262
|
+
size="medium"
|
|
263
|
+
form=""
|
|
264
|
+
></syn-range>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<style>
|
|
268
|
+
.popup-distance span[slot="anchor"] {
|
|
269
|
+
display: inline-block;
|
|
270
|
+
width: 150px;
|
|
271
|
+
height: 150px;
|
|
272
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
273
|
+
margin: 50px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.popup-distance .box {
|
|
277
|
+
width: 100px;
|
|
278
|
+
height: 50px;
|
|
279
|
+
background: var(--syn-color-primary-600);
|
|
280
|
+
border-radius: var(--syn-border-radius-medium);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.popup-distance syn-range {
|
|
284
|
+
max-width: 260px;
|
|
285
|
+
}
|
|
286
|
+
</style>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Skidding
|
|
292
|
+
|
|
293
|
+
The skidding attribute is similar to distance,
|
|
294
|
+
but instead allows you to offset the popup along the anchor's axis.
|
|
295
|
+
Both positive and negative values are allowed.
|
|
296
|
+
|
|
297
|
+
```html
|
|
298
|
+
<div class="popup-skidding">
|
|
299
|
+
<syn-popup placement="top" skidding="0" active="" strategy="absolute">
|
|
300
|
+
<span slot="anchor"></span>
|
|
301
|
+
<div class="box"></div>
|
|
302
|
+
</syn-popup>
|
|
303
|
+
|
|
304
|
+
<syn-range
|
|
305
|
+
min="-50"
|
|
306
|
+
max="50"
|
|
307
|
+
step="1"
|
|
308
|
+
value="0"
|
|
309
|
+
label="Skidding"
|
|
310
|
+
size="medium"
|
|
311
|
+
form=""
|
|
312
|
+
></syn-range>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<style>
|
|
316
|
+
.popup-skidding span[slot="anchor"] {
|
|
317
|
+
display: inline-block;
|
|
318
|
+
width: 150px;
|
|
319
|
+
height: 150px;
|
|
320
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
321
|
+
margin: 50px;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.popup-skidding .box {
|
|
325
|
+
width: 100px;
|
|
326
|
+
height: 50px;
|
|
327
|
+
background: var(--syn-color-primary-600);
|
|
328
|
+
border-radius: var(--syn-border-radius-medium);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.popup-skidding syn-range {
|
|
332
|
+
max-width: 260px;
|
|
333
|
+
}
|
|
334
|
+
</style>
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Arrows
|
|
340
|
+
|
|
341
|
+
Add an arrow to your popup with the arrow attribute.
|
|
342
|
+
It's usually a good idea to set a distance to make room for the arrow.
|
|
343
|
+
To adjust the arrow's color and size,
|
|
344
|
+
use the --arrow-color and --arrow-size custom properties, respectively.
|
|
345
|
+
You can also target the arrow part to add additional styles such as shadows and borders.
|
|
346
|
+
By default, the arrow will be aligned as close to
|
|
347
|
+
the center as possible, considering available space and arrow-padding.
|
|
348
|
+
You can use the arrow-placement attribute to force
|
|
349
|
+
the arrow to align to the start, end, or center of the instead.
|
|
350
|
+
|
|
351
|
+
```html
|
|
352
|
+
<div class="popup-arrow">
|
|
353
|
+
<syn-popup
|
|
354
|
+
placement="top"
|
|
355
|
+
arrow=""
|
|
356
|
+
arrow-placement="anchor"
|
|
357
|
+
distance="8"
|
|
358
|
+
active=""
|
|
359
|
+
strategy="absolute"
|
|
360
|
+
>
|
|
361
|
+
<span slot="anchor"></span>
|
|
362
|
+
<div class="box"></div>
|
|
363
|
+
</syn-popup>
|
|
364
|
+
|
|
365
|
+
<div class="popup-arrow-options">
|
|
366
|
+
<syn-select
|
|
367
|
+
label="Placement"
|
|
368
|
+
name="placement"
|
|
369
|
+
value="top"
|
|
370
|
+
class="popup-overview-select"
|
|
371
|
+
size="medium"
|
|
372
|
+
placement="bottom"
|
|
373
|
+
form=""
|
|
374
|
+
>
|
|
375
|
+
<syn-option
|
|
376
|
+
value="top"
|
|
377
|
+
role="option"
|
|
378
|
+
aria-selected="true"
|
|
379
|
+
aria-disabled="false"
|
|
380
|
+
>top</syn-option
|
|
381
|
+
>
|
|
382
|
+
<syn-option
|
|
383
|
+
value="top-start"
|
|
384
|
+
role="option"
|
|
385
|
+
aria-selected="false"
|
|
386
|
+
aria-disabled="false"
|
|
387
|
+
>top-start</syn-option
|
|
388
|
+
>
|
|
389
|
+
<syn-option
|
|
390
|
+
value="top-end"
|
|
391
|
+
role="option"
|
|
392
|
+
aria-selected="false"
|
|
393
|
+
aria-disabled="false"
|
|
394
|
+
>top-end</syn-option
|
|
395
|
+
>
|
|
396
|
+
<syn-option
|
|
397
|
+
value="bottom"
|
|
398
|
+
role="option"
|
|
399
|
+
aria-selected="false"
|
|
400
|
+
aria-disabled="false"
|
|
401
|
+
>bottom</syn-option
|
|
402
|
+
>
|
|
403
|
+
<syn-option
|
|
404
|
+
value="bottom-start"
|
|
405
|
+
role="option"
|
|
406
|
+
aria-selected="false"
|
|
407
|
+
aria-disabled="false"
|
|
408
|
+
>bottom-start</syn-option
|
|
409
|
+
>
|
|
410
|
+
<syn-option
|
|
411
|
+
value="bottom-end"
|
|
412
|
+
role="option"
|
|
413
|
+
aria-selected="false"
|
|
414
|
+
aria-disabled="false"
|
|
415
|
+
>bottom-end</syn-option
|
|
416
|
+
>
|
|
417
|
+
<syn-option
|
|
418
|
+
value="right"
|
|
419
|
+
role="option"
|
|
420
|
+
aria-selected="false"
|
|
421
|
+
aria-disabled="false"
|
|
422
|
+
>right</syn-option
|
|
423
|
+
>
|
|
424
|
+
<syn-option
|
|
425
|
+
value="right-start"
|
|
426
|
+
role="option"
|
|
427
|
+
aria-selected="false"
|
|
428
|
+
aria-disabled="false"
|
|
429
|
+
>right-start</syn-option
|
|
430
|
+
>
|
|
431
|
+
<syn-option
|
|
432
|
+
value="right-end"
|
|
433
|
+
role="option"
|
|
434
|
+
aria-selected="false"
|
|
435
|
+
aria-disabled="false"
|
|
436
|
+
>right-end</syn-option
|
|
437
|
+
>
|
|
438
|
+
<syn-option
|
|
439
|
+
value="left"
|
|
440
|
+
role="option"
|
|
441
|
+
aria-selected="false"
|
|
442
|
+
aria-disabled="false"
|
|
443
|
+
>left</syn-option
|
|
444
|
+
>
|
|
445
|
+
<syn-option
|
|
446
|
+
value="left-start"
|
|
447
|
+
role="option"
|
|
448
|
+
aria-selected="false"
|
|
449
|
+
aria-disabled="false"
|
|
450
|
+
>left-start</syn-option
|
|
451
|
+
>
|
|
452
|
+
<syn-option
|
|
453
|
+
value="left-end"
|
|
454
|
+
role="option"
|
|
455
|
+
aria-selected="false"
|
|
456
|
+
aria-disabled="false"
|
|
457
|
+
>left-end</syn-option
|
|
458
|
+
>
|
|
459
|
+
</syn-select>
|
|
460
|
+
|
|
461
|
+
<syn-select
|
|
462
|
+
label="Arrow Placement"
|
|
463
|
+
name="arrow-placement"
|
|
464
|
+
value="anchor"
|
|
465
|
+
size="medium"
|
|
466
|
+
placement="bottom"
|
|
467
|
+
form=""
|
|
468
|
+
>
|
|
469
|
+
<syn-option
|
|
470
|
+
value="anchor"
|
|
471
|
+
role="option"
|
|
472
|
+
aria-selected="true"
|
|
473
|
+
aria-disabled="false"
|
|
474
|
+
>anchor</syn-option
|
|
475
|
+
>
|
|
476
|
+
<syn-option
|
|
477
|
+
value="start"
|
|
478
|
+
role="option"
|
|
479
|
+
aria-selected="false"
|
|
480
|
+
aria-disabled="false"
|
|
481
|
+
>start</syn-option
|
|
482
|
+
>
|
|
483
|
+
<syn-option
|
|
484
|
+
value="end"
|
|
485
|
+
role="option"
|
|
486
|
+
aria-selected="false"
|
|
487
|
+
aria-disabled="false"
|
|
488
|
+
>end</syn-option
|
|
489
|
+
>
|
|
490
|
+
<syn-option
|
|
491
|
+
value="center"
|
|
492
|
+
role="option"
|
|
493
|
+
aria-selected="false"
|
|
494
|
+
aria-disabled="false"
|
|
495
|
+
>center</syn-option
|
|
496
|
+
>
|
|
497
|
+
</syn-select>
|
|
498
|
+
</div>
|
|
499
|
+
|
|
500
|
+
<div class="popup-arrow-options">
|
|
501
|
+
<syn-switch name="arrow" checked="" title="" size="medium" form=""
|
|
502
|
+
>Arrow</syn-switch
|
|
503
|
+
>
|
|
504
|
+
</div>
|
|
505
|
+
|
|
506
|
+
<style>
|
|
507
|
+
.popup-arrow syn-popup {
|
|
508
|
+
--arrow-color: var(--syn-color-primary-600);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.popup-arrow span[slot="anchor"] {
|
|
512
|
+
display: inline-block;
|
|
513
|
+
width: 150px;
|
|
514
|
+
height: 150px;
|
|
515
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
516
|
+
margin: 50px;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.popup-arrow .box {
|
|
520
|
+
width: 100px;
|
|
521
|
+
height: 50px;
|
|
522
|
+
background: var(--syn-color-primary-600);
|
|
523
|
+
border-radius: var(--syn-border-radius-medium);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.popup-arrow-options {
|
|
527
|
+
display: flex;
|
|
528
|
+
flex-wrap: wrap;
|
|
529
|
+
align-items: end;
|
|
530
|
+
gap: 1rem;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.popup-arrow-options syn-select {
|
|
534
|
+
width: 160px;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.popup-arrow-options + .popup-arrow-options {
|
|
538
|
+
margin-top: 1rem;
|
|
539
|
+
}
|
|
540
|
+
</style>
|
|
541
|
+
</div>
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
## Syncing With The Anchors Dimensions
|
|
547
|
+
|
|
548
|
+
Use the sync attribute to make the popup the same width or height as the anchor element.
|
|
549
|
+
This is useful for controls that need the popup to stay the same width or height as the trigger.
|
|
550
|
+
|
|
551
|
+
```html
|
|
552
|
+
<div class="popup-sync">
|
|
553
|
+
<syn-popup placement="top" sync="width" active="" strategy="absolute">
|
|
554
|
+
<span slot="anchor"></span>
|
|
555
|
+
<div class="box"></div>
|
|
556
|
+
</syn-popup>
|
|
557
|
+
|
|
558
|
+
<syn-select
|
|
559
|
+
value="width"
|
|
560
|
+
label="Sync"
|
|
561
|
+
size="medium"
|
|
562
|
+
placement="bottom"
|
|
563
|
+
form=""
|
|
564
|
+
>
|
|
565
|
+
<syn-option
|
|
566
|
+
value="width"
|
|
567
|
+
role="option"
|
|
568
|
+
aria-selected="true"
|
|
569
|
+
aria-disabled="false"
|
|
570
|
+
>Width</syn-option
|
|
571
|
+
>
|
|
572
|
+
<syn-option
|
|
573
|
+
value="height"
|
|
574
|
+
role="option"
|
|
575
|
+
aria-selected="false"
|
|
576
|
+
aria-disabled="false"
|
|
577
|
+
>Height</syn-option
|
|
578
|
+
>
|
|
579
|
+
<syn-option
|
|
580
|
+
value="both"
|
|
581
|
+
role="option"
|
|
582
|
+
aria-selected="false"
|
|
583
|
+
aria-disabled="false"
|
|
584
|
+
>Both</syn-option
|
|
585
|
+
>
|
|
586
|
+
<syn-option
|
|
587
|
+
value=""
|
|
588
|
+
role="option"
|
|
589
|
+
aria-selected="false"
|
|
590
|
+
aria-disabled="false"
|
|
591
|
+
>None</syn-option
|
|
592
|
+
>
|
|
593
|
+
</syn-select>
|
|
594
|
+
</div>
|
|
595
|
+
|
|
596
|
+
<style>
|
|
597
|
+
.popup-sync span[slot="anchor"] {
|
|
598
|
+
display: inline-block;
|
|
599
|
+
width: 150px;
|
|
600
|
+
height: 150px;
|
|
601
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
602
|
+
margin: 50px;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.popup-sync .box {
|
|
606
|
+
width: 100%;
|
|
607
|
+
height: 100%;
|
|
608
|
+
min-width: 50px;
|
|
609
|
+
min-height: 50px;
|
|
610
|
+
background: var(--syn-color-primary-600);
|
|
611
|
+
border-radius: var(--syn-border-radius-medium);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.popup-sync syn-select {
|
|
615
|
+
width: 160px;
|
|
616
|
+
}
|
|
617
|
+
</style>
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
---
|
|
621
|
+
|
|
622
|
+
## Flip
|
|
623
|
+
|
|
624
|
+
When the popup doesn't have enough room in its preferred placement,
|
|
625
|
+
it can automatically flip to keep it in view.
|
|
626
|
+
To enable this, use the flip attribute.
|
|
627
|
+
By default, the popup will flip to the opposite placement, but you can configure
|
|
628
|
+
preferred fallback placements using flip-fallback-placement and flip-fallback-strategy.
|
|
629
|
+
Additional options are available to control the flip behavior's boundary and padding.
|
|
630
|
+
|
|
631
|
+
```html
|
|
632
|
+
<div class="popup-flip">
|
|
633
|
+
<div class="overflow">
|
|
634
|
+
<syn-popup
|
|
635
|
+
placement="top"
|
|
636
|
+
flip=""
|
|
637
|
+
active=""
|
|
638
|
+
id="popup-flip"
|
|
639
|
+
strategy="absolute"
|
|
640
|
+
>
|
|
641
|
+
<span slot="anchor"></span>
|
|
642
|
+
<div class="box"></div>
|
|
643
|
+
</syn-popup>
|
|
644
|
+
</div>
|
|
645
|
+
|
|
646
|
+
<br />
|
|
647
|
+
<syn-switch checked="" title="" size="medium" form="">Flip</syn-switch>
|
|
648
|
+
</div>
|
|
649
|
+
|
|
650
|
+
<style>
|
|
651
|
+
.popup-flip .overflow {
|
|
652
|
+
position: relative;
|
|
653
|
+
height: 300px;
|
|
654
|
+
border: solid 2px var(--syn-color-neutral-200);
|
|
655
|
+
overflow: auto;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.popup-flip span[slot="anchor"] {
|
|
659
|
+
display: inline-block;
|
|
660
|
+
width: 150px;
|
|
661
|
+
height: 150px;
|
|
662
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
663
|
+
margin: 150px 50px;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.popup-flip .box {
|
|
667
|
+
width: 100px;
|
|
668
|
+
height: 50px;
|
|
669
|
+
background: var(--syn-color-primary-600);
|
|
670
|
+
border-radius: var(--syn-border-radius-medium);
|
|
671
|
+
}
|
|
672
|
+
</style>
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
677
|
+
## Flip Fallbacks
|
|
678
|
+
|
|
679
|
+
While using the flip attribute, you can customize the placement
|
|
680
|
+
of the popup when the preferred placement doesn't have room.
|
|
681
|
+
For this, use flip-fallback-placements and flip-fallback-strategy.
|
|
682
|
+
If the preferred placement doesn't have room,
|
|
683
|
+
the first suitable placement found in flip-fallback-placement will be used.
|
|
684
|
+
The value of this attribute must be a string,
|
|
685
|
+
including any number of placements separated by a space, e.g. "right bottom".
|
|
686
|
+
If no fallback placement works, the final placement will be determined by flip-fallback-strategy.
|
|
687
|
+
This value can be either initial (default),
|
|
688
|
+
where the placement reverts to the position in placement,
|
|
689
|
+
or best-fit, where the placement is chosen based on available space.
|
|
690
|
+
Scroll the container to see how the popup changes it's fallback placement to prevent clipping.
|
|
691
|
+
|
|
692
|
+
```html
|
|
693
|
+
<div class="popup-flip-fallbacks">
|
|
694
|
+
<div class="overflow">
|
|
695
|
+
<syn-popup
|
|
696
|
+
placement="top"
|
|
697
|
+
flip=""
|
|
698
|
+
flip-fallback-placements="right bottom"
|
|
699
|
+
flip-fallback-strategy="initial"
|
|
700
|
+
active=""
|
|
701
|
+
strategy="absolute"
|
|
702
|
+
>
|
|
703
|
+
<span slot="anchor"></span>
|
|
704
|
+
<div class="box"></div>
|
|
705
|
+
</syn-popup>
|
|
706
|
+
</div>
|
|
707
|
+
</div>
|
|
708
|
+
|
|
709
|
+
<style>
|
|
710
|
+
.popup-flip-fallbacks .overflow {
|
|
711
|
+
position: relative;
|
|
712
|
+
height: 300px;
|
|
713
|
+
border: solid 2px var(--syn-color-neutral-200);
|
|
714
|
+
overflow: auto;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.popup-flip-fallbacks span[slot="anchor"] {
|
|
718
|
+
display: inline-block;
|
|
719
|
+
width: 150px;
|
|
720
|
+
height: 150px;
|
|
721
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
722
|
+
margin: 250px 50px;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
.popup-flip-fallbacks .box {
|
|
726
|
+
width: 100px;
|
|
727
|
+
height: 50px;
|
|
728
|
+
background: var(--syn-color-primary-600);
|
|
729
|
+
border-radius: var(--syn-border-radius-medium);
|
|
730
|
+
}
|
|
731
|
+
</style>
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
---
|
|
735
|
+
|
|
736
|
+
## Shift
|
|
737
|
+
|
|
738
|
+
When a popup is longer than its anchor, it risks being clipped by an overflowing container.
|
|
739
|
+
In this case, use the shift attribute to shift the popup along its axis and back into view.
|
|
740
|
+
You can customize the shift behavior using shiftBoundary and shift-padding.
|
|
741
|
+
Toggle the switch to see the difference.
|
|
742
|
+
|
|
743
|
+
```html
|
|
744
|
+
<div class="popup-shift">
|
|
745
|
+
<div class="overflow">
|
|
746
|
+
<syn-popup
|
|
747
|
+
placement="top"
|
|
748
|
+
shift=""
|
|
749
|
+
shift-padding="10"
|
|
750
|
+
active=""
|
|
751
|
+
strategy="absolute"
|
|
752
|
+
>
|
|
753
|
+
<span slot="anchor"></span>
|
|
754
|
+
<div class="box"></div>
|
|
755
|
+
</syn-popup>
|
|
756
|
+
</div>
|
|
757
|
+
|
|
758
|
+
<syn-switch checked="" title="" size="medium" form="">Shift</syn-switch>
|
|
759
|
+
</div>
|
|
760
|
+
|
|
761
|
+
<style>
|
|
762
|
+
.popup-shift .overflow {
|
|
763
|
+
position: relative;
|
|
764
|
+
border: solid 2px var(--syn-color-neutral-200);
|
|
765
|
+
overflow: auto;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
.popup-shift span[slot="anchor"] {
|
|
769
|
+
display: inline-block;
|
|
770
|
+
width: 150px;
|
|
771
|
+
height: 150px;
|
|
772
|
+
border: dashed 2px var(--syn-color-neutral-600);
|
|
773
|
+
margin: 60px 0 0 10px;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.popup-shift .box {
|
|
777
|
+
width: 300px;
|
|
778
|
+
height: 50px;
|
|
779
|
+
background: var(--syn-color-primary-600);
|
|
780
|
+
border-radius: var(--syn-border-radius-medium);
|
|
781
|
+
}
|
|
782
|
+
</style>
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
---
|
|
786
|
+
|
|
787
|
+
## Virtual Elements
|
|
788
|
+
|
|
789
|
+
In most cases, popups are anchored to an actual element.
|
|
790
|
+
Sometimes, it can be useful to anchor them to a non-element.
|
|
791
|
+
To do this, you can pass a VirtualElement to the anchor property.
|
|
792
|
+
A virtual element must contain a function called getBoundingClientRect() that returns
|
|
793
|
+
a object as shown below.
|
|
794
|
+
This example anchors a popup to the mouse cursor using a virtual element.
|
|
795
|
+
As such, a mouse is required to properly view it.
|
|
796
|
+
|
|
797
|
+
```html
|
|
798
|
+
<div class="popup-virtual-element">
|
|
799
|
+
<syn-popup placement="right-start" strategy="absolute">
|
|
800
|
+
<div class="circle"></div>
|
|
801
|
+
</syn-popup>
|
|
802
|
+
|
|
803
|
+
<syn-switch title="" size="medium" form="">Highlight mouse cursor</syn-switch>
|
|
804
|
+
</div>
|
|
805
|
+
|
|
806
|
+
<style>
|
|
807
|
+
/* If you need to set a z-index, set it on the popup part like this */
|
|
808
|
+
.popup-virtual-element syn-popup::part(popup) {
|
|
809
|
+
z-index: 1000;
|
|
810
|
+
pointer-events: none;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.popup-virtual-element .circle {
|
|
814
|
+
width: 100px;
|
|
815
|
+
height: 100px;
|
|
816
|
+
border: solid 4px var(--syn-color-primary-600);
|
|
817
|
+
border-radius: 50%;
|
|
818
|
+
translate: -50px -50px;
|
|
819
|
+
animation: 1s virtual-cursor infinite;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
@keyframes virtual-cursor {
|
|
823
|
+
0% {
|
|
824
|
+
scale: 1;
|
|
825
|
+
}
|
|
826
|
+
50% {
|
|
827
|
+
scale: 1.1;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
</style>
|
|
831
|
+
```
|
package/package.json
CHANGED
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"semantic-release-monorepo": "7.0.5",
|
|
34
34
|
"ts-jest": "^29.4.0",
|
|
35
35
|
"typescript": "^5.8.3",
|
|
36
|
-
"@synergy-design-system/components": "2.45.
|
|
36
|
+
"@synergy-design-system/components": "2.45.1",
|
|
37
37
|
"@synergy-design-system/docs": "0.1.0",
|
|
38
|
+
"@synergy-design-system/tokens": "^2.26.1",
|
|
38
39
|
"@synergy-design-system/eslint-config-syn": "^0.1.0",
|
|
39
|
-
"@synergy-design-system/styles": "1.8.0"
|
|
40
|
-
"@synergy-design-system/tokens": "^2.26.0"
|
|
40
|
+
"@synergy-design-system/styles": "1.8.0"
|
|
41
41
|
},
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"directory": "packages/mcp"
|
|
123
123
|
},
|
|
124
124
|
"type": "module",
|
|
125
|
-
"version": "1.6.
|
|
125
|
+
"version": "1.6.1",
|
|
126
126
|
"scripts": {
|
|
127
127
|
"build": "pnpm run build:ts && pnpm run build:metadata && pnpm build:hash",
|
|
128
128
|
"build:all": "pnpm run build && pnpm run build:storybook",
|