@latty-ds/web 0.2.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/LICENSE +21 -0
- package/README.md +106 -0
- package/custom-elements.json +8785 -0
- package/dist/base/index.d.ts +1 -0
- package/dist/base/index.js +35 -0
- package/dist/base/themeable-element.d.ts +20 -0
- package/dist/components/accordion/accordion.d.ts +82 -0
- package/dist/components/accordion/accordion.styles.d.ts +1 -0
- package/dist/components/accordion/accordion.types.d.ts +10 -0
- package/dist/components/accordion/index.d.ts +8 -0
- package/dist/components/accordion/index.js +468 -0
- package/dist/components/alert/alert.d.ts +51 -0
- package/dist/components/alert/alert.styles.d.ts +1 -0
- package/dist/components/alert/alert.types.d.ts +2 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +746 -0
- package/dist/components/avatar/avatar.d.ts +27 -0
- package/dist/components/avatar/avatar.styles.d.ts +1 -0
- package/dist/components/avatar/avatar.types.d.ts +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +222 -0
- package/dist/components/badge/badge.d.ts +29 -0
- package/dist/components/badge/badge.styles.d.ts +1 -0
- package/dist/components/badge/badge.types.d.ts +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +277 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +53 -0
- package/dist/components/breadcrumb/breadcrumb.styles.d.ts +2 -0
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +1 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +166 -0
- package/dist/components/button/button.d.ts +111 -0
- package/dist/components/button/button.styles.d.ts +1 -0
- package/dist/components/button/button.types.d.ts +38 -0
- package/dist/components/button/index.d.ts +8 -0
- package/dist/components/button/index.js +466 -0
- package/dist/components/calendar/calendar.d.ts +84 -0
- package/dist/components/calendar/calendar.styles.d.ts +1 -0
- package/dist/components/calendar/calendar.types.d.ts +15 -0
- package/dist/components/calendar/index.d.ts +1 -0
- package/dist/components/calendar/index.js +958 -0
- package/dist/components/checkbox/checkbox.d.ts +113 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.types.d.ts +21 -0
- package/dist/components/checkbox/index.d.ts +8 -0
- package/dist/components/checkbox/index.js +320 -0
- package/dist/components/chip/chip.d.ts +35 -0
- package/dist/components/chip/chip.styles.d.ts +1 -0
- package/dist/components/chip/chip.types.d.ts +3 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +282 -0
- package/dist/components/color-input/color-input.d.ts +55 -0
- package/dist/components/color-input/color-input.styles.d.ts +1 -0
- package/dist/components/color-input/color-input.types.d.ts +2 -0
- package/dist/components/color-input/index.d.ts +1 -0
- package/dist/components/color-input/index.js +489 -0
- package/dist/components/combobox/combobox.d.ts +59 -0
- package/dist/components/combobox/combobox.styles.d.ts +1 -0
- package/dist/components/combobox/combobox.types.d.ts +7 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1988 -0
- package/dist/components/date-input/date-input.d.ts +66 -0
- package/dist/components/date-input/date-input.styles.d.ts +1 -0
- package/dist/components/date-input/date-input.types.d.ts +3 -0
- package/dist/components/date-input/index.d.ts +2 -0
- package/dist/components/date-input/index.js +2863 -0
- package/dist/components/datepicker/datepicker.d.ts +52 -0
- package/dist/components/datepicker/datepicker.styles.d.ts +1 -0
- package/dist/components/datepicker/datepicker.types.d.ts +3 -0
- package/dist/components/datepicker/index.d.ts +2 -0
- package/dist/components/datepicker/index.js +416 -0
- package/dist/components/dialog/dialog.d.ts +114 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.types.d.ts +11 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +920 -0
- package/dist/components/divider/divider.d.ts +35 -0
- package/dist/components/divider/divider.styles.d.ts +1 -0
- package/dist/components/divider/divider.types.d.ts +2 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +149 -0
- package/dist/components/dropdown/dropdown-item.d.ts +24 -0
- package/dist/components/dropdown/dropdown-item.styles.d.ts +1 -0
- package/dist/components/dropdown/dropdown.d.ts +30 -0
- package/dist/components/dropdown/dropdown.styles.d.ts +1 -0
- package/dist/components/dropdown/dropdown.types.d.ts +1 -0
- package/dist/components/dropdown/index.d.ts +3 -0
- package/dist/components/dropdown/index.js +1791 -0
- package/dist/components/header/header.d.ts +19 -0
- package/dist/components/header/header.styles.d.ts +1 -0
- package/dist/components/header/header.types.d.ts +1 -0
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/header/index.js +104 -0
- package/dist/components/icon-button/icon-button.d.ts +52 -0
- package/dist/components/icon-button/icon-button.styles.d.ts +1 -0
- package/dist/components/icon-button/icon-button.types.d.ts +8 -0
- package/dist/components/icon-button/index.d.ts +1 -0
- package/dist/components/icon-button/index.js +342 -0
- package/dist/components/image/image.d.ts +26 -0
- package/dist/components/image/image.styles.d.ts +1 -0
- package/dist/components/image/image.types.d.ts +0 -0
- package/dist/components/image/index.d.ts +1 -0
- package/dist/components/image/index.js +105 -0
- package/dist/components/link/index.d.ts +1 -0
- package/dist/components/link/index.js +108 -0
- package/dist/components/link/link.d.ts +22 -0
- package/dist/components/link/link.styles.d.ts +1 -0
- package/dist/components/link/link.types.d.ts +1 -0
- package/dist/components/list/index.d.ts +9 -0
- package/dist/components/list/index.js +254 -0
- package/dist/components/list/list-item.d.ts +41 -0
- package/dist/components/list/list-item.styles.d.ts +1 -0
- package/dist/components/list/list.d.ts +85 -0
- package/dist/components/list/list.styles.d.ts +1 -0
- package/dist/components/list/list.types.d.ts +16 -0
- package/dist/components/nav/index.d.ts +3 -0
- package/dist/components/nav/index.js +345 -0
- package/dist/components/nav/nav-item.d.ts +73 -0
- package/dist/components/nav/nav.d.ts +49 -0
- package/dist/components/nav/nav.styles.d.ts +2 -0
- package/dist/components/nav/nav.types.d.ts +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +210 -0
- package/dist/components/pagination/pagination.d.ts +34 -0
- package/dist/components/pagination/pagination.styles.d.ts +1 -0
- package/dist/components/pagination/pagination.types.d.ts +1 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.js +167 -0
- package/dist/components/progress/progress.d.ts +44 -0
- package/dist/components/progress/progress.styles.d.ts +1 -0
- package/dist/components/progress/progress.types.d.ts +2 -0
- package/dist/components/radio/index.d.ts +8 -0
- package/dist/components/radio/index.js +294 -0
- package/dist/components/radio/radio.d.ts +96 -0
- package/dist/components/radio/radio.styles.d.ts +1 -0
- package/dist/components/radio/radio.types.d.ts +21 -0
- package/dist/components/radio-group/index.d.ts +8 -0
- package/dist/components/radio-group/index.js +384 -0
- package/dist/components/radio-group/radio-group.d.ts +100 -0
- package/dist/components/radio-group/radio-group.styles.d.ts +1 -0
- package/dist/components/radio-group/radio-group.types.d.ts +8 -0
- package/dist/components/select/index.d.ts +8 -0
- package/dist/components/select/index.js +2123 -0
- package/dist/components/select/select.d.ts +129 -0
- package/dist/components/select/select.styles.d.ts +1 -0
- package/dist/components/select/select.types.d.ts +37 -0
- package/dist/components/shared/backdrop.styles.d.ts +1 -0
- package/dist/components/shared/floating.d.ts +10 -0
- package/dist/components/sidepanel/index.d.ts +1 -0
- package/dist/components/sidepanel/index.js +768 -0
- package/dist/components/sidepanel/sidepanel.d.ts +48 -0
- package/dist/components/sidepanel/sidepanel.styles.d.ts +1 -0
- package/dist/components/sidepanel/sidepanel.types.d.ts +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +129 -0
- package/dist/components/skeleton/skeleton.d.ts +39 -0
- package/dist/components/skeleton/skeleton.styles.d.ts +1 -0
- package/dist/components/skeleton/skeleton.types.d.ts +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +635 -0
- package/dist/components/slider/slider.d.ts +33 -0
- package/dist/components/slider/slider.styles.d.ts +1 -0
- package/dist/components/slider/slider.types.d.ts +1 -0
- package/dist/components/snackbar/index.d.ts +2 -0
- package/dist/components/snackbar/index.js +358 -0
- package/dist/components/snackbar/snackbar.d.ts +63 -0
- package/dist/components/snackbar/snackbar.styles.d.ts +1 -0
- package/dist/components/snackbar/snackbar.types.d.ts +1 -0
- package/dist/components/spinner/index.d.ts +8 -0
- package/dist/components/spinner/index.js +131 -0
- package/dist/components/spinner/spineer.styles.d.ts +1 -0
- package/dist/components/spinner/spinner.d.ts +52 -0
- package/dist/components/spinner/spinner.types.d.ts +18 -0
- package/dist/components/surface/index.d.ts +8 -0
- package/dist/components/surface/index.js +128 -0
- package/dist/components/surface/surface.d.ts +48 -0
- package/dist/components/surface/surface.styles.d.ts +1 -0
- package/dist/components/surface/surface.types.d.ts +20 -0
- package/dist/components/switch/index.d.ts +8 -0
- package/dist/components/switch/index.js +293 -0
- package/dist/components/switch/switch.d.ts +90 -0
- package/dist/components/switch/switch.styles.d.ts +1 -0
- package/dist/components/switch/switch.types.d.ts +21 -0
- package/dist/components/tab/index.d.ts +9 -0
- package/dist/components/tab/index.js +252 -0
- package/dist/components/tab/tab-panel.d.ts +28 -0
- package/dist/components/tab/tab-panel.styles.d.ts +1 -0
- package/dist/components/tab/tab.d.ts +59 -0
- package/dist/components/tab/tab.styles.d.ts +1 -0
- package/dist/components/tab/tab.types.d.ts +7 -0
- package/dist/components/tab-group/index.d.ts +8 -0
- package/dist/components/tab-group/index.js +441 -0
- package/dist/components/tab-group/tab-group.d.ts +99 -0
- package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
- package/dist/components/tab-group/tab-group.types.d.ts +11 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +582 -0
- package/dist/components/table/table.d.ts +160 -0
- package/dist/components/table/table.styles.d.ts +1 -0
- package/dist/components/table/table.types.d.ts +106 -0
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/text/index.js +207 -0
- package/dist/components/text/text.d.ts +32 -0
- package/dist/components/text/text.styles.d.ts +1 -0
- package/dist/components/text/text.types.d.ts +2 -0
- package/dist/components/textfield/index.d.ts +8 -0
- package/dist/components/textfield/index.js +718 -0
- package/dist/components/textfield/textfield.d.ts +168 -0
- package/dist/components/textfield/textfield.styles.d.ts +1 -0
- package/dist/components/textfield/textfield.types.d.ts +40 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +379 -0
- package/dist/components/tooltip/tooltip.d.ts +42 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.types.d.ts +1 -0
- package/dist/css/font-face.css +22 -0
- package/dist/css/latty.css +57 -0
- package/dist/fonts/HankenGrotesk-Variable.woff2 +0 -0
- package/dist/fonts/HankenGrotesk-VariableItalic.woff2 +0 -0
- package/dist/index.cjs +12739 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +11406 -0
- package/dist/manifest.json +2396 -0
- package/dist/utils/click-outside.d.ts +22 -0
- package/dist/utils/color.d.ts +14 -0
- package/dist/utils/dispatch.d.ts +18 -0
- package/dist/utils/index.d.ts +3 -0
- package/package.json +231 -0
|
@@ -0,0 +1,1988 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/components/combobox/combobox.ts
|
|
13
|
+
import { html as html2, nothing } from "lit";
|
|
14
|
+
|
|
15
|
+
// src/base/themeable-element.ts
|
|
16
|
+
import { LitElement } from "lit";
|
|
17
|
+
import { property } from "lit/decorators.js";
|
|
18
|
+
var ThemeableElement = class extends LitElement {
|
|
19
|
+
willUpdate(changed) {
|
|
20
|
+
super.willUpdate(changed);
|
|
21
|
+
if (changed.has("theme")) {
|
|
22
|
+
this._syncThemeAttribute();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
_syncThemeAttribute() {
|
|
26
|
+
if (this.theme === "dark" || this.theme === "light") {
|
|
27
|
+
this.setAttribute("data-theme", this.theme);
|
|
28
|
+
} else {
|
|
29
|
+
this.removeAttribute("data-theme");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
__decorateClass([
|
|
34
|
+
property({ reflect: true })
|
|
35
|
+
], ThemeableElement.prototype, "theme", 2);
|
|
36
|
+
|
|
37
|
+
// src/components/combobox/combobox.ts
|
|
38
|
+
import { customElement as customElement2, property as property3, state } from "lit/decorators.js";
|
|
39
|
+
|
|
40
|
+
// src/components/combobox/combobox.styles.ts
|
|
41
|
+
import { css as css2 } from "lit";
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
44
|
+
var min = Math.min;
|
|
45
|
+
var max = Math.max;
|
|
46
|
+
var round = Math.round;
|
|
47
|
+
var floor = Math.floor;
|
|
48
|
+
var createCoords = (v) => ({
|
|
49
|
+
x: v,
|
|
50
|
+
y: v
|
|
51
|
+
});
|
|
52
|
+
var oppositeSideMap = {
|
|
53
|
+
left: "right",
|
|
54
|
+
right: "left",
|
|
55
|
+
bottom: "top",
|
|
56
|
+
top: "bottom"
|
|
57
|
+
};
|
|
58
|
+
function clamp(start, value, end) {
|
|
59
|
+
return max(start, min(value, end));
|
|
60
|
+
}
|
|
61
|
+
function evaluate(value, param) {
|
|
62
|
+
return typeof value === "function" ? value(param) : value;
|
|
63
|
+
}
|
|
64
|
+
function getSide(placement) {
|
|
65
|
+
return placement.split("-")[0];
|
|
66
|
+
}
|
|
67
|
+
function getAlignment(placement) {
|
|
68
|
+
return placement.split("-")[1];
|
|
69
|
+
}
|
|
70
|
+
function getOppositeAxis(axis) {
|
|
71
|
+
return axis === "x" ? "y" : "x";
|
|
72
|
+
}
|
|
73
|
+
function getAxisLength(axis) {
|
|
74
|
+
return axis === "y" ? "height" : "width";
|
|
75
|
+
}
|
|
76
|
+
function getSideAxis(placement) {
|
|
77
|
+
const firstChar = placement[0];
|
|
78
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
79
|
+
}
|
|
80
|
+
function getAlignmentAxis(placement) {
|
|
81
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
82
|
+
}
|
|
83
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
84
|
+
if (rtl === void 0) {
|
|
85
|
+
rtl = false;
|
|
86
|
+
}
|
|
87
|
+
const alignment = getAlignment(placement);
|
|
88
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
89
|
+
const length = getAxisLength(alignmentAxis);
|
|
90
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
91
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
92
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
93
|
+
}
|
|
94
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
95
|
+
}
|
|
96
|
+
function getExpandedPlacements(placement) {
|
|
97
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
98
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
99
|
+
}
|
|
100
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
101
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
102
|
+
}
|
|
103
|
+
var lrPlacement = ["left", "right"];
|
|
104
|
+
var rlPlacement = ["right", "left"];
|
|
105
|
+
var tbPlacement = ["top", "bottom"];
|
|
106
|
+
var btPlacement = ["bottom", "top"];
|
|
107
|
+
function getSideList(side, isStart, rtl) {
|
|
108
|
+
switch (side) {
|
|
109
|
+
case "top":
|
|
110
|
+
case "bottom":
|
|
111
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
112
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
113
|
+
case "left":
|
|
114
|
+
case "right":
|
|
115
|
+
return isStart ? tbPlacement : btPlacement;
|
|
116
|
+
default:
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
121
|
+
const alignment = getAlignment(placement);
|
|
122
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
123
|
+
if (alignment) {
|
|
124
|
+
list = list.map((side) => side + "-" + alignment);
|
|
125
|
+
if (flipAlignment) {
|
|
126
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return list;
|
|
130
|
+
}
|
|
131
|
+
function getOppositePlacement(placement) {
|
|
132
|
+
const side = getSide(placement);
|
|
133
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
134
|
+
}
|
|
135
|
+
function expandPaddingObject(padding) {
|
|
136
|
+
return {
|
|
137
|
+
top: 0,
|
|
138
|
+
right: 0,
|
|
139
|
+
bottom: 0,
|
|
140
|
+
left: 0,
|
|
141
|
+
...padding
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function getPaddingObject(padding) {
|
|
145
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
146
|
+
top: padding,
|
|
147
|
+
right: padding,
|
|
148
|
+
bottom: padding,
|
|
149
|
+
left: padding
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function rectToClientRect(rect) {
|
|
153
|
+
const {
|
|
154
|
+
x,
|
|
155
|
+
y,
|
|
156
|
+
width,
|
|
157
|
+
height
|
|
158
|
+
} = rect;
|
|
159
|
+
return {
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
top: y,
|
|
163
|
+
left: x,
|
|
164
|
+
right: x + width,
|
|
165
|
+
bottom: y + height,
|
|
166
|
+
x,
|
|
167
|
+
y
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ../../node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
172
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
173
|
+
let {
|
|
174
|
+
reference,
|
|
175
|
+
floating
|
|
176
|
+
} = _ref;
|
|
177
|
+
const sideAxis = getSideAxis(placement);
|
|
178
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
179
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
180
|
+
const side = getSide(placement);
|
|
181
|
+
const isVertical = sideAxis === "y";
|
|
182
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
183
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
184
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
185
|
+
let coords;
|
|
186
|
+
switch (side) {
|
|
187
|
+
case "top":
|
|
188
|
+
coords = {
|
|
189
|
+
x: commonX,
|
|
190
|
+
y: reference.y - floating.height
|
|
191
|
+
};
|
|
192
|
+
break;
|
|
193
|
+
case "bottom":
|
|
194
|
+
coords = {
|
|
195
|
+
x: commonX,
|
|
196
|
+
y: reference.y + reference.height
|
|
197
|
+
};
|
|
198
|
+
break;
|
|
199
|
+
case "right":
|
|
200
|
+
coords = {
|
|
201
|
+
x: reference.x + reference.width,
|
|
202
|
+
y: commonY
|
|
203
|
+
};
|
|
204
|
+
break;
|
|
205
|
+
case "left":
|
|
206
|
+
coords = {
|
|
207
|
+
x: reference.x - floating.width,
|
|
208
|
+
y: commonY
|
|
209
|
+
};
|
|
210
|
+
break;
|
|
211
|
+
default:
|
|
212
|
+
coords = {
|
|
213
|
+
x: reference.x,
|
|
214
|
+
y: reference.y
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
switch (getAlignment(placement)) {
|
|
218
|
+
case "start":
|
|
219
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
220
|
+
break;
|
|
221
|
+
case "end":
|
|
222
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
return coords;
|
|
226
|
+
}
|
|
227
|
+
async function detectOverflow(state2, options) {
|
|
228
|
+
var _await$platform$isEle;
|
|
229
|
+
if (options === void 0) {
|
|
230
|
+
options = {};
|
|
231
|
+
}
|
|
232
|
+
const {
|
|
233
|
+
x,
|
|
234
|
+
y,
|
|
235
|
+
platform: platform2,
|
|
236
|
+
rects,
|
|
237
|
+
elements,
|
|
238
|
+
strategy
|
|
239
|
+
} = state2;
|
|
240
|
+
const {
|
|
241
|
+
boundary = "clippingAncestors",
|
|
242
|
+
rootBoundary = "viewport",
|
|
243
|
+
elementContext = "floating",
|
|
244
|
+
altBoundary = false,
|
|
245
|
+
padding = 0
|
|
246
|
+
} = evaluate(options, state2);
|
|
247
|
+
const paddingObject = getPaddingObject(padding);
|
|
248
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
249
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
250
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
251
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
252
|
+
boundary,
|
|
253
|
+
rootBoundary,
|
|
254
|
+
strategy
|
|
255
|
+
}));
|
|
256
|
+
const rect = elementContext === "floating" ? {
|
|
257
|
+
x,
|
|
258
|
+
y,
|
|
259
|
+
width: rects.floating.width,
|
|
260
|
+
height: rects.floating.height
|
|
261
|
+
} : rects.reference;
|
|
262
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
263
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
264
|
+
x: 1,
|
|
265
|
+
y: 1
|
|
266
|
+
} : {
|
|
267
|
+
x: 1,
|
|
268
|
+
y: 1
|
|
269
|
+
};
|
|
270
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
271
|
+
elements,
|
|
272
|
+
rect,
|
|
273
|
+
offsetParent,
|
|
274
|
+
strategy
|
|
275
|
+
}) : rect);
|
|
276
|
+
return {
|
|
277
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
278
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
279
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
280
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
var MAX_RESET_COUNT = 50;
|
|
284
|
+
var computePosition = async (reference, floating, config) => {
|
|
285
|
+
const {
|
|
286
|
+
placement = "bottom",
|
|
287
|
+
strategy = "absolute",
|
|
288
|
+
middleware = [],
|
|
289
|
+
platform: platform2
|
|
290
|
+
} = config;
|
|
291
|
+
const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
|
|
292
|
+
...platform2,
|
|
293
|
+
detectOverflow
|
|
294
|
+
};
|
|
295
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
296
|
+
let rects = await platform2.getElementRects({
|
|
297
|
+
reference,
|
|
298
|
+
floating,
|
|
299
|
+
strategy
|
|
300
|
+
});
|
|
301
|
+
let {
|
|
302
|
+
x,
|
|
303
|
+
y
|
|
304
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
305
|
+
let statefulPlacement = placement;
|
|
306
|
+
let resetCount = 0;
|
|
307
|
+
const middlewareData = {};
|
|
308
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
309
|
+
const currentMiddleware = middleware[i];
|
|
310
|
+
if (!currentMiddleware) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
const {
|
|
314
|
+
name,
|
|
315
|
+
fn
|
|
316
|
+
} = currentMiddleware;
|
|
317
|
+
const {
|
|
318
|
+
x: nextX,
|
|
319
|
+
y: nextY,
|
|
320
|
+
data,
|
|
321
|
+
reset
|
|
322
|
+
} = await fn({
|
|
323
|
+
x,
|
|
324
|
+
y,
|
|
325
|
+
initialPlacement: placement,
|
|
326
|
+
placement: statefulPlacement,
|
|
327
|
+
strategy,
|
|
328
|
+
middlewareData,
|
|
329
|
+
rects,
|
|
330
|
+
platform: platformWithDetectOverflow,
|
|
331
|
+
elements: {
|
|
332
|
+
reference,
|
|
333
|
+
floating
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
x = nextX != null ? nextX : x;
|
|
337
|
+
y = nextY != null ? nextY : y;
|
|
338
|
+
middlewareData[name] = {
|
|
339
|
+
...middlewareData[name],
|
|
340
|
+
...data
|
|
341
|
+
};
|
|
342
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
343
|
+
resetCount++;
|
|
344
|
+
if (typeof reset === "object") {
|
|
345
|
+
if (reset.placement) {
|
|
346
|
+
statefulPlacement = reset.placement;
|
|
347
|
+
}
|
|
348
|
+
if (reset.rects) {
|
|
349
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
350
|
+
reference,
|
|
351
|
+
floating,
|
|
352
|
+
strategy
|
|
353
|
+
}) : reset.rects;
|
|
354
|
+
}
|
|
355
|
+
({
|
|
356
|
+
x,
|
|
357
|
+
y
|
|
358
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
359
|
+
}
|
|
360
|
+
i = -1;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return {
|
|
364
|
+
x,
|
|
365
|
+
y,
|
|
366
|
+
placement: statefulPlacement,
|
|
367
|
+
strategy,
|
|
368
|
+
middlewareData
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
var flip = function(options) {
|
|
372
|
+
if (options === void 0) {
|
|
373
|
+
options = {};
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
name: "flip",
|
|
377
|
+
options,
|
|
378
|
+
async fn(state2) {
|
|
379
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
380
|
+
const {
|
|
381
|
+
placement,
|
|
382
|
+
middlewareData,
|
|
383
|
+
rects,
|
|
384
|
+
initialPlacement,
|
|
385
|
+
platform: platform2,
|
|
386
|
+
elements
|
|
387
|
+
} = state2;
|
|
388
|
+
const {
|
|
389
|
+
mainAxis: checkMainAxis = true,
|
|
390
|
+
crossAxis: checkCrossAxis = true,
|
|
391
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
392
|
+
fallbackStrategy = "bestFit",
|
|
393
|
+
fallbackAxisSideDirection = "none",
|
|
394
|
+
flipAlignment = true,
|
|
395
|
+
...detectOverflowOptions
|
|
396
|
+
} = evaluate(options, state2);
|
|
397
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
398
|
+
return {};
|
|
399
|
+
}
|
|
400
|
+
const side = getSide(placement);
|
|
401
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
402
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
403
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
404
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
405
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
406
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
407
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
408
|
+
}
|
|
409
|
+
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
410
|
+
const overflow = await platform2.detectOverflow(state2, detectOverflowOptions);
|
|
411
|
+
const overflows = [];
|
|
412
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
413
|
+
if (checkMainAxis) {
|
|
414
|
+
overflows.push(overflow[side]);
|
|
415
|
+
}
|
|
416
|
+
if (checkCrossAxis) {
|
|
417
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
418
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
419
|
+
}
|
|
420
|
+
overflowsData = [...overflowsData, {
|
|
421
|
+
placement,
|
|
422
|
+
overflows
|
|
423
|
+
}];
|
|
424
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
425
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
426
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
427
|
+
const nextPlacement = placements2[nextIndex];
|
|
428
|
+
if (nextPlacement) {
|
|
429
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
430
|
+
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
431
|
+
// overflows the main axis.
|
|
432
|
+
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
433
|
+
return {
|
|
434
|
+
data: {
|
|
435
|
+
index: nextIndex,
|
|
436
|
+
overflows: overflowsData
|
|
437
|
+
},
|
|
438
|
+
reset: {
|
|
439
|
+
placement: nextPlacement
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
445
|
+
if (!resetPlacement) {
|
|
446
|
+
switch (fallbackStrategy) {
|
|
447
|
+
case "bestFit": {
|
|
448
|
+
var _overflowsData$filter2;
|
|
449
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
450
|
+
if (hasFallbackAxisSideDirection) {
|
|
451
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
452
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
453
|
+
// reading directions favoring greater width.
|
|
454
|
+
currentSideAxis === "y";
|
|
455
|
+
}
|
|
456
|
+
return true;
|
|
457
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
458
|
+
if (placement2) {
|
|
459
|
+
resetPlacement = placement2;
|
|
460
|
+
}
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
case "initialPlacement":
|
|
464
|
+
resetPlacement = initialPlacement;
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (placement !== resetPlacement) {
|
|
469
|
+
return {
|
|
470
|
+
reset: {
|
|
471
|
+
placement: resetPlacement
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return {};
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
var originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
481
|
+
async function convertValueToCoords(state2, options) {
|
|
482
|
+
const {
|
|
483
|
+
placement,
|
|
484
|
+
platform: platform2,
|
|
485
|
+
elements
|
|
486
|
+
} = state2;
|
|
487
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
488
|
+
const side = getSide(placement);
|
|
489
|
+
const alignment = getAlignment(placement);
|
|
490
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
491
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
492
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
493
|
+
const rawValue = evaluate(options, state2);
|
|
494
|
+
let {
|
|
495
|
+
mainAxis,
|
|
496
|
+
crossAxis,
|
|
497
|
+
alignmentAxis
|
|
498
|
+
} = typeof rawValue === "number" ? {
|
|
499
|
+
mainAxis: rawValue,
|
|
500
|
+
crossAxis: 0,
|
|
501
|
+
alignmentAxis: null
|
|
502
|
+
} : {
|
|
503
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
504
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
505
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
506
|
+
};
|
|
507
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
508
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
509
|
+
}
|
|
510
|
+
return isVertical ? {
|
|
511
|
+
x: crossAxis * crossAxisMulti,
|
|
512
|
+
y: mainAxis * mainAxisMulti
|
|
513
|
+
} : {
|
|
514
|
+
x: mainAxis * mainAxisMulti,
|
|
515
|
+
y: crossAxis * crossAxisMulti
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
var offset = function(options) {
|
|
519
|
+
if (options === void 0) {
|
|
520
|
+
options = 0;
|
|
521
|
+
}
|
|
522
|
+
return {
|
|
523
|
+
name: "offset",
|
|
524
|
+
options,
|
|
525
|
+
async fn(state2) {
|
|
526
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
527
|
+
const {
|
|
528
|
+
x,
|
|
529
|
+
y,
|
|
530
|
+
placement,
|
|
531
|
+
middlewareData
|
|
532
|
+
} = state2;
|
|
533
|
+
const diffCoords = await convertValueToCoords(state2, options);
|
|
534
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
535
|
+
return {};
|
|
536
|
+
}
|
|
537
|
+
return {
|
|
538
|
+
x: x + diffCoords.x,
|
|
539
|
+
y: y + diffCoords.y,
|
|
540
|
+
data: {
|
|
541
|
+
...diffCoords,
|
|
542
|
+
placement
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
var shift = function(options) {
|
|
549
|
+
if (options === void 0) {
|
|
550
|
+
options = {};
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
name: "shift",
|
|
554
|
+
options,
|
|
555
|
+
async fn(state2) {
|
|
556
|
+
const {
|
|
557
|
+
x,
|
|
558
|
+
y,
|
|
559
|
+
placement,
|
|
560
|
+
platform: platform2
|
|
561
|
+
} = state2;
|
|
562
|
+
const {
|
|
563
|
+
mainAxis: checkMainAxis = true,
|
|
564
|
+
crossAxis: checkCrossAxis = false,
|
|
565
|
+
limiter = {
|
|
566
|
+
fn: (_ref) => {
|
|
567
|
+
let {
|
|
568
|
+
x: x2,
|
|
569
|
+
y: y2
|
|
570
|
+
} = _ref;
|
|
571
|
+
return {
|
|
572
|
+
x: x2,
|
|
573
|
+
y: y2
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
...detectOverflowOptions
|
|
578
|
+
} = evaluate(options, state2);
|
|
579
|
+
const coords = {
|
|
580
|
+
x,
|
|
581
|
+
y
|
|
582
|
+
};
|
|
583
|
+
const overflow = await platform2.detectOverflow(state2, detectOverflowOptions);
|
|
584
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
585
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
586
|
+
let mainAxisCoord = coords[mainAxis];
|
|
587
|
+
let crossAxisCoord = coords[crossAxis];
|
|
588
|
+
if (checkMainAxis) {
|
|
589
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
590
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
591
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
592
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
593
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
594
|
+
}
|
|
595
|
+
if (checkCrossAxis) {
|
|
596
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
597
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
598
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
599
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
600
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
601
|
+
}
|
|
602
|
+
const limitedCoords = limiter.fn({
|
|
603
|
+
...state2,
|
|
604
|
+
[mainAxis]: mainAxisCoord,
|
|
605
|
+
[crossAxis]: crossAxisCoord
|
|
606
|
+
});
|
|
607
|
+
return {
|
|
608
|
+
...limitedCoords,
|
|
609
|
+
data: {
|
|
610
|
+
x: limitedCoords.x - x,
|
|
611
|
+
y: limitedCoords.y - y,
|
|
612
|
+
enabled: {
|
|
613
|
+
[mainAxis]: checkMainAxis,
|
|
614
|
+
[crossAxis]: checkCrossAxis
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
623
|
+
function hasWindow() {
|
|
624
|
+
return typeof window !== "undefined";
|
|
625
|
+
}
|
|
626
|
+
function getNodeName(node) {
|
|
627
|
+
if (isNode(node)) {
|
|
628
|
+
return (node.nodeName || "").toLowerCase();
|
|
629
|
+
}
|
|
630
|
+
return "#document";
|
|
631
|
+
}
|
|
632
|
+
function getWindow(node) {
|
|
633
|
+
var _node$ownerDocument;
|
|
634
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
635
|
+
}
|
|
636
|
+
function getDocumentElement(node) {
|
|
637
|
+
var _ref;
|
|
638
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
639
|
+
}
|
|
640
|
+
function isNode(value) {
|
|
641
|
+
if (!hasWindow()) {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
645
|
+
}
|
|
646
|
+
function isElement(value) {
|
|
647
|
+
if (!hasWindow()) {
|
|
648
|
+
return false;
|
|
649
|
+
}
|
|
650
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
651
|
+
}
|
|
652
|
+
function isHTMLElement(value) {
|
|
653
|
+
if (!hasWindow()) {
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
657
|
+
}
|
|
658
|
+
function isShadowRoot(value) {
|
|
659
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
663
|
+
}
|
|
664
|
+
function isOverflowElement(element) {
|
|
665
|
+
const {
|
|
666
|
+
overflow,
|
|
667
|
+
overflowX,
|
|
668
|
+
overflowY,
|
|
669
|
+
display
|
|
670
|
+
} = getComputedStyle2(element);
|
|
671
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
672
|
+
}
|
|
673
|
+
function isTableElement(element) {
|
|
674
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
675
|
+
}
|
|
676
|
+
function isTopLayer(element) {
|
|
677
|
+
try {
|
|
678
|
+
if (element.matches(":popover-open")) {
|
|
679
|
+
return true;
|
|
680
|
+
}
|
|
681
|
+
} catch (_e) {
|
|
682
|
+
}
|
|
683
|
+
try {
|
|
684
|
+
return element.matches(":modal");
|
|
685
|
+
} catch (_e) {
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
690
|
+
var containRe = /paint|layout|strict|content/;
|
|
691
|
+
var isNotNone = (value) => !!value && value !== "none";
|
|
692
|
+
var isWebKitValue;
|
|
693
|
+
function isContainingBlock(elementOrCss) {
|
|
694
|
+
const css4 = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
|
|
695
|
+
return isNotNone(css4.transform) || isNotNone(css4.translate) || isNotNone(css4.scale) || isNotNone(css4.rotate) || isNotNone(css4.perspective) || !isWebKit() && (isNotNone(css4.backdropFilter) || isNotNone(css4.filter)) || willChangeRe.test(css4.willChange || "") || containRe.test(css4.contain || "");
|
|
696
|
+
}
|
|
697
|
+
function getContainingBlock(element) {
|
|
698
|
+
let currentNode = getParentNode(element);
|
|
699
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
700
|
+
if (isContainingBlock(currentNode)) {
|
|
701
|
+
return currentNode;
|
|
702
|
+
} else if (isTopLayer(currentNode)) {
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
currentNode = getParentNode(currentNode);
|
|
706
|
+
}
|
|
707
|
+
return null;
|
|
708
|
+
}
|
|
709
|
+
function isWebKit() {
|
|
710
|
+
if (isWebKitValue == null) {
|
|
711
|
+
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
712
|
+
}
|
|
713
|
+
return isWebKitValue;
|
|
714
|
+
}
|
|
715
|
+
function isLastTraversableNode(node) {
|
|
716
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
717
|
+
}
|
|
718
|
+
function getComputedStyle2(element) {
|
|
719
|
+
return getWindow(element).getComputedStyle(element);
|
|
720
|
+
}
|
|
721
|
+
function getNodeScroll(element) {
|
|
722
|
+
if (isElement(element)) {
|
|
723
|
+
return {
|
|
724
|
+
scrollLeft: element.scrollLeft,
|
|
725
|
+
scrollTop: element.scrollTop
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
return {
|
|
729
|
+
scrollLeft: element.scrollX,
|
|
730
|
+
scrollTop: element.scrollY
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function getParentNode(node) {
|
|
734
|
+
if (getNodeName(node) === "html") {
|
|
735
|
+
return node;
|
|
736
|
+
}
|
|
737
|
+
const result = (
|
|
738
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
739
|
+
node.assignedSlot || // DOM Element detected.
|
|
740
|
+
node.parentNode || // ShadowRoot detected.
|
|
741
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
742
|
+
getDocumentElement(node)
|
|
743
|
+
);
|
|
744
|
+
return isShadowRoot(result) ? result.host : result;
|
|
745
|
+
}
|
|
746
|
+
function getNearestOverflowAncestor(node) {
|
|
747
|
+
const parentNode = getParentNode(node);
|
|
748
|
+
if (isLastTraversableNode(parentNode)) {
|
|
749
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
750
|
+
}
|
|
751
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
752
|
+
return parentNode;
|
|
753
|
+
}
|
|
754
|
+
return getNearestOverflowAncestor(parentNode);
|
|
755
|
+
}
|
|
756
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
757
|
+
var _node$ownerDocument2;
|
|
758
|
+
if (list === void 0) {
|
|
759
|
+
list = [];
|
|
760
|
+
}
|
|
761
|
+
if (traverseIframes === void 0) {
|
|
762
|
+
traverseIframes = true;
|
|
763
|
+
}
|
|
764
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
765
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
766
|
+
const win = getWindow(scrollableAncestor);
|
|
767
|
+
if (isBody) {
|
|
768
|
+
const frameElement = getFrameElement(win);
|
|
769
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
770
|
+
} else {
|
|
771
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function getFrameElement(win) {
|
|
775
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// ../../node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
779
|
+
function getCssDimensions(element) {
|
|
780
|
+
const css4 = getComputedStyle2(element);
|
|
781
|
+
let width = parseFloat(css4.width) || 0;
|
|
782
|
+
let height = parseFloat(css4.height) || 0;
|
|
783
|
+
const hasOffset = isHTMLElement(element);
|
|
784
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
785
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
786
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
787
|
+
if (shouldFallback) {
|
|
788
|
+
width = offsetWidth;
|
|
789
|
+
height = offsetHeight;
|
|
790
|
+
}
|
|
791
|
+
return {
|
|
792
|
+
width,
|
|
793
|
+
height,
|
|
794
|
+
$: shouldFallback
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
function unwrapElement(element) {
|
|
798
|
+
return !isElement(element) ? element.contextElement : element;
|
|
799
|
+
}
|
|
800
|
+
function getScale(element) {
|
|
801
|
+
const domElement = unwrapElement(element);
|
|
802
|
+
if (!isHTMLElement(domElement)) {
|
|
803
|
+
return createCoords(1);
|
|
804
|
+
}
|
|
805
|
+
const rect = domElement.getBoundingClientRect();
|
|
806
|
+
const {
|
|
807
|
+
width,
|
|
808
|
+
height,
|
|
809
|
+
$
|
|
810
|
+
} = getCssDimensions(domElement);
|
|
811
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
812
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
813
|
+
if (!x || !Number.isFinite(x)) {
|
|
814
|
+
x = 1;
|
|
815
|
+
}
|
|
816
|
+
if (!y || !Number.isFinite(y)) {
|
|
817
|
+
y = 1;
|
|
818
|
+
}
|
|
819
|
+
return {
|
|
820
|
+
x,
|
|
821
|
+
y
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
var noOffsets = /* @__PURE__ */ createCoords(0);
|
|
825
|
+
function getVisualOffsets(element) {
|
|
826
|
+
const win = getWindow(element);
|
|
827
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
828
|
+
return noOffsets;
|
|
829
|
+
}
|
|
830
|
+
return {
|
|
831
|
+
x: win.visualViewport.offsetLeft,
|
|
832
|
+
y: win.visualViewport.offsetTop
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
836
|
+
if (isFixed === void 0) {
|
|
837
|
+
isFixed = false;
|
|
838
|
+
}
|
|
839
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
840
|
+
return false;
|
|
841
|
+
}
|
|
842
|
+
return isFixed;
|
|
843
|
+
}
|
|
844
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
845
|
+
if (includeScale === void 0) {
|
|
846
|
+
includeScale = false;
|
|
847
|
+
}
|
|
848
|
+
if (isFixedStrategy === void 0) {
|
|
849
|
+
isFixedStrategy = false;
|
|
850
|
+
}
|
|
851
|
+
const clientRect = element.getBoundingClientRect();
|
|
852
|
+
const domElement = unwrapElement(element);
|
|
853
|
+
let scale = createCoords(1);
|
|
854
|
+
if (includeScale) {
|
|
855
|
+
if (offsetParent) {
|
|
856
|
+
if (isElement(offsetParent)) {
|
|
857
|
+
scale = getScale(offsetParent);
|
|
858
|
+
}
|
|
859
|
+
} else {
|
|
860
|
+
scale = getScale(element);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
864
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
865
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
866
|
+
let width = clientRect.width / scale.x;
|
|
867
|
+
let height = clientRect.height / scale.y;
|
|
868
|
+
if (domElement) {
|
|
869
|
+
const win = getWindow(domElement);
|
|
870
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
871
|
+
let currentWin = win;
|
|
872
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
873
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
874
|
+
const iframeScale = getScale(currentIFrame);
|
|
875
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
876
|
+
const css4 = getComputedStyle2(currentIFrame);
|
|
877
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css4.paddingLeft)) * iframeScale.x;
|
|
878
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css4.paddingTop)) * iframeScale.y;
|
|
879
|
+
x *= iframeScale.x;
|
|
880
|
+
y *= iframeScale.y;
|
|
881
|
+
width *= iframeScale.x;
|
|
882
|
+
height *= iframeScale.y;
|
|
883
|
+
x += left;
|
|
884
|
+
y += top;
|
|
885
|
+
currentWin = getWindow(currentIFrame);
|
|
886
|
+
currentIFrame = getFrameElement(currentWin);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return rectToClientRect({
|
|
890
|
+
width,
|
|
891
|
+
height,
|
|
892
|
+
x,
|
|
893
|
+
y
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
function getWindowScrollBarX(element, rect) {
|
|
897
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
898
|
+
if (!rect) {
|
|
899
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
900
|
+
}
|
|
901
|
+
return rect.left + leftScroll;
|
|
902
|
+
}
|
|
903
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
904
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
905
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
906
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
907
|
+
return {
|
|
908
|
+
x,
|
|
909
|
+
y
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
913
|
+
let {
|
|
914
|
+
elements,
|
|
915
|
+
rect,
|
|
916
|
+
offsetParent,
|
|
917
|
+
strategy
|
|
918
|
+
} = _ref;
|
|
919
|
+
const isFixed = strategy === "fixed";
|
|
920
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
921
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
922
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
923
|
+
return rect;
|
|
924
|
+
}
|
|
925
|
+
let scroll = {
|
|
926
|
+
scrollLeft: 0,
|
|
927
|
+
scrollTop: 0
|
|
928
|
+
};
|
|
929
|
+
let scale = createCoords(1);
|
|
930
|
+
const offsets = createCoords(0);
|
|
931
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
932
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
933
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
934
|
+
scroll = getNodeScroll(offsetParent);
|
|
935
|
+
}
|
|
936
|
+
if (isOffsetParentAnElement) {
|
|
937
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
938
|
+
scale = getScale(offsetParent);
|
|
939
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
940
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
944
|
+
return {
|
|
945
|
+
width: rect.width * scale.x,
|
|
946
|
+
height: rect.height * scale.y,
|
|
947
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
948
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function getClientRects(element) {
|
|
952
|
+
return Array.from(element.getClientRects());
|
|
953
|
+
}
|
|
954
|
+
function getDocumentRect(element) {
|
|
955
|
+
const html3 = getDocumentElement(element);
|
|
956
|
+
const scroll = getNodeScroll(element);
|
|
957
|
+
const body = element.ownerDocument.body;
|
|
958
|
+
const width = max(html3.scrollWidth, html3.clientWidth, body.scrollWidth, body.clientWidth);
|
|
959
|
+
const height = max(html3.scrollHeight, html3.clientHeight, body.scrollHeight, body.clientHeight);
|
|
960
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
961
|
+
const y = -scroll.scrollTop;
|
|
962
|
+
if (getComputedStyle2(body).direction === "rtl") {
|
|
963
|
+
x += max(html3.clientWidth, body.clientWidth) - width;
|
|
964
|
+
}
|
|
965
|
+
return {
|
|
966
|
+
width,
|
|
967
|
+
height,
|
|
968
|
+
x,
|
|
969
|
+
y
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
var SCROLLBAR_MAX = 25;
|
|
973
|
+
function getViewportRect(element, strategy) {
|
|
974
|
+
const win = getWindow(element);
|
|
975
|
+
const html3 = getDocumentElement(element);
|
|
976
|
+
const visualViewport = win.visualViewport;
|
|
977
|
+
let width = html3.clientWidth;
|
|
978
|
+
let height = html3.clientHeight;
|
|
979
|
+
let x = 0;
|
|
980
|
+
let y = 0;
|
|
981
|
+
if (visualViewport) {
|
|
982
|
+
width = visualViewport.width;
|
|
983
|
+
height = visualViewport.height;
|
|
984
|
+
const visualViewportBased = isWebKit();
|
|
985
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
986
|
+
x = visualViewport.offsetLeft;
|
|
987
|
+
y = visualViewport.offsetTop;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
const windowScrollbarX = getWindowScrollBarX(html3);
|
|
991
|
+
if (windowScrollbarX <= 0) {
|
|
992
|
+
const doc = html3.ownerDocument;
|
|
993
|
+
const body = doc.body;
|
|
994
|
+
const bodyStyles = getComputedStyle(body);
|
|
995
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
996
|
+
const clippingStableScrollbarWidth = Math.abs(html3.clientWidth - body.clientWidth - bodyMarginInline);
|
|
997
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
998
|
+
width -= clippingStableScrollbarWidth;
|
|
999
|
+
}
|
|
1000
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
1001
|
+
width += windowScrollbarX;
|
|
1002
|
+
}
|
|
1003
|
+
return {
|
|
1004
|
+
width,
|
|
1005
|
+
height,
|
|
1006
|
+
x,
|
|
1007
|
+
y
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1011
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1012
|
+
const top = clientRect.top + element.clientTop;
|
|
1013
|
+
const left = clientRect.left + element.clientLeft;
|
|
1014
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1015
|
+
const width = element.clientWidth * scale.x;
|
|
1016
|
+
const height = element.clientHeight * scale.y;
|
|
1017
|
+
const x = left * scale.x;
|
|
1018
|
+
const y = top * scale.y;
|
|
1019
|
+
return {
|
|
1020
|
+
width,
|
|
1021
|
+
height,
|
|
1022
|
+
x,
|
|
1023
|
+
y
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1027
|
+
let rect;
|
|
1028
|
+
if (clippingAncestor === "viewport") {
|
|
1029
|
+
rect = getViewportRect(element, strategy);
|
|
1030
|
+
} else if (clippingAncestor === "document") {
|
|
1031
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
1032
|
+
} else if (isElement(clippingAncestor)) {
|
|
1033
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1034
|
+
} else {
|
|
1035
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1036
|
+
rect = {
|
|
1037
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1038
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1039
|
+
width: clippingAncestor.width,
|
|
1040
|
+
height: clippingAncestor.height
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
return rectToClientRect(rect);
|
|
1044
|
+
}
|
|
1045
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1046
|
+
const parentNode = getParentNode(element);
|
|
1047
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1051
|
+
}
|
|
1052
|
+
function getClippingElementAncestors(element, cache) {
|
|
1053
|
+
const cachedResult = cache.get(element);
|
|
1054
|
+
if (cachedResult) {
|
|
1055
|
+
return cachedResult;
|
|
1056
|
+
}
|
|
1057
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1058
|
+
let currentContainingBlockComputedStyle = null;
|
|
1059
|
+
const elementIsFixed = getComputedStyle2(element).position === "fixed";
|
|
1060
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1061
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1062
|
+
const computedStyle = getComputedStyle2(currentNode);
|
|
1063
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1064
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
1065
|
+
currentContainingBlockComputedStyle = null;
|
|
1066
|
+
}
|
|
1067
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1068
|
+
if (shouldDropCurrentNode) {
|
|
1069
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1070
|
+
} else {
|
|
1071
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1072
|
+
}
|
|
1073
|
+
currentNode = getParentNode(currentNode);
|
|
1074
|
+
}
|
|
1075
|
+
cache.set(element, result);
|
|
1076
|
+
return result;
|
|
1077
|
+
}
|
|
1078
|
+
function getClippingRect(_ref) {
|
|
1079
|
+
let {
|
|
1080
|
+
element,
|
|
1081
|
+
boundary,
|
|
1082
|
+
rootBoundary,
|
|
1083
|
+
strategy
|
|
1084
|
+
} = _ref;
|
|
1085
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1086
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1087
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1088
|
+
let top = firstRect.top;
|
|
1089
|
+
let right = firstRect.right;
|
|
1090
|
+
let bottom = firstRect.bottom;
|
|
1091
|
+
let left = firstRect.left;
|
|
1092
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
1093
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
1094
|
+
top = max(rect.top, top);
|
|
1095
|
+
right = min(rect.right, right);
|
|
1096
|
+
bottom = min(rect.bottom, bottom);
|
|
1097
|
+
left = max(rect.left, left);
|
|
1098
|
+
}
|
|
1099
|
+
return {
|
|
1100
|
+
width: right - left,
|
|
1101
|
+
height: bottom - top,
|
|
1102
|
+
x: left,
|
|
1103
|
+
y: top
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
function getDimensions(element) {
|
|
1107
|
+
const {
|
|
1108
|
+
width,
|
|
1109
|
+
height
|
|
1110
|
+
} = getCssDimensions(element);
|
|
1111
|
+
return {
|
|
1112
|
+
width,
|
|
1113
|
+
height
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1117
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1118
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1119
|
+
const isFixed = strategy === "fixed";
|
|
1120
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1121
|
+
let scroll = {
|
|
1122
|
+
scrollLeft: 0,
|
|
1123
|
+
scrollTop: 0
|
|
1124
|
+
};
|
|
1125
|
+
const offsets = createCoords(0);
|
|
1126
|
+
function setLeftRTLScrollbarOffset() {
|
|
1127
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1128
|
+
}
|
|
1129
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1130
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1131
|
+
scroll = getNodeScroll(offsetParent);
|
|
1132
|
+
}
|
|
1133
|
+
if (isOffsetParentAnElement) {
|
|
1134
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1135
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1136
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1137
|
+
} else if (documentElement) {
|
|
1138
|
+
setLeftRTLScrollbarOffset();
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1142
|
+
setLeftRTLScrollbarOffset();
|
|
1143
|
+
}
|
|
1144
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1145
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1146
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1147
|
+
return {
|
|
1148
|
+
x,
|
|
1149
|
+
y,
|
|
1150
|
+
width: rect.width,
|
|
1151
|
+
height: rect.height
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
function isStaticPositioned(element) {
|
|
1155
|
+
return getComputedStyle2(element).position === "static";
|
|
1156
|
+
}
|
|
1157
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1158
|
+
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
|
|
1159
|
+
return null;
|
|
1160
|
+
}
|
|
1161
|
+
if (polyfill) {
|
|
1162
|
+
return polyfill(element);
|
|
1163
|
+
}
|
|
1164
|
+
let rawOffsetParent = element.offsetParent;
|
|
1165
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1166
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1167
|
+
}
|
|
1168
|
+
return rawOffsetParent;
|
|
1169
|
+
}
|
|
1170
|
+
function getOffsetParent(element, polyfill) {
|
|
1171
|
+
const win = getWindow(element);
|
|
1172
|
+
if (isTopLayer(element)) {
|
|
1173
|
+
return win;
|
|
1174
|
+
}
|
|
1175
|
+
if (!isHTMLElement(element)) {
|
|
1176
|
+
let svgOffsetParent = getParentNode(element);
|
|
1177
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1178
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1179
|
+
return svgOffsetParent;
|
|
1180
|
+
}
|
|
1181
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1182
|
+
}
|
|
1183
|
+
return win;
|
|
1184
|
+
}
|
|
1185
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1186
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1187
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1188
|
+
}
|
|
1189
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1190
|
+
return win;
|
|
1191
|
+
}
|
|
1192
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1193
|
+
}
|
|
1194
|
+
var getElementRects = async function(data) {
|
|
1195
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1196
|
+
const getDimensionsFn = this.getDimensions;
|
|
1197
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1198
|
+
return {
|
|
1199
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1200
|
+
floating: {
|
|
1201
|
+
x: 0,
|
|
1202
|
+
y: 0,
|
|
1203
|
+
width: floatingDimensions.width,
|
|
1204
|
+
height: floatingDimensions.height
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
};
|
|
1208
|
+
function isRTL(element) {
|
|
1209
|
+
return getComputedStyle2(element).direction === "rtl";
|
|
1210
|
+
}
|
|
1211
|
+
var platform = {
|
|
1212
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1213
|
+
getDocumentElement,
|
|
1214
|
+
getClippingRect,
|
|
1215
|
+
getOffsetParent,
|
|
1216
|
+
getElementRects,
|
|
1217
|
+
getClientRects,
|
|
1218
|
+
getDimensions,
|
|
1219
|
+
getScale,
|
|
1220
|
+
isElement,
|
|
1221
|
+
isRTL
|
|
1222
|
+
};
|
|
1223
|
+
function rectsAreEqual(a, b) {
|
|
1224
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1225
|
+
}
|
|
1226
|
+
function observeMove(element, onMove) {
|
|
1227
|
+
let io = null;
|
|
1228
|
+
let timeoutId;
|
|
1229
|
+
const root = getDocumentElement(element);
|
|
1230
|
+
function cleanup() {
|
|
1231
|
+
var _io;
|
|
1232
|
+
clearTimeout(timeoutId);
|
|
1233
|
+
(_io = io) == null || _io.disconnect();
|
|
1234
|
+
io = null;
|
|
1235
|
+
}
|
|
1236
|
+
function refresh(skip, threshold) {
|
|
1237
|
+
if (skip === void 0) {
|
|
1238
|
+
skip = false;
|
|
1239
|
+
}
|
|
1240
|
+
if (threshold === void 0) {
|
|
1241
|
+
threshold = 1;
|
|
1242
|
+
}
|
|
1243
|
+
cleanup();
|
|
1244
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1245
|
+
const {
|
|
1246
|
+
left,
|
|
1247
|
+
top,
|
|
1248
|
+
width,
|
|
1249
|
+
height
|
|
1250
|
+
} = elementRectForRootMargin;
|
|
1251
|
+
if (!skip) {
|
|
1252
|
+
onMove();
|
|
1253
|
+
}
|
|
1254
|
+
if (!width || !height) {
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
const insetTop = floor(top);
|
|
1258
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
1259
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1260
|
+
const insetLeft = floor(left);
|
|
1261
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1262
|
+
const options = {
|
|
1263
|
+
rootMargin,
|
|
1264
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
1265
|
+
};
|
|
1266
|
+
let isFirstUpdate = true;
|
|
1267
|
+
function handleObserve(entries) {
|
|
1268
|
+
const ratio = entries[0].intersectionRatio;
|
|
1269
|
+
if (ratio !== threshold) {
|
|
1270
|
+
if (!isFirstUpdate) {
|
|
1271
|
+
return refresh();
|
|
1272
|
+
}
|
|
1273
|
+
if (!ratio) {
|
|
1274
|
+
timeoutId = setTimeout(() => {
|
|
1275
|
+
refresh(false, 1e-7);
|
|
1276
|
+
}, 1e3);
|
|
1277
|
+
} else {
|
|
1278
|
+
refresh(false, ratio);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
1282
|
+
refresh();
|
|
1283
|
+
}
|
|
1284
|
+
isFirstUpdate = false;
|
|
1285
|
+
}
|
|
1286
|
+
try {
|
|
1287
|
+
io = new IntersectionObserver(handleObserve, {
|
|
1288
|
+
...options,
|
|
1289
|
+
// Handle <iframe>s
|
|
1290
|
+
root: root.ownerDocument
|
|
1291
|
+
});
|
|
1292
|
+
} catch (_e) {
|
|
1293
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
1294
|
+
}
|
|
1295
|
+
io.observe(element);
|
|
1296
|
+
}
|
|
1297
|
+
refresh(true);
|
|
1298
|
+
return cleanup;
|
|
1299
|
+
}
|
|
1300
|
+
function autoUpdate(reference, floating, update, options) {
|
|
1301
|
+
if (options === void 0) {
|
|
1302
|
+
options = {};
|
|
1303
|
+
}
|
|
1304
|
+
const {
|
|
1305
|
+
ancestorScroll = true,
|
|
1306
|
+
ancestorResize = true,
|
|
1307
|
+
elementResize = typeof ResizeObserver === "function",
|
|
1308
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
1309
|
+
animationFrame = false
|
|
1310
|
+
} = options;
|
|
1311
|
+
const referenceEl = unwrapElement(reference);
|
|
1312
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
1313
|
+
ancestors.forEach((ancestor) => {
|
|
1314
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
1315
|
+
passive: true
|
|
1316
|
+
});
|
|
1317
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
1318
|
+
});
|
|
1319
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1320
|
+
let reobserveFrame = -1;
|
|
1321
|
+
let resizeObserver = null;
|
|
1322
|
+
if (elementResize) {
|
|
1323
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
1324
|
+
let [firstEntry] = _ref;
|
|
1325
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
1326
|
+
resizeObserver.unobserve(floating);
|
|
1327
|
+
cancelAnimationFrame(reobserveFrame);
|
|
1328
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
1329
|
+
var _resizeObserver;
|
|
1330
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
update();
|
|
1334
|
+
});
|
|
1335
|
+
if (referenceEl && !animationFrame) {
|
|
1336
|
+
resizeObserver.observe(referenceEl);
|
|
1337
|
+
}
|
|
1338
|
+
if (floating) {
|
|
1339
|
+
resizeObserver.observe(floating);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
let frameId;
|
|
1343
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1344
|
+
if (animationFrame) {
|
|
1345
|
+
frameLoop();
|
|
1346
|
+
}
|
|
1347
|
+
function frameLoop() {
|
|
1348
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
1349
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1350
|
+
update();
|
|
1351
|
+
}
|
|
1352
|
+
prevRefRect = nextRefRect;
|
|
1353
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
1354
|
+
}
|
|
1355
|
+
update();
|
|
1356
|
+
return () => {
|
|
1357
|
+
var _resizeObserver2;
|
|
1358
|
+
ancestors.forEach((ancestor) => {
|
|
1359
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
1360
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
1361
|
+
});
|
|
1362
|
+
cleanupIo == null || cleanupIo();
|
|
1363
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1364
|
+
resizeObserver = null;
|
|
1365
|
+
if (animationFrame) {
|
|
1366
|
+
cancelAnimationFrame(frameId);
|
|
1367
|
+
}
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
var offset2 = offset;
|
|
1371
|
+
var shift2 = shift;
|
|
1372
|
+
var flip2 = flip;
|
|
1373
|
+
var computePosition2 = (reference, floating, options) => {
|
|
1374
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1375
|
+
const mergedOptions = {
|
|
1376
|
+
platform,
|
|
1377
|
+
...options
|
|
1378
|
+
};
|
|
1379
|
+
const platformWithCache = {
|
|
1380
|
+
...mergedOptions.platform,
|
|
1381
|
+
_c: cache
|
|
1382
|
+
};
|
|
1383
|
+
return computePosition(reference, floating, {
|
|
1384
|
+
...mergedOptions,
|
|
1385
|
+
platform: platformWithCache
|
|
1386
|
+
});
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
// src/components/shared/floating.ts
|
|
1390
|
+
import { css } from "lit";
|
|
1391
|
+
async function openFloating(reference, floating, opts) {
|
|
1392
|
+
const { placement = "bottom-start", offsetPx = 4, matchWidth = false } = opts ?? {};
|
|
1393
|
+
floating.style.display = "block";
|
|
1394
|
+
floating.style.visibility = "hidden";
|
|
1395
|
+
floating.showPopover?.();
|
|
1396
|
+
const reposition = async () => {
|
|
1397
|
+
if (matchWidth) {
|
|
1398
|
+
floating.style.width = `${reference.getBoundingClientRect().width}px`;
|
|
1399
|
+
}
|
|
1400
|
+
const { x, y } = await computePosition2(reference, floating, {
|
|
1401
|
+
strategy: "fixed",
|
|
1402
|
+
placement,
|
|
1403
|
+
middleware: [offset2(offsetPx), flip2(), shift2({ padding: 8 })]
|
|
1404
|
+
});
|
|
1405
|
+
floating.style.left = `${x}px`;
|
|
1406
|
+
floating.style.top = `${y}px`;
|
|
1407
|
+
};
|
|
1408
|
+
await reposition();
|
|
1409
|
+
floating.style.visibility = "";
|
|
1410
|
+
const cleanup = autoUpdate(reference, floating, reposition);
|
|
1411
|
+
return cleanup;
|
|
1412
|
+
}
|
|
1413
|
+
function closeFloating(floating, cleanup) {
|
|
1414
|
+
cleanup?.();
|
|
1415
|
+
floating.hidePopover?.();
|
|
1416
|
+
floating.style.display = "";
|
|
1417
|
+
}
|
|
1418
|
+
var floatingPanelReset = css`
|
|
1419
|
+
[popover] {
|
|
1420
|
+
border: 0;
|
|
1421
|
+
inset: unset;
|
|
1422
|
+
margin: 0;
|
|
1423
|
+
overflow: visible;
|
|
1424
|
+
padding: 0;
|
|
1425
|
+
position: fixed;
|
|
1426
|
+
}
|
|
1427
|
+
`;
|
|
1428
|
+
|
|
1429
|
+
// src/components/combobox/combobox.styles.ts
|
|
1430
|
+
var comboboxStyles = [
|
|
1431
|
+
floatingPanelReset,
|
|
1432
|
+
css2`
|
|
1433
|
+
:host {
|
|
1434
|
+
display: block;
|
|
1435
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
1436
|
+
position: relative;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
.wrapper {
|
|
1440
|
+
display: flex;
|
|
1441
|
+
flex-direction: column;
|
|
1442
|
+
gap: var(--lt-spacing-1);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
label {
|
|
1446
|
+
color: var(--lt-text-default);
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
.required-indicator {
|
|
1450
|
+
color: var(--lt-color-error-500);
|
|
1451
|
+
margin-left: 2px;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
.input-wrap {
|
|
1455
|
+
align-items: center;
|
|
1456
|
+
background: var(--lt-bg-surface);
|
|
1457
|
+
border-radius: var(--lt-border-radius);
|
|
1458
|
+
border: 1px solid var(--lt-border-default);
|
|
1459
|
+
cursor: text;
|
|
1460
|
+
display: flex;
|
|
1461
|
+
gap: var(--lt-spacing-2);
|
|
1462
|
+
overflow: hidden;
|
|
1463
|
+
position: relative;
|
|
1464
|
+
transition:
|
|
1465
|
+
border-color 150ms ease,
|
|
1466
|
+
box-shadow 150ms ease;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
:host([open]) .input-wrap,
|
|
1470
|
+
.input-wrap:focus-within {
|
|
1471
|
+
border-color: var(--lt-border-primary);
|
|
1472
|
+
box-shadow: 0 0 0 3px var(--lt-bg-primary-subtle);
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
:host([variant='error']) .input-wrap {
|
|
1476
|
+
border-color: var(--lt-color-error-500);
|
|
1477
|
+
}
|
|
1478
|
+
:host([variant='error'][open]) .input-wrap,
|
|
1479
|
+
:host([variant='error']) .input-wrap:focus-within {
|
|
1480
|
+
box-shadow: 0 0 0 3px var(--lt-bg-error-subtle);
|
|
1481
|
+
}
|
|
1482
|
+
:host([variant='success']) .input-wrap {
|
|
1483
|
+
border-color: var(--lt-color-success-500);
|
|
1484
|
+
}
|
|
1485
|
+
:host([variant='warning']) .input-wrap {
|
|
1486
|
+
border-color: var(--lt-color-warning-500);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
:host([disabled]) .input-wrap {
|
|
1490
|
+
background: var(--lt-bg-neutral-subtle);
|
|
1491
|
+
cursor: not-allowed;
|
|
1492
|
+
pointer-events: none;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
input {
|
|
1496
|
+
background: transparent;
|
|
1497
|
+
border: none;
|
|
1498
|
+
color: var(--lt-text-default);
|
|
1499
|
+
flex: 1;
|
|
1500
|
+
font-family: inherit;
|
|
1501
|
+
min-width: 0;
|
|
1502
|
+
outline: none;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
input::placeholder {
|
|
1506
|
+
color: var(--lt-text-placeholder, var(--lt-color-neutral-400));
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
:host([disabled]) input {
|
|
1510
|
+
color: var(--lt-text-subtle);
|
|
1511
|
+
cursor: not-allowed;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/* Sizes */
|
|
1515
|
+
:host([size='sm']) .input-wrap {
|
|
1516
|
+
height: 32px;
|
|
1517
|
+
padding: 0 var(--lt-spacing-2);
|
|
1518
|
+
}
|
|
1519
|
+
:host([size='sm']) input {
|
|
1520
|
+
font-size: 0.8125rem;
|
|
1521
|
+
}
|
|
1522
|
+
:host([size='md']) .input-wrap,
|
|
1523
|
+
:host(:not([size])) .input-wrap {
|
|
1524
|
+
height: 40px;
|
|
1525
|
+
padding: 0 var(--lt-spacing-3);
|
|
1526
|
+
}
|
|
1527
|
+
:host([size='md']) input,
|
|
1528
|
+
:host(:not([size])) input {
|
|
1529
|
+
font-size: 0.9375rem;
|
|
1530
|
+
}
|
|
1531
|
+
:host([size='lg']) .input-wrap {
|
|
1532
|
+
height: 48px;
|
|
1533
|
+
padding: 0 var(--lt-spacing-4);
|
|
1534
|
+
}
|
|
1535
|
+
:host([size='lg']) input {
|
|
1536
|
+
font-size: 1rem;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
.chevron {
|
|
1540
|
+
color: var(--lt-text-subtle);
|
|
1541
|
+
flex-shrink: 0;
|
|
1542
|
+
pointer-events: none;
|
|
1543
|
+
transition: transform 150ms ease;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
:host([open]) .chevron {
|
|
1547
|
+
transform: rotate(180deg);
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
.dropdown {
|
|
1551
|
+
background: var(--lt-bg-surface);
|
|
1552
|
+
border-radius: var(--lt-border-radius);
|
|
1553
|
+
border: 1px solid var(--lt-border-default);
|
|
1554
|
+
box-shadow: var(--lt-shadow-md);
|
|
1555
|
+
max-height: 240px;
|
|
1556
|
+
overflow-y: auto;
|
|
1557
|
+
z-index: 100;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.option {
|
|
1561
|
+
align-items: center;
|
|
1562
|
+
background: transparent;
|
|
1563
|
+
border: none;
|
|
1564
|
+
color: var(--lt-text-default);
|
|
1565
|
+
cursor: pointer;
|
|
1566
|
+
display: flex;
|
|
1567
|
+
font-family: inherit;
|
|
1568
|
+
font-size: 0.9375rem;
|
|
1569
|
+
padding: var(--lt-spacing-2) var(--lt-spacing-3);
|
|
1570
|
+
text-align: left;
|
|
1571
|
+
width: 100%;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
.option:hover {
|
|
1575
|
+
background: var(--lt-bg-neutral-subtle);
|
|
1576
|
+
}
|
|
1577
|
+
.option[aria-selected='true'] {
|
|
1578
|
+
background: var(--lt-bg-primary-subtle);
|
|
1579
|
+
color: var(--lt-color-primary-700);
|
|
1580
|
+
font-weight: 500;
|
|
1581
|
+
}
|
|
1582
|
+
.option[disabled] {
|
|
1583
|
+
color: var(--lt-text-subtle);
|
|
1584
|
+
cursor: not-allowed;
|
|
1585
|
+
pointer-events: none;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
.no-results {
|
|
1589
|
+
color: var(--lt-text-subtle);
|
|
1590
|
+
font-size: 0.875rem;
|
|
1591
|
+
padding: var(--lt-spacing-3);
|
|
1592
|
+
text-align: center;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
.helper-text {
|
|
1596
|
+
color: var(--lt-text-subtle);
|
|
1597
|
+
font-size: 0.8125rem;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
:host([variant='error']) .helper-text {
|
|
1601
|
+
color: var(--lt-color-error-600);
|
|
1602
|
+
}
|
|
1603
|
+
:host([variant='success']) .helper-text {
|
|
1604
|
+
color: var(--lt-color-success-600);
|
|
1605
|
+
}
|
|
1606
|
+
:host([variant='warning']) .helper-text {
|
|
1607
|
+
color: var(--lt-color-warning-700);
|
|
1608
|
+
}
|
|
1609
|
+
`
|
|
1610
|
+
];
|
|
1611
|
+
|
|
1612
|
+
// src/utils/dispatch.ts
|
|
1613
|
+
var dispatch = (host, name, detail, init) => host.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true, ...init }));
|
|
1614
|
+
|
|
1615
|
+
// src/utils/click-outside.ts
|
|
1616
|
+
var createClickOutsideHandler = (host, onOutside, options) => {
|
|
1617
|
+
const eventName = options?.event ?? "pointerdown";
|
|
1618
|
+
const capture = options?.capture ?? false;
|
|
1619
|
+
const handler = (e) => {
|
|
1620
|
+
if (!e.composedPath().includes(host)) onOutside();
|
|
1621
|
+
};
|
|
1622
|
+
document.addEventListener(eventName, handler, capture ? { capture: true } : void 0);
|
|
1623
|
+
return () => document.removeEventListener(eventName, handler, capture ? { capture: true } : void 0);
|
|
1624
|
+
};
|
|
1625
|
+
|
|
1626
|
+
// src/components/combobox/combobox.ts
|
|
1627
|
+
import "@latty-ds/icons";
|
|
1628
|
+
|
|
1629
|
+
// src/components/text/text.ts
|
|
1630
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
1631
|
+
import { html, unsafeStatic } from "lit/static-html.js";
|
|
1632
|
+
|
|
1633
|
+
// src/components/text/text.styles.ts
|
|
1634
|
+
import { css as css3 } from "lit";
|
|
1635
|
+
var textStyles = css3`
|
|
1636
|
+
:host {
|
|
1637
|
+
display: block;
|
|
1638
|
+
color: inherit;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
/* Inline variants sit in text flow */
|
|
1642
|
+
:host([variant='caption']),
|
|
1643
|
+
:host([variant='overline']),
|
|
1644
|
+
:host([variant='label']) {
|
|
1645
|
+
display: inline;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
[part='base'] {
|
|
1649
|
+
margin: 0;
|
|
1650
|
+
color: inherit;
|
|
1651
|
+
font-family: var(--lt-typography-fontfamily);
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
/* ── Display ─────────────────────────────────────────────────────────── */
|
|
1655
|
+
|
|
1656
|
+
:host([variant='display-2xl']) [part='base'] {
|
|
1657
|
+
font-size: clamp(2.5rem, 6vw, 4.5rem);
|
|
1658
|
+
font-weight: var(--lt-text-weight, 200);
|
|
1659
|
+
line-height: 1.1;
|
|
1660
|
+
letter-spacing: -0.02em;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
:host([variant='display-xl']) [part='base'] {
|
|
1664
|
+
font-size: clamp(2rem, 5vw, 3.75rem);
|
|
1665
|
+
font-weight: var(--lt-text-weight, 200);
|
|
1666
|
+
line-height: 1.1;
|
|
1667
|
+
letter-spacing: -0.02em;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
:host([variant='display-lg']) [part='base'] {
|
|
1671
|
+
font-size: clamp(2rem, 4vw, 3rem);
|
|
1672
|
+
font-weight: var(--lt-text-weight, 200);
|
|
1673
|
+
line-height: 1.15;
|
|
1674
|
+
letter-spacing: -0.01em;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
/* ── Headings ─────────────────────────────────────────────────────────── */
|
|
1678
|
+
|
|
1679
|
+
:host([variant='h1']) [part='base'] {
|
|
1680
|
+
font-size: clamp(1.75rem, 2.5vw + 0.75rem, 2.5rem);
|
|
1681
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1682
|
+
line-height: 1.2;
|
|
1683
|
+
letter-spacing: -0.02em;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
:host([variant='h2']) [part='base'] {
|
|
1687
|
+
font-size: clamp(1.5rem, 2vw + 0.5rem, 2rem);
|
|
1688
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1689
|
+
line-height: 1.25;
|
|
1690
|
+
letter-spacing: -0.01em;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
:host([variant='h3']) [part='base'] {
|
|
1694
|
+
font-size: clamp(1.25rem, 1.5vw + 0.5rem, 1.5rem);
|
|
1695
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1696
|
+
line-height: 1.3;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
:host([variant='h4']) [part='base'] {
|
|
1700
|
+
font-size: 1.25rem;
|
|
1701
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1702
|
+
line-height: 1.35;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
:host([variant='h5']) [part='base'] {
|
|
1706
|
+
font-size: 1.125rem;
|
|
1707
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1708
|
+
line-height: 1.4;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
:host([variant='h6']) [part='base'] {
|
|
1712
|
+
font-size: 1rem;
|
|
1713
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1714
|
+
line-height: 1.4;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
/* ── Body ─────────────────────────────────────────────────────────────── */
|
|
1718
|
+
|
|
1719
|
+
:host([variant='lead']) [part='base'] {
|
|
1720
|
+
font-size: 1.25rem;
|
|
1721
|
+
font-weight: var(--lt-text-weight, 400);
|
|
1722
|
+
line-height: 1.6;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
:host([variant='body']) [part='base'],
|
|
1726
|
+
:host(:not([variant])) [part='base'] {
|
|
1727
|
+
font-size: 1rem;
|
|
1728
|
+
font-weight: var(--lt-text-weight, 400);
|
|
1729
|
+
line-height: 1.6;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
:host([variant='body-sm']) [part='base'] {
|
|
1733
|
+
font-size: 0.875rem;
|
|
1734
|
+
font-weight: var(--lt-text-weight, 400);
|
|
1735
|
+
line-height: 1.6;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
/* ── Inline ───────────────────────────────────────────────────────────── */
|
|
1739
|
+
|
|
1740
|
+
:host([variant='caption']) [part='base'] {
|
|
1741
|
+
font-size: 0.75rem;
|
|
1742
|
+
font-weight: var(--lt-text-weight, 400);
|
|
1743
|
+
line-height: 1.5;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
:host([variant='overline']) [part='base'] {
|
|
1747
|
+
font-size: 0.6875rem;
|
|
1748
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1749
|
+
line-height: 1.2;
|
|
1750
|
+
letter-spacing: 0.08em;
|
|
1751
|
+
text-transform: uppercase;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
:host([variant='label']) [part='base'] {
|
|
1755
|
+
font-size: 0.875rem;
|
|
1756
|
+
font-weight: var(--lt-text-weight, 600);
|
|
1757
|
+
line-height: 1.4;
|
|
1758
|
+
}
|
|
1759
|
+
`;
|
|
1760
|
+
|
|
1761
|
+
// src/components/text/text.ts
|
|
1762
|
+
var VARIANT_TAG = {
|
|
1763
|
+
"display-2xl": "p",
|
|
1764
|
+
"display-xl": "p",
|
|
1765
|
+
"display-lg": "p",
|
|
1766
|
+
h1: "h1",
|
|
1767
|
+
h2: "h2",
|
|
1768
|
+
h3: "h3",
|
|
1769
|
+
h4: "h4",
|
|
1770
|
+
h5: "h5",
|
|
1771
|
+
h6: "h6",
|
|
1772
|
+
lead: "p",
|
|
1773
|
+
body: "p",
|
|
1774
|
+
"body-sm": "p",
|
|
1775
|
+
caption: "span",
|
|
1776
|
+
overline: "span",
|
|
1777
|
+
label: "span"
|
|
1778
|
+
};
|
|
1779
|
+
var Text = class extends ThemeableElement {
|
|
1780
|
+
constructor() {
|
|
1781
|
+
super(...arguments);
|
|
1782
|
+
this.variant = "body";
|
|
1783
|
+
this.as = "";
|
|
1784
|
+
}
|
|
1785
|
+
render() {
|
|
1786
|
+
const tag = unsafeStatic(this.as || VARIANT_TAG[this.variant] || "p");
|
|
1787
|
+
return html`<${tag} part="base"><slot></slot></${tag}>`;
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
Text.styles = textStyles;
|
|
1791
|
+
__decorateClass([
|
|
1792
|
+
property2({ reflect: true })
|
|
1793
|
+
], Text.prototype, "variant", 2);
|
|
1794
|
+
__decorateClass([
|
|
1795
|
+
property2({ reflect: true })
|
|
1796
|
+
], Text.prototype, "as", 2);
|
|
1797
|
+
Text = __decorateClass([
|
|
1798
|
+
customElement("lt-text")
|
|
1799
|
+
], Text);
|
|
1800
|
+
|
|
1801
|
+
// src/components/combobox/combobox.ts
|
|
1802
|
+
var Combobox = class extends ThemeableElement {
|
|
1803
|
+
constructor() {
|
|
1804
|
+
super(...arguments);
|
|
1805
|
+
this.options = [];
|
|
1806
|
+
this.value = "";
|
|
1807
|
+
this.label = "";
|
|
1808
|
+
this.placeholder = "Search\u2026";
|
|
1809
|
+
this.helperText = "";
|
|
1810
|
+
this.variant = "default";
|
|
1811
|
+
this.size = "md";
|
|
1812
|
+
this.disabled = false;
|
|
1813
|
+
this.required = false;
|
|
1814
|
+
this.name = "";
|
|
1815
|
+
this.query = "";
|
|
1816
|
+
this.open = false;
|
|
1817
|
+
this.activeIndex = -1;
|
|
1818
|
+
this._cleanupClickOutside = null;
|
|
1819
|
+
this._floatingCleanup = null;
|
|
1820
|
+
}
|
|
1821
|
+
get selectedLabel() {
|
|
1822
|
+
return this.options.find((o) => o.value === this.value)?.label ?? "";
|
|
1823
|
+
}
|
|
1824
|
+
get filtered() {
|
|
1825
|
+
const q = this.query.toLowerCase();
|
|
1826
|
+
return this.options.filter((o) => o.label.toLowerCase().includes(q));
|
|
1827
|
+
}
|
|
1828
|
+
async openDropdown() {
|
|
1829
|
+
if (this.disabled) return;
|
|
1830
|
+
this.open = true;
|
|
1831
|
+
this.setAttribute("open", "");
|
|
1832
|
+
this.query = "";
|
|
1833
|
+
this.activeIndex = -1;
|
|
1834
|
+
await this.updateComplete;
|
|
1835
|
+
const inputWrap = this.shadowRoot.querySelector(".input-wrap");
|
|
1836
|
+
const dropdown = this.shadowRoot.querySelector(".dropdown");
|
|
1837
|
+
if (inputWrap && dropdown) {
|
|
1838
|
+
this._floatingCleanup = await openFloating(inputWrap, dropdown, { matchWidth: true });
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
closeDropdown() {
|
|
1842
|
+
const dropdown = this.shadowRoot?.querySelector(".dropdown");
|
|
1843
|
+
if (dropdown) closeFloating(dropdown, this._floatingCleanup);
|
|
1844
|
+
this._floatingCleanup = null;
|
|
1845
|
+
this.open = false;
|
|
1846
|
+
this.removeAttribute("open");
|
|
1847
|
+
}
|
|
1848
|
+
selectOption(opt) {
|
|
1849
|
+
if (opt.disabled) return;
|
|
1850
|
+
this.value = opt.value;
|
|
1851
|
+
this.closeDropdown();
|
|
1852
|
+
dispatch(this, "change", { value: opt.value, label: opt.label });
|
|
1853
|
+
}
|
|
1854
|
+
handleInput(e) {
|
|
1855
|
+
this.query = e.target.value;
|
|
1856
|
+
this.activeIndex = -1;
|
|
1857
|
+
if (!this.open) this.openDropdown();
|
|
1858
|
+
}
|
|
1859
|
+
handleFocus() {
|
|
1860
|
+
this.openDropdown();
|
|
1861
|
+
}
|
|
1862
|
+
handleKeydown(e) {
|
|
1863
|
+
const opts = this.filtered.filter((o) => !o.disabled);
|
|
1864
|
+
if (e.key === "Escape") {
|
|
1865
|
+
this.closeDropdown();
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
if (e.key === "ArrowDown") {
|
|
1869
|
+
e.preventDefault();
|
|
1870
|
+
this.activeIndex = Math.min(this.activeIndex + 1, opts.length - 1);
|
|
1871
|
+
} else if (e.key === "ArrowUp") {
|
|
1872
|
+
e.preventDefault();
|
|
1873
|
+
this.activeIndex = Math.max(this.activeIndex - 1, 0);
|
|
1874
|
+
} else if (e.key === "Enter" && this.activeIndex >= 0) {
|
|
1875
|
+
e.preventDefault();
|
|
1876
|
+
this.selectOption(opts[this.activeIndex]);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
connectedCallback() {
|
|
1880
|
+
super.connectedCallback();
|
|
1881
|
+
this._cleanupClickOutside = createClickOutsideHandler(this, () => this.closeDropdown(), { event: "click" });
|
|
1882
|
+
}
|
|
1883
|
+
disconnectedCallback() {
|
|
1884
|
+
super.disconnectedCallback();
|
|
1885
|
+
this._cleanupClickOutside?.();
|
|
1886
|
+
this._cleanupClickOutside = null;
|
|
1887
|
+
this._floatingCleanup?.();
|
|
1888
|
+
this._floatingCleanup = null;
|
|
1889
|
+
}
|
|
1890
|
+
render() {
|
|
1891
|
+
const opts = this.filtered;
|
|
1892
|
+
const displayValue = this.open ? this.query : this.selectedLabel;
|
|
1893
|
+
const inputRow = html2`
|
|
1894
|
+
<div class="input-wrap" @click=${this.openDropdown}>
|
|
1895
|
+
<input
|
|
1896
|
+
id="combobox-input"
|
|
1897
|
+
role="combobox"
|
|
1898
|
+
aria-expanded=${this.open}
|
|
1899
|
+
aria-autocomplete="list"
|
|
1900
|
+
aria-required=${this.required}
|
|
1901
|
+
autocomplete="off"
|
|
1902
|
+
name=${this.name || nothing}
|
|
1903
|
+
placeholder=${this.open ? this.placeholder : this.selectedLabel || this.placeholder}
|
|
1904
|
+
.value=${displayValue}
|
|
1905
|
+
?disabled=${this.disabled}
|
|
1906
|
+
@focus=${this.handleFocus}
|
|
1907
|
+
@input=${this.handleInput}
|
|
1908
|
+
@keydown=${this.handleKeydown}
|
|
1909
|
+
/>
|
|
1910
|
+
<lt-icon class="chevron" name="nav-arrow-down" size="sm"></lt-icon>
|
|
1911
|
+
</div>
|
|
1912
|
+
`;
|
|
1913
|
+
return html2`
|
|
1914
|
+
<div class="wrapper">
|
|
1915
|
+
${this.label ? html2`<label for="combobox-input">
|
|
1916
|
+
<lt-text variant="label" as="span">${this.label}</lt-text>
|
|
1917
|
+
${this.required ? html2`<span class="required-indicator">*</span>` : nothing}
|
|
1918
|
+
</label>` : nothing}
|
|
1919
|
+
${inputRow}
|
|
1920
|
+
${this.open ? html2`
|
|
1921
|
+
<div class="dropdown" popover="manual" role="listbox">
|
|
1922
|
+
${opts.length > 0 ? opts.map(
|
|
1923
|
+
(opt, i) => html2`
|
|
1924
|
+
<button
|
|
1925
|
+
class="option"
|
|
1926
|
+
role="option"
|
|
1927
|
+
aria-selected=${opt.value === this.value}
|
|
1928
|
+
?disabled=${opt.disabled}
|
|
1929
|
+
data-active=${i === this.activeIndex}
|
|
1930
|
+
@click=${() => this.selectOption(opt)}
|
|
1931
|
+
>
|
|
1932
|
+
${opt.label}
|
|
1933
|
+
</button>
|
|
1934
|
+
`
|
|
1935
|
+
) : html2`<p class="no-results">No results</p>`}
|
|
1936
|
+
</div>
|
|
1937
|
+
` : nothing}
|
|
1938
|
+
${this.helperText ? html2`<span class="helper-text">${this.helperText}</span>` : nothing}
|
|
1939
|
+
</div>
|
|
1940
|
+
`;
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
Combobox.styles = comboboxStyles;
|
|
1944
|
+
__decorateClass([
|
|
1945
|
+
property3({ type: Array })
|
|
1946
|
+
], Combobox.prototype, "options", 2);
|
|
1947
|
+
__decorateClass([
|
|
1948
|
+
property3()
|
|
1949
|
+
], Combobox.prototype, "value", 2);
|
|
1950
|
+
__decorateClass([
|
|
1951
|
+
property3()
|
|
1952
|
+
], Combobox.prototype, "label", 2);
|
|
1953
|
+
__decorateClass([
|
|
1954
|
+
property3()
|
|
1955
|
+
], Combobox.prototype, "placeholder", 2);
|
|
1956
|
+
__decorateClass([
|
|
1957
|
+
property3({ attribute: "helper-text" })
|
|
1958
|
+
], Combobox.prototype, "helperText", 2);
|
|
1959
|
+
__decorateClass([
|
|
1960
|
+
property3({ reflect: true })
|
|
1961
|
+
], Combobox.prototype, "variant", 2);
|
|
1962
|
+
__decorateClass([
|
|
1963
|
+
property3({ reflect: true })
|
|
1964
|
+
], Combobox.prototype, "size", 2);
|
|
1965
|
+
__decorateClass([
|
|
1966
|
+
property3({ type: Boolean, reflect: true })
|
|
1967
|
+
], Combobox.prototype, "disabled", 2);
|
|
1968
|
+
__decorateClass([
|
|
1969
|
+
property3({ type: Boolean, reflect: true })
|
|
1970
|
+
], Combobox.prototype, "required", 2);
|
|
1971
|
+
__decorateClass([
|
|
1972
|
+
property3()
|
|
1973
|
+
], Combobox.prototype, "name", 2);
|
|
1974
|
+
__decorateClass([
|
|
1975
|
+
state()
|
|
1976
|
+
], Combobox.prototype, "query", 2);
|
|
1977
|
+
__decorateClass([
|
|
1978
|
+
state()
|
|
1979
|
+
], Combobox.prototype, "open", 2);
|
|
1980
|
+
__decorateClass([
|
|
1981
|
+
state()
|
|
1982
|
+
], Combobox.prototype, "activeIndex", 2);
|
|
1983
|
+
Combobox = __decorateClass([
|
|
1984
|
+
customElement2("lt-combobox")
|
|
1985
|
+
], Combobox);
|
|
1986
|
+
export {
|
|
1987
|
+
Combobox
|
|
1988
|
+
};
|