@fiscozen/composables 0.1.18 → 0.1.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiscozen/composables",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Design System utility composables",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "vitest": "^1.2.0",
27
27
  "vue-tsc": "^1.8.25",
28
28
  "@fiscozen/tsconfig": "^0.1.0",
29
- "@fiscozen/eslint-config": "^0.1.0",
30
- "@fiscozen/prettier-config": "^0.1.0"
29
+ "@fiscozen/prettier-config": "^0.1.0",
30
+ "@fiscozen/eslint-config": "^0.1.0"
31
31
  },
32
32
  "license": "ISC",
33
33
  "scripts": {
@@ -1,10 +1,10 @@
1
- import {Ref, watch, getCurrentInstance, computed, ref} from 'vue'
1
+ import {Ref, watch, getCurrentInstance, computed, ref, onMounted} from 'vue'
2
2
 
3
3
  export const useCurrency = () => {
4
4
  const inputRef: Ref<HTMLInputElement|null> = ref(null)
5
5
  const vm = getCurrentInstance()
6
6
 
7
- const modelValue = computed(() => vm?.props.modelValue)
7
+ const modelValue = computed<number|undefined>(() => vm?.props.modelValue as unknown as number|undefined)
8
8
 
9
9
  const format = (input: number) => {
10
10
  return input.toLocaleString('it-IT', {
@@ -63,9 +63,14 @@ export const useCurrency = () => {
63
63
  newVal.addEventListener('input', onInput(newVal))
64
64
  newVal.addEventListener('blur', onBlur)
65
65
 
66
+ if (modelValue.value) {
67
+ newVal.value = format(modelValue.value)
68
+ }
69
+
66
70
  })
67
71
 
68
72
 
73
+
69
74
  return {
70
75
  inputRef,
71
76
  parse,
@@ -1,357 +0,0 @@
1
- import { ref as v, reactive as W, onUnmounted as I, nextTick as q, onMounted as R, watch as k, onBeforeUnmount as $, getCurrentInstance as T, computed as C, defineComponent as U, useSlots as K, toRef as Q, openBlock as x, createElementBlock as z, renderSlot as w, createElementVNode as S, unref as E, withDirectives as M, normalizeClass as P, vShow as A, createCommentVNode as D, createBlock as X, Teleport as Y } from "vue";
2
- const L = (o, t, i, s) => {
3
- let r = "right", e = "right-start";
4
- const p = o.getBoundingClientRect(), l = t.getBoundingClientRect(), n = i.getBoundingClientRect(), d = (n.left - p.left - l.width) / p.width, u = (p.right - n.right - l.width) / p.width, a = (n.top - p.top - l.height) / p.height, h = (p.bottom - n.bottom - l.height) / p.height;
5
- if (r = [
6
- {
7
- key: "right",
8
- space: u
9
- },
10
- {
11
- key: "top",
12
- space: a
13
- },
14
- {
15
- key: "bottom",
16
- space: h
17
- },
18
- {
19
- key: "left",
20
- space: d
21
- }
22
- ].sort((c, f) => f.space - c.space)[0].key, !s)
23
- switch (r) {
24
- case "right":
25
- case "left":
26
- const c = (l.height - n.height) / 2;
27
- p.top > n.top - c && (s = "end"), p.bottom < n.top - c && (s = "start");
28
- break;
29
- }
30
- return e = s ? `${r}-${s}` : r, e;
31
- }, G = (o, t, i, s) => ({
32
- x: t.x + o.width * i / 100,
33
- y: t.y + o.height * s / 100
34
- }), H = (o) => {
35
- const t = v(null), i = v(null), s = v(null), r = v(null), e = W({
36
- position: { x: 0, y: 0 }
37
- }), p = {
38
- root: null,
39
- rootMargin: "0px",
40
- threshold: 1,
41
- ...o.element.intersectionOptions
42
- }, l = (u, a) => {
43
- }, n = v(new IntersectionObserver(l, p)), d = () => q(() => {
44
- var F;
45
- if (t.value = typeof o.element.domRef.value == "string" ? document.querySelector(o.element.domRef.value) : o.element.domRef.value, o.container ? (i.value = typeof o.container.domRef.value == "string" ? document.querySelector(o.container.domRef.value) : o.container.domRef.value, i.value ?? (i.value = document.body)) : i.value = document.body, !t.value)
46
- throw new Error("missing reference element for floating behavior");
47
- o.opener && (s.value = typeof o.opener.domRef.value == "string" ? document.querySelector(o.opener.domRef.value) : o.opener.domRef.value), r.value = t.value.getBoundingClientRect();
48
- const u = (F = s.value) == null ? void 0 : F.getBoundingClientRect(), a = i.value.getBoundingClientRect(), h = window.getComputedStyle(t.value);
49
- n.value.observe(t.value), n.value.observe(i.value);
50
- let m = o.position ? o.position.value : "auto", c = 0, f = 0;
51
- if (o.opener && s.value && u) {
52
- const y = u.left - parseFloat(h.marginLeft) - parseFloat(h.marginRight), N = u.left - parseFloat(h.marginLeft), b = u.top - parseFloat(h.marginTop) - parseFloat(h.marginBottom), O = u.top - parseFloat(h.marginTop);
53
- switch (m) {
54
- case "auto":
55
- m = L(
56
- i.value,
57
- t.value,
58
- s.value
59
- );
60
- break;
61
- case "auto-start":
62
- m = L(
63
- i.value,
64
- t.value,
65
- s.value,
66
- "start"
67
- );
68
- break;
69
- case "auto-end":
70
- m = L(
71
- i.value,
72
- t.value,
73
- s.value,
74
- "end"
75
- );
76
- break;
77
- }
78
- switch (m) {
79
- case "bottom":
80
- e.position.y = u.bottom, e.position.x = N + u.width / 2, f = -50, c = 0;
81
- break;
82
- case "bottom-start":
83
- e.position.y = u.bottom, e.position.x = y, f = 0, c = 0;
84
- break;
85
- case "bottom-end":
86
- e.position.y = u.bottom, e.position.x = u.right, f = -100, c = 0;
87
- break;
88
- case "left-start":
89
- e.position.y = b, e.position.x = y, f = -100, c = 0;
90
- break;
91
- case "left":
92
- e.position.y = O + u.height / 2, e.position.x = y, c = -50, f = -100;
93
- break;
94
- case "left-end":
95
- e.position.y = u.bottom, e.position.x = y, c = -100, f = -100;
96
- break;
97
- case "top-start":
98
- e.position.y = b, e.position.x = y, c = -100, f = 0;
99
- break;
100
- case "top":
101
- e.position.y = b, e.position.x = N + u.width / 2, f = -50, c = -100;
102
- break;
103
- case "top-end":
104
- e.position.y = b, e.position.x = u.right, f = -100, c = -100;
105
- break;
106
- case "right-start":
107
- e.position.y = b, e.position.x = u.right, f = 0, c = 0;
108
- break;
109
- case "right":
110
- e.position.y = O + u.height / 2, e.position.x = u.right, c = -50, f = 0;
111
- break;
112
- case "right-end":
113
- e.position.y = u.bottom, e.position.x = u.right, c = -100, f = 0;
114
- break;
115
- }
116
- } else
117
- switch (m) {
118
- case "bottom":
119
- e.position.y = a.bottom - r.value.height, e.position.x = a.left + a.width / 2, f = -50;
120
- break;
121
- case "left-end":
122
- case "bottom-start":
123
- e.position.y = a.bottom - r.value.height, e.position.x = a.left;
124
- break;
125
- case "right-end":
126
- case "bottom-end":
127
- e.position.y = a.bottom - r.value.height, e.position.x = a.right - r.value.width;
128
- break;
129
- case "left":
130
- e.position.y = a.top + (a.height - r.value.height) / 2, e.position.x = a.left;
131
- break;
132
- case "top-start":
133
- case "left-start":
134
- e.position.y = a.top, e.position.x = a.left;
135
- break;
136
- case "top":
137
- e.position.y = a.top, e.position.x = a.left + (a.width - r.value.width) / 2;
138
- break;
139
- case "top-end":
140
- case "right-start":
141
- e.position.y = a.top, e.position.x = a.right - r.value.width;
142
- case "right":
143
- e.position.y = a.top + (a.height - r.value.height) / 2, e.position.x = a.right - r.value.width;
144
- break;
145
- }
146
- const g = G(r.value, e.position, f, c);
147
- e.position.x = g.x, e.position.y = g.y, g.x < a.left && (e.position.x = a.left, f = 0), g.x + r.value.width > a.right && (e.position.x = a.right - r.value.width, f = 0), g.y < a.top && (e.position.y = a.top, c = 0), g.y + r.value.height > a.bottom && (e.position.y = a.bottom - r.value.height, c = 0), t.value.style.top = `${e.position.y}px`, t.value.style.left = `${e.position.x}px`, t.value.style.display = "flex", r.value = t.value.getBoundingClientRect();
148
- });
149
- return I(() => {
150
- n.value.disconnect();
151
- }), {
152
- float: e,
153
- rect: r,
154
- floatObserver: n,
155
- setPosition: d
156
- };
157
- };
158
- function B(o) {
159
- const t = window.matchMedia(o), i = v(t.matches);
160
- function s(r) {
161
- i.value = r.matches;
162
- }
163
- return R(() => {
164
- t.addEventListener("change", s);
165
- }), I(() => {
166
- t.removeEventListener("change", s);
167
- }), i;
168
- }
169
- function Z(o) {
170
- return {
171
- isGreater(t) {
172
- return B(`(min-width: ${o[t]})`);
173
- },
174
- isSmaller(t) {
175
- return B(`(max-width: ${o[t]})`);
176
- },
177
- isInBetween(t, i) {
178
- return B(`(min-width: ${o[t]}) and (max-width: ${o[i]})`);
179
- }
180
- };
181
- }
182
- function _(o, t, i) {
183
- if (!o)
184
- throw new Error("A target component has to be provided.");
185
- if (!t)
186
- throw new Error("A callback has to be provided.");
187
- const s = (r) => {
188
- !o.value || r.target === o.value || r.composedPath().includes(o.value) || typeof t == "function" && t();
189
- };
190
- i && k(i, (r, e) => {
191
- e && e.removeEventListener("click", s), r == null || r.addEventListener("click", s);
192
- }), R(() => {
193
- i || document.addEventListener("click", s);
194
- }), $(() => {
195
- if (i) {
196
- i.value.removeEventListener("click", s);
197
- return;
198
- }
199
- document.removeEventListener("click", s);
200
- });
201
- }
202
- function j(o, t) {
203
- if (!o)
204
- throw new Error("A target component has to be provided.");
205
- if (!t || typeof t != "function")
206
- throw new Error("A callback has to be provided.");
207
- const i = (s) => {
208
- t(s);
209
- };
210
- R(() => {
211
- o.value.addEventListener("keydown", i);
212
- }), $(() => {
213
- o.value.removeEventListener("keydown", i);
214
- });
215
- }
216
- function V(o, t) {
217
- if (!o || typeof o != "function")
218
- throw new Error("A callback has to be provided.");
219
- const i = (s) => {
220
- o(s);
221
- };
222
- R(() => {
223
- if (!t) {
224
- document.addEventListener("keyup", i);
225
- return;
226
- }
227
- t.value.addEventListener("keyup", i);
228
- }), $(() => {
229
- if (!t) {
230
- document.removeEventListener("keyup", i);
231
- return;
232
- }
233
- t.value.removeEventListener("keyup", i);
234
- });
235
- }
236
- const ee = () => {
237
- const o = v(null), t = T();
238
- C(() => t == null ? void 0 : t.props.modelValue);
239
- const i = (l) => l.toLocaleString("it-IT", {
240
- minimumFractionDigits: 2,
241
- maximumFractionDigits: 2
242
- }), s = (l) => parseFloat(l), r = (l) => {
243
- Number.isNaN(l) || t && t.emit("update:modelValue", l);
244
- }, e = (l) => (n) => {
245
- if (!o.value || !n.target)
246
- return;
247
- let { value: d } = l;
248
- d = d.replace(/[^0-9,.]/g, ""), o.value.value = d;
249
- const u = s(d);
250
- r(Number.isNaN(u) ? 0 : u);
251
- }, p = (l) => {
252
- if (!o.value || !l.target)
253
- return;
254
- let n = s(l.target.value.replace(/,/g, "."));
255
- Number.isNaN(n) && (n = 0);
256
- const d = i(n);
257
- o.value.value = d, r(n);
258
- };
259
- return k(o, (l, n) => {
260
- l && (n && (n == null || n.removeEventListener("input", e(l)), n == null || n.removeEventListener("blur", p)), l.addEventListener("input", e(l)), l.addEventListener("blur", p));
261
- }), {
262
- inputRef: o,
263
- parse: s,
264
- format: i,
265
- setValue: r
266
- };
267
- }, te = /* @__PURE__ */ U({
268
- __name: "FzFloating",
269
- props: {
270
- isOpen: { type: Boolean, default: !1 },
271
- position: { default: "auto" },
272
- container: {},
273
- contentClass: {},
274
- openerClass: {},
275
- overrideContentClass: { type: Boolean },
276
- teleport: { type: Boolean, default: !1 }
277
- },
278
- setup(o) {
279
- const t = o, i = v(null), s = v(null), r = K(), e = {
280
- position: C(() => t.position),
281
- element: {
282
- domRef: s
283
- },
284
- container: {
285
- domRef: Q(t.container || document.body)
286
- }
287
- };
288
- r.opener && (e.opener = {
289
- domRef: i
290
- });
291
- const p = H(e);
292
- k(
293
- () => t.position,
294
- () => t.isOpen && p.setPosition()
295
- ), k(
296
- () => t.isOpen,
297
- (n) => {
298
- !n || !s.value || (s.value.style.top = "0px", s.value.style.left = "0px", s.value.style.transform = "none", p.setPosition());
299
- }
300
- );
301
- const l = C(() => t.overrideContentClass ? t.contentClass : ["bg-core-white fixed p-4 z-10", t.contentClass]);
302
- return (n, d) => (x(), z("div", null, [
303
- w(n.$slots, "opener-start"),
304
- S("div", {
305
- ref_key: "opener",
306
- ref: i,
307
- class: "inline-flex"
308
- }, [
309
- w(n.$slots, "opener", {
310
- isOpen: n.isOpen,
311
- floating: E(p)
312
- })
313
- ], 512),
314
- w(n.$slots, "opener-end"),
315
- n.teleport ? D("", !0) : M((x(), z("div", {
316
- key: 0,
317
- ref_key: "content",
318
- ref: s,
319
- class: P(["fz__floating__content bg-core-white fixed p-4 z-10", l.value])
320
- }, [
321
- w(n.$slots, "default", {
322
- isOpen: n.isOpen,
323
- floating: E(p)
324
- })
325
- ], 2)), [
326
- [A, n.$slots.default && (!n.$slots.opener || n.$slots.opener && n.isOpen)]
327
- ]),
328
- n.teleport ? (x(), X(Y, {
329
- key: 1,
330
- to: "body"
331
- }, [
332
- M(S("div", {
333
- ref_key: "content",
334
- ref: s,
335
- class: P(["fz__floating__content bg-core-white absolute p-4 z-10", l.value])
336
- }, [
337
- w(n.$slots, "default", {
338
- isOpen: n.isOpen,
339
- floating: E(p)
340
- })
341
- ], 2), [
342
- [A, n.$slots.default && (!n.$slots.opener || n.$slots.opener && n.isOpen)]
343
- ])
344
- ])) : D("", !0)
345
- ]));
346
- }
347
- });
348
- export {
349
- te as FzFloating,
350
- Z as useBreakpoints,
351
- _ as useClickOutside,
352
- ee as useCurrency,
353
- H as useFloating,
354
- j as useKeyDown,
355
- V as useKeyUp,
356
- B as useMediaQuery
357
- };
@@ -1 +0,0 @@
1
- (function(h,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(h=typeof globalThis<"u"?globalThis:h||self,t(h.FzComposables={},h.Vue))})(this,function(h,t){"use strict";const R=(n,o,s,r)=>{let a="right",e="right-start";const u=n.getBoundingClientRect(),p=o.getBoundingClientRect(),i=s.getBoundingClientRect(),m=(i.left-u.left-p.width)/u.width,c=(u.right-i.right-p.width)/u.width,l=(i.top-u.top-p.height)/u.height,g=(u.bottom-i.bottom-p.height)/u.height;if(a=[{key:"right",space:c},{key:"top",space:l},{key:"bottom",space:g},{key:"left",space:m}].sort((f,d)=>d.space-f.space)[0].key,!r)switch(a){case"right":case"left":const f=(p.height-i.height)/2;u.top>i.top-f&&(r="end"),u.bottom<i.top-f&&(r="start");break}return e=r?`${a}-${r}`:a,e},L=(n,o,s,r)=>({x:o.x+n.width*s/100,y:o.y+n.height*r/100}),E=n=>{const o=t.ref(null),s=t.ref(null),r=t.ref(null),a=t.ref(null),e=t.reactive({position:{x:0,y:0}}),u={root:null,rootMargin:"0px",threshold:1,...n.element.intersectionOptions},p=(c,l)=>{},i=t.ref(new IntersectionObserver(p,u)),m=()=>t.nextTick(()=>{var B;if(o.value=typeof n.element.domRef.value=="string"?document.querySelector(n.element.domRef.value):n.element.domRef.value,n.container?(s.value=typeof n.container.domRef.value=="string"?document.querySelector(n.container.domRef.value):n.container.domRef.value,s.value??(s.value=document.body)):s.value=document.body,!o.value)throw new Error("missing reference element for floating behavior");n.opener&&(r.value=typeof n.opener.domRef.value=="string"?document.querySelector(n.opener.domRef.value):n.opener.domRef.value),a.value=o.value.getBoundingClientRect();const c=(B=r.value)==null?void 0:B.getBoundingClientRect(),l=s.value.getBoundingClientRect(),g=window.getComputedStyle(o.value);i.value.observe(o.value),i.value.observe(s.value);let y=n.position?n.position.value:"auto",f=0,d=0;if(n.opener&&r.value&&c){const b=c.left-parseFloat(g.marginLeft)-parseFloat(g.marginRight),C=c.left-parseFloat(g.marginLeft),w=c.top-parseFloat(g.marginTop)-parseFloat(g.marginBottom),x=c.top-parseFloat(g.marginTop);switch(y){case"auto":y=R(s.value,o.value,r.value);break;case"auto-start":y=R(s.value,o.value,r.value,"start");break;case"auto-end":y=R(s.value,o.value,r.value,"end");break}switch(y){case"bottom":e.position.y=c.bottom,e.position.x=C+c.width/2,d=-50,f=0;break;case"bottom-start":e.position.y=c.bottom,e.position.x=b,d=0,f=0;break;case"bottom-end":e.position.y=c.bottom,e.position.x=c.right,d=-100,f=0;break;case"left-start":e.position.y=w,e.position.x=b,d=-100,f=0;break;case"left":e.position.y=x+c.height/2,e.position.x=b,f=-50,d=-100;break;case"left-end":e.position.y=c.bottom,e.position.x=b,f=-100,d=-100;break;case"top-start":e.position.y=w,e.position.x=b,f=-100,d=0;break;case"top":e.position.y=w,e.position.x=C+c.width/2,d=-50,f=-100;break;case"top-end":e.position.y=w,e.position.x=c.right,d=-100,f=-100;break;case"right-start":e.position.y=w,e.position.x=c.right,d=0,f=0;break;case"right":e.position.y=x+c.height/2,e.position.x=c.right,f=-50,d=0;break;case"right-end":e.position.y=c.bottom,e.position.x=c.right,f=-100,d=0;break}}else switch(y){case"bottom":e.position.y=l.bottom-a.value.height,e.position.x=l.left+l.width/2,d=-50;break;case"left-end":case"bottom-start":e.position.y=l.bottom-a.value.height,e.position.x=l.left;break;case"right-end":case"bottom-end":e.position.y=l.bottom-a.value.height,e.position.x=l.right-a.value.width;break;case"left":e.position.y=l.top+(l.height-a.value.height)/2,e.position.x=l.left;break;case"top-start":case"left-start":e.position.y=l.top,e.position.x=l.left;break;case"top":e.position.y=l.top,e.position.x=l.left+(l.width-a.value.width)/2;break;case"top-end":case"right-start":e.position.y=l.top,e.position.x=l.right-a.value.width;case"right":e.position.y=l.top+(l.height-a.value.height)/2,e.position.x=l.right-a.value.width;break}const v=L(a.value,e.position,d,f);e.position.x=v.x,e.position.y=v.y,v.x<l.left&&(e.position.x=l.left,d=0),v.x+a.value.width>l.right&&(e.position.x=l.right-a.value.width,d=0),v.y<l.top&&(e.position.y=l.top,f=0),v.y+a.value.height>l.bottom&&(e.position.y=l.bottom-a.value.height,f=0),o.value.style.top=`${e.position.y}px`,o.value.style.left=`${e.position.x}px`,o.value.style.display="flex",a.value=o.value.getBoundingClientRect()});return t.onUnmounted(()=>{i.value.disconnect()}),{float:e,rect:a,floatObserver:i,setPosition:m}};function k(n){const o=window.matchMedia(n),s=t.ref(o.matches);function r(a){s.value=a.matches}return t.onMounted(()=>{o.addEventListener("change",r)}),t.onUnmounted(()=>{o.removeEventListener("change",r)}),s}function $(n){return{isGreater(o){return k(`(min-width: ${n[o]})`)},isSmaller(o){return k(`(max-width: ${n[o]})`)},isInBetween(o,s){return k(`(min-width: ${n[o]}) and (max-width: ${n[s]})`)}}}function S(n,o,s){if(!n)throw new Error("A target component has to be provided.");if(!o)throw new Error("A callback has to be provided.");const r=a=>{!n.value||a.target===n.value||a.composedPath().includes(n.value)||typeof o=="function"&&o()};s&&t.watch(s,(a,e)=>{e&&e.removeEventListener("click",r),a==null||a.addEventListener("click",r)}),t.onMounted(()=>{s||document.addEventListener("click",r)}),t.onBeforeUnmount(()=>{if(s){s.value.removeEventListener("click",r);return}document.removeEventListener("click",r)})}function F(n,o){if(!n)throw new Error("A target component has to be provided.");if(!o||typeof o!="function")throw new Error("A callback has to be provided.");const s=r=>{o(r)};t.onMounted(()=>{n.value.addEventListener("keydown",s)}),t.onBeforeUnmount(()=>{n.value.removeEventListener("keydown",s)})}function N(n,o){if(!n||typeof n!="function")throw new Error("A callback has to be provided.");const s=r=>{n(r)};t.onMounted(()=>{if(!o){document.addEventListener("keyup",s);return}o.value.addEventListener("keyup",s)}),t.onBeforeUnmount(()=>{if(!o){document.removeEventListener("keyup",s);return}o.value.removeEventListener("keyup",s)})}const O=()=>{const n=t.ref(null),o=t.getCurrentInstance();t.computed(()=>o==null?void 0:o.props.modelValue);const s=p=>p.toLocaleString("it-IT",{minimumFractionDigits:2,maximumFractionDigits:2}),r=p=>parseFloat(p),a=p=>{Number.isNaN(p)||o&&o.emit("update:modelValue",p)},e=p=>i=>{if(!n.value||!i.target)return;let{value:m}=p;m=m.replace(/[^0-9,.]/g,""),n.value.value=m;const c=r(m);a(Number.isNaN(c)?0:c)},u=p=>{if(!n.value||!p.target)return;let i=r(p.target.value.replace(/,/g,"."));Number.isNaN(i)&&(i=0);const m=s(i);n.value.value=m,a(i)};return t.watch(n,(p,i)=>{p&&(i&&(i==null||i.removeEventListener("input",e(p)),i==null||i.removeEventListener("blur",u)),p.addEventListener("input",e(p)),p.addEventListener("blur",u))}),{inputRef:n,parse:r,format:s,setValue:a}},z=t.defineComponent({__name:"FzFloating",props:{isOpen:{type:Boolean,default:!1},position:{default:"auto"},container:{},contentClass:{},openerClass:{},overrideContentClass:{type:Boolean},teleport:{type:Boolean,default:!1}},setup(n){const o=n,s=t.ref(null),r=t.ref(null),a=t.useSlots(),e={position:t.computed(()=>o.position),element:{domRef:r},container:{domRef:t.toRef(o.container||document.body)}};a.opener&&(e.opener={domRef:s});const u=E(e);t.watch(()=>o.position,()=>o.isOpen&&u.setPosition()),t.watch(()=>o.isOpen,i=>{!i||!r.value||(r.value.style.top="0px",r.value.style.left="0px",r.value.style.transform="none",u.setPosition())});const p=t.computed(()=>o.overrideContentClass?o.contentClass:["bg-core-white fixed p-4 z-10",o.contentClass]);return(i,m)=>(t.openBlock(),t.createElementBlock("div",null,[t.renderSlot(i.$slots,"opener-start"),t.createElementVNode("div",{ref_key:"opener",ref:s,class:"inline-flex"},[t.renderSlot(i.$slots,"opener",{isOpen:i.isOpen,floating:t.unref(u)})],512),t.renderSlot(i.$slots,"opener-end"),i.teleport?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"content",ref:r,class:t.normalizeClass(["fz__floating__content bg-core-white fixed p-4 z-10",p.value])},[t.renderSlot(i.$slots,"default",{isOpen:i.isOpen,floating:t.unref(u)})],2)),[[t.vShow,i.$slots.default&&(!i.$slots.opener||i.$slots.opener&&i.isOpen)]]),i.teleport?(t.openBlock(),t.createBlock(t.Teleport,{key:1,to:"body"},[t.withDirectives(t.createElementVNode("div",{ref_key:"content",ref:r,class:t.normalizeClass(["fz__floating__content bg-core-white absolute p-4 z-10",p.value])},[t.renderSlot(i.$slots,"default",{isOpen:i.isOpen,floating:t.unref(u)})],2),[[t.vShow,i.$slots.default&&(!i.$slots.opener||i.$slots.opener&&i.isOpen)]])])):t.createCommentVNode("",!0)]))}});h.FzFloating=z,h.useBreakpoints=$,h.useClickOutside=S,h.useCurrency=O,h.useFloating=E,h.useKeyDown=F,h.useKeyUp=N,h.useMediaQuery=k,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});