@ttoss/ui 5.6.0 → 5.7.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
@@ -264,44 +264,16 @@ var Checkbox = React2.forwardRef(({
264
264
  Checkbox.displayName = "Checkbox";
265
265
 
266
266
  // src/components/CloseButton.tsx
267
- import { Icon as Icon3 } from "@ttoss/react-icons";
268
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
267
+ import { Close as CloseUI } from "theme-ui";
268
+ import { jsx as jsx6 } from "react/jsx-runtime";
269
269
  var CloseButton = props => {
270
- return /* @__PURE__ */jsxs3(Button, {
270
+ return /* @__PURE__ */jsx6(CloseUI, {
271
271
  type: "button",
272
+ "aria-label": props.ariaLabel,
272
273
  sx: {
273
- fontFamily: "body",
274
- display: "flex",
275
- alignItems: "center",
276
- cursor: "pointer",
277
- lineHeight: "normal",
278
- padding: "2",
279
- backgroundColor: "action.background.primary.active",
280
- color: "action.text.primary.default",
281
- border: "sm",
282
- borderColor: "action.border.primary.default",
283
- borderRadius: "sm",
284
- gap: 2,
285
- ":disabled": {
286
- border: "sm",
287
- backgroundColor: "action.background.muted.default",
288
- borderColor: "action.border.muted.default",
289
- color: "action.text.muted.default",
290
- cursor: "not-allowed"
291
- },
292
- ":is(:focus-within, :hover):not(:disabled)": {
293
- color: "action.text.secondary.active",
294
- backgroundColor: "action.background.secondary.active",
295
- borderColor: "action.border.secondary.active"
296
- },
297
274
  ...props.sx
298
275
  },
299
- ...props,
300
- children: [props.label && /* @__PURE__ */jsx6("span", {
301
- children: props.label
302
- }), /* @__PURE__ */jsx6(Icon3, {
303
- icon: "close"
304
- })]
276
+ ...props
305
277
  });
306
278
  };
307
279
 
@@ -352,7 +324,7 @@ var HelpText = ({
352
324
  };
353
325
 
354
326
  // src/components/IconButton.tsx
355
- import { Icon as Icon4 } from "@ttoss/react-icons";
327
+ import { Icon as Icon3 } from "@ttoss/react-icons";
356
328
  import { IconButton as IconButtonUi } from "theme-ui";
357
329
  import { jsx as jsx9 } from "react/jsx-runtime";
358
330
  var IconButton = props => {
@@ -372,7 +344,7 @@ var IconButton = props => {
372
344
  },
373
345
  ...restProps.sx
374
346
  },
375
- children: icon ? /* @__PURE__ */jsx9(Icon4, {
347
+ children: icon ? /* @__PURE__ */jsx9(Icon3, {
376
348
  inline: true,
377
349
  icon
378
350
  }) : children
@@ -422,10 +394,10 @@ var InfiniteLinearProgress = () => {
422
394
  };
423
395
 
424
396
  // src/components/Input.tsx
425
- import { Icon as Icon5 } from "@ttoss/react-icons";
397
+ import { Icon as Icon4 } from "@ttoss/react-icons";
426
398
  import * as React5 from "react";
427
399
  import { Input as InputUI } from "theme-ui";
428
- import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
400
+ import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
429
401
  var Input = React5.forwardRef(({
430
402
  leadingIcon,
431
403
  trailingIcon: trailingIconProp,
@@ -437,7 +409,7 @@ var Input = React5.forwardRef(({
437
409
  }, ref) => {
438
410
  const trailingIcon = inputProps["aria-invalid"] ? "warning-alt" : trailingIconProp;
439
411
  const isWarning = !inputProps["aria-invalid"] && trailingIcon === "warning-alt";
440
- return /* @__PURE__ */jsxs4(Flex, {
412
+ return /* @__PURE__ */jsxs3(Flex, {
441
413
  className: `${className} ${isWarning ? "is-warning" : ""}`,
442
414
  sx: {
443
415
  ...sx,
@@ -454,7 +426,7 @@ var Input = React5.forwardRef(({
454
426
  },
455
427
  onClick: onLeadingIconClick,
456
428
  variant: "leading-icon",
457
- children: /* @__PURE__ */jsx11(Icon5, {
429
+ children: /* @__PURE__ */jsx11(Icon4, {
458
430
  inline: true,
459
431
  icon: leadingIcon
460
432
  })
@@ -482,7 +454,7 @@ var Input = React5.forwardRef(({
482
454
  },
483
455
  variant: "trailing-icon",
484
456
  onClick: onTrailingIconClick,
485
- children: /* @__PURE__ */jsx11(Icon5, {
457
+ children: /* @__PURE__ */jsx11(Icon4, {
486
458
  inline: true,
487
459
  icon: trailingIcon
488
460
  })
@@ -492,10 +464,10 @@ var Input = React5.forwardRef(({
492
464
  Input.displayName = "Input";
493
465
 
494
466
  // src/components/InputNumber.tsx
495
- import { Icon as Icon6 } from "@ttoss/react-icons";
467
+ import { Icon as Icon5 } from "@ttoss/react-icons";
496
468
  import * as React6 from "react";
497
469
  import { Input as Input2 } from "theme-ui";
498
- import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
470
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
499
471
  var InputNumber = React6.forwardRef(({
500
472
  sx,
501
473
  value,
@@ -556,7 +528,7 @@ var InputNumber = React6.forwardRef(({
556
528
  }
557
529
  onChange(value + 1);
558
530
  };
559
- return /* @__PURE__ */jsxs5(Flex, {
531
+ return /* @__PURE__ */jsxs4(Flex, {
560
532
  sx: {
561
533
  width: "fit-content",
562
534
  ...sx,
@@ -585,7 +557,7 @@ var InputNumber = React6.forwardRef(({
585
557
  cursor: "pointer"
586
558
  },
587
559
  onClick: handleChangeUp,
588
- children: /* @__PURE__ */jsx12(Icon6, {
560
+ children: /* @__PURE__ */jsx12(Icon5, {
589
561
  icon: "picker-down"
590
562
  })
591
563
  }), infoIcon && /* @__PURE__ */jsx12(Text, {
@@ -597,7 +569,7 @@ var InputNumber = React6.forwardRef(({
597
569
  cursor: onClickInfoIcon ? "pointer" : "default"
598
570
  },
599
571
  onClick: onClickInfoIcon,
600
- children: /* @__PURE__ */jsx12(Icon6, {
572
+ children: /* @__PURE__ */jsx12(Icon5, {
601
573
  icon: "info"
602
574
  })
603
575
  }), /* @__PURE__ */jsx12(Text, {
@@ -609,7 +581,7 @@ var InputNumber = React6.forwardRef(({
609
581
  cursor: "pointer"
610
582
  },
611
583
  onClick: handleChangeDown,
612
- children: /* @__PURE__ */jsx12(Icon6, {
584
+ children: /* @__PURE__ */jsx12(Icon5, {
613
585
  icon: "picker-up"
614
586
  })
615
587
  })]
@@ -667,10 +639,10 @@ var InputPassword = React8.forwardRef(({
667
639
  InputPassword.displayName = "InputPassword";
668
640
 
669
641
  // src/components/Label.tsx
670
- import { Icon as Icon7 } from "@ttoss/react-icons";
642
+ import { Icon as Icon6 } from "@ttoss/react-icons";
671
643
  import * as React9 from "react";
672
644
  import { Label as LabelUi } from "theme-ui";
673
- import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
645
+ import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
674
646
  var TOOLTIP_LABEL = "tooltip";
675
647
  var Label = ({
676
648
  children,
@@ -680,7 +652,7 @@ var Label = ({
680
652
  }) => {
681
653
  const id = React9.useId();
682
654
  const tooltipId = `${id}-tooltip`;
683
- return /* @__PURE__ */jsxs6(LabelUi, {
655
+ return /* @__PURE__ */jsxs5(LabelUi, {
684
656
  "data-tooltip-id": tooltipId,
685
657
  sx: {
686
658
  alignItems: "center",
@@ -691,13 +663,16 @@ var Label = ({
691
663
  ...sx
692
664
  },
693
665
  ...props,
694
- children: [children, tooltip && /* @__PURE__ */jsxs6(Text, {
666
+ children: [children, tooltip && /* @__PURE__ */jsxs5(Text, {
695
667
  sx: {
696
668
  color: "currentcolor",
697
669
  cursor: "pointer"
698
670
  },
699
671
  "aria-label": TOOLTIP_LABEL,
700
- children: [/* @__PURE__ */jsx14(Icon7, {
672
+ children: [tooltip.icon ? /* @__PURE__ */jsx14(Icon6, {
673
+ inline: true,
674
+ icon: tooltip.icon
675
+ }) : /* @__PURE__ */jsx14(Icon6, {
701
676
  inline: true,
702
677
  icon: "fluent:info-24-regular"
703
678
  }), /* @__PURE__ */jsx14(Tooltip, {
@@ -705,6 +680,10 @@ var Label = ({
705
680
  openOnClick: tooltip.openOnClick,
706
681
  clickable: tooltip.clickable,
707
682
  place: tooltip.place,
683
+ hidden: tooltip.hidden,
684
+ variant: tooltip.variant,
685
+ setIsOpen: tooltip.setIsOpen,
686
+ isOpen: tooltip.isOpen,
708
687
  children: tooltip.render
709
688
  })]
710
689
  })]
@@ -737,7 +716,7 @@ import { Radio } from "theme-ui";
737
716
  // src/components/SegmentedControl.tsx
738
717
  import * as React11 from "react";
739
718
  import { Box as Box3, Flex as Flex2 } from "theme-ui";
740
- import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
719
+ import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
741
720
  var SegmentedControl = ({
742
721
  options,
743
722
  value: propValue,
@@ -852,15 +831,15 @@ var SegmentedControl = ({
852
831
  ...rest,
853
832
  children: /* @__PURE__ */jsx16("div", {
854
833
  className: "rc-segmented",
855
- children: /* @__PURE__ */jsxs7(Flex2, {
834
+ children: /* @__PURE__ */jsxs6(Flex2, {
856
835
  className: "rc-segmented-group custom-segmented-group",
857
836
  children: [normalizedOptions.map((option, index) => {
858
837
  const isSelected = option.value === currentValue;
859
838
  const isLastItem = index === normalizedOptions.length - 1;
860
839
  const isItemDisabled = disabled || option.disabled;
861
840
  const showDivider = !isLastItem && option.value !== currentValue && normalizedOptions[index + 1].value !== currentValue;
862
- return /* @__PURE__ */jsxs7(React11.Fragment, {
863
- children: [/* @__PURE__ */jsxs7(Box3, {
841
+ return /* @__PURE__ */jsxs6(React11.Fragment, {
842
+ children: [/* @__PURE__ */jsxs6(Box3, {
864
843
  as: "label",
865
844
  className: `rc-segmented-item ${isSelected ? "rc-segmented-item-selected" : ""} ${isItemDisabled ? "rc-segmented-item-disabled" : ""}`,
866
845
  onClick: () => {
@@ -909,10 +888,10 @@ var SegmentedControl = ({
909
888
  };
910
889
 
911
890
  // src/components/Select.tsx
912
- import { Icon as Icon8 } from "@ttoss/react-icons";
891
+ import { Icon as Icon7 } from "@ttoss/react-icons";
913
892
  import * as React12 from "react";
914
893
  import ReactSelect, { components } from "react-select";
915
- import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
894
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
916
895
  var Control = props => {
917
896
  const isDisabled = props.selectProps.isDisabled;
918
897
  const hasError = props.selectProps["aria-invalid"] === "true";
@@ -961,7 +940,7 @@ var DropdownIndicator = props => {
961
940
  display: "flex",
962
941
  alignItems: "center"
963
942
  },
964
- children: /* @__PURE__ */jsx17(Icon8, {
943
+ children: /* @__PURE__ */jsx17(Icon7, {
965
944
  icon: "picker-down"
966
945
  })
967
946
  });
@@ -1032,7 +1011,7 @@ var ValueContainer = ({
1032
1011
  }
1033
1012
  return leadingIcon || "search";
1034
1013
  })();
1035
- return /* @__PURE__ */jsxs8(Flex, {
1014
+ return /* @__PURE__ */jsxs7(Flex, {
1036
1015
  sx: {
1037
1016
  gap: "4",
1038
1017
  flex: 1
@@ -1044,7 +1023,7 @@ var ValueContainer = ({
1044
1023
  lineHeight: 0,
1045
1024
  fontSize: "md"
1046
1025
  },
1047
- children: /* @__PURE__ */jsx17(Icon8, {
1026
+ children: /* @__PURE__ */jsx17(Icon7, {
1048
1027
  icon: finalLeadingIcon
1049
1028
  })
1050
1029
  }), /* @__PURE__ */jsx17(Flex, {
@@ -1062,7 +1041,7 @@ var ValueContainer = ({
1062
1041
  fontSize: "md",
1063
1042
  color: trailingIconColor
1064
1043
  },
1065
- children: /* @__PURE__ */jsx17(Icon8, {
1044
+ children: /* @__PURE__ */jsx17(Icon7, {
1066
1045
  icon: hasError ? "warning-alt" : trailingIcon
1067
1046
  })
1068
1047
  })]
@@ -1154,17 +1133,17 @@ var Switch = props => {
1154
1133
  };
1155
1134
 
1156
1135
  // src/components/Textarea.tsx
1157
- import { Icon as Icon9 } from "@ttoss/react-icons";
1136
+ import { Icon as Icon8 } from "@ttoss/react-icons";
1158
1137
  import * as React13 from "react";
1159
1138
  import { Textarea as TextareaUI } from "theme-ui";
1160
- import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
1139
+ import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
1161
1140
  var Textarea = React13.forwardRef(({
1162
1141
  trailingIcon,
1163
1142
  className,
1164
1143
  sx,
1165
1144
  ...textareaProps
1166
1145
  }, ref) => {
1167
- return /* @__PURE__ */jsxs9(Flex, {
1146
+ return /* @__PURE__ */jsxs8(Flex, {
1168
1147
  className,
1169
1148
  sx: {
1170
1149
  ...sx,
@@ -1190,7 +1169,7 @@ var Textarea = React13.forwardRef(({
1190
1169
  right: "1.25rem",
1191
1170
  top: "0.75rem"
1192
1171
  },
1193
- children: /* @__PURE__ */jsx20(Icon9, {
1172
+ children: /* @__PURE__ */jsx20(Icon8, {
1194
1173
  inline: true,
1195
1174
  icon: trailingIcon
1196
1175
  })
@@ -1202,22 +1181,51 @@ Textarea.displayName = "Textarea";
1202
1181
  // src/components/Tooltip.tsx
1203
1182
  import { Tooltip as TooltipReact } from "react-tooltip";
1204
1183
  import { jsx as jsx21 } from "react/jsx-runtime";
1205
- var Tooltip = props => {
1206
- const className = "tooltip-component";
1184
+ var Tooltip = ({
1185
+ variant = "info",
1186
+ ...props
1187
+ }) => {
1188
+ const className = `tooltip-component tooltip-${variant}`;
1189
+ const getVariantStyles = variantType => {
1190
+ const variants = {
1191
+ info: {
1192
+ backgroundColor: "input.background.secondary.default",
1193
+ color: "feedback.text.secondary.default",
1194
+ borderColor: "feedback.border.secondary.default"
1195
+ },
1196
+ success: {
1197
+ backgroundColor: "feedback.background.positive.default",
1198
+ color: "feedback.text.positive.default",
1199
+ borderColor: "feedback.border.positive.default"
1200
+ },
1201
+ warning: {
1202
+ backgroundColor: "feedback.background.caution.default",
1203
+ color: "feedback.text.caution.default",
1204
+ borderColor: "feedback.border.caution.default"
1205
+ },
1206
+ error: {
1207
+ backgroundColor: "feedback.background.negative.default",
1208
+ color: "feedback.text.negative.default",
1209
+ borderColor: "feedback.border.negative.default"
1210
+ }
1211
+ };
1212
+ return variants[variantType] || variants.info;
1213
+ };
1207
1214
  return /* @__PURE__ */jsx21(Box, {
1208
1215
  sx: ({
1209
1216
  fonts
1210
1217
  }) => {
1218
+ const variantStyles = getVariantStyles(variant);
1211
1219
  return {
1220
+ ".example-arrow": {
1221
+ display: "none"
1222
+ },
1212
1223
  ".tooltip-component": {
1213
1224
  fontFamily: fonts?.body,
1214
- backgroundColor: "input.background.secondary.default",
1215
1225
  paddingY: "2",
1216
1226
  paddingX: "3",
1217
- color: "feedback.text.secondary.default",
1218
1227
  border: "sm",
1219
1228
  borderRadius: "xl",
1220
- borderColor: "feedback.border.secondary.default",
1221
1229
  zIndex: "tooltip",
1222
1230
  opacity: "1",
1223
1231
  lineHeight: "shorter",
@@ -1227,13 +1235,16 @@ var Tooltip = props => {
1227
1235
  fontFamily: "body",
1228
1236
  textDecorationLine: "underline",
1229
1237
  lineHeight: "normal"
1230
- }
1231
- }
1238
+ },
1239
+ ...variantStyles
1240
+ },
1241
+ [`&.tooltip-${variant}`]: variantStyles
1232
1242
  };
1233
1243
  },
1234
1244
  children: /* @__PURE__ */jsx21(TooltipReact, {
1235
1245
  className,
1236
1246
  ...props,
1247
+ classNameArrow: "example-arrow",
1237
1248
  children: props.children
1238
1249
  })
1239
1250
  });
@@ -1243,14 +1254,14 @@ var Tooltip = props => {
1243
1254
  import { css, Global } from "@emotion/react";
1244
1255
  import { BruttalFonts, BruttalTheme } from "@ttoss/theme/Bruttal";
1245
1256
  import { ThemeUIProvider } from "theme-ui";
1246
- import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
1257
+ import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
1247
1258
  var ThemeProvider = ({
1248
1259
  children,
1249
1260
  theme = BruttalTheme,
1250
1261
  fonts = BruttalFonts
1251
1262
  }) => {
1252
1263
  return /* @__PURE__ */jsx22(Fragment2, {
1253
- children: /* @__PURE__ */jsxs10(ThemeUIProvider, {
1264
+ children: /* @__PURE__ */jsxs9(ThemeUIProvider, {
1254
1265
  theme,
1255
1266
  children: [/* @__PURE__ */jsx22(Global, {
1256
1267
  styles: css`
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ 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 as IconButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, FlexProps, SxProp, SwitchProps, TextareaProps as TextareaProps$1, Theme } from 'theme-ui';
5
+ import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CardProps, BoxProps, CheckboxProps as CheckboxProps$1, CloseProps, TextProps, IconButtonProps as IconButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, FlexProps, SxProp, 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, 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';
@@ -41,8 +41,8 @@ interface CheckboxProps extends CheckboxProps$1 {
41
41
  }
42
42
  declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
43
43
 
44
- type CloseButtonProps = ButtonProps & {
45
- label?: string;
44
+ type CloseButtonProps = CloseProps & {
45
+ ariaLabel?: string;
46
46
  };
47
47
  declare const CloseButton: (props: CloseButtonProps) => react_jsx_runtime.JSX.Element;
48
48
 
@@ -88,6 +88,11 @@ type LabelProps = LabelProps$1 & {
88
88
  place: 'top' | 'right' | 'bottom' | 'left';
89
89
  openOnClick?: boolean;
90
90
  clickable?: boolean;
91
+ variant?: 'dark' | 'light' | 'success' | 'warning' | 'error' | 'info';
92
+ hidden?: boolean;
93
+ setIsOpen?: (value: boolean) => void;
94
+ isOpen?: boolean;
95
+ icon?: string;
91
96
  };
92
97
  };
93
98
  declare const Label: ({ children, tooltip, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
@@ -159,7 +164,7 @@ interface TextareaProps extends TextareaProps$1 {
159
164
  }
160
165
  declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
161
166
 
162
- declare const Tooltip: (props: ITooltip) => react_jsx_runtime.JSX.Element;
167
+ declare const Tooltip: ({ variant, ...props }: ITooltip) => react_jsx_runtime.JSX.Element;
163
168
 
164
169
  type ThemeProviderProps = {
165
170
  children?: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -29,7 +29,7 @@
29
29
  "react-select": "^5.9.0",
30
30
  "react-tooltip": "^5.28.0",
31
31
  "theme-ui": "^0.17.1",
32
- "@ttoss/theme": "^2.5.7"
32
+ "@ttoss/theme": "^2.6.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@emotion/react": "^11",
@@ -45,8 +45,8 @@
45
45
  "react": "^19.0.0",
46
46
  "tsup": "^8.3.5",
47
47
  "@ttoss/react-icons": "^0.4.11",
48
- "@ttoss/test-utils": "^2.1.23",
49
- "@ttoss/config": "^1.35.3"
48
+ "@ttoss/config": "^1.35.3",
49
+ "@ttoss/test-utils": "^2.1.23"
50
50
  },
51
51
  "keywords": [
52
52
  "React",