@tecsinapse/cortex-react 1.3.0-beta.2 → 1.3.0-beta.20
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/Calendar.js +1 -0
- package/dist/cjs/components/CalendarCell.js +1 -0
- package/dist/cjs/components/CalendarGrid.js +1 -0
- package/dist/cjs/components/DatePickerInput.js +1 -0
- package/dist/cjs/components/DatePickerInputBase.js +2 -2
- package/dist/cjs/components/DateRangePickerInput.js +1 -0
- package/dist/cjs/components/Divider.js +10 -0
- package/dist/cjs/components/Input/Box.js +32 -0
- package/dist/cjs/components/Input/Face.js +30 -0
- package/dist/cjs/components/Input/Left.js +12 -0
- package/dist/cjs/components/Input/Mask.js +53 -0
- package/dist/cjs/components/Input/Right.js +12 -0
- package/dist/cjs/components/Input/Root.js +13 -0
- package/dist/cjs/components/Input/Search.js +25 -0
- package/dist/cjs/components/Input/index.js +23 -0
- 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 +25 -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 +63 -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/Content.js +31 -0
- 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/RadioButton.js +22 -0
- package/dist/cjs/components/RangeCalendar.js +1 -0
- package/dist/cjs/components/Select/Content.js +21 -0
- package/dist/cjs/components/Select/GroupedOptions.js +7 -4
- package/dist/cjs/components/Select/MultiCheckAllOptions.js +47 -0
- package/dist/cjs/components/Select/MultiGroupedOptions.js +44 -0
- package/dist/cjs/components/Select/MultiOption.js +43 -0
- package/dist/cjs/components/Select/MultiOptions.js +26 -0
- package/dist/cjs/components/Select/Option.js +4 -2
- package/dist/cjs/components/Select/Options.js +7 -3
- package/dist/cjs/components/Select/Popover.js +2 -5
- package/dist/cjs/components/Select/Root.js +3 -17
- package/dist/cjs/components/Select/Trigger.js +10 -8
- package/dist/cjs/components/Select/context.js +4 -0
- package/dist/cjs/components/Select/index.js +9 -1
- package/dist/cjs/components/Select/utils.js +16 -0
- package/dist/cjs/components/TimeFieldInput.js +2 -2
- package/dist/cjs/components/Tooltip.js +55 -0
- package/dist/cjs/components/utils.js +5 -0
- package/dist/cjs/hooks/useFloatingLogic.js +53 -0
- package/dist/cjs/index.js +30 -27
- package/dist/cjs/provider/MenubarProvider.js +22 -0
- package/dist/cjs/provider/SnackbarProvider.js +56 -0
- package/dist/cjs/service/SnackbarSonner.js +25 -5
- package/dist/cjs/styles/menubar.js +70 -0
- package/dist/esm/components/Calendar.js +1 -0
- package/dist/esm/components/CalendarCell.js +1 -0
- package/dist/esm/components/CalendarGrid.js +1 -0
- package/dist/esm/components/DatePickerInput.js +1 -0
- package/dist/esm/components/DatePickerInputBase.js +1 -1
- package/dist/esm/components/DateRangePickerInput.js +1 -0
- package/dist/esm/components/Divider.js +8 -0
- package/dist/esm/components/Input/Box.js +30 -0
- package/dist/esm/components/Input/Face.js +28 -0
- package/dist/esm/components/Input/Left.js +10 -0
- package/dist/esm/components/Input/Mask.js +49 -0
- package/dist/esm/components/Input/Right.js +10 -0
- package/dist/esm/components/Input/Root.js +11 -0
- package/dist/esm/components/Input/Search.js +23 -0
- package/dist/esm/components/Input/index.js +21 -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 +23 -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 +61 -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/Content.js +29 -0
- 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/Trigger.js +9 -0
- package/dist/esm/components/Popover/index.js +13 -0
- package/dist/esm/components/RadioButton.js +20 -0
- package/dist/esm/components/RangeCalendar.js +1 -0
- package/dist/esm/components/Select/Content.js +19 -0
- package/dist/esm/components/Select/GroupedOptions.js +7 -4
- package/dist/esm/components/Select/MultiCheckAllOptions.js +45 -0
- package/dist/esm/components/Select/MultiGroupedOptions.js +42 -0
- package/dist/esm/components/Select/MultiOption.js +41 -0
- package/dist/esm/components/Select/MultiOptions.js +24 -0
- package/dist/esm/components/Select/Option.js +4 -2
- package/dist/esm/components/Select/Options.js +7 -3
- package/dist/esm/components/Select/Popover.js +3 -6
- package/dist/esm/components/Select/Root.js +4 -18
- package/dist/esm/components/Select/Trigger.js +10 -8
- package/dist/esm/components/Select/context.js +4 -1
- package/dist/esm/components/Select/index.js +9 -1
- package/dist/esm/components/Select/utils.js +14 -0
- package/dist/esm/components/TimeFieldInput.js +1 -1
- package/dist/esm/components/Tooltip.js +50 -0
- package/dist/esm/components/utils.js +5 -1
- package/dist/esm/hooks/useFloatingLogic.js +51 -0
- package/dist/esm/index.js +14 -12
- package/dist/esm/provider/MenubarProvider.js +19 -0
- package/dist/esm/provider/SnackbarProvider.js +54 -0
- package/dist/esm/service/SnackbarSonner.js +25 -5
- package/dist/esm/styles/menubar.js +62 -0
- package/dist/types/components/Card.d.ts +3 -4
- package/dist/types/components/Divider.d.ts +5 -0
- package/dist/types/components/Input/Box.d.ts +3 -0
- package/dist/types/components/Input/Face.d.ts +3 -0
- package/dist/types/components/Input/Left.d.ts +3 -0
- package/dist/types/components/Input/Mask.d.ts +5 -0
- package/dist/types/components/Input/Right.d.ts +3 -0
- package/dist/types/components/Input/Root.d.ts +3 -0
- package/dist/types/components/Input/Search.d.ts +3 -0
- package/dist/types/components/Input/index.d.ts +12 -0
- package/dist/types/components/Input/types.d.ts +27 -0
- 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/Context.d.ts +18 -0
- package/dist/types/components/Popover/Provider.d.ts +8 -0
- package/dist/types/components/Popover/Root.d.ts +8 -0
- package/dist/types/components/Popover/Trigger.d.ts +5 -0
- package/dist/types/components/Popover/index.d.ts +6 -0
- package/dist/types/components/RadioButton.d.ts +6 -0
- package/dist/types/components/SearchInput.d.ts +0 -11
- package/dist/types/components/Select/Content.d.ts +6 -0
- package/dist/types/components/Select/MultiCheckAllOptions.d.ts +4 -0
- package/dist/types/components/Select/MultiGroupedOptions.d.ts +8 -0
- package/dist/types/components/Select/MultiOption.d.ts +6 -0
- package/dist/types/components/Select/MultiOptions.d.ts +7 -0
- package/dist/types/components/Select/Option.d.ts +2 -1
- package/dist/types/components/Select/Root.d.ts +1 -1
- package/dist/types/components/Select/context.d.ts +6 -4
- package/dist/types/components/Select/index.d.ts +5 -1
- package/dist/types/components/Select/utils.d.ts +1 -0
- package/dist/types/components/Tooltip.d.ts +13 -0
- package/dist/types/components/index.d.ts +5 -1
- package/dist/types/components/utils.d.ts +2 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useFloatingLogic.d.ts +46 -0
- 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 +350 -0
- package/dist/types/tests/Input/Face.test.d.ts +1 -0
- package/dist/types/tests/Input/Left.test.d.ts +1 -0
- package/dist/types/tests/Input/Mask.test.d.ts +1 -0
- package/dist/types/tests/Input/Right.test.d.ts +1 -0
- package/dist/types/tests/Input/Root.test.d.ts +1 -0
- package/dist/types/tests/Input/Search.test.d.ts +1 -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/dist/types/tests/Popover.test.d.ts +1 -0
- package/dist/types/tests/RadioButton.test.d.ts +1 -0
- package/dist/types/tests/Tooltip.test.d.ts +1 -0
- package/package.json +5 -3
- package/dist/cjs/components/Input.js +0 -81
- package/dist/esm/components/Input.js +0 -74
- package/dist/types/components/Input.d.ts +0 -34
- /package/dist/types/tests/{Input.test.d.ts → Divider.test.d.ts} +0 -0
- /package/dist/types/tests/{SearchInput.test.d.ts → Input/Box.test.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InputBox } from './Box.js';
|
|
2
|
+
import { InputFace } from './Face.js';
|
|
3
|
+
import { InputLeft } from './Left.js';
|
|
4
|
+
import { InputMaskCurrency, InputMaskNumber, InputMaskExpression } from './Mask.js';
|
|
5
|
+
import { InputRight } from './Right.js';
|
|
6
|
+
import { InputRoot } from './Root.js';
|
|
7
|
+
import { InputSearch } from './Search.js';
|
|
8
|
+
|
|
9
|
+
const Input = {
|
|
10
|
+
Root: InputRoot,
|
|
11
|
+
Face: InputFace,
|
|
12
|
+
Box: InputBox,
|
|
13
|
+
Left: InputLeft,
|
|
14
|
+
Right: InputRight,
|
|
15
|
+
Search: InputSearch,
|
|
16
|
+
MaskCurrency: InputMaskCurrency,
|
|
17
|
+
MaskNumber: InputMaskNumber,
|
|
18
|
+
MaskExpression: InputMaskExpression
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { Input };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
const Masonry = ({ children, columns }) => {
|
|
5
|
+
const getColumns = () => {
|
|
6
|
+
const columnsArray = Array.from(
|
|
7
|
+
{ length: columns },
|
|
8
|
+
() => []
|
|
9
|
+
);
|
|
10
|
+
React.Children.forEach(children, (child, index) => {
|
|
11
|
+
if (child && React.isValidElement(child)) {
|
|
12
|
+
columnsArray[index % columns].push(child);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return columnsArray;
|
|
16
|
+
};
|
|
17
|
+
const renderColumn = (column) => {
|
|
18
|
+
return column.map((item, index) => {
|
|
19
|
+
return /* @__PURE__ */ React.createElement("div", { className: index > 0 ? "mt-deca" : "mt-0", key: index }, item);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const renderColumns = () => {
|
|
23
|
+
return getColumns().map((column, index) => {
|
|
24
|
+
return /* @__PURE__ */ React.createElement(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: clsx(
|
|
28
|
+
"width-0 flex flex-1 flex-col content-start",
|
|
29
|
+
index > 0 ? "ml-deca" : "ml-0"
|
|
30
|
+
),
|
|
31
|
+
key: index
|
|
32
|
+
},
|
|
33
|
+
renderColumn(column)
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ React.createElement(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
"data-testid": "masonry",
|
|
41
|
+
className: "box-border flex w-full flex-row content-stretch justify-center"
|
|
42
|
+
},
|
|
43
|
+
renderColumns()
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { Masonry as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { category } from '../../styles/menubar.js';
|
|
3
|
+
|
|
4
|
+
const Category = ({ title, options, render }) => {
|
|
5
|
+
const { text, hr, container } = category();
|
|
6
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: text() }, title), /* @__PURE__ */ React.createElement("hr", { className: hr() }), /* @__PURE__ */ React.createElement("div", { className: container() }, options.map((i) => render(i))));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { Category as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { menubar, animate } from '../../styles/menubar.js';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useMenubar } from '../../provider/MenubarProvider.js';
|
|
5
|
+
import '../../provider/SnackbarProvider.js';
|
|
6
|
+
|
|
7
|
+
const { dropdown } = menubar();
|
|
8
|
+
const Dropdown = ({ children, ...rest }) => {
|
|
9
|
+
const [show] = useMenubar();
|
|
10
|
+
return /* @__PURE__ */ React.createElement(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
className: clsx(dropdown({ show }), animate({ show })),
|
|
14
|
+
"data-testid": "dropdown-menubar",
|
|
15
|
+
...rest
|
|
16
|
+
},
|
|
17
|
+
children
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { Dropdown as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Menubar } from './index.js';
|
|
3
|
+
import MostUsedList from './MostUsedList.js';
|
|
4
|
+
|
|
5
|
+
const DropdownRoot = ({
|
|
6
|
+
mostUsed,
|
|
7
|
+
options,
|
|
8
|
+
labelMostUsed
|
|
9
|
+
}) => {
|
|
10
|
+
const hasMostUsed = mostUsed && (mostUsed ?? []).length > 0;
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Menubar.Dropdown, null, hasMostUsed ? /* @__PURE__ */ React.createElement(Menubar.MostUsed, { label: labelMostUsed }, /* @__PURE__ */ React.createElement(MostUsedList, { mostUsed })) : /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement(Menubar.Categories, null, options.map((item, index) => /* @__PURE__ */ React.createElement(
|
|
12
|
+
Menubar.Category,
|
|
13
|
+
{
|
|
14
|
+
key: `${item.title}-${index}`,
|
|
15
|
+
title: item.title,
|
|
16
|
+
options: item.items,
|
|
17
|
+
render: (prop) => {
|
|
18
|
+
const { title, items, ...rest } = prop;
|
|
19
|
+
return /* @__PURE__ */ React.createElement(
|
|
20
|
+
Menubar.Item,
|
|
21
|
+
{
|
|
22
|
+
key: prop.title,
|
|
23
|
+
...rest,
|
|
24
|
+
subItems: items ?? [],
|
|
25
|
+
renderSubItems: ({ title: title2, ...rest2 }) => {
|
|
26
|
+
return /* @__PURE__ */ React.createElement(Menubar.SubItem, { key: title2, ...rest2 }, title2);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
title
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
))));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { DropdownRoot as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { menubar } from '../../styles/menubar.js';
|
|
3
|
+
import { Button } from '../Button.js';
|
|
4
|
+
import { IoMenu } from 'react-icons/io5';
|
|
5
|
+
import { useMenubar } from '../../provider/MenubarProvider.js';
|
|
6
|
+
import '../../provider/SnackbarProvider.js';
|
|
7
|
+
|
|
8
|
+
const { header } = menubar();
|
|
9
|
+
const Header = ({ children, className, ...rest }) => {
|
|
10
|
+
const [show, setShow] = useMenubar();
|
|
11
|
+
return /* @__PURE__ */ React.createElement(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: header({ className }),
|
|
15
|
+
"data-testid": "header-menubar",
|
|
16
|
+
...rest
|
|
17
|
+
},
|
|
18
|
+
/* @__PURE__ */ React.createElement(Button, { variants: { size: "square" }, onClick: () => setShow(!show) }, /* @__PURE__ */ React.createElement(IoMenu, { size: 16 })),
|
|
19
|
+
children
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { Header as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { item } from '../../styles/menubar.js';
|
|
3
|
+
import { IoCaretUpCircleOutline, IoCaretDownCircleOutline } from 'react-icons/io5';
|
|
4
|
+
|
|
5
|
+
const { icon } = item();
|
|
6
|
+
const IconControlSubItem = ({
|
|
7
|
+
show,
|
|
8
|
+
setShow
|
|
9
|
+
}) => {
|
|
10
|
+
const handleClick = (e) => {
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
setShow(!show);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ React.createElement("div", { onClick: handleClick, "data-testid": "icon-sub-item-menubar" }, show ? /* @__PURE__ */ React.createElement(IoCaretUpCircleOutline, { className: icon() }) : /* @__PURE__ */ React.createElement(IoCaretDownCircleOutline, { className: icon() }));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { IconControlSubItem as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import IconControlSubItem from './IconControlSubItem.js';
|
|
3
|
+
import { item } from '../../styles/menubar.js';
|
|
4
|
+
import ItemLink from './ItemLink.js';
|
|
5
|
+
|
|
6
|
+
const { container, text } = item();
|
|
7
|
+
const Item = ({
|
|
8
|
+
children,
|
|
9
|
+
subItems,
|
|
10
|
+
renderSubItems,
|
|
11
|
+
className,
|
|
12
|
+
href,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
const [showSubItem, setShowSubItem] = useState(false);
|
|
16
|
+
const hasSubItems = (subItems ?? []).length > 0;
|
|
17
|
+
return /* @__PURE__ */ React.createElement(ItemLink, { href }, /* @__PURE__ */ React.createElement("div", { "data-testid": "item-menubar", ...rest, className: container() }, /* @__PURE__ */ React.createElement("div", { className: text({ className }) }, children), hasSubItems ? /* @__PURE__ */ React.createElement(IconControlSubItem, { show: showSubItem, setShow: setShowSubItem }) : /* @__PURE__ */ React.createElement(React.Fragment, null)), showSubItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, subItems?.map((subItem) => renderSubItems?.(subItem))) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { Item as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const ItemLink = ({ href, children, classNameAnchor }) => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, href ? /* @__PURE__ */ React.createElement(
|
|
5
|
+
"a",
|
|
6
|
+
{
|
|
7
|
+
href,
|
|
8
|
+
target: "_blank",
|
|
9
|
+
rel: "noopener noreferrer",
|
|
10
|
+
className: classNameAnchor
|
|
11
|
+
},
|
|
12
|
+
children
|
|
13
|
+
) : children);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { ItemLink as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { menubar } from '../../styles/menubar.js';
|
|
3
|
+
|
|
4
|
+
const { left } = menubar();
|
|
5
|
+
const Left = ({ children, ...rest }) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement("div", { className: left(), "data-testid": "header-left-menubar", ...rest }, children);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { Left as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mostUsed } from '../../styles/menubar.js';
|
|
3
|
+
|
|
4
|
+
const { container, label: labelClass, containerList } = mostUsed();
|
|
5
|
+
const MostUsed = ({ label, children, ...rest }) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement("div", { className: container(), "data-testid": "most-used-menubar", ...rest }, /* @__PURE__ */ React.createElement("p", { className: labelClass() }, label), /* @__PURE__ */ React.createElement("div", { className: containerList() }, children));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { MostUsed as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mostUsedItem } from '../../styles/menubar.js';
|
|
3
|
+
import { Card } from '../Card.js';
|
|
4
|
+
import ItemLink from './ItemLink.js';
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
title: titleClass,
|
|
8
|
+
category: categoryClass,
|
|
9
|
+
container
|
|
10
|
+
} = mostUsedItem();
|
|
11
|
+
const MostUsedItem = ({
|
|
12
|
+
title,
|
|
13
|
+
category,
|
|
14
|
+
href,
|
|
15
|
+
...rest
|
|
16
|
+
}) => {
|
|
17
|
+
return /* @__PURE__ */ React.createElement(ItemLink, { href, classNameAnchor: "w-full" }, /* @__PURE__ */ React.createElement(
|
|
18
|
+
Card,
|
|
19
|
+
{
|
|
20
|
+
...rest,
|
|
21
|
+
"data-testid": "most-used-item-menubar",
|
|
22
|
+
className: container()
|
|
23
|
+
},
|
|
24
|
+
/* @__PURE__ */ React.createElement("p", { className: titleClass() }, title),
|
|
25
|
+
/* @__PURE__ */ React.createElement("p", { className: categoryClass() }, category)
|
|
26
|
+
));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { MostUsedItem as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import 'clsx';
|
|
3
|
+
import '@internationalized/date';
|
|
4
|
+
import '../Badge.js';
|
|
5
|
+
import '../BaseSnackbar.js';
|
|
6
|
+
import 'react-icons/md';
|
|
7
|
+
import '../Card.js';
|
|
8
|
+
import '../Button.js';
|
|
9
|
+
import 'react-aria';
|
|
10
|
+
import 'react-stately';
|
|
11
|
+
import '@floating-ui/react';
|
|
12
|
+
import '../CalendarCell.js';
|
|
13
|
+
import '@tecsinapse/cortex-core';
|
|
14
|
+
import 'react-icons/fa';
|
|
15
|
+
import 'react-icons/lia';
|
|
16
|
+
import '../Input/Box.js';
|
|
17
|
+
import '../Input/Face.js';
|
|
18
|
+
import '../Input/Left.js';
|
|
19
|
+
import '../Input/Mask.js';
|
|
20
|
+
import '../Input/Right.js';
|
|
21
|
+
import '../Input/Root.js';
|
|
22
|
+
import '../Input/Search.js';
|
|
23
|
+
import 'react-icons/io';
|
|
24
|
+
import '../GroupButton.js';
|
|
25
|
+
import '../Hint.js';
|
|
26
|
+
import { Menubar } from './index.js';
|
|
27
|
+
import '../Modal.js';
|
|
28
|
+
import '../Popover/Context.js';
|
|
29
|
+
import '../../styles/calendar-cell.js';
|
|
30
|
+
import '../../styles/groupButton.js';
|
|
31
|
+
import '../../styles/progressBar.js';
|
|
32
|
+
import '../RadioButton.js';
|
|
33
|
+
import '../Select/GroupedOptions.js';
|
|
34
|
+
import '../Select/context.js';
|
|
35
|
+
import '../Select/MultiGroupedOptions.js';
|
|
36
|
+
import '../Select/MultiOptions.js';
|
|
37
|
+
import '../Select/Options.js';
|
|
38
|
+
import '../Select/Trigger.js';
|
|
39
|
+
import '../Tag.js';
|
|
40
|
+
import '../TextArea.js';
|
|
41
|
+
import '../Toggle.js';
|
|
42
|
+
import '../Tooltip.js';
|
|
43
|
+
|
|
44
|
+
const MostUsedList = ({ mostUsed }) => {
|
|
45
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (mostUsed ?? []).map((item, index) => {
|
|
46
|
+
const { title, category, ...rest } = item;
|
|
47
|
+
if (index > 3)
|
|
48
|
+
return /* @__PURE__ */ React.createElement(Fragment, { key: `${title}-${category}` });
|
|
49
|
+
return /* @__PURE__ */ React.createElement(
|
|
50
|
+
Menubar.MostUsedItem,
|
|
51
|
+
{
|
|
52
|
+
key: `${title}-${category}`,
|
|
53
|
+
title,
|
|
54
|
+
category,
|
|
55
|
+
...rest
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { MostUsedList as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { menubar } from '../../styles/menubar.js';
|
|
3
|
+
|
|
4
|
+
const { right } = menubar();
|
|
5
|
+
const Right = ({ children, ...rest }) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement("div", { className: right(), "data-testid": "header-right-menubar", ...rest }, children);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { Right as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenubarProvider } from '../../provider/MenubarProvider.js';
|
|
3
|
+
import '../../provider/SnackbarProvider.js';
|
|
4
|
+
|
|
5
|
+
const Root = ({ children, ...rest }) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement(MenubarProvider, null, /* @__PURE__ */ React.createElement("div", { ...rest }, children));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { Root as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Input } from '../Input/index.js';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { animate } from '../../styles/menubar.js';
|
|
5
|
+
import { useMenubar } from '../../provider/MenubarProvider.js';
|
|
6
|
+
import '../../provider/SnackbarProvider.js';
|
|
7
|
+
|
|
8
|
+
const Search = (props) => {
|
|
9
|
+
const [show] = useMenubar();
|
|
10
|
+
return /* @__PURE__ */ React.createElement(
|
|
11
|
+
Input.Search,
|
|
12
|
+
{
|
|
13
|
+
...props,
|
|
14
|
+
className: clsx("mr-tera flex-1", animate({ show }))
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { Search as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { subItem } from '../../styles/menubar.js';
|
|
3
|
+
import ItemLink from './ItemLink.js';
|
|
4
|
+
|
|
5
|
+
const { container } = subItem();
|
|
6
|
+
const SubItem = ({ children, href, className, ...rest }) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(ItemLink, { href }, /* @__PURE__ */ React.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
...rest,
|
|
11
|
+
"data-testid": "sub-item-menubar",
|
|
12
|
+
className: container({ className })
|
|
13
|
+
},
|
|
14
|
+
children
|
|
15
|
+
));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { SubItem as default };
|
|
@@ -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 };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { usePopoverContext } from './Context.js';
|
|
4
|
+
|
|
5
|
+
const PopoverContent = ({
|
|
6
|
+
children,
|
|
7
|
+
className
|
|
8
|
+
}) => {
|
|
9
|
+
const { isOpen, x, y, strategy, floatingStyles, refs } = usePopoverContext();
|
|
10
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isOpen ? /* @__PURE__ */ React.createElement(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
ref: refs.setFloating,
|
|
14
|
+
className: clsx(
|
|
15
|
+
"border border-gray-200 bg-black p-[0px] rounded-md shadow-lg z-50",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
style: {
|
|
19
|
+
position: strategy,
|
|
20
|
+
top: y ?? 0,
|
|
21
|
+
left: x ?? 0,
|
|
22
|
+
...floatingStyles
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
children
|
|
26
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
27
|
+
};
|
|
28
|
+
|
|
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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { usePopoverContext } from './Context.js';
|
|
2
|
+
import { cloneWithProps } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
const PopoverTrigger = ({ children }) => {
|
|
5
|
+
const { triggerProps } = usePopoverContext();
|
|
6
|
+
return cloneWithProps(children, triggerProps);
|
|
7
|
+
};
|
|
8
|
+
|
|
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,20 @@
|
|
|
1
|
+
import { radioButtonStyles } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
const { container, input, label: labelStyle } = radioButtonStyles();
|
|
5
|
+
const RadioButton = forwardRef(
|
|
6
|
+
({ label, reversed, id, ...rest }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: container({ reversed }),
|
|
11
|
+
ref,
|
|
12
|
+
"data-testid": "radio-button-container"
|
|
13
|
+
},
|
|
14
|
+
/* @__PURE__ */ React.createElement("input", { id, type: "radio", className: input(), ...rest }),
|
|
15
|
+
label ? /* @__PURE__ */ React.createElement("label", { htmlFor: id, className: labelStyle() }, label) : /* @__PURE__ */ React.createElement(React.Fragment, null)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export { RadioButton };
|
|
@@ -3,6 +3,7 @@ import '@internationalized/date';
|
|
|
3
3
|
import 'react-aria';
|
|
4
4
|
import 'react-stately';
|
|
5
5
|
import { useRangeCalendar } from '../hooks/useRangeCalendar.js';
|
|
6
|
+
import '@floating-ui/react';
|
|
6
7
|
import { CalendarGrid } from './CalendarGrid.js';
|
|
7
8
|
import { CalendarHeader } from './CalendarHeader.js';
|
|
8
9
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { useRef } 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 { usePopoverContext } from '../Popover/Context.js';
|
|
8
|
+
|
|
9
|
+
const Content = ({ children }) => {
|
|
10
|
+
const { setIsOpen } = usePopoverContext();
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
useOutsideClickListener({
|
|
13
|
+
ref,
|
|
14
|
+
onClickOutside: () => setIsOpen(false)
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white", ref }, children);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { Content };
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
2
2
|
import React, { useContext, useCallback } from 'react';
|
|
3
3
|
import { Select } from './index.js';
|
|
4
|
+
import { usePopoverContext } from '../Popover/Context.js';
|
|
4
5
|
import { SelectContext } from './context.js';
|
|
5
6
|
|
|
6
|
-
const { groupedTitle,
|
|
7
|
+
const { groupedTitle, list } = selectVariants();
|
|
7
8
|
const SelectGroupedOptions = ({
|
|
8
9
|
onSelect,
|
|
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
|
);
|
|
20
|
-
return /* @__PURE__ */ React.createElement("ul", { role: "select", className:
|
|
22
|
+
return /* @__PURE__ */ React.createElement("ul", { role: "select", className: list() }, [...options ?? []].map(([key, value]) => /* @__PURE__ */ React.createElement("div", { key }, /* @__PURE__ */ React.createElement("span", { className: groupedTitle() }, groupedLabelExtractor?.(key)), value.map((option) => /* @__PURE__ */ React.createElement(
|
|
21
23
|
Select.Option,
|
|
22
24
|
{
|
|
25
|
+
grouped: true,
|
|
23
26
|
option,
|
|
24
27
|
key: keyExtractor(option),
|
|
25
28
|
onSelectOption: handleSelect
|