@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
package/dist/cjs/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var TimeFieldInput = require('./components/TimePicker/TimeFieldInput.js');
|
|
|
44
44
|
var Toggle = require('./components/Toggle.js');
|
|
45
45
|
var Tooltip = require('./components/Tooltip.js');
|
|
46
46
|
var index$7 = require('./components/Uploader/index.js');
|
|
47
|
-
var index$8 = require('./components/
|
|
47
|
+
var index$8 = require('./components/PhoneInput/index.js');
|
|
48
48
|
var useCalendar = require('./hooks/useCalendar.js');
|
|
49
49
|
var useCalendarCell = require('./hooks/useCalendarCell.js');
|
|
50
50
|
var useCalendarGrid = require('./hooks/useCalendarGrid.js');
|
|
@@ -128,7 +128,7 @@ exports.TimeFieldInput = TimeFieldInput.TimeFieldInput;
|
|
|
128
128
|
exports.Toggle = Toggle.Toggle;
|
|
129
129
|
exports.Tooltip = Tooltip.Tooltip;
|
|
130
130
|
exports.Uploader = index$7.Uploader;
|
|
131
|
-
exports.
|
|
131
|
+
exports.PhoneInput = index$8.PhoneInput;
|
|
132
132
|
exports.useCalendar = useCalendar.useCalendar;
|
|
133
133
|
exports.useCalendarCell = useCalendarCell.useCalendarCell;
|
|
134
134
|
exports.useCalendarGrid = useCalendarGrid.useCalendarGrid;
|
|
@@ -66,9 +66,11 @@ require('../components/Tooltip.js');
|
|
|
66
66
|
require('react-icons/hi2');
|
|
67
67
|
require('react-icons/fa6');
|
|
68
68
|
require('react-dom');
|
|
69
|
-
require('../components/
|
|
70
|
-
require('../components/
|
|
71
|
-
require('
|
|
69
|
+
require('../components/PhoneInput/Options.js');
|
|
70
|
+
require('../components/PhoneInput/context.js');
|
|
71
|
+
require('react-international-phone');
|
|
72
|
+
require('react-icons/io5');
|
|
73
|
+
require('country-flag-icons/react/3x2');
|
|
72
74
|
|
|
73
75
|
const ManagerContext = React.createContext(null);
|
|
74
76
|
const ManagerProvider = ({ children }) => {
|
|
@@ -35,6 +35,38 @@ class SnackbarSonner {
|
|
|
35
35
|
{ ...this._options, ...options }
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
+
async promise(promise, config) {
|
|
39
|
+
const { loading, success, error } = config;
|
|
40
|
+
const id = this.show(loading.type ?? "info", loading.message, {
|
|
41
|
+
...loading.options,
|
|
42
|
+
duration: loading.options?.duration ?? Infinity
|
|
43
|
+
});
|
|
44
|
+
try {
|
|
45
|
+
await promise;
|
|
46
|
+
if (!success) {
|
|
47
|
+
sonner.toast.dismiss(id);
|
|
48
|
+
} else {
|
|
49
|
+
const msg = success?.message ?? "Opera\xE7\xE3o conclu\xEDda com sucesso.";
|
|
50
|
+
this.show(success?.type ?? "success", msg, {
|
|
51
|
+
...success?.options,
|
|
52
|
+
id,
|
|
53
|
+
duration: success?.options?.duration ?? this._options?.duration ?? 5e3
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
} catch (err) {
|
|
57
|
+
if (!error) {
|
|
58
|
+
sonner.toast.dismiss(id);
|
|
59
|
+
} else {
|
|
60
|
+
const msg = error?.message ?? "Ocorreu um erro inesperado.";
|
|
61
|
+
this.show(error?.type ?? "error", msg, {
|
|
62
|
+
...error?.options,
|
|
63
|
+
id,
|
|
64
|
+
duration: error?.options?.duration ?? this._options?.duration ?? 5e3
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return promise;
|
|
69
|
+
}
|
|
38
70
|
}
|
|
39
71
|
|
|
40
72
|
exports.SnackbarSonner = SnackbarSonner;
|
|
@@ -4,7 +4,7 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const calendarCell = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
cell: "text-center rounded-mili
|
|
7
|
+
cell: "text-center rounded-mili hover:bg-primary-light",
|
|
8
8
|
button: "flex aspect-square items-center justify-center"
|
|
9
9
|
},
|
|
10
10
|
variants: {
|
|
@@ -35,7 +35,7 @@ const calendarCell = tailwindVariants.tv({
|
|
|
35
35
|
},
|
|
36
36
|
isDisabled: {
|
|
37
37
|
true: {
|
|
38
|
-
cell: "text-
|
|
38
|
+
cell: "text-content-minimal cursor-default hover:bg-surface-overlay",
|
|
39
39
|
button: "cursor-default"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -4,12 +4,12 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const dateSegment = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
base: "focus:outline-none focus:bg-
|
|
7
|
+
base: "focus:outline-none focus:bg-content-minimal"
|
|
8
8
|
},
|
|
9
9
|
variants: {
|
|
10
10
|
disabled: {
|
|
11
11
|
true: {
|
|
12
|
-
base: "text-
|
|
12
|
+
base: "text-content-minimal"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -4,12 +4,12 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const groupButton = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
button: "border-[1px] border-
|
|
8
|
-
inactive: "bg-
|
|
7
|
+
button: "border-[1px] border-content-low px-centi py-mili items-center flex text-sub font-bold",
|
|
8
|
+
inactive: "bg-surface-overlay text-content-low disabled:bg-content-minimal",
|
|
9
9
|
firstButton: "first:rounded-l-mili first:border-r-0",
|
|
10
10
|
lastButton: "last:rounded-r-mili last:border-l-0",
|
|
11
11
|
container: "flex flex-row h-[2rem]",
|
|
12
|
-
active: "text-white bg-
|
|
12
|
+
active: "text-white bg-content-low"
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -4,10 +4,10 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const menubar = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
header: "relative w-screen px-kilo py-deca flex flex-row md:justify-between bg-
|
|
7
|
+
header: "relative w-screen px-kilo py-deca flex flex-row md:justify-between bg-surface-overlay z-header sm:justify-start",
|
|
8
8
|
left: "flex items-center w-fit",
|
|
9
9
|
right: "flex items-center gap-x-deca hidden sm:flex",
|
|
10
|
-
dropdown: "w-full bg-
|
|
10
|
+
dropdown: "w-full bg-surface-overlay flex-1 shadow-default z-popover px-[8vw] absolute"
|
|
11
11
|
},
|
|
12
12
|
variants: {
|
|
13
13
|
show: {
|
|
@@ -21,7 +21,7 @@ const menubar = tailwindVariants.tv({
|
|
|
21
21
|
const mostUsed = tailwindVariants.tv({
|
|
22
22
|
slots: {
|
|
23
23
|
container: "mb-kilo",
|
|
24
|
-
label: "font-bold mb-centi",
|
|
24
|
+
label: "font-bold mb-centi text-default",
|
|
25
25
|
containerList: "gap-x-kilo flex flex-row"
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -29,26 +29,26 @@ const mostUsedItem = tailwindVariants.tv({
|
|
|
29
29
|
slots: {
|
|
30
30
|
container: "flex-1 py-mili",
|
|
31
31
|
title: "text-primary-medium font-bold text-base",
|
|
32
|
-
category: "text-
|
|
32
|
+
category: "text-content-low text-label"
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
const item = tailwindVariants.tv({
|
|
36
36
|
slots: {
|
|
37
|
-
container: "flex flex-row gap-x-deca items-center text-
|
|
37
|
+
container: "flex flex-row gap-x-deca items-center text-content-medium hover:cursor-pointer text-base",
|
|
38
38
|
textBehavior: "hover:text-primary-medium",
|
|
39
39
|
icon: "text-primary-medium hover:cursor-pointer"
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
const category = tailwindVariants.tv({
|
|
43
43
|
slots: {
|
|
44
|
-
text: "mb-mili font-bold",
|
|
45
|
-
hr: "mb-mili border-0 h-px bg-
|
|
44
|
+
text: "mb-mili font-bold text-default",
|
|
45
|
+
hr: "mb-mili border-0 h-px bg-content-high",
|
|
46
46
|
container: "flex flex-col gap-y-mili"
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
const subItem = tailwindVariants.tv({
|
|
50
50
|
slots: {
|
|
51
|
-
container: "pl-deca text-sub border-l-[1px] border-primary-medium text-
|
|
51
|
+
container: "pl-deca text-sub border-l-[1px] border-primary-medium text-content-medium hover:text-primary-medium cursor-pointer"
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
const animate = tailwindVariants.tv({
|
|
@@ -5,7 +5,7 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
5
5
|
const ProgressVariants = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
7
|
container: "relative",
|
|
8
|
-
bar: "h-1.5 w-full overflow-hidden bg-
|
|
8
|
+
bar: "h-1.5 w-full overflow-hidden bg-content-inverse",
|
|
9
9
|
progress: "w-full h-full rounded-mili"
|
|
10
10
|
},
|
|
11
11
|
variants: {
|
|
@@ -33,7 +33,7 @@ const AccordionTrigger = ({
|
|
|
33
33
|
"div",
|
|
34
34
|
{
|
|
35
35
|
className: clsx(
|
|
36
|
-
"flex justify-between align-center border-
|
|
36
|
+
"flex justify-between align-center border-content-minimal cursor-pointer",
|
|
37
37
|
{ "mr-deca": floating && direction === "horizontal" },
|
|
38
38
|
{ "mb-deca": floating && direction === "vertical" },
|
|
39
39
|
{ "border-r flex-col px-mili": direction === "horizontal" },
|
|
@@ -45,12 +45,12 @@ const AccordionTrigger = ({
|
|
|
45
45
|
"div",
|
|
46
46
|
{
|
|
47
47
|
className: clsx(
|
|
48
|
-
"rounded-mili border border-
|
|
48
|
+
"rounded-mili border border-content-minimal flex align-center justify-center p-micro",
|
|
49
49
|
{
|
|
50
|
-
"absolute -translate-x-micro translate-y-deca bg-
|
|
50
|
+
"absolute -translate-x-micro translate-y-deca bg-surface-overlay": floating && direction === "horizontal"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
"absolute -translate-y-micro translate-x-deca bg-
|
|
53
|
+
"absolute -translate-y-micro translate-x-deca bg-surface-overlay": floating && direction === "vertical"
|
|
54
54
|
},
|
|
55
55
|
className
|
|
56
56
|
),
|
|
@@ -58,7 +58,7 @@ const AccordionTrigger = ({
|
|
|
58
58
|
LiaAngleRightSolid,
|
|
59
59
|
{
|
|
60
60
|
className: clsx(
|
|
61
|
-
"text-
|
|
61
|
+
"text-content-low transition-transform duration-200",
|
|
62
62
|
{
|
|
63
63
|
"rotate-180": invertedArrow ? !open : open
|
|
64
64
|
}
|
|
@@ -68,7 +68,7 @@ const AccordionTrigger = ({
|
|
|
68
68
|
LiaAngleDownSolid,
|
|
69
69
|
{
|
|
70
70
|
className: clsx(
|
|
71
|
-
"text-
|
|
71
|
+
"text-content-low transition-transform duration-200",
|
|
72
72
|
{
|
|
73
73
|
"rotate-180": invertedArrow ? !open : open
|
|
74
74
|
}
|
|
@@ -14,7 +14,7 @@ const Avatar = ({ src, name, className, ...rest }) => {
|
|
|
14
14
|
{
|
|
15
15
|
...rest,
|
|
16
16
|
className: clsx(
|
|
17
|
-
"rounded-pill bg-
|
|
17
|
+
"rounded-pill bg-content-medium h-mega flex items-center justify-center cursor-pointer aspect-square",
|
|
18
18
|
className
|
|
19
19
|
),
|
|
20
20
|
children: src && !hasError ? /* @__PURE__ */ jsx(
|
|
@@ -15,7 +15,7 @@ const BreadcrumbItem = ({
|
|
|
15
15
|
{
|
|
16
16
|
className: clsx(
|
|
17
17
|
"no-underline",
|
|
18
|
-
isLast ? "text-
|
|
18
|
+
isLast ? "text-content-low cursor-default" : "text-content-medium cursor-pointer"
|
|
19
19
|
),
|
|
20
20
|
children: title
|
|
21
21
|
}
|
|
@@ -21,7 +21,7 @@ const CalendarGrid = ({ state }) => {
|
|
|
21
21
|
return /* @__PURE__ */ jsx(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
24
|
-
className: "bg-
|
|
24
|
+
className: "bg-surface-overlay rounded-micro px-deca py-mili",
|
|
25
25
|
"data-testid": "calendar-grid",
|
|
26
26
|
children: /* @__PURE__ */ jsxs("table", { ...gridProps, className: "border-separate border-spacing-y-nano", children: [
|
|
27
27
|
/* @__PURE__ */ jsx("thead", { ...headerProps, children: /* @__PURE__ */ jsx(CalendarGridHeaderRow, { weekDays }) }),
|
|
@@ -4,19 +4,28 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
|
|
5
5
|
const Box = forwardRef((props, ref) => {
|
|
6
6
|
const { id, className, ...rest } = props;
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
"
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"div",
|
|
9
9
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
className: clsx(
|
|
11
|
+
"w-tera h-kilo border overflow-hidden relative",
|
|
12
|
+
className
|
|
13
|
+
),
|
|
14
|
+
children: /* @__PURE__ */ jsx(
|
|
15
|
+
"input",
|
|
16
|
+
{
|
|
17
|
+
...rest,
|
|
18
|
+
id,
|
|
19
|
+
type: "color",
|
|
20
|
+
className: "bg-transparent cursor-pointer disabled:opacity-50 disabled:cursor-default absolute -top-1.5 -right-1 w-peta h-giga",
|
|
21
|
+
ref
|
|
22
|
+
}
|
|
23
|
+
)
|
|
15
24
|
}
|
|
16
|
-
)
|
|
25
|
+
);
|
|
17
26
|
});
|
|
18
27
|
const Face = ({ children }) => {
|
|
19
|
-
return /* @__PURE__ */ jsx("div", { className: "rounded-mili p-mili shadow-default bg-
|
|
28
|
+
return /* @__PURE__ */ jsx("div", { className: "rounded-mili p-mili shadow-default bg-default flex flex-row items-center gap-2", children });
|
|
20
29
|
};
|
|
21
30
|
const Label = ({
|
|
22
31
|
children,
|
|
@@ -7,7 +7,7 @@ const Root = ({ children, className, ...rest }) => {
|
|
|
7
7
|
{
|
|
8
8
|
...rest,
|
|
9
9
|
className: clsx(
|
|
10
|
-
"border border-dashed border-
|
|
10
|
+
"border border-dashed border-content-low rounded-mili bg-content-inverse overflow-hidden",
|
|
11
11
|
className
|
|
12
12
|
),
|
|
13
13
|
children
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as Flags from 'country-flag-icons/react/3x2';
|
|
3
|
+
|
|
4
|
+
const FlagIcon = ({
|
|
5
|
+
countryCode,
|
|
6
|
+
className = "w-[25px]",
|
|
7
|
+
title
|
|
8
|
+
}) => {
|
|
9
|
+
if (!countryCode) return null;
|
|
10
|
+
const upperCode = countryCode.toUpperCase();
|
|
11
|
+
const FlagComponent = Flags[upperCode];
|
|
12
|
+
if (!FlagComponent) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
FlagComponent,
|
|
17
|
+
{
|
|
18
|
+
className,
|
|
19
|
+
title: title || upperCode,
|
|
20
|
+
"aria-label": `Flag of ${upperCode}`
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { FlagIcon };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
const PhoneInputOption = ({
|
|
4
|
+
country,
|
|
5
|
+
handleSelectCountry,
|
|
6
|
+
disableClick = false
|
|
7
|
+
}) => {
|
|
8
|
+
return /* @__PURE__ */ jsxs(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
className: "flex w-full h-[2rem] items-center justify-between p-centi cursor-pointer hover:bg-content-inverse bg-inherit",
|
|
12
|
+
onClick: () => {
|
|
13
|
+
handleSelectCountry(country);
|
|
14
|
+
},
|
|
15
|
+
disabled: disableClick,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("span", { children: country?.name }),
|
|
18
|
+
/* @__PURE__ */ jsxs("span", { className: "text-content-minimal text-sm", children: [
|
|
19
|
+
"+",
|
|
20
|
+
country?.dialCode
|
|
21
|
+
] })
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { PhoneInputOption };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
import { Divider } from '../Divider.js';
|
|
4
|
+
import { usePhoneContext } from './context.js';
|
|
5
|
+
import { PhoneInputOption } from './Option.js';
|
|
6
|
+
import 'clsx';
|
|
7
|
+
import '../Accordion/context.js';
|
|
8
|
+
import 'react-icons/lia';
|
|
9
|
+
import '@internationalized/date';
|
|
10
|
+
import '../Badge.js';
|
|
11
|
+
import 'react-icons/md';
|
|
12
|
+
import '@tecsinapse/cortex-core';
|
|
13
|
+
import 'react-aria';
|
|
14
|
+
import 'react-stately';
|
|
15
|
+
import '../../provider/MenubarContext.js';
|
|
16
|
+
import '../../provider/SnackbarProvider.js';
|
|
17
|
+
import '../../provider/CalendarProvider.js';
|
|
18
|
+
import '../../provider/ManagerContext.js';
|
|
19
|
+
import '../Popover/Context.js';
|
|
20
|
+
import 'react-dropzone';
|
|
21
|
+
import 'uuid';
|
|
22
|
+
import '@floating-ui/react';
|
|
23
|
+
import 'currency.js';
|
|
24
|
+
import '../Calendar/CalendarCell.js';
|
|
25
|
+
import 'react-icons/fa';
|
|
26
|
+
import 'react-icons/io';
|
|
27
|
+
import 'embla-carousel-react';
|
|
28
|
+
import 'embla-carousel-autoplay';
|
|
29
|
+
import '../ColorPicker.js';
|
|
30
|
+
import '../DatePicker/DateSegment.js';
|
|
31
|
+
import '../DatePicker/DatePickerInputBase.js';
|
|
32
|
+
import '../GroupButton.js';
|
|
33
|
+
import { Input } from '../Input/index.js';
|
|
34
|
+
import '../Menubar/Left.js';
|
|
35
|
+
import '../../styles/menubar.js';
|
|
36
|
+
import '../Menubar/Right.js';
|
|
37
|
+
import '../Menubar/Dropdown.js';
|
|
38
|
+
import '../Menubar/MostUsed.js';
|
|
39
|
+
import '../Menubar/MostUsedItem.js';
|
|
40
|
+
import '../Menubar/Header.js';
|
|
41
|
+
import '../Menubar/Item.js';
|
|
42
|
+
import '../../provider/CategoriesContext.js';
|
|
43
|
+
import '../Menubar/SubItem.js';
|
|
44
|
+
import '../ProgressBar/Progress.js';
|
|
45
|
+
import '../RadioButton.js';
|
|
46
|
+
import '../Select/GroupedOptions.js';
|
|
47
|
+
import '../Select/context.js';
|
|
48
|
+
import '../Select/MultiGroupedOptions.js';
|
|
49
|
+
import '../Select/MultiOptions.js';
|
|
50
|
+
import '../Select/Options.js';
|
|
51
|
+
import '../Select/Trigger.js';
|
|
52
|
+
import '../../styles/stepNodeVariants.js';
|
|
53
|
+
import '../TextArea/Box.js';
|
|
54
|
+
import '../TextArea/Face.js';
|
|
55
|
+
import '../TextArea/Left.js';
|
|
56
|
+
import '../TextArea/Right.js';
|
|
57
|
+
import '../TextArea/Root.js';
|
|
58
|
+
import '../TimePicker/TimeFieldInput.js';
|
|
59
|
+
import '../Tooltip.js';
|
|
60
|
+
import 'react-icons/hi2';
|
|
61
|
+
import 'react-icons/fa6';
|
|
62
|
+
import 'react-dom';
|
|
63
|
+
import 'react-icons/io5';
|
|
64
|
+
import { defaultCountries, parseCountry } from 'react-international-phone';
|
|
65
|
+
import 'country-flag-icons/react/3x2';
|
|
66
|
+
|
|
67
|
+
const countries = defaultCountries.map((c) => {
|
|
68
|
+
return parseCountry(c);
|
|
69
|
+
});
|
|
70
|
+
const PhoneInputOptions = ({
|
|
71
|
+
hasSearch = true
|
|
72
|
+
}) => {
|
|
73
|
+
const { country, setCountry, setIsOpen } = usePhoneContext();
|
|
74
|
+
const [searchText, setSearchText] = useState("");
|
|
75
|
+
const filteredCountries = useMemo(() => {
|
|
76
|
+
return countries.filter(
|
|
77
|
+
(c) => c.iso2 !== country?.iso2 && (c.name.toLowerCase().includes(searchText.toLowerCase()) || c.dialCode.includes(searchText))
|
|
78
|
+
);
|
|
79
|
+
}, [country, searchText]);
|
|
80
|
+
const handleSelect = (country2) => {
|
|
81
|
+
setCountry?.(country2.iso2);
|
|
82
|
+
setIsOpen?.(false);
|
|
83
|
+
};
|
|
84
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col overflow-y-auto", children: [
|
|
85
|
+
hasSearch ? /* @__PURE__ */ jsx(
|
|
86
|
+
Input.Search,
|
|
87
|
+
{
|
|
88
|
+
onChange: (e) => setSearchText(e.target.value),
|
|
89
|
+
variants: { className: "mx-deca my-centi outline-none" }
|
|
90
|
+
}
|
|
91
|
+
) : null,
|
|
92
|
+
country ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
PhoneInputOption,
|
|
95
|
+
{
|
|
96
|
+
country,
|
|
97
|
+
handleSelectCountry: handleSelect,
|
|
98
|
+
disableClick: true
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx(Divider, {})
|
|
102
|
+
] }) : null,
|
|
103
|
+
filteredCountries.map((country2) => {
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
PhoneInputOption,
|
|
106
|
+
{
|
|
107
|
+
country: country2,
|
|
108
|
+
handleSelectCountry: handleSelect
|
|
109
|
+
},
|
|
110
|
+
`${country2.dialCode} ${country2.iso2}`
|
|
111
|
+
);
|
|
112
|
+
})
|
|
113
|
+
] });
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export { PhoneInputOptions };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { FloatingPortal } from '@floating-ui/react';
|
|
3
|
+
import { Popover } from '../Popover/index.js';
|
|
4
|
+
import { usePhoneContext } from './context.js';
|
|
5
|
+
|
|
6
|
+
const PhoneInputPopover = ({ children }) => {
|
|
7
|
+
const { triggerWidth } = usePhoneContext();
|
|
8
|
+
return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
9
|
+
Popover.Content,
|
|
10
|
+
{
|
|
11
|
+
className: "bg-surface-overlay shadow-md rounded-md overflow-hidden h-full max-h-[30vh] outline-none z-9999",
|
|
12
|
+
style: {
|
|
13
|
+
width: triggerWidth ? `${triggerWidth}px` : "auto"
|
|
14
|
+
},
|
|
15
|
+
children
|
|
16
|
+
}
|
|
17
|
+
) });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { PhoneInputPopover };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Popover } from '../Popover/index.js';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { usePhoneInput, defaultCountries } from 'react-international-phone';
|
|
6
|
+
import { PhoneInputContext } from './context.js';
|
|
7
|
+
|
|
8
|
+
const PhoneInputRoot = ({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
onChange,
|
|
12
|
+
...rest
|
|
13
|
+
}) => {
|
|
14
|
+
const [triggerWidth, setTriggerWidth] = useState();
|
|
15
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
16
|
+
const {
|
|
17
|
+
country,
|
|
18
|
+
handlePhoneValueChange,
|
|
19
|
+
inputRef,
|
|
20
|
+
inputValue,
|
|
21
|
+
phone,
|
|
22
|
+
setCountry
|
|
23
|
+
} = usePhoneInput({
|
|
24
|
+
countries: defaultCountries,
|
|
25
|
+
onChange: ({ phone: phone2, ...rest2 }) => {
|
|
26
|
+
onChange?.(phone2, { ...rest2 });
|
|
27
|
+
},
|
|
28
|
+
...rest
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
Popover.Root,
|
|
32
|
+
{
|
|
33
|
+
placement: "bottom-start",
|
|
34
|
+
controlled: true,
|
|
35
|
+
isOpen,
|
|
36
|
+
setIsOpen,
|
|
37
|
+
children: /* @__PURE__ */ jsx(
|
|
38
|
+
PhoneInputContext.Provider,
|
|
39
|
+
{
|
|
40
|
+
value: {
|
|
41
|
+
triggerWidth,
|
|
42
|
+
setTriggerWidth,
|
|
43
|
+
isOpen,
|
|
44
|
+
setIsOpen,
|
|
45
|
+
country,
|
|
46
|
+
setCountry,
|
|
47
|
+
handlePhoneValueChange,
|
|
48
|
+
inputValue,
|
|
49
|
+
phone,
|
|
50
|
+
inputRef
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ jsx("div", { className: clsx("relative w-full h-full", className), children })
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { PhoneInputRoot };
|