@tecsinapse/cortex-react 1.3.0-beta.14 → 1.3.0-beta.16
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/Input/Mask.js +54 -0
- package/dist/cjs/components/Input/index.js +5 -1
- package/dist/cjs/components/Menubar/Header.js +2 -2
- package/dist/cjs/components/Menubar/MostUsedList.js +2 -0
- package/dist/cjs/components/Popover/Trigger.js +2 -2
- package/dist/cjs/components/Select/Content.js +2 -8
- package/dist/cjs/components/Select/MultiGroupedOptions.js +26 -0
- package/dist/cjs/components/Select/MultiOption.js +32 -0
- package/dist/cjs/components/Select/MultiOptions.js +23 -0
- package/dist/cjs/components/Select/Root.js +3 -10
- package/dist/cjs/components/Select/Trigger.js +7 -5
- package/dist/cjs/components/Select/index.js +7 -1
- package/dist/cjs/components/Select/utils.js +14 -0
- package/dist/cjs/components/Tooltip.js +2 -1
- package/dist/cjs/components/utils.js +5 -0
- package/dist/cjs/provider/SnackbarProvider.js +2 -0
- package/dist/cjs/service/SnackbarSonner.js +2 -0
- package/dist/cjs/styles/menubar.js +2 -2
- package/dist/esm/components/Input/Mask.js +50 -0
- package/dist/esm/components/Input/index.js +5 -1
- package/dist/esm/components/Menubar/Header.js +2 -2
- package/dist/esm/components/Menubar/MostUsedList.js +2 -0
- package/dist/esm/components/Popover/Trigger.js +2 -2
- package/dist/esm/components/Select/Content.js +2 -8
- package/dist/esm/components/Select/MultiGroupedOptions.js +24 -0
- package/dist/esm/components/Select/MultiOption.js +30 -0
- package/dist/esm/components/Select/MultiOptions.js +21 -0
- package/dist/esm/components/Select/Root.js +3 -10
- package/dist/esm/components/Select/Trigger.js +7 -5
- package/dist/esm/components/Select/index.js +7 -1
- package/dist/esm/components/Select/utils.js +12 -0
- package/dist/esm/components/Tooltip.js +2 -1
- package/dist/esm/components/utils.js +5 -1
- package/dist/esm/provider/SnackbarProvider.js +2 -0
- package/dist/esm/service/SnackbarSonner.js +2 -0
- package/dist/esm/styles/menubar.js +2 -2
- package/dist/types/components/Input/Mask.d.ts +5 -0
- package/dist/types/components/Input/index.d.ts +3 -0
- package/dist/types/components/Input/types.d.ts +3 -0
- package/dist/types/components/Popover/Trigger.d.ts +1 -1
- package/dist/types/components/Popover/index.d.ts +1 -1
- package/dist/types/components/Select/Content.d.ts +2 -5
- package/dist/types/components/Select/MultiGroupedOptions.d.ts +6 -0
- package/dist/types/components/Select/MultiOption.d.ts +5 -0
- package/dist/types/components/Select/MultiOptions.d.ts +5 -0
- package/dist/types/components/Select/Root.d.ts +1 -1
- package/dist/types/components/Select/context.d.ts +1 -1
- package/dist/types/components/Select/index.d.ts +3 -0
- package/dist/types/components/Select/utils.d.ts +1 -0
- package/dist/types/components/utils.d.ts +2 -0
- package/dist/types/styles/menubar.d.ts +47 -43
- package/dist/types/tests/Input/Mask.test.d.ts +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactImask = require('react-imask');
|
|
5
|
+
var index = require('./index.js');
|
|
6
|
+
|
|
7
|
+
const useIMaskLocal = (mask, inputProps, ref) => {
|
|
8
|
+
const { ref: iMaskRef, maskRef } = reactImask.useIMask(mask, {
|
|
9
|
+
onAccept: () => inputProps.onChange?.(maskRef.current),
|
|
10
|
+
ref: ref ? ref : React.createRef()
|
|
11
|
+
});
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
if (inputProps.value === "") {
|
|
14
|
+
maskRef.current?.updateValue();
|
|
15
|
+
}
|
|
16
|
+
}, [maskRef, inputProps.value]);
|
|
17
|
+
return {
|
|
18
|
+
iMaskRef
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const InputMaskExpression = React.forwardRef(({ mask, ...rest }, ref) => {
|
|
22
|
+
const { iMaskRef } = useIMaskLocal({ mask }, rest, ref);
|
|
23
|
+
return /* @__PURE__ */ React.createElement(index.Input.Root, { ...rest, ref: iMaskRef });
|
|
24
|
+
});
|
|
25
|
+
const InputMaskNumber = React.forwardRef(
|
|
26
|
+
({ ...rest }, ref) => {
|
|
27
|
+
const mask = { mask: Number, scale: 2 };
|
|
28
|
+
const { iMaskRef } = useIMaskLocal(mask, rest, ref);
|
|
29
|
+
return /* @__PURE__ */ React.createElement(index.Input.Root, { ...rest, ref: iMaskRef });
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
const InputMaskCurrency = React.forwardRef(
|
|
33
|
+
({ ...rest }, ref) => {
|
|
34
|
+
const mask = {
|
|
35
|
+
mask: "R$ num",
|
|
36
|
+
blocks: {
|
|
37
|
+
num: {
|
|
38
|
+
mask: Number,
|
|
39
|
+
scale: 2,
|
|
40
|
+
thousandsSeparator: ".",
|
|
41
|
+
padFractionalZeros: true,
|
|
42
|
+
radix: ",",
|
|
43
|
+
mapToRadix: ["."]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const { iMaskRef } = useIMaskLocal(mask, rest, ref);
|
|
48
|
+
return /* @__PURE__ */ React.createElement(index.Input.Root, { ...rest, ref: iMaskRef });
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
exports.InputMaskCurrency = InputMaskCurrency;
|
|
53
|
+
exports.InputMaskExpression = InputMaskExpression;
|
|
54
|
+
exports.InputMaskNumber = InputMaskNumber;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var Box = require('./Box.js');
|
|
4
4
|
var Face = require('./Face.js');
|
|
5
5
|
var Left = require('./Left.js');
|
|
6
|
+
var Mask = require('./Mask.js');
|
|
6
7
|
var Right = require('./Right.js');
|
|
7
8
|
var Root = require('./Root.js');
|
|
8
9
|
var Search = require('./Search.js');
|
|
@@ -13,7 +14,10 @@ const Input = {
|
|
|
13
14
|
Box: Box.InputBox,
|
|
14
15
|
Left: Left.InputLeft,
|
|
15
16
|
Right: Right.InputRight,
|
|
16
|
-
Search: Search.InputSearch
|
|
17
|
+
Search: Search.InputSearch,
|
|
18
|
+
MaskCurrency: Mask.InputMaskCurrency,
|
|
19
|
+
MaskNumber: Mask.InputMaskNumber,
|
|
20
|
+
MaskExpression: Mask.InputMaskExpression
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
exports.Input = Input;
|
|
@@ -7,13 +7,13 @@ var io5 = require('react-icons/io5');
|
|
|
7
7
|
var MenubarProvider = require('../../provider/MenubarProvider.js');
|
|
8
8
|
require('../../provider/SnackbarProvider.js');
|
|
9
9
|
|
|
10
|
-
const {
|
|
10
|
+
const { header } = menubar.menubar();
|
|
11
11
|
const Header = ({ children, className, ...rest }) => {
|
|
12
12
|
const [show, setShow] = MenubarProvider.useMenubar();
|
|
13
13
|
return /* @__PURE__ */ React.createElement(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
|
-
className:
|
|
16
|
+
className: header({ className }),
|
|
17
17
|
"data-testid": "header-menubar",
|
|
18
18
|
...rest
|
|
19
19
|
},
|
|
@@ -18,6 +18,7 @@ require('react-icons/lia');
|
|
|
18
18
|
require('../Input/Box.js');
|
|
19
19
|
require('../Input/Face.js');
|
|
20
20
|
require('../Input/Left.js');
|
|
21
|
+
require('../Input/Mask.js');
|
|
21
22
|
require('../Input/Right.js');
|
|
22
23
|
require('../Input/Root.js');
|
|
23
24
|
require('../Input/Search.js');
|
|
@@ -31,6 +32,7 @@ require('../../styles/calendar-cell.js');
|
|
|
31
32
|
require('../../styles/groupButton.js');
|
|
32
33
|
require('../../styles/progressBar.js');
|
|
33
34
|
require('../Select/GroupedOptions.js');
|
|
35
|
+
require('../Select/MultiGroupedOptions.js');
|
|
34
36
|
require('../Select/context.js');
|
|
35
37
|
require('../Select/Trigger.js');
|
|
36
38
|
require('../Tag.js');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var React = require('react');
|
|
4
3
|
var Context = require('./Context.js');
|
|
4
|
+
var utils = require('../utils.js');
|
|
5
5
|
|
|
6
6
|
const PopoverTrigger = ({ children }) => {
|
|
7
7
|
const { triggerProps } = Context.usePopoverContext();
|
|
8
|
-
return
|
|
8
|
+
return utils.cloneWithProps(children, triggerProps);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.PopoverTrigger = PopoverTrigger;
|
|
@@ -7,21 +7,15 @@ require('react-stately');
|
|
|
7
7
|
var useOutsideClickListener = require('../../hooks/useOutsideClickListener.js');
|
|
8
8
|
require('@floating-ui/react');
|
|
9
9
|
var Context = require('../Popover/Context.js');
|
|
10
|
-
var context = require('./context.js');
|
|
11
10
|
|
|
12
|
-
const Content = ({
|
|
13
|
-
children,
|
|
14
|
-
keyExtractor,
|
|
15
|
-
labelExtractor,
|
|
16
|
-
value
|
|
17
|
-
}) => {
|
|
11
|
+
const Content = ({ children }) => {
|
|
18
12
|
const { setIsOpen } = Context.usePopoverContext();
|
|
19
13
|
const ref = React.useRef(null);
|
|
20
14
|
useOutsideClickListener.useOutsideClickListener({
|
|
21
15
|
ref,
|
|
22
16
|
onClickOutside: () => setIsOpen(false)
|
|
23
17
|
});
|
|
24
|
-
return /* @__PURE__ */ React.createElement(
|
|
18
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white", ref }, children);
|
|
25
19
|
};
|
|
26
20
|
|
|
27
21
|
module.exports = Content;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var index = require('./index.js');
|
|
6
|
+
var context = require('./context.js');
|
|
7
|
+
var utils = require('./utils.js');
|
|
8
|
+
|
|
9
|
+
const { groupedTitle, containerGrouped } = cortexCore.selectVariants();
|
|
10
|
+
const SelectMultiGroupedOptions = ({
|
|
11
|
+
onSelect,
|
|
12
|
+
groupedLabelExtractor,
|
|
13
|
+
options
|
|
14
|
+
}) => {
|
|
15
|
+
const { value: currentValue, keyExtractor } = React.useContext(context.SelectContext);
|
|
16
|
+
return /* @__PURE__ */ React.createElement("ul", { role: "select", className: containerGrouped() }, [...options ?? []].map(([key, value]) => /* @__PURE__ */ React.createElement("div", { key }, /* @__PURE__ */ React.createElement("span", { className: groupedTitle() }, groupedLabelExtractor?.(key)), value.map((option) => /* @__PURE__ */ React.createElement(
|
|
17
|
+
index.Select.MultiOption,
|
|
18
|
+
{
|
|
19
|
+
option,
|
|
20
|
+
key: keyExtractor(option),
|
|
21
|
+
onSelectOption: (option2) => utils.handleSelectMulti(option2, currentValue, onSelect)
|
|
22
|
+
}
|
|
23
|
+
)))));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.SelectMultiGroupedOptions = SelectMultiGroupedOptions;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var context = require('./context.js');
|
|
6
|
+
|
|
7
|
+
const SelectMultiOption = ({
|
|
8
|
+
onSelectOption,
|
|
9
|
+
option
|
|
10
|
+
}) => {
|
|
11
|
+
const { keyExtractor, labelExtractor, value } = React.useContext(context.SelectContext);
|
|
12
|
+
const inputRef = React.useRef(null);
|
|
13
|
+
const isChecked = React.useMemo(
|
|
14
|
+
() => value?.length > 0 && value.find((it) => keyExtractor(it) === keyExtractor(option)) !== void 0,
|
|
15
|
+
[value, option]
|
|
16
|
+
);
|
|
17
|
+
const onClickOption = React.useCallback(() => {
|
|
18
|
+
onSelectOption(option);
|
|
19
|
+
inputRef.current?.click();
|
|
20
|
+
}, [onSelectOption, inputRef]);
|
|
21
|
+
return /* @__PURE__ */ React.createElement("li", { onClick: onClickOption, className: cortexCore.option(), role: "option" }, /* @__PURE__ */ React.createElement(
|
|
22
|
+
"input",
|
|
23
|
+
{
|
|
24
|
+
type: "checkbox",
|
|
25
|
+
checked: isChecked,
|
|
26
|
+
className: cortexCore.checkbox({ className: "pointer-events-none" }),
|
|
27
|
+
ref: inputRef
|
|
28
|
+
}
|
|
29
|
+
), labelExtractor(option));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.SelectMultiOption = SelectMultiOption;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var index = require('./index.js');
|
|
5
|
+
var context = require('./context.js');
|
|
6
|
+
var utils = require('./utils.js');
|
|
7
|
+
|
|
8
|
+
const SelectMultiOptions = ({
|
|
9
|
+
onSelect,
|
|
10
|
+
options
|
|
11
|
+
}) => {
|
|
12
|
+
const { keyExtractor, value: currentValue } = React.useContext(context.SelectContext);
|
|
13
|
+
return /* @__PURE__ */ React.createElement("ul", { role: "select", className: "list-none" }, (options ?? []).map((option) => /* @__PURE__ */ React.createElement(
|
|
14
|
+
index.Select.MultiOption,
|
|
15
|
+
{
|
|
16
|
+
option,
|
|
17
|
+
key: keyExtractor(option),
|
|
18
|
+
onSelectOption: (option2) => utils.handleSelectMulti(option2, currentValue, onSelect)
|
|
19
|
+
}
|
|
20
|
+
)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.SelectMultiOptions = SelectMultiOptions;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var Content = require('./Content.js');
|
|
5
4
|
var index = require('../Popover/index.js');
|
|
5
|
+
var Content = require('./Content.js');
|
|
6
|
+
var context = require('./context.js');
|
|
6
7
|
|
|
7
8
|
const SelectRoot = ({
|
|
8
9
|
children,
|
|
@@ -10,15 +11,7 @@ const SelectRoot = ({
|
|
|
10
11
|
keyExtractor,
|
|
11
12
|
labelExtractor
|
|
12
13
|
}) => {
|
|
13
|
-
return /* @__PURE__ */ React.createElement(index.Popover.Provider, null, /* @__PURE__ */ React.createElement(index.Popover.Root, { placement: "bottom", trigger: "click" }, /* @__PURE__ */ React.createElement(
|
|
14
|
-
Content,
|
|
15
|
-
{
|
|
16
|
-
keyExtractor,
|
|
17
|
-
labelExtractor,
|
|
18
|
-
value
|
|
19
|
-
},
|
|
20
|
-
children
|
|
21
|
-
)));
|
|
14
|
+
return /* @__PURE__ */ React.createElement(index.Popover.Provider, null, /* @__PURE__ */ React.createElement(index.Popover.Root, { placement: "bottom", trigger: "click" }, /* @__PURE__ */ React.createElement(context.SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement(Content, null, children))));
|
|
22
15
|
};
|
|
23
16
|
|
|
24
17
|
exports.SelectRoot = SelectRoot;
|
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var io5 = require('react-icons/io5');
|
|
6
|
-
var context = require('./context.js');
|
|
7
6
|
var index = require('../Popover/index.js');
|
|
7
|
+
var context = require('./context.js');
|
|
8
8
|
|
|
9
9
|
const { button } = cortexCore.selectVariants();
|
|
10
10
|
const SelectTrigger = ({ label, disabled }) => {
|
|
11
11
|
const { value, labelExtractor } = React.useContext(context.SelectContext);
|
|
12
|
-
const placeholder = React.useMemo(
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const placeholder = React.useMemo(() => {
|
|
13
|
+
if (value?.length === 0 || !value) return label;
|
|
14
|
+
if (value?.length === 1) return labelExtractor(value[0]);
|
|
15
|
+
if (value?.length > 1) return `${value.length} items selected`;
|
|
16
|
+
return labelExtractor(value);
|
|
17
|
+
}, [label, value]);
|
|
16
18
|
return /* @__PURE__ */ React.createElement(index.Popover.Trigger, null, /* @__PURE__ */ React.createElement(
|
|
17
19
|
"button",
|
|
18
20
|
{
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var GroupedOptions = require('./GroupedOptions.js');
|
|
4
|
+
var MultiGroupedOptions = require('./MultiGroupedOptions.js');
|
|
5
|
+
var MultiOption = require('./MultiOption.js');
|
|
6
|
+
var MultiOptions = require('./MultiOptions.js');
|
|
4
7
|
var Option = require('./Option.js');
|
|
5
8
|
var Options = require('./Options.js');
|
|
6
9
|
var Popover = require('./Popover.js');
|
|
@@ -13,7 +16,10 @@ const Select = {
|
|
|
13
16
|
Popover: Popover.SelectPopover,
|
|
14
17
|
Options: Options.SelectOptions,
|
|
15
18
|
GroupedOptions: GroupedOptions.SelectGroupedOptions,
|
|
16
|
-
Option: Option.SelectOption
|
|
19
|
+
Option: Option.SelectOption,
|
|
20
|
+
MultiOptions: MultiOptions.SelectMultiOptions,
|
|
21
|
+
MultiGroupedOptions: MultiGroupedOptions.SelectMultiGroupedOptions,
|
|
22
|
+
MultiOption: MultiOption.SelectMultiOption
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
exports.Select = Select;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const handleSelectMulti = (option, value, onSelect) => {
|
|
4
|
+
const current = Array.from(value ?? []);
|
|
5
|
+
const indexOf = current.indexOf(option);
|
|
6
|
+
if (indexOf === -1) {
|
|
7
|
+
current.push(option);
|
|
8
|
+
} else {
|
|
9
|
+
current.splice(indexOf, 1);
|
|
10
|
+
}
|
|
11
|
+
onSelect(current);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.handleSelectMulti = handleSelectMulti;
|
|
@@ -7,6 +7,7 @@ var react = require('@floating-ui/react');
|
|
|
7
7
|
require('@internationalized/date');
|
|
8
8
|
require('react-aria');
|
|
9
9
|
require('react-stately');
|
|
10
|
+
var utils = require('./utils.js');
|
|
10
11
|
var useFloatingLogic = require('../hooks/useFloatingLogic.js');
|
|
11
12
|
|
|
12
13
|
const Tooltip = React.forwardRef(
|
|
@@ -30,7 +31,7 @@ const Tooltip = React.forwardRef(
|
|
|
30
31
|
context,
|
|
31
32
|
floatingStyles
|
|
32
33
|
} = useFloatingLogic.useFloatingLogic({ placement, arrowRef, trigger });
|
|
33
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
34
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, utils.cloneWithProps(children, triggerProps), isOpen ? /* @__PURE__ */ React.createElement(
|
|
34
35
|
"div",
|
|
35
36
|
{
|
|
36
37
|
ref: ref || refs.setFloating,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var date = require('@internationalized/date');
|
|
4
|
+
var React = require('react');
|
|
4
5
|
|
|
5
6
|
const getNameInitials = (name) => {
|
|
6
7
|
const nameSplit = name.split(" ");
|
|
@@ -20,7 +21,11 @@ const dateToCalendarDate = (value) => {
|
|
|
20
21
|
const calendarDateToDate = (value) => {
|
|
21
22
|
return value.toDate(date.getLocalTimeZone());
|
|
22
23
|
};
|
|
24
|
+
function cloneWithProps(children, triggerProps) {
|
|
25
|
+
return React.cloneElement(/* @__PURE__ */ React.createElement("div", null, children), triggerProps);
|
|
26
|
+
}
|
|
23
27
|
|
|
24
28
|
exports.calendarDateToDate = calendarDateToDate;
|
|
29
|
+
exports.cloneWithProps = cloneWithProps;
|
|
25
30
|
exports.dateToCalendarDate = dateToCalendarDate;
|
|
26
31
|
exports.getNameInitials = getNameInitials;
|
|
@@ -19,6 +19,7 @@ require('react-icons/lia');
|
|
|
19
19
|
require('../components/Input/Box.js');
|
|
20
20
|
require('../components/Input/Face.js');
|
|
21
21
|
require('../components/Input/Left.js');
|
|
22
|
+
require('../components/Input/Mask.js');
|
|
22
23
|
require('../components/Input/Right.js');
|
|
23
24
|
require('../components/Input/Root.js');
|
|
24
25
|
require('../components/Input/Search.js');
|
|
@@ -41,6 +42,7 @@ require('../styles/calendar-cell.js');
|
|
|
41
42
|
require('../styles/groupButton.js');
|
|
42
43
|
require('../styles/progressBar.js');
|
|
43
44
|
require('../components/Select/GroupedOptions.js');
|
|
45
|
+
require('../components/Select/MultiGroupedOptions.js');
|
|
44
46
|
require('../components/Select/context.js');
|
|
45
47
|
require('../components/Select/Trigger.js');
|
|
46
48
|
require('../components/Tag.js');
|
|
@@ -19,6 +19,7 @@ require('react-icons/lia');
|
|
|
19
19
|
require('../components/Input/Box.js');
|
|
20
20
|
require('../components/Input/Face.js');
|
|
21
21
|
require('../components/Input/Left.js');
|
|
22
|
+
require('../components/Input/Mask.js');
|
|
22
23
|
require('../components/Input/Right.js');
|
|
23
24
|
require('../components/Input/Root.js');
|
|
24
25
|
require('../components/Input/Search.js');
|
|
@@ -42,6 +43,7 @@ require('../styles/calendar-cell.js');
|
|
|
42
43
|
require('../styles/groupButton.js');
|
|
43
44
|
require('../styles/progressBar.js');
|
|
44
45
|
require('../components/Select/GroupedOptions.js');
|
|
46
|
+
require('../components/Select/MultiGroupedOptions.js');
|
|
45
47
|
require('../components/Select/context.js');
|
|
46
48
|
require('../components/Select/Trigger.js');
|
|
47
49
|
require('../components/Tag.js');
|
|
@@ -4,10 +4,10 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const menubar = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
|
|
7
|
+
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-[100]",
|
|
8
8
|
left: "flex items-center w-fit",
|
|
9
9
|
right: "flex items-center gap-x-deca",
|
|
10
|
-
dropdown: "w-full bg-white flex-1 shadow-default z-[100] px-[8vw]"
|
|
10
|
+
dropdown: "w-full bg-white flex-1 shadow-default z-[100] px-[8vw] absolute"
|
|
11
11
|
},
|
|
12
12
|
variants: {
|
|
13
13
|
show: {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { createRef, useEffect } from 'react';
|
|
2
|
+
import { useIMask } from 'react-imask';
|
|
3
|
+
import { Input } from './index.js';
|
|
4
|
+
|
|
5
|
+
const useIMaskLocal = (mask, inputProps, ref) => {
|
|
6
|
+
const { ref: iMaskRef, maskRef } = useIMask(mask, {
|
|
7
|
+
onAccept: () => inputProps.onChange?.(maskRef.current),
|
|
8
|
+
ref: ref ? ref : createRef()
|
|
9
|
+
});
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (inputProps.value === "") {
|
|
12
|
+
maskRef.current?.updateValue();
|
|
13
|
+
}
|
|
14
|
+
}, [maskRef, inputProps.value]);
|
|
15
|
+
return {
|
|
16
|
+
iMaskRef
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const InputMaskExpression = React.forwardRef(({ mask, ...rest }, ref) => {
|
|
20
|
+
const { iMaskRef } = useIMaskLocal({ mask }, rest, ref);
|
|
21
|
+
return /* @__PURE__ */ React.createElement(Input.Root, { ...rest, ref: iMaskRef });
|
|
22
|
+
});
|
|
23
|
+
const InputMaskNumber = React.forwardRef(
|
|
24
|
+
({ ...rest }, ref) => {
|
|
25
|
+
const mask = { mask: Number, scale: 2 };
|
|
26
|
+
const { iMaskRef } = useIMaskLocal(mask, rest, ref);
|
|
27
|
+
return /* @__PURE__ */ React.createElement(Input.Root, { ...rest, ref: iMaskRef });
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
const InputMaskCurrency = React.forwardRef(
|
|
31
|
+
({ ...rest }, ref) => {
|
|
32
|
+
const mask = {
|
|
33
|
+
mask: "R$ num",
|
|
34
|
+
blocks: {
|
|
35
|
+
num: {
|
|
36
|
+
mask: Number,
|
|
37
|
+
scale: 2,
|
|
38
|
+
thousandsSeparator: ".",
|
|
39
|
+
padFractionalZeros: true,
|
|
40
|
+
radix: ",",
|
|
41
|
+
mapToRadix: ["."]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const { iMaskRef } = useIMaskLocal(mask, rest, ref);
|
|
46
|
+
return /* @__PURE__ */ React.createElement(Input.Root, { ...rest, ref: iMaskRef });
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export { InputMaskCurrency, InputMaskExpression, InputMaskNumber };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InputBox } from './Box.js';
|
|
2
2
|
import { InputFace } from './Face.js';
|
|
3
3
|
import { InputLeft } from './Left.js';
|
|
4
|
+
import { InputMaskCurrency, InputMaskNumber, InputMaskExpression } from './Mask.js';
|
|
4
5
|
import { InputRight } from './Right.js';
|
|
5
6
|
import { InputRoot } from './Root.js';
|
|
6
7
|
import { InputSearch } from './Search.js';
|
|
@@ -11,7 +12,10 @@ const Input = {
|
|
|
11
12
|
Box: InputBox,
|
|
12
13
|
Left: InputLeft,
|
|
13
14
|
Right: InputRight,
|
|
14
|
-
Search: InputSearch
|
|
15
|
+
Search: InputSearch,
|
|
16
|
+
MaskCurrency: InputMaskCurrency,
|
|
17
|
+
MaskNumber: InputMaskNumber,
|
|
18
|
+
MaskExpression: InputMaskExpression
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
export { Input };
|
|
@@ -5,13 +5,13 @@ import { IoMenu } from 'react-icons/io5';
|
|
|
5
5
|
import { useMenubar } from '../../provider/MenubarProvider.js';
|
|
6
6
|
import '../../provider/SnackbarProvider.js';
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { header } = menubar();
|
|
9
9
|
const Header = ({ children, className, ...rest }) => {
|
|
10
10
|
const [show, setShow] = useMenubar();
|
|
11
11
|
return /* @__PURE__ */ React.createElement(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
|
-
className:
|
|
14
|
+
className: header({ className }),
|
|
15
15
|
"data-testid": "header-menubar",
|
|
16
16
|
...rest
|
|
17
17
|
},
|
|
@@ -16,6 +16,7 @@ import 'react-icons/lia';
|
|
|
16
16
|
import '../Input/Box.js';
|
|
17
17
|
import '../Input/Face.js';
|
|
18
18
|
import '../Input/Left.js';
|
|
19
|
+
import '../Input/Mask.js';
|
|
19
20
|
import '../Input/Right.js';
|
|
20
21
|
import '../Input/Root.js';
|
|
21
22
|
import '../Input/Search.js';
|
|
@@ -29,6 +30,7 @@ import '../../styles/calendar-cell.js';
|
|
|
29
30
|
import '../../styles/groupButton.js';
|
|
30
31
|
import '../../styles/progressBar.js';
|
|
31
32
|
import '../Select/GroupedOptions.js';
|
|
33
|
+
import '../Select/MultiGroupedOptions.js';
|
|
32
34
|
import '../Select/context.js';
|
|
33
35
|
import '../Select/Trigger.js';
|
|
34
36
|
import '../Tag.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { usePopoverContext } from './Context.js';
|
|
2
|
+
import { cloneWithProps } from '../utils.js';
|
|
3
3
|
|
|
4
4
|
const PopoverTrigger = ({ children }) => {
|
|
5
5
|
const { triggerProps } = usePopoverContext();
|
|
6
|
-
return
|
|
6
|
+
return cloneWithProps(children, triggerProps);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { PopoverTrigger };
|
|
@@ -5,21 +5,15 @@ import 'react-stately';
|
|
|
5
5
|
import { useOutsideClickListener } from '../../hooks/useOutsideClickListener.js';
|
|
6
6
|
import '@floating-ui/react';
|
|
7
7
|
import { usePopoverContext } from '../Popover/Context.js';
|
|
8
|
-
import { SelectContext } from './context.js';
|
|
9
8
|
|
|
10
|
-
const Content = ({
|
|
11
|
-
children,
|
|
12
|
-
keyExtractor,
|
|
13
|
-
labelExtractor,
|
|
14
|
-
value
|
|
15
|
-
}) => {
|
|
9
|
+
const Content = ({ children }) => {
|
|
16
10
|
const { setIsOpen } = usePopoverContext();
|
|
17
11
|
const ref = useRef(null);
|
|
18
12
|
useOutsideClickListener({
|
|
19
13
|
ref,
|
|
20
14
|
onClickOutside: () => setIsOpen(false)
|
|
21
15
|
});
|
|
22
|
-
return /* @__PURE__ */ React.createElement(
|
|
16
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white", ref }, children);
|
|
23
17
|
};
|
|
24
18
|
|
|
25
19
|
export { Content as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { Select } from './index.js';
|
|
4
|
+
import { SelectContext } from './context.js';
|
|
5
|
+
import { handleSelectMulti } from './utils.js';
|
|
6
|
+
|
|
7
|
+
const { groupedTitle, containerGrouped } = selectVariants();
|
|
8
|
+
const SelectMultiGroupedOptions = ({
|
|
9
|
+
onSelect,
|
|
10
|
+
groupedLabelExtractor,
|
|
11
|
+
options
|
|
12
|
+
}) => {
|
|
13
|
+
const { value: currentValue, keyExtractor } = useContext(SelectContext);
|
|
14
|
+
return /* @__PURE__ */ React.createElement("ul", { role: "select", className: containerGrouped() }, [...options ?? []].map(([key, value]) => /* @__PURE__ */ React.createElement("div", { key }, /* @__PURE__ */ React.createElement("span", { className: groupedTitle() }, groupedLabelExtractor?.(key)), value.map((option) => /* @__PURE__ */ React.createElement(
|
|
15
|
+
Select.MultiOption,
|
|
16
|
+
{
|
|
17
|
+
option,
|
|
18
|
+
key: keyExtractor(option),
|
|
19
|
+
onSelectOption: (option2) => handleSelectMulti(option2, currentValue, onSelect)
|
|
20
|
+
}
|
|
21
|
+
)))));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { SelectMultiGroupedOptions };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { option, checkbox } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React, { useContext, useRef, useMemo, useCallback } from 'react';
|
|
3
|
+
import { SelectContext } from './context.js';
|
|
4
|
+
|
|
5
|
+
const SelectMultiOption = ({
|
|
6
|
+
onSelectOption,
|
|
7
|
+
option: option$1
|
|
8
|
+
}) => {
|
|
9
|
+
const { keyExtractor, labelExtractor, value } = useContext(SelectContext);
|
|
10
|
+
const inputRef = useRef(null);
|
|
11
|
+
const isChecked = useMemo(
|
|
12
|
+
() => value?.length > 0 && value.find((it) => keyExtractor(it) === keyExtractor(option$1)) !== void 0,
|
|
13
|
+
[value, option$1]
|
|
14
|
+
);
|
|
15
|
+
const onClickOption = useCallback(() => {
|
|
16
|
+
onSelectOption(option$1);
|
|
17
|
+
inputRef.current?.click();
|
|
18
|
+
}, [onSelectOption, inputRef]);
|
|
19
|
+
return /* @__PURE__ */ React.createElement("li", { onClick: onClickOption, className: option(), role: "option" }, /* @__PURE__ */ React.createElement(
|
|
20
|
+
"input",
|
|
21
|
+
{
|
|
22
|
+
type: "checkbox",
|
|
23
|
+
checked: isChecked,
|
|
24
|
+
className: checkbox({ className: "pointer-events-none" }),
|
|
25
|
+
ref: inputRef
|
|
26
|
+
}
|
|
27
|
+
), labelExtractor(option$1));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { SelectMultiOption };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { Select } from './index.js';
|
|
3
|
+
import { SelectContext } from './context.js';
|
|
4
|
+
import { handleSelectMulti } from './utils.js';
|
|
5
|
+
|
|
6
|
+
const SelectMultiOptions = ({
|
|
7
|
+
onSelect,
|
|
8
|
+
options
|
|
9
|
+
}) => {
|
|
10
|
+
const { keyExtractor, value: currentValue } = useContext(SelectContext);
|
|
11
|
+
return /* @__PURE__ */ React.createElement("ul", { role: "select", className: "list-none" }, (options ?? []).map((option) => /* @__PURE__ */ React.createElement(
|
|
12
|
+
Select.MultiOption,
|
|
13
|
+
{
|
|
14
|
+
option,
|
|
15
|
+
key: keyExtractor(option),
|
|
16
|
+
onSelectOption: (option2) => handleSelectMulti(option2, currentValue, onSelect)
|
|
17
|
+
}
|
|
18
|
+
)));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { SelectMultiOptions };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Content from './Content.js';
|
|
3
2
|
import { Popover } from '../Popover/index.js';
|
|
3
|
+
import Content from './Content.js';
|
|
4
|
+
import { SelectContext } from './context.js';
|
|
4
5
|
|
|
5
6
|
const SelectRoot = ({
|
|
6
7
|
children,
|
|
@@ -8,15 +9,7 @@ const SelectRoot = ({
|
|
|
8
9
|
keyExtractor,
|
|
9
10
|
labelExtractor
|
|
10
11
|
}) => {
|
|
11
|
-
return /* @__PURE__ */ React.createElement(Popover.Provider, null, /* @__PURE__ */ React.createElement(Popover.Root, { placement: "bottom", trigger: "click" }, /* @__PURE__ */ React.createElement(
|
|
12
|
-
Content,
|
|
13
|
-
{
|
|
14
|
-
keyExtractor,
|
|
15
|
-
labelExtractor,
|
|
16
|
-
value
|
|
17
|
-
},
|
|
18
|
-
children
|
|
19
|
-
)));
|
|
12
|
+
return /* @__PURE__ */ React.createElement(Popover.Provider, null, /* @__PURE__ */ React.createElement(Popover.Root, { placement: "bottom", trigger: "click" }, /* @__PURE__ */ React.createElement(SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement(Content, null, children))));
|
|
20
13
|
};
|
|
21
14
|
|
|
22
15
|
export { SelectRoot };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
2
2
|
import React, { useContext, useMemo } from 'react';
|
|
3
3
|
import { IoChevronDownOutline } from 'react-icons/io5';
|
|
4
|
-
import { SelectContext } from './context.js';
|
|
5
4
|
import { Popover } from '../Popover/index.js';
|
|
5
|
+
import { SelectContext } from './context.js';
|
|
6
6
|
|
|
7
7
|
const { button } = selectVariants();
|
|
8
8
|
const SelectTrigger = ({ label, disabled }) => {
|
|
9
9
|
const { value, labelExtractor } = useContext(SelectContext);
|
|
10
|
-
const placeholder = useMemo(
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const placeholder = useMemo(() => {
|
|
11
|
+
if (value?.length === 0 || !value) return label;
|
|
12
|
+
if (value?.length === 1) return labelExtractor(value[0]);
|
|
13
|
+
if (value?.length > 1) return `${value.length} items selected`;
|
|
14
|
+
return labelExtractor(value);
|
|
15
|
+
}, [label, value]);
|
|
14
16
|
return /* @__PURE__ */ React.createElement(Popover.Trigger, null, /* @__PURE__ */ React.createElement(
|
|
15
17
|
"button",
|
|
16
18
|
{
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SelectGroupedOptions } from './GroupedOptions.js';
|
|
2
|
+
import { SelectMultiGroupedOptions } from './MultiGroupedOptions.js';
|
|
3
|
+
import { SelectMultiOption } from './MultiOption.js';
|
|
4
|
+
import { SelectMultiOptions } from './MultiOptions.js';
|
|
2
5
|
import { SelectOption } from './Option.js';
|
|
3
6
|
import { SelectOptions } from './Options.js';
|
|
4
7
|
import { SelectPopover } from './Popover.js';
|
|
@@ -11,7 +14,10 @@ const Select = {
|
|
|
11
14
|
Popover: SelectPopover,
|
|
12
15
|
Options: SelectOptions,
|
|
13
16
|
GroupedOptions: SelectGroupedOptions,
|
|
14
|
-
Option: SelectOption
|
|
17
|
+
Option: SelectOption,
|
|
18
|
+
MultiOptions: SelectMultiOptions,
|
|
19
|
+
MultiGroupedOptions: SelectMultiGroupedOptions,
|
|
20
|
+
MultiOption: SelectMultiOption
|
|
15
21
|
};
|
|
16
22
|
|
|
17
23
|
export { Select };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const handleSelectMulti = (option, value, onSelect) => {
|
|
2
|
+
const current = Array.from(value ?? []);
|
|
3
|
+
const indexOf = current.indexOf(option);
|
|
4
|
+
if (indexOf === -1) {
|
|
5
|
+
current.push(option);
|
|
6
|
+
} else {
|
|
7
|
+
current.splice(indexOf, 1);
|
|
8
|
+
}
|
|
9
|
+
onSelect(current);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { handleSelectMulti };
|
|
@@ -3,6 +3,7 @@ import { FloatingArrow } from '@floating-ui/react';
|
|
|
3
3
|
import '@internationalized/date';
|
|
4
4
|
import 'react-aria';
|
|
5
5
|
import 'react-stately';
|
|
6
|
+
import { cloneWithProps } from './utils.js';
|
|
6
7
|
import { useFloatingLogic } from '../hooks/useFloatingLogic.js';
|
|
7
8
|
|
|
8
9
|
const Tooltip = forwardRef(
|
|
@@ -26,7 +27,7 @@ const Tooltip = forwardRef(
|
|
|
26
27
|
context,
|
|
27
28
|
floatingStyles
|
|
28
29
|
} = useFloatingLogic({ placement, arrowRef, trigger });
|
|
29
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
30
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, cloneWithProps(children, triggerProps), isOpen ? /* @__PURE__ */ React.createElement(
|
|
30
31
|
"div",
|
|
31
32
|
{
|
|
32
33
|
ref: ref || refs.setFloating,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CalendarDate, getLocalTimeZone } from '@internationalized/date';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
|
|
3
4
|
const getNameInitials = (name) => {
|
|
4
5
|
const nameSplit = name.split(" ");
|
|
@@ -18,5 +19,8 @@ const dateToCalendarDate = (value) => {
|
|
|
18
19
|
const calendarDateToDate = (value) => {
|
|
19
20
|
return value.toDate(getLocalTimeZone());
|
|
20
21
|
};
|
|
22
|
+
function cloneWithProps(children, triggerProps) {
|
|
23
|
+
return React.cloneElement(/* @__PURE__ */ React.createElement("div", null, children), triggerProps);
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
export { calendarDateToDate, dateToCalendarDate, getNameInitials };
|
|
26
|
+
export { calendarDateToDate, cloneWithProps, dateToCalendarDate, getNameInitials };
|
|
@@ -17,6 +17,7 @@ import 'react-icons/lia';
|
|
|
17
17
|
import '../components/Input/Box.js';
|
|
18
18
|
import '../components/Input/Face.js';
|
|
19
19
|
import '../components/Input/Left.js';
|
|
20
|
+
import '../components/Input/Mask.js';
|
|
20
21
|
import '../components/Input/Right.js';
|
|
21
22
|
import '../components/Input/Root.js';
|
|
22
23
|
import '../components/Input/Search.js';
|
|
@@ -39,6 +40,7 @@ import '../styles/calendar-cell.js';
|
|
|
39
40
|
import '../styles/groupButton.js';
|
|
40
41
|
import '../styles/progressBar.js';
|
|
41
42
|
import '../components/Select/GroupedOptions.js';
|
|
43
|
+
import '../components/Select/MultiGroupedOptions.js';
|
|
42
44
|
import '../components/Select/context.js';
|
|
43
45
|
import '../components/Select/Trigger.js';
|
|
44
46
|
import '../components/Tag.js';
|
|
@@ -17,6 +17,7 @@ import 'react-icons/lia';
|
|
|
17
17
|
import '../components/Input/Box.js';
|
|
18
18
|
import '../components/Input/Face.js';
|
|
19
19
|
import '../components/Input/Left.js';
|
|
20
|
+
import '../components/Input/Mask.js';
|
|
20
21
|
import '../components/Input/Right.js';
|
|
21
22
|
import '../components/Input/Root.js';
|
|
22
23
|
import '../components/Input/Search.js';
|
|
@@ -40,6 +41,7 @@ import '../styles/calendar-cell.js';
|
|
|
40
41
|
import '../styles/groupButton.js';
|
|
41
42
|
import '../styles/progressBar.js';
|
|
42
43
|
import '../components/Select/GroupedOptions.js';
|
|
44
|
+
import '../components/Select/MultiGroupedOptions.js';
|
|
43
45
|
import '../components/Select/context.js';
|
|
44
46
|
import '../components/Select/Trigger.js';
|
|
45
47
|
import '../components/Tag.js';
|
|
@@ -2,10 +2,10 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const menubar = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
|
|
5
|
+
header: "relative w-screen px-kilo py-deca flex flex-row justify-between bg-white z-[100]",
|
|
6
6
|
left: "flex items-center w-fit",
|
|
7
7
|
right: "flex items-center gap-x-deca",
|
|
8
|
-
dropdown: "w-full bg-white flex-1 shadow-default z-[100] px-[8vw]"
|
|
8
|
+
dropdown: "w-full bg-white flex-1 shadow-default z-[100] px-[8vw] absolute"
|
|
9
9
|
},
|
|
10
10
|
variants: {
|
|
11
11
|
show: {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputMaskProps, InputProps } from './types';
|
|
3
|
+
export declare const InputMaskExpression: React.ForwardRefExoticComponent<InputMaskProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
|
+
export declare const InputMaskNumber: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export declare const InputMaskCurrency: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -5,5 +5,8 @@ export declare const Input: {
|
|
|
5
5
|
Left: import("react").ForwardRefExoticComponent<import("./types").InputLeftProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Right: import("react").ForwardRefExoticComponent<import("./types").InputRightProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
7
|
Search: import("react").ForwardRefExoticComponent<import("./types").InputSearchProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
8
|
+
MaskCurrency: import("react").ForwardRefExoticComponent<import("./types").InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
9
|
+
MaskNumber: import("react").ForwardRefExoticComponent<import("./types").InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
|
+
MaskExpression: import("react").ForwardRefExoticComponent<import("./types").InputMaskProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
8
11
|
};
|
|
9
12
|
export * from './types';
|
|
@@ -2,4 +2,4 @@ import React from 'react';
|
|
|
2
2
|
export interface PopoverTriggerProps {
|
|
3
3
|
children: React.ReactElement;
|
|
4
4
|
}
|
|
5
|
-
export declare const PopoverTrigger: ({ children }: PopoverTriggerProps) => React.
|
|
5
|
+
export declare const PopoverTrigger: ({ children }: PopoverTriggerProps) => React.FunctionComponentElement<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const Popover: {
|
|
2
2
|
Root: ({ children, placement, trigger, }: import("./Root").PopoverRootProps) => JSX.Element;
|
|
3
|
-
Trigger: ({ children }: import("./Trigger").PopoverTriggerProps) => import("react").
|
|
3
|
+
Trigger: ({ children }: import("./Trigger").PopoverTriggerProps) => import("react").FunctionComponentElement<any>;
|
|
4
4
|
Content: ({ children, className, }: import("./Content").PopoverContentProps) => JSX.Element;
|
|
5
5
|
Provider: ({ children, placement, trigger, }: import("./Provider").PopoverProviderProps) => JSX.Element;
|
|
6
6
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
interface ContentProps
|
|
2
|
+
interface ContentProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
keyExtractor: (value: T) => string;
|
|
5
|
-
labelExtractor: (value: T) => string;
|
|
6
|
-
value?: T;
|
|
7
4
|
}
|
|
8
|
-
declare const Content:
|
|
5
|
+
declare const Content: ({ children }: ContentProps) => JSX.Element;
|
|
9
6
|
export default Content;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface SelectMultiGroupedOptionsProps<T> {
|
|
2
|
+
onSelect: (value: T[]) => void;
|
|
3
|
+
options?: Map<string, T[]>;
|
|
4
|
+
groupedLabelExtractor: (value: string) => string;
|
|
5
|
+
}
|
|
6
|
+
export declare const SelectMultiGroupedOptions: <T>({ onSelect, groupedLabelExtractor, options, }: SelectMultiGroupedOptionsProps<T>) => JSX.Element;
|
|
@@ -5,4 +5,7 @@ export declare const Select: {
|
|
|
5
5
|
Options: <T_1>({ onSelect, options, }: import("./Options").SelectOptionsProps<T_1>) => JSX.Element;
|
|
6
6
|
GroupedOptions: <T_2>({ onSelect, groupedLabelExtractor, options, }: import("./GroupedOptions").SelectGroupedOptionsProps<T_2>) => JSX.Element;
|
|
7
7
|
Option: <T_3>({ onSelectOption, option, }: import("./Option").SelectOptionProps<T_3>) => JSX.Element;
|
|
8
|
+
MultiOptions: <T_4>({ onSelect, options, }: import("./MultiOptions").SelectMultiOptionsProps<T_4>) => JSX.Element;
|
|
9
|
+
MultiGroupedOptions: <T_5>({ onSelect, groupedLabelExtractor, options, }: import("./MultiGroupedOptions").SelectMultiGroupedOptionsProps<T_5>) => JSX.Element;
|
|
10
|
+
MultiOption: <T_6>({ onSelectOption, option, }: import("./MultiOption").SelectMultiOptionProps<T_6>) => JSX.Element;
|
|
8
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const handleSelectMulti: <T>(option: T, value: T[], onSelect: (value: T[]) => void) => void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
export declare const getNameInitials: (name: string) => string;
|
|
3
4
|
export declare const dateToCalendarDate: (value?: Date) => CalendarDate;
|
|
4
5
|
export declare const calendarDateToDate: (value: CalendarDate) => Date;
|
|
6
|
+
export declare function cloneWithProps(children: React.ReactElement, triggerProps: any): React.FunctionComponentElement<any>;
|
|
@@ -1,64 +1,68 @@
|
|
|
1
1
|
export declare const menubar: import("tailwind-variants").TVReturnType<{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
root?: import("tailwind-merge").ClassNameValue;
|
|
7
|
-
dropdown?: import("tailwind-merge").ClassNameValue;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
} | {
|
|
11
|
-
[x: string]: {
|
|
12
|
-
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
13
|
-
right?: import("tailwind-merge").ClassNameValue;
|
|
14
|
-
left?: import("tailwind-merge").ClassNameValue;
|
|
15
|
-
root?: import("tailwind-merge").ClassNameValue;
|
|
16
|
-
dropdown?: import("tailwind-merge").ClassNameValue;
|
|
2
|
+
show: {
|
|
3
|
+
true: {
|
|
4
|
+
dropdown: string;
|
|
5
|
+
false: string;
|
|
17
6
|
};
|
|
18
7
|
};
|
|
19
|
-
}
|
|
20
|
-
|
|
8
|
+
}, {
|
|
9
|
+
header: string;
|
|
21
10
|
left: string;
|
|
22
11
|
right: string;
|
|
23
12
|
dropdown: string;
|
|
24
|
-
}, undefined, import("tailwind-variants/dist/config").TVConfig<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
root?: import("tailwind-merge").ClassNameValue;
|
|
30
|
-
dropdown?: import("tailwind-merge").ClassNameValue;
|
|
13
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
14
|
+
show: {
|
|
15
|
+
true: {
|
|
16
|
+
dropdown: string;
|
|
17
|
+
false: string;
|
|
31
18
|
};
|
|
32
19
|
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
root?: import("tailwind-merge").ClassNameValue;
|
|
39
|
-
dropdown?: import("tailwind-merge").ClassNameValue;
|
|
20
|
+
}, {
|
|
21
|
+
show: {
|
|
22
|
+
true: {
|
|
23
|
+
dropdown: string;
|
|
24
|
+
false: string;
|
|
40
25
|
};
|
|
41
26
|
};
|
|
42
|
-
}
|
|
43
|
-
|
|
27
|
+
}>, {
|
|
28
|
+
show: {
|
|
29
|
+
true: {
|
|
30
|
+
dropdown: string;
|
|
31
|
+
false: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
header: string;
|
|
44
36
|
left: string;
|
|
45
37
|
right: string;
|
|
46
38
|
dropdown: string;
|
|
47
|
-
}, import("tailwind-variants").TVReturnType<
|
|
48
|
-
|
|
39
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
40
|
+
show: {
|
|
41
|
+
true: {
|
|
42
|
+
dropdown: string;
|
|
43
|
+
false: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}, {
|
|
47
|
+
header: string;
|
|
49
48
|
left: string;
|
|
50
49
|
right: string;
|
|
51
50
|
dropdown: string;
|
|
52
|
-
}, undefined, import("tailwind-variants/dist/config").TVConfig<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
root?: import("tailwind-merge").ClassNameValue;
|
|
58
|
-
dropdown?: import("tailwind-merge").ClassNameValue;
|
|
51
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
52
|
+
show: {
|
|
53
|
+
true: {
|
|
54
|
+
dropdown: string;
|
|
55
|
+
false: string;
|
|
59
56
|
};
|
|
60
57
|
};
|
|
61
|
-
}
|
|
58
|
+
}, {
|
|
59
|
+
show: {
|
|
60
|
+
true: {
|
|
61
|
+
dropdown: string;
|
|
62
|
+
false: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}>, unknown, unknown, undefined>>;
|
|
62
66
|
export declare const mostUsed: import("tailwind-variants").TVReturnType<{
|
|
63
67
|
[key: string]: {
|
|
64
68
|
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.16",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@floating-ui/react": "^0.26.18",
|
|
22
22
|
"@internationalized/date": "*",
|
|
23
|
-
"@tecsinapse/cortex-core": "0.3.0-beta.
|
|
23
|
+
"@tecsinapse/cortex-core": "0.3.0-beta.8",
|
|
24
24
|
"clsx": "*",
|
|
25
25
|
"react-aria": "^3.33.1",
|
|
26
26
|
"react-icons": "^5.2.1",
|
|
27
|
+
"react-imask": "7.6.1",
|
|
27
28
|
"react-stately": "^3.31.1",
|
|
28
29
|
"sonner": "^1.5.0",
|
|
29
30
|
"tailwind-merge": "*"
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"react-dom": ">=18.0.0",
|
|
43
44
|
"tailwind": ">=3.3.0"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "61cbf81c03570640266b11e0330e7da91344006b"
|
|
46
47
|
}
|