@tecsinapse/cortex-react 1.7.5 → 1.8.0-beta.0
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/Popover/Provider.js +3 -2
- package/dist/cjs/components/Popover/Root.js +3 -2
- 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/useFloatingElement.js +12 -8
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/styles/stepNodeVariants.js +62 -0
- package/dist/esm/components/Popover/Provider.js +3 -2
- package/dist/esm/components/Popover/Root.js +3 -2
- 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/useFloatingElement.js +12 -8
- package/dist/esm/index.js +1 -0
- package/dist/esm/styles/stepNodeVariants.js +60 -0
- package/dist/types/components/Popover/Provider.d.ts +12 -3
- package/dist/types/components/Popover/Root.d.ts +7 -2
- package/dist/types/components/Popover/index.d.ts +2 -2
- 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/useFloatingElement.d.ts +7 -5
- package/dist/types/styles/stepNodeVariants.d.ts +307 -0
- package/package.json +2 -2
|
@@ -13,9 +13,10 @@ var Context = require('./Context.js');
|
|
|
13
13
|
const PopoverProvider = ({
|
|
14
14
|
children,
|
|
15
15
|
placement,
|
|
16
|
-
trigger
|
|
16
|
+
trigger,
|
|
17
|
+
...props
|
|
17
18
|
}) => {
|
|
18
|
-
const floatingLogic = useFloatingElement.useFloatingElement({ placement, trigger });
|
|
19
|
+
const floatingLogic = useFloatingElement.useFloatingElement({ placement, trigger, ...props });
|
|
19
20
|
return /* @__PURE__ */ React.createElement(Context.Context.Provider, { value: { ...floatingLogic } }, children);
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -6,9 +6,10 @@ var Provider = require('./Provider.js');
|
|
|
6
6
|
const PopoverRoot = ({
|
|
7
7
|
children,
|
|
8
8
|
placement,
|
|
9
|
-
trigger
|
|
9
|
+
trigger,
|
|
10
|
+
...props
|
|
10
11
|
}) => {
|
|
11
|
-
return /* @__PURE__ */ React.createElement(Provider.PopoverProvider, { placement, trigger }, children);
|
|
12
|
+
return /* @__PURE__ */ React.createElement(Provider.PopoverProvider, { placement, trigger, ...props }, children);
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
exports.PopoverRoot = PopoverRoot;
|
|
@@ -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;
|
|
@@ -7,15 +7,18 @@ const useFloatingElement = ({
|
|
|
7
7
|
placement,
|
|
8
8
|
trigger,
|
|
9
9
|
delay,
|
|
10
|
-
arrowRef
|
|
10
|
+
arrowRef,
|
|
11
|
+
controlled,
|
|
12
|
+
isOpen,
|
|
13
|
+
setIsOpen
|
|
11
14
|
}) => {
|
|
12
|
-
const [
|
|
15
|
+
const [openUncontrolled, onOpenChangeUncontrolled] = React.useState(false);
|
|
13
16
|
const { x, y, strategy, refs, update, context, floatingStyles } = react.useFloating(
|
|
14
17
|
{
|
|
15
18
|
placement,
|
|
16
19
|
whileElementsMounted: react.autoUpdate,
|
|
17
|
-
open: isOpen,
|
|
18
|
-
onOpenChange: setIsOpen,
|
|
20
|
+
open: controlled ? isOpen : openUncontrolled,
|
|
21
|
+
onOpenChange: controlled ? setIsOpen : onOpenChangeUncontrolled,
|
|
19
22
|
middleware: [
|
|
20
23
|
react.offset(10),
|
|
21
24
|
react.flip({
|
|
@@ -38,15 +41,16 @@ const useFloatingElement = ({
|
|
|
38
41
|
hover
|
|
39
42
|
]);
|
|
40
43
|
React.useEffect(() => {
|
|
41
|
-
if (isOpen) update();
|
|
42
|
-
|
|
44
|
+
if (controlled && isOpen) update();
|
|
45
|
+
else if (openUncontrolled) update();
|
|
46
|
+
}, [openUncontrolled, update, isOpen]);
|
|
43
47
|
const triggerProps = {
|
|
44
48
|
ref: refs.setReference,
|
|
45
49
|
...getReferenceProps()
|
|
46
50
|
};
|
|
47
51
|
return {
|
|
48
|
-
isOpen,
|
|
49
|
-
setIsOpen,
|
|
52
|
+
isOpen: controlled ? isOpen : openUncontrolled,
|
|
53
|
+
setIsOpen: controlled ? setIsOpen : onOpenChangeUncontrolled,
|
|
50
54
|
x,
|
|
51
55
|
y,
|
|
52
56
|
strategy,
|
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');
|
|
@@ -114,6 +115,7 @@ exports.TimeFieldInput = TimeFieldInput.TimeFieldInput;
|
|
|
114
115
|
exports.Toggle = Toggle.Toggle;
|
|
115
116
|
exports.Tooltip = Tooltip.Tooltip;
|
|
116
117
|
exports.Uploader = index$5.Uploader;
|
|
118
|
+
exports.Stepper = index$6.Stepper;
|
|
117
119
|
exports.useCalendar = useCalendar.useCalendar;
|
|
118
120
|
exports.useCalendarCell = useCalendarCell.useCalendarCell;
|
|
119
121
|
exports.useCalendarGrid = useCalendarGrid.useCalendarGrid;
|
|
@@ -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;
|
|
@@ -11,9 +11,10 @@ import { Context } from './Context.js';
|
|
|
11
11
|
const PopoverProvider = ({
|
|
12
12
|
children,
|
|
13
13
|
placement,
|
|
14
|
-
trigger
|
|
14
|
+
trigger,
|
|
15
|
+
...props
|
|
15
16
|
}) => {
|
|
16
|
-
const floatingLogic = useFloatingElement({ placement, trigger });
|
|
17
|
+
const floatingLogic = useFloatingElement({ placement, trigger, ...props });
|
|
17
18
|
return /* @__PURE__ */ React__default.createElement(Context.Provider, { value: { ...floatingLogic } }, children);
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -4,9 +4,10 @@ import { PopoverProvider } from './Provider.js';
|
|
|
4
4
|
const PopoverRoot = ({
|
|
5
5
|
children,
|
|
6
6
|
placement,
|
|
7
|
-
trigger
|
|
7
|
+
trigger,
|
|
8
|
+
...props
|
|
8
9
|
}) => {
|
|
9
|
-
return /* @__PURE__ */ React__default.createElement(PopoverProvider, { placement, trigger }, children);
|
|
10
|
+
return /* @__PURE__ */ React__default.createElement(PopoverProvider, { placement, trigger, ...props }, children);
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export { PopoverRoot };
|
|
@@ -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 };
|
|
@@ -5,15 +5,18 @@ const useFloatingElement = ({
|
|
|
5
5
|
placement,
|
|
6
6
|
trigger,
|
|
7
7
|
delay,
|
|
8
|
-
arrowRef
|
|
8
|
+
arrowRef,
|
|
9
|
+
controlled,
|
|
10
|
+
isOpen,
|
|
11
|
+
setIsOpen
|
|
9
12
|
}) => {
|
|
10
|
-
const [
|
|
13
|
+
const [openUncontrolled, onOpenChangeUncontrolled] = useState(false);
|
|
11
14
|
const { x, y, strategy, refs, update, context, floatingStyles } = useFloating(
|
|
12
15
|
{
|
|
13
16
|
placement,
|
|
14
17
|
whileElementsMounted: autoUpdate,
|
|
15
|
-
open: isOpen,
|
|
16
|
-
onOpenChange: setIsOpen,
|
|
18
|
+
open: controlled ? isOpen : openUncontrolled,
|
|
19
|
+
onOpenChange: controlled ? setIsOpen : onOpenChangeUncontrolled,
|
|
17
20
|
middleware: [
|
|
18
21
|
offset(10),
|
|
19
22
|
flip({
|
|
@@ -36,15 +39,16 @@ const useFloatingElement = ({
|
|
|
36
39
|
hover
|
|
37
40
|
]);
|
|
38
41
|
useEffect(() => {
|
|
39
|
-
if (isOpen) update();
|
|
40
|
-
|
|
42
|
+
if (controlled && isOpen) update();
|
|
43
|
+
else if (openUncontrolled) update();
|
|
44
|
+
}, [openUncontrolled, update, isOpen]);
|
|
41
45
|
const triggerProps = {
|
|
42
46
|
ref: refs.setReference,
|
|
43
47
|
...getReferenceProps()
|
|
44
48
|
};
|
|
45
49
|
return {
|
|
46
|
-
isOpen,
|
|
47
|
-
setIsOpen,
|
|
50
|
+
isOpen: controlled ? isOpen : openUncontrolled,
|
|
51
|
+
setIsOpen: controlled ? setIsOpen : onOpenChangeUncontrolled,
|
|
48
52
|
x,
|
|
49
53
|
y,
|
|
50
54
|
strategy,
|
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';
|
|
@@ -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 };
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { Placement } from '@floating-ui/react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
export interface
|
|
2
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
3
|
+
export interface ControlledProps {
|
|
4
|
+
controlled: true;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
7
|
+
}
|
|
8
|
+
export interface UncontrolledProviderProps {
|
|
4
9
|
children: ReactNode;
|
|
5
10
|
placement?: Placement;
|
|
6
11
|
trigger?: 'hover' | 'click';
|
|
12
|
+
controlled?: false;
|
|
13
|
+
}
|
|
14
|
+
export interface ControlledPopoverProviderProps extends Omit<UncontrolledProviderProps, 'controlled'>, ControlledProps {
|
|
7
15
|
}
|
|
8
|
-
export
|
|
16
|
+
export type PopoverProviderProps = UncontrolledProviderProps | ControlledPopoverProviderProps;
|
|
17
|
+
export declare const PopoverProvider: ({ children, placement, trigger, ...props }: PopoverProviderProps) => JSX.Element;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Placement } from '@floating-ui/react';
|
|
3
|
-
|
|
3
|
+
import { ControlledProps } from './Provider';
|
|
4
|
+
export interface UncontrolledPopoverProps {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
placement?: Placement;
|
|
6
7
|
trigger?: 'hover' | 'click';
|
|
8
|
+
controlled?: false;
|
|
7
9
|
}
|
|
8
|
-
export
|
|
10
|
+
export interface ControlledPopoverProps extends Omit<UncontrolledPopoverProps, 'controlled'>, ControlledProps {
|
|
11
|
+
}
|
|
12
|
+
export type PopoverRootProps = UncontrolledPopoverProps | ControlledPopoverProps;
|
|
13
|
+
export declare const PopoverRoot: ({ children, placement, trigger, ...props }: PopoverRootProps) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Popover: {
|
|
3
|
-
Root: ({ children, placement, trigger, }: import("./Root").PopoverRootProps) => JSX.Element;
|
|
3
|
+
Root: ({ children, placement, trigger, ...props }: import("./Root").PopoverRootProps) => JSX.Element;
|
|
4
4
|
Trigger: ({ children }: import("./Trigger").PopoverTriggerProps) => import("react").FunctionComponentElement<any>;
|
|
5
5
|
Content: ({ children, className, }: import("./Content").PopoverContentProps) => JSX.Element;
|
|
6
|
-
Provider: ({ children, placement, trigger, }: import("./Provider").PopoverProviderProps) => JSX.Element;
|
|
6
|
+
Provider: ({ children, placement, trigger, ...props }: import("./Provider").PopoverProviderProps) => JSX.Element;
|
|
7
7
|
};
|
|
@@ -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
|
+
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { Placement } from '@floating-ui/react';
|
|
2
|
-
import { RefObject } from 'react';
|
|
2
|
+
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
3
3
|
export type Delay = number | {
|
|
4
4
|
open?: number;
|
|
5
5
|
close?: number;
|
|
6
6
|
};
|
|
7
|
-
interface FloatingElementProps {
|
|
7
|
+
export interface FloatingElementProps {
|
|
8
8
|
placement?: Placement;
|
|
9
9
|
trigger?: 'hover' | 'click';
|
|
10
10
|
delay?: Delay;
|
|
11
11
|
arrowRef?: RefObject<SVGSVGElement>;
|
|
12
|
+
controlled?: boolean;
|
|
13
|
+
isOpen?: boolean;
|
|
14
|
+
setIsOpen?: Dispatch<SetStateAction<boolean>> | undefined;
|
|
12
15
|
}
|
|
13
|
-
export declare const useFloatingElement: ({ placement, trigger, delay, arrowRef, }: FloatingElementProps) => {
|
|
16
|
+
export declare const useFloatingElement: ({ placement, trigger, delay, arrowRef, controlled, isOpen, setIsOpen, }: FloatingElementProps) => {
|
|
14
17
|
isOpen: boolean;
|
|
15
|
-
setIsOpen:
|
|
18
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
16
19
|
x: number;
|
|
17
20
|
y: number;
|
|
18
21
|
strategy: import("@floating-ui/utils").Strategy;
|
|
@@ -47,4 +50,3 @@ export declare const useFloatingElement: ({ placement, trigger, delay, arrowRef,
|
|
|
47
50
|
getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
48
51
|
getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
49
52
|
};
|
|
50
|
-
export {};
|
|
@@ -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.0",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-dom": ">=18.0.0",
|
|
49
49
|
"tailwind": ">=3.3.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "db9ab6aab2ffeac3f02916553595bf44673ee595"
|
|
52
52
|
}
|