@ttoss/ui 5.2.1 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -615,44 +615,54 @@ InputPassword.displayName = "InputPassword";
615
615
 
616
616
  // src/components/Label.tsx
617
617
  import { Icon as Icon6 } from "@ttoss/react-icons";
618
+ import * as React10 from "react";
618
619
  import { Label as LabelUi } from "theme-ui";
619
620
  import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
620
621
  var TOOLTIP_LABEL = "tooltip";
621
622
  var Label = ({
622
623
  children,
623
- onTooltipClick,
624
624
  tooltip,
625
+ onTooltipClick,
625
626
  sx,
626
627
  ...props
627
628
  }) => {
629
+ const id = React10.useId();
630
+ const tooltipId = `${id}-tooltip`;
628
631
  return /* @__PURE__ */jsxs6(LabelUi, {
632
+ "data-tooltip-id": tooltipId,
629
633
  sx: {
630
634
  alignItems: "center",
631
635
  fontSize: "sm",
632
636
  lineHeight: "normal",
637
+ width: "fit-content",
633
638
  ...sx
634
639
  },
635
640
  ...props,
636
- children: [children, tooltip && /* @__PURE__ */jsx14(Text, {
641
+ children: [children, tooltip && /* @__PURE__ */jsxs6(Text, {
637
642
  sx: {
638
643
  color: "currentcolor",
639
- cursor: onTooltipClick ? "pointer" : void 0
644
+ cursor: "pointer"
640
645
  },
641
- onClick: onTooltipClick,
642
646
  "aria-label": TOOLTIP_LABEL,
643
- children: /* @__PURE__ */jsx14(Icon6, {
647
+ onClick: onTooltipClick,
648
+ children: [/* @__PURE__ */jsx14(Icon6, {
644
649
  inline: true,
645
- icon: "info"
646
- })
650
+ icon: "fluent:info-24-regular"
651
+ }), /* @__PURE__ */jsx14(Tooltip, {
652
+ id: tooltipId,
653
+ clickable: onTooltipClick ? true : false,
654
+ place: "top",
655
+ children: tooltip
656
+ })]
647
657
  })]
648
658
  });
649
659
  };
650
660
 
651
661
  // src/components/Link.tsx
652
- import * as React10 from "react";
662
+ import * as React11 from "react";
653
663
  import { Link as LinkUi } from "theme-ui";
654
664
  import { jsx as jsx15 } from "react/jsx-runtime";
655
- var Link = React10.forwardRef(({
665
+ var Link = React11.forwardRef(({
656
666
  quiet,
657
667
  className,
658
668
  ...props
@@ -673,7 +683,7 @@ import { Radio } from "theme-ui";
673
683
 
674
684
  // src/components/Select.tsx
675
685
  import { Icon as Icon7 } from "@ttoss/react-icons";
676
- import * as React11 from "react";
686
+ import * as React12 from "react";
677
687
  import ReactSelect, { components } from "react-select";
678
688
  import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
679
689
  var Control = props => {
@@ -831,7 +841,7 @@ var ValueContainer = ({
831
841
  })]
832
842
  });
833
843
  };
834
- var Select = React11.forwardRef(({
844
+ var Select = React12.forwardRef(({
835
845
  ...props
836
846
  }, ref) => {
837
847
  const value = props.options?.find(option => {
@@ -899,13 +909,13 @@ var Switch = props => {
899
909
  sx: {
900
910
  backgroundColor: "input.background.muted.disabled",
901
911
  "input:checked ~ &": {
902
- backgroundColor: "input.background.secondary.default"
912
+ backgroundColor: "input.background.accent.default"
903
913
  },
904
914
  "input ~ & > div": {
905
915
  backgroundColor: "input.background.primary.default"
906
916
  },
907
917
  "input:checked ~ & > div": {
908
- backgroundColor: "input.background.accent.default"
918
+ backgroundColor: "input.text.primary.default"
909
919
  },
910
920
  "input:focus ~ &": {
911
921
  outline: "md",
@@ -918,10 +928,10 @@ var Switch = props => {
918
928
 
919
929
  // src/components/Textarea.tsx
920
930
  import { Icon as Icon8 } from "@ttoss/react-icons";
921
- import * as React12 from "react";
931
+ import * as React13 from "react";
922
932
  import { Textarea as TextareaUI } from "theme-ui";
923
933
  import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
924
- var Textarea = React12.forwardRef(({
934
+ var Textarea = React13.forwardRef(({
925
935
  trailingIcon,
926
936
  className,
927
937
  sx,
@@ -962,20 +972,54 @@ var Textarea = React12.forwardRef(({
962
972
  });
963
973
  Textarea.displayName = "Textarea";
964
974
 
975
+ // src/components/Tooltip.tsx
976
+ import { Tooltip as TooltipReact } from "react-tooltip";
977
+ import { jsx as jsx20 } from "react/jsx-runtime";
978
+ var Tooltip = props => {
979
+ const className = "tooltip-component";
980
+ return /* @__PURE__ */jsx20(Box, {
981
+ sx: ({
982
+ colors,
983
+ fonts
984
+ }) => {
985
+ const themeColors = colors;
986
+ return {
987
+ ".tooltip-component": {
988
+ fontFamily: fonts?.body,
989
+ backgroundColor: themeColors?.feedback?.background?.primary?.default,
990
+ paddingY: "2",
991
+ paddingX: "3",
992
+ color: themeColors?.feedback?.text?.secondary?.default,
993
+ border: "sm",
994
+ borderRadius: "xl",
995
+ borderColor: themeColors?.feedback?.border?.primary?.default,
996
+ zIndex: "tooltip",
997
+ opacity: "1"
998
+ }
999
+ };
1000
+ },
1001
+ children: /* @__PURE__ */jsx20(TooltipReact, {
1002
+ className,
1003
+ ...props,
1004
+ children: props.children
1005
+ })
1006
+ });
1007
+ };
1008
+
965
1009
  // src/theme/ThemeProvider.tsx
966
1010
  import { BruttalFonts, BruttalTheme } from "@ttoss/theme/Bruttal";
967
1011
  import { Global, css } from "@emotion/react";
968
1012
  import { ThemeUIProvider } from "theme-ui";
969
- import { Fragment, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
1013
+ import { Fragment, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
970
1014
  var ThemeProvider = ({
971
1015
  children,
972
1016
  theme = BruttalTheme,
973
1017
  fonts = BruttalFonts
974
1018
  }) => {
975
- return /* @__PURE__ */jsx20(Fragment, {
1019
+ return /* @__PURE__ */jsx21(Fragment, {
976
1020
  children: /* @__PURE__ */jsxs9(ThemeUIProvider, {
977
1021
  theme,
978
- children: [/* @__PURE__ */jsx20(Global, {
1022
+ children: [/* @__PURE__ */jsx21(Global, {
979
1023
  styles: css`
980
1024
  ${fonts.map(url => {
981
1025
  return `@import url('${url}');`;
@@ -994,4 +1038,4 @@ var useTheme = useThemeUI;
994
1038
  import { keyframes } from "@emotion/react";
995
1039
  import { useBreakpointIndex, useResponsiveValue } from "@theme-ui/match-media";
996
1040
  import { BaseStyles, Global as Global2 } from "theme-ui";
997
- 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, Select, Slider, Spinner, Stack, Switch, Text, Textarea, ThemeProvider, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
1041
+ 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, Select, Slider, Spinner, Stack, Switch, Text, Textarea, ThemeProvider, Tooltip, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import * as theme_ui from 'theme-ui';
5
5
  import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CardProps, BoxProps, CheckboxProps as CheckboxProps$1, TextProps, IconButtonProps, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, SxProp, FlexProps, SwitchProps, 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, IconButtonProps, 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';
7
7
  import { Props } from 'react-select';
8
+ import { ITooltip } from 'react-tooltip';
8
9
  export { Keyframes, keyframes } from '@emotion/react';
9
10
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
10
11
 
@@ -79,10 +80,10 @@ type InputPasswordProps = Omit<InputProps, 'trailingIcon' | 'onTrailingIconClick
79
80
  declare const InputPassword: React.ForwardRefExoticComponent<Omit<InputPasswordProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
80
81
 
81
82
  type LabelProps = LabelProps$1 & {
82
- tooltip?: boolean;
83
+ tooltip?: string | React.ReactNode;
83
84
  onTooltipClick?: () => void;
84
85
  };
85
- declare const Label: ({ children, onTooltipClick, tooltip, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
86
+ declare const Label: ({ children, tooltip, onTooltipClick, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
86
87
 
87
88
  type LinkProps = LinkProps$1 & {
88
89
  quiet?: boolean;
@@ -136,6 +137,8 @@ interface TextareaProps extends TextareaProps$1 {
136
137
  }
137
138
  declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
138
139
 
140
+ declare const Tooltip: (props: ITooltip) => react_jsx_runtime.JSX.Element;
141
+
139
142
  type ThemeProviderProps = {
140
143
  children?: React.ReactNode;
141
144
  theme?: Theme;
@@ -148,4 +151,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
148
151
 
149
152
  declare const useTheme: () => theme_ui.ThemeUIContextValue;
150
153
 
151
- export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Card, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, useTheme };
154
+ export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Card, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "5.2.1",
3
+ "version": "5.3.1",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -26,8 +26,9 @@
26
26
  "dependencies": {
27
27
  "@theme-ui/match-media": "^0.17.1",
28
28
  "react-select": "^5.9.0",
29
+ "react-tooltip": "^5.28.0",
29
30
  "theme-ui": "^0.17.1",
30
- "@ttoss/theme": "^2.2.1"
31
+ "@ttoss/theme": "^2.3.0"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "@emotion/react": "^11",