@tecsinapse/cortex-react 1.3.0-beta.3 → 1.3.0-beta.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/Masonry.js +49 -0
- package/dist/cjs/components/Menubar/Categories.js +10 -0
- package/dist/cjs/components/Menubar/Category.js +11 -0
- package/dist/cjs/components/Menubar/Dropdown.js +23 -0
- package/dist/cjs/components/Menubar/DropdownRoot.js +38 -0
- package/dist/cjs/components/Menubar/Header.js +26 -0
- package/dist/cjs/components/Menubar/IconControlSubItem.js +19 -0
- package/dist/cjs/components/Menubar/Item.js +22 -0
- package/dist/cjs/components/Menubar/ItemLink.js +18 -0
- package/dist/cjs/components/Menubar/Left.js +11 -0
- package/dist/cjs/components/Menubar/MostUsed.js +11 -0
- package/dist/cjs/components/Menubar/MostUsedItem.js +31 -0
- package/dist/cjs/components/Menubar/MostUsedList.js +58 -0
- package/dist/cjs/components/Menubar/Right.js +11 -0
- package/dist/cjs/components/Menubar/Root.js +11 -0
- package/dist/cjs/components/Menubar/Search.js +21 -0
- package/dist/cjs/components/Menubar/SubItem.js +20 -0
- package/dist/cjs/components/Menubar/index.js +33 -0
- package/dist/cjs/components/Popover/{PopoverContent.js → Content.js} +8 -5
- package/dist/cjs/components/Popover/Context.js +15 -0
- package/dist/cjs/components/Popover/Provider.js +19 -0
- package/dist/cjs/components/Popover/Root.js +14 -0
- package/dist/cjs/components/Popover/Trigger.js +11 -0
- package/dist/cjs/components/Popover/index.js +15 -0
- package/dist/cjs/components/Select/Content.js +26 -0
- package/dist/cjs/components/Select/GroupedOptions.js +4 -2
- package/dist/cjs/components/Select/Options.js +5 -3
- package/dist/cjs/components/Select/Popover.js +2 -5
- package/dist/cjs/components/Select/Root.js +9 -17
- package/dist/cjs/components/Select/Trigger.js +4 -4
- package/dist/cjs/hooks/useOutsideClickListener.js +3 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/provider/MenubarProvider.js +22 -0
- package/dist/cjs/provider/SnackbarProvider.js +51 -0
- package/dist/cjs/service/SnackbarSonner.js +12 -2
- package/dist/cjs/styles/menubar.js +62 -0
- package/dist/esm/components/Masonry.js +47 -0
- package/dist/esm/components/Menubar/Categories.js +8 -0
- package/dist/esm/components/Menubar/Category.js +9 -0
- package/dist/esm/components/Menubar/Dropdown.js +21 -0
- package/dist/esm/components/Menubar/DropdownRoot.js +36 -0
- package/dist/esm/components/Menubar/Header.js +24 -0
- package/dist/esm/components/Menubar/IconControlSubItem.js +17 -0
- package/dist/esm/components/Menubar/Item.js +20 -0
- package/dist/esm/components/Menubar/ItemLink.js +16 -0
- package/dist/esm/components/Menubar/Left.js +9 -0
- package/dist/esm/components/Menubar/MostUsed.js +9 -0
- package/dist/esm/components/Menubar/MostUsedItem.js +29 -0
- package/dist/esm/components/Menubar/MostUsedList.js +56 -0
- package/dist/esm/components/Menubar/Right.js +9 -0
- package/dist/esm/components/Menubar/Root.js +9 -0
- package/dist/esm/components/Menubar/Search.js +19 -0
- package/dist/esm/components/Menubar/SubItem.js +18 -0
- package/dist/esm/components/Menubar/index.js +31 -0
- package/dist/esm/components/Popover/{PopoverContent.js → Content.js} +7 -4
- package/dist/esm/components/Popover/Context.js +12 -0
- package/dist/esm/components/Popover/Provider.js +17 -0
- package/dist/esm/components/Popover/Root.js +12 -0
- package/dist/esm/components/Popover/{PopoverTrigger.js → Trigger.js} +2 -2
- package/dist/esm/components/Popover/index.js +13 -0
- package/dist/esm/components/Select/Content.js +24 -0
- package/dist/esm/components/Select/GroupedOptions.js +4 -2
- package/dist/esm/components/Select/Options.js +5 -3
- package/dist/esm/components/Select/Popover.js +3 -6
- package/dist/esm/components/Select/Root.js +10 -18
- package/dist/esm/components/Select/Trigger.js +4 -4
- package/dist/esm/hooks/useOutsideClickListener.js +3 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/provider/MenubarProvider.js +19 -0
- package/dist/esm/provider/SnackbarProvider.js +49 -0
- package/dist/esm/service/SnackbarSonner.js +12 -2
- package/dist/esm/styles/menubar.js +54 -0
- package/dist/types/components/Card.d.ts +3 -4
- package/dist/types/components/Masonry.d.ts +7 -0
- package/dist/types/components/Menubar/Categories.d.ts +3 -0
- package/dist/types/components/Menubar/Category.d.ts +8 -0
- package/dist/types/components/Menubar/Dropdown.d.ts +3 -0
- package/dist/types/components/Menubar/DropdownRoot.d.ts +17 -0
- package/dist/types/components/Menubar/Header.d.ts +6 -0
- package/dist/types/components/Menubar/IconControlSubItem.d.ts +6 -0
- package/dist/types/components/Menubar/Item.d.ts +10 -0
- package/dist/types/components/Menubar/ItemLink.d.ts +8 -0
- package/dist/types/components/Menubar/Left.d.ts +3 -0
- package/dist/types/components/Menubar/MostUsed.d.ts +8 -0
- package/dist/types/components/Menubar/MostUsedItem.d.ts +8 -0
- package/dist/types/components/Menubar/MostUsedList.d.ts +3 -0
- package/dist/types/components/Menubar/Right.d.ts +3 -0
- package/dist/types/components/Menubar/Root.d.ts +6 -0
- package/dist/types/components/Menubar/Search.d.ts +3 -0
- package/dist/types/components/Menubar/SubItem.d.ts +6 -0
- package/dist/types/components/Menubar/index.d.ts +15 -0
- package/dist/types/components/Menubar/interface.d.ts +4 -0
- package/dist/types/components/Popover/Content.d.ts +6 -0
- package/dist/types/components/Popover/{PopoverContext.d.ts → Context.d.ts} +5 -9
- package/dist/types/components/Popover/Provider.d.ts +8 -0
- package/dist/types/components/Popover/{PopoverRoot.d.ts → Root.d.ts} +1 -2
- package/dist/types/components/Popover/Trigger.d.ts +5 -0
- package/dist/types/components/Popover/index.d.ts +6 -3
- package/dist/types/components/SearchInput.d.ts +0 -0
- package/dist/types/components/Select/Content.d.ts +9 -0
- package/dist/types/components/Select/context.d.ts +0 -3
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/provider/MenubarProvider.d.ts +8 -0
- package/dist/types/provider/index.d.ts +2 -0
- package/dist/types/styles/menubar.d.ts +346 -0
- package/dist/types/tests/Menubar/Categories.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Category.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Dropdown.test.d.ts +1 -0
- package/dist/types/tests/Menubar/DropdownRoot.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Header.test.d.ts +1 -0
- package/dist/types/tests/Menubar/HeaderLeft.test.d.ts +1 -0
- package/dist/types/tests/Menubar/HeaderRigth.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Item.test.d.ts +1 -0
- package/dist/types/tests/Menubar/MostUsed.test.d.ts +1 -0
- package/dist/types/tests/Menubar/MostUsedItem.test.d.ts +1 -0
- package/dist/types/tests/Menubar/MostUsedList.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Root.test.d.ts +1 -0
- package/dist/types/tests/Menubar/SubItem.test.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/components/Popover/Popover.js +0 -13
- package/dist/cjs/components/Popover/PopoverContext.js +0 -29
- package/dist/cjs/components/Popover/PopoverRoot.js +0 -10
- package/dist/cjs/components/Popover/PopoverTrigger.js +0 -11
- package/dist/esm/components/Popover/Popover.js +0 -11
- package/dist/esm/components/Popover/PopoverContext.js +0 -26
- package/dist/esm/components/Popover/PopoverRoot.js +0 -8
- package/dist/types/components/Popover/Popover.d.ts +0 -5
- package/dist/types/components/Popover/PopoverContent.d.ts +0 -7
- package/dist/types/components/Popover/PopoverTrigger.d.ts +0 -6
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Root from './Root.js';
|
|
2
|
+
import Left from './Left.js';
|
|
3
|
+
import Search from './Search.js';
|
|
4
|
+
import Right from './Right.js';
|
|
5
|
+
import Dropdown from './Dropdown.js';
|
|
6
|
+
import MostUsed from './MostUsed.js';
|
|
7
|
+
import MostUsedItem from './MostUsedItem.js';
|
|
8
|
+
import Header from './Header.js';
|
|
9
|
+
import Category from './Category.js';
|
|
10
|
+
import Item from './Item.js';
|
|
11
|
+
import Categories from './Categories.js';
|
|
12
|
+
import SubItem from './SubItem.js';
|
|
13
|
+
import DropdownRoot from './DropdownRoot.js';
|
|
14
|
+
|
|
15
|
+
const Menubar = {
|
|
16
|
+
Root,
|
|
17
|
+
Header,
|
|
18
|
+
HeaderLeft: Left,
|
|
19
|
+
Search,
|
|
20
|
+
HeaderRight: Right,
|
|
21
|
+
Dropdown,
|
|
22
|
+
MostUsed,
|
|
23
|
+
MostUsedItem,
|
|
24
|
+
Category,
|
|
25
|
+
Categories,
|
|
26
|
+
Item,
|
|
27
|
+
SubItem,
|
|
28
|
+
DropdownRoot
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { Menubar };
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { usePopoverContext } from './
|
|
3
|
+
import { usePopoverContext } from './Context.js';
|
|
4
4
|
|
|
5
|
-
const PopoverContent = ({
|
|
5
|
+
const PopoverContent = ({
|
|
6
|
+
children,
|
|
7
|
+
className
|
|
8
|
+
}) => {
|
|
6
9
|
const { isOpen, x, y, strategy, floatingStyles, refs } = usePopoverContext();
|
|
7
10
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, isOpen ? /* @__PURE__ */ React.createElement(
|
|
8
11
|
"div",
|
|
9
12
|
{
|
|
10
13
|
ref: refs.setFloating,
|
|
11
14
|
className: clsx(
|
|
12
|
-
"border border-gray-200 bg-black
|
|
15
|
+
"border border-gray-200 bg-black p-4 rounded-md shadow-lg z-50",
|
|
13
16
|
className
|
|
14
17
|
),
|
|
15
18
|
style: {
|
|
@@ -23,4 +26,4 @@ const PopoverContent = ({ children, className }) => {
|
|
|
23
26
|
) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
export { PopoverContent
|
|
29
|
+
export { PopoverContent };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const Context = createContext(void 0);
|
|
4
|
+
const usePopoverContext = () => {
|
|
5
|
+
const context = useContext(Context);
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error("usePopoverContext must be used within a PopoverProvider");
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { Context, usePopoverContext };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@internationalized/date';
|
|
3
|
+
import 'react-aria';
|
|
4
|
+
import 'react-stately';
|
|
5
|
+
import { useFloatingLogic } from '../../hooks/useFloatingLogic.js';
|
|
6
|
+
import { Context } from './Context.js';
|
|
7
|
+
|
|
8
|
+
const PopoverProvider = ({
|
|
9
|
+
children,
|
|
10
|
+
placement,
|
|
11
|
+
trigger
|
|
12
|
+
}) => {
|
|
13
|
+
const floatingLogic = useFloatingLogic({ placement, trigger });
|
|
14
|
+
return /* @__PURE__ */ React.createElement(Context.Provider, { value: { ...floatingLogic } }, children);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { PopoverProvider };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popover } from './index.js';
|
|
3
|
+
|
|
4
|
+
const PopoverRoot = ({
|
|
5
|
+
children,
|
|
6
|
+
placement,
|
|
7
|
+
trigger
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ React.createElement(Popover.Provider, { placement, trigger }, children);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { PopoverRoot };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { usePopoverContext } from './
|
|
2
|
+
import { usePopoverContext } from './Context.js';
|
|
3
3
|
|
|
4
4
|
const PopoverTrigger = ({ children }) => {
|
|
5
5
|
const { triggerProps } = usePopoverContext();
|
|
6
6
|
return React.cloneElement(children, triggerProps);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export { PopoverTrigger
|
|
9
|
+
export { PopoverTrigger };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PopoverRoot } from './Root.js';
|
|
2
|
+
import { PopoverTrigger } from './Trigger.js';
|
|
3
|
+
import { PopoverContent } from './Content.js';
|
|
4
|
+
import { PopoverProvider } from './Provider.js';
|
|
5
|
+
|
|
6
|
+
const Popover = {
|
|
7
|
+
Root: PopoverRoot,
|
|
8
|
+
Trigger: PopoverTrigger,
|
|
9
|
+
Content: PopoverContent,
|
|
10
|
+
Provider: PopoverProvider
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { Popover };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@internationalized/date';
|
|
3
|
+
import 'react-aria';
|
|
4
|
+
import 'react-stately';
|
|
5
|
+
import { useOutsideClickListener } from '../../hooks/useOutsideClickListener.js';
|
|
6
|
+
import '@floating-ui/react';
|
|
7
|
+
import { SelectContext } from './context.js';
|
|
8
|
+
import { usePopoverContext } from '../Popover/Context.js';
|
|
9
|
+
|
|
10
|
+
const Content = ({
|
|
11
|
+
children,
|
|
12
|
+
keyExtractor,
|
|
13
|
+
labelExtractor,
|
|
14
|
+
value
|
|
15
|
+
}) => {
|
|
16
|
+
const { setIsOpen, refs } = usePopoverContext();
|
|
17
|
+
useOutsideClickListener({
|
|
18
|
+
ref: refs.domReference,
|
|
19
|
+
onClickOutside: () => setIsOpen(false)
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ React.createElement(SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white" }, children));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { Content as default };
|
|
@@ -2,6 +2,7 @@ import { selectVariants } from '@tecsinapse/cortex-core';
|
|
|
2
2
|
import React, { useContext, useCallback } from 'react';
|
|
3
3
|
import { Select } from './index.js';
|
|
4
4
|
import { SelectContext } from './context.js';
|
|
5
|
+
import { usePopoverContext } from '../Popover/Context.js';
|
|
5
6
|
|
|
6
7
|
const { groupedTitle, containerGrouped } = selectVariants();
|
|
7
8
|
const SelectGroupedOptions = ({
|
|
@@ -9,11 +10,12 @@ const SelectGroupedOptions = ({
|
|
|
9
10
|
groupedLabelExtractor,
|
|
10
11
|
options
|
|
11
12
|
}) => {
|
|
12
|
-
const {
|
|
13
|
+
const { keyExtractor } = useContext(SelectContext);
|
|
14
|
+
const { setIsOpen } = usePopoverContext();
|
|
13
15
|
const handleSelect = useCallback(
|
|
14
16
|
(option) => {
|
|
15
17
|
onSelect(option);
|
|
16
|
-
|
|
18
|
+
setIsOpen?.(false);
|
|
17
19
|
},
|
|
18
20
|
[onSelect]
|
|
19
21
|
);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import React, { useContext, useCallback } from 'react';
|
|
2
|
-
import { Select } from './index.js';
|
|
3
2
|
import { SelectContext } from './context.js';
|
|
3
|
+
import { Select } from './index.js';
|
|
4
|
+
import { usePopoverContext } from '../Popover/Context.js';
|
|
4
5
|
|
|
5
6
|
const SelectOptions = ({
|
|
6
7
|
onSelect,
|
|
7
8
|
options
|
|
8
9
|
}) => {
|
|
9
|
-
const {
|
|
10
|
+
const { keyExtractor } = useContext(SelectContext);
|
|
11
|
+
const { setIsOpen } = usePopoverContext();
|
|
10
12
|
const handleSelect = useCallback(
|
|
11
13
|
(option) => {
|
|
12
14
|
onSelect(option);
|
|
13
|
-
|
|
15
|
+
setIsOpen?.(false);
|
|
14
16
|
},
|
|
15
17
|
[onSelect]
|
|
16
18
|
);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { SelectContext } from './context.js';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popover } from '../Popover/index.js';
|
|
4
3
|
|
|
5
|
-
const { dropdown } = selectVariants();
|
|
6
4
|
const SelectPopover = ({ children }) => {
|
|
7
|
-
|
|
8
|
-
return /* @__PURE__ */ React.createElement("div", { className: dropdown({ open }), "data-testid": "select-popover" }, children);
|
|
5
|
+
return /* @__PURE__ */ React.createElement(Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll" }, children);
|
|
9
6
|
};
|
|
10
7
|
|
|
11
8
|
export { SelectPopover };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
4
|
-
import 'react-stately';
|
|
5
|
-
import { useOutsideClickListener } from '../../hooks/useOutsideClickListener.js';
|
|
6
|
-
import '@floating-ui/react';
|
|
7
|
-
import { SelectContext } from './context.js';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Content from './Content.js';
|
|
3
|
+
import { Popover } from '../Popover/index.js';
|
|
8
4
|
|
|
9
5
|
const SelectRoot = ({
|
|
10
6
|
children,
|
|
@@ -12,19 +8,15 @@ const SelectRoot = ({
|
|
|
12
8
|
keyExtractor,
|
|
13
9
|
labelExtractor
|
|
14
10
|
}) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
useOutsideClickListener({
|
|
18
|
-
ref,
|
|
19
|
-
onClickOutside: () => setOpen?.(false)
|
|
20
|
-
});
|
|
21
|
-
return /* @__PURE__ */ React.createElement(
|
|
22
|
-
SelectContext.Provider,
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Popover.Provider, null, /* @__PURE__ */ React.createElement(Popover.Root, { placement: "bottom", trigger: "click" }, /* @__PURE__ */ React.createElement(
|
|
12
|
+
Content,
|
|
23
13
|
{
|
|
24
|
-
|
|
14
|
+
keyExtractor,
|
|
15
|
+
labelExtractor,
|
|
16
|
+
value
|
|
25
17
|
},
|
|
26
|
-
|
|
27
|
-
);
|
|
18
|
+
children
|
|
19
|
+
)));
|
|
28
20
|
};
|
|
29
21
|
|
|
30
22
|
export { SelectRoot };
|
|
@@ -2,25 +2,25 @@ import { selectVariants } from '@tecsinapse/cortex-core';
|
|
|
2
2
|
import React, { useContext, useMemo } from 'react';
|
|
3
3
|
import { IoChevronDownOutline } from 'react-icons/io5';
|
|
4
4
|
import { SelectContext } from './context.js';
|
|
5
|
+
import { Popover } from '../Popover/index.js';
|
|
5
6
|
|
|
6
7
|
const { button } = selectVariants();
|
|
7
8
|
const SelectTrigger = ({ label, disabled }) => {
|
|
8
|
-
const { value,
|
|
9
|
+
const { value, labelExtractor } = useContext(SelectContext);
|
|
9
10
|
const placeholder = useMemo(
|
|
10
11
|
() => value ? labelExtractor(value) : label,
|
|
11
12
|
[label, value]
|
|
12
13
|
);
|
|
13
|
-
return /* @__PURE__ */ React.createElement(
|
|
14
|
+
return /* @__PURE__ */ React.createElement(Popover.Trigger, null, /* @__PURE__ */ React.createElement(
|
|
14
15
|
"button",
|
|
15
16
|
{
|
|
16
17
|
className: button({ disabled }),
|
|
17
|
-
onClick: () => setOpen?.(!open),
|
|
18
18
|
disabled,
|
|
19
19
|
role: "button"
|
|
20
20
|
},
|
|
21
21
|
/* @__PURE__ */ React.createElement("span", { "data-testid": "select-placeholder" }, placeholder),
|
|
22
22
|
/* @__PURE__ */ React.createElement(IoChevronDownOutline, null)
|
|
23
|
-
);
|
|
23
|
+
));
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export { SelectTrigger };
|
|
@@ -6,7 +6,9 @@ const useOutsideClickListener = ({
|
|
|
6
6
|
}) => {
|
|
7
7
|
const handleClickOutside = useCallback((event) => {
|
|
8
8
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
9
|
-
|
|
9
|
+
setTimeout(() => {
|
|
10
|
+
onClickOutside?.();
|
|
11
|
+
}, 10);
|
|
10
12
|
}
|
|
11
13
|
}, []);
|
|
12
14
|
useEffect(() => {
|
package/dist/esm/index.js
CHANGED
|
@@ -23,7 +23,8 @@ export { TextArea } from './components/TextArea.js';
|
|
|
23
23
|
export { TimeFieldInput } from './components/TimeFieldInput.js';
|
|
24
24
|
export { Toggle } from './components/Toggle.js';
|
|
25
25
|
import './components/Tooltip.js';
|
|
26
|
-
export { Popover } from './components/Popover/
|
|
26
|
+
export { Popover } from './components/Popover/index.js';
|
|
27
|
+
export { Menubar } from './components/Menubar/index.js';
|
|
27
28
|
export { useCalendar } from './hooks/useCalendar.js';
|
|
28
29
|
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
29
30
|
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const MenubarContext = createContext({
|
|
4
|
+
show: false,
|
|
5
|
+
setShow: () => void 0
|
|
6
|
+
});
|
|
7
|
+
const MenubarProvider = ({ children }) => {
|
|
8
|
+
const [show, setShow] = React.useState(false);
|
|
9
|
+
return /* @__PURE__ */ React.createElement(MenubarContext.Provider, { value: { show, setShow } }, children);
|
|
10
|
+
};
|
|
11
|
+
const useMenubar = () => {
|
|
12
|
+
const context = useContext(MenubarContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
15
|
+
}
|
|
16
|
+
return [context.show, context.setShow];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { MenubarProvider, useMenubar };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import 'sonner';
|
|
3
|
+
import 'clsx';
|
|
4
|
+
import '@internationalized/date';
|
|
5
|
+
import '../components/Badge.js';
|
|
6
|
+
import '../components/BaseSnackbar.js';
|
|
7
|
+
import 'react-icons/md';
|
|
8
|
+
import '../components/Card.js';
|
|
9
|
+
import '../components/Button.js';
|
|
10
|
+
import 'react-aria';
|
|
11
|
+
import 'react-stately';
|
|
12
|
+
import '@floating-ui/react';
|
|
13
|
+
import '../components/CalendarCell.js';
|
|
14
|
+
import '@tecsinapse/cortex-core';
|
|
15
|
+
import 'react-icons/fa';
|
|
16
|
+
import 'react-icons/lia';
|
|
17
|
+
import '../components/Input/Box.js';
|
|
18
|
+
import '../components/Input/Face.js';
|
|
19
|
+
import '../components/Input/Left.js';
|
|
20
|
+
import '../components/Input/Right.js';
|
|
21
|
+
import '../components/Input/Root.js';
|
|
22
|
+
import '../components/Input/Search.js';
|
|
23
|
+
import 'react-icons/io';
|
|
24
|
+
import '../components/GroupButton.js';
|
|
25
|
+
import '../components/Hint.js';
|
|
26
|
+
import '../components/Modal.js';
|
|
27
|
+
import '../styles/calendar-cell.js';
|
|
28
|
+
import '../styles/groupButton.js';
|
|
29
|
+
import '../styles/progressBar.js';
|
|
30
|
+
import '../components/Select/GroupedOptions.js';
|
|
31
|
+
import '../components/Select/context.js';
|
|
32
|
+
import '../components/Popover/Context.js';
|
|
33
|
+
import '../components/Select/Trigger.js';
|
|
34
|
+
import '../components/Tag.js';
|
|
35
|
+
import '../components/TextArea.js';
|
|
36
|
+
import '../components/Toggle.js';
|
|
37
|
+
import '../components/Tooltip.js';
|
|
38
|
+
import './MenubarProvider.js';
|
|
39
|
+
import '../components/Menubar/Left.js';
|
|
40
|
+
import '../styles/menubar.js';
|
|
41
|
+
import '../components/Menubar/Right.js';
|
|
42
|
+
import '../components/Menubar/Dropdown.js';
|
|
43
|
+
import '../components/Menubar/MostUsed.js';
|
|
44
|
+
import '../components/Menubar/MostUsedItem.js';
|
|
45
|
+
import '../components/Menubar/Header.js';
|
|
46
|
+
import '../components/Menubar/Item.js';
|
|
47
|
+
import '../components/Menubar/SubItem.js';
|
|
48
|
+
|
|
49
|
+
createContext(null);
|
|
@@ -29,13 +29,23 @@ import '../styles/groupButton.js';
|
|
|
29
29
|
import '../styles/progressBar.js';
|
|
30
30
|
import '../components/Select/GroupedOptions.js';
|
|
31
31
|
import '../components/Select/context.js';
|
|
32
|
-
import '../components/
|
|
32
|
+
import '../components/Popover/Context.js';
|
|
33
33
|
import '../components/Select/Trigger.js';
|
|
34
34
|
import '../components/Tag.js';
|
|
35
35
|
import '../components/TextArea.js';
|
|
36
36
|
import '../components/Toggle.js';
|
|
37
37
|
import '../components/Tooltip.js';
|
|
38
|
-
import '../
|
|
38
|
+
import '../provider/MenubarProvider.js';
|
|
39
|
+
import '../provider/SnackbarProvider.js';
|
|
40
|
+
import '../components/Menubar/Left.js';
|
|
41
|
+
import '../styles/menubar.js';
|
|
42
|
+
import '../components/Menubar/Right.js';
|
|
43
|
+
import '../components/Menubar/Dropdown.js';
|
|
44
|
+
import '../components/Menubar/MostUsed.js';
|
|
45
|
+
import '../components/Menubar/MostUsedItem.js';
|
|
46
|
+
import '../components/Menubar/Header.js';
|
|
47
|
+
import '../components/Menubar/Item.js';
|
|
48
|
+
import '../components/Menubar/SubItem.js';
|
|
39
49
|
|
|
40
50
|
class SnackbarSonner {
|
|
41
51
|
custom(Component, options) {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
const menubar = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
root: "w-screen px-kilo py-deca flex flex-row justify-between bg-white z-[100]",
|
|
6
|
+
left: "flex items-center w-fit",
|
|
7
|
+
right: "flex items-center gap-x-deca",
|
|
8
|
+
dropdown: "w-full bg-white flex-1 pt-kilo pb-mega shadow-default px-[8vw] z-[100]"
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const mostUsed = tv({
|
|
12
|
+
slots: {
|
|
13
|
+
container: "mb-kilo",
|
|
14
|
+
label: "font-bold mb-centi",
|
|
15
|
+
containerList: "gap-x-kilo flex flex-row"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const mostUsedItem = tv({
|
|
19
|
+
slots: {
|
|
20
|
+
container: "flex-1 py-mili",
|
|
21
|
+
title: "text-primary-medium font-bold",
|
|
22
|
+
category: "text-secondary-medium"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const item = tv({
|
|
26
|
+
slots: {
|
|
27
|
+
container: "flex flex-row gap-x-deca items-center",
|
|
28
|
+
text: "text-secondary-dark hover:text-primary-medium hover:cursor-pointer text-base",
|
|
29
|
+
icon: "text-primary-medium hover:cursor-pointer"
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const category = tv({
|
|
33
|
+
slots: {
|
|
34
|
+
text: "mb-mili font-bold",
|
|
35
|
+
hr: "mb-mili",
|
|
36
|
+
container: "flex flex-col gap-y-mili"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const subItem = tv({
|
|
40
|
+
slots: {
|
|
41
|
+
container: "pl-deca text-sub border-l-[1px] border-primary-medium text-secondary-dark hover:text-primary-medium cursor-pointer"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const animate = tv({
|
|
45
|
+
base: "transition-all ease-in-out duration-250",
|
|
46
|
+
variants: {
|
|
47
|
+
show: {
|
|
48
|
+
true: "translate-y-0 opacity-1 visible",
|
|
49
|
+
false: "-translate-y-[120%] opacity-0 invisible"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export { animate, category, item, menubar, mostUsed, mostUsedItem, subItem };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface CardProps {
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
-
export declare const Card: React.ForwardRefExoticComponent<
|
|
6
|
-
export {};
|
|
5
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MostUsedItemProps } from './MostUsedItem';
|
|
2
|
+
import { DefaultProps } from './interface';
|
|
3
|
+
interface MenuItem extends DefaultProps {
|
|
4
|
+
title: string;
|
|
5
|
+
items?: MenuItem[];
|
|
6
|
+
}
|
|
7
|
+
interface MenuCategory {
|
|
8
|
+
title: string;
|
|
9
|
+
items: MenuItem[];
|
|
10
|
+
}
|
|
11
|
+
export interface DropdownRootProps {
|
|
12
|
+
labelMostUsed?: string;
|
|
13
|
+
mostUsed?: MostUsedItemProps[];
|
|
14
|
+
options: MenuCategory[];
|
|
15
|
+
}
|
|
16
|
+
declare const DropdownRoot: ({ mostUsed, options, labelMostUsed, }: DropdownRootProps) => JSX.Element;
|
|
17
|
+
export default DropdownRoot;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DefaultProps } from './interface';
|
|
3
|
+
export interface ItemProps<T> extends DefaultProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
subItems?: T[];
|
|
6
|
+
renderSubItems?: (prop: T) => React.ReactNode;
|
|
7
|
+
href?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Item: <T>({ children, subItems, renderSubItems, className, href, ...rest }: ItemProps<T>) => JSX.Element;
|
|
10
|
+
export default Item;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DefaultProps } from './interface';
|
|
3
|
+
export interface MostUsedProps extends DefaultProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const MostUsed: ({ label, children, ...rest }: MostUsedProps) => JSX.Element;
|
|
8
|
+
export default MostUsed;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CardProps } from '../Card';
|
|
2
|
+
export interface MostUsedItemProps extends CardProps {
|
|
3
|
+
title: string;
|
|
4
|
+
category: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const MostUsedItem: ({ title, category, href, ...rest }: MostUsedItemProps) => JSX.Element;
|
|
8
|
+
export default MostUsedItem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const Menubar: {
|
|
2
|
+
Root: ({ children, ...rest }: import("./Root").RootProps) => JSX.Element;
|
|
3
|
+
Header: ({ children, className, ...rest }: import("./Header").HeaderProps) => JSX.Element;
|
|
4
|
+
HeaderLeft: ({ children, ...rest }: import("./interface").DefaultProps) => JSX.Element;
|
|
5
|
+
Search: (props: import("..").InputSearchProps) => JSX.Element;
|
|
6
|
+
HeaderRight: ({ children, ...rest }: import("./interface").DefaultProps) => JSX.Element;
|
|
7
|
+
Dropdown: ({ children, ...rest }: import("./interface").DefaultProps) => JSX.Element;
|
|
8
|
+
MostUsed: ({ label, children, ...rest }: import("./MostUsed").MostUsedProps) => JSX.Element;
|
|
9
|
+
MostUsedItem: ({ title, category, href, ...rest }: import("./MostUsedItem").MostUsedItemProps) => JSX.Element;
|
|
10
|
+
Category: <T>({ title, options, render }: import("./Category").CategoryType<T>) => JSX.Element;
|
|
11
|
+
Categories: ({ children }: import("./interface").DefaultProps) => JSX.Element;
|
|
12
|
+
Item: <T_1>({ children, subItems, renderSubItems, className, href, ...rest }: import("./Item").ItemProps<T_1>) => JSX.Element;
|
|
13
|
+
SubItem: ({ children, href, className, ...rest }: import("./SubItem").SubItemProps) => JSX.Element;
|
|
14
|
+
DropdownRoot: ({ mostUsed, options, labelMostUsed, }: import("./DropdownRoot").DropdownRootProps) => JSX.Element;
|
|
15
|
+
};
|