@ttoss/ui 6.5.0 → 6.6.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/README.md CHANGED
@@ -5,7 +5,7 @@ React component library built on [Theme UI](https://theme-ui.com/) for building
5
5
  ## Installation
6
6
 
7
7
  ```shell
8
- pnpm add @ttoss/ui @ttoss/react-icons @emotion/react
8
+ pnpm add @ttoss/ui @ttoss/react-icons @emotion/react @chakra-ui/react
9
9
  ```
10
10
 
11
11
  **ESM Only**: This package requires ES modules support.
@@ -61,6 +61,61 @@ export const customTheme: Theme = {
61
61
 
62
62
  **Note**: No custom JSX pragma needed when using `sx` prop directly on library components.
63
63
 
64
+ ## Chakra UI Integration
65
+
66
+ This package integrates seamlessly with [Chakra UI](https://chakra-ui.com/). You can import and use any Chakra UI component directly, and it will automatically be styled according to your theme configuration.
67
+
68
+ ### Using Chakra UI Components
69
+
70
+ ```tsx
71
+ import { Button } from '@chakra-ui/react';
72
+ import { ThemeProvider } from '@ttoss/ui';
73
+ import { BruttalTheme } from '@ttoss/theme/Bruttal';
74
+
75
+ export const App = () => (
76
+ <ThemeProvider theme={BruttalTheme}>
77
+ {/* Chakra Button automatically styled with BruttalTheme */}
78
+ <Button colorScheme="blue">Chakra Button</Button>
79
+ </ThemeProvider>
80
+ );
81
+ ```
82
+
83
+ ### Customizing Chakra Components via Theme
84
+
85
+ You can customize how Chakra UI components render by adding component specifications to your theme:
86
+
87
+ ```tsx
88
+ import type { Theme } from '@ttoss/ui';
89
+
90
+ export const customTheme: Theme = {
91
+ colors: {
92
+ primary: '#007acc',
93
+ },
94
+ // Customize Chakra UI Button component
95
+ components: {
96
+ Button: {
97
+ defaultProps: {
98
+ size: 'lg',
99
+ variant: 'solid',
100
+ },
101
+ variants: {
102
+ solid: {
103
+ bg: 'primary',
104
+ color: 'white',
105
+ },
106
+ },
107
+ },
108
+ },
109
+ };
110
+ ```
111
+
112
+ **Key Points:**
113
+
114
+ - All Chakra UI components work out of the box with `ThemeProvider`
115
+ - Component styles are controlled through theme configuration
116
+ - No need for additional setup or wrappers
117
+ - Full access to Chakra's [component theming API](https://chakra-ui.com/docs/styled-system/component-style)
118
+
64
119
  ## Available Components
65
120
 
66
121
  **Browse all components**: [Storybook Documentation](https://storybook.ttoss.dev/?path=/story/ui)
package/dist/esm/index.js CHANGED
@@ -6,11 +6,76 @@ var __name = (target, value) => __defProp(target, "name", {
6
6
  configurable: true
7
7
  });
8
8
 
9
+ // src/chakra/ChakraThemeProvider.tsx
10
+ import { ChakraProvider as ChakraProviderBase, createSystem, defaultConfig } from "@chakra-ui/react";
11
+ import * as React2 from "react";
12
+
13
+ // src/theme/useTheme.ts
14
+ import { useThemeUI } from "theme-ui";
15
+ var useTheme = useThemeUI;
16
+
17
+ // src/chakra/ChakraThemeProvider.tsx
18
+ var wrapTokenValues = /* @__PURE__ */__name(tokens => {
19
+ if (!tokens) {
20
+ return void 0;
21
+ }
22
+ const wrapped = {};
23
+ for (const [key, value] of Object.entries(tokens)) {
24
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
25
+ wrapped[key] = wrapTokenValues(value);
26
+ } else {
27
+ wrapped[key] = {
28
+ value
29
+ };
30
+ }
31
+ }
32
+ return wrapped;
33
+ }, "wrapTokenValues");
34
+ var toChakraTheme = /* @__PURE__ */__name((themeUITheme, overrides = {}) => {
35
+ const config = {
36
+ theme: {
37
+ tokens: {
38
+ borders: wrapTokenValues(themeUITheme.borders),
39
+ colors: wrapTokenValues(themeUITheme.rawColors ?? themeUITheme.colors),
40
+ fonts: wrapTokenValues(themeUITheme.fonts),
41
+ fontSizes: wrapTokenValues(themeUITheme.fontSizes),
42
+ fontWeights: wrapTokenValues(themeUITheme.fontWeights),
43
+ letterSpacings: wrapTokenValues(themeUITheme.letterSpacings),
44
+ lineHeights: wrapTokenValues(themeUITheme.lineHeights),
45
+ radii: wrapTokenValues(themeUITheme.radii),
46
+ sizes: wrapTokenValues(themeUITheme.sizes),
47
+ spacing: wrapTokenValues(themeUITheme.space),
48
+ zIndex: wrapTokenValues(themeUITheme.zIndices)
49
+ },
50
+ breakpoints: themeUITheme.breakpoints && Array.isArray(themeUITheme.breakpoints) ? {
51
+ sm: themeUITheme.breakpoints[0],
52
+ md: themeUITheme.breakpoints[1],
53
+ lg: themeUITheme.breakpoints[2],
54
+ xl: themeUITheme.breakpoints[3],
55
+ "2xl": themeUITheme.breakpoints[4]
56
+ } : void 0
57
+ },
58
+ ...overrides
59
+ };
60
+ return createSystem(defaultConfig, config);
61
+ }, "toChakraTheme");
62
+ var ChakraProvider = /* @__PURE__ */__name(({
63
+ children
64
+ }) => {
65
+ const themeUITheme = useTheme();
66
+ const chakraSystem = React2.useMemo(() => {
67
+ return toChakraTheme(themeUITheme.theme);
68
+ }, [themeUITheme.theme]);
69
+ return /* @__PURE__ */React2.createElement(ChakraProviderBase, {
70
+ value: chakraSystem
71
+ }, children);
72
+ }, "ChakraProvider");
73
+
9
74
  // src/components/Button.tsx
10
75
  import { Icon } from "@ttoss/react-icons";
11
- import * as React2 from "react";
76
+ import * as React3 from "react";
12
77
  import { Button as ButtonUi } from "theme-ui";
13
- var Button = /* @__PURE__ */React2.forwardRef((props, ref) => {
78
+ var Button = /* @__PURE__ */React3.forwardRef((props, ref) => {
14
79
  const {
15
80
  children,
16
81
  leftIcon,
@@ -18,7 +83,7 @@ var Button = /* @__PURE__ */React2.forwardRef((props, ref) => {
18
83
  loading,
19
84
  ...restProps
20
85
  } = props;
21
- return /* @__PURE__ */React2.createElement(ButtonUi, {
86
+ return /* @__PURE__ */React3.createElement(ButtonUi, {
22
87
  type: "button",
23
88
  ...restProps,
24
89
  ref,
@@ -35,13 +100,13 @@ var Button = /* @__PURE__ */React2.forwardRef((props, ref) => {
35
100
  },
36
101
  ...restProps.sx
37
102
  }
38
- }, loading && /* @__PURE__ */React2.createElement(Icon, {
103
+ }, loading && /* @__PURE__ */React3.createElement(Icon, {
39
104
  inline: true,
40
105
  icon: "three-dots-loading"
41
- }), !loading && leftIcon && /* @__PURE__ */React2.createElement(Icon, {
106
+ }), !loading && leftIcon && /* @__PURE__ */React3.createElement(Icon, {
42
107
  inline: true,
43
108
  icon: leftIcon
44
- }), children, rightIcon && /* @__PURE__ */React2.createElement(Icon, {
109
+ }), children, rightIcon && /* @__PURE__ */React3.createElement(Icon, {
45
110
  inline: true,
46
111
  icon: rightIcon
47
112
  }));
@@ -161,10 +226,10 @@ var Badge = /* @__PURE__ */__name(({
161
226
  import { Box } from "theme-ui";
162
227
 
163
228
  // src/components/Card.tsx
164
- import * as React3 from "react";
229
+ import * as React4 from "react";
165
230
  import { Box as Box2, Card as CardUi } from "theme-ui";
166
231
  var Card = /* @__PURE__ */__name(props => {
167
- return /* @__PURE__ */React3.createElement(CardUi, {
232
+ return /* @__PURE__ */React4.createElement(CardUi, {
168
233
  ...props,
169
234
  sx: {
170
235
  backgroundColor: "display.background.secondary.default",
@@ -184,7 +249,7 @@ var CardTitle = /* @__PURE__ */__name(({
184
249
  children,
185
250
  ...props
186
251
  }) => {
187
- return /* @__PURE__ */React3.createElement(Box2, {
252
+ return /* @__PURE__ */React4.createElement(Box2, {
188
253
  ...props,
189
254
  sx: {
190
255
  paddingY: "4",
@@ -200,7 +265,7 @@ var CardBody = /* @__PURE__ */__name(({
200
265
  children,
201
266
  ...props
202
267
  }) => {
203
- return /* @__PURE__ */React3.createElement(Box2, {
268
+ return /* @__PURE__ */React4.createElement(Box2, {
204
269
  ...props,
205
270
  sx: {
206
271
  paddingY: "4",
@@ -215,7 +280,7 @@ var CardFooter = /* @__PURE__ */__name(({
215
280
  children,
216
281
  ...props
217
282
  }) => {
218
- return /* @__PURE__ */React3.createElement(Box2, {
283
+ return /* @__PURE__ */React4.createElement(Box2, {
219
284
  ...props,
220
285
  sx: {
221
286
  paddingY: "2",
@@ -230,14 +295,14 @@ Card.Body = CardBody;
230
295
  Card.Footer = CardFooter;
231
296
 
232
297
  // src/components/Checkbox.tsx
233
- import * as React4 from "react";
298
+ import * as React5 from "react";
234
299
  import { Checkbox as CheckBoxUi } from "theme-ui";
235
- var Checkbox = /* @__PURE__ */React4.forwardRef(({
300
+ var Checkbox = /* @__PURE__ */React5.forwardRef(({
236
301
  indeterminate = false,
237
302
  ...rest
238
303
  }, ref) => {
239
- const innerRef = React4.useRef(null);
240
- const setRefs = React4.useCallback(element => {
304
+ const innerRef = React5.useRef(null);
305
+ const setRefs = React5.useCallback(element => {
241
306
  innerRef.current = element;
242
307
  if (typeof ref === "function") {
243
308
  ref(element);
@@ -245,19 +310,19 @@ var Checkbox = /* @__PURE__ */React4.forwardRef(({
245
310
  ref.current = element;
246
311
  }
247
312
  }, [ref]);
248
- React4.useEffect(() => {
313
+ React5.useEffect(() => {
249
314
  if (innerRef.current) {
250
315
  innerRef.current.indeterminate = indeterminate;
251
316
  }
252
317
  }, [indeterminate]);
253
318
  if (indeterminate) {
254
- return /* @__PURE__ */React4.createElement("input", {
319
+ return /* @__PURE__ */React5.createElement("input", {
255
320
  type: "checkbox",
256
321
  ref: setRefs,
257
322
  ...rest
258
323
  });
259
324
  }
260
- return /* @__PURE__ */React4.createElement(CheckBoxUi, {
325
+ return /* @__PURE__ */React5.createElement(CheckBoxUi, {
261
326
  ref: setRefs,
262
327
  ...rest
263
328
  });
@@ -278,10 +343,10 @@ var CloseButton = /* @__PURE__ */__name(props => {
278
343
  }, "CloseButton");
279
344
 
280
345
  // src/components/Container.tsx
281
- import * as React5 from "react";
346
+ import * as React6 from "react";
282
347
  import { Container as ContainerUi } from "theme-ui";
283
- var Container = /* @__PURE__ */React5.forwardRef((props, ref) => {
284
- return /* @__PURE__ */React5.createElement(ContainerUi, {
348
+ var Container = /* @__PURE__ */React6.forwardRef((props, ref) => {
349
+ return /* @__PURE__ */React6.createElement(ContainerUi, {
285
350
  ref,
286
351
  ...props
287
352
  });
@@ -351,7 +416,7 @@ var IconButton = /* @__PURE__ */__name(props => {
351
416
  import { Image } from "theme-ui";
352
417
 
353
418
  // src/components/InfiniteLinearProgress.tsx
354
- import * as React6 from "react";
419
+ import * as React7 from "react";
355
420
 
356
421
  // src/components/LinearProgress.tsx
357
422
  import { Progress } from "theme-ui";
@@ -359,8 +424,8 @@ import { Progress } from "theme-ui";
359
424
  // src/components/InfiniteLinearProgress.tsx
360
425
  var MAX_PROGRESS = 100;
361
426
  var InfiniteLinearProgress = /* @__PURE__ */__name(() => {
362
- const [progress, setProgress] = React6.useState(0);
363
- React6.useEffect(() => {
427
+ const [progress, setProgress] = React7.useState(0);
428
+ React7.useEffect(() => {
364
429
  const timer = setInterval(() => {
365
430
  setProgress(oldProgress => {
366
431
  if (oldProgress === MAX_PROGRESS) {
@@ -381,7 +446,7 @@ var InfiniteLinearProgress = /* @__PURE__ */__name(() => {
381
446
  clearInterval(timer);
382
447
  };
383
448
  }, []);
384
- return /* @__PURE__ */React6.createElement(Progress, {
449
+ return /* @__PURE__ */React7.createElement(Progress, {
385
450
  max: MAX_PROGRESS,
386
451
  value: progress,
387
452
  role: "progressbar"
@@ -468,9 +533,9 @@ var Input = /* @__PURE__ */__name(({
468
533
 
469
534
  // src/components/InputNumber.tsx
470
535
  import { Icon as Icon4 } from "@ttoss/react-icons";
471
- import * as React7 from "react";
536
+ import * as React8 from "react";
472
537
  import { Input as Input2 } from "theme-ui";
473
- var InputNumber = /* @__PURE__ */React7.forwardRef(({
538
+ var InputNumber = /* @__PURE__ */React8.forwardRef(({
474
539
  sx,
475
540
  value,
476
541
  infoIcon,
@@ -478,7 +543,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
478
543
  onClickInfoIcon,
479
544
  ...inputProps
480
545
  }, ref) => {
481
- const sxProps = React7.useMemo(() => {
546
+ const sxProps = React8.useMemo(() => {
482
547
  const size = String(typeof value === "undefined" ? 0 : value).length;
483
548
  if (inputProps["aria-invalid"] === "true") {
484
549
  return {
@@ -530,7 +595,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
530
595
  }
531
596
  onChange(value + 1);
532
597
  }, "handleChangeDown");
533
- return /* @__PURE__ */React7.createElement(Flex, {
598
+ return /* @__PURE__ */React8.createElement(Flex, {
534
599
  sx: {
535
600
  width: "fit-content",
536
601
  ...sx,
@@ -540,7 +605,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
540
605
  },
541
606
  ref,
542
607
  "aria-invalid": inputProps["aria-invalid"]
543
- }, /* @__PURE__ */React7.createElement(Input2, {
608
+ }, /* @__PURE__ */React8.createElement(Input2, {
544
609
  ref,
545
610
  variant: "forms.inputNumber",
546
611
  sx: sxProps,
@@ -550,7 +615,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
550
615
  }, "onChange"),
551
616
  value,
552
617
  ...inputProps
553
- }), /* @__PURE__ */React7.createElement(Text, {
618
+ }), /* @__PURE__ */React8.createElement(Text, {
554
619
  sx: {
555
620
  position: "absolute",
556
621
  alignSelf: "center",
@@ -559,9 +624,9 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
559
624
  cursor: "pointer"
560
625
  },
561
626
  onClick: handleChangeUp
562
- }, /* @__PURE__ */React7.createElement(Icon4, {
627
+ }, /* @__PURE__ */React8.createElement(Icon4, {
563
628
  icon: "picker-down"
564
- })), infoIcon && /* @__PURE__ */React7.createElement(Text, {
629
+ })), infoIcon && /* @__PURE__ */React8.createElement(Text, {
565
630
  sx: {
566
631
  position: "absolute",
567
632
  alignSelf: "center",
@@ -570,9 +635,9 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
570
635
  cursor: onClickInfoIcon ? "pointer" : "default"
571
636
  },
572
637
  onClick: onClickInfoIcon
573
- }, /* @__PURE__ */React7.createElement(Icon4, {
638
+ }, /* @__PURE__ */React8.createElement(Icon4, {
574
639
  icon: "info"
575
- })), /* @__PURE__ */React7.createElement(Text, {
640
+ })), /* @__PURE__ */React8.createElement(Text, {
576
641
  sx: {
577
642
  position: "absolute",
578
643
  alignSelf: "center",
@@ -581,23 +646,23 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
581
646
  cursor: "pointer"
582
647
  },
583
648
  onClick: handleChangeDown
584
- }, /* @__PURE__ */React7.createElement(Icon4, {
649
+ }, /* @__PURE__ */React8.createElement(Icon4, {
585
650
  icon: "picker-up"
586
651
  })));
587
652
  });
588
653
  InputNumber.displayName = "InputNumber";
589
654
 
590
655
  // src/components/InputPassword.tsx
591
- import * as React8 from "react";
656
+ import * as React9 from "react";
592
657
  var InputPassword = /* @__PURE__ */__name(({
593
658
  showPasswordByDefault = false,
594
659
  ...inputPasswordProps
595
660
  }) => {
596
- const [hidePass, setHidePass] = React8.useState(Boolean(!showPasswordByDefault));
661
+ const [hidePass, setHidePass] = React9.useState(Boolean(!showPasswordByDefault));
597
662
  const {
598
663
  icon,
599
664
  inputType
600
- } = React8.useMemo(() => {
665
+ } = React9.useMemo(() => {
601
666
  return {
602
667
  icon: hidePass ? "view-off" : "view-on",
603
668
  inputType: hidePass ? "password" : "text"
@@ -608,7 +673,7 @@ var InputPassword = /* @__PURE__ */__name(({
608
673
  return !prev;
609
674
  });
610
675
  }, "handleClick");
611
- return /* @__PURE__ */React8.createElement(Input, {
676
+ return /* @__PURE__ */React9.createElement(Input, {
612
677
  ...inputPasswordProps,
613
678
  trailingIcon: {
614
679
  icon,
@@ -620,7 +685,7 @@ var InputPassword = /* @__PURE__ */__name(({
620
685
 
621
686
  // src/components/Label.tsx
622
687
  import { Icon as Icon5 } from "@ttoss/react-icons";
623
- import * as React9 from "react";
688
+ import * as React10 from "react";
624
689
  import { Label as LabelUi } from "theme-ui";
625
690
 
626
691
  // src/components/Tooltip.tsx
@@ -702,9 +767,9 @@ var Label = /* @__PURE__ */__name(({
702
767
  sx,
703
768
  ...props
704
769
  }) => {
705
- const id = React9.useId();
770
+ const id = React10.useId();
706
771
  const tooltipId = `${id}-tooltip`;
707
- return /* @__PURE__ */React9.createElement(LabelUi, {
772
+ return /* @__PURE__ */React10.createElement(LabelUi, {
708
773
  sx: {
709
774
  alignItems: "center",
710
775
  fontSize: "sm",
@@ -714,7 +779,7 @@ var Label = /* @__PURE__ */__name(({
714
779
  ...sx
715
780
  },
716
781
  ...props
717
- }, children, tooltip && /* @__PURE__ */React9.createElement(Text, {
782
+ }, children, tooltip && /* @__PURE__ */React10.createElement(Text, {
718
783
  "data-tooltip-id": tooltipId,
719
784
  sx: {
720
785
  color: "currentcolor",
@@ -722,23 +787,23 @@ var Label = /* @__PURE__ */__name(({
722
787
  marginLeft: "1"
723
788
  },
724
789
  "aria-label": TOOLTIP_LABEL
725
- }, /* @__PURE__ */React9.createElement(Icon5, {
790
+ }, /* @__PURE__ */React10.createElement(Icon5, {
726
791
  icon: "info"
727
- }), /* @__PURE__ */React9.createElement(Tooltip, {
792
+ }), /* @__PURE__ */React10.createElement(Tooltip, {
728
793
  id: tooltipId,
729
794
  ...tooltip
730
795
  })));
731
796
  }, "Label");
732
797
 
733
798
  // src/components/Link.tsx
734
- import * as React10 from "react";
799
+ import * as React11 from "react";
735
800
  import { Link as LinkUi } from "theme-ui";
736
- var Link = /* @__PURE__ */React10.forwardRef(({
801
+ var Link = /* @__PURE__ */React11.forwardRef(({
737
802
  quiet,
738
803
  className,
739
804
  ...props
740
805
  }, ref) => {
741
- return /* @__PURE__ */React10.createElement(LinkUi, {
806
+ return /* @__PURE__ */React11.createElement(LinkUi, {
742
807
  className: `${quiet ? "quiet" : ""} ${className ?? ""}`,
743
808
  ...props,
744
809
  ref
@@ -753,7 +818,7 @@ import { Paragraph } from "theme-ui";
753
818
  import { Radio } from "theme-ui";
754
819
 
755
820
  // src/components/SegmentedControl.tsx
756
- import * as React11 from "react";
821
+ import * as React12 from "react";
757
822
  import { Box as Box3, Flex as Flex2 } from "theme-ui";
758
823
  var variantTokens = {
759
824
  primary: {
@@ -813,8 +878,8 @@ var SegmentedControl = /* @__PURE__ */__name(({
813
878
  sx,
814
879
  ...rest
815
880
  }) => {
816
- const [internalValue, setInternalValue] = React11.useState(propValue || defaultValue);
817
- React11.useEffect(() => {
881
+ const [internalValue, setInternalValue] = React12.useState(propValue || defaultValue);
882
+ React12.useEffect(() => {
818
883
  if (propValue !== void 0) {
819
884
  setInternalValue(propValue);
820
885
  }
@@ -834,7 +899,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
834
899
  const currentValue = propValue !== void 0 ? propValue : internalValue;
835
900
  const tokens = variantTokens[variant];
836
901
  const sizeStyles = sizeTokens[size];
837
- return /* @__PURE__ */React11.createElement(Flex2, {
902
+ return /* @__PURE__ */React12.createElement(Flex2, {
838
903
  className,
839
904
  "data-variant": variant,
840
905
  "data-size": size,
@@ -919,18 +984,18 @@ var SegmentedControl = /* @__PURE__ */__name(({
919
984
  ...sx
920
985
  },
921
986
  ...rest
922
- }, /* @__PURE__ */React11.createElement("div", {
987
+ }, /* @__PURE__ */React12.createElement("div", {
923
988
  className: "rc-segmented"
924
- }, /* @__PURE__ */React11.createElement(Flex2, {
989
+ }, /* @__PURE__ */React12.createElement(Flex2, {
925
990
  className: "rc-segmented-group custom-segmented-group"
926
991
  }, normalizedOptions.map((option, index) => {
927
992
  const isSelected = option.value === currentValue;
928
993
  const isLastItem = index === normalizedOptions.length - 1;
929
994
  const isItemDisabled = disabled || option.disabled;
930
995
  const showDivider = !isLastItem && option.value !== currentValue && normalizedOptions[index + 1].value !== currentValue;
931
- return /* @__PURE__ */React11.createElement(React11.Fragment, {
996
+ return /* @__PURE__ */React12.createElement(React12.Fragment, {
932
997
  key: `${index}-${option.value}`
933
- }, /* @__PURE__ */React11.createElement(Box3, {
998
+ }, /* @__PURE__ */React12.createElement(Box3, {
934
999
  as: "label",
935
1000
  className: `rc-segmented-item ${isSelected ? "rc-segmented-item-selected" : ""} ${isItemDisabled ? "rc-segmented-item-disabled" : ""}`,
936
1001
  onClick: /* @__PURE__ */__name(() => {
@@ -938,7 +1003,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
938
1003
  handleChange(option.value);
939
1004
  }
940
1005
  }, "onClick")
941
- }, /* @__PURE__ */React11.createElement("input", {
1006
+ }, /* @__PURE__ */React12.createElement("input", {
942
1007
  type: "radio",
943
1008
  value: option.value,
944
1009
  checked: isSelected,
@@ -948,9 +1013,9 @@ var SegmentedControl = /* @__PURE__ */__name(({
948
1013
  handleChange(option.value);
949
1014
  }
950
1015
  }, "onChange")
951
- }), /* @__PURE__ */React11.createElement("div", {
1016
+ }), /* @__PURE__ */React12.createElement("div", {
952
1017
  className: "rc-segmented-item-label"
953
- }, option.label)), showDivider && /* @__PURE__ */React11.createElement(Box3, {
1018
+ }, option.label)), showDivider && /* @__PURE__ */React12.createElement(Box3, {
954
1019
  className: "segmented-divider",
955
1020
  sx: {
956
1021
  height: "60%",
@@ -961,7 +1026,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
961
1026
  zIndex: 3
962
1027
  }
963
1028
  }));
964
- }), currentValue !== void 0 && /* @__PURE__ */React11.createElement("div", {
1029
+ }), currentValue !== void 0 && /* @__PURE__ */React12.createElement("div", {
965
1030
  className: "rc-segmented-thumb",
966
1031
  style: {
967
1032
  width: `${100 / normalizedOptions.length}%`,
@@ -974,7 +1039,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
974
1039
 
975
1040
  // src/components/Select.tsx
976
1041
  import { Icon as Icon6 } from "@ttoss/react-icons";
977
- import * as React12 from "react";
1042
+ import * as React13 from "react";
978
1043
  import ReactSelect, { components } from "react-select";
979
1044
  var Control = /* @__PURE__ */__name(props => {
980
1045
  const isDisabled = props.selectProps.isDisabled;
@@ -994,7 +1059,7 @@ var Control = /* @__PURE__ */__name(props => {
994
1059
  }
995
1060
  return "display.background.secondary.default";
996
1061
  })();
997
- return /* @__PURE__ */React12.createElement(Box, {
1062
+ return /* @__PURE__ */React13.createElement(Box, {
998
1063
  sx: {
999
1064
  ".react-select__control": {
1000
1065
  borderColor,
@@ -1003,7 +1068,7 @@ var Control = /* @__PURE__ */__name(props => {
1003
1068
  paddingY: "3"
1004
1069
  }
1005
1070
  }
1006
- }, /* @__PURE__ */React12.createElement(components.Control, props));
1071
+ }, /* @__PURE__ */React13.createElement(components.Control, props));
1007
1072
  }, "Control");
1008
1073
  var DropdownIndicator = /* @__PURE__ */__name(props => {
1009
1074
  const isDisabled = props.selectProps.isDisabled;
@@ -1013,7 +1078,7 @@ var DropdownIndicator = /* @__PURE__ */__name(props => {
1013
1078
  }
1014
1079
  return "text";
1015
1080
  })();
1016
- return /* @__PURE__ */React12.createElement(Text, {
1081
+ return /* @__PURE__ */React13.createElement(Text, {
1017
1082
  sx: {
1018
1083
  fontSize: "md",
1019
1084
  color,
@@ -1021,14 +1086,14 @@ var DropdownIndicator = /* @__PURE__ */__name(props => {
1021
1086
  display: "flex",
1022
1087
  alignItems: "center"
1023
1088
  }
1024
- }, /* @__PURE__ */React12.createElement(Icon6, {
1089
+ }, /* @__PURE__ */React13.createElement(Icon6, {
1025
1090
  icon: "picker-down"
1026
1091
  }));
1027
1092
  }, "DropdownIndicator");
1028
1093
  var IndicatorsContainer = /* @__PURE__ */__name(({
1029
1094
  children
1030
1095
  }) => {
1031
- return /* @__PURE__ */React12.createElement(Box, {
1096
+ return /* @__PURE__ */React13.createElement(Box, {
1032
1097
  sx: {
1033
1098
  marginLeft: "4",
1034
1099
  border: "none"
@@ -1038,7 +1103,7 @@ var IndicatorsContainer = /* @__PURE__ */__name(({
1038
1103
  var Placeholder = /* @__PURE__ */__name(({
1039
1104
  children
1040
1105
  }) => {
1041
- return /* @__PURE__ */React12.createElement(Text, {
1106
+ return /* @__PURE__ */React13.createElement(Text, {
1042
1107
  sx: {
1043
1108
  color: "onMuted",
1044
1109
  alignSelf: "center"
@@ -1056,10 +1121,10 @@ var SelectContainer = /* @__PURE__ */__name(({
1056
1121
  return (
1057
1122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1058
1123
  /* @__PURE__ */
1059
- React12.createElement(Box, {
1124
+ React13.createElement(Box, {
1060
1125
  sx,
1061
1126
  css: css2
1062
- }, /* @__PURE__ */React12.createElement(components.SelectContainer, props, children))
1127
+ }, /* @__PURE__ */React13.createElement(components.SelectContainer, props, children))
1063
1128
  );
1064
1129
  }, "SelectContainer");
1065
1130
  var ValueContainer = /* @__PURE__ */__name(({
@@ -1085,26 +1150,26 @@ var ValueContainer = /* @__PURE__ */__name(({
1085
1150
  }
1086
1151
  return leadingIcon || "search";
1087
1152
  })();
1088
- return /* @__PURE__ */React12.createElement(Flex, {
1153
+ return /* @__PURE__ */React13.createElement(Flex, {
1089
1154
  sx: {
1090
1155
  gap: "4",
1091
1156
  flex: 1
1092
1157
  }
1093
- }, finalLeadingIcon && /* @__PURE__ */React12.createElement(Text, {
1158
+ }, finalLeadingIcon && /* @__PURE__ */React13.createElement(Text, {
1094
1159
  sx: {
1095
1160
  alignSelf: "center",
1096
1161
  pointerEvents: "none",
1097
1162
  lineHeight: 0,
1098
1163
  fontSize: "md"
1099
1164
  }
1100
- }, /* @__PURE__ */React12.createElement(Icon6, {
1165
+ }, /* @__PURE__ */React13.createElement(Icon6, {
1101
1166
  icon: finalLeadingIcon
1102
- })), /* @__PURE__ */React12.createElement(Flex, {
1167
+ })), /* @__PURE__ */React13.createElement(Flex, {
1103
1168
  sx: {
1104
1169
  flex: 1,
1105
1170
  alignItems: "center"
1106
1171
  }
1107
- }, children), (trailingIcon || hasError) && /* @__PURE__ */React12.createElement(Text, {
1172
+ }, children), (trailingIcon || hasError) && /* @__PURE__ */React13.createElement(Text, {
1108
1173
  className: hasError ? "error-icon" : "",
1109
1174
  sx: {
1110
1175
  alignSelf: "center",
@@ -1113,11 +1178,11 @@ var ValueContainer = /* @__PURE__ */__name(({
1113
1178
  fontSize: "md",
1114
1179
  color: trailingIconColor
1115
1180
  }
1116
- }, /* @__PURE__ */React12.createElement(Icon6, {
1181
+ }, /* @__PURE__ */React13.createElement(Icon6, {
1117
1182
  icon: hasError ? "warning-alt" : trailingIcon
1118
1183
  })));
1119
1184
  }, "ValueContainer");
1120
- var Select = /* @__PURE__ */React12.forwardRef(({
1185
+ var Select = /* @__PURE__ */React13.forwardRef(({
1121
1186
  ...props
1122
1187
  }, ref) => {
1123
1188
  const value = props.options?.find(option => {
@@ -1126,7 +1191,7 @@ var Select = /* @__PURE__ */React12.forwardRef(({
1126
1191
  }
1127
1192
  return false;
1128
1193
  });
1129
- return /* @__PURE__ */React12.createElement(ReactSelect, {
1194
+ return /* @__PURE__ */React13.createElement(ReactSelect, {
1130
1195
  ref,
1131
1196
  /**
1132
1197
  * https://react-select.com/components
@@ -1208,7 +1273,7 @@ var Switch = /* @__PURE__ */__name(props => {
1208
1273
  }, "Switch");
1209
1274
 
1210
1275
  // src/components/Tag.tsx
1211
- import * as React13 from "react";
1276
+ import * as React14 from "react";
1212
1277
  var tagVariantMap = {
1213
1278
  positive: {
1214
1279
  bg: "feedback.background.positive.default",
@@ -1265,7 +1330,7 @@ var Tag = /* @__PURE__ */__name(({
1265
1330
  alignItems: "center"
1266
1331
  };
1267
1332
  if (Array.isArray(children)) {
1268
- return /* @__PURE__ */React13.createElement(Box, {
1333
+ return /* @__PURE__ */React14.createElement(Box, {
1269
1334
  as: "span",
1270
1335
  sx: {
1271
1336
  ml: 2,
@@ -1275,7 +1340,7 @@ var Tag = /* @__PURE__ */__name(({
1275
1340
  ...sx
1276
1341
  }
1277
1342
  }, children.map((child, i) => {
1278
- return /* @__PURE__ */React13.createElement(Box, {
1343
+ return /* @__PURE__ */React14.createElement(Box, {
1279
1344
  key: i,
1280
1345
  as: "span",
1281
1346
  sx: {
@@ -1289,7 +1354,7 @@ var Tag = /* @__PURE__ */__name(({
1289
1354
  }, child);
1290
1355
  }));
1291
1356
  }
1292
- return /* @__PURE__ */React13.createElement(Box, {
1357
+ return /* @__PURE__ */React14.createElement(Box, {
1293
1358
  as: "span",
1294
1359
  sx: {
1295
1360
  ...baseStyles,
@@ -1300,15 +1365,15 @@ var Tag = /* @__PURE__ */__name(({
1300
1365
 
1301
1366
  // src/components/Textarea.tsx
1302
1367
  import { Icon as Icon7 } from "@ttoss/react-icons";
1303
- import * as React14 from "react";
1368
+ import * as React15 from "react";
1304
1369
  import { Textarea as TextareaUI } from "theme-ui";
1305
- var Textarea = /* @__PURE__ */React14.forwardRef(({
1370
+ var Textarea = /* @__PURE__ */React15.forwardRef(({
1306
1371
  trailingIcon,
1307
1372
  className,
1308
1373
  sx,
1309
1374
  ...textareaProps
1310
1375
  }, ref) => {
1311
- return /* @__PURE__ */React14.createElement(Flex, {
1376
+ return /* @__PURE__ */React15.createElement(Flex, {
1312
1377
  className,
1313
1378
  sx: {
1314
1379
  ...sx,
@@ -1316,7 +1381,7 @@ var Textarea = /* @__PURE__ */React14.forwardRef(({
1316
1381
  padding: 0,
1317
1382
  border: "none"
1318
1383
  }
1319
- }, /* @__PURE__ */React14.createElement(TextareaUI, {
1384
+ }, /* @__PURE__ */React15.createElement(TextareaUI, {
1320
1385
  ref,
1321
1386
  sx: {
1322
1387
  fontFamily: "body",
@@ -1328,13 +1393,13 @@ var Textarea = /* @__PURE__ */React14.forwardRef(({
1328
1393
  },
1329
1394
  className,
1330
1395
  ...textareaProps
1331
- }), trailingIcon && /* @__PURE__ */React14.createElement(Text, {
1396
+ }), trailingIcon && /* @__PURE__ */React15.createElement(Text, {
1332
1397
  sx: {
1333
1398
  position: "absolute",
1334
1399
  right: "1.25rem",
1335
1400
  top: "0.75rem"
1336
1401
  }
1337
- }, /* @__PURE__ */React14.createElement(Icon7, {
1402
+ }, /* @__PURE__ */React15.createElement(Icon7, {
1338
1403
  inline: true,
1339
1404
  icon: trailingIcon
1340
1405
  })));
@@ -1343,7 +1408,7 @@ Textarea.displayName = "Textarea";
1343
1408
 
1344
1409
  // src/components/TooltipIcon.tsx
1345
1410
  import { Icon as Icon8 } from "@ttoss/react-icons";
1346
- import * as React15 from "react";
1411
+ import * as React16 from "react";
1347
1412
  var TooltipIcon = /* @__PURE__ */__name(({
1348
1413
  icon,
1349
1414
  onClick,
@@ -1352,9 +1417,9 @@ var TooltipIcon = /* @__PURE__ */__name(({
1352
1417
  variant,
1353
1418
  sx
1354
1419
  }) => {
1355
- const id = React15.useId();
1420
+ const id = React16.useId();
1356
1421
  const tooltipId = `${id}-tooltip`;
1357
- return /* @__PURE__ */React15.createElement(React15.Fragment, null, /* @__PURE__ */React15.createElement(Text, {
1422
+ return /* @__PURE__ */React16.createElement(React16.Fragment, null, /* @__PURE__ */React16.createElement(Text, {
1358
1423
  "data-testid": dataTestId,
1359
1424
  "data-tooltip-id": tooltip ? tooltipId : void 0,
1360
1425
  sx: {
@@ -1363,10 +1428,10 @@ var TooltipIcon = /* @__PURE__ */__name(({
1363
1428
  },
1364
1429
  onClick,
1365
1430
  variant
1366
- }, /* @__PURE__ */React15.createElement(Icon8, {
1431
+ }, /* @__PURE__ */React16.createElement(Icon8, {
1367
1432
  inline: true,
1368
1433
  icon
1369
- })), tooltip && /* @__PURE__ */React15.createElement(Tooltip, {
1434
+ })), tooltip && /* @__PURE__ */React16.createElement(Tooltip, {
1370
1435
  id: tooltipId,
1371
1436
  ...tooltip,
1372
1437
  variant
@@ -1384,21 +1449,17 @@ var ThemeProvider = /* @__PURE__ */__name(({
1384
1449
  }) => {
1385
1450
  return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(ThemeUIProvider, {
1386
1451
  theme
1387
- }, /* @__PURE__ */React.createElement(Global, {
1452
+ }, /* @__PURE__ */React.createElement(ChakraProvider, null, /* @__PURE__ */React.createElement(Global, {
1388
1453
  styles: css`
1389
- ${fonts.map(url => {
1454
+ ${fonts.map(url => {
1390
1455
  return `@import url('${url}');`;
1391
1456
  }).join("\n")}
1392
- `
1393
- }), children));
1457
+ `
1458
+ }), children)));
1394
1459
  }, "ThemeProvider");
1395
1460
 
1396
- // src/theme/useTheme.ts
1397
- import { useThemeUI } from "theme-ui";
1398
- var useTheme = useThemeUI;
1399
-
1400
1461
  // src/index.ts
1401
1462
  import { keyframes } from "@emotion/react";
1402
1463
  import { useBreakpointIndex, useResponsiveValue } from "@theme-ui/match-media";
1403
1464
  import { BaseStyles, Global as Global2 } from "theme-ui";
1404
- export { ActionButton, Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Global2 as Global, Grid, Heading, HelpText, IconButton, Image, InfiniteLinearProgress, Input, InputNumber, InputPassword, Label, Progress as LinearProgress, Link, Paragraph, Radio, SegmentedControl, Select, Slider, Spinner, Stack, Switch, Tag, Text, Textarea, ThemeProvider, Tooltip, TooltipIcon, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
1465
+ export { ActionButton, Badge, BaseStyles, Box, Button, Card, ChakraProvider, Checkbox, CloseButton, Container, Divider, Flex, Global2 as Global, Grid, Heading, HelpText, IconButton, Image, InfiniteLinearProgress, Input, InputNumber, InputPassword, Label, Progress as LinearProgress, Link, Paragraph, Radio, SegmentedControl, Select, Slider, Spinner, Stack, Switch, Tag, Text, Textarea, ThemeProvider, Tooltip, TooltipIcon, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { IconType } from '@ttoss/react-icons';
3
2
  import * as React from 'react';
3
+ import { IconType } from '@ttoss/react-icons';
4
4
  import * as theme_ui from 'theme-ui';
5
5
  import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CardProps, BoxProps, CheckboxProps as CheckboxProps$1, CloseProps, TextProps, IconButtonProps as IconButtonProps$1, SxProp, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, FlexProps, SwitchProps, ThemeUIStyleObject, TextareaProps as TextareaProps$1, Theme } from 'theme-ui';
6
6
  export { BaseStyles, Box, BoxProps, CardProps, ContainerProps, Divider, DividerProps, Flex, FlexProps, Global, Grid, GridProps, Heading, HeadingProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Paragraph, ParagraphProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, SwitchProps, SxProp, Text, TextProps, Theme, ThemeUIStyleObject } from 'theme-ui';
@@ -9,6 +9,37 @@ import { Props } from 'react-select';
9
9
  export { Keyframes, keyframes } from '@emotion/react';
10
10
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
11
11
 
12
+ type ChakraThemeProviderProps = {
13
+ children?: React.ReactNode;
14
+ };
15
+ /**
16
+ * Opt-in Chakra UI provider that inherits design tokens from the parent
17
+ * theme-ui `ThemeProvider`.
18
+ *
19
+ * **Must be rendered as a child of `ThemeProvider`** so that `useThemeUI()`
20
+ * can read the active theme.
21
+ *
22
+ * This component automatically converts theme-ui tokens to Chakra UI v3
23
+ * system format, allowing seamless integration between both systems.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * import { ThemeProvider } from '@ttoss/ui';
28
+ * import { ChakraProvider } from '@ttoss/ui/chakra';
29
+ *
30
+ * function App() {
31
+ * return (
32
+ * <ThemeProvider>
33
+ * <ChakraProvider>
34
+ * <Button colorScheme="blue">Click me</Button>
35
+ * </ChakraProvider>
36
+ * </ThemeProvider>
37
+ * );
38
+ * }
39
+ * ```
40
+ */
41
+ declare const ChakraProvider: ({ children }: ChakraThemeProviderProps) => react_jsx_runtime.JSX.Element;
42
+
12
43
  type ButtonProps = ButtonProps$1 & {
13
44
  leftIcon?: IconType;
14
45
  rightIcon?: IconType;
@@ -245,4 +276,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
245
276
 
246
277
  declare const useTheme: () => theme_ui.ThemeUIContextValue;
247
278
 
248
- export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Card, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, type IconButtonProps, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Tag, type TagProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipIcon, type TooltipIconProps, type TooltipProps, useTheme };
279
+ export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Card, ChakraProvider, type ChakraThemeProviderProps, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, type IconButtonProps, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Tag, type TagProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipIcon, type TooltipIconProps, type TooltipProps, useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -24,29 +24,30 @@
24
24
  ],
25
25
  "sideEffects": false,
26
26
  "dependencies": {
27
+ "@chakra-ui/react": "^3.33.0",
27
28
  "@theme-ui/match-media": "^0.17.2",
28
29
  "rc-segmented": "^2.7.0",
29
30
  "react-select": "^5.10.2",
30
31
  "react-tooltip": "^5.30.0",
31
32
  "theme-ui": "^0.17.2",
32
- "@ttoss/theme": "^2.9.0"
33
+ "@ttoss/theme": "^2.9.2"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "@emotion/react": "^11",
36
37
  "react": ">=16.8.0",
37
- "@ttoss/react-icons": "^0.5.6"
38
+ "@ttoss/react-icons": "^0.6.0"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@emotion/react": "^11.14.0",
41
42
  "@iconify-icons/mdi-light": "^1.2.5",
42
43
  "@types/jest": "^30.0.0",
43
- "@types/react": "^19.2.7",
44
+ "@types/react": "^19.2.14",
44
45
  "jest": "^30.2.0",
45
- "react": "^19.2.1",
46
+ "react": "^19.2.4",
46
47
  "tsup": "^8.5.1",
47
- "@ttoss/react-icons": "^0.5.6",
48
- "@ttoss/config": "^1.35.12",
49
- "@ttoss/test-utils": "^4.0.2"
48
+ "@ttoss/test-utils": "^4.1.0",
49
+ "@ttoss/config": "^1.36.0",
50
+ "@ttoss/react-icons": "^0.6.0"
50
51
  },
51
52
  "keywords": [
52
53
  "React",