@fluid-topics/ft-floating-menu 1.1.21 → 1.1.23
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.
|
@@ -10,8 +10,7 @@ import { eventPathContainsMatchingElement, FtLitElement, jsonProperty, } from "@
|
|
|
10
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
11
11
|
import { FtFloatingMenuItem } from "./ft-floating-menu-item";
|
|
12
12
|
import { FtIconVariants } from "@fluid-topics/ft-icon/build/ft-icon.properties";
|
|
13
|
-
import {
|
|
14
|
-
import { offsetParent } from "composed-offset-position";
|
|
13
|
+
import { computeOffsetPosition } from "@fluid-topics/ft-wc-utils/build/floating";
|
|
15
14
|
export class FloatingMenuCloseEvent extends CustomEvent {
|
|
16
15
|
constructor() {
|
|
17
16
|
super("close-ft-floating-menu");
|
|
@@ -116,25 +115,13 @@ class FtBaseFloatingMenu extends FtLitElement {
|
|
|
116
115
|
this.positionMenuWrapper();
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
positionMenuWrapper() {
|
|
118
|
+
async positionMenuWrapper() {
|
|
120
119
|
this.menuWrapper.style.left = "";
|
|
121
120
|
this.menuWrapper.style.top = "";
|
|
122
121
|
const reference = this.customToggle.length > 0 ? this.customToggle[0] : this.actionButton;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
getOffsetParent: (element) => {
|
|
127
|
-
return platform.getOffsetParent(element, offsetParent);
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
middleware: [
|
|
131
|
-
shift({ crossAxis: true }),
|
|
132
|
-
autoPlacement({ allowedPlacements: [this.convertPlacement()] }),
|
|
133
|
-
],
|
|
134
|
-
}).then(({ x, y }) => {
|
|
135
|
-
this.menuWrapper.style.left = `${x}px`;
|
|
136
|
-
this.menuWrapper.style.top = `${y}px`;
|
|
137
|
-
});
|
|
122
|
+
const { x, y } = await computeOffsetPosition(reference, this.menuWrapper, this.convertPlacement());
|
|
123
|
+
this.menuWrapper.style.left = `${x}px`;
|
|
124
|
+
this.menuWrapper.style.top = `${y}px`;
|
|
138
125
|
this.menuWrapper.classList.add("ft-floating-menu--wrapper-positioned");
|
|
139
126
|
}
|
|
140
127
|
convertPlacement() {
|
|
@@ -6,6 +6,5 @@ export declare const FtFloatingMenuCssVariables: {
|
|
|
6
6
|
colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
7
7
|
menuElevation: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
8
8
|
borderRadiusS: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
9
|
-
buttonBackgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
10
9
|
};
|
|
11
10
|
export declare const styles: import("lit").CSSResult;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
|
-
import { designSystemVariables, FtCssVariableFactory
|
|
3
|
-
import { FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
2
|
+
import { designSystemVariables, FtCssVariableFactory } from "@fluid-topics/ft-wc-utils";
|
|
4
3
|
export const FtFloatingMenuCssVariables = {
|
|
5
4
|
zIndex: FtCssVariableFactory.create("--ft-floating-menu-z-index", "", "NUMBER", "8"),
|
|
6
5
|
maxWidth: FtCssVariableFactory.create("--ft-floating-menu-max-width", "", "SIZE", "300px"),
|
|
@@ -9,7 +8,6 @@ export const FtFloatingMenuCssVariables = {
|
|
|
9
8
|
colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
|
|
10
9
|
menuElevation: FtCssVariableFactory.external(designSystemVariables.elevation02, "Design system"),
|
|
11
10
|
borderRadiusS: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design system"),
|
|
12
|
-
buttonBackgroundColor: FtCssVariableFactory.create("--ft-floating-menu-button-background-color", "", "COLOR", designSystemVariables.colorSurface),
|
|
13
11
|
};
|
|
14
12
|
// language=CSS
|
|
15
13
|
export const styles = css `
|
|
@@ -43,8 +41,4 @@ export const styles = css `
|
|
|
43
41
|
.ft-floating-menu--open .ft-floating-menu--options {
|
|
44
42
|
display: block;
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
[part="button"] {
|
|
48
|
-
${setVariable(FtButtonCssVariables.backgroundColor, FtFloatingMenuCssVariables.buttonBackgroundColor)}
|
|
49
|
-
}
|
|
50
44
|
`;
|