@veritree/ui 0.84.0 → 0.84.2
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/mixins/floating-ui.js +26 -29
- package/package.json +1 -1
- package/src/components/Alert/VTAlert.vue +15 -15
package/mixins/floating-ui.js
CHANGED
|
@@ -139,12 +139,7 @@ export const floatingUiMixin = {
|
|
|
139
139
|
const content = document.getElementById(this.componentContent.id);
|
|
140
140
|
const minWidthLimit = Number(this.floatingUiMinWidth);
|
|
141
141
|
|
|
142
|
-
if (
|
|
143
|
-
this.top !== null ||
|
|
144
|
-
this.top !== undefined ||
|
|
145
|
-
this.left !== null ||
|
|
146
|
-
this.left !== undefined
|
|
147
|
-
) {
|
|
142
|
+
if (this.top || this.left) {
|
|
148
143
|
this.positionContentToTriggerByTopAndLeft(
|
|
149
144
|
trigger,
|
|
150
145
|
content,
|
|
@@ -153,29 +148,31 @@ export const floatingUiMixin = {
|
|
|
153
148
|
return;
|
|
154
149
|
}
|
|
155
150
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
151
|
+
this.floatingUiUpdaterDisposer = autoUpdate(trigger, content, () => {
|
|
152
|
+
computePosition(trigger, content, {
|
|
153
|
+
placement: this.placement,
|
|
154
|
+
middleware: [
|
|
155
|
+
offset(Number(this.offset)),
|
|
156
|
+
flip(),
|
|
157
|
+
shift({ padding: 5 }),
|
|
158
|
+
size({
|
|
159
|
+
apply({ rects }) {
|
|
160
|
+
if (!minWidthLimit) return;
|
|
161
|
+
|
|
162
|
+
const width = rects.reference.width;
|
|
163
|
+
const minWidth = width < minWidthLimit ? minWidthLimit : width;
|
|
164
|
+
|
|
165
|
+
Object.assign(content.style, {
|
|
166
|
+
minWidth: `${minWidth}px`,
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
],
|
|
171
|
+
}).then(({ x, y }) => {
|
|
172
|
+
Object.assign(content.style, {
|
|
173
|
+
left: `${x}px`,
|
|
174
|
+
top: `${y}px`,
|
|
175
|
+
});
|
|
179
176
|
});
|
|
180
177
|
});
|
|
181
178
|
},
|
package/package.json
CHANGED
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
headless
|
|
9
9
|
? `alert--${variant}`
|
|
10
10
|
: isSuccess
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
? 'border-success-300 bg-success-200 text-success-700'
|
|
12
|
+
: isError
|
|
13
|
+
? 'border-error-300 bg-error-200 text-error-700'
|
|
14
|
+
: isWarning
|
|
15
|
+
? 'border-warning-300 bg-warning-200 text-warning-700'
|
|
16
|
+
: null,
|
|
17
17
|
// sizes styles
|
|
18
18
|
headless
|
|
19
19
|
? `alert--${size}`
|
|
20
20
|
: isLarge
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
? 'p-3'
|
|
22
|
+
: isSmall
|
|
23
|
+
? 'py-1 px-2 text-sm'
|
|
24
|
+
: null,
|
|
25
25
|
]"
|
|
26
26
|
role="alert"
|
|
27
27
|
>
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
headless
|
|
35
35
|
? `alert-close--${variant}`
|
|
36
36
|
: isLarge
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
? 'mt-1'
|
|
38
|
+
: isSmall
|
|
39
|
+
? 'mt-0.5'
|
|
40
|
+
: null,
|
|
41
41
|
]"
|
|
42
|
-
@click="hide"
|
|
42
|
+
@click.stop.prevent="hide"
|
|
43
43
|
>
|
|
44
44
|
<IconClose />
|
|
45
45
|
</button>
|