@ttoss/ui 5.5.7 → 5.5.8

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,31 @@ 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
+ children: icon ? /* @__PURE__ */jsx9(Icon4, {
365
+ inline: true,
366
+ icon
367
+ }) : children
328
368
  });
329
- });
369
+ };
330
370
  IconButton.displayName = "IconButton";
331
371
 
332
372
  // src/components/Image.tsx
333
373
  import { Image } from "theme-ui";
334
374
 
335
375
  // src/components/InfiniteLinearProgress.tsx
336
- import * as React5 from "react";
376
+ import * as React4 from "react";
337
377
 
338
378
  // src/components/LinearProgress.tsx
339
379
  import { Progress } from "theme-ui";
@@ -342,8 +382,8 @@ import { Progress } from "theme-ui";
342
382
  import { jsx as jsx10 } from "react/jsx-runtime";
343
383
  var MAX_PROGRESS = 100;
344
384
  var InfiniteLinearProgress = () => {
345
- const [progress, setProgress] = React5.useState(0);
346
- React5.useEffect(() => {
385
+ const [progress, setProgress] = React4.useState(0);
386
+ React4.useEffect(() => {
347
387
  const timer = setInterval(() => {
348
388
  setProgress(oldProgress => {
349
389
  if (oldProgress === MAX_PROGRESS) {
@@ -372,11 +412,11 @@ var InfiniteLinearProgress = () => {
372
412
  };
373
413
 
374
414
  // src/components/Input.tsx
375
- import { Icon as Icon4 } from "@ttoss/react-icons";
376
- import * as React6 from "react";
415
+ import { Icon as Icon5 } from "@ttoss/react-icons";
416
+ import * as React5 from "react";
377
417
  import { Input as InputUI } from "theme-ui";
378
418
  import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
379
- var Input = React6.forwardRef(({
419
+ var Input = React5.forwardRef(({
380
420
  leadingIcon,
381
421
  trailingIcon: trailingIconProp,
382
422
  onLeadingIconClick,
@@ -404,7 +444,7 @@ var Input = React6.forwardRef(({
404
444
  },
405
445
  onClick: onLeadingIconClick,
406
446
  variant: "leading-icon",
407
- children: /* @__PURE__ */jsx11(Icon4, {
447
+ children: /* @__PURE__ */jsx11(Icon5, {
408
448
  inline: true,
409
449
  icon: leadingIcon
410
450
  })
@@ -432,7 +472,7 @@ var Input = React6.forwardRef(({
432
472
  },
433
473
  variant: "trailing-icon",
434
474
  onClick: onTrailingIconClick,
435
- children: /* @__PURE__ */jsx11(Icon4, {
475
+ children: /* @__PURE__ */jsx11(Icon5, {
436
476
  inline: true,
437
477
  icon: trailingIcon
438
478
  })
@@ -442,11 +482,11 @@ var Input = React6.forwardRef(({
442
482
  Input.displayName = "Input";
443
483
 
444
484
  // src/components/InputNumber.tsx
445
- import { Icon as Icon5 } from "@ttoss/react-icons";
446
- import * as React7 from "react";
485
+ import { Icon as Icon6 } from "@ttoss/react-icons";
486
+ import * as React6 from "react";
447
487
  import { Input as Input2 } from "theme-ui";
448
488
  import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
449
- var InputNumber = React7.forwardRef(({
489
+ var InputNumber = React6.forwardRef(({
450
490
  sx,
451
491
  value,
452
492
  infoIcon,
@@ -454,7 +494,7 @@ var InputNumber = React7.forwardRef(({
454
494
  onClickInfoIcon,
455
495
  ...inputProps
456
496
  }, ref) => {
457
- const sxProps = React7.useMemo(() => {
497
+ const sxProps = React6.useMemo(() => {
458
498
  const size = String(typeof value === "undefined" ? 0 : value).length;
459
499
  if (inputProps["aria-invalid"] === "true") {
460
500
  return {
@@ -535,7 +575,7 @@ var InputNumber = React7.forwardRef(({
535
575
  cursor: "pointer"
536
576
  },
537
577
  onClick: handleChangeUp,
538
- children: /* @__PURE__ */jsx12(Icon5, {
578
+ children: /* @__PURE__ */jsx12(Icon6, {
539
579
  icon: "picker-down"
540
580
  })
541
581
  }), infoIcon && /* @__PURE__ */jsx12(Text, {
@@ -547,7 +587,7 @@ var InputNumber = React7.forwardRef(({
547
587
  cursor: onClickInfoIcon ? "pointer" : "default"
548
588
  },
549
589
  onClick: onClickInfoIcon,
550
- children: /* @__PURE__ */jsx12(Icon5, {
590
+ children: /* @__PURE__ */jsx12(Icon6, {
551
591
  icon: "info"
552
592
  })
553
593
  }), /* @__PURE__ */jsx12(Text, {
@@ -559,7 +599,7 @@ var InputNumber = React7.forwardRef(({
559
599
  cursor: "pointer"
560
600
  },
561
601
  onClick: handleChangeDown,
562
- children: /* @__PURE__ */jsx12(Icon5, {
602
+ children: /* @__PURE__ */jsx12(Icon6, {
563
603
  icon: "picker-up"
564
604
  })
565
605
  })]
@@ -568,16 +608,16 @@ var InputNumber = React7.forwardRef(({
568
608
  InputNumber.displayName = "InputNumber";
569
609
 
570
610
  // src/components/InputPassword/InputPassword.tsx
571
- import * as React9 from "react";
611
+ import * as React8 from "react";
572
612
 
573
613
  // src/components/InputPassword/useHidePassInput.ts
574
- import * as React8 from "react";
614
+ import * as React7 from "react";
575
615
  var useHidePassInput = (defaultValue = true) => {
576
- const [hidePass, setHidePass] = React8.useState(Boolean(defaultValue));
616
+ const [hidePass, setHidePass] = React7.useState(Boolean(defaultValue));
577
617
  const {
578
618
  icon,
579
619
  inputType
580
- } = React8.useMemo(() => {
620
+ } = React7.useMemo(() => {
581
621
  return {
582
622
  icon: hidePass ? "view-off" : "view-on",
583
623
  inputType: hidePass ? "password" : "text"
@@ -597,7 +637,7 @@ var useHidePassInput = (defaultValue = true) => {
597
637
 
598
638
  // src/components/InputPassword/InputPassword.tsx
599
639
  import { jsx as jsx13 } from "react/jsx-runtime";
600
- var InputPassword = React9.forwardRef(({
640
+ var InputPassword = React8.forwardRef(({
601
641
  showPasswordByDefault,
602
642
  ...inputPasswordProps
603
643
  }, ref) => {
@@ -617,8 +657,8 @@ var InputPassword = React9.forwardRef(({
617
657
  InputPassword.displayName = "InputPassword";
618
658
 
619
659
  // src/components/Label.tsx
620
- import { Icon as Icon6 } from "@ttoss/react-icons";
621
- import * as React10 from "react";
660
+ import { Icon as Icon7 } from "@ttoss/react-icons";
661
+ import * as React9 from "react";
622
662
  import { Label as LabelUi } from "theme-ui";
623
663
  import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
624
664
  var TOOLTIP_LABEL = "tooltip";
@@ -628,7 +668,7 @@ var Label = ({
628
668
  sx,
629
669
  ...props
630
670
  }) => {
631
- const id = React10.useId();
671
+ const id = React9.useId();
632
672
  const tooltipId = `${id}-tooltip`;
633
673
  return /* @__PURE__ */jsxs6(LabelUi, {
634
674
  "data-tooltip-id": tooltipId,
@@ -647,7 +687,7 @@ var Label = ({
647
687
  cursor: "pointer"
648
688
  },
649
689
  "aria-label": TOOLTIP_LABEL,
650
- children: [/* @__PURE__ */jsx14(Icon6, {
690
+ children: [/* @__PURE__ */jsx14(Icon7, {
651
691
  inline: true,
652
692
  icon: "fluent:info-24-regular"
653
693
  }), /* @__PURE__ */jsx14(Tooltip, {
@@ -662,10 +702,10 @@ var Label = ({
662
702
  };
663
703
 
664
704
  // src/components/Link.tsx
665
- import * as React11 from "react";
705
+ import * as React10 from "react";
666
706
  import { Link as LinkUi } from "theme-ui";
667
707
  import { jsx as jsx15 } from "react/jsx-runtime";
668
- var Link = React11.forwardRef(({
708
+ var Link = React10.forwardRef(({
669
709
  quiet,
670
710
  className,
671
711
  ...props
@@ -685,8 +725,8 @@ import { Paragraph } from "theme-ui";
685
725
  import { Radio } from "theme-ui";
686
726
 
687
727
  // src/components/Select.tsx
688
- import { Icon as Icon7 } from "@ttoss/react-icons";
689
- import * as React12 from "react";
728
+ import { Icon as Icon8 } from "@ttoss/react-icons";
729
+ import * as React11 from "react";
690
730
  import ReactSelect, { components } from "react-select";
691
731
  import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
692
732
  var Control = props => {
@@ -737,7 +777,7 @@ var DropdownIndicator = props => {
737
777
  display: "flex",
738
778
  alignItems: "center"
739
779
  },
740
- children: /* @__PURE__ */jsx16(Icon7, {
780
+ children: /* @__PURE__ */jsx16(Icon8, {
741
781
  icon: "picker-down"
742
782
  })
743
783
  });
@@ -820,7 +860,7 @@ var ValueContainer = ({
820
860
  lineHeight: 0,
821
861
  fontSize: "md"
822
862
  },
823
- children: /* @__PURE__ */jsx16(Icon7, {
863
+ children: /* @__PURE__ */jsx16(Icon8, {
824
864
  icon: finalLeadingIcon
825
865
  })
826
866
  }), /* @__PURE__ */jsx16(Flex, {
@@ -838,13 +878,13 @@ var ValueContainer = ({
838
878
  fontSize: "md",
839
879
  color: trailingIconColor
840
880
  },
841
- children: /* @__PURE__ */jsx16(Icon7, {
881
+ children: /* @__PURE__ */jsx16(Icon8, {
842
882
  icon: hasError ? "warning-alt" : trailingIcon
843
883
  })
844
884
  })]
845
885
  });
846
886
  };
847
- var Select = React12.forwardRef(({
887
+ var Select = React11.forwardRef(({
848
888
  ...props
849
889
  }, ref) => {
850
890
  const value = props.options?.find(option => {
@@ -930,11 +970,11 @@ var Switch = props => {
930
970
  };
931
971
 
932
972
  // src/components/Textarea.tsx
933
- import { Icon as Icon8 } from "@ttoss/react-icons";
934
- import * as React13 from "react";
973
+ import { Icon as Icon9 } from "@ttoss/react-icons";
974
+ import * as React12 from "react";
935
975
  import { Textarea as TextareaUI } from "theme-ui";
936
976
  import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
937
- var Textarea = React13.forwardRef(({
977
+ var Textarea = React12.forwardRef(({
938
978
  trailingIcon,
939
979
  className,
940
980
  sx,
@@ -966,7 +1006,7 @@ var Textarea = React13.forwardRef(({
966
1006
  right: "1.25rem",
967
1007
  top: "0.75rem"
968
1008
  },
969
- children: /* @__PURE__ */jsx19(Icon8, {
1009
+ children: /* @__PURE__ */jsx19(Icon9, {
970
1010
  inline: true,
971
1011
  icon: trailingIcon
972
1012
  })
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,13 @@ 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: {
61
+ (props: IconButtonProps): react_jsx_runtime.JSX.Element;
62
+ displayName: string;
63
+ };
58
64
 
59
65
  declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
60
66
 
@@ -155,4 +161,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
155
161
 
156
162
  declare const useTheme: () => theme_ui.ThemeUIContextValue;
157
163
 
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 };
164
+ 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.8",
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/config": "^1.35.3",
47
46
  "@ttoss/test-utils": "^2.1.23",
48
- "@ttoss/react-icons": "^0.4.11"
47
+ "@ttoss/react-icons": "^0.4.11",
48
+ "@ttoss/config": "^1.35.3"
49
49
  },
50
50
  "keywords": [
51
51
  "React",