@tecsinapse/cortex-react 2.2.1-beta.0 → 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.
Files changed (86) hide show
  1. package/dist/cjs/components/Accordion/Trigger.js +6 -6
  2. package/dist/cjs/components/Avatar.js +1 -1
  3. package/dist/cjs/components/Breadcrumbs/BreadcrumbItem.js +1 -1
  4. package/dist/cjs/components/Calendar/CalendarGrid.js +1 -1
  5. package/dist/cjs/components/ColorPicker.js +18 -9
  6. package/dist/cjs/components/Kanban.js +1 -1
  7. package/dist/cjs/components/PhoneInput/FlagIcon.js +46 -0
  8. package/dist/cjs/components/PhoneInput/Option.js +29 -0
  9. package/dist/cjs/components/PhoneInput/Options.js +118 -0
  10. package/dist/cjs/components/PhoneInput/Popover.js +22 -0
  11. package/dist/cjs/components/PhoneInput/Root.js +61 -0
  12. package/dist/cjs/components/PhoneInput/Trigger.js +112 -0
  13. package/dist/cjs/components/PhoneInput/context.js +19 -0
  14. package/dist/cjs/components/PhoneInput/index.js +17 -0
  15. package/dist/cjs/components/Popover/Content.js +1 -1
  16. package/dist/cjs/components/ScrollableDigitSelector.js +1 -1
  17. package/dist/cjs/components/Select/Popover.js +1 -1
  18. package/dist/cjs/components/Skeleton.js +1 -1
  19. package/dist/cjs/components/Stepper/Root.js +1 -1
  20. package/dist/cjs/components/TimePicker/TimePickerInput.js +1 -1
  21. package/dist/cjs/components/TimePicker/TimePickerSelector.js +2 -2
  22. package/dist/cjs/components/Uploader/Dropzone.js +3 -3
  23. package/dist/cjs/components/Uploader/Files.js +2 -2
  24. package/dist/cjs/components/Uploader/Manager.js +1 -1
  25. package/dist/cjs/components/Uploader/Modal.js +1 -1
  26. package/dist/cjs/index.js +2 -0
  27. package/dist/cjs/provider/ManagerContext.js +5 -0
  28. package/dist/cjs/service/SnackbarSonner.js +32 -0
  29. package/dist/cjs/styles/calendar-cell.js +5 -5
  30. package/dist/cjs/styles/date-picker-input-base.js +1 -1
  31. package/dist/cjs/styles/date-segment.js +2 -2
  32. package/dist/cjs/styles/groupButton.js +3 -3
  33. package/dist/cjs/styles/menubar.js +8 -8
  34. package/dist/cjs/styles/progressBar.js +1 -1
  35. package/dist/cjs/styles/stepNodeVariants.js +2 -2
  36. package/dist/cjs/styles/time-field-input.js +1 -1
  37. package/dist/esm/components/Accordion/Trigger.js +6 -6
  38. package/dist/esm/components/Avatar.js +1 -1
  39. package/dist/esm/components/Breadcrumbs/BreadcrumbItem.js +1 -1
  40. package/dist/esm/components/Calendar/CalendarGrid.js +1 -1
  41. package/dist/esm/components/ColorPicker.js +18 -9
  42. package/dist/esm/components/Kanban.js +1 -1
  43. package/dist/esm/components/PhoneInput/FlagIcon.js +25 -0
  44. package/dist/esm/components/PhoneInput/Option.js +27 -0
  45. package/dist/esm/components/PhoneInput/Options.js +116 -0
  46. package/dist/esm/components/PhoneInput/Popover.js +20 -0
  47. package/dist/esm/components/PhoneInput/Root.js +59 -0
  48. package/dist/esm/components/PhoneInput/Trigger.js +110 -0
  49. package/dist/esm/components/PhoneInput/context.js +16 -0
  50. package/dist/esm/components/PhoneInput/index.js +15 -0
  51. package/dist/esm/components/Popover/Content.js +1 -1
  52. package/dist/esm/components/ScrollableDigitSelector.js +1 -1
  53. package/dist/esm/components/Select/Popover.js +1 -1
  54. package/dist/esm/components/Skeleton.js +1 -1
  55. package/dist/esm/components/Stepper/Root.js +1 -1
  56. package/dist/esm/components/TimePicker/TimePickerInput.js +1 -1
  57. package/dist/esm/components/TimePicker/TimePickerSelector.js +2 -2
  58. package/dist/esm/components/Uploader/Dropzone.js +3 -3
  59. package/dist/esm/components/Uploader/Files.js +2 -2
  60. package/dist/esm/components/Uploader/Manager.js +1 -1
  61. package/dist/esm/components/Uploader/Modal.js +1 -1
  62. package/dist/esm/index.js +1 -0
  63. package/dist/esm/provider/ManagerContext.js +5 -0
  64. package/dist/esm/service/SnackbarSonner.js +32 -0
  65. package/dist/esm/styles/calendar-cell.js +5 -5
  66. package/dist/esm/styles/date-picker-input-base.js +1 -1
  67. package/dist/esm/styles/date-segment.js +2 -2
  68. package/dist/esm/styles/groupButton.js +3 -3
  69. package/dist/esm/styles/menubar.js +8 -8
  70. package/dist/esm/styles/progressBar.js +1 -1
  71. package/dist/esm/styles/stepNodeVariants.js +2 -2
  72. package/dist/esm/styles/time-field-input.js +1 -1
  73. package/dist/types/components/PhoneInput/FlagIcon.d.ts +8 -0
  74. package/dist/types/components/PhoneInput/Option.d.ts +6 -0
  75. package/dist/types/components/PhoneInput/Options.d.ts +3 -0
  76. package/dist/types/components/PhoneInput/Popover.d.ts +4 -0
  77. package/dist/types/components/PhoneInput/Root.d.ts +2 -0
  78. package/dist/types/components/PhoneInput/Trigger.d.ts +2 -0
  79. package/dist/types/components/PhoneInput/context.d.ts +15 -0
  80. package/dist/types/components/PhoneInput/index.d.ts +16 -0
  81. package/dist/types/components/PhoneInput/types.d.ts +13 -0
  82. package/dist/types/components/index.d.ts +1 -0
  83. package/dist/types/hooks/useFileUpload.d.ts +4 -4
  84. package/dist/types/provider/ManagerContext.d.ts +1 -1
  85. package/dist/types/service/SnackbarSonner.d.ts +19 -0
  86. package/package.json +5 -3
