@ttoss/ui 5.0.15 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -823,11 +823,39 @@ var Stack = React13.forwardRef((props, ref) => {
823
823
  });
824
824
  Stack.displayName = "Stack";
825
825
 
826
+ // src/components/Switch.tsx
827
+ import { Switch as SwitchUi } from "theme-ui";
828
+ import { jsx as jsx17 } from "react/jsx-runtime";
829
+ var Switch = props => {
830
+ return /* @__PURE__ */jsx17(SwitchUi, {
831
+ ...props,
832
+ role: "switch",
833
+ "aria-checked": props.checked || false,
834
+ sx: {
835
+ backgroundColor: "input.background.muted.default",
836
+ "input:checked ~ &": {
837
+ backgroundColor: "input.background.secondary.default"
838
+ },
839
+ "input ~ & > div": {
840
+ backgroundColor: "input.background.primary.default"
841
+ },
842
+ "input:checked ~ & > div": {
843
+ backgroundColor: "input.background.accent.default"
844
+ },
845
+ "input:focus ~ &": {
846
+ outline: "md",
847
+ outlineColor: "input.border.accent.default",
848
+ outlineOffset: "0px"
849
+ }
850
+ }
851
+ });
852
+ };
853
+
826
854
  // src/components/Textarea.tsx
827
855
  import * as React14 from "react";
828
856
  import { Icon as Icon8 } from "@ttoss/react-icons";
829
857
  import { Textarea as TextareaUI } from "theme-ui";
830
- import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
858
+ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
831
859
  var Textarea = React14.forwardRef(({
832
860
  trailingIcon,
833
861
  className,
@@ -842,7 +870,7 @@ var Textarea = React14.forwardRef(({
842
870
  padding: 0,
843
871
  border: "none"
844
872
  },
845
- children: [/* @__PURE__ */jsx17(TextareaUI, {
873
+ children: [/* @__PURE__ */jsx18(TextareaUI, {
846
874
  ref,
847
875
  sx: {
848
876
  fontFamily: "body",
@@ -854,13 +882,13 @@ var Textarea = React14.forwardRef(({
854
882
  },
855
883
  className,
856
884
  ...textareaProps
857
- }), trailingIcon && /* @__PURE__ */jsx17(Text, {
885
+ }), trailingIcon && /* @__PURE__ */jsx18(Text, {
858
886
  sx: {
859
887
  position: "absolute",
860
888
  right: "1.25rem",
861
889
  top: "0.75rem"
862
890
  },
863
- children: /* @__PURE__ */jsx17(Icon8, {
891
+ children: /* @__PURE__ */jsx18(Icon8, {
864
892
  inline: true,
865
893
  icon: trailingIcon
866
894
  })
@@ -873,16 +901,16 @@ Textarea.displayName = "Textarea";
873
901
  import { BruttalFonts, BruttalTheme } from "@ttoss/theme/Bruttal";
874
902
  import { Global, css } from "@emotion/react";
875
903
  import { ThemeUIProvider } from "theme-ui";
876
- import { Fragment, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
904
+ import { Fragment, jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
877
905
  var ThemeProvider = ({
878
906
  children,
879
907
  theme = BruttalTheme,
880
908
  fonts = BruttalFonts
881
909
  }) => {
882
- return /* @__PURE__ */jsx18(Fragment, {
910
+ return /* @__PURE__ */jsx19(Fragment, {
883
911
  children: /* @__PURE__ */jsxs9(ThemeUIProvider, {
884
912
  theme,
885
- children: [/* @__PURE__ */jsx18(Global, {
913
+ children: [/* @__PURE__ */jsx19(Global, {
886
914
  styles: css`
887
915
  ${fonts.map(url => {
888
916
  return `@import url('${url}');`;
@@ -901,4 +929,4 @@ var useTheme = useThemeUI;
901
929
  import { keyframes } from "@emotion/react";
902
930
  import { useBreakpointIndex, useResponsiveValue } from "@theme-ui/match-media";
903
931
  import { BaseStyles, Global as Global2 } from "theme-ui";
904
- 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, Text, Textarea, ThemeProvider, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
932
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import * as theme_ui from 'theme-ui';
4
- import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CheckboxProps as CheckboxProps$1, TextProps, IconButtonProps, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, SxProp, FlexProps, TextareaProps as TextareaProps$1, Theme } from 'theme-ui';
5
- export { BaseStyles, Box, BoxProps, Card, 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, SxProp, Text, TextProps, Theme, ThemeUIStyleObject } from 'theme-ui';
4
+ import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, 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';
5
+ export { BaseStyles, Box, BoxProps, Card, 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';
6
6
  import { IconType } from '@ttoss/react-icons';
7
7
  import { Props } from 'react-select';
8
8
  export { Keyframes, keyframes } from '@emotion/react';
@@ -123,6 +123,8 @@ type StackProps = FlexProps;
123
123
  */
124
124
  declare const Stack: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLElement>>;
125
125
 
126
+ declare const Switch: (props: SwitchProps) => react_jsx_runtime.JSX.Element;
127
+
126
128
  interface TextareaProps extends TextareaProps$1 {
127
129
  trailingIcon?: IconType;
128
130
  }
@@ -140,4 +142,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
140
142
 
141
143
  declare const useTheme: () => theme_ui.ThemeUIContextValue;
142
144
 
143
- export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, 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, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, useTheme };
145
+ export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "5.0.15",
3
+ "version": "5.1.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",