@lumx/vue 4.11.0 → 4.12.0-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/CO3BhTbu.js +161 -0
- package/_internal/CO3BhTbu.js.map +1 -0
- package/components/chip/SelectionChipGroup.d.ts +33 -3
- package/components/combobox/Combobox.stories.d.ts +1 -0
- package/components/combobox/ComboboxOption.d.ts +9 -6
- package/components/combobox/ComboboxOption.test.d.ts +1 -0
- package/components/combobox/ComboboxProvider.d.ts +5 -1
- package/components/combobox/index.d.ts +11 -4
- package/components/lightbox/Lightbox.d.ts +28 -0
- package/components/lightbox/Lightbox.stories.d.ts +27 -0
- package/components/lightbox/index.d.ts +1 -0
- package/components/select-text-field/SelectTextField.d.ts +127 -0
- package/components/select-text-field/SelectTextField.stories.d.ts +203 -0
- package/components/select-text-field/SelectTextField.test.d.ts +1 -0
- package/components/select-text-field/SelectTextField.test.stories.d.ts +37 -0
- package/components/select-text-field/Stories/CustomRender.vue.d.ts +2 -0
- package/components/select-text-field/Stories/MultipleWithSearch.vue.d.ts +2 -0
- package/components/select-text-field/Stories/WithCreatableOptions.vue.d.ts +2 -0
- package/components/select-text-field/Stories/WithInfiniteScroll.vue.d.ts +2 -0
- package/components/select-text-field/Stories/WithSearch.vue.d.ts +2 -0
- package/components/select-text-field/index.d.ts +58 -0
- package/index.d.ts +2 -0
- package/index.js +4052 -3538
- package/index.js.map +1 -1
- package/package.json +6 -5
- package/utils/index.js +19 -55
- package/utils/index.js.map +1 -1
- package/_internal/BiLpoFMC.js +0 -124
- package/_internal/BiLpoFMC.js.map +0 -1
package/package.json
CHANGED
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"sideEffects": false,
|
|
36
|
-
"version": "4.
|
|
36
|
+
"version": "4.12.0-alpha.0",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/vue": "^1.1.10",
|
|
39
|
-
"@lumx/core": "^4.
|
|
40
|
-
"@lumx/icons": "^4.
|
|
39
|
+
"@lumx/core": "^4.12.0-alpha.0",
|
|
40
|
+
"@lumx/icons": "^4.12.0-alpha.0",
|
|
41
41
|
"@vueuse/core": "^14.1.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -62,12 +62,13 @@
|
|
|
62
62
|
"jsdom": "^27.2.0",
|
|
63
63
|
"storybook": "^10.2.19",
|
|
64
64
|
"typescript": "^5.4.3",
|
|
65
|
-
"vite": "^7.3.
|
|
65
|
+
"vite": "^7.3.2",
|
|
66
66
|
"vite-plugin-dts": "^4.5.4",
|
|
67
67
|
"vite-plugin-static-copy": "^3.1.4",
|
|
68
68
|
"vite-tsconfig-paths": "^5.1.4",
|
|
69
69
|
"vitest": "^4.0.18",
|
|
70
70
|
"vue": "^3.5.27",
|
|
71
71
|
"vue-tsc": "^3.2.4"
|
|
72
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"stableVersion": "4.11.0"
|
|
73
74
|
}
|
package/utils/index.js
CHANGED
|
@@ -1,60 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
}),
|
|
12
|
-
|
|
1
|
+
import { s } from "../_internal/CO3BhTbu.js";
|
|
2
|
+
import { C as P, I as v, P as w, a as d, T as C, u as h } from "../_internal/CO3BhTbu.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(() => {
|
|
8
|
+
const r = o.value;
|
|
9
|
+
return r ? r.map((a) => a?.value).filter(Boolean) : [];
|
|
10
|
+
}, t);
|
|
11
|
+
}), l(() => {
|
|
12
|
+
e?.();
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function v(e, t, n) {
|
|
16
|
-
const r = new IntersectionObserver((o = []) => {
|
|
17
|
-
o.some((l) => l.isIntersecting) && t();
|
|
18
|
-
}, n);
|
|
19
|
-
return r.observe(e), () => {
|
|
20
|
-
r.unobserve(e);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const I = "lumx-infinite-scroll-anchor", h = ({
|
|
24
|
-
ref: e
|
|
25
|
-
}) => (
|
|
26
|
-
// In order to avoid issues when a zoom is added to the browser, we add a small height to the div so that
|
|
27
|
-
// the intersection has a higher chance of working correctly.
|
|
28
|
-
c("div", {
|
|
29
|
-
ref: e,
|
|
30
|
-
"aria-hidden": "true",
|
|
31
|
-
className: I,
|
|
32
|
-
style: {
|
|
33
|
-
height: "4px"
|
|
34
|
-
}
|
|
35
|
-
}, null)
|
|
36
|
-
), C = /* @__PURE__ */ f((e) => {
|
|
37
|
-
const t = u(null);
|
|
38
|
-
return i((n) => {
|
|
39
|
-
const r = t.value;
|
|
40
|
-
if (!r) return;
|
|
41
|
-
const o = v(r, e.callback, e.options);
|
|
42
|
-
n(o);
|
|
43
|
-
}), () => h({
|
|
44
|
-
ref: t
|
|
45
|
-
});
|
|
46
|
-
}, {
|
|
47
|
-
name: "LumxInfiniteScroll",
|
|
48
|
-
inheritAttrs: !1,
|
|
49
|
-
props: p()("callback", "options")
|
|
50
|
-
});
|
|
51
15
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
16
|
+
P as ClickAwayProvider,
|
|
17
|
+
v as InfiniteScroll,
|
|
18
|
+
w as Portal,
|
|
19
|
+
d as PortalProvider,
|
|
20
|
+
C as ThemeProvider,
|
|
21
|
+
u as useClickAway,
|
|
22
|
+
h as useTheme
|
|
59
23
|
};
|
|
60
24
|
//# sourceMappingURL=index.js.map
|
package/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/utils/ClickAway/useClickAway.ts"
|
|
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;"}
|
package/_internal/BiLpoFMC.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { defineComponent as i, provide as d, inject as s, ref as y, watch as P, onBeforeUnmount as p, createVNode as b, Teleport as C, isVNode as R, onMounted as x, computed as v, unref as L } from "vue";
|
|
2
|
-
import { Theme as T } from "@lumx/core/js/constants";
|
|
3
|
-
const O = () => (...e) => e.reduce(
|
|
4
|
-
(n, o) => (n[o] = { required: !1 }, n),
|
|
5
|
-
{}
|
|
6
|
-
), h = /* @__PURE__ */ Symbol("LumxPortal"), A = () => ({
|
|
7
|
-
container: "body"
|
|
8
|
-
}), S = /* @__PURE__ */ i((e, {
|
|
9
|
-
slots: n
|
|
10
|
-
}) => (d(h, e.value), () => n.default?.()), {
|
|
11
|
-
name: "LumxPortalProvider",
|
|
12
|
-
props: {
|
|
13
|
-
value: {
|
|
14
|
-
type: Function,
|
|
15
|
-
required: !0
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
function w(e) {
|
|
20
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !R(e);
|
|
21
|
-
}
|
|
22
|
-
const g = /* @__PURE__ */ i((e, {
|
|
23
|
-
slots: n
|
|
24
|
-
}) => {
|
|
25
|
-
const o = s(h, A), t = y(null), u = () => {
|
|
26
|
-
e.enabled ? t.value = o() : t.value = null;
|
|
27
|
-
};
|
|
28
|
-
return u(), P(() => e.enabled, u), p(() => {
|
|
29
|
-
t.value?.teardown?.();
|
|
30
|
-
}), () => {
|
|
31
|
-
const a = n.default?.(), r = t.value?.container;
|
|
32
|
-
return !e.enabled || !r ? a : b(C, {
|
|
33
|
-
to: r
|
|
34
|
-
}, w(a) ? a : {
|
|
35
|
-
default: () => [a]
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
}, {
|
|
39
|
-
name: "LumxPortal",
|
|
40
|
-
props: {
|
|
41
|
-
enabled: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: !0
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}), f = ["mousedown", "touchstart"];
|
|
47
|
-
function E(e, n) {
|
|
48
|
-
return !n.some((o) => o instanceof Node && e.some((t) => o.contains(t)));
|
|
49
|
-
}
|
|
50
|
-
function k(e, n) {
|
|
51
|
-
if (!n)
|
|
52
|
-
return;
|
|
53
|
-
const o = (t) => {
|
|
54
|
-
const u = [t.composedPath?.()[0], t.target].filter((r) => r instanceof Node), a = e();
|
|
55
|
-
E(u, a) && n(t);
|
|
56
|
-
};
|
|
57
|
-
return f.forEach((t) => document.addEventListener(t, o)), () => {
|
|
58
|
-
f.forEach((t) => document.removeEventListener(t, o));
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const m = /* @__PURE__ */ Symbol("LumxClickAway"), N = /* @__PURE__ */ i((e, {
|
|
62
|
-
slots: n
|
|
63
|
-
}) => {
|
|
64
|
-
const o = s(m, null), t = [], u = {
|
|
65
|
-
childrenRefs: t,
|
|
66
|
-
addRefs(...r) {
|
|
67
|
-
for (const l of r) {
|
|
68
|
-
const c = l.value;
|
|
69
|
-
c && t.push(c);
|
|
70
|
-
}
|
|
71
|
-
o && (o.addRefs(...r), e.parentRef && o.addRefs(e.parentRef));
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
d(m, u);
|
|
75
|
-
let a;
|
|
76
|
-
return x(() => {
|
|
77
|
-
const r = e.childrenRefs.value;
|
|
78
|
-
r && u.addRefs(...r), a = k(() => t, (l) => {
|
|
79
|
-
const c = e.callback;
|
|
80
|
-
typeof c == "function" && c(l);
|
|
81
|
-
});
|
|
82
|
-
}), p(() => {
|
|
83
|
-
a?.();
|
|
84
|
-
}), () => n.default?.();
|
|
85
|
-
}, {
|
|
86
|
-
name: "LumxClickAwayProvider",
|
|
87
|
-
props: {
|
|
88
|
-
callback: {
|
|
89
|
-
type: [Function, Boolean, void 0],
|
|
90
|
-
default: void 0
|
|
91
|
-
},
|
|
92
|
-
childrenRefs: {
|
|
93
|
-
type: Object,
|
|
94
|
-
required: !0
|
|
95
|
-
},
|
|
96
|
-
parentRef: {
|
|
97
|
-
type: Object,
|
|
98
|
-
default: void 0
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}), Y = i(
|
|
102
|
-
(e, { slots: n }) => (d(
|
|
103
|
-
"theme",
|
|
104
|
-
v(() => e.value)
|
|
105
|
-
), () => n.default?.()),
|
|
106
|
-
{
|
|
107
|
-
name: "LumxThemeProvider",
|
|
108
|
-
props: { value: { type: String, default: void 0 } }
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
function I(e = { defaultTheme: T.light }) {
|
|
112
|
-
const { defaultTheme: n } = e, o = s("theme", void 0);
|
|
113
|
-
return v(() => L(o) || n);
|
|
114
|
-
}
|
|
115
|
-
export {
|
|
116
|
-
N as C,
|
|
117
|
-
g as P,
|
|
118
|
-
Y as T,
|
|
119
|
-
S as a,
|
|
120
|
-
O as k,
|
|
121
|
-
k as s,
|
|
122
|
-
I as u
|
|
123
|
-
};
|
|
124
|
-
//# sourceMappingURL=BiLpoFMC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BiLpoFMC.js","sources":["../../src/utils/VueToJSX.ts","../../src/utils/Portal/PortalProvider.tsx","../../src/utils/Portal/Portal.tsx","../../../lumx-core/src/js/utils/ClickAway/index.ts","../../src/utils/ClickAway/ClickAwayProvider.tsx","../../src/utils/theme/ThemeProvider.ts","../../src/utils/theme/useTheme.ts"],"sourcesContent":["import { PropsToOverride } from '@lumx/core/js/types';\n/**\n * Props interface for components wrapped with VueToJSX.\n * It omits JSX-specific props like `children` and `className` and adds Vue's `class`.\n *\n * @template Props - The base props type\n * @template OmitProps - Additional props to omit beyond the defaults (children, className, ref)\n */\nexport type VueToJSXProps<Props, OmitProps extends keyof Props = never> = Omit<\n Props,\n PropsToOverride | 'children' | 'className' | OmitProps\n> & {\n /** Class name forwarded to the root element of the component. */\n class?: string;\n};\n\n/**\n * Hyphenated aria-* prop keys that must NOT be declared as Vue component props.\n * When declared, Vue normalizes them to camelCase (e.g. aria-haspopup → ariaHaspopup),\n * which breaks hyphenated key destructuring in core component templates.\n * By excluding them from props, they flow through `attrs` with their original hyphenated keys.\n */\nexport type HyphenatedAriaProps = 'aria-expanded' | 'aria-haspopup' | 'aria-label' | 'aria-pressed';\n\nexport const keysOf = <T>() => {\n return <K extends readonly (keyof T)[]>(\n ...keys: [keyof T] extends [K[number]]\n ? K\n : [Error: '❌ Missing keys in your list:', Exclude<keyof T, K[number]>]\n ) => {\n // Return an object with all props marked as optional (not required)\n // This ensures Vue's type system correctly infers props as optional\n return keys.reduce(\n (acc, key) => {\n acc[key as K[number]] = { required: false };\n return acc;\n },\n {} as Record<K[number], { required: false }>,\n );\n };\n};\n","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","/**\n * Shared types and logic for ClickAway detection.\n *\n * ClickAway detects clicks outside a set of elements and triggers a callback.\n * The core logic (event listening + target checking) is framework-agnostic.\n * Framework-specific wrappers (React hook, Vue composable) and context providers\n * (React context, Vue provide/inject) are implemented in each framework package.\n */\n\nimport type { Falsy } from '@lumx/core/js/types';\n\n/** Event types that trigger click away detection. */\nexport const CLICK_AWAY_EVENT_TYPES = ['mousedown', 'touchstart'] as const;\n\n/** Callback triggered when a click away is detected. */\nexport type ClickAwayCallback = EventListener | Falsy;\n\n/**\n * Check if the click event targets are outside all the given elements.\n *\n * @param targets - The event target elements (from `event.target` and `event.composedPath()`).\n * @param elements - The elements considered \"inside\" the click away context.\n * @returns `true` if the click is outside all elements (i.e. a click away).\n */\nexport function isClickAway(targets: HTMLElement[], elements: HTMLElement[]): boolean {\n return !elements.some((element) => element instanceof Node && targets.some((target) => element.contains(target)));\n}\n\n/**\n * Imperative setup for click away detection.\n * Adds mousedown/touchstart listeners on `document` and calls the callback when a click\n * occurs outside the elements returned by `getElements`.\n *\n * Note: when `getElements` returns an empty array, any click is considered a click away.\n * Callers should guard against calling `setupClickAway` when no refs are registered.\n *\n * @param getElements - Getter returning the current list of elements considered \"inside\".\n * @param callback - Callback to invoke on click away.\n * @returns A teardown function that removes the event listeners.\n */\nexport function setupClickAway(\n getElements: () => HTMLElement[],\n callback: ClickAwayCallback,\n): (() => void) | undefined {\n if (!callback) {\n return undefined;\n }\n\n const listener: EventListener = (evt) => {\n const targets = [evt.composedPath?.()[0], evt.target].filter((t): t is HTMLElement => t instanceof Node);\n const elements = getElements();\n if (isClickAway(targets, elements)) {\n callback(evt);\n }\n };\n\n CLICK_AWAY_EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n CLICK_AWAY_EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n}\n","import {\n defineComponent,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n type InjectionKey,\n type PropType,\n type Ref,\n} from 'vue';\nimport { setupClickAway, type ClickAwayCallback } from '@lumx/core/js/utils/ClickAway';\n\ninterface ContextValue {\n childrenRefs: HTMLElement[];\n addRefs(...newChildrenRefs: Array<Ref<HTMLElement | undefined>>): void;\n}\n\nexport const CLICK_AWAY_KEY: InjectionKey<ContextValue> = Symbol('LumxClickAway');\n\n/**\n * Component combining click away detection with Vue's provide/inject to hook into the component tree\n * and take into account both the DOM tree and the component tree to detect click away.\n */\nexport const ClickAwayProvider = defineComponent(\n (\n props: {\n callback: ClickAwayCallback;\n childrenRefs: Ref<Array<Ref<HTMLElement | undefined>>>;\n parentRef?: Ref<HTMLElement | undefined>;\n },\n { slots },\n ) => {\n const parentContext = inject(CLICK_AWAY_KEY, null);\n\n const contextChildrenRefs: HTMLElement[] = [];\n\n const currentContext: ContextValue = {\n childrenRefs: contextChildrenRefs,\n addRefs(...newChildrenRefs) {\n for (const newRef of newChildrenRefs) {\n const el = newRef.value;\n if (el) {\n contextChildrenRefs.push(el);\n }\n }\n if (parentContext) {\n parentContext.addRefs(...newChildrenRefs);\n if (props.parentRef) {\n parentContext.addRefs(props.parentRef);\n }\n }\n },\n };\n\n provide(CLICK_AWAY_KEY, currentContext);\n\n let teardown: (() => void) | undefined;\n\n onMounted(() => {\n const refs = props.childrenRefs.value;\n if (refs) {\n currentContext.addRefs(...refs);\n }\n\n // Setup click away using a closure that always reads the latest callback prop.\n // This handles transitions like closeMode=\"hide\" where the callback changes\n // between open (handleClose) and closed (undefined) without re-creating the listener.\n teardown = setupClickAway(\n () => contextChildrenRefs,\n (event) => {\n const cb = props.callback;\n if (typeof cb === 'function') cb(event);\n },\n );\n });\n\n onBeforeUnmount(() => {\n teardown?.();\n });\n\n return () => slots.default?.();\n },\n {\n name: 'LumxClickAwayProvider',\n props: {\n callback: {\n type: [Function, Boolean, undefined] as PropType<ClickAwayCallback>,\n default: undefined,\n },\n childrenRefs: {\n type: Object as PropType<Ref<Array<Ref<HTMLElement | undefined>>>>,\n required: true,\n },\n parentRef: {\n type: Object as PropType<Ref<HTMLElement | undefined>>,\n default: undefined,\n },\n },\n },\n);\n","import { computed, defineComponent, provide, type PropType } from 'vue';\nimport type { Theme } from '@lumx/core/js/constants';\n\n/**\n * ThemeProvider for Vue: wraps children with `provide('theme', value)` for theme isolation.\n * Vue's `provide()` requires a component boundary, so this is a component.\n */\nexport const ThemeProvider = defineComponent(\n (props: { value: Theme | undefined }, { slots }) => {\n provide(\n 'theme',\n computed(() => props.value),\n );\n return () => slots.default?.();\n },\n {\n name: 'LumxThemeProvider',\n props: { value: { type: String as PropType<Theme | undefined>, default: undefined } },\n },\n);\n","import { type ComputedRef, type Ref, computed, inject, unref } from 'vue';\n\nimport { Theme } from '@lumx/core/js/constants';\n\nexport interface UseTheme {\n defaultTheme?: Theme;\n}\n/**\n * Retrieves the globally applied theme.\n * @returns computed theme value (auto-updates when the provided theme changes)\n */\nexport function useTheme(options: UseTheme = { defaultTheme: Theme.light }): ComputedRef<Theme | undefined> {\n const { defaultTheme } = options;\n const injected = inject<Theme | Ref<Theme | undefined> | undefined>('theme', undefined);\n return computed(() => unref(injected) || defaultTheme);\n}\n"],"names":["keysOf","keys","acc","key","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","CLICK_AWAY_EVENT_TYPES","isClickAway","targets","elements","element","target","setupClickAway","getElements","callback","listener","evt","t","evtType","CLICK_AWAY_KEY","ClickAwayProvider","parentContext","contextChildrenRefs","currentContext","childrenRefs","addRefs","newChildrenRefs","newRef","el","push","parentRef","onMounted","refs","event","cb","undefined","ThemeProvider","defineComponent","computed","useTheme","options","Theme","defaultTheme","injected","unref"],"mappings":";;AAwBO,MAAMA,IAAS,MACX,IACAC,MAMIA,EAAK;AAAA,EACR,CAACC,GAAKC,OACFD,EAAIC,CAAgB,IAAI,EAAE,UAAU,GAAA,GAC7BD;AAAA,EAEX,CAAA;AAAC,GChCAE,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,GAG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