@@ -8,9 +8,9 @@ const Files = ({
8
8
  onDelete,
9
9
  uploadProgressText = "Upload(s) in progress"
10
10
  }) => {
11
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white w-full border-2 p-deca flex flex-col overflow-y-auto rounded-mili h-[18rem]", children: [
11
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface-overlay w-full border-2 p-deca flex flex-col overflow-y-auto rounded-mili h-[18rem]", children: [
12
12
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-mili items-center mb-deca", children: [
13
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-deca h-deca bg-primary-medium rounded-full text-micro text-light", children: `${files.length}` }),
13
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-deca h-deca bg-primary-medium rounded-full text-micro text-white", children: `${files.length}` }),
14
14
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-md font-semibold", "data-testid": "upload-progress", children: uploadProgressText })
15
15
  ] }),
16
16
  files.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(Upload.File, { file, index, onDelete }, file.uid))
@@ -47,7 +47,7 @@ const Manager = ({
47
47
  children: min ? /* @__PURE__ */ jsxRuntime.jsx(io5.IoChevronUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(io5.IoChevronDown, {})
48
48
  }
49
49
  ),
50
- /* @__PURE__ */ jsxRuntime.jsx("h3", { "data-testid": "upload-progress", children: isLoading ? uploadProgressText : uploadSuccessText }),
50
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { "data-testid": "upload-progress", className: "font-bold text-h4", children: isLoading ? uploadProgressText : uploadSuccessText }),
51
51
  /* @__PURE__ */ jsxRuntime.jsx(
52
52
  Button.Button,
53
53
  {
@@ -18,7 +18,7 @@ const Modal = ({
18
18
  {
19
19
  open,
20
20
  onClose,
21
- className: "flex flex-col bg-secondary-xlight rounded-mili min-w-[70vw] max-w-[95vh] max-h-[95vh] overflow-auto",
21
+ className: "flex flex-col bg-surface-base rounded-mili min-w-[70vw] max-w-[95vh] max-h-[95vh] overflow-auto text-default",
22
22
  children: [
23
23
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between mb-deca", children: [
24
24
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-deca font-semibold ml-tera flex-1 text-center", children: title }),
package/dist/cjs/index.js CHANGED
@@ -44,6 +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/PhoneInput/index.js');
47
48
  var useCalendar = require('./hooks/useCalendar.js');
48
49
  var useCalendarCell = require('./hooks/useCalendarCell.js');
49
50
  var useCalendarGrid = require('./hooks/useCalendarGrid.js');
@@ -127,6 +128,7 @@ exports.TimeFieldInput = TimeFieldInput.TimeFieldInput;
127
128
  exports.Toggle = Toggle.Toggle;
128
129
  exports.Tooltip = Tooltip.Tooltip;
129
130
  exports.Uploader = index$7.Uploader;
131
+ exports.PhoneInput = index$8.PhoneInput;
130
132
  exports.useCalendar = useCalendar.useCalendar;
131
133
  exports.useCalendarCell = useCalendarCell.useCalendarCell;
132
134
  exports.useCalendarGrid = useCalendarGrid.useCalendarGrid;
@@ -66,6 +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/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');
69
74
 
70
75
  const ManagerContext = React.createContext(null);
71
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 text-black hover:bg-primary-light",
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: {
@@ -15,17 +15,17 @@ const calendarCell = tailwindVariants.tv({
15
15
  },
16
16
  isSelected: {
17
17
  true: {
18
- cell: "bg-primary-medium border-2 border-primary-medium text-light hover:bg-primary-medium"
18
+ cell: "bg-primary-medium border-2 border-primary-medium text-white hover:bg-primary-medium"
19
19
  }
20
20
  },
21
21
  isSelectionStart: {
22
22
  true: {
23
- cell: "bg-primary-medium border-2 border-primary-medium rounded-r-none text-light"
23
+ cell: "bg-primary-medium border-2 border-primary-medium rounded-r-none text-white"
24
24
  }
25
25
  },
26
26
  isSelectionEnd: {
27
27
  true: {
28
- cell: "bg-primary-medium border-2 border-primary-medium rounded-l-none text-light"
28
+ cell: "bg-primary-medium border-2 border-primary-medium rounded-l-none text-white"
29
29
  }
30
30
  },
31
31
  inRange: {
@@ -35,7 +35,7 @@ const calendarCell = tailwindVariants.tv({
35
35
  },
36
36
  isDisabled: {
37
37
  true: {
38
- cell: "text-secondary-light cursor-default hover:bg-white-500",
38
+ cell: "text-content-minimal cursor-default hover:bg-surface-overlay",
39
39
  button: "cursor-default"
40
40
  }
41
41
  }
@@ -9,7 +9,7 @@ const datePickerInputBase = tailwindVariants.tv({
9
9
  variants: {
10
10
  disabled: {
11
11
  true: {
12
- icon: "text-secondary-light cursor-default"
12
+ icon: "text-content-minimal cursor-default"
13
13
  }
14
14
  }
15
15
  }
@@ -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-secondary-light"
7
+ base: "focus:outline-none focus:bg-content-minimal"
8
8
  },
9
9
  variants: {
10
10
  disabled: {
11
11
  true: {
12
- base: "text-secondary-light"
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-secondary-medium px-centi py-mili items-center flex text-sub font-bold",
8
- inactive: "bg-white text-secondary-medium disabled:bg-secondary-light",
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-secondary-medium"
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-white z-header sm:justify-start",
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-white flex-1 shadow-default z-popover px-[8vw] absolute"
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-secondary-medium text-label"
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-secondary-dark hover:cursor-pointer text-base",
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-secondary-light",
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-secondary-dark hover:text-primary-medium cursor-pointer"
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-secondary-xlight",
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: {
@@ -30,8 +30,8 @@ const StepNodeVariants = tailwindVariants.tv({
30
30
  content: "font-bold"
31
31
  },
32
32
  false: {
33
- content: "text-secondary-medium",
34
- separator: "bg-secondary-light"
33
+ content: "text-content-low",
34
+ separator: "bg-content-minimal"
35
35
  }
36
36
  },
37
37
  selected: {
@@ -9,7 +9,7 @@ const timePickerInputBase = tailwindVariants.tv({
9
9
  variants: {
10
10
  disabled: {
11
11
  true: {
12
- icon: "text-secondary-light cursor-default"
12
+ icon: "text-content-minimal cursor-default"
13
13
  }
14
14
  }
15
15
  }
@@ -33,7 +33,7 @@ const AccordionTrigger = ({
33
33
  "div",
34
34
  {
35
35
  className: clsx(
36
- "flex justify-between align-center border-secondary-light cursor-pointer",
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-secondary-light flex align-center justify-center p-micro",
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-white": floating && direction === "horizontal"
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-white": floating && direction === "vertical"
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-secondary-medium transition-transform duration-200",
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-secondary-medium transition-transform duration-200",
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-secondary-dark h-mega flex items-center justify-center cursor-pointer aspect-square",
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-secondary-medium cursor-default" : "text-secondary-xdark cursor-pointer"
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-white rounded-micro px-deca py-mili",
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("div", { className: clsx("w-tera h-kilo border overflow-hidden relative", className), children: /* @__PURE__ */ jsx(
8
- "input",
7
+ return /* @__PURE__ */ jsx(
8
+ "div",
9
9
  {
10
- ...rest,
11
- id,
12
- type: "color",
13
- className: "bg-transparent cursor-pointer disabled:opacity-50 disabled:cursor-default absolute -top-1.5 -right-1 w-peta h-giga",
14
- ref
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-white flex flex-row items-center gap-2", children });
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-secondary-medium rounded-mili bg-secondary-xlight overflow-hidden",
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 };