@tecsinapse/cortex-react 1.3.0-beta.5 → 1.3.0-beta.6
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/cjs/components/Select/Content.js +5 -4
- package/dist/cjs/components/Select/Popover.js +1 -1
- package/dist/cjs/hooks/useOutsideClickListener.js +1 -3
- package/dist/esm/components/Select/Content.js +6 -5
- package/dist/esm/components/Select/Popover.js +1 -1
- package/dist/esm/hooks/useOutsideClickListener.js +1 -3
- package/package.json +2 -2
|
@@ -6,8 +6,8 @@ require('react-aria');
|
|
|
6
6
|
require('react-stately');
|
|
7
7
|
var useOutsideClickListener = require('../../hooks/useOutsideClickListener.js');
|
|
8
8
|
require('@floating-ui/react');
|
|
9
|
-
var context = require('./context.js');
|
|
10
9
|
var Context = require('../Popover/Context.js');
|
|
10
|
+
var context = require('./context.js');
|
|
11
11
|
|
|
12
12
|
const Content = ({
|
|
13
13
|
children,
|
|
@@ -15,12 +15,13 @@ const Content = ({
|
|
|
15
15
|
labelExtractor,
|
|
16
16
|
value
|
|
17
17
|
}) => {
|
|
18
|
-
const { setIsOpen
|
|
18
|
+
const { setIsOpen } = Context.usePopoverContext();
|
|
19
|
+
const ref = React.useRef(null);
|
|
19
20
|
useOutsideClickListener.useOutsideClickListener({
|
|
20
|
-
ref
|
|
21
|
+
ref,
|
|
21
22
|
onClickOutside: () => setIsOpen(false)
|
|
22
23
|
});
|
|
23
|
-
return /* @__PURE__ */ React.createElement(context.SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white" }, children));
|
|
24
|
+
return /* @__PURE__ */ React.createElement(context.SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white", ref }, children));
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
module.exports = Content;
|
|
@@ -4,7 +4,7 @@ var React = require('react');
|
|
|
4
4
|
var index = require('../Popover/index.js');
|
|
5
5
|
|
|
6
6
|
const SelectPopover = ({ children }) => {
|
|
7
|
-
return /* @__PURE__ */ React.createElement(index.Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll" }, children);
|
|
7
|
+
return /* @__PURE__ */ React.createElement(index.Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll gap-y-mili flex flex-col" }, children);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
exports.SelectPopover = SelectPopover;
|
|
@@ -8,9 +8,7 @@ const useOutsideClickListener = ({
|
|
|
8
8
|
}) => {
|
|
9
9
|
const handleClickOutside = React.useCallback((event) => {
|
|
10
10
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
11
|
-
|
|
12
|
-
onClickOutside?.();
|
|
13
|
-
}, 10);
|
|
11
|
+
onClickOutside?.();
|
|
14
12
|
}
|
|
15
13
|
}, []);
|
|
16
14
|
React.useEffect(() => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import '@internationalized/date';
|
|
3
3
|
import 'react-aria';
|
|
4
4
|
import 'react-stately';
|
|
5
5
|
import { useOutsideClickListener } from '../../hooks/useOutsideClickListener.js';
|
|
6
6
|
import '@floating-ui/react';
|
|
7
|
-
import { SelectContext } from './context.js';
|
|
8
7
|
import { usePopoverContext } from '../Popover/Context.js';
|
|
8
|
+
import { SelectContext } from './context.js';
|
|
9
9
|
|
|
10
10
|
const Content = ({
|
|
11
11
|
children,
|
|
@@ -13,12 +13,13 @@ const Content = ({
|
|
|
13
13
|
labelExtractor,
|
|
14
14
|
value
|
|
15
15
|
}) => {
|
|
16
|
-
const { setIsOpen
|
|
16
|
+
const { setIsOpen } = usePopoverContext();
|
|
17
|
+
const ref = useRef(null);
|
|
17
18
|
useOutsideClickListener({
|
|
18
|
-
ref
|
|
19
|
+
ref,
|
|
19
20
|
onClickOutside: () => setIsOpen(false)
|
|
20
21
|
});
|
|
21
|
-
return /* @__PURE__ */ React.createElement(SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white" }, children));
|
|
22
|
+
return /* @__PURE__ */ React.createElement(SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white", ref }, children));
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export { Content as default };
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popover } from '../Popover/index.js';
|
|
3
3
|
|
|
4
4
|
const SelectPopover = ({ children }) => {
|
|
5
|
-
return /* @__PURE__ */ React.createElement(Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll" }, children);
|
|
5
|
+
return /* @__PURE__ */ React.createElement(Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll gap-y-mili flex flex-col" }, children);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { SelectPopover };
|
|
@@ -6,9 +6,7 @@ const useOutsideClickListener = ({
|
|
|
6
6
|
}) => {
|
|
7
7
|
const handleClickOutside = useCallback((event) => {
|
|
8
8
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
9
|
-
|
|
10
|
-
onClickOutside?.();
|
|
11
|
-
}, 10);
|
|
9
|
+
onClickOutside?.();
|
|
12
10
|
}
|
|
13
11
|
}, []);
|
|
14
12
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.6",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"react-dom": ">=18.0.0",
|
|
43
43
|
"tailwind": ">=3.3.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "c45d44c53d32b39febf7f65f2b54692681d677c3"
|
|
46
46
|
}
|