@ttoss/ui 5.5.7 → 5.5.9

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
@@ -49,22 +49,54 @@ var ActionButton = ({
49
49
  sx,
50
50
  ...props
51
51
  }) => {
52
+ const variantStyles = {
53
+ default: {
54
+ backgroundColor: "action.background.secondary.default",
55
+ color: "action.text.primary.default",
56
+ border: "sm",
57
+ borderColor: "action.background.primary.default",
58
+ transition: "all 0.2s",
59
+ ":is(:focus-within, :hover):not(:disabled)": {
60
+ backgroundColor: "action.background.secondary.active",
61
+ borderColor: "action.border.secondary.active",
62
+ color: "action.text.secondary.active"
63
+ },
64
+ ":disabled": {
65
+ cursor: "default",
66
+ backgroundColor: "action.background.muted.default",
67
+ borderColor: "action.border.muted.default",
68
+ color: "action.text.muted.default"
69
+ }
70
+ },
71
+ accent: {
72
+ backgroundColor: "action.background.accent.default",
73
+ color: "action.text.accent.default",
74
+ border: "none",
75
+ ":disabled": {
76
+ cursor: "default",
77
+ backgroundColor: "action.background.muted.default",
78
+ color: "action.text.muted.default"
79
+ }
80
+ },
81
+ quiet: {
82
+ backgroundColor: "action.background.muted.default",
83
+ color: "action.text.accent.default",
84
+ border: "none",
85
+ borderColor: "transparent",
86
+ ":disabled": {
87
+ cursor: "default",
88
+ opacity: 0.6,
89
+ color: "action.text.muted.default"
90
+ }
91
+ }
92
+ };
52
93
  return /* @__PURE__ */jsx2(Button, {
53
- variant: `buttons.actionButton.${variant}`,
54
94
  leftIcon: icon,
55
95
  sx: {
56
- padding: "2",
57
- gap: "4",
58
- fontFamily: "body",
59
- borderRadius: "action",
60
- outlineColor: "transparent",
61
- ":disabled": props.disabled ? {
62
- backgroundColor: "muted",
63
- color: "onMuted",
64
- cursor: "not-allowed",
65
- border: "muted",
66
- borderColor: "onMuted"
67
- } : void 0,
96
+ paddingY: "2",
97
+ paddingX: "4",
98
+ // Apply variant-specific styles
99
+ ...variantStyles[variant],
68
100
  ...sx
69
101
  },
70
102
  ...props
@@ -317,23 +349,34 @@ var HelpText = ({
317
349
  };
318
350
 
319
351
  // src/components/IconButton.tsx
320
- import * as React4 from "react";
352
+ import { Icon as Icon4 } from "@ttoss/react-icons";
321
353
  import { IconButton as IconButtonUi } from "theme-ui";
322
354
  import { jsx as jsx9 } from "react/jsx-runtime";
323
- var IconButton = React4.forwardRef((props, ref) => {
355
+ var IconButton = props => {
356
+ const {
357
+ icon,
358
+ children,
359
+ ...restProps
360
+ } = props;
324
361
  return /* @__PURE__ */jsx9(IconButtonUi, {
325
362
  type: "button",
326
- ...props,
327
- ref
363
+ ...restProps,
364
+ sx: {
365
+ borderRadius: "sm",
366
+ ...restProps.sx
367
+ },
368
+ children: icon ? /* @__PURE__ */jsx9(Icon4, {
369
+ inline: true,
370
+ icon
371
+ }) : children
328
372
  });
329
- });
330
- IconButton.displayName = "IconButton";
373
+ };
331
374
 
332
375
  // src/components/Image.tsx
333
376
  import { Image } from "theme-ui";
334
377
 
335
378
  // src/components/InfiniteLinearProgress.tsx
336
- import * as React5 from "react";
379
+ import * as React4 from "react";
337
380
 
338
381
  // src/components/LinearProgress.tsx
339
382
  import { Progress } from "theme-ui";
@@ -342,8 +385,8 @@ import { Progress } from "theme-ui";
342
385
  import { jsx as jsx10 } from "react/jsx-runtime";
343
386
  var MAX_PROGRESS = 100;
344
387
  var InfiniteLinearProgress = () => {
345
- const [progress, setProgress] = React5.useState(0);
346
- React5.useEffect(() => {
388
+ const [progress, setProgress] = React4.useState(0);
389
+ React4.useEffect(() => {
347
390
  const timer = setInterval(() => {
348
391
  setProgress(oldProgress => {
349
392
  if (oldProgress === MAX_PROGRESS) {
@@ -372,11 +415,11 @@ var InfiniteLinearProgress = () => {
372
415
  };
373
416
 
374
417
  // src/components/Input.tsx
375
- import { Icon as Icon4 } from "@ttoss/react-icons";
376
- import * as React6 from "react";
418
+ import { Icon as Icon5 } from "@ttoss/react-icons";
419
+ import * as React5 from "react";
377
420
  import { Input as InputUI } from "theme-ui";
378
421
  import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
379
- var Input = React6.forwardRef(({
422
+ var Input = React5.forwardRef(({
380
423
  leadingIcon,
381
424
  trailingIcon: trailingIconProp,
382
425
  onLeadingIconClick,
@@ -404,7 +447,7 @@ var Input = React6.forwardRef(({
404
447
  },
405
448
  onClick: onLeadingIconClick,
406
449
  variant: "leading-icon",
407
- children: /* @__PURE__ */jsx11(Icon4, {
450
+ children: /* @__PURE__ */jsx11(Icon5, {
408
451
  inline: true,
409
452
  icon: leadingIcon
410
453
  })
@@ -432,7 +475,7 @@ var Input = React6.forwardRef(({
432
475
  },
433
476
  variant: "trailing-icon",
434
477
  onClick: onTrailingIconClick,
435
- children: /* @__PURE__ */jsx11(Icon4, {
478
+ children: /* @__PURE__ */jsx11(Icon5, {
436
479
  inline: true,
437
480
  icon: trailingIcon
438
481
  })
@@ -442,11 +485,11 @@ var Input = React6.forwardRef(({
442
485
  Input.displayName = "Input";
443
486
 
444
487
  // src/components/InputNumber.tsx
445
- import { Icon as Icon5 } from "@ttoss/react-icons";
446
- import * as React7 from "react";
488
+ import { Icon as Icon6 } from "@ttoss/react-icons";
489
+ import * as React6 from "react";
447
490
  import { Input as Input2 } from "theme-ui";
448
491
  import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
449
- var InputNumber = React7.forwardRef(({
492
+ var InputNumber = React6.forwardRef(({
450
493
  sx,
451
494
  value,
452
495
  infoIcon,
@@ -454,7 +497,7 @@ var InputNumber = React7.forwardRef(({
454
497
  onClickInfoIcon,
455
498
  ...inputProps
456
499
  }, ref) => {
457
- const sxProps = React7.useMemo(() => {
500
+ const sxProps = React6.useMemo(() => {
458
501
  const size = String(typeof value === "undefined" ? 0 : value).length;
459
502
  if (inputProps["aria-invalid"] === "true") {
460
503
  return {
@@ -535,7 +578,7 @@ var InputNumber = React7.forwardRef(({
535
578
  cursor: "pointer"
536
579
  },
537
580
  onClick: handleChangeUp,
538
- children: /* @__PURE__ */jsx12(Icon5, {
581
+ children: /* @__PURE__ */jsx12(Icon6, {
539
582
  icon: "picker-down"
540
583
  })
541
584
  }), infoIcon && /* @__PURE__ */jsx12(Text, {
@@ -547,7 +590,7 @@ var InputNumber = React7.forwardRef(({
547
590
  cursor: onClickInfoIcon ? "pointer" : "default"
548
591
  },
549
592
  onClick: onClickInfoIcon,
550
- children: /* @__PURE__ */jsx12(Icon5, {
593
+ children: /* @__PURE__ */jsx12(Icon6, {
551
594
  icon: "info"
552
595
  })
553
596
  }), /* @__PURE__ */jsx12(Text, {
@@ -559,7 +602,7 @@ var InputNumber = React7.forwardRef(({
559
602
  cursor: "pointer"
560
603
  },
561
604
  onClick: handleChangeDown,
562
- children: /* @__PURE__ */jsx12(Icon5, {
605
+ children: /* @__PURE__ */jsx12(Icon6, {
563
606
  icon: "picker-up"
564
607
  })
565
608
  })]
@@ -568,16 +611,16 @@ var InputNumber = React7.forwardRef(({
568
611
  InputNumber.displayName = "InputNumber";
569
612
 
570
613
  // src/components/InputPassword/InputPassword.tsx
571
- import * as React9 from "react";
614
+ import * as React8 from "react";
572
615
 
573
616
  // src/components/InputPassword/useHidePassInput.ts
574
- import * as React8 from "react";
617
+ import * as React7 from "react";
575
618
  var useHidePassInput = (defaultValue = true) => {
576
- const [hidePass, setHidePass] = React8.useState(Boolean(defaultValue));
619
+ const [hidePass, setHidePass] = React7.useState(Boolean(defaultValue));
577
620
  const {
578
621
  icon,
579
622
  inputType
580
- } = React8.useMemo(() => {
623
+ } = React7.useMemo(() => {
581
624
  return {
582
625
  icon: hidePass ? "view-off" : "view-on",
583
626
  inputType: hidePass ? "password" : "text"
@@ -597,7 +640,7 @@ var useHidePassInput = (defaultValue = true) => {
597
640
 
598
641
  // src/components/InputPassword/InputPassword.tsx
599
642
  import { jsx as jsx13 } from "react/jsx-runtime";
600
- var InputPassword = React9.forwardRef(({
643
+ var InputPassword = React8.forwardRef(({
601
644
  showPasswordByDefault,
602
645
  ...inputPasswordProps
603
646
  }, ref) => {
@@ -617,8 +660,8 @@ var InputPassword = React9.forwardRef(({
617
660
  InputPassword.displayName = "InputPassword";
618
661
 
619
662
  // src/components/Label.tsx
620
- import { Icon as Icon6 } from "@ttoss/react-icons";
621
- import * as React10 from "react";
663
+ import { Icon as Icon7 } from "@ttoss/react-icons";
664
+ import * as React9 from "react";
622
665
  import { Label as LabelUi } from "theme-ui";
623
666
  import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
624
667
  var TOOLTIP_LABEL = "tooltip";
@@ -628,7 +671,7 @@ var Label = ({
628
671
  sx,
629
672
  ...props
630
673
  }) => {
631
- const id = React10.useId();
674
+ const id = React9.useId();
632
675
  const tooltipId = `${id}-tooltip`;
633
676
  return /* @__PURE__ */jsxs6(LabelUi, {
634
677
  "data-tooltip-id": tooltipId,
@@ -647,7 +690,7 @@ var Label = ({
647
690
  cursor: "pointer"
648
691
  },
649
692
  "aria-label": TOOLTIP_LABEL,
650
- children: [/* @__PURE__ */jsx14(Icon6, {
693
+ children: [/* @__PURE__ */jsx14(Icon7, {
651
694
  inline: true,
652
695
  icon: "fluent:info-24-regular"
653
696
  }), /* @__PURE__ */jsx14(Tooltip, {
@@ -662,10 +705,10 @@ var Label = ({
662
705
  };
663
706
 
664
707
  // src/components/Link.tsx
665
- import * as React11 from "react";
708
+ import * as React10 from "react";
666
709
  import { Link as LinkUi } from "theme-ui";
667
710
  import { jsx as jsx15 } from "react/jsx-runtime";
668
- var Link = React11.forwardRef(({
711
+ var Link = React10.forwardRef(({
669
712
  quiet,
670
713
  className,
671
714
  ...props
@@ -685,8 +728,8 @@ import { Paragraph } from "theme-ui";
685
728
  import { Radio } from "theme-ui";
686
729
 
687
730
  // src/components/Select.tsx
688
- import { Icon as Icon7 } from "@ttoss/react-icons";
689
- import * as React12 from "react";
731
+ import { Icon as Icon8 } from "@ttoss/react-icons";
732
+ import * as React11 from "react";
690
733
  import ReactSelect, { components } from "react-select";
691
734
  import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
692
735
  var Control = props => {
@@ -737,7 +780,7 @@ var DropdownIndicator = props => {
737
780
  display: "flex",
738
781
  alignItems: "center"
739
782
  },
740
- children: /* @__PURE__ */jsx16(Icon7, {
783
+ children: /* @__PURE__ */jsx16(Icon8, {
741
784
  icon: "picker-down"
742
785
  })
743
786
  });
@@ -820,7 +863,7 @@ var ValueContainer = ({
820
863
  lineHeight: 0,
821
864
  fontSize: "md"
822
865
  },
823
- children: /* @__PURE__ */jsx16(Icon7, {
866
+ children: /* @__PURE__ */jsx16(Icon8, {
824
867
  icon: finalLeadingIcon
825
868
  })
826
869
  }), /* @__PURE__ */jsx16(Flex, {
@@ -838,13 +881,13 @@ var ValueContainer = ({
838
881
  fontSize: "md",
839
882
  color: trailingIconColor
840
883
  },
841
- children: /* @__PURE__ */jsx16(Icon7, {
884
+ children: /* @__PURE__ */jsx16(Icon8, {
842
885
  icon: hasError ? "warning-alt" : trailingIcon
843
886
  })
844
887
  })]
845
888
  });
846
889
  };
847
- var Select = React12.forwardRef(({
890
+ var Select = React11.forwardRef(({
848
891
  ...props
849
892
  }, ref) => {
850
893
  const value = props.options?.find(option => {
@@ -930,11 +973,11 @@ var Switch = props => {
930
973
  };
931
974
 
932
975
  // src/components/Textarea.tsx
933
- import { Icon as Icon8 } from "@ttoss/react-icons";
934
- import * as React13 from "react";
976
+ import { Icon as Icon9 } from "@ttoss/react-icons";
977
+ import * as React12 from "react";
935
978
  import { Textarea as TextareaUI } from "theme-ui";
936
979
  import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
937
- var Textarea = React13.forwardRef(({
980
+ var Textarea = React12.forwardRef(({
938
981
  trailingIcon,
939
982
  className,
940
983
  sx,
@@ -966,7 +1009,7 @@ var Textarea = React13.forwardRef(({
966
1009
  right: "1.25rem",
967
1010
  top: "0.75rem"
968
1011
  },
969
- children: /* @__PURE__ */jsx19(Icon8, {
1012
+ children: /* @__PURE__ */jsx19(Icon9, {
970
1013
  inline: true,
971
1014
  icon: trailingIcon
972
1015
  })
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { IconType } from '@ttoss/react-icons';
3
3
  import * as React from 'react';
4
4
  import * as theme_ui from 'theme-ui';
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
- 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';
5
+ import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CardProps, BoxProps, CheckboxProps as CheckboxProps$1, TextProps, IconButtonProps as IconButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, SxProp, FlexProps, SwitchProps, TextareaProps as TextareaProps$1, Theme } from 'theme-ui';
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';
7
7
  import { Props } from 'react-select';
8
8
  import { ITooltip } from 'react-tooltip';
9
9
  export { Keyframes, keyframes } from '@emotion/react';
@@ -54,7 +54,10 @@ type HelpTextProps = Omit<TextProps, 'variant'> & {
54
54
  };
55
55
  declare const HelpText: ({ sx, disabled, negative, ...props }: HelpTextProps) => react_jsx_runtime.JSX.Element;
56
56
 
57
- declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
57
+ type IconButtonProps = IconButtonProps$1 & {
58
+ icon?: string;
59
+ };
60
+ declare const IconButton: (props: IconButtonProps) => react_jsx_runtime.JSX.Element;
58
61
 
59
62
  declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
60
63
 
@@ -155,4 +158,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
155
158
 
156
159
  declare const useTheme: () => theme_ui.ThemeUIContextValue;
157
160
 
158
- 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 };
161
+ 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, 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.5.7",
3
+ "version": "5.5.9",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -28,7 +28,7 @@
28
28
  "react-select": "^5.9.0",
29
29
  "react-tooltip": "^5.28.0",
30
30
  "theme-ui": "^0.17.1",
31
- "@ttoss/theme": "^2.5.6"
31
+ "@ttoss/theme": "^2.5.7"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@emotion/react": "^11",
@@ -43,9 +43,9 @@
43
43
  "jest": "^29.7.0",
44
44
  "react": "^19.0.0",
45
45
  "tsup": "^8.3.5",
46
+ "@ttoss/react-icons": "^0.4.11",
46
47
  "@ttoss/config": "^1.35.3",
47
- "@ttoss/test-utils": "^2.1.23",
48
- "@ttoss/react-icons": "^0.4.11"
48
+ "@ttoss/test-utils": "^2.1.23"
49
49
  },
50
50
  "keywords": [
51
51
  "React",