@tecsinapse/cortex-react 1.3.0-beta.24 → 1.3.0-beta.26
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/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 +14 -4
- package/dist/cjs/provider/SnackbarProvider.js +17 -52
- 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 +7 -7
- 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/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 +6 -2
- package/dist/esm/provider/MenubarProvider.js +3 -3
- package/dist/esm/provider/SnackbarProvider.js +17 -53
- package/dist/esm/service/SnackbarSonner.js +7 -3
- package/dist/types/components/Badge.d.ts +4 -5
- 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/dist/types/index.d.ts +1 -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,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,7 +38,11 @@ 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';
|
|
47
|
+
export { MenubarProvider, useMenubar } from './provider/MenubarProvider.js';
|
|
48
|
+
export { SnackbarProvider, useSnackbar } from './provider/SnackbarProvider.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,54 +1,18 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
4
|
-
import '@internationalized/date';
|
|
5
|
-
import '../components/Badge.js';
|
|
6
|
-
import 'react-icons/md';
|
|
7
|
-
import '../components/Card.js';
|
|
8
|
-
import '../components/Button.js';
|
|
9
|
-
import 'react-aria';
|
|
10
|
-
import 'react-stately';
|
|
11
|
-
import '@floating-ui/react';
|
|
12
|
-
import '../components/Calendar/CalendarCell.js';
|
|
13
|
-
import '@tecsinapse/cortex-core';
|
|
14
|
-
import 'react-icons/fa';
|
|
15
|
-
import 'react-icons/lia';
|
|
16
|
-
import '../components/Input/Box.js';
|
|
17
|
-
import '../components/Input/Face.js';
|
|
18
|
-
import '../components/Input/Left.js';
|
|
19
|
-
import '../components/Input/Mask.js';
|
|
20
|
-
import '../components/Input/Right.js';
|
|
21
|
-
import '../components/Input/Root.js';
|
|
22
|
-
import '../components/Input/Search.js';
|
|
23
|
-
import '../components/GroupButton.js';
|
|
24
|
-
import '../components/Hint.js';
|
|
25
|
-
import './MenubarProvider.js';
|
|
26
|
-
import '../components/Menubar/Left.js';
|
|
27
|
-
import '../styles/menubar.js';
|
|
28
|
-
import '../components/Menubar/Right.js';
|
|
29
|
-
import '../components/Menubar/Dropdown.js';
|
|
30
|
-
import '../components/Menubar/MostUsed.js';
|
|
31
|
-
import '../components/Menubar/MostUsedItem.js';
|
|
32
|
-
import '../components/Menubar/Header.js';
|
|
33
|
-
import '../components/Menubar/Item.js';
|
|
34
|
-
import '../components/Menubar/SubItem.js';
|
|
35
|
-
import '../components/Modal.js';
|
|
36
|
-
import '../components/Popover/Context.js';
|
|
37
|
-
import '../styles/calendar-cell.js';
|
|
38
|
-
import '../styles/groupButton.js';
|
|
39
|
-
import '../styles/progressBar.js';
|
|
40
|
-
import '../components/RadioButton.js';
|
|
41
|
-
import '../components/Select/GroupedOptions.js';
|
|
42
|
-
import '../components/Select/context.js';
|
|
43
|
-
import '../components/Select/MultiGroupedOptions.js';
|
|
44
|
-
import '../components/Select/MultiOptions.js';
|
|
45
|
-
import '../components/Select/Options.js';
|
|
46
|
-
import '../components/Select/Trigger.js';
|
|
47
|
-
import '../components/Snackbar/BaseSnackbar.js';
|
|
48
|
-
import 'react-icons/io';
|
|
49
|
-
import '../components/Tag.js';
|
|
50
|
-
import '../components/TextArea.js';
|
|
51
|
-
import '../components/Toggle.js';
|
|
52
|
-
import '../components/Tooltip.js';
|
|
1
|
+
import React__default, { createContext, useContext } from 'react';
|
|
2
|
+
import { SnackbarSonner } from '../service/SnackbarSonner.js';
|
|
3
|
+
import { Toaster } from 'sonner';
|
|
53
4
|
|
|
54
|
-
createContext(null);
|
|
5
|
+
const SnackbarContext = createContext(null);
|
|
6
|
+
const SnackbarProvider = ({ children }) => {
|
|
7
|
+
const snackbar = new SnackbarSonner();
|
|
8
|
+
return /* @__PURE__ */ React__default.createElement(SnackbarContext.Provider, { value: { snackbar } }, children, /* @__PURE__ */ React__default.createElement(Toaster, null));
|
|
9
|
+
};
|
|
10
|
+
const useSnackbar = () => {
|
|
11
|
+
const context = useContext(SnackbarContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { SnackbarProvider, useSnackbar };
|
|
@@ -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 {};
|
|
@@ -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/dist/types/index.d.ts
CHANGED
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.26",
|
|
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": "4a75bfc17fd179e230c266d71cd7b1d7d82d2df5"
|
|
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;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { inputBox, labelStyle, input } from '@tecsinapse/cortex-core';
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
const getValidChildren = (children) => {
|
|
6
|
-
return React.Children.toArray(children).filter(
|
|
7
|
-
(el) => React.isValidElement(el)
|
|
8
|
-
);
|
|
9
|
-
};
|
|
10
|
-
const Box = React.forwardRef(
|
|
11
|
-
({ id, name, variants, label, placeholder, rows, className, ...rest }, ref) => {
|
|
12
|
-
return /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-col" }, /* @__PURE__ */ React.createElement(
|
|
13
|
-
"textarea",
|
|
14
|
-
{
|
|
15
|
-
"data-testid": "textarea-box",
|
|
16
|
-
ref,
|
|
17
|
-
id: id ?? name,
|
|
18
|
-
name,
|
|
19
|
-
placeholder: placeholder ?? " ",
|
|
20
|
-
className: clsx(
|
|
21
|
-
inputBox(placeholder, label, className),
|
|
22
|
-
"resize-none mt-mili"
|
|
23
|
-
),
|
|
24
|
-
rows,
|
|
25
|
-
...rest
|
|
26
|
-
}
|
|
27
|
-
), /* @__PURE__ */ React.createElement(
|
|
28
|
-
"label",
|
|
29
|
-
{
|
|
30
|
-
htmlFor: id ?? name,
|
|
31
|
-
className: labelStyle({
|
|
32
|
-
intent: variants?.intent,
|
|
33
|
-
placeholder
|
|
34
|
-
})
|
|
35
|
-
},
|
|
36
|
-
label
|
|
37
|
-
));
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
const Face = React.forwardRef(
|
|
41
|
-
({ children, variants, className, ...rest }, ref) => {
|
|
42
|
-
const clones = getValidChildren(children).map((el) => {
|
|
43
|
-
return React.cloneElement(el, { ...el.props, variants });
|
|
44
|
-
});
|
|
45
|
-
return /* @__PURE__ */ React.createElement(
|
|
46
|
-
"div",
|
|
47
|
-
{
|
|
48
|
-
ref,
|
|
49
|
-
className: clsx(input(variants), className),
|
|
50
|
-
"data-testid": "textarea-face",
|
|
51
|
-
id: "textarea-face",
|
|
52
|
-
...rest
|
|
53
|
-
},
|
|
54
|
-
clones
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
const Root = React.forwardRef(
|
|
59
|
-
({ variants, className, ...rest }, ref) => {
|
|
60
|
-
return /* @__PURE__ */ React.createElement(Face, { variants, className }, /* @__PURE__ */ React.createElement(Box, { ref, ...rest }));
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
const Left = React.forwardRef(
|
|
64
|
-
({ children, className, ...rest }, ref) => {
|
|
65
|
-
return /* @__PURE__ */ React.createElement("div", { className: clsx(className, "mr-2.5"), ...rest, ref }, children);
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
const Right = React.forwardRef(
|
|
69
|
-
({ children, className, ...rest }, ref) => {
|
|
70
|
-
return /* @__PURE__ */ React.createElement("div", { className: clsx(className, "ml-2.5"), ...rest, ref }, children);
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
const TextArea = {
|
|
74
|
-
Root,
|
|
75
|
-
Face,
|
|
76
|
-
Box,
|
|
77
|
-
Left,
|
|
78
|
-
Right
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export { TextArea };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { InputBaseVariants } from '@tecsinapse/cortex-core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
interface TextAreaPropsBase {
|
|
4
|
-
variants?: InputBaseVariants;
|
|
5
|
-
label?: string;
|
|
6
|
-
rows?: number;
|
|
7
|
-
}
|
|
8
|
-
interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement>, TextAreaPropsBase {
|
|
9
|
-
}
|
|
10
|
-
type DivBaseProps = React.HTMLAttributes<HTMLDivElement>;
|
|
11
|
-
export declare const TextArea: {
|
|
12
|
-
Root: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
13
|
-
Face: React.ForwardRefExoticComponent<DivBaseProps & Pick<TextAreaPropsBase, "variants"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
-
Box: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
15
|
-
Left: React.ForwardRefExoticComponent<DivBaseProps & {
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
className?: string | undefined;
|
|
18
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
-
Right: React.ForwardRefExoticComponent<DivBaseProps & {
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
className?: string | undefined;
|
|
22
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
-
};
|
|
24
|
-
export {};
|