@lumx/vue 4.5.0 → 4.5.2-alpha.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/_internal/DCsEMm-b.js +117 -0
- package/_internal/DCsEMm-b.js.map +1 -0
- package/components/popover/Popover.d.ts +46 -0
- package/components/popover/Popover.stories.d.ts +114 -0
- package/components/popover/Popover.test.stories.d.ts +16 -0
- package/components/popover/index.d.ts +2 -0
- package/components/popover/usePopoverStyle.d.ts +24 -0
- package/composables/useFocus.d.ts +9 -0
- package/composables/useFocusTrap.d.ts +11 -0
- package/composables/useRestoreFocusOnClose.d.ts +11 -0
- package/composables/useTheme.d.ts +1 -10
- package/index.d.ts +1 -0
- package/index.js +2478 -1834
- package/index.js.map +1 -1
- package/package.json +5 -4
- package/utils/index.d.ts +1 -0
- package/utils/index.js +16 -66
- package/utils/index.js.map +1 -1
- package/utils/theme/ThemeProvider.d.ts +10 -0
- package/utils/theme/index.d.ts +3 -0
- package/utils/theme/useTheme.d.ts +10 -0
- package/_internal/CCjQX5wE.js +0 -47
- package/_internal/CCjQX5wE.js.map +0 -1
- /package/utils/{ResetTheme.d.ts → theme/ResetTheme.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|
|
34
|
-
"version": "4.5.0",
|
|
34
|
+
"version": "4.5.2-alpha.0",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/vue": "^1.1.10",
|
|
37
|
-
"@lumx/core": "^4.5.0",
|
|
38
|
-
"@lumx/icons": "^4.5.0",
|
|
37
|
+
"@lumx/core": "^4.5.2-alpha.0",
|
|
38
|
+
"@lumx/icons": "^4.5.2-alpha.0",
|
|
39
39
|
"@vueuse/core": "^14.1.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -67,5 +67,6 @@
|
|
|
67
67
|
"vitest": "^4.0.18",
|
|
68
68
|
"vue": "^3.5.27",
|
|
69
69
|
"vue-tsc": "^3.2.4"
|
|
70
|
-
}
|
|
70
|
+
},
|
|
71
|
+
"stableVersion": "4.5.1"
|
|
71
72
|
}
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -1,73 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as
|
|
3
|
-
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (!o)
|
|
9
|
-
return;
|
|
10
|
-
const t = (e) => {
|
|
11
|
-
const r = [e.composedPath?.()[0], e.target], a = n();
|
|
12
|
-
v(r, a) && o(e);
|
|
13
|
-
};
|
|
14
|
-
return s.forEach((e) => document.addEventListener(e, t)), () => {
|
|
15
|
-
s.forEach((e) => document.removeEventListener(e, t));
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
const i = /* @__PURE__ */ Symbol("LumxClickAway"), y = /* @__PURE__ */ m((n, {
|
|
19
|
-
slots: o
|
|
20
|
-
}) => {
|
|
21
|
-
const t = C(i, null), e = [], r = {
|
|
22
|
-
childrenRefs: e,
|
|
23
|
-
addRefs(...c) {
|
|
24
|
-
for (const l of c) {
|
|
25
|
-
const f = l.value;
|
|
26
|
-
f && e.push(f);
|
|
27
|
-
}
|
|
28
|
-
t && (t.addRefs(...c), n.parentRef && t.addRefs(n.parentRef));
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
p(i, r);
|
|
32
|
-
let a;
|
|
33
|
-
return E(() => {
|
|
34
|
-
const c = n.childrenRefs.value;
|
|
35
|
-
c && r.addRefs(...c), a = u(() => e, n.callback);
|
|
36
|
-
}), d(() => {
|
|
37
|
-
a?.();
|
|
38
|
-
}), () => o.default?.();
|
|
39
|
-
}, {
|
|
40
|
-
name: "LumxClickAwayProvider",
|
|
41
|
-
props: {
|
|
42
|
-
callback: {
|
|
43
|
-
type: [Function, Boolean, void 0],
|
|
44
|
-
default: void 0
|
|
45
|
-
},
|
|
46
|
-
childrenRefs: {
|
|
47
|
-
type: Object,
|
|
48
|
-
required: !0
|
|
49
|
-
},
|
|
50
|
-
parentRef: {
|
|
51
|
-
type: Object,
|
|
52
|
-
default: void 0
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
function A({ callback: n, childrenRefs: o }) {
|
|
57
|
-
let t;
|
|
58
|
-
R(() => {
|
|
59
|
-
t?.(), t = u(() => {
|
|
1
|
+
import { s } from "../_internal/DCsEMm-b.js";
|
|
2
|
+
import { C as P, P as v, a as w, T as d, u as C } from "../_internal/DCsEMm-b.js";
|
|
3
|
+
import { watchEffect as n, onBeforeUnmount as l } from "vue";
|
|
4
|
+
function u({ callback: t, childrenRefs: o }) {
|
|
5
|
+
let e;
|
|
6
|
+
n(() => {
|
|
7
|
+
e?.(), e = s(() => {
|
|
60
8
|
const r = o.value;
|
|
61
9
|
return r ? r.map((a) => a?.value).filter(Boolean) : [];
|
|
62
|
-
},
|
|
63
|
-
}),
|
|
64
|
-
|
|
10
|
+
}, t);
|
|
11
|
+
}), l(() => {
|
|
12
|
+
e?.();
|
|
65
13
|
});
|
|
66
14
|
}
|
|
67
15
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
16
|
+
P as ClickAwayProvider,
|
|
17
|
+
v as Portal,
|
|
18
|
+
w as PortalProvider,
|
|
19
|
+
d as ThemeProvider,
|
|
20
|
+
u as useClickAway,
|
|
21
|
+
C as useTheme
|
|
72
22
|
};
|
|
73
23
|
//# sourceMappingURL=index.js.map
|
package/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/utils/ClickAway/useClickAway.ts"],"sourcesContent":["import { onBeforeUnmount, watchEffect, type Ref } from 'vue';\nimport { setupClickAway, type ClickAwayCallback } from '@lumx/core/js/utils/ClickAway';\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: ClickAwayCallback;\n /**\n * Elements considered within the click away context (clicking outside them will trigger the click away callback).\n */\n childrenRefs: Ref<Array<Ref<HTMLElement | undefined>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested Vue portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, childrenRefs }: ClickAwayParameters): void {\n let teardown: (() => void) | undefined;\n\n watchEffect(() => {\n // Clean up previous listener\n teardown?.();\n\n const getElements = () => {\n const refs = childrenRefs.value;\n if (!refs) return [];\n return refs.map((ref) => ref?.value).filter(Boolean) as HTMLElement[];\n };\n\n teardown = setupClickAway(getElements, callback);\n });\n\n onBeforeUnmount(() => {\n teardown?.();\n });\n}\n"],"names":["useClickAway","callback","childrenRefs","teardown","watchEffect","setupClickAway","refs","ref","onBeforeUnmount"],"mappings":";;;AAmBO,SAASA,EAAa,EAAE,UAAAC,GAAU,cAAAC,KAA2C;AAChF,MAAIC;AAEJ,EAAAC,EAAY,MAAM;AAEd,IAAAD,IAAA,GAQAA,IAAWE,EANS,MAAM;AACtB,YAAMC,IAAOJ,EAAa;AAC1B,aAAKI,IACEA,EAAK,IAAI,CAACC,MAAQA,GAAK,KAAK,EAAE,OAAO,OAAO,IADjC,CAAA;AAAA,IAEtB,GAEuCN,CAAQ;AAAA,EACnD,CAAC,GAEDO,EAAgB,MAAM;AAClB,IAAAL,IAAA;AAAA,EACJ,CAAC;AACL;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Theme } from '@lumx/core/js/constants';
|
|
2
|
+
/**
|
|
3
|
+
* ThemeProvider for Vue: wraps children with `provide('theme', value)` for theme isolation.
|
|
4
|
+
* Vue's `provide()` requires a component boundary, so this is a component.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ThemeProvider: import('vue').DefineSetupFnComponent<{
|
|
7
|
+
value: Theme | undefined;
|
|
8
|
+
}, {}, {}, {
|
|
9
|
+
value: Theme | undefined;
|
|
10
|
+
} & {}, import('vue').PublicProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { Theme } from '@lumx/core/js/constants';
|
|
3
|
+
export interface UseTheme {
|
|
4
|
+
defaultTheme?: Theme;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the globally applied theme.
|
|
8
|
+
* @returns computed theme value (auto-updates when the provided theme changes)
|
|
9
|
+
*/
|
|
10
|
+
export declare function useTheme(options?: UseTheme): ComputedRef<Theme | undefined>;
|
package/_internal/CCjQX5wE.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { defineComponent as l, provide as i, inject as d, ref as f, watch as s, onBeforeUnmount as p, createVNode as P, Teleport as m, isVNode as b } from "vue";
|
|
2
|
-
const u = /* @__PURE__ */ Symbol("LumxPortal"), v = () => ({
|
|
3
|
-
container: "body"
|
|
4
|
-
}), j = /* @__PURE__ */ l((e, {
|
|
5
|
-
slots: n
|
|
6
|
-
}) => (i(u, e.value), () => n.default?.()), {
|
|
7
|
-
name: "LumxPortalProvider",
|
|
8
|
-
props: {
|
|
9
|
-
value: {
|
|
10
|
-
type: Function,
|
|
11
|
-
required: !0
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
function y(e) {
|
|
16
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !b(e);
|
|
17
|
-
}
|
|
18
|
-
const L = /* @__PURE__ */ l((e, {
|
|
19
|
-
slots: n
|
|
20
|
-
}) => {
|
|
21
|
-
const c = d(u, v), t = f(null), r = () => {
|
|
22
|
-
e.enabled ? t.value = c() : t.value = null;
|
|
23
|
-
};
|
|
24
|
-
return r(), s(() => e.enabled, r), p(() => {
|
|
25
|
-
t.value?.teardown?.();
|
|
26
|
-
}), () => {
|
|
27
|
-
const o = n.default?.(), a = t.value?.container;
|
|
28
|
-
return !e.enabled || !a ? o : P(m, {
|
|
29
|
-
to: a
|
|
30
|
-
}, y(o) ? o : {
|
|
31
|
-
default: () => [o]
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
}, {
|
|
35
|
-
name: "LumxPortal",
|
|
36
|
-
props: {
|
|
37
|
-
enabled: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: !0
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
export {
|
|
44
|
-
L as P,
|
|
45
|
-
j as a
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=CCjQX5wE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CCjQX5wE.js","sources":["../../src/utils/Portal/PortalProvider.tsx","../../src/utils/Portal/Portal.tsx"],"sourcesContent":["import { defineComponent, provide, type PropType, type InjectionKey } from 'vue';\n\nexport type { PortalInit, PortalProviderProps } from '@lumx/core/js/utils/Portal';\nimport type { PortalInit, PortalProviderProps } from '@lumx/core/js/utils/Portal';\n\nexport const PORTAL_KEY: InjectionKey<PortalInit> = Symbol('LumxPortal');\n\nexport const defaultPortalInit: PortalInit = () => ({ container: 'body' });\n\n/**\n * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)\n */\nexport const PortalProvider = defineComponent(\n (props: PortalProviderProps, { slots }) => {\n provide(PORTAL_KEY, props.value);\n return () => slots.default?.();\n },\n {\n name: 'LumxPortalProvider',\n props: {\n value: {\n type: Function as PropType<PortalInit>,\n required: true,\n },\n },\n },\n);\n","import { defineComponent, inject, onBeforeUnmount, Teleport, ref, watch } from 'vue';\nimport { PORTAL_KEY, defaultPortalInit } from './PortalProvider';\n\nexport type { PortalProps } from '@lumx/core/js/utils/Portal';\nimport type { PortalProps } from '@lumx/core/js/utils/Portal';\n\n/**\n * Render children in a portal outside the current DOM position\n * (defaults to `document.body` but can be customized with the PortalProvider)\n */\nexport const Portal = defineComponent(\n (props: PortalProps, { slots }) => {\n const portalInit = inject(PORTAL_KEY, defaultPortalInit);\n const context = ref<ReturnType<typeof portalInit> | null>(null);\n\n // Initialize portal context when enabled\n const initializePortal = () => {\n if (props.enabled) {\n context.value = portalInit();\n } else {\n context.value = null;\n }\n };\n\n // Initialize on mount and when enabled changes\n initializePortal();\n watch(() => props.enabled, initializePortal);\n\n // Register teardown on unmount\n onBeforeUnmount(() => {\n context.value?.teardown?.();\n });\n\n return () => {\n const content = slots.default?.();\n const container = context.value?.container;\n\n // If disabled or no container, render inline\n if (!props.enabled || !container) {\n return content;\n }\n\n // Render in portal using Teleport\n return <Teleport to={container}>{content}</Teleport>;\n };\n },\n {\n name: 'LumxPortal',\n props: {\n enabled: {\n type: Boolean,\n default: true,\n },\n },\n },\n);\n"],"names":["PORTAL_KEY","Symbol","defaultPortalInit","container","PortalProvider","props","slots","provide","value","default","name","type","Function","required","_isSlot","s","Object","prototype","toString","call","_isVNode","Portal","portalInit","inject","context","ref","initializePortal","enabled","watch","onBeforeUnmount","teardown","content","_createVNode","Teleport","Boolean"],"mappings":";AAKO,MAAMA,IAAuCC,uBAAO,YAAY,GAE1DC,IAAgCA,OAAO;AAAA,EAAEC,WAAW;AAAO,IAK3DC,sBACT,CAACC,GAA4B;AAAA,EAAEC,OAAAA;AAAM,OACjCC,EAAQP,GAAYK,EAAMG,KAAK,GACxB,MAAMF,EAAMG,UAAO,IAE9B;AAAA,EACIC,MAAM;AAAA,EACNL,OAAO;AAAA,IACHG,OAAO;AAAA,MACHG,MAAMC;AAAAA,MACNC,UAAU;AAAA,IACd;AAAA,EACJ;AACJ,CACJ;ACzBiE,SAAAC,EAAAC,GAAA;AAAA,SAAA,OAAAA,KAAA,cAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,CAAA,MAAA,qBAAA,CAAAK,EAAAL,CAAA;AAAA;MASpDM,sBACT,CAAChB,GAAoB;AAAA,EAAEC,OAAAA;AAAM,MAAM;AAC/B,QAAMgB,IAAaC,EAAOvB,GAAYE,CAAiB,GACjDsB,IAAUC,EAA0C,IAAI,GAGxDC,IAAmBA,MAAM;AAC3B,IAAIrB,EAAMsB,UACNH,EAAQhB,QAAQc,EAAU,IAE1BE,EAAQhB,QAAQ;AAAA,EAExB;AAGAkB,SAAAA,EAAgB,GAChBE,EAAM,MAAMvB,EAAMsB,SAASD,CAAgB,GAG3CG,EAAgB,MAAM;AAClBL,IAAAA,EAAQhB,OAAOsB,WAAQ;AAAA,EAC3B,CAAC,GAEM,MAAM;AACT,UAAMC,IAAUzB,EAAMG,UAAO,GACvBN,IAAYqB,EAAQhB,OAAOL;AAGjC,WAAI,CAACE,EAAMsB,WAAW,CAACxB,IACZ4B,IAIXC,EAAAC,GAAA;AAAA,MAAA,IAAqB9B;AAAAA,IAAS,GAAAW,EAAGiB,CAAO,IAAPA,IAAO;AAAA,MAAAtB,SAAAA,MAAA,CAAPsB,CAAO;AAAA,IAAA,CAAA;AAAA,EAC5C;AACJ,GACA;AAAA,EACIrB,MAAM;AAAA,EACNL,OAAO;AAAA,IACHsB,SAAS;AAAA,MACLhB,MAAMuB;AAAAA,MACNzB,SAAS;AAAA,IACb;AAAA,EACJ;AACJ,CACJ;"}
|
|
File without changes
|