@tecsinapse/cortex-react 1.3.0-beta.25 → 1.3.0-beta.27
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/Badge.js +21 -2
- package/dist/cjs/components/Calendar/RangeCalendar.js +1 -1
- package/dist/cjs/components/Input/Mask.js +13 -33
- package/dist/cjs/components/Input/index.js +1 -3
- package/dist/cjs/components/Input/masks.js +43 -0
- package/dist/cjs/components/Menubar/Header.js +2 -2
- package/dist/cjs/components/Menubar/Item.js +1 -1
- package/dist/cjs/components/Menubar/MostUsedList.js +5 -1
- package/dist/cjs/components/Popover/Trigger.js +1 -1
- package/dist/cjs/components/Select/Content.js +1 -1
- package/dist/cjs/components/Select/GroupedOptions.js +8 -1
- package/dist/cjs/components/Select/MultiCheckAllOptions.js +1 -1
- package/dist/cjs/components/Select/MultiGroupedOptions.js +12 -5
- package/dist/cjs/components/Select/MultiOptions.js +8 -1
- package/dist/cjs/components/Select/Options.js +8 -1
- package/dist/cjs/components/Select/SkeletonOptions.js +11 -0
- package/dist/cjs/components/Skeleton.js +1 -5
- package/dist/cjs/components/Snackbar/BaseSnackbar.js +1 -1
- package/dist/cjs/components/TextArea/Box.js +47 -0
- package/dist/cjs/components/TextArea/Face.js +27 -0
- package/dist/cjs/components/TextArea/Left.js +10 -0
- package/dist/cjs/components/TextArea/Right.js +10 -0
- package/dist/cjs/components/TextArea/Root.js +11 -0
- package/dist/cjs/components/TextArea/index.js +17 -0
- package/dist/cjs/components/TextArea/utils.js +11 -0
- package/dist/cjs/hooks/useSelectGroupedOptions.js +35 -0
- package/dist/cjs/hooks/useSelectOptions.js +35 -0
- package/dist/cjs/index.js +13 -4
- package/dist/cjs/service/SnackbarSonner.js +5 -1
- package/dist/esm/components/Avatar.js +6 -6
- package/dist/esm/components/Badge.js +2 -1
- package/dist/esm/components/Breadcrumbs/BreadcrumbItem.js +4 -4
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +3 -3
- package/dist/esm/components/Button.js +2 -2
- package/dist/esm/components/Calendar/Calendar.js +3 -3
- package/dist/esm/components/Calendar/CalendarCell.js +3 -3
- package/dist/esm/components/Calendar/CalendarGrid.js +3 -3
- package/dist/esm/components/Calendar/CalendarGridBodyRows.js +3 -3
- package/dist/esm/components/Calendar/CalendarGridHeaderRow.js +2 -2
- package/dist/esm/components/Calendar/CalendarHeader.js +7 -7
- package/dist/esm/components/Calendar/RangeCalendar.js +5 -5
- package/dist/esm/components/Card.js +2 -2
- package/dist/esm/components/DatePicker/DateField.js +3 -3
- package/dist/esm/components/DatePicker/DatePickerInput.js +5 -5
- package/dist/esm/components/DatePicker/DatePickerInputBase.js +2 -2
- package/dist/esm/components/DatePicker/DateRangePickerInput.js +6 -6
- package/dist/esm/components/DatePicker/DateSegment.js +3 -3
- package/dist/esm/components/Divider.js +2 -2
- package/dist/esm/components/Drawer.js +3 -3
- package/dist/esm/components/GroupButton.js +3 -3
- package/dist/esm/components/Hint.js +2 -2
- package/dist/esm/components/Input/Box.js +4 -4
- package/dist/esm/components/Input/Face.js +6 -6
- package/dist/esm/components/Input/Left.js +3 -3
- package/dist/esm/components/Input/Mask.js +14 -32
- package/dist/esm/components/Input/Right.js +3 -3
- package/dist/esm/components/Input/Root.js +3 -3
- package/dist/esm/components/Input/Search.js +3 -3
- package/dist/esm/components/Input/index.js +2 -4
- package/dist/esm/components/Input/masks.js +38 -0
- package/dist/esm/components/Masonry.js +6 -6
- package/dist/esm/components/Menubar/Categories.js +2 -2
- package/dist/esm/components/Menubar/Category.js +2 -2
- package/dist/esm/components/Menubar/Dropdown.js +2 -2
- package/dist/esm/components/Menubar/DropdownRoot.js +4 -4
- package/dist/esm/components/Menubar/Header.js +5 -5
- package/dist/esm/components/Menubar/IconControlSubItem.js +2 -2
- package/dist/esm/components/Menubar/Item.js +3 -3
- package/dist/esm/components/Menubar/ItemLink.js +2 -2
- package/dist/esm/components/Menubar/Left.js +2 -2
- package/dist/esm/components/Menubar/MostUsed.js +2 -2
- package/dist/esm/components/Menubar/MostUsedItem.js +4 -4
- package/dist/esm/components/Menubar/MostUsedList.js +9 -5
- package/dist/esm/components/Menubar/Right.js +2 -2
- package/dist/esm/components/Menubar/Root.js +2 -2
- package/dist/esm/components/Menubar/Search.js +2 -2
- package/dist/esm/components/Menubar/SubItem.js +2 -2
- package/dist/esm/components/Modal.js +3 -3
- package/dist/esm/components/Popover/Content.js +3 -3
- package/dist/esm/components/Popover/Provider.js +2 -2
- package/dist/esm/components/Popover/Root.js +2 -2
- package/dist/esm/components/Popover/Trigger.js +1 -1
- package/dist/esm/components/ProgressBar.js +4 -4
- package/dist/esm/components/RadioButton.js +4 -4
- package/dist/esm/components/Select/Content.js +3 -3
- package/dist/esm/components/Select/GroupedOptions.js +9 -2
- package/dist/esm/components/Select/MultiCheckAllOptions.js +4 -4
- package/dist/esm/components/Select/MultiGroupedOptions.js +13 -6
- package/dist/esm/components/Select/MultiOption.js +3 -3
- package/dist/esm/components/Select/MultiOptions.js +9 -2
- package/dist/esm/components/Select/Option.js +2 -2
- package/dist/esm/components/Select/Options.js +9 -2
- package/dist/esm/components/Select/Popover.js +2 -2
- package/dist/esm/components/Select/Root.js +2 -2
- package/dist/esm/components/Select/SkeletonOptions.js +9 -0
- package/dist/esm/components/Select/Trigger.js +4 -4
- package/dist/esm/components/Skeleton.js +3 -7
- package/dist/esm/components/Snackbar/BaseSnackbar.js +2 -2
- package/dist/esm/components/Snackbar/DefaultSnack.js +3 -3
- package/dist/esm/components/Table.js +9 -9
- package/dist/esm/components/Tag.js +2 -2
- package/dist/esm/components/TextArea/Box.js +45 -0
- package/dist/esm/components/TextArea/Face.js +25 -0
- package/dist/esm/components/TextArea/Left.js +8 -0
- package/dist/esm/components/TextArea/Right.js +8 -0
- package/dist/esm/components/TextArea/Root.js +9 -0
- package/dist/esm/components/TextArea/index.js +15 -0
- package/dist/esm/components/TextArea/utils.js +9 -0
- package/dist/esm/components/TimeField/TimeField.js +2 -2
- package/dist/esm/components/TimeField/TimeFieldInput.js +4 -4
- package/dist/esm/components/Toggle.js +4 -4
- package/dist/esm/components/Tooltip.js +4 -4
- package/dist/esm/components/utils.js +2 -2
- package/dist/esm/hooks/useSelectGroupedOptions.js +33 -0
- package/dist/esm/hooks/useSelectOptions.js +33 -0
- package/dist/esm/hooks/useTimeField.js +2 -2
- package/dist/esm/index.js +5 -2
- package/dist/esm/provider/MenubarProvider.js +3 -3
- package/dist/esm/provider/SnackbarProvider.js +2 -2
- package/dist/esm/service/SnackbarSonner.js +7 -3
- package/dist/types/components/Badge.d.ts +4 -5
- package/dist/types/components/Input/Mask.d.ts +2 -4
- package/dist/types/components/Input/index.d.ts +2 -3
- package/dist/types/components/Input/masks.d.ts +39 -0
- package/dist/types/components/Input/types.d.ts +11 -4
- package/dist/types/components/Popover/Provider.d.ts +1 -1
- package/dist/types/components/Select/SkeletonOptions.d.ts +1 -0
- package/dist/types/components/Select/types.d.ts +4 -4
- package/dist/types/components/Skeleton.d.ts +6 -4
- package/dist/types/components/Snackbar/BaseSnackbar.d.ts +1 -1
- package/dist/types/components/TextArea/Box.d.ts +3 -0
- package/dist/types/components/TextArea/Face.d.ts +3 -0
- package/dist/types/components/TextArea/Left.d.ts +3 -0
- package/dist/types/components/TextArea/Right.d.ts +3 -0
- package/dist/types/components/TextArea/Root.d.ts +3 -0
- package/dist/types/components/TextArea/index.d.ts +8 -0
- package/dist/types/components/TextArea/types.d.ts +15 -0
- package/dist/types/components/TextArea/utils.d.ts +2 -0
- package/dist/types/hooks/index.d.ts +3 -1
- package/dist/types/hooks/useSelectGroupedOptions.d.ts +9 -0
- package/dist/types/hooks/useSelectOptions.d.ts +9 -0
- package/package.json +2 -2
- package/dist/cjs/components/TextArea.js +0 -83
- package/dist/esm/components/TextArea.js +0 -81
- package/dist/types/components/TextArea.d.ts +0 -24
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FloatingArrow } from '@floating-ui/react';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef, useRef } from 'react';
|
|
3
3
|
import '@internationalized/date';
|
|
4
4
|
import 'react-aria';
|
|
5
5
|
import 'react-stately';
|
|
@@ -27,7 +27,7 @@ const Tooltip = forwardRef(
|
|
|
27
27
|
context,
|
|
28
28
|
floatingStyles
|
|
29
29
|
} = useFloatingLogic({ placement, arrowRef, trigger });
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, cloneWithProps(children, triggerProps), isOpen ? /* @__PURE__ */ React__default.createElement(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
33
|
ref: ref || refs.setFloating,
|
|
@@ -42,8 +42,8 @@ const Tooltip = forwardRef(
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
text,
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
) : /* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ React__default.createElement(FloatingArrow, { ref: arrowRef, context, fill: "black" })
|
|
46
|
+
) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null));
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
49
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CalendarDate, getLocalTimeZone } from '@internationalized/date';
|
|
2
|
-
import
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
|
|
4
4
|
const getNameInitials = (name) => {
|
|
5
5
|
const nameSplit = name.split(" ");
|
|
@@ -20,7 +20,7 @@ const calendarDateToDate = (value) => {
|
|
|
20
20
|
return value.toDate(getLocalTimeZone());
|
|
21
21
|
};
|
|
22
22
|
function cloneWithProps(children, triggerProps) {
|
|
23
|
-
return
|
|
23
|
+
return React__default.cloneElement(/* @__PURE__ */ React__default.createElement("div", null, children), triggerProps);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export { calendarDateToDate, cloneWithProps, dateToCalendarDate, getNameInitials };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useSelectGroupedOptions = ({
|
|
4
|
+
options: _options
|
|
5
|
+
}) => {
|
|
6
|
+
const [options, setOptions] = useState();
|
|
7
|
+
const [isLoading, setIsLoading] = useState();
|
|
8
|
+
const [error, setError] = useState();
|
|
9
|
+
const initData = async (fetch) => {
|
|
10
|
+
setIsLoading(true);
|
|
11
|
+
try {
|
|
12
|
+
const result = await fetch();
|
|
13
|
+
if (result) {
|
|
14
|
+
setOptions(result ?? []);
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {
|
|
17
|
+
setError(String(e));
|
|
18
|
+
} finally {
|
|
19
|
+
setIsLoading(false);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (typeof _options === "function") initData(_options);
|
|
24
|
+
else setOptions(_options);
|
|
25
|
+
}, [_options]);
|
|
26
|
+
return {
|
|
27
|
+
isLoading,
|
|
28
|
+
options,
|
|
29
|
+
error
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { useSelectGroupedOptions };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useSelectOptions = ({
|
|
4
|
+
options: _options
|
|
5
|
+
}) => {
|
|
6
|
+
const [options, setOptions] = useState();
|
|
7
|
+
const [isLoading, setIsLoading] = useState();
|
|
8
|
+
const [error, setError] = useState();
|
|
9
|
+
const initData = useCallback(async (fetch) => {
|
|
10
|
+
setIsLoading(true);
|
|
11
|
+
try {
|
|
12
|
+
const result = await fetch();
|
|
13
|
+
if (result) {
|
|
14
|
+
setOptions(result ?? []);
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {
|
|
17
|
+
setError(String(e));
|
|
18
|
+
} finally {
|
|
19
|
+
setIsLoading(false);
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (typeof _options === "function") initData(_options);
|
|
24
|
+
else setOptions(_options);
|
|
25
|
+
}, [_options]);
|
|
26
|
+
return {
|
|
27
|
+
isLoading,
|
|
28
|
+
options,
|
|
29
|
+
error
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { useSelectOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { useLocale, useTimeField as useTimeField$1 } from 'react-aria';
|
|
3
3
|
import { useTimeFieldState } from 'react-stately';
|
|
4
4
|
import { Time } from '@internationalized/date';
|
|
@@ -11,7 +11,7 @@ const useTimeField = (props) => {
|
|
|
11
11
|
onChange: (timeValue) => onChange({ hour: timeValue.hour, minute: timeValue.minute }),
|
|
12
12
|
locale
|
|
13
13
|
});
|
|
14
|
-
const ref =
|
|
14
|
+
const ref = React__default.useRef(null);
|
|
15
15
|
const { fieldProps } = useTimeField$1(
|
|
16
16
|
{
|
|
17
17
|
"aria-label": "time-field",
|
package/dist/esm/index.js
CHANGED
|
@@ -27,7 +27,7 @@ export { BaseSnackbar } from './components/Snackbar/BaseSnackbar.js';
|
|
|
27
27
|
export { DefaultSnack } from './components/Snackbar/DefaultSnack.js';
|
|
28
28
|
export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td } from './components/Table.js';
|
|
29
29
|
export { Tag } from './components/Tag.js';
|
|
30
|
-
export { TextArea } from './components/TextArea.js';
|
|
30
|
+
export { TextArea } from './components/TextArea/index.js';
|
|
31
31
|
export { TimeField } from './components/TimeField/TimeField.js';
|
|
32
32
|
export { TimeFieldInput } from './components/TimeField/TimeFieldInput.js';
|
|
33
33
|
export { Toggle } from './components/Toggle.js';
|
|
@@ -38,9 +38,12 @@ export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
|
38
38
|
export { useDatePickerInput } from './hooks/useDatePickerInput.js';
|
|
39
39
|
export { useDateRangePickerInput } from './hooks/useDateRangePickerInput.js';
|
|
40
40
|
export { useDebouncedState } from './hooks/useDebouncedState.js';
|
|
41
|
+
export { useFloatingLogic } from './hooks/useFloatingLogic.js';
|
|
41
42
|
export { useOutsideClickListener } from './hooks/useOutsideClickListener.js';
|
|
42
43
|
export { useRangeCalendar } from './hooks/useRangeCalendar.js';
|
|
43
|
-
export {
|
|
44
|
+
export { useSelectGroupedOptions } from './hooks/useSelectGroupedOptions.js';
|
|
45
|
+
export { useSelectOptions } from './hooks/useSelectOptions.js';
|
|
44
46
|
export { SnackbarSonner } from './service/SnackbarSonner.js';
|
|
45
47
|
export { MenubarProvider, useMenubar } from './provider/MenubarProvider.js';
|
|
46
48
|
export { SnackbarProvider, useSnackbar } from './provider/SnackbarProvider.js';
|
|
49
|
+
export { CurrencyIMask, ExpressionMasks, NumberIMask, PercentageIMask } from './components/Input/masks.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { createContext, useContext } from 'react';
|
|
2
2
|
|
|
3
3
|
const MenubarContext = createContext({
|
|
4
4
|
show: false,
|
|
5
5
|
setShow: () => void 0
|
|
6
6
|
});
|
|
7
7
|
const MenubarProvider = ({ children }) => {
|
|
8
|
-
const [show, setShow] =
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
const [show, setShow] = React__default.useState(false);
|
|
9
|
+
return /* @__PURE__ */ React__default.createElement(MenubarContext.Provider, { value: { show, setShow } }, children);
|
|
10
10
|
};
|
|
11
11
|
const useMenubar = () => {
|
|
12
12
|
const context = useContext(MenubarContext);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { createContext, useContext } from 'react';
|
|
2
2
|
import { SnackbarSonner } from '../service/SnackbarSonner.js';
|
|
3
3
|
import { Toaster } from 'sonner';
|
|
4
4
|
|
|
5
5
|
const SnackbarContext = createContext(null);
|
|
6
6
|
const SnackbarProvider = ({ children }) => {
|
|
7
7
|
const snackbar = new SnackbarSonner();
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ React__default.createElement(SnackbarContext.Provider, { value: { snackbar } }, children, /* @__PURE__ */ React__default.createElement(Toaster, null));
|
|
9
9
|
};
|
|
10
10
|
const useSnackbar = () => {
|
|
11
11
|
const context = useContext(SnackbarContext);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toast } from 'sonner';
|
|
2
|
-
import
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import 'clsx';
|
|
4
4
|
import '@internationalized/date';
|
|
5
5
|
import '../components/Badge.js';
|
|
@@ -48,7 +48,11 @@ import '../components/Select/Trigger.js';
|
|
|
48
48
|
import '../components/Snackbar/BaseSnackbar.js';
|
|
49
49
|
import { DefaultSnack } from '../components/Snackbar/DefaultSnack.js';
|
|
50
50
|
import '../components/Tag.js';
|
|
51
|
-
import '../components/TextArea.js';
|
|
51
|
+
import '../components/TextArea/Box.js';
|
|
52
|
+
import '../components/TextArea/Face.js';
|
|
53
|
+
import '../components/TextArea/Left.js';
|
|
54
|
+
import '../components/TextArea/Right.js';
|
|
55
|
+
import '../components/TextArea/Root.js';
|
|
52
56
|
import '../components/Toggle.js';
|
|
53
57
|
import '../components/Tooltip.js';
|
|
54
58
|
|
|
@@ -62,7 +66,7 @@ class SnackbarSonner {
|
|
|
62
66
|
show(type, message, options) {
|
|
63
67
|
return toast.custom(
|
|
64
68
|
(t) => {
|
|
65
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
66
70
|
DefaultSnack,
|
|
67
71
|
{
|
|
68
72
|
text: message,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { BadgeVariants } from '@tecsinapse/cortex-core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
interface BadgeProps {
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface BadgeProps {
|
|
4
4
|
value: string | number;
|
|
5
5
|
variants?: BadgeVariants;
|
|
6
6
|
}
|
|
7
|
-
interface BadgeAnchorProps extends BadgeProps {
|
|
8
|
-
children:
|
|
7
|
+
export interface BadgeAnchorProps extends BadgeProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
9
|
}
|
|
10
10
|
export declare const Badge: React.ForwardRefExoticComponent<Omit<BadgeProps & Omit<React.HTMLProps<HTMLDivElement>, "className">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
export declare const BadgeAnchor: React.ForwardRefExoticComponent<Omit<BadgeAnchorProps & Omit<React.HTMLProps<HTMLDivElement>, "className">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const InputMaskNumber: React.ForwardRefExoticComponent<InputMaskProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
-
export declare const InputMaskCurrency: React.ForwardRefExoticComponent<InputMaskProps & React.RefAttributes<HTMLInputElement>>;
|
|
2
|
+
import { InputMaskProps } from './types';
|
|
3
|
+
export declare const InputMask: React.ForwardRefExoticComponent<InputMaskProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -5,8 +5,7 @@ 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
|
-
|
|
9
|
-
MaskNumber: import("react").ForwardRefExoticComponent<import("./types").InputMaskProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
|
-
MaskExpression: import("react").ForwardRefExoticComponent<import("./types").InputMaskExpressionProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
8
|
+
Mask: import("react").ForwardRefExoticComponent<import("./types").InputMaskProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
11
9
|
};
|
|
10
|
+
export * from './masks';
|
|
12
11
|
export * from './types';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const ExpressionMasks: {
|
|
2
|
+
CPF: string;
|
|
3
|
+
CNPJ: string;
|
|
4
|
+
PHONE: string;
|
|
5
|
+
PHONE_EXTENDED: string;
|
|
6
|
+
DATE: string;
|
|
7
|
+
CEP: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const NumberIMask: {
|
|
10
|
+
mask: NumberConstructor;
|
|
11
|
+
scale: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const CurrencyIMask: {
|
|
14
|
+
mask: string;
|
|
15
|
+
blocks: {
|
|
16
|
+
num: {
|
|
17
|
+
mask: NumberConstructor;
|
|
18
|
+
scale: number;
|
|
19
|
+
thousandsSeparator: string;
|
|
20
|
+
padFractionalZeros: boolean;
|
|
21
|
+
radix: string;
|
|
22
|
+
mapToRadix: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const PercentageIMask: {
|
|
27
|
+
mask: string;
|
|
28
|
+
lazy: boolean;
|
|
29
|
+
blocks: {
|
|
30
|
+
num: {
|
|
31
|
+
mask: NumberConstructor;
|
|
32
|
+
scale: number;
|
|
33
|
+
thousandsSeparator: string;
|
|
34
|
+
padFractionalZeros: boolean;
|
|
35
|
+
radix: string;
|
|
36
|
+
mapToRadix: string[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InputBaseVariants } from '@tecsinapse/cortex-core';
|
|
2
|
-
import { MutableRefObject } from 'react';
|
|
3
2
|
export interface InputPropsBase {
|
|
4
3
|
variants?: InputBaseVariants;
|
|
5
4
|
label?: string;
|
|
@@ -19,9 +18,17 @@ export interface InputRightProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
19
18
|
export interface InputSearchProps extends InputProps {
|
|
20
19
|
bounceTimeout?: number;
|
|
21
20
|
}
|
|
22
|
-
export
|
|
23
|
-
|
|
21
|
+
export type InputMaskEvent = {
|
|
22
|
+
value: string;
|
|
23
|
+
unmaskedValue: string;
|
|
24
|
+
};
|
|
25
|
+
export interface Mask extends Record<string, any> {
|
|
26
|
+
mask: any;
|
|
27
|
+
}
|
|
28
|
+
export interface InputMaskProps extends Omit<InputProps, 'onChange'> {
|
|
29
|
+
onChange?: (e: InputMaskEvent) => void;
|
|
30
|
+
mask: Mask;
|
|
24
31
|
}
|
|
25
32
|
export interface InputMaskExpressionProps extends InputMaskProps {
|
|
26
|
-
mask:
|
|
33
|
+
mask: Mask;
|
|
27
34
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SkeletonOptions: () => JSX.Element;
|
|
@@ -4,7 +4,7 @@ export interface ContentProps {
|
|
|
4
4
|
}
|
|
5
5
|
export interface SelectGroupedOptionsProps<T> {
|
|
6
6
|
onSelect: (value: T) => void;
|
|
7
|
-
options?: Map<string, T[]
|
|
7
|
+
options?: Map<string, T[]> | (() => Promise<Map<string, T[]>>);
|
|
8
8
|
groupedLabelExtractor: (value: string) => string;
|
|
9
9
|
}
|
|
10
10
|
export interface SelectMultiCheckAllOptionsProps {
|
|
@@ -12,7 +12,7 @@ export interface SelectMultiCheckAllOptionsProps {
|
|
|
12
12
|
}
|
|
13
13
|
export interface SelectMultiGroupedOptionsProps<T> {
|
|
14
14
|
onSelect: (value: T[]) => void;
|
|
15
|
-
options?: Map<string, T[]
|
|
15
|
+
options?: Map<string, T[]> | (() => Promise<Map<string, T[]>>);
|
|
16
16
|
groupedLabelExtractor: (value: string) => string;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
}
|
|
@@ -22,7 +22,7 @@ export interface SelectMultiOptionProps<T> {
|
|
|
22
22
|
grouped?: boolean;
|
|
23
23
|
}
|
|
24
24
|
export interface SelectMultiOptionsProps<T> {
|
|
25
|
-
options?: T[];
|
|
25
|
+
options?: T[] | (() => Promise<T[]>);
|
|
26
26
|
onSelect: (value: T[]) => void;
|
|
27
27
|
children?: React.ReactNode;
|
|
28
28
|
}
|
|
@@ -32,7 +32,7 @@ export interface SelectOptionProps<T> {
|
|
|
32
32
|
grouped?: boolean;
|
|
33
33
|
}
|
|
34
34
|
export interface SelectOptionsProps<T> {
|
|
35
|
-
options?: T[];
|
|
35
|
+
options?: T[] | (() => Promise<T[]>);
|
|
36
36
|
onSelect: (value: T) => void;
|
|
37
37
|
}
|
|
38
38
|
export interface SelectPopoverProps {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
|
|
3
|
-
children?: ReactNode;
|
|
4
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare const Skeleton: ({ className, children, ...rest }: SkeletonProps) => JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TextArea: {
|
|
2
|
+
Root: import("react").ForwardRefExoticComponent<import("./types").TextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
3
|
+
Face: import("react").ForwardRefExoticComponent<import("./types").TextAreaFaceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
Box: import("react").ForwardRefExoticComponent<import("./types").TextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
5
|
+
Left: import("react").ForwardRefExoticComponent<import("./types").TextAreaElementsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
Right: import("react").ForwardRefExoticComponent<import("./types").TextAreaElementsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
};
|
|
8
|
+
export * from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InputBaseVariants } from '@tecsinapse/cortex-core';
|
|
2
|
+
export type DivBaseProps = React.HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
export interface TextAreaElementsProps extends DivBaseProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TextAreaPropsBase {
|
|
8
|
+
variants?: InputBaseVariants;
|
|
9
|
+
label?: string;
|
|
10
|
+
rows?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement>, TextAreaPropsBase {
|
|
13
|
+
}
|
|
14
|
+
export interface TextAreaFaceProps extends DivBaseProps, Pick<TextAreaPropsBase, 'variants'> {
|
|
15
|
+
}
|
|
@@ -4,6 +4,8 @@ export * from './useCalendarGrid';
|
|
|
4
4
|
export * from './useDatePickerInput';
|
|
5
5
|
export * from './useDateRangePickerInput';
|
|
6
6
|
export * from './useDebouncedState';
|
|
7
|
+
export * from './useFloatingLogic';
|
|
7
8
|
export * from './useOutsideClickListener';
|
|
8
9
|
export * from './useRangeCalendar';
|
|
9
|
-
export * from './
|
|
10
|
+
export * from './useSelectGroupedOptions';
|
|
11
|
+
export * from './useSelectOptions';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface useSelectGroupedOptionsProps<T> {
|
|
2
|
+
options?: Map<string, T[]> | (() => Promise<Map<string, T[]>>);
|
|
3
|
+
}
|
|
4
|
+
export declare const useSelectGroupedOptions: <T>({ options: _options, }: useSelectGroupedOptionsProps<T>) => {
|
|
5
|
+
isLoading: boolean | undefined;
|
|
6
|
+
options: Map<string, T[]> | undefined;
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface useSelectOptionsProps<T> {
|
|
2
|
+
options?: T[] | (() => Promise<T[]>);
|
|
3
|
+
}
|
|
4
|
+
export declare const useSelectOptions: <T>({ options: _options, }: useSelectOptionsProps<T>) => {
|
|
5
|
+
isLoading: boolean | undefined;
|
|
6
|
+
options: T[] | undefined;
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
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.27",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"react-dom": ">=18.0.0",
|
|
44
44
|
"tailwind": ">=3.3.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "43a88a5a80a54451f5e2621363f7164927e5ef47"
|
|
47
47
|
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
-
var clsx = require('clsx');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
|
|
7
|
-
const getValidChildren = (children) => {
|
|
8
|
-
return React.Children.toArray(children).filter(
|
|
9
|
-
(el) => React.isValidElement(el)
|
|
10
|
-
);
|
|
11
|
-
};
|
|
12
|
-
const Box = React.forwardRef(
|
|
13
|
-
({ id, name, variants, label, placeholder, rows, className, ...rest }, ref) => {
|
|
14
|
-
return /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-col" }, /* @__PURE__ */ React.createElement(
|
|
15
|
-
"textarea",
|
|
16
|
-
{
|
|
17
|
-
"data-testid": "textarea-box",
|
|
18
|
-
ref,
|
|
19
|
-
id: id ?? name,
|
|
20
|
-
name,
|
|
21
|
-
placeholder: placeholder ?? " ",
|
|
22
|
-
className: clsx.clsx(
|
|
23
|
-
cortexCore.inputBox(placeholder, label, className),
|
|
24
|
-
"resize-none mt-mili"
|
|
25
|
-
),
|
|
26
|
-
rows,
|
|
27
|
-
...rest
|
|
28
|
-
}
|
|
29
|
-
), /* @__PURE__ */ React.createElement(
|
|
30
|
-
"label",
|
|
31
|
-
{
|
|
32
|
-
htmlFor: id ?? name,
|
|
33
|
-
className: cortexCore.labelStyle({
|
|
34
|
-
intent: variants?.intent,
|
|
35
|
-
placeholder
|
|
36
|
-
})
|
|
37
|
-
},
|
|
38
|
-
label
|
|
39
|
-
));
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
const Face = React.forwardRef(
|
|
43
|
-
({ children, variants, className, ...rest }, ref) => {
|
|
44
|
-
const clones = getValidChildren(children).map((el) => {
|
|
45
|
-
return React.cloneElement(el, { ...el.props, variants });
|
|
46
|
-
});
|
|
47
|
-
return /* @__PURE__ */ React.createElement(
|
|
48
|
-
"div",
|
|
49
|
-
{
|
|
50
|
-
ref,
|
|
51
|
-
className: clsx.clsx(cortexCore.input(variants), className),
|
|
52
|
-
"data-testid": "textarea-face",
|
|
53
|
-
id: "textarea-face",
|
|
54
|
-
...rest
|
|
55
|
-
},
|
|
56
|
-
clones
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
const Root = React.forwardRef(
|
|
61
|
-
({ variants, className, ...rest }, ref) => {
|
|
62
|
-
return /* @__PURE__ */ React.createElement(Face, { variants, className }, /* @__PURE__ */ React.createElement(Box, { ref, ...rest }));
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
const Left = React.forwardRef(
|
|
66
|
-
({ children, className, ...rest }, ref) => {
|
|
67
|
-
return /* @__PURE__ */ React.createElement("div", { className: clsx.clsx(className, "mr-2.5"), ...rest, ref }, children);
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
const Right = React.forwardRef(
|
|
71
|
-
({ children, className, ...rest }, ref) => {
|
|
72
|
-
return /* @__PURE__ */ React.createElement("div", { className: clsx.clsx(className, "ml-2.5"), ...rest, ref }, children);
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
const TextArea = {
|
|
76
|
-
Root,
|
|
77
|
-
Face,
|
|
78
|
-
Box,
|
|
79
|
-
Left,
|
|
80
|
-
Right
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
exports.TextArea = TextArea;
|