@tecsinapse/cortex-react 1.15.3 → 2.0.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 (49) hide show
  1. package/dist/cjs/components/Button.js +3 -4
  2. package/dist/cjs/components/Card.js +3 -4
  3. package/dist/cjs/components/Carousel/CarouselItem.js +1 -1
  4. package/dist/cjs/components/Checkbox.js +3 -3
  5. package/dist/cjs/components/Hint.js +4 -5
  6. package/dist/cjs/components/Input/Face.js +7 -2
  7. package/dist/cjs/components/Modal.js +3 -4
  8. package/dist/cjs/components/Popover/Trigger.js +1 -1
  9. package/dist/cjs/components/RadioButton.js +14 -17
  10. package/dist/cjs/components/Snackbar/BaseSnackbar.js +4 -7
  11. package/dist/cjs/components/Stepper/Root.js +8 -4
  12. package/dist/cjs/components/Tag.js +20 -23
  13. package/dist/cjs/components/TextArea/Face.js +3 -1
  14. package/dist/cjs/components/Toggle.js +4 -4
  15. package/dist/cjs/hooks/useDebouncedState.js +1 -1
  16. package/dist/cjs/provider/ManagerContext.js +1 -9
  17. package/dist/esm/components/Button.js +3 -4
  18. package/dist/esm/components/Card.js +3 -4
  19. package/dist/esm/components/Carousel/CarouselItem.js +1 -1
  20. package/dist/esm/components/Checkbox.js +4 -4
  21. package/dist/esm/components/Hint.js +4 -5
  22. package/dist/esm/components/Input/Face.js +7 -2
  23. package/dist/esm/components/Modal.js +3 -4
  24. package/dist/esm/components/Popover/Trigger.js +1 -1
  25. package/dist/esm/components/RadioButton.js +14 -17
  26. package/dist/esm/components/Snackbar/BaseSnackbar.js +4 -7
  27. package/dist/esm/components/Stepper/Root.js +8 -4
  28. package/dist/esm/components/Tag.js +20 -23
  29. package/dist/esm/components/TextArea/Face.js +3 -1
  30. package/dist/esm/components/Toggle.js +4 -4
  31. package/dist/esm/hooks/useDebouncedState.js +1 -1
  32. package/dist/esm/provider/ManagerContext.js +1 -9
  33. package/dist/types/components/Button.d.ts +2 -1
  34. package/dist/types/components/Card.d.ts +2 -1
  35. package/dist/types/components/Checkbox.d.ts +2 -1
  36. package/dist/types/components/Hint.d.ts +4 -3
  37. package/dist/types/components/Masonry.d.ts +2 -2
  38. package/dist/types/components/Modal.d.ts +3 -2
  39. package/dist/types/components/RadioButton.d.ts +2 -1
  40. package/dist/types/components/Select/useMultiSelectOption.d.ts +1 -1
  41. package/dist/types/components/Snackbar/BaseSnackbar.d.ts +2 -1
  42. package/dist/types/components/Tag.d.ts +8 -3
  43. package/dist/types/components/Toggle.d.ts +5 -2
  44. package/dist/types/hooks/useCalendarCell.d.ts +1 -1
  45. package/dist/types/hooks/useDatePickerInput.d.ts +1 -1
  46. package/dist/types/hooks/useDateRangePickerInput.d.ts +1 -1
  47. package/dist/types/hooks/useRangeCalendar.d.ts +1 -1
  48. package/dist/types/utils/react.d.ts +1 -1
  49. package/package.json +7 -7
@@ -2,10 +2,9 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
 
7
- const Button = React.forwardRef((props, ref) => {
8
- const { variants, intent, variant, size, children, className, ...rest } = props;
6
+ const Button = (props) => {
7
+ const { variants, intent, variant, size, children, className, ref, ...rest } = props;
9
8
  return /* @__PURE__ */ jsxRuntime.jsx(
10
9
  "button",
11
10
  {
@@ -15,6 +14,6 @@ const Button = React.forwardRef((props, ref) => {
15
14
  children
16
15
  }
17
16
  );
18
- });
17
+ };
19
18
 
20
19
  exports.Button = Button;
@@ -2,11 +2,10 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
 
7
- const Card = React.forwardRef((props, ref) => {
8
- const { children, className, ...rest } = props;
6
+ const Card = (props) => {
7
+ const { children, className, ref, ...rest } = props;
9
8
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cortexCore.card({ className }), ref, ...rest, children });
10
- });
9
+ };
11
10
 
12
11
  exports.Card = Card;
@@ -57,7 +57,7 @@ const CarouselItem = ({ item }) => {
57
57
  {
58
58
  type: "button",
59
59
  "data-testid": "button-link-carousel",
60
- className: "z-absolute absolute bottom-deca left-[10%]",
60
+ className: "z-absolute absolute bottom-giga left-[10%]",
61
61
  children: item.button.title
62
62
  }
63
63
  )
@@ -4,9 +4,9 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
5
  var React = require('react');
6
6
 
