cisse-vue-ui 0.5.21 → 0.5.23
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/dist/{ListSkeleton.vue_vue_type_script_setup_true_lang-D3_Oddwt.js → Button.vue_vue_type_script_setup_true_lang-CD9QPOeU.js} +114 -10
- package/dist/Button.vue_vue_type_script_setup_true_lang-CD9QPOeU.js.map +1 -0
- package/dist/{ListSkeleton.vue_vue_type_script_setup_true_lang-CrEu33_J.cjs → Button.vue_vue_type_script_setup_true_lang-Cev21KGJ.cjs} +113 -9
- package/dist/Button.vue_vue_type_script_setup_true_lang-Cev21KGJ.cjs.map +1 -0
- package/dist/{RangeSlider.vue_vue_type_script_setup_true_lang-ClH-pyK8.cjs → Combobox.vue_vue_type_script_setup_true_lang-D9TIId4E.cjs} +621 -266
- package/dist/Combobox.vue_vue_type_script_setup_true_lang-D9TIId4E.cjs.map +1 -0
- package/dist/{RangeSlider.vue_vue_type_script_setup_true_lang-B79_S1JL.js → Combobox.vue_vue_type_script_setup_true_lang-DCLKWzhc.js} +595 -240
- package/dist/Combobox.vue_vue_type_script_setup_true_lang-DCLKWzhc.js.map +1 -0
- package/dist/{Skeleton.vue_vue_type_script_setup_true_lang-CsDMGhaT.cjs → ConfirmDialog.vue_vue_type_script_setup_true_lang-CwHYxBhR.cjs} +290 -128
- package/dist/ConfirmDialog.vue_vue_type_script_setup_true_lang-CwHYxBhR.cjs.map +1 -0
- package/dist/{Skeleton.vue_vue_type_script_setup_true_lang-Q4PcIELi.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-Dm4kLAnr.js} +291 -129
- package/dist/ConfirmDialog.vue_vue_type_script_setup_true_lang-Dm4kLAnr.js.map +1 -0
- package/dist/{Timeline.vue_vue_type_script_setup_true_lang-C5SKEGPG.cjs → DarkModeToggle.vue_vue_type_script_setup_true_lang-CSxGvdSP.cjs} +192 -408
- package/dist/DarkModeToggle.vue_vue_type_script_setup_true_lang-CSxGvdSP.cjs.map +1 -0
- package/dist/{Timeline.vue_vue_type_script_setup_true_lang-ykGksWXN.js → DarkModeToggle.vue_vue_type_script_setup_true_lang-D1Q43mhJ.js} +153 -369
- package/dist/DarkModeToggle.vue_vue_type_script_setup_true_lang-D1Q43mhJ.js.map +1 -0
- package/dist/{Dropdown.vue_vue_type_script_setup_true_lang-DKxcVBKu.cjs → Dropdown.vue_vue_type_script_setup_true_lang-DNeh9Gi-.cjs} +32 -15
- package/dist/Dropdown.vue_vue_type_script_setup_true_lang-DNeh9Gi-.cjs.map +1 -0
- package/dist/{Dropdown.vue_vue_type_script_setup_true_lang-C3pr8BwC.js → Dropdown.vue_vue_type_script_setup_true_lang-DXV811zB.js} +32 -15
- package/dist/Dropdown.vue_vue_type_script_setup_true_lang-DXV811zB.js.map +1 -0
- package/dist/{PageLayout.vue_vue_type_script_setup_true_lang-D22uNeS1.cjs → PageLayout.vue_vue_type_script_setup_true_lang-C0YzyJnK.cjs} +2 -2
- package/dist/{PageLayout.vue_vue_type_script_setup_true_lang-D22uNeS1.cjs.map → PageLayout.vue_vue_type_script_setup_true_lang-C0YzyJnK.cjs.map} +1 -1
- package/dist/{PageLayout.vue_vue_type_script_setup_true_lang-kT7np2ir.js → PageLayout.vue_vue_type_script_setup_true_lang-ClzYGS8h.js} +2 -2
- package/dist/{PageLayout.vue_vue_type_script_setup_true_lang-kT7np2ir.js.map → PageLayout.vue_vue_type_script_setup_true_lang-ClzYGS8h.js.map} +1 -1
- package/dist/components/core/AccordionItem.vue.d.ts +2 -0
- package/dist/components/core/DarkModeToggle.stories.d.ts +15 -0
- package/dist/components/core/DarkModeToggle.test.d.ts +1 -0
- package/dist/components/core/DarkModeToggle.vue.d.ts +21 -0
- package/dist/components/core/Dropdown.vue.d.ts +2 -0
- package/dist/components/core/Popover.vue.d.ts +2 -0
- package/dist/components/core/Tooltip.vue.d.ts +2 -0
- package/dist/components/core/index.cjs +23 -21
- package/dist/components/core/index.cjs.map +1 -1
- package/dist/components/core/index.d.ts +2 -0
- package/dist/components/core/index.js +17 -15
- package/dist/components/core/index.js.map +1 -1
- package/dist/components/core/index.test.d.ts +1 -0
- package/dist/components/feedback/ConfirmDialog.stories.d.ts +12 -0
- package/dist/components/feedback/ConfirmDialog.test.d.ts +1 -0
- package/dist/components/feedback/ConfirmDialog.vue.d.ts +53 -0
- package/dist/components/feedback/LoadingSpinner.vue.d.ts +6 -1
- package/dist/components/feedback/Modal.vue.d.ts +18 -3
- package/dist/components/feedback/Progress.vue.d.ts +1 -1
- package/dist/components/feedback/index.cjs +17 -16
- package/dist/components/feedback/index.cjs.map +1 -1
- package/dist/components/feedback/index.d.ts +2 -0
- package/dist/components/feedback/index.js +6 -5
- package/dist/components/feedback/index.test.d.ts +1 -0
- package/dist/components/form/Checkbox.vue.d.ts +2 -0
- package/dist/components/form/ColorPicker.vue.d.ts +3 -0
- package/dist/components/form/Combobox.stories.d.ts +15 -0
- package/dist/components/form/Combobox.test.d.ts +1 -0
- package/dist/components/form/Combobox.vue.d.ts +46 -0
- package/dist/components/form/DatePicker.vue.d.ts +2 -0
- package/dist/components/form/FormHelp.vue.d.ts +2 -0
- package/dist/components/form/Switch.vue.d.ts +2 -0
- package/dist/components/form/index.cjs +17 -16
- package/dist/components/form/index.cjs.map +1 -1
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +3 -2
- package/dist/components/form/index.test.d.ts +1 -0
- package/dist/components/index.cjs +57 -54
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +35 -32
- package/dist/components/index.test.d.ts +1 -0
- package/dist/components/layout/index.cjs +1 -1
- package/dist/components/layout/index.js +1 -1
- package/dist/components/layout/index.test.d.ts +1 -0
- package/dist/components/type/index.test.d.ts +1 -0
- package/dist/composables/index.cjs +9 -2
- package/dist/composables/index.cjs.map +1 -1
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +15 -8
- package/dist/composables/index.js.map +1 -1
- package/dist/composables/index.test.d.ts +1 -0
- package/dist/composables/useDarkMode.test.d.ts +1 -0
- package/dist/composables/useDropdown.test.d.ts +1 -0
- package/dist/composables/useExportCSV.test.d.ts +1 -0
- package/dist/composables/useFocusTrap.d.ts +41 -0
- package/dist/composables/useFocusTrap.test.d.ts +1 -0
- package/dist/composables/useId.d.ts +42 -0
- package/dist/composables/useId.test.d.ts +1 -0
- package/dist/composables/useModal.d.ts +1 -1
- package/dist/composables/useModal.test.d.ts +1 -0
- package/dist/index-BMoLBt6A.js +75 -0
- package/dist/index-BMoLBt6A.js.map +1 -0
- package/dist/index-CJwlO351.js +347 -0
- package/dist/index-CJwlO351.js.map +1 -0
- package/dist/index-CUNU12xk.cjs +346 -0
- package/dist/index-CUNU12xk.cjs.map +1 -0
- package/dist/index-DwFvFW-3.cjs +74 -0
- package/dist/index-DwFvFW-3.cjs.map +1 -0
- package/dist/index.cjs +67 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -41
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/types/form.d.ts +4 -0
- package/dist/types/index.test.d.ts +1 -0
- package/dist/useDarkMode-Cl5QWTlC.js +53 -0
- package/dist/useDarkMode-Cl5QWTlC.js.map +1 -0
- package/dist/useDarkMode-DLZcJEUQ.cjs +52 -0
- package/dist/useDarkMode-DLZcJEUQ.cjs.map +1 -0
- package/dist/useFocusTrap-AnlJsihM.js +120 -0
- package/dist/useFocusTrap-AnlJsihM.js.map +1 -0
- package/dist/useFocusTrap-kcxO8AeU.cjs +119 -0
- package/dist/useFocusTrap-kcxO8AeU.cjs.map +1 -0
- package/dist/useId-nxrBaIC9.cjs +25 -0
- package/dist/useId-nxrBaIC9.cjs.map +1 -0
- package/dist/useId-xeHj7rkg.js +26 -0
- package/dist/useId-xeHj7rkg.js.map +1 -0
- package/dist/{useToast-CRh_sG82.cjs → useToast-Bk60GArg.cjs} +1 -50
- package/dist/useToast-Bk60GArg.cjs.map +1 -0
- package/dist/{useToast-DwFOkewC.js → useToast-ina5g3mj.js} +6 -55
- package/dist/useToast-ina5g3mj.js.map +1 -0
- package/package.json +9 -8
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang-B-nLCCNY.js +0 -54
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang-B-nLCCNY.js.map +0 -1
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang-DIoHDji4.cjs +0 -53
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang-DIoHDji4.cjs.map +0 -1
- package/dist/Dropdown.vue_vue_type_script_setup_true_lang-C3pr8BwC.js.map +0 -1
- package/dist/Dropdown.vue_vue_type_script_setup_true_lang-DKxcVBKu.cjs.map +0 -1
- package/dist/ListSkeleton.vue_vue_type_script_setup_true_lang-CrEu33_J.cjs.map +0 -1
- package/dist/ListSkeleton.vue_vue_type_script_setup_true_lang-D3_Oddwt.js.map +0 -1
- package/dist/RangeSlider.vue_vue_type_script_setup_true_lang-B79_S1JL.js.map +0 -1
- package/dist/RangeSlider.vue_vue_type_script_setup_true_lang-ClH-pyK8.cjs.map +0 -1
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-CsDMGhaT.cjs.map +0 -1
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-Q4PcIELi.js.map +0 -1
- package/dist/Timeline.vue_vue_type_script_setup_true_lang-C5SKEGPG.cjs.map +0 -1
- package/dist/Timeline.vue_vue_type_script_setup_true_lang-ykGksWXN.js.map +0 -1
- package/dist/index-C3NAM2ds.js +0 -72
- package/dist/index-C3NAM2ds.js.map +0 -1
- package/dist/index-Ti1RIOEG.cjs +0 -71
- package/dist/index-Ti1RIOEG.cjs.map +0 -1
- package/dist/useToast-CRh_sG82.cjs.map +0 -1
- package/dist/useToast-DwFOkewC.js.map +0 -1
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const vue = require("vue");
|
|
3
|
+
const useId = require("./useId-nxrBaIC9.cjs");
|
|
4
|
+
const _hoisted_1 = ["id", "checked", "disabled", "indeterminate", "aria-describedby"];
|
|
5
|
+
const _hoisted_2 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "flex flex-col"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "text-sm font-medium text-gray-900 dark:text-white"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_4 = ["id"];
|
|
14
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
15
|
+
__name: "Checkbox",
|
|
16
|
+
props: {
|
|
17
|
+
modelValue: { type: Boolean, default: false },
|
|
18
|
+
label: {},
|
|
19
|
+
description: {},
|
|
20
|
+
disabled: { type: Boolean },
|
|
21
|
+
indeterminate: { type: Boolean },
|
|
22
|
+
id: {}
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:modelValue"],
|
|
25
|
+
setup(__props, { emit: __emit }) {
|
|
26
|
+
const props = __props;
|
|
27
|
+
const emit = __emit;
|
|
28
|
+
const { id: generatedId, related } = useId.useId({ prefix: "checkbox", id: props.id });
|
|
29
|
+
const inputId = vue.computed(() => props.id ?? generatedId.value);
|
|
30
|
+
const descriptionId = vue.computed(() => related("description"));
|
|
31
|
+
const toggle = (event) => {
|
|
32
|
+
const target = event.target;
|
|
33
|
+
emit("update:modelValue", target.checked);
|
|
34
|
+
};
|
|
35
|
+
return (_ctx, _cache) => {
|
|
36
|
+
return vue.openBlock(), vue.createElementBlock("label", {
|
|
37
|
+
class: vue.normalizeClass(["inline-flex items-start gap-3", __props.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"])
|
|
38
|
+
}, [
|
|
39
|
+
vue.createElementVNode("input", {
|
|
40
|
+
id: inputId.value,
|
|
41
|
+
type: "checkbox",
|
|
42
|
+
checked: __props.modelValue,
|
|
43
|
+
disabled: __props.disabled,
|
|
44
|
+
indeterminate: __props.indeterminate,
|
|
45
|
+
"aria-describedby": __props.description ? descriptionId.value : void 0,
|
|
46
|
+
class: "mt-0.5 size-4 rounded border-gray-300 text-primary/90 focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed dark:border-gray-600 dark:bg-gray-800 dark:focus:ring-offset-gray-900",
|
|
47
|
+
onChange: toggle
|
|
48
|
+
}, null, 40, _hoisted_1),
|
|
49
|
+
__props.label || __props.description ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
|
50
|
+
__props.label ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3, vue.toDisplayString(__props.label), 1)) : vue.createCommentVNode("", true),
|
|
51
|
+
__props.description ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
52
|
+
key: 1,
|
|
53
|
+
id: descriptionId.value,
|
|
54
|
+
class: "text-sm text-gray-500 dark:text-gray-400"
|
|
55
|
+
}, vue.toDisplayString(__props.description), 9, _hoisted_4)) : vue.createCommentVNode("", true)
|
|
56
|
+
])) : vue.createCommentVNode("", true)
|
|
57
|
+
], 2);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
62
|
+
const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
63
|
+
var _getCurrentInstance;
|
|
64
|
+
const key = args[0];
|
|
65
|
+
const instance = (_getCurrentInstance = vue.getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.proxy;
|
|
66
|
+
const owner = instance !== null && instance !== void 0 ? instance : vue.getCurrentScope();
|
|
67
|
+
if (owner == null && !vue.hasInjectionContext()) throw new Error("injectLocal must be called in setup");
|
|
68
|
+
if (owner && localProvidedStateMap.has(owner) && key in localProvidedStateMap.get(owner)) return localProvidedStateMap.get(owner)[key];
|
|
69
|
+
return vue.inject(...args);
|
|
70
|
+
};
|
|
71
|
+
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
72
|
+
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
73
|
+
const toString = Object.prototype.toString;
|
|
74
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
75
|
+
const noop = () => {
|
|
76
|
+
};
|
|
77
|
+
function increaseWithUnit(target, delta) {
|
|
78
|
+
var _target$match;
|
|
79
|
+
if (typeof target === "number") return target + delta;
|
|
80
|
+
const value = ((_target$match = target.match(/^-?\d+\.?\d*/)) === null || _target$match === void 0 ? void 0 : _target$match[0]) || "";
|
|
81
|
+
const unit = target.slice(value.length);
|
|
82
|
+
const result = Number.parseFloat(value) + delta;
|
|
83
|
+
if (Number.isNaN(result)) return target;
|
|
84
|
+
return result + unit;
|
|
85
|
+
}
|
|
86
|
+
function pxValue(px) {
|
|
87
|
+
return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
|
|
88
|
+
}
|
|
89
|
+
function toArray(value) {
|
|
90
|
+
return Array.isArray(value) ? value : [value];
|
|
91
|
+
}
|
|
92
|
+
function getLifeCycleTarget(target) {
|
|
93
|
+
return vue.getCurrentInstance();
|
|
94
|
+
}
|
|
95
|
+
function tryOnMounted(fn, sync = true, target) {
|
|
96
|
+
if (getLifeCycleTarget()) vue.onMounted(fn, target);
|
|
97
|
+
else if (sync) fn();
|
|
98
|
+
else vue.nextTick(fn);
|
|
99
|
+
}
|
|
100
|
+
function watchImmediate(source, cb, options) {
|
|
101
|
+
return vue.watch(source, cb, {
|
|
102
|
+
...options,
|
|
103
|
+
immediate: true
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
const defaultWindow = isClient ? window : void 0;
|
|
107
|
+
function unrefElement(elRef) {
|
|
108
|
+
var _$el;
|
|
109
|
+
const plain = vue.toValue(elRef);
|
|
110
|
+
return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;
|
|
111
|
+
}
|
|
112
|
+
function useEventListener(...args) {
|
|
113
|
+
const register = (el, event, listener, options) => {
|
|
114
|
+
el.addEventListener(event, listener, options);
|
|
115
|
+
return () => el.removeEventListener(event, listener, options);
|
|
116
|
+
};
|
|
117
|
+
const firstParamTargets = vue.computed(() => {
|
|
118
|
+
const test = toArray(vue.toValue(args[0])).filter((e) => e != null);
|
|
119
|
+
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
120
|
+
});
|
|
121
|
+
return watchImmediate(() => {
|
|
122
|
+
var _firstParamTargets$va, _firstParamTargets$va2;
|
|
123
|
+
return [
|
|
124
|
+
(_firstParamTargets$va = (_firstParamTargets$va2 = firstParamTargets.value) === null || _firstParamTargets$va2 === void 0 ? void 0 : _firstParamTargets$va2.map((e) => unrefElement(e))) !== null && _firstParamTargets$va !== void 0 ? _firstParamTargets$va : [defaultWindow].filter((e) => e != null),
|
|
125
|
+
toArray(vue.toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
126
|
+
toArray(vue.unref(firstParamTargets.value ? args[2] : args[1])),
|
|
127
|
+
vue.toValue(firstParamTargets.value ? args[3] : args[2])
|
|
128
|
+
];
|
|
129
|
+
}, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => {
|
|
130
|
+
if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return;
|
|
131
|
+
const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
132
|
+
const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))));
|
|
133
|
+
onCleanup(() => {
|
|
134
|
+
cleanups.forEach((fn) => fn());
|
|
135
|
+
});
|
|
136
|
+
}, { flush: "post" });
|
|
137
|
+
}
|
|
138
|
+
function onClickOutside(target, handler, options = {}) {
|
|
139
|
+
const { window: window$1 = defaultWindow, ignore = [], capture = true, detectIframe = false, controls = false } = options;
|
|
140
|
+
if (!window$1) return controls ? {
|
|
141
|
+
stop: noop,
|
|
142
|
+
cancel: noop,
|
|
143
|
+
trigger: noop
|
|
144
|
+
} : noop;
|
|
145
|
+
let shouldListen = true;
|
|
146
|
+
const shouldIgnore = (event) => {
|
|
147
|
+
return vue.toValue(ignore).some((target$1) => {
|
|
148
|
+
if (typeof target$1 === "string") return Array.from(window$1.document.querySelectorAll(target$1)).some((el) => el === event.target || event.composedPath().includes(el));
|
|
149
|
+
else {
|
|
150
|
+
const el = unrefElement(target$1);
|
|
151
|
+
return el && (event.target === el || event.composedPath().includes(el));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
function hasMultipleRoots(target$1) {
|
|
156
|
+
const vm = vue.toValue(target$1);
|
|
157
|
+
return vm && vm.$.subTree.shapeFlag === 16;
|
|
158
|
+
}
|
|
159
|
+
function checkMultipleRoots(target$1, event) {
|
|
160
|
+
const vm = vue.toValue(target$1);
|
|
161
|
+
const children = vm.$.subTree && vm.$.subTree.children;
|
|
162
|
+
if (children == null || !Array.isArray(children)) return false;
|
|
163
|
+
return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));
|
|
164
|
+
}
|
|
165
|
+
const listener = (event) => {
|
|
166
|
+
const el = unrefElement(target);
|
|
167
|
+
if (event.target == null) return;
|
|
168
|
+
if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event)) return;
|
|
169
|
+
if (!el || el === event.target || event.composedPath().includes(el)) return;
|
|
170
|
+
if ("detail" in event && event.detail === 0) shouldListen = !shouldIgnore(event);
|
|
171
|
+
if (!shouldListen) {
|
|
172
|
+
shouldListen = true;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
handler(event);
|
|
176
|
+
};
|
|
177
|
+
let isProcessingClick = false;
|
|
178
|
+
const cleanup = [
|
|
179
|
+
useEventListener(window$1, "click", (event) => {
|
|
180
|
+
if (!isProcessingClick) {
|
|
181
|
+
isProcessingClick = true;
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
isProcessingClick = false;
|
|
184
|
+
}, 0);
|
|
185
|
+
listener(event);
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
passive: true,
|
|
189
|
+
capture
|
|
190
|
+
}),
|
|
191
|
+
useEventListener(window$1, "pointerdown", (e) => {
|
|
192
|
+
const el = unrefElement(target);
|
|
193
|
+
shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
|
|
194
|
+
}, { passive: true }),
|
|
195
|
+
detectIframe && useEventListener(window$1, "blur", (event) => {
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
var _window$document$acti;
|
|
198
|
+
const el = unrefElement(target);
|
|
199
|
+
if (((_window$document$acti = window$1.document.activeElement) === null || _window$document$acti === void 0 ? void 0 : _window$document$acti.tagName) === "IFRAME" && !(el === null || el === void 0 ? void 0 : el.contains(window$1.document.activeElement))) handler(event);
|
|
200
|
+
}, 0);
|
|
201
|
+
}, { passive: true })
|
|
202
|
+
].filter(Boolean);
|
|
203
|
+
const stop = () => cleanup.forEach((fn) => fn());
|
|
204
|
+
if (controls) return {
|
|
205
|
+
stop,
|
|
206
|
+
cancel: () => {
|
|
207
|
+
shouldListen = false;
|
|
208
|
+
},
|
|
209
|
+
trigger: (event) => {
|
|
210
|
+
shouldListen = true;
|
|
211
|
+
listener(event);
|
|
212
|
+
shouldListen = false;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
return stop;
|
|
216
|
+
}
|
|
217
|
+
// @__NO_SIDE_EFFECTS__
|
|
218
|
+
function useMounted() {
|
|
219
|
+
const isMounted = vue.shallowRef(false);
|
|
220
|
+
const instance = vue.getCurrentInstance();
|
|
221
|
+
if (instance) vue.onMounted(() => {
|
|
222
|
+
isMounted.value = true;
|
|
223
|
+
}, instance);
|
|
224
|
+
return isMounted;
|
|
225
|
+
}
|
|
226
|
+
// @__NO_SIDE_EFFECTS__
|
|
227
|
+
function useSupported(callback) {
|
|
228
|
+
const isMounted = /* @__PURE__ */ useMounted();
|
|
229
|
+
return vue.computed(() => {
|
|
230
|
+
isMounted.value;
|
|
231
|
+
return Boolean(callback());
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
235
|
+
// @__NO_SIDE_EFFECTS__
|
|
236
|
+
function useSSRWidth() {
|
|
237
|
+
const ssrWidth = vue.hasInjectionContext() ? /* @__PURE__ */ injectLocal(ssrWidthSymbol, null) : null;
|
|
238
|
+
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
239
|
+
}
|
|
240
|
+
function useMediaQuery(query, options = {}) {
|
|
241
|
+
const { window: window$1 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
242
|
+
const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "matchMedia" in window$1 && typeof window$1.matchMedia === "function");
|
|
243
|
+
const ssrSupport = vue.shallowRef(typeof ssrWidth === "number");
|
|
244
|
+
const mediaQuery = vue.shallowRef();
|
|
245
|
+
const matches = vue.shallowRef(false);
|
|
246
|
+
const handler = (event) => {
|
|
247
|
+
matches.value = event.matches;
|
|
248
|
+
};
|
|
249
|
+
vue.watchEffect(() => {
|
|
250
|
+
if (ssrSupport.value) {
|
|
251
|
+
ssrSupport.value = !isSupported.value;
|
|
252
|
+
matches.value = vue.toValue(query).split(",").some((queryString) => {
|
|
253
|
+
const not = queryString.includes("not all");
|
|
254
|
+
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
255
|
+
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
256
|
+
let res = Boolean(minWidth || maxWidth);
|
|
257
|
+
if (minWidth && res) res = ssrWidth >= pxValue(minWidth[1]);
|
|
258
|
+
if (maxWidth && res) res = ssrWidth <= pxValue(maxWidth[1]);
|
|
259
|
+
return not ? !res : res;
|
|
260
|
+
});
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (!isSupported.value) return;
|
|
264
|
+
mediaQuery.value = window$1.matchMedia(vue.toValue(query));
|
|
265
|
+
matches.value = mediaQuery.value.matches;
|
|
266
|
+
});
|
|
267
|
+
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
268
|
+
return vue.computed(() => matches.value);
|
|
269
|
+
}
|
|
270
|
+
// @__NO_SIDE_EFFECTS__
|
|
271
|
+
function useBreakpoints(breakpoints, options = {}) {
|
|
272
|
+
function getValue$1(k, delta) {
|
|
273
|
+
let v = vue.toValue(breakpoints[vue.toValue(k)]);
|
|
274
|
+
if (delta != null) v = increaseWithUnit(v, delta);
|
|
275
|
+
if (typeof v === "number") v = `${v}px`;
|
|
276
|
+
return v;
|
|
277
|
+
}
|
|
278
|
+
const { window: window$1 = defaultWindow, strategy = "min-width", ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
279
|
+
const ssrSupport = typeof ssrWidth === "number";
|
|
280
|
+
const mounted = ssrSupport ? vue.shallowRef(false) : { value: true };
|
|
281
|
+
if (ssrSupport) tryOnMounted(() => mounted.value = !!window$1);
|
|
282
|
+
function match(query, size) {
|
|
283
|
+
if (!mounted.value && ssrSupport) return query === "min" ? ssrWidth >= pxValue(size) : ssrWidth <= pxValue(size);
|
|
284
|
+
if (!window$1) return false;
|
|
285
|
+
return window$1.matchMedia(`(${query}-width: ${size})`).matches;
|
|
286
|
+
}
|
|
287
|
+
const greaterOrEqual = (k) => {
|
|
288
|
+
return useMediaQuery(() => `(min-width: ${getValue$1(k)})`, options);
|
|
289
|
+
};
|
|
290
|
+
const smallerOrEqual = (k) => {
|
|
291
|
+
return useMediaQuery(() => `(max-width: ${getValue$1(k)})`, options);
|
|
292
|
+
};
|
|
293
|
+
const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k) => {
|
|
294
|
+
Object.defineProperty(shortcuts, k, {
|
|
295
|
+
get: () => strategy === "min-width" ? greaterOrEqual(k) : smallerOrEqual(k),
|
|
296
|
+
enumerable: true,
|
|
297
|
+
configurable: true
|
|
298
|
+
});
|
|
299
|
+
return shortcuts;
|
|
300
|
+
}, {});
|
|
301
|
+
function current() {
|
|
302
|
+
const points = Object.keys(breakpoints).map((k) => [
|
|
303
|
+
k,
|
|
304
|
+
shortcutMethods[k],
|
|
305
|
+
pxValue(getValue$1(k))
|
|
306
|
+
]).sort((a, b) => a[2] - b[2]);
|
|
307
|
+
return vue.computed(() => points.filter(([, v]) => v.value).map(([k]) => k));
|
|
308
|
+
}
|
|
309
|
+
return Object.assign(shortcutMethods, {
|
|
310
|
+
greaterOrEqual,
|
|
311
|
+
smallerOrEqual,
|
|
312
|
+
greater(k) {
|
|
313
|
+
return useMediaQuery(() => `(min-width: ${getValue$1(k, 0.1)})`, options);
|
|
314
|
+
},
|
|
315
|
+
smaller(k) {
|
|
316
|
+
return useMediaQuery(() => `(max-width: ${getValue$1(k, -0.1)})`, options);
|
|
317
|
+
},
|
|
318
|
+
between(a, b) {
|
|
319
|
+
return useMediaQuery(() => `(min-width: ${getValue$1(a)}) and (max-width: ${getValue$1(b, -0.1)})`, options);
|
|
320
|
+
},
|
|
321
|
+
isGreater(k) {
|
|
322
|
+
return match("min", getValue$1(k, 0.1));
|
|
323
|
+
},
|
|
324
|
+
isGreaterOrEqual(k) {
|
|
325
|
+
return match("min", getValue$1(k));
|
|
326
|
+
},
|
|
327
|
+
isSmaller(k) {
|
|
328
|
+
return match("max", getValue$1(k, -0.1));
|
|
329
|
+
},
|
|
330
|
+
isSmallerOrEqual(k) {
|
|
331
|
+
return match("max", getValue$1(k));
|
|
332
|
+
},
|
|
333
|
+
isInBetween(a, b) {
|
|
334
|
+
return match("min", getValue$1(a)) && match("max", getValue$1(b, -0.1));
|
|
335
|
+
},
|
|
336
|
+
current,
|
|
337
|
+
active() {
|
|
338
|
+
const bps = current();
|
|
339
|
+
return vue.computed(() => bps.value.length === 0 ? "" : bps.value.at(strategy === "min-width" ? -1 : 0));
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
exports._sfc_main = _sfc_main;
|
|
344
|
+
exports.onClickOutside = onClickOutside;
|
|
345
|
+
exports.useBreakpoints = useBreakpoints;
|
|
346
|
+
//# sourceMappingURL=index-CUNU12xk.cjs.map
|