@tecsinapse/cortex-react 1.7.6 → 1.8.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Menubar/Categories.js +10 -1
- package/dist/cjs/components/Menubar/Left.js +10 -1
- package/dist/cjs/components/Menubar/MostUsed.js +10 -0
- package/dist/cjs/components/Menubar/Right.js +10 -1
- package/dist/cjs/components/Menubar/Search.js +2 -1
- package/dist/cjs/components/Stepper/Node.js +28 -0
- package/dist/cjs/components/Stepper/Root.js +36 -0
- package/dist/cjs/components/Stepper/index.js +11 -0
- package/dist/cjs/hooks/useDimensions.js +26 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/styles/menubar.js +2 -2
- package/dist/cjs/styles/stepNodeVariants.js +62 -0
- package/dist/esm/components/Menubar/Categories.js +10 -1
- package/dist/esm/components/Menubar/Left.js +10 -1
- package/dist/esm/components/Menubar/MostUsed.js +10 -0
- package/dist/esm/components/Menubar/Right.js +10 -1
- package/dist/esm/components/Menubar/Search.js +2 -1
- package/dist/esm/components/Stepper/Node.js +26 -0
- package/dist/esm/components/Stepper/Root.js +34 -0
- package/dist/esm/components/Stepper/index.js +9 -0
- package/dist/esm/hooks/useDimensions.js +24 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/styles/menubar.js +2 -2
- package/dist/esm/styles/stepNodeVariants.js +60 -0
- package/dist/types/components/Stepper/Node.d.ts +11 -0
- package/dist/types/components/Stepper/Root.d.ts +6 -0
- package/dist/types/components/Stepper/index.d.ts +5 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useDimensions.d.ts +4 -0
- package/dist/types/styles/stepNodeVariants.d.ts +307 -0
- package/package.json +3 -3
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var Masonry = require('../Masonry.js');
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('react-aria');
|
|
7
|
+
require('react-stately');
|
|
8
|
+
require('@floating-ui/react');
|
|
9
|
+
require('currency.js');
|
|
10
|
+
require('react-dropzone');
|
|
11
|
+
require('uuid');
|
|
12
|
+
var useDimensions = require('../../hooks/useDimensions.js');
|
|
5
13
|
|
|
6
14
|
const Categories = ({ children }) => {
|
|
7
|
-
|
|
15
|
+
const { width } = useDimensions.useDimensions();
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Masonry, { columns: width <= 640 ? 2 : 4 }, children);
|
|
8
17
|
};
|
|
9
18
|
|
|
10
19
|
module.exports = Categories;
|
|
@@ -5,7 +5,16 @@ var menubar = require('../../styles/menubar.js');
|
|
|
5
5
|
|
|
6
6
|
const { left } = menubar.menubar();
|
|
7
7
|
const Left = ({ children, ...rest }) => {
|
|
8
|
-
|
|
8
|
+
const { className } = rest;
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: left({ className }),
|
|
13
|
+
"data-testid": "header-left-menubar",
|
|
14
|
+
...rest
|
|
15
|
+
},
|
|
16
|
+
children
|
|
17
|
+
);
|
|
9
18
|
};
|
|
10
19
|
|
|
11
20
|
module.exports = Left;
|
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var menubar = require('../../styles/menubar.js');
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('react-aria');
|
|
7
|
+
require('react-stately');
|
|
8
|
+
require('@floating-ui/react');
|
|
9
|
+
require('currency.js');
|
|
10
|
+
require('react-dropzone');
|
|
11
|
+
require('uuid');
|
|
12
|
+
var useDimensions = require('../../hooks/useDimensions.js');
|
|
5
13
|
|
|
6
14
|
const { container, label: labelClass, containerList } = menubar.mostUsed();
|
|
7
15
|
const MostUsed = ({ label, children, ...rest }) => {
|
|
16
|
+
const { width } = useDimensions.useDimensions();
|
|
17
|
+
if (width <= 640) return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
8
18
|
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));
|
|
9
19
|
};
|
|
10
20
|
|
|
@@ -5,7 +5,16 @@ var menubar = require('../../styles/menubar.js');
|
|
|
5
5
|
|
|
6
6
|
const { right } = menubar.menubar();
|
|
7
7
|
const Right = ({ children, ...rest }) => {
|
|
8
|
-
|
|
8
|
+
const { className } = rest;
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: right({ className }),
|
|
13
|
+
"data-testid": "header-right-menubar",
|
|
14
|
+
...rest
|
|
15
|
+
},
|
|
16
|
+
children
|
|
17
|
+
);
|
|
9
18
|
};
|
|
10
19
|
|
|
11
20
|
module.exports = Right;
|
|
@@ -17,11 +17,12 @@ var useMenubar = require('../../provider/useMenubar.js');
|
|
|
17
17
|
|
|
18
18
|
const Search = (props) => {
|
|
19
19
|
const [show] = useMenubar.useMenubar();
|
|
20
|
+
const { className } = props;
|
|
20
21
|
return /* @__PURE__ */ React.createElement(
|
|
21
22
|
index.Input.Search,
|
|
22
23
|
{
|
|
23
24
|
...props,
|
|
24
|
-
className: clsx("
|
|
25
|
+
className: clsx("flex-1", menubar.animate({ show }), className)
|
|
25
26
|
}
|
|
26
27
|
);
|
|
27
28
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var stepNodeVariants = require('../../styles/stepNodeVariants.js');
|
|
5
|
+
|
|
6
|
+
const Node = ({
|
|
7
|
+
marked = false,
|
|
8
|
+
intent = "success",
|
|
9
|
+
isFirst = false,
|
|
10
|
+
isLast = false,
|
|
11
|
+
segmented = false,
|
|
12
|
+
selected = false,
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
...rest
|
|
16
|
+
}) => {
|
|
17
|
+
const { container, content, separator } = stepNodeVariants.StepNodeVariants({
|
|
18
|
+
intent,
|
|
19
|
+
marked,
|
|
20
|
+
isFirst,
|
|
21
|
+
isLast,
|
|
22
|
+
selected,
|
|
23
|
+
disabled: rest.disabled
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ React.createElement("button", { type: "button", className: container({ className }), ...rest }, /* @__PURE__ */ React.createElement("div", { className: content() }, children), segmented ? /* @__PURE__ */ React.createElement("div", { className: separator() }) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.Node = Node;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Node = require('./Node.js');
|
|
5
|
+
|
|
6
|
+
const Root = ({ segmented = false, children }) => {
|
|
7
|
+
const [selectedNode, setSelectedNode] = React.useState(null);
|
|
8
|
+
const childrenCount = React.useMemo(
|
|
9
|
+
() => React.Children.count(children),
|
|
10
|
+
[children]
|
|
11
|
+
);
|
|
12
|
+
const handleNodeClick = React.useCallback((index, onClick) => {
|
|
13
|
+
setSelectedNode(index);
|
|
14
|
+
if (onClick) {
|
|
15
|
+
onClick();
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
18
|
+
const renderNode = React.useMemo(
|
|
19
|
+
() => (child, index) => {
|
|
20
|
+
if (React.isValidElement(child) && child.type === Node.Node) {
|
|
21
|
+
return React.cloneElement(child, {
|
|
22
|
+
isFirst: index === 0,
|
|
23
|
+
isLast: index === childrenCount - 1,
|
|
24
|
+
selected: selectedNode === index,
|
|
25
|
+
segmented,
|
|
26
|
+
onClick: () => handleNodeClick(index, child.props.onClick)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
},
|
|
31
|
+
[childrenCount, selectedNode, segmented]
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ React.createElement("div", { className: "flex w-full space-x-2 bg-white p-4 pb-2 rounded-mili" }, React.Children.map(children, renderNode));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.Root = Root;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const getWindowDimensions = () => {
|
|
6
|
+
const { innerWidth: width, innerHeight: height } = window;
|
|
7
|
+
return {
|
|
8
|
+
width,
|
|
9
|
+
height
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const useDimensions = () => {
|
|
13
|
+
const [windowDimensions, setWindowDimensions] = React.useState(
|
|
14
|
+
getWindowDimensions()
|
|
15
|
+
);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
function handleResize() {
|
|
18
|
+
setWindowDimensions(getWindowDimensions());
|
|
19
|
+
}
|
|
20
|
+
window.addEventListener("resize", handleResize);
|
|
21
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
22
|
+
}, []);
|
|
23
|
+
return windowDimensions;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.useDimensions = useDimensions;
|
package/dist/cjs/index.js
CHANGED
|
@@ -40,6 +40,7 @@ var TimeFieldInput = require('./components/TimeField/TimeFieldInput.js');
|
|
|
40
40
|
var Toggle = require('./components/Toggle.js');
|
|
41
41
|
var Tooltip = require('./components/Tooltip.js');
|
|
42
42
|
var index$5 = require('./components/Uploader/index.js');
|
|
43
|
+
var index$6 = require('./components/Stepper/index.js');
|
|
43
44
|
var useCalendar = require('./hooks/useCalendar.js');
|
|
44
45
|
var useCalendarCell = require('./hooks/useCalendarCell.js');
|
|
45
46
|
var useCalendarGrid = require('./hooks/useCalendarGrid.js');
|
|
@@ -54,6 +55,7 @@ var useSelectGroupedOptions = require('./hooks/useSelectGroupedOptions.js');
|
|
|
54
55
|
var useSelectOptions = require('./hooks/useSelectOptions.js');
|
|
55
56
|
var useStringMask = require('./hooks/useStringMask.js');
|
|
56
57
|
var useFileUpload = require('./hooks/useFileUpload.js');
|
|
58
|
+
var useDimensions = require('./hooks/useDimensions.js');
|
|
57
59
|
var SnackbarSonner = require('./service/SnackbarSonner.js');
|
|
58
60
|
var MenubarProvider = require('./provider/MenubarProvider.js');
|
|
59
61
|
var SnackbarProvider = require('./provider/SnackbarProvider.js');
|
|
@@ -114,6 +116,7 @@ exports.TimeFieldInput = TimeFieldInput.TimeFieldInput;
|
|
|
114
116
|
exports.Toggle = Toggle.Toggle;
|
|
115
117
|
exports.Tooltip = Tooltip.Tooltip;
|
|
116
118
|
exports.Uploader = index$5.Uploader;
|
|
119
|
+
exports.Stepper = index$6.Stepper;
|
|
117
120
|
exports.useCalendar = useCalendar.useCalendar;
|
|
118
121
|
exports.useCalendarCell = useCalendarCell.useCalendarCell;
|
|
119
122
|
exports.useCalendarGrid = useCalendarGrid.useCalendarGrid;
|
|
@@ -131,6 +134,7 @@ exports.getMask = useStringMask.getMask;
|
|
|
131
134
|
exports.mergeMask = useStringMask.mergeMask;
|
|
132
135
|
exports.useStringMask = useStringMask.useStringMask;
|
|
133
136
|
exports.useFileUpload = useFileUpload.useFileUpload;
|
|
137
|
+
exports.useDimensions = useDimensions.useDimensions;
|
|
134
138
|
exports.SnackbarSonner = SnackbarSonner.SnackbarSonner;
|
|
135
139
|
exports.MenubarProvider = MenubarProvider.MenubarProvider;
|
|
136
140
|
exports.SnackbarProvider = SnackbarProvider.SnackbarProvider;
|
|
@@ -4,9 +4,9 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const menubar = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-sidebar",
|
|
7
|
+
header: "relative w-screen px-kilo py-deca flex flex-row md:justify-between bg-white z-sidebar sm:justify-start",
|
|
8
8
|
left: "flex items-center w-fit",
|
|
9
|
-
right: "flex items-center gap-x-deca",
|
|
9
|
+
right: "flex items-center gap-x-deca hidden sm:flex",
|
|
10
10
|
dropdown: "w-full bg-white flex-1 shadow-default z-popover px-[8vw] absolute"
|
|
11
11
|
},
|
|
12
12
|
variants: {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tailwindVariants = require('tailwind-variants');
|
|
4
|
+
|
|
5
|
+
const StepNodeVariants = tailwindVariants.tv({
|
|
6
|
+
slots: {
|
|
7
|
+
container: "flex flex-col items-center justify-center text-center w-full max-w-[268px]",
|
|
8
|
+
content: "flex p-mili text-center w-full text-sub justify-center font-bold cursor-pointer",
|
|
9
|
+
separator: "h-micro w-full"
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
intent: {
|
|
13
|
+
success: {
|
|
14
|
+
separator: "bg-success-medium"
|
|
15
|
+
},
|
|
16
|
+
warning: {
|
|
17
|
+
separator: "bg-warning-medium"
|
|
18
|
+
},
|
|
19
|
+
error: {
|
|
20
|
+
separator: "bg-error-medium"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
marked: {
|
|
24
|
+
true: {
|
|
25
|
+
content: "font-bold"
|
|
26
|
+
},
|
|
27
|
+
false: {
|
|
28
|
+
content: "text-secondary-medium",
|
|
29
|
+
separator: "bg-secondary-light"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
selected: {
|
|
33
|
+
true: {
|
|
34
|
+
content: "text-primary-medium"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
isFirst: {
|
|
38
|
+
true: {
|
|
39
|
+
separator: "rounded-l-lg"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
isLast: {
|
|
43
|
+
true: {
|
|
44
|
+
separator: "rounded-r-lg"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
disabled: {
|
|
48
|
+
true: {
|
|
49
|
+
container: "opacity-50 cursor-not-allowed",
|
|
50
|
+
content: "pointer-events-none"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
intent: "success",
|
|
56
|
+
marked: false,
|
|
57
|
+
selected: false,
|
|
58
|
+
disabled: false
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
exports.StepNodeVariants = StepNodeVariants;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import Masonry from '../Masonry.js';
|
|
3
|
+
import '@internationalized/date';
|
|
4
|
+
import 'react-aria';
|
|
5
|
+
import 'react-stately';
|
|
6
|
+
import '@floating-ui/react';
|
|
7
|
+
import 'currency.js';
|
|
8
|
+
import 'react-dropzone';
|
|
9
|
+
import 'uuid';
|
|
10
|
+
import { useDimensions } from '../../hooks/useDimensions.js';
|
|
3
11
|
|
|
4
12
|
const Categories = ({ children }) => {
|
|
5
|
-
|
|
13
|
+
const { width } = useDimensions();
|
|
14
|
+
return /* @__PURE__ */ React__default.createElement(Masonry, { columns: width <= 640 ? 2 : 4 }, children);
|
|
6
15
|
};
|
|
7
16
|
|
|
8
17
|
export { Categories as default };
|
|
@@ -3,7 +3,16 @@ import { menubar } from '../../styles/menubar.js';
|
|
|
3
3
|
|
|
4
4
|
const { left } = menubar();
|
|
5
5
|
const Left = ({ children, ...rest }) => {
|
|
6
|
-
|
|
6
|
+
const { className } = rest;
|
|
7
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: left({ className }),
|
|
11
|
+
"data-testid": "header-left-menubar",
|
|
12
|
+
...rest
|
|
13
|
+
},
|
|
14
|
+
children
|
|
15
|
+
);
|
|
7
16
|
};
|
|
8
17
|
|
|
9
18
|
export { Left as default };
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { mostUsed } from '../../styles/menubar.js';
|
|
3
|
+
import '@internationalized/date';
|
|
4
|
+
import 'react-aria';
|
|
5
|
+
import 'react-stately';
|
|
6
|
+
import '@floating-ui/react';
|
|
7
|
+
import 'currency.js';
|
|
8
|
+
import 'react-dropzone';
|
|
9
|
+
import 'uuid';
|
|
10
|
+
import { useDimensions } from '../../hooks/useDimensions.js';
|
|
3
11
|
|
|
4
12
|
const { container, label: labelClass, containerList } = mostUsed();
|
|
5
13
|
const MostUsed = ({ label, children, ...rest }) => {
|
|
14
|
+
const { width } = useDimensions();
|
|
15
|
+
if (width <= 640) return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
6
16
|
return /* @__PURE__ */ React__default.createElement("div", { className: container(), "data-testid": "most-used-menubar", ...rest }, /* @__PURE__ */ React__default.createElement("p", { className: labelClass() }, label), /* @__PURE__ */ React__default.createElement("div", { className: containerList() }, children));
|
|
7
17
|
};
|
|
8
18
|
|
|
@@ -3,7 +3,16 @@ import { menubar } from '../../styles/menubar.js';
|
|
|
3
3
|
|
|
4
4
|
const { right } = menubar();
|
|
5
5
|
const Right = ({ children, ...rest }) => {
|
|
6
|
-
|
|
6
|
+
const { className } = rest;
|
|
7
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: right({ className }),
|
|
11
|
+
"data-testid": "header-right-menubar",
|
|
12
|
+
...rest
|
|
13
|
+
},
|
|
14
|
+
children
|
|
15
|
+
);
|
|
7
16
|
};
|
|
8
17
|
|
|
9
18
|
export { Right as default };
|
|
@@ -15,11 +15,12 @@ import { useMenubar } from '../../provider/useMenubar.js';
|
|
|
15
15
|
|
|
16
16
|
const Search = (props) => {
|
|
17
17
|
const [show] = useMenubar();
|
|
18
|
+
const { className } = props;
|
|
18
19
|
return /* @__PURE__ */ React__default.createElement(
|
|
19
20
|
Input.Search,
|
|
20
21
|
{
|
|
21
22
|
...props,
|
|
22
|
-
className: clsx("
|
|
23
|
+
className: clsx("flex-1", animate({ show }), className)
|
|
23
24
|
}
|
|
24
25
|
);
|
|
25
26
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { StepNodeVariants } from '../../styles/stepNodeVariants.js';
|
|
3
|
+
|
|
4
|
+
const Node = ({
|
|
5
|
+
marked = false,
|
|
6
|
+
intent = "success",
|
|
7
|
+
isFirst = false,
|
|
8
|
+
isLast = false,
|
|
9
|
+
segmented = false,
|
|
10
|
+
selected = false,
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
const { container, content, separator } = StepNodeVariants({
|
|
16
|
+
intent,
|
|
17
|
+
marked,
|
|
18
|
+
isFirst,
|
|
19
|
+
isLast,
|
|
20
|
+
selected,
|
|
21
|
+
disabled: rest.disabled
|
|
22
|
+
});
|
|
23
|
+
return /* @__PURE__ */ React__default.createElement("button", { type: "button", className: container({ className }), ...rest }, /* @__PURE__ */ React__default.createElement("div", { className: content() }, children), segmented ? /* @__PURE__ */ React__default.createElement("div", { className: separator() }) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { Node };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React__default, { useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import { Node } from './Node.js';
|
|
3
|
+
|
|
4
|
+
const Root = ({ segmented = false, children }) => {
|
|
5
|
+
const [selectedNode, setSelectedNode] = useState(null);
|
|
6
|
+
const childrenCount = useMemo(
|
|
7
|
+
() => React__default.Children.count(children),
|
|
8
|
+
[children]
|
|
9
|
+
);
|
|
10
|
+
const handleNodeClick = useCallback((index, onClick) => {
|
|
11
|
+
setSelectedNode(index);
|
|
12
|
+
if (onClick) {
|
|
13
|
+
onClick();
|
|
14
|
+
}
|
|
15
|
+
}, []);
|
|
16
|
+
const renderNode = useMemo(
|
|
17
|
+
() => (child, index) => {
|
|
18
|
+
if (React__default.isValidElement(child) && child.type === Node) {
|
|
19
|
+
return React__default.cloneElement(child, {
|
|
20
|
+
isFirst: index === 0,
|
|
21
|
+
isLast: index === childrenCount - 1,
|
|
22
|
+
selected: selectedNode === index,
|
|
23
|
+
segmented,
|
|
24
|
+
onClick: () => handleNodeClick(index, child.props.onClick)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
},
|
|
29
|
+
[childrenCount, selectedNode, segmented]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "flex w-full space-x-2 bg-white p-4 pb-2 rounded-mili" }, React__default.Children.map(children, renderNode));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { Root };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const getWindowDimensions = () => {
|
|
4
|
+
const { innerWidth: width, innerHeight: height } = window;
|
|
5
|
+
return {
|
|
6
|
+
width,
|
|
7
|
+
height
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
const useDimensions = () => {
|
|
11
|
+
const [windowDimensions, setWindowDimensions] = useState(
|
|
12
|
+
getWindowDimensions()
|
|
13
|
+
);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
function handleResize() {
|
|
16
|
+
setWindowDimensions(getWindowDimensions());
|
|
17
|
+
}
|
|
18
|
+
window.addEventListener("resize", handleResize);
|
|
19
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
20
|
+
}, []);
|
|
21
|
+
return windowDimensions;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { useDimensions };
|
package/dist/esm/index.js
CHANGED
|
@@ -38,6 +38,7 @@ export { TimeFieldInput } from './components/TimeField/TimeFieldInput.js';
|
|
|
38
38
|
export { Toggle } from './components/Toggle.js';
|
|
39
39
|
export { Tooltip } from './components/Tooltip.js';
|
|
40
40
|
export { Uploader } from './components/Uploader/index.js';
|
|
41
|
+
export { Stepper } from './components/Stepper/index.js';
|
|
41
42
|
export { useCalendar } from './hooks/useCalendar.js';
|
|
42
43
|
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
43
44
|
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
@@ -52,6 +53,7 @@ export { useSelectGroupedOptions } from './hooks/useSelectGroupedOptions.js';
|
|
|
52
53
|
export { useSelectOptions } from './hooks/useSelectOptions.js';
|
|
53
54
|
export { getMask, mergeMask, useStringMask } from './hooks/useStringMask.js';
|
|
54
55
|
export { useFileUpload } from './hooks/useFileUpload.js';
|
|
56
|
+
export { useDimensions } from './hooks/useDimensions.js';
|
|
55
57
|
export { SnackbarSonner } from './service/SnackbarSonner.js';
|
|
56
58
|
export { MenubarProvider } from './provider/MenubarProvider.js';
|
|
57
59
|
export { SnackbarProvider, useSnackbar } from './provider/SnackbarProvider.js';
|
|
@@ -2,9 +2,9 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const menubar = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-sidebar",
|
|
5
|
+
header: "relative w-screen px-kilo py-deca flex flex-row md:justify-between bg-white z-sidebar sm:justify-start",
|
|
6
6
|
left: "flex items-center w-fit",
|
|
7
|
-
right: "flex items-center gap-x-deca",
|
|
7
|
+
right: "flex items-center gap-x-deca hidden sm:flex",
|
|
8
8
|
dropdown: "w-full bg-white flex-1 shadow-default z-popover px-[8vw] absolute"
|
|
9
9
|
},
|
|
10
10
|
variants: {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
const StepNodeVariants = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
container: "flex flex-col items-center justify-center text-center w-full max-w-[268px]",
|
|
6
|
+
content: "flex p-mili text-center w-full text-sub justify-center font-bold cursor-pointer",
|
|
7
|
+
separator: "h-micro w-full"
|
|
8
|
+
},
|
|
9
|
+
variants: {
|
|
10
|
+
intent: {
|
|
11
|
+
success: {
|
|
12
|
+
separator: "bg-success-medium"
|
|
13
|
+
},
|
|
14
|
+
warning: {
|
|
15
|
+
separator: "bg-warning-medium"
|
|
16
|
+
},
|
|
17
|
+
error: {
|
|
18
|
+
separator: "bg-error-medium"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
marked: {
|
|
22
|
+
true: {
|
|
23
|
+
content: "font-bold"
|
|
24
|
+
},
|
|
25
|
+
false: {
|
|
26
|
+
content: "text-secondary-medium",
|
|
27
|
+
separator: "bg-secondary-light"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
selected: {
|
|
31
|
+
true: {
|
|
32
|
+
content: "text-primary-medium"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
isFirst: {
|
|
36
|
+
true: {
|
|
37
|
+
separator: "rounded-l-lg"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
isLast: {
|
|
41
|
+
true: {
|
|
42
|
+
separator: "rounded-r-lg"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
true: {
|
|
47
|
+
container: "opacity-50 cursor-not-allowed",
|
|
48
|
+
content: "pointer-events-none"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
intent: "success",
|
|
54
|
+
marked: false,
|
|
55
|
+
selected: false,
|
|
56
|
+
disabled: false
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export { StepNodeVariants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface StepNodeProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
3
|
+
marked?: boolean;
|
|
4
|
+
intent?: 'success' | 'warning' | 'error';
|
|
5
|
+
isFirst?: boolean;
|
|
6
|
+
isLast?: boolean;
|
|
7
|
+
segmented?: boolean;
|
|
8
|
+
selected?: boolean;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const Node: ({ marked, intent, isFirst, isLast, segmented, selected, children, className, ...rest }: StepNodeProps) => JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Stepper: {
|
|
3
|
+
Root: ({ segmented, children }: import("./Root").StepRootProps) => JSX.Element;
|
|
4
|
+
Node: ({ marked, intent, isFirst, isLast, segmented, selected, children, className, ...rest }: import("./Node").StepNodeProps) => JSX.Element;
|
|
5
|
+
};
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
export declare const StepNodeVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
intent: {
|
|
3
|
+
success: {
|
|
4
|
+
separator: string;
|
|
5
|
+
};
|
|
6
|
+
warning: {
|
|
7
|
+
separator: string;
|
|
8
|
+
};
|
|
9
|
+
error: {
|
|
10
|
+
separator: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
marked: {
|
|
14
|
+
true: {
|
|
15
|
+
content: string;
|
|
16
|
+
};
|
|
17
|
+
false: {
|
|
18
|
+
content: string;
|
|
19
|
+
separator: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
selected: {
|
|
23
|
+
true: {
|
|
24
|
+
content: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
isFirst: {
|
|
28
|
+
true: {
|
|
29
|
+
separator: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
isLast: {
|
|
33
|
+
true: {
|
|
34
|
+
separator: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
disabled: {
|
|
38
|
+
true: {
|
|
39
|
+
container: string;
|
|
40
|
+
content: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}, {
|
|
44
|
+
container: string;
|
|
45
|
+
content: string;
|
|
46
|
+
separator: string;
|
|
47
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
48
|
+
intent: {
|
|
49
|
+
success: {
|
|
50
|
+
separator: string;
|
|
51
|
+
};
|
|
52
|
+
warning: {
|
|
53
|
+
separator: string;
|
|
54
|
+
};
|
|
55
|
+
error: {
|
|
56
|
+
separator: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
marked: {
|
|
60
|
+
true: {
|
|
61
|
+
content: string;
|
|
62
|
+
};
|
|
63
|
+
false: {
|
|
64
|
+
content: string;
|
|
65
|
+
separator: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
selected: {
|
|
69
|
+
true: {
|
|
70
|
+
content: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
isFirst: {
|
|
74
|
+
true: {
|
|
75
|
+
separator: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
isLast: {
|
|
79
|
+
true: {
|
|
80
|
+
separator: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
disabled: {
|
|
84
|
+
true: {
|
|
85
|
+
container: string;
|
|
86
|
+
content: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}, {
|
|
90
|
+
intent: {
|
|
91
|
+
success: {
|
|
92
|
+
separator: string;
|
|
93
|
+
};
|
|
94
|
+
warning: {
|
|
95
|
+
separator: string;
|
|
96
|
+
};
|
|
97
|
+
error: {
|
|
98
|
+
separator: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
marked: {
|
|
102
|
+
true: {
|
|
103
|
+
content: string;
|
|
104
|
+
};
|
|
105
|
+
false: {
|
|
106
|
+
content: string;
|
|
107
|
+
separator: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
selected: {
|
|
111
|
+
true: {
|
|
112
|
+
content: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
isFirst: {
|
|
116
|
+
true: {
|
|
117
|
+
separator: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
isLast: {
|
|
121
|
+
true: {
|
|
122
|
+
separator: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
disabled: {
|
|
126
|
+
true: {
|
|
127
|
+
container: string;
|
|
128
|
+
content: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
}>, {
|
|
132
|
+
intent: {
|
|
133
|
+
success: {
|
|
134
|
+
separator: string;
|
|
135
|
+
};
|
|
136
|
+
warning: {
|
|
137
|
+
separator: string;
|
|
138
|
+
};
|
|
139
|
+
error: {
|
|
140
|
+
separator: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
marked: {
|
|
144
|
+
true: {
|
|
145
|
+
content: string;
|
|
146
|
+
};
|
|
147
|
+
false: {
|
|
148
|
+
content: string;
|
|
149
|
+
separator: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
selected: {
|
|
153
|
+
true: {
|
|
154
|
+
content: string;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
isFirst: {
|
|
158
|
+
true: {
|
|
159
|
+
separator: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
isLast: {
|
|
163
|
+
true: {
|
|
164
|
+
separator: string;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
disabled: {
|
|
168
|
+
true: {
|
|
169
|
+
container: string;
|
|
170
|
+
content: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
}, {
|
|
174
|
+
container: string;
|
|
175
|
+
content: string;
|
|
176
|
+
separator: string;
|
|
177
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
178
|
+
intent: {
|
|
179
|
+
success: {
|
|
180
|
+
separator: string;
|
|
181
|
+
};
|
|
182
|
+
warning: {
|
|
183
|
+
separator: string;
|
|
184
|
+
};
|
|
185
|
+
error: {
|
|
186
|
+
separator: string;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
marked: {
|
|
190
|
+
true: {
|
|
191
|
+
content: string;
|
|
192
|
+
};
|
|
193
|
+
false: {
|
|
194
|
+
content: string;
|
|
195
|
+
separator: string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
selected: {
|
|
199
|
+
true: {
|
|
200
|
+
content: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
isFirst: {
|
|
204
|
+
true: {
|
|
205
|
+
separator: string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
isLast: {
|
|
209
|
+
true: {
|
|
210
|
+
separator: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
disabled: {
|
|
214
|
+
true: {
|
|
215
|
+
container: string;
|
|
216
|
+
content: string;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
}, {
|
|
220
|
+
container: string;
|
|
221
|
+
content: string;
|
|
222
|
+
separator: string;
|
|
223
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
224
|
+
intent: {
|
|
225
|
+
success: {
|
|
226
|
+
separator: string;
|
|
227
|
+
};
|
|
228
|
+
warning: {
|
|
229
|
+
separator: string;
|
|
230
|
+
};
|
|
231
|
+
error: {
|
|
232
|
+
separator: string;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
marked: {
|
|
236
|
+
true: {
|
|
237
|
+
content: string;
|
|
238
|
+
};
|
|
239
|
+
false: {
|
|
240
|
+
content: string;
|
|
241
|
+
separator: string;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
selected: {
|
|
245
|
+
true: {
|
|
246
|
+
content: string;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
isFirst: {
|
|
250
|
+
true: {
|
|
251
|
+
separator: string;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
isLast: {
|
|
255
|
+
true: {
|
|
256
|
+
separator: string;
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
disabled: {
|
|
260
|
+
true: {
|
|
261
|
+
container: string;
|
|
262
|
+
content: string;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
}, {
|
|
266
|
+
intent: {
|
|
267
|
+
success: {
|
|
268
|
+
separator: string;
|
|
269
|
+
};
|
|
270
|
+
warning: {
|
|
271
|
+
separator: string;
|
|
272
|
+
};
|
|
273
|
+
error: {
|
|
274
|
+
separator: string;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
marked: {
|
|
278
|
+
true: {
|
|
279
|
+
content: string;
|
|
280
|
+
};
|
|
281
|
+
false: {
|
|
282
|
+
content: string;
|
|
283
|
+
separator: string;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
selected: {
|
|
287
|
+
true: {
|
|
288
|
+
content: string;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
isFirst: {
|
|
292
|
+
true: {
|
|
293
|
+
separator: string;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
isLast: {
|
|
297
|
+
true: {
|
|
298
|
+
separator: string;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
disabled: {
|
|
302
|
+
true: {
|
|
303
|
+
container: string;
|
|
304
|
+
content: string;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
}>, unknown, unknown, undefined>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-beta.1",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@floating-ui/react": "^0.26.18",
|
|
22
22
|
"@internationalized/date": "*",
|
|
23
|
-
"@tecsinapse/cortex-core": "0.4.
|
|
23
|
+
"@tecsinapse/cortex-core": "0.4.3-beta.3",
|
|
24
24
|
"clsx": "*",
|
|
25
25
|
"currency.js": "~2.0.4",
|
|
26
26
|
"react-aria": "^3.33.1",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-dom": ">=18.0.0",
|
|
49
49
|
"tailwind": ">=3.3.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "fcbe14c0bbcc8bab1309deec184ae3d90163f674"
|
|
52
52
|
}
|