@tecsinapse/cortex-react 2.2.0-beta.6 → 2.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Accordion/Trigger.js +6 -6
- package/dist/cjs/components/Avatar.js +1 -1
- package/dist/cjs/components/Breadcrumbs/BreadcrumbItem.js +1 -1
- package/dist/cjs/components/Calendar/CalendarGrid.js +1 -1
- package/dist/cjs/components/ColorPicker.js +18 -9
- package/dist/cjs/components/Kanban.js +1 -1
- package/dist/cjs/components/PhoneInput/FlagIcon.js +46 -0
- package/dist/cjs/components/PhoneInput/Option.js +29 -0
- package/dist/cjs/components/PhoneInput/Options.js +118 -0
- package/dist/cjs/components/PhoneInput/Popover.js +22 -0
- package/dist/cjs/components/PhoneInput/Root.js +61 -0
- package/dist/cjs/components/PhoneInput/Trigger.js +112 -0
- package/dist/cjs/components/PhoneInput/context.js +19 -0
- package/dist/cjs/components/PhoneInput/index.js +17 -0
- package/dist/cjs/components/Popover/Content.js +1 -1
- package/dist/cjs/components/Select/Popover.js +1 -1
- package/dist/cjs/components/Skeleton.js +1 -1
- package/dist/cjs/components/Stepper/Root.js +1 -1
- package/dist/cjs/components/TimePicker/TimePickerInput.js +1 -1
- package/dist/cjs/components/Uploader/Dropzone.js +3 -3
- package/dist/cjs/components/Uploader/Files.js +1 -1
- package/dist/cjs/components/Uploader/Manager.js +1 -1
- package/dist/cjs/components/Uploader/Modal.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/provider/ManagerContext.js +5 -3
- package/dist/cjs/service/SnackbarSonner.js +32 -0
- package/dist/cjs/styles/calendar-cell.js +2 -2
- package/dist/cjs/styles/date-picker-input-base.js +1 -1
- package/dist/cjs/styles/date-segment.js +2 -2
- package/dist/cjs/styles/groupButton.js +3 -3
- package/dist/cjs/styles/menubar.js +8 -8
- package/dist/cjs/styles/progressBar.js +1 -1
- package/dist/cjs/styles/stepNodeVariants.js +2 -2
- package/dist/cjs/styles/time-field-input.js +1 -1
- package/dist/esm/components/Accordion/Trigger.js +6 -6
- package/dist/esm/components/Avatar.js +1 -1
- package/dist/esm/components/Breadcrumbs/BreadcrumbItem.js +1 -1
- package/dist/esm/components/Calendar/CalendarGrid.js +1 -1
- package/dist/esm/components/ColorPicker.js +18 -9
- package/dist/esm/components/Kanban.js +1 -1
- package/dist/esm/components/PhoneInput/FlagIcon.js +25 -0
- package/dist/esm/components/PhoneInput/Option.js +27 -0
- package/dist/esm/components/PhoneInput/Options.js +116 -0
- package/dist/esm/components/PhoneInput/Popover.js +20 -0
- package/dist/esm/components/PhoneInput/Root.js +59 -0
- package/dist/esm/components/PhoneInput/Trigger.js +110 -0
- package/dist/esm/components/PhoneInput/context.js +16 -0
- package/dist/esm/components/PhoneInput/index.js +15 -0
- package/dist/esm/components/Popover/Content.js +1 -1
- package/dist/esm/components/Select/Popover.js +1 -1
- package/dist/esm/components/Skeleton.js +1 -1
- package/dist/esm/components/Stepper/Root.js +1 -1
- package/dist/esm/components/TimePicker/TimePickerInput.js +1 -1
- package/dist/esm/components/Uploader/Dropzone.js +3 -3
- package/dist/esm/components/Uploader/Files.js +1 -1
- package/dist/esm/components/Uploader/Manager.js +1 -1
- package/dist/esm/components/Uploader/Modal.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/provider/ManagerContext.js +5 -3
- package/dist/esm/service/SnackbarSonner.js +32 -0
- package/dist/esm/styles/calendar-cell.js +2 -2
- package/dist/esm/styles/date-picker-input-base.js +1 -1
- package/dist/esm/styles/date-segment.js +2 -2
- package/dist/esm/styles/groupButton.js +3 -3
- package/dist/esm/styles/menubar.js +8 -8
- package/dist/esm/styles/progressBar.js +1 -1
- package/dist/esm/styles/stepNodeVariants.js +2 -2
- package/dist/esm/styles/time-field-input.js +1 -1
- package/dist/types/components/PhoneInput/FlagIcon.d.ts +8 -0
- package/dist/types/components/PhoneInput/Option.d.ts +6 -0
- package/dist/types/components/PhoneInput/Options.d.ts +3 -0
- package/dist/types/components/PhoneInput/Popover.d.ts +4 -0
- package/dist/types/components/PhoneInput/Root.d.ts +2 -0
- package/dist/types/components/PhoneInput/Trigger.d.ts +2 -0
- package/dist/types/components/PhoneInput/context.d.ts +15 -0
- package/dist/types/components/PhoneInput/index.d.ts +16 -0
- package/dist/types/components/PhoneInput/types.d.ts +13 -0
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/hooks/useFileUpload.d.ts +4 -4
- package/dist/types/provider/ManagerContext.d.ts +1 -1
- package/dist/types/service/SnackbarSonner.d.ts +19 -0
- package/package.json +5 -3
- package/dist/cjs/components/Autocomplete/GroupedOptions.js +0 -32
- package/dist/cjs/components/Autocomplete/Option.js +0 -38
- package/dist/cjs/components/Autocomplete/Options.js +0 -31
- package/dist/cjs/components/Autocomplete/Popover.js +0 -34
- package/dist/cjs/components/Autocomplete/Root.js +0 -34
- package/dist/cjs/components/Autocomplete/Trigger.js +0 -48
- package/dist/cjs/components/Autocomplete/context.js +0 -9
- package/dist/cjs/components/Autocomplete/index.js +0 -19
- package/dist/cjs/hooks/useAutocompleteGroupedOptions.js +0 -35
- package/dist/cjs/hooks/useAutocompleteOptions.js +0 -35
- package/dist/esm/components/Autocomplete/GroupedOptions.js +0 -30
- package/dist/esm/components/Autocomplete/Option.js +0 -36
- package/dist/esm/components/Autocomplete/Options.js +0 -29
- package/dist/esm/components/Autocomplete/Popover.js +0 -32
- package/dist/esm/components/Autocomplete/Root.js +0 -32
- package/dist/esm/components/Autocomplete/Trigger.js +0 -46
- package/dist/esm/components/Autocomplete/context.js +0 -7
- package/dist/esm/components/Autocomplete/index.js +0 -17
- package/dist/esm/hooks/useAutocompleteGroupedOptions.js +0 -33
- package/dist/esm/hooks/useAutocompleteOptions.js +0 -33
- package/dist/types/components/Autocomplete/GroupedOptions.d.ts +0 -2
- package/dist/types/components/Autocomplete/Option.d.ts +0 -2
- package/dist/types/components/Autocomplete/Options.d.ts +0 -2
- package/dist/types/components/Autocomplete/Popover.d.ts +0 -2
- package/dist/types/components/Autocomplete/Root.d.ts +0 -2
- package/dist/types/components/Autocomplete/Trigger.d.ts +0 -2
- package/dist/types/components/Autocomplete/context.d.ts +0 -9
- package/dist/types/components/Autocomplete/index.d.ts +0 -9
- package/dist/types/components/Autocomplete/types.d.ts +0 -46
- package/dist/types/hooks/useAutocompleteGroupedOptions.d.ts +0 -10
- package/dist/types/hooks/useAutocompleteOptions.d.ts +0 -10
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { IoChevronDown } from 'react-icons/io5';
|
|
3
|
+
import 'clsx';
|
|
4
|
+
import { useRef, useEffect } from 'react';
|
|
5
|
+
import '../Accordion/context.js';
|
|
6
|
+
import 'react-icons/lia';
|
|
7
|
+
import '@internationalized/date';
|
|
8
|
+
import '../Badge.js';
|
|
9
|
+
import 'react-icons/md';
|
|
10
|
+
import '@tecsinapse/cortex-core';
|
|
11
|
+
import 'react-aria';
|
|
12
|
+
import 'react-stately';
|
|
13
|
+
import '../../provider/MenubarContext.js';
|
|
14
|
+
import '../../provider/SnackbarProvider.js';
|
|
15
|
+
import '../../provider/CalendarProvider.js';
|
|
16
|
+
import '../../provider/ManagerContext.js';
|
|
17
|
+
import '../Popover/Context.js';
|
|
18
|
+
import 'react-dropzone';
|
|
19
|
+
import 'uuid';
|
|
20
|
+
import '@floating-ui/react';
|
|
21
|
+
import 'currency.js';
|
|
22
|
+
import '../Calendar/CalendarCell.js';
|
|
23
|
+
import 'react-icons/fa';
|
|
24
|
+
import 'react-icons/io';
|
|
25
|
+
import 'embla-carousel-react';
|
|
26
|
+
import 'embla-carousel-autoplay';
|
|
27
|
+
import '../ColorPicker.js';
|
|
28
|
+
import '../DatePicker/DateSegment.js';
|
|
29
|
+
import { Popover } from '../Popover/index.js';
|
|
30
|
+
import '../DatePicker/DatePickerInputBase.js';
|
|
31
|
+
import '../GroupButton.js';
|
|
32
|
+
import { Input } from '../Input/index.js';
|
|
33
|
+
import '../Menubar/Left.js';
|
|
34
|
+
import '../../styles/menubar.js';
|
|
35
|
+
import '../Menubar/Right.js';
|
|
36
|
+
import '../Menubar/Dropdown.js';
|
|
37
|
+
import '../Menubar/MostUsed.js';
|
|
38
|
+
import '../Menubar/MostUsedItem.js';
|
|
39
|
+
import '../Menubar/Header.js';
|
|
40
|
+
import '../Menubar/Item.js';
|
|
41
|
+
import '../../provider/CategoriesContext.js';
|
|
42
|
+
import '../Menubar/SubItem.js';
|
|
43
|
+
import '../ProgressBar/Progress.js';
|
|
44
|
+
import '../RadioButton.js';
|
|
45
|
+
import '../Select/GroupedOptions.js';
|
|
46
|
+
import '../Select/context.js';
|
|
47
|
+
import '../Select/MultiGroupedOptions.js';
|
|
48
|
+
import '../Select/MultiOptions.js';
|
|
49
|
+
import '../Select/Options.js';
|
|
50
|
+
import '../Select/Trigger.js';
|
|
51
|
+
import '../../styles/stepNodeVariants.js';
|
|
52
|
+
import '../TextArea/Box.js';
|
|
53
|
+
import '../TextArea/Face.js';
|
|
54
|
+
import '../TextArea/Left.js';
|
|
55
|
+
import '../TextArea/Right.js';
|
|
56
|
+
import '../TextArea/Root.js';
|
|
57
|
+
import '../TimePicker/TimeFieldInput.js';
|
|
58
|
+
import '../Tooltip.js';
|
|
59
|
+
import 'react-icons/hi2';
|
|
60
|
+
import 'react-icons/fa6';
|
|
61
|
+
import 'react-dom';
|
|
62
|
+
import './Options.js';
|
|
63
|
+
import { usePhoneContext } from './context.js';
|
|
64
|
+
import 'react-international-phone';
|
|
65
|
+
import { FlagIcon } from './FlagIcon.js';
|
|
66
|
+
|
|
67
|
+
const PhoneInputTrigger = ({
|
|
68
|
+
disabled = false,
|
|
69
|
+
label,
|
|
70
|
+
...rest
|
|
71
|
+
}) => {
|
|
72
|
+
const {
|
|
73
|
+
setIsOpen,
|
|
74
|
+
setTriggerWidth,
|
|
75
|
+
country,
|
|
76
|
+
handlePhoneValueChange,
|
|
77
|
+
inputValue
|
|
78
|
+
} = usePhoneContext();
|
|
79
|
+
const triggerRef = useRef(null);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (triggerRef.current && setTriggerWidth) {
|
|
82
|
+
const width = triggerRef.current.getBoundingClientRect().width;
|
|
83
|
+
setTriggerWidth(width);
|
|
84
|
+
}
|
|
85
|
+
}, [triggerRef.current, setTriggerWidth]);
|
|
86
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { disabled, children: /* @__PURE__ */ jsxs(Input.Face, { ref: triggerRef, children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
Input.Box,
|
|
89
|
+
{
|
|
90
|
+
value: inputValue,
|
|
91
|
+
onChange: handlePhoneValueChange,
|
|
92
|
+
label: label ?? "Insert a phone number",
|
|
93
|
+
...rest
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(Input.Right, { children: /* @__PURE__ */ jsxs(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: "flex items-center gap-1 cursor-pointer w-full",
|
|
100
|
+
onClick: () => setIsOpen?.(true),
|
|
101
|
+
children: [
|
|
102
|
+
country ? /* @__PURE__ */ jsx(FlagIcon, { countryCode: country.iso2, className: "w-[25px]" }) : null,
|
|
103
|
+
/* @__PURE__ */ jsx(IoChevronDown, { className: "h-full text-md" })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
) })
|
|
107
|
+
] }) });
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { PhoneInputTrigger };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const PhoneInputContext = createContext(
|
|
4
|
+
null
|
|
5
|
+
);
|
|
6
|
+
const usePhoneContext = () => {
|
|
7
|
+
const context = useContext(PhoneInputContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
"usePhoneInputContext must be used within a usePhoneInputProvider"
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { PhoneInputContext, usePhoneContext };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PhoneInputOption } from './Option.js';
|
|
2
|
+
import { PhoneInputOptions } from './Options.js';
|
|
3
|
+
import { PhoneInputPopover } from './Popover.js';
|
|
4
|
+
import { PhoneInputRoot } from './Root.js';
|
|
5
|
+
import { PhoneInputTrigger } from './Trigger.js';
|
|
6
|
+
|
|
7
|
+
const PhoneInput = {
|
|
8
|
+
Root: PhoneInputRoot,
|
|
9
|
+
Popover: PhoneInputPopover,
|
|
10
|
+
Trigger: PhoneInputTrigger,
|
|
11
|
+
Option: PhoneInputOption,
|
|
12
|
+
Options: PhoneInputOptions
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { PhoneInput };
|
|
@@ -26,7 +26,7 @@ const PopoverContent = ({
|
|
|
26
26
|
ref: refs.setFloating,
|
|
27
27
|
...getFloatingProps(),
|
|
28
28
|
className: clsx(
|
|
29
|
-
"border border-gray-200 bg-
|
|
29
|
+
"border border-gray-200 bg-surface-inverse p-0 rounded-md shadow-default z-popover",
|
|
30
30
|
className
|
|
31
31
|
),
|
|
32
32
|
style: {
|
|
@@ -9,7 +9,7 @@ const SelectPopover = ({ children }) => {
|
|
|
9
9
|
return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
10
10
|
Popover.Content,
|
|
11
11
|
{
|
|
12
|
-
className: "bg-
|
|
12
|
+
className: "bg-surface-overlay max-h-[30vh] overflow-y-auto gap-y-mili flex flex-col p-0",
|
|
13
13
|
style: {
|
|
14
14
|
width: triggerWidth ? `${triggerWidth}px` : "auto",
|
|
15
15
|
zIndex: 9999
|
|
@@ -60,7 +60,7 @@ const TimePickerInputWithPopover = (props) => {
|
|
|
60
60
|
/* @__PURE__ */ jsx(
|
|
61
61
|
Popover.Content,
|
|
62
62
|
{
|
|
63
|
-
className: "bg-
|
|
63
|
+
className: "bg-surface-overlay shadow-default border-none p-deca flex flex-col",
|
|
64
64
|
initialFocus: -1,
|
|
65
65
|
children: /* @__PURE__ */ jsx(
|
|
66
66
|
TimePickerSelector,
|
|
@@ -17,7 +17,7 @@ const Dropzone = ({
|
|
|
17
17
|
{
|
|
18
18
|
...getRootProps(),
|
|
19
19
|
className: clsx(
|
|
20
|
-
"bg-
|
|
20
|
+
"bg-surface-overlay w-full border-dashed border-2 p-deca flex flex-col justify-center rounded-mili overflow-auto h-[18rem]",
|
|
21
21
|
{
|
|
22
22
|
"border-success-medium bg-gray-100": isDragActive
|
|
23
23
|
}
|
|
@@ -25,7 +25,7 @@ const Dropzone = ({
|
|
|
25
25
|
children: [
|
|
26
26
|
/* @__PURE__ */ jsx("input", { ...getInputProps() }),
|
|
27
27
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center text-center items-center", children: [
|
|
28
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
29
29
|
/* @__PURE__ */ jsx(
|
|
30
30
|
HiOutlineCloudArrowUp,
|
|
31
31
|
{
|
|
@@ -36,7 +36,7 @@ const Dropzone = ({
|
|
|
36
36
|
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold", "data-testid": "select-dropzone", children: selectFileText })
|
|
37
37
|
] }),
|
|
38
38
|
hasButton ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-centi", children: [
|
|
39
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-
|
|
39
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-content-low", children: dropText }),
|
|
40
40
|
isFileLimitReached ? /* @__PURE__ */ jsx(Tooltip, { text: "Voc\xEA s\xF3 pode selecionar um \xFAnico arquivo.", children: /* @__PURE__ */ jsx(
|
|
41
41
|
"button",
|
|
42
42
|
{
|
|
@@ -6,7 +6,7 @@ const Files = ({
|
|
|
6
6
|
onDelete,
|
|
7
7
|
uploadProgressText = "Upload(s) in progress"
|
|
8
8
|
}) => {
|
|
9
|
-
return /* @__PURE__ */ jsxs("div", { className: "bg-
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-surface-overlay w-full border-2 p-deca flex flex-col overflow-y-auto rounded-mili h-[18rem]", children: [
|
|
10
10
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-mili items-center mb-deca", children: [
|
|
11
11
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-deca h-deca bg-primary-medium rounded-full text-micro text-white", children: `${files.length}` }),
|
|
12
12
|
/* @__PURE__ */ jsx("h2", { className: "text-md font-semibold", "data-testid": "upload-progress", children: uploadProgressText })
|
|
@@ -45,7 +45,7 @@ const Manager = ({
|
|
|
45
45
|
children: min ? /* @__PURE__ */ jsx(IoChevronUp, {}) : /* @__PURE__ */ jsx(IoChevronDown, {})
|
|
46
46
|
}
|
|
47
47
|
),
|
|
48
|
-
/* @__PURE__ */ jsx("h3", { "data-testid": "upload-progress", children: isLoading ? uploadProgressText : uploadSuccessText }),
|
|
48
|
+
/* @__PURE__ */ jsx("h3", { "data-testid": "upload-progress", className: "font-bold text-h4", children: isLoading ? uploadProgressText : uploadSuccessText }),
|
|
49
49
|
/* @__PURE__ */ jsx(
|
|
50
50
|
Button,
|
|
51
51
|
{
|
|
@@ -16,7 +16,7 @@ const Modal = ({
|
|
|
16
16
|
{
|
|
17
17
|
open,
|
|
18
18
|
onClose,
|
|
19
|
-
className: "flex flex-col bg-
|
|
19
|
+
className: "flex flex-col bg-surface-base rounded-mili min-w-[70vw] max-w-[95vh] max-h-[95vh] overflow-auto text-default",
|
|
20
20
|
children: [
|
|
21
21
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between mb-deca", children: [
|
|
22
22
|
/* @__PURE__ */ jsx("h2", { className: "text-deca font-semibold ml-tera flex-1 text-center", children: title }),
|
package/dist/esm/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export { TimeFieldInput } from './components/TimePicker/TimeFieldInput.js';
|
|
|
42
42
|
export { Toggle } from './components/Toggle.js';
|
|
43
43
|
export { Tooltip } from './components/Tooltip.js';
|
|
44
44
|
export { Uploader } from './components/Uploader/index.js';
|
|
45
|
-
export {
|
|
45
|
+
export { PhoneInput } from './components/PhoneInput/index.js';
|
|
46
46
|
export { useCalendar } from './hooks/useCalendar.js';
|
|
47
47
|
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
48
48
|
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
@@ -64,9 +64,11 @@ import '../components/Tooltip.js';
|
|
|
64
64
|
import 'react-icons/hi2';
|
|
65
65
|
import 'react-icons/fa6';
|
|
66
66
|
import 'react-dom';
|
|
67
|
-
import '../components/
|
|
68
|
-
import '../components/
|
|
69
|
-
import '
|
|
67
|
+
import '../components/PhoneInput/Options.js';
|
|
68
|
+
import '../components/PhoneInput/context.js';
|
|
69
|
+
import 'react-international-phone';
|
|
70
|
+
import 'react-icons/io5';
|
|
71
|
+
import 'country-flag-icons/react/3x2';
|
|
70
72
|
|
|
71
73
|
const ManagerContext = createContext(null);
|
|
72
74
|
const ManagerProvider = ({ children }) => {
|
|
@@ -33,6 +33,38 @@ class SnackbarSonner {
|
|
|
33
33
|
{ ...this._options, ...options }
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
|
+
async promise(promise, config) {
|
|
37
|
+
const { loading, success, error } = config;
|
|
38
|
+
const id = this.show(loading.type ?? "info", loading.message, {
|
|
39
|
+
...loading.options,
|
|
40
|
+
duration: loading.options?.duration ?? Infinity
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
await promise;
|
|
44
|
+
if (!success) {
|
|
45
|
+
toast.dismiss(id);
|
|
46
|
+
} else {
|
|
47
|
+
const msg = success?.message ?? "Opera\xE7\xE3o conclu\xEDda com sucesso.";
|
|
48
|
+
this.show(success?.type ?? "success", msg, {
|
|
49
|
+
...success?.options,
|
|
50
|
+
id,
|
|
51
|
+
duration: success?.options?.duration ?? this._options?.duration ?? 5e3
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
} catch (err) {
|
|
55
|
+
if (!error) {
|
|
56
|
+
toast.dismiss(id);
|
|
57
|
+
} else {
|
|
58
|
+
const msg = error?.message ?? "Ocorreu um erro inesperado.";
|
|
59
|
+
this.show(error?.type ?? "error", msg, {
|
|
60
|
+
...error?.options,
|
|
61
|
+
id,
|
|
62
|
+
duration: error?.options?.duration ?? this._options?.duration ?? 5e3
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return promise;
|
|
67
|
+
}
|
|
36
68
|
}
|
|
37
69
|
|
|
38
70
|
export { SnackbarSonner };
|
|
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const calendarCell = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
cell: "text-center rounded-mili
|
|
5
|
+
cell: "text-center rounded-mili hover:bg-primary-light",
|
|
6
6
|
button: "flex aspect-square items-center justify-center"
|
|
7
7
|
},
|
|
8
8
|
variants: {
|
|
@@ -33,7 +33,7 @@ const calendarCell = tv({
|
|
|
33
33
|
},
|
|
34
34
|
isDisabled: {
|
|
35
35
|
true: {
|
|
36
|
-
cell: "text-
|
|
36
|
+
cell: "text-content-minimal cursor-default hover:bg-surface-overlay",
|
|
37
37
|
button: "cursor-default"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -2,12 +2,12 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const dateSegment = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
base: "focus:outline-none focus:bg-
|
|
5
|
+
base: "focus:outline-none focus:bg-content-minimal"
|
|
6
6
|
},
|
|
7
7
|
variants: {
|
|
8
8
|
disabled: {
|
|
9
9
|
true: {
|
|
10
|
-
base: "text-
|
|
10
|
+
base: "text-content-minimal"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -2,12 +2,12 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const groupButton = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
button: "border-[1px] border-
|
|
6
|
-
inactive: "bg-
|
|
5
|
+
button: "border-[1px] border-content-low px-centi py-mili items-center flex text-sub font-bold",
|
|
6
|
+
inactive: "bg-surface-overlay text-content-low disabled:bg-content-minimal",
|
|
7
7
|
firstButton: "first:rounded-l-mili first:border-r-0",
|
|
8
8
|
lastButton: "last:rounded-r-mili last:border-l-0",
|
|
9
9
|
container: "flex flex-row h-[2rem]",
|
|
10
|
-
active: "text-white bg-
|
|
10
|
+
active: "text-white bg-content-low"
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
|
|
@@ -2,10 +2,10 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const menubar = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
header: "relative w-screen px-kilo py-deca flex flex-row md:justify-between bg-
|
|
5
|
+
header: "relative w-screen px-kilo py-deca flex flex-row md:justify-between bg-surface-overlay z-header sm:justify-start",
|
|
6
6
|
left: "flex items-center w-fit",
|
|
7
7
|
right: "flex items-center gap-x-deca hidden sm:flex",
|
|
8
|
-
dropdown: "w-full bg-
|
|
8
|
+
dropdown: "w-full bg-surface-overlay flex-1 shadow-default z-popover px-[8vw] absolute"
|
|
9
9
|
},
|
|
10
10
|
variants: {
|
|
11
11
|
show: {
|
|
@@ -19,7 +19,7 @@ const menubar = tv({
|
|
|
19
19
|
const mostUsed = tv({
|
|
20
20
|
slots: {
|
|
21
21
|
container: "mb-kilo",
|
|
22
|
-
label: "font-bold mb-centi",
|
|
22
|
+
label: "font-bold mb-centi text-default",
|
|
23
23
|
containerList: "gap-x-kilo flex flex-row"
|
|
24
24
|
}
|
|
25
25
|
});
|
|
@@ -27,26 +27,26 @@ const mostUsedItem = tv({
|
|
|
27
27
|
slots: {
|
|
28
28
|
container: "flex-1 py-mili",
|
|
29
29
|
title: "text-primary-medium font-bold text-base",
|
|
30
|
-
category: "text-
|
|
30
|
+
category: "text-content-low text-label"
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
const item = tv({
|
|
34
34
|
slots: {
|
|
35
|
-
container: "flex flex-row gap-x-deca items-center text-
|
|
35
|
+
container: "flex flex-row gap-x-deca items-center text-content-medium hover:cursor-pointer text-base",
|
|
36
36
|
textBehavior: "hover:text-primary-medium",
|
|
37
37
|
icon: "text-primary-medium hover:cursor-pointer"
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const category = tv({
|
|
41
41
|
slots: {
|
|
42
|
-
text: "mb-mili font-bold",
|
|
43
|
-
hr: "mb-mili border-0 h-px bg-
|
|
42
|
+
text: "mb-mili font-bold text-default",
|
|
43
|
+
hr: "mb-mili border-0 h-px bg-content-high",
|
|
44
44
|
container: "flex flex-col gap-y-mili"
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
const subItem = tv({
|
|
48
48
|
slots: {
|
|
49
|
-
container: "pl-deca text-sub border-l-[1px] border-primary-medium text-
|
|
49
|
+
container: "pl-deca text-sub border-l-[1px] border-primary-medium text-content-medium hover:text-primary-medium cursor-pointer"
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
const animate = tv({
|
|
@@ -3,7 +3,7 @@ import { tv } from 'tailwind-variants';
|
|
|
3
3
|
const ProgressVariants = tv({
|
|
4
4
|
slots: {
|
|
5
5
|
container: "relative",
|
|
6
|
-
bar: "h-1.5 w-full overflow-hidden bg-
|
|
6
|
+
bar: "h-1.5 w-full overflow-hidden bg-content-inverse",
|
|
7
7
|
progress: "w-full h-full rounded-mili"
|
|
8
8
|
},
|
|
9
9
|
variants: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ParsedCountry } from 'react-international-phone';
|
|
2
|
+
export declare const PhoneInputOption: ({ country, handleSelectCountry, disableClick, }: {
|
|
3
|
+
country: ParsedCountry;
|
|
4
|
+
handleSelectCountry: (country: ParsedCountry) => void;
|
|
5
|
+
disableClick?: boolean;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { usePhoneInput } from 'react-international-phone';
|
|
2
|
+
export interface Country {
|
|
3
|
+
country: string;
|
|
4
|
+
iso: string;
|
|
5
|
+
code: string;
|
|
6
|
+
}
|
|
7
|
+
interface PhoneInputContextProps extends ReturnType<typeof usePhoneInput> {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
+
triggerWidth?: number;
|
|
11
|
+
setTriggerWidth?: React.Dispatch<React.SetStateAction<number | undefined>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const PhoneInputContext: import("react").Context<PhoneInputContextProps | null>;
|
|
14
|
+
export declare const usePhoneContext: () => PhoneInputContextProps;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const PhoneInput: {
|
|
2
|
+
Root: ({ children, className, onChange, ...rest }: import("./types").PhoneInputRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Popover: ({ children }: {
|
|
4
|
+
children: import("react").ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Trigger: ({ disabled, label, ...rest }: import("./types").PhoneInputTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Option: ({ country, handleSelectCountry, disableClick, }: {
|
|
8
|
+
country: import("react-international-phone").ParsedCountry;
|
|
9
|
+
handleSelectCountry: (country: import("react-international-phone").ParsedCountry) => void;
|
|
10
|
+
disableClick?: boolean;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
Options: ({ hasSearch, }: {
|
|
13
|
+
hasSearch?: boolean;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export * from './types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ParsedCountry, UsePhoneInputConfig } from 'react-international-phone';
|
|
2
|
+
import { InputPropsBase } from '../Input';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export interface PhoneInputTriggerProps extends React.InputHTMLAttributes<HTMLInputElement>, InputPropsBase {
|
|
5
|
+
}
|
|
6
|
+
export interface PhoneInputRootProps extends Omit<UsePhoneInputConfig, 'onChange'> {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
onChange?: (value: string, rest: {
|
|
10
|
+
inputValue: string;
|
|
11
|
+
country: ParsedCountry;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DropEvent, type FileRejection } from 'react-dropzone';
|
|
2
2
|
import { AcceptSpecificMap, UseDropzoneProps, type FileUpload } from '../components/Uploader/types';
|
|
3
|
-
interface UseFileUploadOptions {
|
|
3
|
+
interface UseFileUploadOptions<T> {
|
|
4
4
|
accept?: {
|
|
5
5
|
IMAGE?: (typeof AcceptSpecificMap.IMAGE)[number][];
|
|
6
6
|
APPLICATION?: (typeof AcceptSpecificMap.APPLICATION)[number][];
|
|
@@ -8,7 +8,7 @@ interface UseFileUploadOptions {
|
|
|
8
8
|
VIDEO?: (typeof AcceptSpecificMap.VIDEO)[number][];
|
|
9
9
|
TEXT?: (typeof AcceptSpecificMap.TEXT)[number][];
|
|
10
10
|
};
|
|
11
|
-
onAccept?: (files: FileUpload<
|
|
11
|
+
onAccept?: (files: FileUpload<T>[]) => Promise<FileUpload<T>[]>;
|
|
12
12
|
onOpenManager?: () => void;
|
|
13
13
|
onFileRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;
|
|
14
14
|
maxSize?: number;
|
|
@@ -22,7 +22,7 @@ interface UseFileUploadOptions {
|
|
|
22
22
|
noClick?: boolean;
|
|
23
23
|
ignoreRejections?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export declare const useFileUpload: <T>({ accept, onAccept, onOpenManager, onFileRejected, maxSize, allowMultiple, preventDuplicates, onDuplicate, hasManager, isFolder, noClick, ignoreRejections, uploadProgressText, uploadSuccessText, }: UseFileUploadOptions) => {
|
|
25
|
+
export declare const useFileUpload: <T>({ accept, onAccept, onOpenManager, onFileRejected, maxSize, allowMultiple, preventDuplicates, onDuplicate, hasManager, isFolder, noClick, ignoreRejections, uploadProgressText, uploadSuccessText, }: UseFileUploadOptions<T>) => {
|
|
26
26
|
onOpen: () => void;
|
|
27
27
|
onClose: () => void;
|
|
28
28
|
onDelete: (index: number) => void;
|
|
@@ -31,7 +31,7 @@ export declare const useFileUpload: <T>({ accept, onAccept, onOpenManager, onFil
|
|
|
31
31
|
openManager: () => void;
|
|
32
32
|
closeManager: () => void;
|
|
33
33
|
isManagerOpen: boolean;
|
|
34
|
-
files: FileUpload<
|
|
34
|
+
files: FileUpload<any>[];
|
|
35
35
|
duplicates: File[];
|
|
36
36
|
onClearFiles: () => void;
|
|
37
37
|
};
|
|
@@ -16,5 +16,5 @@ interface ManagerContextProps<T> {
|
|
|
16
16
|
export declare const ManagerProvider: ({ children }: {
|
|
17
17
|
children: ReactNode;
|
|
18
18
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare const useManager: () => ManagerContextProps<
|
|
19
|
+
export declare const useManager: () => ManagerContextProps<any>;
|
|
20
20
|
export {};
|
|
@@ -2,9 +2,28 @@ import React from 'react';
|
|
|
2
2
|
import { ExternalToast } from 'sonner';
|
|
3
3
|
import { ISnackbar, TypeSnack } from './ISnackbar';
|
|
4
4
|
import { IExternalToast } from './IExternalToast';
|
|
5
|
+
interface PromiseSnackConfig<T = unknown> {
|
|
6
|
+
loading: {
|
|
7
|
+
message: string;
|
|
8
|
+
type?: TypeSnack;
|
|
9
|
+
options?: Omit<IExternalToast, 'className' | 'style'>;
|
|
10
|
+
};
|
|
11
|
+
success?: {
|
|
12
|
+
message?: string;
|
|
13
|
+
type?: TypeSnack;
|
|
14
|
+
options?: Omit<IExternalToast, 'className' | 'style'>;
|
|
15
|
+
};
|
|
16
|
+
error?: {
|
|
17
|
+
message?: string;
|
|
18
|
+
type?: TypeSnack;
|
|
19
|
+
options?: Omit<IExternalToast, 'className' | 'style'>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
5
22
|
export declare class SnackbarSonner implements ISnackbar<IExternalToast> {
|
|
6
23
|
_options?: IExternalToast;
|
|
7
24
|
constructor(options?: IExternalToast);
|
|
8
25
|
custom(Component: React.ReactElement, options?: ExternalToast): string | number;
|
|
9
26
|
show(type: TypeSnack, message: string, options?: Omit<IExternalToast, 'className' | 'style'>): string | number;
|
|
27
|
+
promise<T>(promise: Promise<T>, config: PromiseSnackConfig<T>): Promise<T>;
|
|
10
28
|
}
|
|
29
|
+
export {};
|