@tecsinapse/cortex-react 1.5.4-beta.0 → 1.5.5
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/Menubar/Dropdown.js +8 -2
- package/dist/cjs/components/Menubar/Header.js +8 -2
- package/dist/cjs/components/Menubar/Root.js +1 -0
- package/dist/cjs/components/Menubar/Search.js +8 -2
- package/dist/cjs/index.js +4 -9
- package/dist/cjs/provider/MenubarContext.js +10 -0
- package/dist/cjs/provider/MenubarProvider.js +11 -16
- package/dist/cjs/provider/useMenubar.js +14 -0
- package/dist/cjs/styles/menubar.js +2 -2
- package/dist/esm/components/Menubar/Dropdown.js +7 -1
- package/dist/esm/components/Menubar/Header.js +7 -1
- package/dist/esm/components/Menubar/Root.js +1 -0
- package/dist/esm/components/Menubar/Search.js +7 -1
- package/dist/esm/index.js +3 -9
- package/dist/esm/provider/MenubarContext.js +8 -0
- package/dist/esm/provider/MenubarProvider.js +12 -16
- package/dist/esm/provider/useMenubar.js +12 -0
- package/dist/esm/styles/menubar.js +2 -2
- package/dist/types/components/Menubar/DropdownRoot.d.ts +2 -2
- package/dist/types/components/index.d.ts +0 -1
- package/dist/types/provider/MenubarContext.d.ts +7 -0
- package/dist/types/provider/MenubarProvider.d.ts +0 -4
- package/dist/types/provider/index.d.ts +2 -0
- package/dist/types/provider/useMenubar.d.ts +4 -0
- package/package.json +3 -3
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var menubar = require('../../styles/menubar.js');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
|
-
|
|
6
|
+
require('@internationalized/date');
|
|
7
|
+
require('react-aria');
|
|
8
|
+
require('react-stately');
|
|
9
|
+
require('@floating-ui/react');
|
|
10
|
+
require('currency.js');
|
|
11
|
+
require('../../provider/MenubarContext.js');
|
|
7
12
|
require('../../provider/SnackbarProvider.js');
|
|
13
|
+
var useMenubar = require('../../provider/useMenubar.js');
|
|
8
14
|
|
|
9
15
|
const { dropdown } = menubar.menubar();
|
|
10
16
|
const Dropdown = ({ children, ...rest }) => {
|
|
11
|
-
const [show] =
|
|
17
|
+
const [show] = useMenubar.useMenubar();
|
|
12
18
|
return /* @__PURE__ */ React.createElement(
|
|
13
19
|
"div",
|
|
14
20
|
{
|
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var io5 = require('react-icons/io5');
|
|
5
|
-
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('react-aria');
|
|
7
|
+
require('react-stately');
|
|
8
|
+
require('@floating-ui/react');
|
|
9
|
+
require('currency.js');
|
|
10
|
+
require('../../provider/MenubarContext.js');
|
|
6
11
|
require('../../provider/SnackbarProvider.js');
|
|
12
|
+
var useMenubar = require('../../provider/useMenubar.js');
|
|
7
13
|
var menubar = require('../../styles/menubar.js');
|
|
8
14
|
var Button = require('../Button.js');
|
|
9
15
|
|
|
10
16
|
const { header } = menubar.menubar();
|
|
11
17
|
const Header = ({ children, className, ...rest }) => {
|
|
12
|
-
const [show, setShow] =
|
|
18
|
+
const [show, setShow] = useMenubar.useMenubar();
|
|
13
19
|
return /* @__PURE__ */ React.createElement(
|
|
14
20
|
"div",
|
|
15
21
|
{
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var MenubarProvider = require('../../provider/MenubarProvider.js');
|
|
5
5
|
require('../../provider/SnackbarProvider.js');
|
|
6
|
+
require('../../provider/MenubarContext.js');
|
|
6
7
|
|
|
7
8
|
const Root = ({ children }) => {
|
|
8
9
|
return /* @__PURE__ */ React.createElement(MenubarProvider.MenubarProvider, null, children);
|
|
@@ -4,11 +4,17 @@ var React = require('react');
|
|
|
4
4
|
var index = require('../Input/index.js');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var menubar = require('../../styles/menubar.js');
|
|
7
|
-
|
|
7
|
+
require('@internationalized/date');
|
|
8
|
+
require('react-aria');
|
|
9
|
+
require('react-stately');
|
|
10
|
+
require('@floating-ui/react');
|
|
11
|
+
require('currency.js');
|
|
12
|
+
require('../../provider/MenubarContext.js');
|
|
8
13
|
require('../../provider/SnackbarProvider.js');
|
|
14
|
+
var useMenubar = require('../../provider/useMenubar.js');
|
|
9
15
|
|
|
10
16
|
const Search = (props) => {
|
|
11
|
-
const [show] =
|
|
17
|
+
const [show] = useMenubar.useMenubar();
|
|
12
18
|
return /* @__PURE__ */ React.createElement(
|
|
13
19
|
index.Input.Search,
|
|
14
20
|
{
|
package/dist/cjs/index.js
CHANGED
|
@@ -38,14 +38,6 @@ var TimeField = require('./components/TimeField/TimeField.js');
|
|
|
38
38
|
var TimeFieldInput = require('./components/TimeField/TimeFieldInput.js');
|
|
39
39
|
var Toggle = require('./components/Toggle.js');
|
|
40
40
|
var Tooltip = require('./components/Tooltip.js');
|
|
41
|
-
require('react');
|
|
42
|
-
require('clsx');
|
|
43
|
-
require('./styles/menubar.js');
|
|
44
|
-
require('./components/Menubar/Dropdown.js');
|
|
45
|
-
require('./components/Menubar/Item.js');
|
|
46
|
-
require('./components/Menubar/MostUsed.js');
|
|
47
|
-
require('./components/Menubar/MostUsedItem.js');
|
|
48
|
-
require('./components/Menubar/SubItem.js');
|
|
49
41
|
var useCalendar = require('./hooks/useCalendar.js');
|
|
50
42
|
var useCalendarCell = require('./hooks/useCalendarCell.js');
|
|
51
43
|
var useCalendarGrid = require('./hooks/useCalendarGrid.js');
|
|
@@ -62,6 +54,8 @@ var useStringMask = require('./hooks/useStringMask.js');
|
|
|
62
54
|
var SnackbarSonner = require('./service/SnackbarSonner.js');
|
|
63
55
|
var MenubarProvider = require('./provider/MenubarProvider.js');
|
|
64
56
|
var SnackbarProvider = require('./provider/SnackbarProvider.js');
|
|
57
|
+
var MenubarContext = require('./provider/MenubarContext.js');
|
|
58
|
+
var useMenubar = require('./provider/useMenubar.js');
|
|
65
59
|
var masks = require('./components/Input/masks.js');
|
|
66
60
|
|
|
67
61
|
|
|
@@ -131,9 +125,10 @@ exports.mergeMask = useStringMask.mergeMask;
|
|
|
131
125
|
exports.useStringMask = useStringMask.useStringMask;
|
|
132
126
|
exports.SnackbarSonner = SnackbarSonner.SnackbarSonner;
|
|
133
127
|
exports.MenubarProvider = MenubarProvider.MenubarProvider;
|
|
134
|
-
exports.useMenubar = MenubarProvider.useMenubar;
|
|
135
128
|
exports.SnackbarProvider = SnackbarProvider.SnackbarProvider;
|
|
136
129
|
exports.useSnackbar = SnackbarProvider.useSnackbar;
|
|
130
|
+
exports.MenubarContext = MenubarContext.MenubarContext;
|
|
131
|
+
exports.useMenubar = useMenubar.useMenubar;
|
|
137
132
|
exports.BRLMask = masks.BRLMask;
|
|
138
133
|
exports.CurrencyIMask = masks.CurrencyIMask;
|
|
139
134
|
exports.ExpressionMasks = masks.ExpressionMasks;
|
|
@@ -7,30 +7,25 @@ require('react-stately');
|
|
|
7
7
|
require('@floating-ui/react');
|
|
8
8
|
require('currency.js');
|
|
9
9
|
var useOutsideClickListener = require('../hooks/useOutsideClickListener.js');
|
|
10
|
+
var MenubarContext = require('./MenubarContext.js');
|
|
10
11
|
|
|
11
|
-
const MenubarContext = React.createContext({
|
|
12
|
-
show: false,
|
|
13
|
-
setShow: () => void 0
|
|
14
|
-
});
|
|
15
12
|
const MenubarProvider = ({ children }) => {
|
|
16
13
|
const [show, setShow] = React.useState(false);
|
|
17
14
|
const ref = React.useRef(null);
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const showRef = React.useRef(false);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
showRef.current = show;
|
|
18
|
+
}, [show]);
|
|
19
|
+
const onClickOutside = () => {
|
|
20
|
+
if (showRef.current === true) {
|
|
21
|
+
setShow(false);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
21
24
|
useOutsideClickListener.useOutsideClickListener({
|
|
22
25
|
ref,
|
|
23
26
|
onClickOutside
|
|
24
27
|
});
|
|
25
|
-
return /* @__PURE__ */ React.createElement(MenubarContext.Provider, { value: { show, setShow } }, /* @__PURE__ */ React.createElement("div", { ref }, children));
|
|
26
|
-
};
|
|
27
|
-
const useMenubar = () => {
|
|
28
|
-
const context = React.useContext(MenubarContext);
|
|
29
|
-
if (!context) {
|
|
30
|
-
throw new Error("useMenubar must be used within a MenubarProvider");
|
|
31
|
-
}
|
|
32
|
-
return [context.show, context.setShow];
|
|
28
|
+
return /* @__PURE__ */ React.createElement(MenubarContext.MenubarContext.Provider, { value: { show, setShow } }, /* @__PURE__ */ React.createElement("div", { ref }, children));
|
|
33
29
|
};
|
|
34
30
|
|
|
35
31
|
exports.MenubarProvider = MenubarProvider;
|
|
36
|
-
exports.useMenubar = useMenubar;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var MenubarContext = require('./MenubarContext.js');
|
|
5
|
+
|
|
6
|
+
const useMenubar = () => {
|
|
7
|
+
const context = React.useContext(MenubarContext.MenubarContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error("useMenubar must be used within a MenubarProvider");
|
|
10
|
+
}
|
|
11
|
+
return [context.show, context.setShow];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.useMenubar = useMenubar;
|
|
@@ -4,10 +4,10 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const menubar = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-
|
|
7
|
+
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-sidebar",
|
|
8
8
|
left: "flex items-center w-fit",
|
|
9
9
|
right: "flex items-center gap-x-deca",
|
|
10
|
-
dropdown: "w-full bg-white flex-1 shadow-default z-
|
|
10
|
+
dropdown: "w-full bg-white flex-1 shadow-default z-popover px-[8vw] absolute"
|
|
11
11
|
},
|
|
12
12
|
variants: {
|
|
13
13
|
show: {
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { menubar, animate } from '../../styles/menubar.js';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import
|
|
4
|
+
import '@internationalized/date';
|
|
5
|
+
import 'react-aria';
|
|
6
|
+
import 'react-stately';
|
|
7
|
+
import '@floating-ui/react';
|
|
8
|
+
import 'currency.js';
|
|
9
|
+
import '../../provider/MenubarContext.js';
|
|
5
10
|
import '../../provider/SnackbarProvider.js';
|
|
11
|
+
import { useMenubar } from '../../provider/useMenubar.js';
|
|
6
12
|
|
|
7
13
|
const { dropdown } = menubar();
|
|
8
14
|
const Dropdown = ({ children, ...rest }) => {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { IoCloseOutline, IoMenu } from 'react-icons/io5';
|
|
3
|
-
import
|
|
3
|
+
import '@internationalized/date';
|
|
4
|
+
import 'react-aria';
|
|
5
|
+
import 'react-stately';
|
|
6
|
+
import '@floating-ui/react';
|
|
7
|
+
import 'currency.js';
|
|
8
|
+
import '../../provider/MenubarContext.js';
|
|
4
9
|
import '../../provider/SnackbarProvider.js';
|
|
10
|
+
import { useMenubar } from '../../provider/useMenubar.js';
|
|
5
11
|
import { menubar } from '../../styles/menubar.js';
|
|
6
12
|
import { Button } from '../Button.js';
|
|
7
13
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { MenubarProvider } from '../../provider/MenubarProvider.js';
|
|
3
3
|
import '../../provider/SnackbarProvider.js';
|
|
4
|
+
import '../../provider/MenubarContext.js';
|
|
4
5
|
|
|
5
6
|
const Root = ({ children }) => {
|
|
6
7
|
return /* @__PURE__ */ React__default.createElement(MenubarProvider, null, children);
|
|
@@ -2,8 +2,14 @@ import React__default from 'react';
|
|
|
2
2
|
import { Input } from '../Input/index.js';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { animate } from '../../styles/menubar.js';
|
|
5
|
-
import
|
|
5
|
+
import '@internationalized/date';
|
|
6
|
+
import 'react-aria';
|
|
7
|
+
import 'react-stately';
|
|
8
|
+
import '@floating-ui/react';
|
|
9
|
+
import 'currency.js';
|
|
10
|
+
import '../../provider/MenubarContext.js';
|
|
6
11
|
import '../../provider/SnackbarProvider.js';
|
|
12
|
+
import { useMenubar } from '../../provider/useMenubar.js';
|
|
7
13
|
|
|
8
14
|
const Search = (props) => {
|
|
9
15
|
const [show] = useMenubar();
|
package/dist/esm/index.js
CHANGED
|
@@ -36,14 +36,6 @@ export { TimeField } from './components/TimeField/TimeField.js';
|
|
|
36
36
|
export { TimeFieldInput } from './components/TimeField/TimeFieldInput.js';
|
|
37
37
|
export { Toggle } from './components/Toggle.js';
|
|
38
38
|
export { Tooltip } from './components/Tooltip.js';
|
|
39
|
-
import 'react';
|
|
40
|
-
import 'clsx';
|
|
41
|
-
import './styles/menubar.js';
|
|
42
|
-
import './components/Menubar/Dropdown.js';
|
|
43
|
-
import './components/Menubar/Item.js';
|
|
44
|
-
import './components/Menubar/MostUsed.js';
|
|
45
|
-
import './components/Menubar/MostUsedItem.js';
|
|
46
|
-
import './components/Menubar/SubItem.js';
|
|
47
39
|
export { useCalendar } from './hooks/useCalendar.js';
|
|
48
40
|
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
49
41
|
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
@@ -58,6 +50,8 @@ export { useSelectGroupedOptions } from './hooks/useSelectGroupedOptions.js';
|
|
|
58
50
|
export { useSelectOptions } from './hooks/useSelectOptions.js';
|
|
59
51
|
export { getMask, mergeMask, useStringMask } from './hooks/useStringMask.js';
|
|
60
52
|
export { SnackbarSonner } from './service/SnackbarSonner.js';
|
|
61
|
-
export { MenubarProvider
|
|
53
|
+
export { MenubarProvider } from './provider/MenubarProvider.js';
|
|
62
54
|
export { SnackbarProvider, useSnackbar } from './provider/SnackbarProvider.js';
|
|
55
|
+
export { MenubarContext } from './provider/MenubarContext.js';
|
|
56
|
+
export { useMenubar } from './provider/useMenubar.js';
|
|
63
57
|
export { BRLMask, CurrencyIMask, ExpressionMasks, Masks, NumberIMask, PercentageIMask, PercentageMask } from './components/Input/masks.js';
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
import React__default, {
|
|
1
|
+
import React__default, { useRef, useEffect } from 'react';
|
|
2
2
|
import '@internationalized/date';
|
|
3
3
|
import 'react-aria';
|
|
4
4
|
import 'react-stately';
|
|
5
5
|
import '@floating-ui/react';
|
|
6
6
|
import 'currency.js';
|
|
7
7
|
import { useOutsideClickListener } from '../hooks/useOutsideClickListener.js';
|
|
8
|
+
import { MenubarContext } from './MenubarContext.js';
|
|
8
9
|
|
|
9
|
-
const MenubarContext = createContext({
|
|
10
|
-
show: false,
|
|
11
|
-
setShow: () => void 0
|
|
12
|
-
});
|
|
13
10
|
const MenubarProvider = ({ children }) => {
|
|
14
11
|
const [show, setShow] = React__default.useState(false);
|
|
15
12
|
const ref = useRef(null);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const showRef = useRef(false);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
showRef.current = show;
|
|
16
|
+
}, [show]);
|
|
17
|
+
const onClickOutside = () => {
|
|
18
|
+
if (showRef.current === true) {
|
|
19
|
+
setShow(false);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
19
22
|
useOutsideClickListener({
|
|
20
23
|
ref,
|
|
21
24
|
onClickOutside
|
|
22
25
|
});
|
|
23
26
|
return /* @__PURE__ */ React__default.createElement(MenubarContext.Provider, { value: { show, setShow } }, /* @__PURE__ */ React__default.createElement("div", { ref }, children));
|
|
24
27
|
};
|
|
25
|
-
const useMenubar = () => {
|
|
26
|
-
const context = useContext(MenubarContext);
|
|
27
|
-
if (!context) {
|
|
28
|
-
throw new Error("useMenubar must be used within a MenubarProvider");
|
|
29
|
-
}
|
|
30
|
-
return [context.show, context.setShow];
|
|
31
|
-
};
|
|
32
28
|
|
|
33
|
-
export { MenubarProvider
|
|
29
|
+
export { MenubarProvider };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { MenubarContext } from './MenubarContext.js';
|
|
3
|
+
|
|
4
|
+
const useMenubar = () => {
|
|
5
|
+
const context = useContext(MenubarContext);
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error("useMenubar must be used within a MenubarProvider");
|
|
8
|
+
}
|
|
9
|
+
return [context.show, context.setShow];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { useMenubar };
|
|
@@ -2,10 +2,10 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const menubar = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-
|
|
5
|
+
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-sidebar",
|
|
6
6
|
left: "flex items-center w-fit",
|
|
7
7
|
right: "flex items-center gap-x-deca",
|
|
8
|
-
dropdown: "w-full bg-white flex-1 shadow-default z-
|
|
8
|
+
dropdown: "w-full bg-white flex-1 shadow-default z-popover px-[8vw] absolute"
|
|
9
9
|
},
|
|
10
10
|
variants: {
|
|
11
11
|
show: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DefaultProps } from './interface';
|
|
3
3
|
import { MostUsedItemProps } from './MostUsedItem';
|
|
4
|
-
|
|
4
|
+
interface MenuItem extends DefaultProps {
|
|
5
5
|
title: string;
|
|
6
6
|
items?: MenuItem[];
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
interface MenuCategory {
|
|
9
9
|
title: string;
|
|
10
10
|
items: MenuItem[];
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@floating-ui/react": "^0.26.18",
|
|
22
22
|
"@internationalized/date": "*",
|
|
23
|
-
"@tecsinapse/cortex-core": "0.3.3
|
|
23
|
+
"@tecsinapse/cortex-core": "0.3.3",
|
|
24
24
|
"clsx": "*",
|
|
25
25
|
"react-aria": "^3.33.1",
|
|
26
26
|
"react-icons": "^5.2.1",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"react-dom": ">=18.0.0",
|
|
46
46
|
"tailwind": ">=3.3.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "841b9e158cbd67b65b750cb8a61918e177772180"
|
|
49
49
|
}
|