7
- const Checkbox = React.forwardRef((props, ref) => {
7
+ const Checkbox = (props) => {
8
8
  const localRef = React.useRef(null);
9
- const { className, indeterminate, ...rest } = props;
9
+ const { className, indeterminate, ref, ...rest } = props;
10
10
  const setIndeterminate = React.useCallback((value) => {
11
11
  if (localRef?.current) {
12
12
  localRef.current.indeterminate = value;
@@ -31,6 +31,6 @@ const Checkbox = React.forwardRef((props, ref) => {
31
31
  ...rest
32
32
  }
33
33
  );
34
- });
34
+ };
35
35
 
36
36
  exports.Checkbox = Checkbox;
@@ -2,11 +2,10 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
 
7
- const Hint = React.forwardRef((props, ref) => {
8
- const { children, variants } = props;
9
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cortexCore.hint(variants), ref, children: children ?? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
10
- });
6
+ const Hint = (props) => {
7
+ const { children, variants, ref, ...rest } = props;
8
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cortexCore.hint(variants), ref, ...rest, children: children ?? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
9
+ };
11
10
 
12
11
  exports.Hint = Hint;
@@ -13,14 +13,19 @@ const getValidChildren = (children) => {
13
13
  const InputFace = React.forwardRef(
14
14
  ({ children, variants, className, ...rest }, ref) => {
15
15
  const clones = getValidChildren(children).map((el) => {
16
- return React.cloneElement(el, { ...el.props, variants });
16
+ const element = el;
17
+ const elProps = element.props || {};
18
+ return React.cloneElement(element, { ...elProps, variants });
17
19
  });
18
20
  return /* @__PURE__ */ jsxRuntime.jsx(
19
21
  "div",
20
22
  {
21
23
  "data-testid": "input-face",
22
24
  ...rest,
23
- className: clsx(cortexCore.input(variants), className),
25
+ className: clsx(
26
+ cortexCore.input(variants),
27
+ className
28
+ ),
24
29
  ref,
25
30
  children: clones
26
31
  }
@@ -2,10 +2,9 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
 
7
- const Modal = React.forwardRef((props, ref) => {
8
- const { open, onClose, children, className, ...rest } = props;
6
+ const Modal = (props) => {
7
+ const { open, onClose, children, className, ref, ...rest } = props;
9
8
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10
9
  /* @__PURE__ */ jsxRuntime.jsx(
11
10
  "div",
@@ -26,6 +25,6 @@ const Modal = React.forwardRef((props, ref) => {
26
25
  }
27
26
  )
28
27
  ] });
29
- });
28
+ };
30
29
 
31
30
  exports.Modal = Modal;
@@ -13,7 +13,7 @@ const isDisabledProps = {
13
13
  };
14
14
  const PopoverTrigger = ({ children, disabled }) => {
15
15
  const { triggerProps } = Context.usePopoverContext();
16
- const isDisabled = disabled ?? children.props?.disabled;
16
+ const isDisabled = disabled ?? children.props.disabled;
17
17
  return react.cloneWithProps(children, {
18
18
  ...triggerProps,
19
19
  ...isDisabled ? isDisabledProps : {}
@@ -2,24 +2,21 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
 
7
6
  const { container, input, label: labelStyle } = cortexCore.radioButtonStyles();
8
- const RadioButton = React.forwardRef(
9
- ({ label, reversed, id, ...rest }, ref) => {
10
- return /* @__PURE__ */ jsxRuntime.jsxs(
11
- "div",
12
- {
13
- className: container({ reversed }),
14
- ref,
15
- "data-testid": "radio-button-container",
16
- children: [
17
- /* @__PURE__ */ jsxRuntime.jsx("input", { id, type: "radio", className: input(), ...rest }),
18
- label ? /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: labelStyle(), children: label }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
19
- ]
20
- }
21
- );
22
- }
23
- );
7
+ const RadioButton = ({ label, reversed, id, ref, ...rest }) => {
8
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9
+ "div",
10
+ {
11
+ className: container({ reversed }),
12
+ ref,
13
+ "data-testid": "radio-button-container",
14
+ children: [
15
+ /* @__PURE__ */ jsxRuntime.jsx("input", { id, type: "radio", className: input(), ...rest }),
16
+ label ? /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: labelStyle(), children: label }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
17
+ ]
18
+ }
19
+ );
20
+ };
24
21
 
25
22
  exports.RadioButton = RadioButton;
@@ -2,13 +2,10 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
 
7
- const BaseSnackbar = React.forwardRef(
8
- (props, ref) => {
9
- const { children, show, variants } = props;
10
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: show ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cortexCore.snackbar(variants), ref, "data-testid": "snackbar", children }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
11
- }
12
- );
6
+ const BaseSnackbar = (props) => {
7
+ const { children, show, variants, ref } = props;
8
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: show ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cortexCore.snackbar(variants), ref, "data-testid": "snackbar", children }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
9
+ };
13
10
 
14
11
  exports.BaseSnackbar = BaseSnackbar;
@@ -14,8 +14,11 @@ const Root = ({
14
14
  const initialSelectedIndex = React.useMemo(() => {
15
15
  let initialIndex = null;
16
16
  React.Children.forEach(children, (child, index) => {
17
- if (React.isValidElement(child) && child.props.selected) {
18
- initialIndex = index;
17
+ if (React.isValidElement(child)) {
18
+ const element = child;
19
+ if (element.props.selected) {
20
+ initialIndex = index;
21
+ }
19
22
  }
20
23
  });
21
24
  return initialIndex;
@@ -41,13 +44,14 @@ const Root = ({
41
44
  const renderNode = React.useMemo(
42
45
  () => (child, index) => {
43
46
  if (React.isValidElement(child) && child.type === Node.Node) {
44
- return React.cloneElement(child, {
47
+ const element = child;
48
+ return React.cloneElement(element, {
45
49
  isFirst: index === 0,
46
50
  isLast: index === childrenCount - 1,
47
51
  selected: selectedNode === index,
48
52
  segmented,
49
53
  interactive,
50
- onClick: () => handleNodeClick(index, child.props.onClick)
54
+ onClick: () => handleNodeClick(index, element.props.onClick)
51
55
  });
52
56
  }
53
57
  return null;
@@ -2,7 +2,6 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
  var lia = require('react-icons/lia');
7
6
 
8
7
  const Close = ({
@@ -28,8 +27,8 @@ const Label = ({
28
27
  }) => {
29
28
  return /* @__PURE__ */ jsxRuntime.jsx("p", { className, ...rest, children });
30
29
  };
31
- const Face = React.forwardRef((props, ref) => {
32
- const { variants, className, intent, children, style, ...rest } = props;
30
+ const Face = (props) => {
31
+ const { variants, className, intent, children, style, ref, ...rest } = props;
33
32
  return /* @__PURE__ */ jsxRuntime.jsx(
34
33
  "div",
35
34
  {
@@ -44,26 +43,24 @@ const Face = React.forwardRef((props, ref) => {
44
43
  children
45
44
  }
46
45
  );
47
- });
48
- const Root = React.forwardRef(
49
- (props, ref) => {
50
- const { label, variants, intent, className, onDismiss, ...rest } = props;
51
- return /* @__PURE__ */ jsxRuntime.jsxs(
52
- Face,
53
- {
54
- ...rest,
55
- variants,
56
- intent,
57
- className,
58
- ref,
59
- children: [
60
- /* @__PURE__ */ jsxRuntime.jsx(Label, { children: label }),
61
- onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(Close, { onClick: onDismiss }) : null
62
- ]
63
- }
64
- );
65
- }
66
- );
46
+ };
47
+ const Root = (props) => {
48
+ const { label, variants, intent, className, onDismiss, ref, ...rest } = props;
49
+ return /* @__PURE__ */ jsxRuntime.jsxs(
50
+ Face,
51
+ {
52
+ ...rest,
53
+ variants,
54
+ intent,
55
+ className,
56
+ ref,
57
+ children: [
58
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: label }),
59
+ onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(Close, { onClick: onDismiss }) : null
60
+ ]
61
+ }
62
+ );
63
+ };
67
64
  const Tag = {
68
65
  Root,
69
66
  Close,
@@ -9,7 +9,9 @@ var utils = require('./utils.js');
9
9
  const TextAreaFace = React.forwardRef(
10
10
  ({ children, variants, className, ...rest }, ref) => {
11
11
  const clones = utils.getValidChildren(children).map((el) => {
12
- return React.cloneElement(el, { ...el.props, variants });
12
+ const element = el;
13
+ const elProps = element.props || {};
14
+ return React.cloneElement(element, { ...elProps, variants });
13
15
  });
14
16
  return /* @__PURE__ */ jsxRuntime.jsx(
15
17
  "div",
@@ -2,9 +2,9 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cortexCore = require('@tecsinapse/cortex-core');
5
- var React = require('react');
6
5
 
7
- const Toggle = React.forwardRef((props, ref) => {
6
+ const Toggle = (props) => {
7
+ const { ref, ...rest } = props;
8
8
  return /* @__PURE__ */ jsxRuntime.jsx(
9
9
  "div",
10
10
  {
@@ -18,13 +18,13 @@ const Toggle = React.forwardRef((props, ref) => {
18
18
  className: cortexCore.styleInputElement(),
19
19
  ref,
20
20
  "data-testid": "toggle-input",
21
- ...props
21
+ ...rest
22
22
  }
23
23
  ),
24
24
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: cortexCore.toggle() })
25
25
  ] })
26
26
  }
27
27
  );
28
- });
28
+ };
29
29
 
30
30
  exports.Toggle = Toggle;
@@ -3,7 +3,7 @@
3
3
  var React = require('react');
4
4
 
5
5
  function useDebouncedState(initialState, timeoutCallback, timeoutMs = 166) {
6
- const timeoutId = React.useRef();
6
+ const timeoutId = React.useRef(void 0);
7
7
  const [state, setState] = React.useState(initialState);
8
8
  React.useEffect(() => {
9
9
  if (timeoutId.current) clearTimeout(timeoutId.current);
@@ -9,8 +9,7 @@ require('react-icons/lia');
9
9
  require('@internationalized/date');
10
10
  require('../components/Badge.js');
11
11
  require('react-icons/md');
12
- require('../components/Card.js');
13
- require('../components/Button.js');
12
+ require('@tecsinapse/cortex-core');
14
13
  require('react-aria');
15
14
  require('react-stately');
16
15
  require('./MenubarContext.js');
@@ -23,17 +22,14 @@ var types = require('../components/Uploader/types.js');
23
22
  require('@floating-ui/react');
24
23
  require('currency.js');
25
24
  require('../components/Calendar/CalendarCell.js');
26
- require('@tecsinapse/cortex-core');
27
25
  require('react-icons/fa');
28
26
  require('react-icons/io');
29
27
  require('embla-carousel-react');
30
28
  require('embla-carousel-autoplay');
31
- require('../components/Checkbox.js');
32
29
  require('../components/ColorPicker.js');
33
30
  require('../components/DatePicker/DateSegment.js');
34
31
  require('../components/DatePicker/DatePickerInputBase.js');
35
32
  require('../components/GroupButton.js');
36
- require('../components/Hint.js');
37
33
  require('../components/Input/Box.js');
38
34
  require('../components/Input/Face.js');
39
35
  require('../components/Input/Left.js');
@@ -51,7 +47,6 @@ require('../components/Menubar/Header.js');
51
47
  require('../components/Menubar/Item.js');
52
48
  require('./CategoriesContext.js');
53
49
  require('../components/Menubar/SubItem.js');
54
- require('../components/Modal.js');
55
50
  require('../components/ProgressBar/Progress.js');
56
51
  require('../components/RadioButton.js');
57
52
  require('../components/Select/GroupedOptions.js');
@@ -60,16 +55,13 @@ require('../components/Select/MultiGroupedOptions.js');
60
55
  require('../components/Select/MultiOptions.js');
61
56
  require('../components/Select/Options.js');
62
57
  require('../components/Select/Trigger.js');
63
- require('../components/Snackbar/BaseSnackbar.js');
64
58
  require('../styles/stepNodeVariants.js');
65
- require('../components/Tag.js');
66
59
  require('../components/TextArea/Box.js');
67
60
  require('../components/TextArea/Face.js');
68
61
  require('../components/TextArea/Left.js');
69
62
  require('../components/TextArea/Right.js');
70
63
  require('../components/TextArea/Root.js');
71
64
  require('../components/TimePicker/TimeFieldInput.js');
72
- require('../components/Toggle.js');
73
65
  require('../components/Tooltip.js');
74
66
  require('react-icons/hi2');
75
67
  require('react-icons/fa6');
@@ -1,9 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { button } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
 
5
- const Button = forwardRef((props, ref) => {
6
- const { variants, intent, variant, size, children, className, ...rest } = props;
4
+ const Button = (props) => {
5
+ const { variants, intent, variant, size, children, className, ref, ...rest } = props;
7
6
  return /* @__PURE__ */ jsx(
8
7
  "button",
9
8
  {
@@ -13,6 +12,6 @@ const Button = forwardRef((props, ref) => {
13
12
  children
14
13
  }
15
14
  );
16
- });
15
+ };
17
16
 
18
17
  export { Button };
@@ -1,10 +1,9 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { card } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
 
5
- const Card = forwardRef((props, ref) => {
6
- const { children, className, ...rest } = props;
4
+ const Card = (props) => {
5
+ const { children, className, ref, ...rest } = props;
7
6
  return /* @__PURE__ */ jsx("div", { className: card({ className }), ref, ...rest, children });
8
- });
7
+ };
9
8
 
10
9
  export { Card };
@@ -55,7 +55,7 @@ const CarouselItem = ({ item }) => {
55
55
  {
56
56
  type: "button",
57
57
  "data-testid": "button-link-carousel",
58
- className: "z-absolute absolute bottom-deca left-[10%]",
58
+ className: "z-absolute absolute bottom-giga left-[10%]",
59
59
  children: item.button.title
60
60
  }
61
61
  )
@@ -1,10 +1,10 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { checkbox } from '@tecsinapse/cortex-core';
3
- import { forwardRef, useRef, useCallback, useEffect, useImperativeHandle } from 'react';
3
+ import { useRef, useCallback, useEffect, useImperativeHandle } from 'react';
4
4
 
5
- const Checkbox = forwardRef((props, ref) => {
5
+ const Checkbox = (props) => {
6
6
  const localRef = useRef(null);
7
- const { className, indeterminate, ...rest } = props;
7
+ const { className, indeterminate, ref, ...rest } = props;
8
8
  const setIndeterminate = useCallback((value) => {
9
9
  if (localRef?.current) {
10
10
  localRef.current.indeterminate = value;
@@ -29,6 +29,6 @@ const Checkbox = forwardRef((props, ref) => {
29
29
  ...rest
30
30
  }
31
31
  );
32
- });
32
+ };
33
33
 
34
34
  export { Checkbox };
@@ -1,10 +1,9 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { hint } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
 
5
- const Hint = forwardRef((props, ref) => {
6
- const { children, variants } = props;
7
- return /* @__PURE__ */ jsx("div", { className: hint(variants), ref, children: children ?? /* @__PURE__ */ jsx(Fragment, {}) });
8
- });
4
+ const Hint = (props) => {
5
+ const { children, variants, ref, ...rest } = props;
6
+ return /* @__PURE__ */ jsx("div", { className: hint(variants), ref, ...rest, children: children ?? /* @__PURE__ */ jsx(Fragment, {}) });
7
+ };
9
8
 
10
9
  export { Hint };
@@ -11,14 +11,19 @@ const getValidChildren = (children) => {
11
11
  const InputFace = React.forwardRef(
12
12
  ({ children, variants, className, ...rest }, ref) => {
13
13
  const clones = getValidChildren(children).map((el) => {
14
- return React.cloneElement(el, { ...el.props, variants });
14
+ const element = el;
15
+ const elProps = element.props || {};
16
+ return React.cloneElement(element, { ...elProps, variants });
15
17
  });
16
18
  return /* @__PURE__ */ jsx(
17
19
  "div",
18
20
  {
19
21
  "data-testid": "input-face",
20
22
  ...rest,
21
- className: clsx(input(variants), className),
23
+ className: clsx(
24
+ input(variants),
25
+ className
26
+ ),
22
27
  ref,
23
28
  children: clones
24
29
  }
@@ -1,9 +1,8 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { overlay, modal } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
 
5
- const Modal = forwardRef((props, ref) => {
6
- const { open, onClose, children, className, ...rest } = props;
4
+ const Modal = (props) => {
5
+ const { open, onClose, children, className, ref, ...rest } = props;
7
6
  return /* @__PURE__ */ jsxs(Fragment, { children: [
8
7
  /* @__PURE__ */ jsx(
9
8
  "div",
@@ -24,6 +23,6 @@ const Modal = forwardRef((props, ref) => {
24
23
  }
25
24
  )
26
25
  ] });
27
- });
26
+ };
28
27
 
29
28
  export { Modal };
@@ -11,7 +11,7 @@ const isDisabledProps = {
11
11
  };
12
12
  const PopoverTrigger = ({ children, disabled }) => {
13
13
  const { triggerProps } = usePopoverContext();
14
- const isDisabled = disabled ?? children.props?.disabled;
14
+ const isDisabled = disabled ?? children.props.disabled;
15
15
  return cloneWithProps(children, {
16
16
  ...triggerProps,
17
17
  ...isDisabled ? isDisabledProps : {}
@@ -1,23 +1,20 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { radioButtonStyles } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
 
5
4
  const { container, input, label: labelStyle } = radioButtonStyles();
6
- const RadioButton = forwardRef(
7
- ({ label, reversed, id, ...rest }, ref) => {
8
- return /* @__PURE__ */ jsxs(
9
- "div",
10
- {
11
- className: container({ reversed }),
12
- ref,
13
- "data-testid": "radio-button-container",
14
- children: [
15
- /* @__PURE__ */ jsx("input", { id, type: "radio", className: input(), ...rest }),
16
- label ? /* @__PURE__ */ jsx("label", { htmlFor: id, className: labelStyle(), children: label }) : /* @__PURE__ */ jsx(Fragment, {})
17
- ]
18
- }
19
- );
20
- }
21
- );
5
+ const RadioButton = ({ label, reversed, id, ref, ...rest }) => {
6
+ return /* @__PURE__ */ jsxs(
7
+ "div",
8
+ {
9
+ className: container({ reversed }),
10
+ ref,
11
+ "data-testid": "radio-button-container",
12
+ children: [
13
+ /* @__PURE__ */ jsx("input", { id, type: "radio", className: input(), ...rest }),
14
+ label ? /* @__PURE__ */ jsx("label", { htmlFor: id, className: labelStyle(), children: label }) : /* @__PURE__ */ jsx(Fragment, {})
15
+ ]
16
+ }
17
+ );
18
+ };
22
19
 
23
20
  export { RadioButton };
@@ -1,12 +1,9 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { snackbar } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
 
5
- const BaseSnackbar = forwardRef(
6
- (props, ref) => {
7
- const { children, show, variants } = props;
8
- return /* @__PURE__ */ jsx(Fragment, { children: show ? /* @__PURE__ */ jsx("div", { className: snackbar(variants), ref, "data-testid": "snackbar", children }) : /* @__PURE__ */ jsx(Fragment, {}) });
9
- }
10
- );
4
+ const BaseSnackbar = (props) => {
5
+ const { children, show, variants, ref } = props;
6
+ return /* @__PURE__ */ jsx(Fragment, { children: show ? /* @__PURE__ */ jsx("div", { className: snackbar(variants), ref, "data-testid": "snackbar", children }) : /* @__PURE__ */ jsx(Fragment, {}) });
7
+ };
11
8
 
12
9
  export { BaseSnackbar };
@@ -12,8 +12,11 @@ const Root = ({
12
12
  const initialSelectedIndex = useMemo(() => {
13
13
  let initialIndex = null;
14
14
  React.Children.forEach(children, (child, index) => {
15
- if (React.isValidElement(child) && child.props.selected) {
16
- initialIndex = index;
15
+ if (React.isValidElement(child)) {
16
+ const element = child;
17
+ if (element.props.selected) {
18
+ initialIndex = index;
19
+ }
17
20
  }
18
21
  });
19
22
  return initialIndex;
@@ -39,13 +42,14 @@ const Root = ({
39
42
  const renderNode = useMemo(
40
43
  () => (child, index) => {
41
44
  if (React.isValidElement(child) && child.type === Node) {
42
- return React.cloneElement(child, {
45
+ const element = child;
46
+ return React.cloneElement(element, {
43
47
  isFirst: index === 0,
44
48
  isLast: index === childrenCount - 1,
45
49
  selected: selectedNode === index,
46
50
  segmented,
47
51
  interactive,
48
- onClick: () => handleNodeClick(index, child.props.onClick)
52
+ onClick: () => handleNodeClick(index, element.props.onClick)
49
53
  });
50
54
  }
51
55
  return null;
@@ -1,6 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { tag } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
  import { LiaTimesSolid } from 'react-icons/lia';
5
4
 
6
5
  const Close = ({
@@ -26,8 +25,8 @@ const Label = ({
26
25
  }) => {
27
26
  return /* @__PURE__ */ jsx("p", { className, ...rest, children });
28
27
  };
29
- const Face = forwardRef((props, ref) => {
30
- const { variants, className, intent, children, style, ...rest } = props;
28
+ const Face = (props) => {
29
+ const { variants, className, intent, children, style, ref, ...rest } = props;
31
30
  return /* @__PURE__ */ jsx(
32
31
  "div",
33
32
  {
@@ -42,26 +41,24 @@ const Face = forwardRef((props, ref) => {
42
41
  children
43
42
  }
44
43
  );
45
- });
46
- const Root = forwardRef(
47
- (props, ref) => {
48
- const { label, variants, intent, className, onDismiss, ...rest } = props;
49
- return /* @__PURE__ */ jsxs(
50
- Face,
51
- {
52
- ...rest,
53
- variants,
54
- intent,
55
- className,
56
- ref,
57
- children: [
58
- /* @__PURE__ */ jsx(Label, { children: label }),
59
- onDismiss ? /* @__PURE__ */ jsx(Close, { onClick: onDismiss }) : null
60
- ]
61
- }
62
- );
63
- }
64
- );
44
+ };
45
+ const Root = (props) => {
46
+ const { label, variants, intent, className, onDismiss, ref, ...rest } = props;
47
+ return /* @__PURE__ */ jsxs(
48
+ Face,
49
+ {
50
+ ...rest,
51
+ variants,
52
+ intent,
53
+ className,
54
+ ref,
55
+ children: [
56
+ /* @__PURE__ */ jsx(Label, { children: label }),
57
+ onDismiss ? /* @__PURE__ */ jsx(Close, { onClick: onDismiss }) : null
58
+ ]
59
+ }
60
+ );
61
+ };
65
62
  const Tag = {
66
63
  Root,
67
64
  Close,
@@ -7,7 +7,9 @@ import { getValidChildren } from './utils.js';
7
7
  const TextAreaFace = React.forwardRef(
8
8
  ({ children, variants, className, ...rest }, ref) => {
9
9
  const clones = getValidChildren(children).map((el) => {
10
- return React.cloneElement(el, { ...el.props, variants });
10
+ const element = el;
11
+ const elProps = element.props || {};
12
+ return React.cloneElement(element, { ...elProps, variants });
11
13
  });
12
14
  return /* @__PURE__ */ jsx(
13
15
  "div",
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { styleLabelElement, styleInputElement, toggle } from '@tecsinapse/cortex-core';
3
- import { forwardRef } from 'react';
4
3
 
5
- const Toggle = forwardRef((props, ref) => {
4
+ const Toggle = (props) => {
5
+ const { ref, ...rest } = props;
6
6
  return /* @__PURE__ */ jsx(
7
7
  "div",
8
8
  {
@@ -16,13 +16,13 @@ const Toggle = forwardRef((props, ref) => {
16
16
  className: styleInputElement(),
17
17
  ref,
18
18
  "data-testid": "toggle-input",
19
- ...props
19
+ ...rest
20
20
  }
21
21
  ),
22
22
  /* @__PURE__ */ jsx("div", { className: toggle() })
23
23
  ] })
24
24
  }
25
25
  );
26
- });
26
+ };
27
27
 
28
28
  export { Toggle };
@@ -1,7 +1,7 @@
1
1
  import { useRef, useState, useEffect } from 'react';
2
2
 
3
3
  function useDebouncedState(initialState, timeoutCallback, timeoutMs = 166) {
4
- const timeoutId = useRef();
4
+ const timeoutId = useRef(void 0);
5
5
  const [state, setState] = useState(initialState);
6
6
  useEffect(() => {
7
7
  if (timeoutId.current) clearTimeout(timeoutId.current);
@@ -7,8 +7,7 @@ import 'react-icons/lia';
7
7
  import '@internationalized/date';
8
8
  import '../components/Badge.js';
9
9
  import 'react-icons/md';
10
- import '../components/Card.js';
11
- import '../components/Button.js';
10
+ import '@tecsinapse/cortex-core';
12
11
  import 'react-aria';
13
12
  import 'react-stately';
14
13
  import './MenubarContext.js';
@@ -21,17 +20,14 @@ import { FileStatus } from '../components/Uploader/types.js';
21
20
  import '@floating-ui/react';
22
21
  import 'currency.js';
23
22
  import '../components/Calendar/CalendarCell.js';
24
- import '@tecsinapse/cortex-core';
25
23
  import 'react-icons/fa';
26
24
  import 'react-icons/io';
27
25
  import 'embla-carousel-react';
28
26
  import 'embla-carousel-autoplay';
29
- import '../components/Checkbox.js';
30
27
  import '../components/ColorPicker.js';
31
28
  import '../components/DatePicker/DateSegment.js';
32
29
  import '../components/DatePicker/DatePickerInputBase.js';
33
30
  import '../components/GroupButton.js';
34
- import '../components/Hint.js';
35
31
  import '../components/Input/Box.js';
36
32
  import '../components/Input/Face.js';
37
33
  import '../components/Input/Left.js';
@@ -49,7 +45,6 @@ import '../components/Menubar/Header.js';
49
45
  import '../components/Menubar/Item.js';
50
46
  import './CategoriesContext.js';
51
47
  import '../components/Menubar/SubItem.js';
52
- import '../components/Modal.js';
53
48
  import '../components/ProgressBar/Progress.js';
54
49
  import '../components/RadioButton.js';
55
50
  import '../components/Select/GroupedOptions.js';
@@ -58,16 +53,13 @@ import '../components/Select/MultiGroupedOptions.js';
58
53
  import '../components/Select/MultiOptions.js';
59
54
  import '../components/Select/Options.js';
60
55
  import '../components/Select/Trigger.js';
61
- import '../components/Snackbar/BaseSnackbar.js';
62
56
  import '../styles/stepNodeVariants.js';
63
- import '../components/Tag.js';
64
57
  import '../components/TextArea/Box.js';
65
58
  import '../components/TextArea/Face.js';
66
59
  import '../components/TextArea/Left.js';
67
60
  import '../components/TextArea/Right.js';
68
61
  import '../components/TextArea/Root.js';
69
62
  import '../components/TimePicker/TimeFieldInput.js';
70
- import '../components/Toggle.js';
71
63
  import '../components/Tooltip.js';
72
64
  import 'react-icons/hi2';
73
65
  import 'react-icons/fa6';
@@ -6,5 +6,6 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
6
6
  variant?: ButtonVariants['variant'];
7
7
  size?: ButtonVariants['size'];
8
8
  children?: React.ReactNode;
9
+ ref?: React.Ref<HTMLButtonElement>;
9
10
  }
10
- export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
11
+ export declare const Button: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
2
  export interface CardProps extends HTMLAttributes<HTMLDivElement> {
3
3
  children?: React.ReactNode;
4
+ ref?: React.Ref<HTMLDivElement>;
4
5
  }
5
- export declare const Card: React.ForwardRefExoticComponent<CardProps & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
6
+ export declare const Card: (props: CardProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
2
  export interface CheckboxProps extends HTMLAttributes<HTMLInputElement> {
3
3
  indeterminate?: boolean;
4
+ ref?: React.Ref<CheckboxRef>;
4
5
  }
5
6
  export interface CheckboxRef extends HTMLAttributes<HTMLInputElement> {
6
7
  setIndeterminate: (value: boolean) => void;
7
8
  }
8
- export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.HTMLAttributes<HTMLInputElement> & React.RefAttributes<CheckboxRef>>;
9
+ export declare const Checkbox: (props: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { HintVariants } from '@tecsinapse/cortex-core';
2
- import React from 'react';
3
- export interface HintProps {
2
+ import React, { HTMLProps } from 'react';
3
+ export interface HintProps extends Omit<HTMLProps<HTMLDivElement>, 'className'> {
4
4
  children: React.ReactNode;
5
5
  variants?: HintVariants;
6
+ ref?: React.Ref<HTMLDivElement>;
6
7
  }
7
- export declare const Hint: React.ForwardRefExoticComponent<Omit<HintProps & Omit<React.HTMLProps<HTMLDivElement>, "className">, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const Hint: (props: HintProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  export interface MasonryProps {
3
3
  columns: number;
4
4
  children?: ReactNode;
5
5
  }
6
- declare const Masonry: ({ children, columns }: MasonryProps) => JSX.Element;
6
+ declare const Masonry: ({ children, columns }: MasonryProps) => React.ReactElement;
7
7
  export default Masonry;
@@ -1,8 +1,9 @@
1
1
  import { ReactNode, type DialogHTMLAttributes } from 'react';
2
- interface ModalProps {
2
+ interface ModalProps extends DialogHTMLAttributes<HTMLDialogElement> {
3
3
  open: boolean;
4
4
  onClose: () => void;
5
5
  children?: ReactNode;
6
+ ref?: React.Ref<HTMLDialogElement>;
6
7
  }
7
- export declare const Modal: import("react").ForwardRefExoticComponent<ModalProps & DialogHTMLAttributes<HTMLDialogElement> & import("react").RefAttributes<HTMLDialogElement>>;
8
+ export declare const Modal: (props: ModalProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -2,5 +2,6 @@ import React, { InputHTMLAttributes } from 'react';
2
2
  export interface RadioButtonProps extends InputHTMLAttributes<HTMLInputElement> {
3
3
  label?: string;
4
4
  reversed?: boolean;
5
+ ref?: React.Ref<HTMLDivElement>;
5
6
  }
6
- export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLDivElement>>;
7
+ export declare const RadioButton: ({ label, reversed, id, ref, ...rest }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,6 @@ export declare const useMultiSelectOption: <T>(option: T, onSelect?: (option: T[
3
3
  value: any;
4
4
  isChecked: boolean;
5
5
  onClickOption: () => void;
6
- inputRef: import("react").RefObject<HTMLInputElement>;
6
+ inputRef: import("react").RefObject<HTMLInputElement | null>;
7
7
  labelExtractor: (value: any) => string;
8
8
  };
@@ -4,6 +4,7 @@ interface SnackbarProps {
4
4
  variants?: SnackbarVariants;
5
5
  children?: ReactNode;
6
6
  show: boolean;
7
+ ref?: React.Ref<HTMLDivElement>;
7
8
  }
8
- export declare const BaseSnackbar: React.ForwardRefExoticComponent<SnackbarProps & React.RefAttributes<HTMLDivElement>>;
9
+ export declare const BaseSnackbar: (props: SnackbarProps) => import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -1,14 +1,19 @@
1
1
  import { TagVariants } from '@tecsinapse/cortex-core';
2
2
  import React, { HTMLProps } from 'react';
3
- export interface TagProps {
3
+ export interface TagProps extends HTMLProps<HTMLDivElement> {
4
4
  variants?: TagVariants;
5
5
  intent?: TagVariants['intent'];
6
6
  label: string;
7
7
  onDismiss?: () => void;
8
+ ref?: React.Ref<HTMLDivElement>;
9
+ }
10
+ interface FaceProps extends Pick<TagProps, 'variants' | 'intent'>, HTMLProps<HTMLDivElement> {
11
+ ref?: React.Ref<HTMLDivElement>;
8
12
  }
9
13
  export declare const Tag: {
10
- Root: React.ForwardRefExoticComponent<Omit<TagProps & React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
+ Root: (props: TagProps) => import("react/jsx-runtime").JSX.Element;
11
15
  Close: ({ onClick, className, ...rest }: Omit<HTMLProps<HTMLButtonElement>, "children" | "type">) => import("react/jsx-runtime").JSX.Element;
12
16
  Label: ({ children, className, ...rest }: HTMLProps<HTMLParagraphElement>) => import("react/jsx-runtime").JSX.Element;
13
- Face: React.ForwardRefExoticComponent<Omit<Pick<TagProps, "intent" | "variants"> & React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
+ Face: (props: FaceProps) => import("react/jsx-runtime").JSX.Element;
14
18
  };
19
+ export {};
@@ -1,2 +1,5 @@
1
- import React from 'react';
2
- export declare const Toggle: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
1
+ import React, { InputHTMLAttributes } from 'react';
2
+ export interface ToggleProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ ref?: React.Ref<HTMLInputElement>;
4
+ }
5
+ export declare const Toggle: (props: ToggleProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,7 +5,7 @@ interface useCalendarCellProps {
5
5
  date: CalendarDate;
6
6
  }
7
7
  export declare const useCalendarCell: ({ state, date }: useCalendarCellProps) => {
8
- ref: import("react").MutableRefObject<null>;
8
+ ref: import("react").RefObject<null>;
9
9
  cellProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
10
10
  buttonProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
11
11
  isSelected: boolean;
@@ -7,6 +7,6 @@ interface useDatePickerInputProps {
7
7
  export declare const useDatePickerInput: ({ value, onChange, minValue, maxValue, }: useDatePickerInputProps) => {
8
8
  fieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
9
9
  state: import("react-stately").DatePickerState;
10
- ref: import("react").MutableRefObject<null>;
10
+ ref: import("react").RefObject<null>;
11
11
  };
12
12
  export {};
@@ -9,6 +9,6 @@ export declare const useDateRangePickerInput: ({ value, onChange, minValue, maxV
9
9
  startFieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
10
10
  endFieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
11
11
  state: import("react-stately").DateRangePickerState;
12
- ref: import("react").MutableRefObject<null>;
12
+ ref: import("react").RefObject<null>;
13
13
  };
14
14
  export {};
@@ -9,6 +9,6 @@ export declare const useRangeCalendar: ({ value, onChange, minValue, maxValue, }
9
9
  calendarProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
10
10
  title: string;
11
11
  state: import("react-stately").RangeCalendarState;
12
- ref: import("react").MutableRefObject<null>;
12
+ ref: import("react").RefObject<null>;
13
13
  };
14
14
  export {};
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare function cloneWithProps(children: React.ReactElement, props: any): React.FunctionComponentElement<any>;
2
+ export declare function cloneWithProps(children: React.ReactElement, props: React.HTMLAttributes<HTMLDivElement>): React.FunctionComponentElement<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.15.3",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@floating-ui/react": "^0.26.18",
22
22
  "@internationalized/date": "3.7.0",
23
- "@tecsinapse/cortex-core": "1.2.0",
23
+ "@tecsinapse/cortex-core": "2.0.0-beta.0",
24
24
  "clsx": "2.1.1",
25
25
  "currency.js": "2.0.4",
26
26
  "embla-carousel-autoplay": "^8.0.0",
@@ -43,10 +43,10 @@
43
43
  },
44
44
  "homepage": "https://tecsinapse.github.io/design-system/",
45
45
  "peerDependencies": {
46
- "react": ">=18.0.0",
47
- "react-dom": ">=18.0.0",
46
+ "react": ">=18.0.0 || ^19.0.0",
47
+ "react-dom": ">=18.0.0 || ^19.0.0",
48
48
  "react-icons": ">=5.2.0",
49
- "tailwind": ">=3.3.0"
49
+ "tailwindcss": "^4.1.16"
50
50
  },
51
- "gitHead": "e618077a8d04305e7c1755a5f08b9621b8b7d82a"
52
- }
51
+ "gitHead": "093769fc2a963c315d0062216ca73f692ee3d385"
52
+ }