framepexls-ui-lib 0.3.7 → 0.3.8
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/Checkbox.d.mts +1 -1
- package/dist/Checkbox.d.ts +1 -1
- package/dist/MultiComboSelect.js +25 -1
- package/dist/MultiComboSelect.mjs +26 -2
- package/package.json +1 -1
package/dist/Checkbox.d.mts
CHANGED
|
@@ -11,7 +11,7 @@ type CheckboxProps = Omit<React__default.InputHTMLAttributes<HTMLInputElement>,
|
|
|
11
11
|
className?: string;
|
|
12
12
|
inputClassName?: string;
|
|
13
13
|
};
|
|
14
|
-
declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "
|
|
14
|
+
declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & {
|
|
15
15
|
label?: React__default.ReactNode;
|
|
16
16
|
description?: React__default.ReactNode;
|
|
17
17
|
error?: boolean;
|
package/dist/Checkbox.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type CheckboxProps = Omit<React__default.InputHTMLAttributes<HTMLInputElement>,
|
|
|
11
11
|
className?: string;
|
|
12
12
|
inputClassName?: string;
|
|
13
13
|
};
|
|
14
|
-
declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "
|
|
14
|
+
declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & {
|
|
15
15
|
label?: React__default.ReactNode;
|
|
16
16
|
description?: React__default.ReactNode;
|
|
17
17
|
error?: boolean;
|
package/dist/MultiComboSelect.js
CHANGED
|
@@ -53,6 +53,7 @@ function MultiComboSelect({
|
|
|
53
53
|
enableDialog = true,
|
|
54
54
|
dialogTitle = "Seleccionadas"
|
|
55
55
|
}) {
|
|
56
|
+
const rootRef = import_react.default.useRef(null);
|
|
56
57
|
const selectedSet = import_react.default.useMemo(() => new Set(value), [value]);
|
|
57
58
|
const [dialogOpen, setDialogOpen] = import_react.default.useState(false);
|
|
58
59
|
const toggle = import_react.default.useCallback(
|
|
@@ -65,7 +66,30 @@ function MultiComboSelect({
|
|
|
65
66
|
},
|
|
66
67
|
[selectedSet, onChange]
|
|
67
68
|
);
|
|
68
|
-
|
|
69
|
+
import_react.default.useEffect(() => {
|
|
70
|
+
const onPointerDownCapture = (e) => {
|
|
71
|
+
var _a;
|
|
72
|
+
const t = e.target;
|
|
73
|
+
const inRoot = !!rootRef.current && rootRef.current.contains(t);
|
|
74
|
+
const inListbox = !!(t == null ? void 0 : t.closest('[role="listbox"]'));
|
|
75
|
+
if (!inRoot && !inListbox) {
|
|
76
|
+
const input = (_a = rootRef.current) == null ? void 0 : _a.querySelector('input[role="combobox"]');
|
|
77
|
+
if (input) {
|
|
78
|
+
try {
|
|
79
|
+
input.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
input.blur();
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
window.addEventListener("pointerdown", onPointerDownCapture, true);
|
|
90
|
+
return () => window.removeEventListener("pointerdown", onPointerDownCapture, true);
|
|
91
|
+
}, []);
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: rootRef, children: [
|
|
69
93
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
94
|
import_ComboSelect.default,
|
|
71
95
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import ComboSelect from "./ComboSelect";
|
|
5
5
|
import Dialog from "./Dialog";
|
|
@@ -20,6 +20,7 @@ function MultiComboSelect({
|
|
|
20
20
|
enableDialog = true,
|
|
21
21
|
dialogTitle = "Seleccionadas"
|
|
22
22
|
}) {
|
|
23
|
+
const rootRef = React.useRef(null);
|
|
23
24
|
const selectedSet = React.useMemo(() => new Set(value), [value]);
|
|
24
25
|
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
25
26
|
const toggle = React.useCallback(
|
|
@@ -32,7 +33,30 @@ function MultiComboSelect({
|
|
|
32
33
|
},
|
|
33
34
|
[selectedSet, onChange]
|
|
34
35
|
);
|
|
35
|
-
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
const onPointerDownCapture = (e) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const t = e.target;
|
|
40
|
+
const inRoot = !!rootRef.current && rootRef.current.contains(t);
|
|
41
|
+
const inListbox = !!(t == null ? void 0 : t.closest('[role="listbox"]'));
|
|
42
|
+
if (!inRoot && !inListbox) {
|
|
43
|
+
const input = (_a = rootRef.current) == null ? void 0 : _a.querySelector('input[role="combobox"]');
|
|
44
|
+
if (input) {
|
|
45
|
+
try {
|
|
46
|
+
input.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
input.blur();
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
window.addEventListener("pointerdown", onPointerDownCapture, true);
|
|
57
|
+
return () => window.removeEventListener("pointerdown", onPointerDownCapture, true);
|
|
58
|
+
}, []);
|
|
59
|
+
return /* @__PURE__ */ jsxs("div", { ref: rootRef, children: [
|
|
36
60
|
/* @__PURE__ */ jsx(
|
|
37
61
|
ComboSelect,
|
|
38
62
|
{
|