@tecsinapse/cortex-react 1.3.0-beta.0 → 1.3.0-beta.10
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 +2 -0
- package/dist/cjs/components/CalendarCell.js +1 -0
- package/dist/cjs/components/CalendarGrid.js +1 -0
- package/dist/cjs/components/DateField.js +25 -0
- package/dist/cjs/components/DatePickerInput.js +49 -0
- package/dist/cjs/components/DatePickerInputBase.js +24 -0
- package/dist/cjs/components/DateRangePickerInput.js +63 -0
- package/dist/cjs/components/DateSegment.js +9 -1
- 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/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 +19 -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 +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/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/RangeCalendar.js +25 -32
- package/dist/cjs/components/Select/Content.js +27 -0
- package/dist/cjs/components/Select/GroupedOptions.js +34 -0
- package/dist/cjs/components/Select/Option.js +25 -0
- package/dist/cjs/components/Select/Options.js +31 -0
- package/dist/cjs/components/Select/Popover.js +10 -0
- package/dist/cjs/components/Select/Root.js +24 -0
- package/dist/cjs/components/Select/Trigger.js +28 -0
- package/dist/cjs/components/Select/context.js +10 -0
- package/dist/cjs/components/Select/index.js +19 -0
- package/dist/cjs/components/Table.js +2 -2
- package/dist/cjs/components/TimeFieldInput.js +2 -2
- package/dist/cjs/components/Tooltip.js +54 -0
- package/dist/cjs/components/utils.js +14 -0
- package/dist/cjs/hooks/useCalendar.js +3 -6
- package/dist/cjs/hooks/useDatePickerInput.js +31 -0
- package/dist/cjs/hooks/useDateRangePickerInput.js +33 -0
- package/dist/cjs/hooks/useFloatingLogic.js +53 -0
- package/dist/cjs/hooks/useOutsideClickListener.js +22 -0
- package/dist/cjs/hooks/useRangeCalendar.js +36 -0
- package/dist/cjs/index.js +30 -13
- package/dist/cjs/provider/MenubarProvider.js +22 -0
- package/dist/cjs/provider/SnackbarProvider.js +51 -0
- package/dist/cjs/service/SnackbarSonner.js +25 -3
- package/dist/cjs/styles/calendar-cell.js +3 -3
- package/dist/cjs/styles/menubar.js +62 -0
- package/dist/esm/components/Calendar.js +2 -0
- package/dist/esm/components/CalendarCell.js +1 -0
- package/dist/esm/components/CalendarGrid.js +1 -0
- package/dist/esm/components/DateField.js +23 -0
- package/dist/esm/components/DatePickerInput.js +47 -0
- package/dist/esm/components/DatePickerInputBase.js +22 -0
- package/dist/esm/components/DateRangePickerInput.js +61 -0
- package/dist/esm/components/DateSegment.js +9 -1
- 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/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 +17 -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/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/RangeCalendar.js +25 -32
- package/dist/esm/components/Select/Content.js +25 -0
- package/dist/esm/components/Select/GroupedOptions.js +32 -0
- package/dist/esm/components/Select/Option.js +23 -0
- package/dist/esm/components/Select/Options.js +29 -0
- package/dist/esm/components/Select/Popover.js +8 -0
- package/dist/esm/components/Select/Root.js +22 -0
- package/dist/esm/components/Select/Trigger.js +26 -0
- package/dist/esm/components/Select/context.js +8 -0
- package/dist/esm/components/Select/index.js +17 -0
- package/dist/esm/components/Table.js +2 -2
- package/dist/esm/components/TimeFieldInput.js +1 -1
- package/dist/esm/components/Tooltip.js +49 -0
- package/dist/esm/components/utils.js +13 -1
- package/dist/esm/hooks/useCalendar.js +4 -7
- package/dist/esm/hooks/useDatePickerInput.js +29 -0
- package/dist/esm/hooks/useDateRangePickerInput.js +31 -0
- package/dist/esm/hooks/useFloatingLogic.js +51 -0
- package/dist/esm/hooks/useOutsideClickListener.js +20 -0
- package/dist/esm/hooks/useRangeCalendar.js +34 -0
- package/dist/esm/index.js +15 -4
- package/dist/esm/provider/MenubarProvider.js +19 -0
- package/dist/esm/provider/SnackbarProvider.js +49 -0
- package/dist/esm/service/SnackbarSonner.js +25 -3
- package/dist/esm/styles/calendar-cell.js +3 -3
- package/dist/esm/styles/menubar.js +54 -0
- package/dist/types/components/Calendar.d.ts +1 -1
- package/dist/types/components/Card.d.ts +3 -4
- package/dist/types/components/DateField.d.ts +5 -0
- package/dist/types/components/DatePickerInput.d.ts +6 -0
- package/dist/types/components/DatePickerInputBase.d.ts +8 -0
- package/dist/types/components/DateRangePickerInput.d.ts +7 -0
- 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/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 +9 -0
- package/dist/types/components/Input/types.d.ts +20 -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/RangeCalendar.d.ts +1 -1
- package/dist/types/components/SearchInput.d.ts +0 -10
- package/dist/types/components/Select/Content.d.ts +9 -0
- package/dist/types/components/Select/GroupedOptions.d.ts +6 -0
- package/dist/types/components/Select/Option.d.ts +5 -0
- package/dist/types/components/Select/Options.d.ts +5 -0
- package/dist/types/components/Select/Popover.d.ts +5 -0
- package/dist/types/components/Select/Root.d.ts +8 -0
- package/dist/types/components/Select/Trigger.d.ts +5 -0
- package/dist/types/components/Select/context.d.ts +7 -0
- package/dist/types/components/Select/index.d.ts +8 -0
- package/dist/types/components/Tooltip.d.ts +13 -0
- package/dist/types/components/index.d.ts +8 -2
- package/dist/types/components/utils.d.ts +3 -0
- package/dist/types/hooks/index.d.ts +5 -0
- package/dist/types/hooks/useCalendar.d.ts +1 -1
- package/dist/types/hooks/useDatePickerInput.d.ts +10 -0
- package/dist/types/hooks/useDateRangePickerInput.d.ts +12 -0
- package/dist/types/hooks/useFloatingLogic.d.ts +46 -0
- package/dist/types/hooks/useOutsideClickListener.d.ts +7 -0
- package/dist/types/hooks/useRangeCalendar.d.ts +12 -0
- package/dist/types/index.d.ts +1 -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/DatePickerInputBase.test.d.ts +1 -0
- package/dist/types/tests/DateRangePickerInput.test.d.ts +1 -0
- package/dist/types/tests/Divider.test.d.ts +1 -0
- package/dist/types/tests/Input/Box.test.d.ts +1 -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/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/RangeCalendar.test.d.ts +1 -0
- package/dist/types/tests/Tooltip.test.d.ts +1 -0
- package/dist/types/tests/useOutsideClickListener.test.d.ts +1 -0
- package/package.json +7 -4
- package/dist/cjs/components/Input.js +0 -81
- package/dist/cjs/components/SearchInput.js +0 -82
- package/dist/cjs/components/Select.js +0 -101
- package/dist/esm/components/Input.js +0 -74
- package/dist/esm/components/SearchInput.js +0 -80
- package/dist/esm/components/Select.js +0 -96
- package/dist/types/components/Input.d.ts +0 -34
- package/dist/types/components/Select.d.ts +0 -27
- /package/dist/types/tests/{Input.test.d.ts → DateField.test.d.ts} +0 -0
- /package/dist/types/tests/{SearchInput.test.d.ts → DatePickerInput.test.d.ts} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@internationalized/date';
|
|
3
|
+
import 'react-aria';
|
|
4
|
+
import 'react-stately';
|
|
5
|
+
import { dateToCalendarDate } from './utils.js';
|
|
6
|
+
import { useDateRangePickerInput } from '../hooks/useDateRangePickerInput.js';
|
|
7
|
+
import '@floating-ui/react';
|
|
8
|
+
import { DateField } from './DateField.js';
|
|
9
|
+
import { DatePickerInputBase } from './DatePickerInputBase.js';
|
|
10
|
+
import { RangeCalendar } from './RangeCalendar.js';
|
|
11
|
+
|
|
12
|
+
const DateRangePickerInput = (props) => {
|
|
13
|
+
const { onChange, value, label, variants } = props;
|
|
14
|
+
const { endFieldProps, startFieldProps, ref, state } = useDateRangePickerInput({ value, onChange });
|
|
15
|
+
return /* @__PURE__ */ React.createElement("div", { "data-testid": "date-range-picker-input" }, /* @__PURE__ */ React.createElement(
|
|
16
|
+
DatePickerInputBase,
|
|
17
|
+
{
|
|
18
|
+
onClickCalendar: () => state.isOpen ? state.close() : state.open(),
|
|
19
|
+
variants: {
|
|
20
|
+
...variants,
|
|
21
|
+
intent: state.isInvalid ? "error" : variants?.intent
|
|
22
|
+
},
|
|
23
|
+
label
|
|
24
|
+
},
|
|
25
|
+
/* @__PURE__ */ React.createElement("div", { ref, className: "flex flex-row gap-x-micro items-center" }, /* @__PURE__ */ React.createElement(
|
|
26
|
+
DateField,
|
|
27
|
+
{
|
|
28
|
+
...startFieldProps,
|
|
29
|
+
value: dateToCalendarDate(value?.start),
|
|
30
|
+
onChange: (value2) => {
|
|
31
|
+
state.setDate("start", value2);
|
|
32
|
+
state.close();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
), /* @__PURE__ */ React.createElement("span", null, "-"), /* @__PURE__ */ React.createElement(
|
|
36
|
+
DateField,
|
|
37
|
+
{
|
|
38
|
+
...endFieldProps,
|
|
39
|
+
value: dateToCalendarDate(value?.end),
|
|
40
|
+
onChange: (value2) => {
|
|
41
|
+
state.setDate("end", value2);
|
|
42
|
+
state.close();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
))
|
|
46
|
+
), state.isOpen ? /* @__PURE__ */ React.createElement("div", { className: "absolute" }, /* @__PURE__ */ React.createElement(
|
|
47
|
+
RangeCalendar,
|
|
48
|
+
{
|
|
49
|
+
value,
|
|
50
|
+
onChange: (value2) => {
|
|
51
|
+
state.setDateRange({
|
|
52
|
+
start: dateToCalendarDate(value2.start),
|
|
53
|
+
end: dateToCalendarDate(value2.end)
|
|
54
|
+
});
|
|
55
|
+
state.close();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
)) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { DateRangePickerInput };
|
|
@@ -4,7 +4,15 @@ import { useDateSegment } from 'react-aria';
|
|
|
4
4
|
const DateSegment = ({ segment, state }) => {
|
|
5
5
|
const ref = React.useRef(null);
|
|
6
6
|
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
7
|
-
return /* @__PURE__ */ React.createElement(
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
...segmentProps,
|
|
11
|
+
ref,
|
|
12
|
+
className: "focus:outline-none focus:bg-secondary-light"
|
|
13
|
+
},
|
|
14
|
+
segment.text
|
|
15
|
+
);
|
|
8
16
|
};
|
|
9
17
|
|
|
10
18
|
export { DateSegment };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { inputBox, labelStyle } from '@tecsinapse/cortex-core';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const InputBox = React.forwardRef(
|
|
6
|
+
({ id, name, variants, label, placeholder, className, ...rest }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-col" }, /* @__PURE__ */ React.createElement(
|
|
8
|
+
"input",
|
|
9
|
+
{
|
|
10
|
+
id: id ?? name,
|
|
11
|
+
name,
|
|
12
|
+
placeholder: placeholder ?? " ",
|
|
13
|
+
className: clsx(inputBox(placeholder, label, className)),
|
|
14
|
+
...rest,
|
|
15
|
+
ref,
|
|
16
|
+
"data-testid": "input-box"
|
|
17
|
+
}
|
|
18
|
+
), /* @__PURE__ */ React.createElement(
|
|
19
|
+
"label",
|
|
20
|
+
{
|
|
21
|
+
htmlFor: id ?? name,
|
|
22
|
+
className: labelStyle({ intent: variants?.intent, placeholder }),
|
|
23
|
+
"data-testid": "input-label"
|
|
24
|
+
},
|
|
25
|
+
label
|
|
26
|
+
));
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export { InputBox };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { input } from '@tecsinapse/cortex-core';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const getValidChildren = (children) => {
|
|
6
|
+
return React.Children.toArray(children).filter(
|
|
7
|
+
(el) => React.isValidElement(el)
|
|
8
|
+
);
|
|
9
|
+
};
|
|
10
|
+
const InputFace = React.forwardRef(
|
|
11
|
+
({ children, variants, className, ...rest }, ref) => {
|
|
12
|
+
const clones = getValidChildren(children).map((el) => {
|
|
13
|
+
return React.cloneElement(el, { ...el.props, variants });
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ React.createElement(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
"data-testid": "input-face",
|
|
19
|
+
...rest,
|
|
20
|
+
className: clsx(input(variants), className),
|
|
21
|
+
ref
|
|
22
|
+
},
|
|
23
|
+
clones
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export { InputFace };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
const InputLeft = React.forwardRef(
|
|
5
|
+
({ children, className, ...rest }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx(className, "mr-2.5"), ...rest, ref }, children);
|
|
7
|
+
}
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export { InputLeft };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
const InputRight = React.forwardRef(
|
|
5
|
+
({ children, className, ...rest }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx(className, "ml-2.5"), ...rest, ref }, children);
|
|
7
|
+
}
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export { InputRight };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputBox } from './Box.js';
|
|
3
|
+
import { InputFace } from './Face.js';
|
|
4
|
+
|
|
5
|
+
const InputRoot = React.forwardRef(
|
|
6
|
+
({ variants, className, ...rest }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(InputFace, { variants, className }, /* @__PURE__ */ React.createElement(InputBox, { ...rest, ref }));
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export { InputRoot };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { IoSearchOutline } from 'react-icons/io5';
|
|
3
|
+
import { Input } from './index.js';
|
|
4
|
+
import '@internationalized/date';
|
|
5
|
+
import 'react-aria';
|
|
6
|
+
import 'react-stately';
|
|
7
|
+
import { useDebouncedState } from '../../hooks/useDebouncedState.js';
|
|
8
|
+
import '@floating-ui/react';
|
|
9
|
+
|
|
10
|
+
const InputSearch = React.forwardRef(
|
|
11
|
+
({ bounceTimeout = 1e3, variants, className, onChange, ...rest }, ref) => {
|
|
12
|
+
const [bouncedTextEvent, setBouncedTextEvent] = useState();
|
|
13
|
+
const [searchInputEvent, setSearchInputEvent] = useDebouncedState(void 0, setBouncedTextEvent, bounceTimeout);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (onChange && searchInputEvent) {
|
|
16
|
+
onChange(searchInputEvent);
|
|
17
|
+
}
|
|
18
|
+
}, [bouncedTextEvent]);
|
|
19
|
+
return /* @__PURE__ */ React.createElement(Input.Face, { variants, className }, /* @__PURE__ */ React.createElement(Input.Left, null, /* @__PURE__ */ React.createElement(IoSearchOutline, { "data-testid": "icon-search-left" })), /* @__PURE__ */ React.createElement(Input.Box, { ...rest, ref, onChange: (e) => setSearchInputEvent(e) }));
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export { InputSearch };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InputBox } from './Box.js';
|
|
2
|
+
import { InputFace } from './Face.js';
|
|
3
|
+
import { InputLeft } from './Left.js';
|
|
4
|
+
import { InputRight } from './Right.js';
|
|
5
|
+
import { InputRoot } from './Root.js';
|
|
6
|
+
import { InputSearch } from './Search.js';
|
|
7
|
+
|
|
8
|
+
const Input = {
|
|
9
|
+
Root: InputRoot,
|
|
10
|
+
Face: InputFace,
|
|
11
|
+
Box: InputBox,
|
|
12
|
+
Left: InputLeft,
|
|
13
|
+
Right: InputRight,
|
|
14
|
+
Search: InputSearch
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
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(), 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,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { menubar } from '../../styles/menubar.js';
|
|
4
|
+
import { Button } from '../Button.js';
|
|
5
|
+
import { IoMenu } from 'react-icons/io5';
|
|
6
|
+
import { useMenubar } from '../../provider/MenubarProvider.js';
|
|
7
|
+
import '../../provider/SnackbarProvider.js';
|
|
8
|
+
|
|
9
|
+
const { root } = menubar();
|
|
10
|
+
const Header = ({ children, className, ...rest }) => {
|
|
11
|
+
const [show, setShow] = useMenubar();
|
|
12
|
+
return /* @__PURE__ */ React.createElement(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: clsx(root(), className),
|
|
16
|
+
"data-testid": "header-menubar",
|
|
17
|
+
...rest
|
|
18
|
+
},
|
|
19
|
+
/* @__PURE__ */ React.createElement(Button, { variants: { size: "square" }, onClick: () => setShow(!show) }, /* @__PURE__ */ React.createElement(IoMenu, { size: 16 })),
|
|
20
|
+
children
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
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,56 @@
|
|
|
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/Right.js';
|
|
20
|
+
import '../Input/Root.js';
|
|
21
|
+
import '../Input/Search.js';
|
|
22
|
+
import 'react-icons/io';
|
|
23
|
+
import '../GroupButton.js';
|
|
24
|
+
import '../Hint.js';
|
|
25
|
+
import { Menubar } from './index.js';
|
|
26
|
+
import '../Modal.js';
|
|
27
|
+
import '../Popover/Context.js';
|
|
28
|
+
import '../../styles/calendar-cell.js';
|
|
29
|
+
import '../../styles/groupButton.js';
|
|
30
|
+
import '../../styles/progressBar.js';
|
|
31
|
+
import '../Select/GroupedOptions.js';
|
|
32
|
+
import '../Select/context.js';
|
|
33
|
+
import '../Select/Trigger.js';
|
|
34
|
+
import '../Tag.js';
|
|
35
|
+
import '../TextArea.js';
|
|
36
|
+
import '../Toggle.js';
|
|
37
|
+
import '../Tooltip.js';
|
|
38
|
+
|
|
39
|
+
const MostUsedList = ({ mostUsed }) => {
|
|
40
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (mostUsed ?? []).map((item, index) => {
|
|
41
|
+
const { title, category, ...rest } = item;
|
|
42
|
+
if (index > 3)
|
|
43
|
+
return /* @__PURE__ */ React.createElement(Fragment, { key: `${title}-${category}` });
|
|
44
|
+
return /* @__PURE__ */ React.createElement(
|
|
45
|
+
Menubar.MostUsedItem,
|
|
46
|
+
{
|
|
47
|
+
key: `${title}-${category}`,
|
|
48
|
+
title,
|
|
49
|
+
category,
|
|
50
|
+
...rest
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
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 };
|