@ttoss/ui 5.11.0 → 5.11.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 +162 -165
- package/dist/index.d.ts +2 -12
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -385,6 +385,7 @@ var InfiniteLinearProgress = /* @__PURE__ */__name(() => {
|
|
|
385
385
|
|
|
386
386
|
// src/components/Input.tsx
|
|
387
387
|
import { Icon as Icon4 } from "@ttoss/react-icons";
|
|
388
|
+
import * as React7 from "react";
|
|
388
389
|
import { Input as InputUI } from "theme-ui";
|
|
389
390
|
var isInputIconConfig = /* @__PURE__ */__name(icon => {
|
|
390
391
|
return icon !== void 0 && typeof icon === "object" && "icon" in icon && (typeof icon.icon === "string" || typeof icon.icon === "object" && "body" in icon.icon);
|
|
@@ -417,7 +418,10 @@ var Input = /* @__PURE__ */__name(({
|
|
|
417
418
|
} : normalizedTrailingIconProp;
|
|
418
419
|
const isWarning = !isInvalid && trailingIcon?.icon === "warning-alt";
|
|
419
420
|
const wrapperClassName = [className, isWarning && "is-warning"].filter(Boolean).join(" ");
|
|
420
|
-
|
|
421
|
+
const id = React7.useId();
|
|
422
|
+
const leadingTooltipId = `${id}-leading-tooltip`;
|
|
423
|
+
const trailingTooltipId = `${id}-trailing-tooltip`;
|
|
424
|
+
return /* @__PURE__ */React7.createElement(Flex, {
|
|
421
425
|
className: wrapperClassName,
|
|
422
426
|
sx: {
|
|
423
427
|
...sx,
|
|
@@ -425,9 +429,9 @@ var Input = /* @__PURE__ */__name(({
|
|
|
425
429
|
padding: 0,
|
|
426
430
|
border: "none"
|
|
427
431
|
}
|
|
428
|
-
}, normalizedLeadingIcon && /* @__PURE__ */
|
|
432
|
+
}, normalizedLeadingIcon && /* @__PURE__ */React7.createElement(React7.Fragment, null, /* @__PURE__ */React7.createElement(Text, {
|
|
429
433
|
"data-testid": "input-leading-icon",
|
|
430
|
-
"data-tooltip-id": normalizedLeadingIcon.tooltip ?
|
|
434
|
+
"data-tooltip-id": normalizedLeadingIcon.tooltip ? leadingTooltipId : void 0,
|
|
431
435
|
sx: {
|
|
432
436
|
position: "absolute",
|
|
433
437
|
alignSelf: "center",
|
|
@@ -436,13 +440,13 @@ var Input = /* @__PURE__ */__name(({
|
|
|
436
440
|
},
|
|
437
441
|
onClick: normalizedLeadingIcon.onClick,
|
|
438
442
|
variant: "leading-icon"
|
|
439
|
-
}, /* @__PURE__ */
|
|
443
|
+
}, /* @__PURE__ */React7.createElement(Icon4, {
|
|
440
444
|
inline: true,
|
|
441
445
|
icon: normalizedLeadingIcon.icon
|
|
442
|
-
})), normalizedLeadingIcon.tooltip && /* @__PURE__ */
|
|
443
|
-
id:
|
|
446
|
+
})), normalizedLeadingIcon.tooltip && /* @__PURE__ */React7.createElement(Tooltip, {
|
|
447
|
+
id: leadingTooltipId,
|
|
444
448
|
...normalizedLeadingIcon.tooltipProps
|
|
445
|
-
}, normalizedLeadingIcon.tooltip)), /* @__PURE__ */
|
|
449
|
+
}, normalizedLeadingIcon.tooltip)), /* @__PURE__ */React7.createElement(InputUI, {
|
|
446
450
|
sx: {
|
|
447
451
|
fontFamily: "body",
|
|
448
452
|
paddingY: "3",
|
|
@@ -454,9 +458,9 @@ var Input = /* @__PURE__ */__name(({
|
|
|
454
458
|
},
|
|
455
459
|
className,
|
|
456
460
|
...inputProps
|
|
457
|
-
}), trailingIcon && /* @__PURE__ */
|
|
461
|
+
}), trailingIcon && /* @__PURE__ */React7.createElement(React7.Fragment, null, /* @__PURE__ */React7.createElement(Text, {
|
|
458
462
|
"data-testid": "input-trailing-icon",
|
|
459
|
-
"data-tooltip-id": trailingIcon.tooltip ?
|
|
463
|
+
"data-tooltip-id": trailingIcon.tooltip ? trailingTooltipId : void 0,
|
|
460
464
|
sx: {
|
|
461
465
|
position: "absolute",
|
|
462
466
|
right: "1rem",
|
|
@@ -467,20 +471,20 @@ var Input = /* @__PURE__ */__name(({
|
|
|
467
471
|
},
|
|
468
472
|
variant: "trailing-icon",
|
|
469
473
|
onClick: trailingIcon.onClick
|
|
470
|
-
}, /* @__PURE__ */
|
|
474
|
+
}, /* @__PURE__ */React7.createElement(Icon4, {
|
|
471
475
|
inline: true,
|
|
472
476
|
icon: trailingIcon.icon
|
|
473
|
-
})), trailingIcon.tooltip && /* @__PURE__ */
|
|
474
|
-
id:
|
|
477
|
+
})), trailingIcon.tooltip && /* @__PURE__ */React7.createElement(Tooltip, {
|
|
478
|
+
id: trailingTooltipId,
|
|
475
479
|
...trailingIcon.tooltipProps
|
|
476
480
|
}, trailingIcon.tooltip)));
|
|
477
481
|
}, "Input");
|
|
478
482
|
|
|
479
483
|
// src/components/InputNumber.tsx
|
|
480
484
|
import { Icon as Icon5 } from "@ttoss/react-icons";
|
|
481
|
-
import * as
|
|
485
|
+
import * as React8 from "react";
|
|
482
486
|
import { Input as Input2 } from "theme-ui";
|
|
483
|
-
var InputNumber = /* @__PURE__ */
|
|
487
|
+
var InputNumber = /* @__PURE__ */React8.forwardRef(({
|
|
484
488
|
sx,
|
|
485
489
|
value,
|
|
486
490
|
infoIcon,
|
|
@@ -488,7 +492,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
|
488
492
|
onClickInfoIcon,
|
|
489
493
|
...inputProps
|
|
490
494
|
}, ref) => {
|
|
491
|
-
const sxProps =
|
|
495
|
+
const sxProps = React8.useMemo(() => {
|
|
492
496
|
const size = String(typeof value === "undefined" ? 0 : value).length;
|
|
493
497
|
if (inputProps["aria-invalid"] === "true") {
|
|
494
498
|
return {
|
|
@@ -540,7 +544,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
|
540
544
|
}
|
|
541
545
|
onChange(value + 1);
|
|
542
546
|
}, "handleChangeDown");
|
|
543
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */React8.createElement(Flex, {
|
|
544
548
|
sx: {
|
|
545
549
|
width: "fit-content",
|
|
546
550
|
...sx,
|
|
@@ -550,7 +554,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
|
550
554
|
},
|
|
551
555
|
ref,
|
|
552
556
|
"aria-invalid": inputProps["aria-invalid"]
|
|
553
|
-
}, /* @__PURE__ */
|
|
557
|
+
}, /* @__PURE__ */React8.createElement(Input2, {
|
|
554
558
|
ref,
|
|
555
559
|
variant: "forms.inputNumber",
|
|
556
560
|
sx: sxProps,
|
|
@@ -560,7 +564,7 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
|
560
564
|
}, "onChange"),
|
|
561
565
|
value,
|
|
562
566
|
...inputProps
|
|
563
|
-
}), /* @__PURE__ */
|
|
567
|
+
}), /* @__PURE__ */React8.createElement(Text, {
|
|
564
568
|
sx: {
|
|
565
569
|
position: "absolute",
|
|
566
570
|
alignSelf: "center",
|
|
@@ -569,9 +573,9 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
|
569
573
|
cursor: "pointer"
|
|
570
574
|
},
|
|
571
575
|
onClick: handleChangeUp
|
|
572
|
-
}, /* @__PURE__ */
|
|
576
|
+
}, /* @__PURE__ */React8.createElement(Icon5, {
|
|
573
577
|
icon: "picker-down"
|
|
574
|
-
})), infoIcon && /* @__PURE__ */
|
|
578
|
+
})), infoIcon && /* @__PURE__ */React8.createElement(Text, {
|
|
575
579
|
sx: {
|
|
576
580
|
position: "absolute",
|
|
577
581
|
alignSelf: "center",
|
|
@@ -580,9 +584,9 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
|
580
584
|
cursor: onClickInfoIcon ? "pointer" : "default"
|
|
581
585
|
},
|
|
582
586
|
onClick: onClickInfoIcon
|
|
583
|
-
}, /* @__PURE__ */
|
|
587
|
+
}, /* @__PURE__ */React8.createElement(Icon5, {
|
|
584
588
|
icon: "info"
|
|
585
|
-
})), /* @__PURE__ */
|
|
589
|
+
})), /* @__PURE__ */React8.createElement(Text, {
|
|
586
590
|
sx: {
|
|
587
591
|
position: "absolute",
|
|
588
592
|
alignSelf: "center",
|
|
@@ -591,23 +595,23 @@ var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
|
591
595
|
cursor: "pointer"
|
|
592
596
|
},
|
|
593
597
|
onClick: handleChangeDown
|
|
594
|
-
}, /* @__PURE__ */
|
|
598
|
+
}, /* @__PURE__ */React8.createElement(Icon5, {
|
|
595
599
|
icon: "picker-up"
|
|
596
600
|
})));
|
|
597
601
|
});
|
|
598
602
|
InputNumber.displayName = "InputNumber";
|
|
599
603
|
|
|
600
604
|
// src/components/InputPassword.tsx
|
|
601
|
-
import * as
|
|
605
|
+
import * as React9 from "react";
|
|
602
606
|
var InputPassword = /* @__PURE__ */__name(({
|
|
603
607
|
showPasswordByDefault = false,
|
|
604
608
|
...inputPasswordProps
|
|
605
609
|
}) => {
|
|
606
|
-
const [hidePass, setHidePass] =
|
|
610
|
+
const [hidePass, setHidePass] = React9.useState(Boolean(!showPasswordByDefault));
|
|
607
611
|
const {
|
|
608
612
|
icon,
|
|
609
613
|
inputType
|
|
610
|
-
} =
|
|
614
|
+
} = React9.useMemo(() => {
|
|
611
615
|
return {
|
|
612
616
|
icon: hidePass ? "view-off" : "view-on",
|
|
613
617
|
inputType: hidePass ? "password" : "text"
|
|
@@ -618,7 +622,7 @@ var InputPassword = /* @__PURE__ */__name(({
|
|
|
618
622
|
return !prev;
|
|
619
623
|
});
|
|
620
624
|
}, "handleClick");
|
|
621
|
-
return /* @__PURE__ */
|
|
625
|
+
return /* @__PURE__ */React9.createElement(Input, {
|
|
622
626
|
...inputPasswordProps,
|
|
623
627
|
trailingIcon: {
|
|
624
628
|
icon,
|
|
@@ -630,8 +634,81 @@ var InputPassword = /* @__PURE__ */__name(({
|
|
|
630
634
|
|
|
631
635
|
// src/components/Label.tsx
|
|
632
636
|
import { Icon as Icon6 } from "@ttoss/react-icons";
|
|
633
|
-
import * as
|
|
637
|
+
import * as React10 from "react";
|
|
634
638
|
import { Label as LabelUi } from "theme-ui";
|
|
639
|
+
|
|
640
|
+
// src/components/Tooltip.tsx
|
|
641
|
+
import { Tooltip as TooltipReact } from "react-tooltip";
|
|
642
|
+
var Tooltip = /* @__PURE__ */__name(({
|
|
643
|
+
variant = "info",
|
|
644
|
+
sx,
|
|
645
|
+
...props
|
|
646
|
+
}) => {
|
|
647
|
+
const className = `tooltip-component tooltip-${variant}`;
|
|
648
|
+
const getVariantStyles = /* @__PURE__ */__name(variantType => {
|
|
649
|
+
const variants = {
|
|
650
|
+
info: {
|
|
651
|
+
backgroundColor: "input.background.secondary.default",
|
|
652
|
+
color: "feedback.text.secondary.default",
|
|
653
|
+
borderColor: "feedback.border.secondary.default"
|
|
654
|
+
},
|
|
655
|
+
success: {
|
|
656
|
+
backgroundColor: "feedback.background.positive.default",
|
|
657
|
+
color: "feedback.text.positive.default",
|
|
658
|
+
borderColor: "feedback.border.positive.default"
|
|
659
|
+
},
|
|
660
|
+
warning: {
|
|
661
|
+
backgroundColor: "feedback.background.caution.default",
|
|
662
|
+
color: "feedback.text.caution.default",
|
|
663
|
+
borderColor: "feedback.border.caution.default"
|
|
664
|
+
},
|
|
665
|
+
error: {
|
|
666
|
+
backgroundColor: "feedback.background.negative.default",
|
|
667
|
+
color: "feedback.text.negative.default",
|
|
668
|
+
borderColor: "feedback.border.negative.default"
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
return variants[variantType] || variants.info;
|
|
672
|
+
}, "getVariantStyles");
|
|
673
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
674
|
+
sx: /* @__PURE__ */__name(({
|
|
675
|
+
fonts
|
|
676
|
+
}) => {
|
|
677
|
+
const variantStyles = getVariantStyles(variant);
|
|
678
|
+
return {
|
|
679
|
+
".example-arrow": {
|
|
680
|
+
display: "none"
|
|
681
|
+
},
|
|
682
|
+
".tooltip-component": {
|
|
683
|
+
fontFamily: fonts?.body,
|
|
684
|
+
paddingY: "2",
|
|
685
|
+
paddingX: "3",
|
|
686
|
+
border: "sm",
|
|
687
|
+
borderRadius: "xl",
|
|
688
|
+
zIndex: "tooltip",
|
|
689
|
+
opacity: "1",
|
|
690
|
+
lineHeight: "shorter",
|
|
691
|
+
letterSpacing: "wide",
|
|
692
|
+
a: {
|
|
693
|
+
color: "feedback.text.secondary.default",
|
|
694
|
+
fontFamily: "body",
|
|
695
|
+
textDecorationLine: "underline",
|
|
696
|
+
lineHeight: "normal"
|
|
697
|
+
},
|
|
698
|
+
...variantStyles,
|
|
699
|
+
...sx
|
|
700
|
+
},
|
|
701
|
+
[`&.tooltip-${variant}`]: variantStyles
|
|
702
|
+
};
|
|
703
|
+
}, "sx")
|
|
704
|
+
}, /* @__PURE__ */React.createElement(TooltipReact, {
|
|
705
|
+
className,
|
|
706
|
+
...props,
|
|
707
|
+
classNameArrow: "example-arrow"
|
|
708
|
+
}, props.children));
|
|
709
|
+
}, "Tooltip");
|
|
710
|
+
|
|
711
|
+
// src/components/Label.tsx
|
|
635
712
|
var TOOLTIP_LABEL = "tooltip";
|
|
636
713
|
var Label = /* @__PURE__ */__name(({
|
|
637
714
|
children,
|
|
@@ -639,10 +716,9 @@ var Label = /* @__PURE__ */__name(({
|
|
|
639
716
|
sx,
|
|
640
717
|
...props
|
|
641
718
|
}) => {
|
|
642
|
-
const id =
|
|
719
|
+
const id = React10.useId();
|
|
643
720
|
const tooltipId = `${id}-tooltip`;
|
|
644
|
-
return /* @__PURE__ */
|
|
645
|
-
"data-tooltip-id": tooltipId,
|
|
721
|
+
return /* @__PURE__ */React10.createElement(LabelUi, {
|
|
646
722
|
sx: {
|
|
647
723
|
alignItems: "center",
|
|
648
724
|
fontSize: "sm",
|
|
@@ -652,39 +728,31 @@ var Label = /* @__PURE__ */__name(({
|
|
|
652
728
|
...sx
|
|
653
729
|
},
|
|
654
730
|
...props
|
|
655
|
-
}, children, tooltip && /* @__PURE__ */
|
|
731
|
+
}, children, tooltip && /* @__PURE__ */React10.createElement(Text, {
|
|
732
|
+
"data-tooltip-id": tooltipId,
|
|
656
733
|
sx: {
|
|
657
734
|
color: "currentcolor",
|
|
658
|
-
cursor: "pointer"
|
|
735
|
+
cursor: "pointer",
|
|
736
|
+
marginLeft: "1"
|
|
659
737
|
},
|
|
660
738
|
"aria-label": TOOLTIP_LABEL
|
|
661
|
-
},
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}), /* @__PURE__ */React9.createElement(Tooltip, {
|
|
668
|
-
id: tooltipId,
|
|
669
|
-
openOnClick: tooltip.openOnClick,
|
|
670
|
-
clickable: tooltip.clickable,
|
|
671
|
-
place: tooltip.place,
|
|
672
|
-
hidden: tooltip.hidden,
|
|
673
|
-
variant: tooltip.variant,
|
|
674
|
-
setIsOpen: tooltip.setIsOpen,
|
|
675
|
-
isOpen: tooltip.isOpen
|
|
676
|
-
}, tooltip.render)));
|
|
739
|
+
}, /* @__PURE__ */React10.createElement(Icon6, {
|
|
740
|
+
icon: "info"
|
|
741
|
+
}), /* @__PURE__ */React10.createElement(Tooltip, {
|
|
742
|
+
...tooltip,
|
|
743
|
+
id: tooltipId
|
|
744
|
+
})));
|
|
677
745
|
}, "Label");
|
|
678
746
|
|
|
679
747
|
// src/components/Link.tsx
|
|
680
|
-
import * as
|
|
748
|
+
import * as React11 from "react";
|
|
681
749
|
import { Link as LinkUi } from "theme-ui";
|
|
682
|
-
var Link = /* @__PURE__ */
|
|
750
|
+
var Link = /* @__PURE__ */React11.forwardRef(({
|
|
683
751
|
quiet,
|
|
684
752
|
className,
|
|
685
753
|
...props
|
|
686
754
|
}, ref) => {
|
|
687
|
-
return /* @__PURE__ */
|
|
755
|
+
return /* @__PURE__ */React11.createElement(LinkUi, {
|
|
688
756
|
className: `${quiet ? "quiet" : ""} ${className ?? ""}`,
|
|
689
757
|
...props,
|
|
690
758
|
ref
|
|
@@ -699,7 +767,7 @@ import { Paragraph } from "theme-ui";
|
|
|
699
767
|
import { Radio } from "theme-ui";
|
|
700
768
|
|
|
701
769
|
// src/components/SegmentedControl.tsx
|
|
702
|
-
import * as
|
|
770
|
+
import * as React12 from "react";
|
|
703
771
|
import { Box as Box3, Flex as Flex2 } from "theme-ui";
|
|
704
772
|
var SegmentedControl = /* @__PURE__ */__name(({
|
|
705
773
|
options,
|
|
@@ -711,8 +779,8 @@ var SegmentedControl = /* @__PURE__ */__name(({
|
|
|
711
779
|
sx,
|
|
712
780
|
...rest
|
|
713
781
|
}) => {
|
|
714
|
-
const [internalValue, setInternalValue] =
|
|
715
|
-
|
|
782
|
+
const [internalValue, setInternalValue] = React12.useState(propValue || defaultValue);
|
|
783
|
+
React12.useEffect(() => {
|
|
716
784
|
if (propValue !== void 0) {
|
|
717
785
|
setInternalValue(propValue);
|
|
718
786
|
}
|
|
@@ -730,7 +798,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
|
|
|
730
798
|
} : option;
|
|
731
799
|
});
|
|
732
800
|
const currentValue = propValue !== void 0 ? propValue : internalValue;
|
|
733
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */React12.createElement(Flex2, {
|
|
734
802
|
className,
|
|
735
803
|
sx: {
|
|
736
804
|
width: "100%",
|
|
@@ -813,18 +881,18 @@ var SegmentedControl = /* @__PURE__ */__name(({
|
|
|
813
881
|
...sx
|
|
814
882
|
},
|
|
815
883
|
...rest
|
|
816
|
-
}, /* @__PURE__ */
|
|
884
|
+
}, /* @__PURE__ */React12.createElement("div", {
|
|
817
885
|
className: "rc-segmented"
|
|
818
|
-
}, /* @__PURE__ */
|
|
886
|
+
}, /* @__PURE__ */React12.createElement(Flex2, {
|
|
819
887
|
className: "rc-segmented-group custom-segmented-group"
|
|
820
888
|
}, normalizedOptions.map((option, index) => {
|
|
821
889
|
const isSelected = option.value === currentValue;
|
|
822
890
|
const isLastItem = index === normalizedOptions.length - 1;
|
|
823
891
|
const isItemDisabled = disabled || option.disabled;
|
|
824
892
|
const showDivider = !isLastItem && option.value !== currentValue && normalizedOptions[index + 1].value !== currentValue;
|
|
825
|
-
return /* @__PURE__ */
|
|
893
|
+
return /* @__PURE__ */React12.createElement(React12.Fragment, {
|
|
826
894
|
key: `${index}-${option.value}`
|
|
827
|
-
}, /* @__PURE__ */
|
|
895
|
+
}, /* @__PURE__ */React12.createElement(Box3, {
|
|
828
896
|
as: "label",
|
|
829
897
|
className: `rc-segmented-item ${isSelected ? "rc-segmented-item-selected" : ""} ${isItemDisabled ? "rc-segmented-item-disabled" : ""}`,
|
|
830
898
|
onClick: /* @__PURE__ */__name(() => {
|
|
@@ -832,7 +900,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
|
|
|
832
900
|
handleChange(option.value);
|
|
833
901
|
}
|
|
834
902
|
}, "onClick")
|
|
835
|
-
}, /* @__PURE__ */
|
|
903
|
+
}, /* @__PURE__ */React12.createElement("input", {
|
|
836
904
|
type: "radio",
|
|
837
905
|
value: option.value,
|
|
838
906
|
checked: isSelected,
|
|
@@ -842,9 +910,9 @@ var SegmentedControl = /* @__PURE__ */__name(({
|
|
|
842
910
|
handleChange(option.value);
|
|
843
911
|
}
|
|
844
912
|
}, "onChange")
|
|
845
|
-
}), /* @__PURE__ */
|
|
913
|
+
}), /* @__PURE__ */React12.createElement("div", {
|
|
846
914
|
className: "rc-segmented-item-label"
|
|
847
|
-
}, option.label)), showDivider && /* @__PURE__ */
|
|
915
|
+
}, option.label)), showDivider && /* @__PURE__ */React12.createElement(Box3, {
|
|
848
916
|
className: "segmented-divider",
|
|
849
917
|
sx: {
|
|
850
918
|
height: "60%",
|
|
@@ -855,7 +923,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
|
|
|
855
923
|
zIndex: 3
|
|
856
924
|
}
|
|
857
925
|
}));
|
|
858
|
-
}), currentValue !== void 0 && /* @__PURE__ */
|
|
926
|
+
}), currentValue !== void 0 && /* @__PURE__ */React12.createElement("div", {
|
|
859
927
|
className: "rc-segmented-thumb",
|
|
860
928
|
style: {
|
|
861
929
|
width: `${100 / normalizedOptions.length}%`,
|
|
@@ -868,7 +936,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
|
|
|
868
936
|
|
|
869
937
|
// src/components/Select.tsx
|
|
870
938
|
import { Icon as Icon7 } from "@ttoss/react-icons";
|
|
871
|
-
import * as
|
|
939
|
+
import * as React13 from "react";
|
|
872
940
|
import ReactSelect, { components } from "react-select";
|
|
873
941
|
var Control = /* @__PURE__ */__name(props => {
|
|
874
942
|
const isDisabled = props.selectProps.isDisabled;
|
|
@@ -888,7 +956,7 @@ var Control = /* @__PURE__ */__name(props => {
|
|
|
888
956
|
}
|
|
889
957
|
return "display.background.secondary.default";
|
|
890
958
|
})();
|
|
891
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */React13.createElement(Box, {
|
|
892
960
|
sx: {
|
|
893
961
|
".react-select__control": {
|
|
894
962
|
borderColor,
|
|
@@ -897,7 +965,7 @@ var Control = /* @__PURE__ */__name(props => {
|
|
|
897
965
|
paddingY: "3"
|
|
898
966
|
}
|
|
899
967
|
}
|
|
900
|
-
}, /* @__PURE__ */
|
|
968
|
+
}, /* @__PURE__ */React13.createElement(components.Control, props));
|
|
901
969
|
}, "Control");
|
|
902
970
|
var DropdownIndicator = /* @__PURE__ */__name(props => {
|
|
903
971
|
const isDisabled = props.selectProps.isDisabled;
|
|
@@ -907,7 +975,7 @@ var DropdownIndicator = /* @__PURE__ */__name(props => {
|
|
|
907
975
|
}
|
|
908
976
|
return "text";
|
|
909
977
|
})();
|
|
910
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */React13.createElement(Text, {
|
|
911
979
|
sx: {
|
|
912
980
|
fontSize: "md",
|
|
913
981
|
color,
|
|
@@ -915,14 +983,14 @@ var DropdownIndicator = /* @__PURE__ */__name(props => {
|
|
|
915
983
|
display: "flex",
|
|
916
984
|
alignItems: "center"
|
|
917
985
|
}
|
|
918
|
-
}, /* @__PURE__ */
|
|
986
|
+
}, /* @__PURE__ */React13.createElement(Icon7, {
|
|
919
987
|
icon: "picker-down"
|
|
920
988
|
}));
|
|
921
989
|
}, "DropdownIndicator");
|
|
922
990
|
var IndicatorsContainer = /* @__PURE__ */__name(({
|
|
923
991
|
children
|
|
924
992
|
}) => {
|
|
925
|
-
return /* @__PURE__ */
|
|
993
|
+
return /* @__PURE__ */React13.createElement(Box, {
|
|
926
994
|
sx: {
|
|
927
995
|
marginLeft: "4",
|
|
928
996
|
border: "none"
|
|
@@ -932,7 +1000,7 @@ var IndicatorsContainer = /* @__PURE__ */__name(({
|
|
|
932
1000
|
var Placeholder = /* @__PURE__ */__name(({
|
|
933
1001
|
children
|
|
934
1002
|
}) => {
|
|
935
|
-
return /* @__PURE__ */
|
|
1003
|
+
return /* @__PURE__ */React13.createElement(Text, {
|
|
936
1004
|
sx: {
|
|
937
1005
|
color: "onMuted",
|
|
938
1006
|
alignSelf: "center"
|
|
@@ -950,10 +1018,10 @@ var SelectContainer = /* @__PURE__ */__name(({
|
|
|
950
1018
|
return (
|
|
951
1019
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
952
1020
|
/* @__PURE__ */
|
|
953
|
-
|
|
1021
|
+
React13.createElement(Box, {
|
|
954
1022
|
sx,
|
|
955
1023
|
css: css2
|
|
956
|
-
}, /* @__PURE__ */
|
|
1024
|
+
}, /* @__PURE__ */React13.createElement(components.SelectContainer, props, children))
|
|
957
1025
|
);
|
|
958
1026
|
}, "SelectContainer");
|
|
959
1027
|
var ValueContainer = /* @__PURE__ */__name(({
|
|
@@ -979,26 +1047,26 @@ var ValueContainer = /* @__PURE__ */__name(({
|
|
|
979
1047
|
}
|
|
980
1048
|
return leadingIcon || "search";
|
|
981
1049
|
})();
|
|
982
|
-
return /* @__PURE__ */
|
|
1050
|
+
return /* @__PURE__ */React13.createElement(Flex, {
|
|
983
1051
|
sx: {
|
|
984
1052
|
gap: "4",
|
|
985
1053
|
flex: 1
|
|
986
1054
|
}
|
|
987
|
-
}, finalLeadingIcon && /* @__PURE__ */
|
|
1055
|
+
}, finalLeadingIcon && /* @__PURE__ */React13.createElement(Text, {
|
|
988
1056
|
sx: {
|
|
989
1057
|
alignSelf: "center",
|
|
990
1058
|
pointerEvents: "none",
|
|
991
1059
|
lineHeight: 0,
|
|
992
1060
|
fontSize: "md"
|
|
993
1061
|
}
|
|
994
|
-
}, /* @__PURE__ */
|
|
1062
|
+
}, /* @__PURE__ */React13.createElement(Icon7, {
|
|
995
1063
|
icon: finalLeadingIcon
|
|
996
|
-
})), /* @__PURE__ */
|
|
1064
|
+
})), /* @__PURE__ */React13.createElement(Flex, {
|
|
997
1065
|
sx: {
|
|
998
1066
|
flex: 1,
|
|
999
1067
|
alignItems: "center"
|
|
1000
1068
|
}
|
|
1001
|
-
}, children), (trailingIcon || hasError) && /* @__PURE__ */
|
|
1069
|
+
}, children), (trailingIcon || hasError) && /* @__PURE__ */React13.createElement(Text, {
|
|
1002
1070
|
className: hasError ? "error-icon" : "",
|
|
1003
1071
|
sx: {
|
|
1004
1072
|
alignSelf: "center",
|
|
@@ -1007,11 +1075,11 @@ var ValueContainer = /* @__PURE__ */__name(({
|
|
|
1007
1075
|
fontSize: "md",
|
|
1008
1076
|
color: trailingIconColor
|
|
1009
1077
|
}
|
|
1010
|
-
}, /* @__PURE__ */
|
|
1078
|
+
}, /* @__PURE__ */React13.createElement(Icon7, {
|
|
1011
1079
|
icon: hasError ? "warning-alt" : trailingIcon
|
|
1012
1080
|
})));
|
|
1013
1081
|
}, "ValueContainer");
|
|
1014
|
-
var Select = /* @__PURE__ */
|
|
1082
|
+
var Select = /* @__PURE__ */React13.forwardRef(({
|
|
1015
1083
|
...props
|
|
1016
1084
|
}, ref) => {
|
|
1017
1085
|
const value = props.options?.find(option => {
|
|
@@ -1020,7 +1088,7 @@ var Select = /* @__PURE__ */React12.forwardRef(({
|
|
|
1020
1088
|
}
|
|
1021
1089
|
return false;
|
|
1022
1090
|
});
|
|
1023
|
-
return /* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */React13.createElement(ReactSelect, {
|
|
1024
1092
|
ref,
|
|
1025
1093
|
/**
|
|
1026
1094
|
* https://react-select.com/components
|
|
@@ -1102,7 +1170,7 @@ var Switch = /* @__PURE__ */__name(props => {
|
|
|
1102
1170
|
}, "Switch");
|
|
1103
1171
|
|
|
1104
1172
|
// src/components/Tag.tsx
|
|
1105
|
-
import * as
|
|
1173
|
+
import * as React14 from "react";
|
|
1106
1174
|
var tagVariantMap = {
|
|
1107
1175
|
positive: {
|
|
1108
1176
|
bg: "feedback.background.positive.default",
|
|
@@ -1159,7 +1227,7 @@ var Tag = /* @__PURE__ */__name(({
|
|
|
1159
1227
|
alignItems: "center"
|
|
1160
1228
|
};
|
|
1161
1229
|
if (Array.isArray(children)) {
|
|
1162
|
-
return /* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */React14.createElement(Box, {
|
|
1163
1231
|
as: "span",
|
|
1164
1232
|
sx: {
|
|
1165
1233
|
ml: 2,
|
|
@@ -1169,7 +1237,7 @@ var Tag = /* @__PURE__ */__name(({
|
|
|
1169
1237
|
...sx
|
|
1170
1238
|
}
|
|
1171
1239
|
}, children.map((child, i) => {
|
|
1172
|
-
return /* @__PURE__ */
|
|
1240
|
+
return /* @__PURE__ */React14.createElement(Box, {
|
|
1173
1241
|
key: i,
|
|
1174
1242
|
as: "span",
|
|
1175
1243
|
sx: {
|
|
@@ -1183,7 +1251,7 @@ var Tag = /* @__PURE__ */__name(({
|
|
|
1183
1251
|
}, child);
|
|
1184
1252
|
}));
|
|
1185
1253
|
}
|
|
1186
|
-
return /* @__PURE__ */
|
|
1254
|
+
return /* @__PURE__ */React14.createElement(Box, {
|
|
1187
1255
|
as: "span",
|
|
1188
1256
|
sx: {
|
|
1189
1257
|
...baseStyles,
|
|
@@ -1194,15 +1262,15 @@ var Tag = /* @__PURE__ */__name(({
|
|
|
1194
1262
|
|
|
1195
1263
|
// src/components/Textarea.tsx
|
|
1196
1264
|
import { Icon as Icon8 } from "@ttoss/react-icons";
|
|
1197
|
-
import * as
|
|
1265
|
+
import * as React15 from "react";
|
|
1198
1266
|
import { Textarea as TextareaUI } from "theme-ui";
|
|
1199
|
-
var Textarea = /* @__PURE__ */
|
|
1267
|
+
var Textarea = /* @__PURE__ */React15.forwardRef(({
|
|
1200
1268
|
trailingIcon,
|
|
1201
1269
|
className,
|
|
1202
1270
|
sx,
|
|
1203
1271
|
...textareaProps
|
|
1204
1272
|
}, ref) => {
|
|
1205
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */React15.createElement(Flex, {
|
|
1206
1274
|
className,
|
|
1207
1275
|
sx: {
|
|
1208
1276
|
...sx,
|
|
@@ -1210,7 +1278,7 @@ var Textarea = /* @__PURE__ */React14.forwardRef(({
|
|
|
1210
1278
|
padding: 0,
|
|
1211
1279
|
border: "none"
|
|
1212
1280
|
}
|
|
1213
|
-
}, /* @__PURE__ */
|
|
1281
|
+
}, /* @__PURE__ */React15.createElement(TextareaUI, {
|
|
1214
1282
|
ref,
|
|
1215
1283
|
sx: {
|
|
1216
1284
|
fontFamily: "body",
|
|
@@ -1222,103 +1290,32 @@ var Textarea = /* @__PURE__ */React14.forwardRef(({
|
|
|
1222
1290
|
},
|
|
1223
1291
|
className,
|
|
1224
1292
|
...textareaProps
|
|
1225
|
-
}), trailingIcon && /* @__PURE__ */
|
|
1293
|
+
}), trailingIcon && /* @__PURE__ */React15.createElement(Text, {
|
|
1226
1294
|
sx: {
|
|
1227
1295
|
position: "absolute",
|
|
1228
1296
|
right: "1.25rem",
|
|
1229
1297
|
top: "0.75rem"
|
|
1230
1298
|
}
|
|
1231
|
-
}, /* @__PURE__ */
|
|
1299
|
+
}, /* @__PURE__ */React15.createElement(Icon8, {
|
|
1232
1300
|
inline: true,
|
|
1233
1301
|
icon: trailingIcon
|
|
1234
1302
|
})));
|
|
1235
1303
|
});
|
|
1236
1304
|
Textarea.displayName = "Textarea";
|
|
1237
1305
|
|
|
1238
|
-
// src/components/Tooltip.tsx
|
|
1239
|
-
import { Tooltip as TooltipReact } from "react-tooltip";
|
|
1240
|
-
var Tooltip = /* @__PURE__ */__name(({
|
|
1241
|
-
variant = "info",
|
|
1242
|
-
sx,
|
|
1243
|
-
...props
|
|
1244
|
-
}) => {
|
|
1245
|
-
const className = `tooltip-component tooltip-${variant}`;
|
|
1246
|
-
const getVariantStyles = /* @__PURE__ */__name(variantType => {
|
|
1247
|
-
const variants = {
|
|
1248
|
-
info: {
|
|
1249
|
-
backgroundColor: "input.background.secondary.default",
|
|
1250
|
-
color: "feedback.text.secondary.default",
|
|
1251
|
-
borderColor: "feedback.border.secondary.default"
|
|
1252
|
-
},
|
|
1253
|
-
success: {
|
|
1254
|
-
backgroundColor: "feedback.background.positive.default",
|
|
1255
|
-
color: "feedback.text.positive.default",
|
|
1256
|
-
borderColor: "feedback.border.positive.default"
|
|
1257
|
-
},
|
|
1258
|
-
warning: {
|
|
1259
|
-
backgroundColor: "feedback.background.caution.default",
|
|
1260
|
-
color: "feedback.text.caution.default",
|
|
1261
|
-
borderColor: "feedback.border.caution.default"
|
|
1262
|
-
},
|
|
1263
|
-
error: {
|
|
1264
|
-
backgroundColor: "feedback.background.negative.default",
|
|
1265
|
-
color: "feedback.text.negative.default",
|
|
1266
|
-
borderColor: "feedback.border.negative.default"
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1269
|
-
return variants[variantType] || variants.info;
|
|
1270
|
-
}, "getVariantStyles");
|
|
1271
|
-
return /* @__PURE__ */React.createElement(Box, {
|
|
1272
|
-
sx: /* @__PURE__ */__name(({
|
|
1273
|
-
fonts
|
|
1274
|
-
}) => {
|
|
1275
|
-
const variantStyles = getVariantStyles(variant);
|
|
1276
|
-
return {
|
|
1277
|
-
".example-arrow": {
|
|
1278
|
-
display: "none"
|
|
1279
|
-
},
|
|
1280
|
-
".tooltip-component": {
|
|
1281
|
-
fontFamily: fonts?.body,
|
|
1282
|
-
paddingY: "2",
|
|
1283
|
-
paddingX: "3",
|
|
1284
|
-
border: "sm",
|
|
1285
|
-
borderRadius: "xl",
|
|
1286
|
-
zIndex: "tooltip",
|
|
1287
|
-
opacity: "1",
|
|
1288
|
-
lineHeight: "shorter",
|
|
1289
|
-
letterSpacing: "wide",
|
|
1290
|
-
a: {
|
|
1291
|
-
color: "feedback.text.secondary.default",
|
|
1292
|
-
fontFamily: "body",
|
|
1293
|
-
textDecorationLine: "underline",
|
|
1294
|
-
lineHeight: "normal"
|
|
1295
|
-
},
|
|
1296
|
-
...variantStyles,
|
|
1297
|
-
...sx
|
|
1298
|
-
},
|
|
1299
|
-
[`&.tooltip-${variant}`]: variantStyles
|
|
1300
|
-
};
|
|
1301
|
-
}, "sx")
|
|
1302
|
-
}, /* @__PURE__ */React.createElement(TooltipReact, {
|
|
1303
|
-
className,
|
|
1304
|
-
...props,
|
|
1305
|
-
classNameArrow: "example-arrow"
|
|
1306
|
-
}, props.children));
|
|
1307
|
-
}, "Tooltip");
|
|
1308
|
-
|
|
1309
1306
|
// src/theme/ThemeProvider.tsx
|
|
1310
1307
|
import { css, Global } from "@emotion/react";
|
|
1311
1308
|
import { BruttalFonts, BruttalTheme } from "@ttoss/theme/Bruttal";
|
|
1312
|
-
import * as
|
|
1309
|
+
import * as React16 from "react";
|
|
1313
1310
|
import { ThemeUIProvider } from "theme-ui";
|
|
1314
1311
|
var ThemeProvider = /* @__PURE__ */__name(({
|
|
1315
1312
|
children,
|
|
1316
1313
|
theme = BruttalTheme,
|
|
1317
1314
|
fonts = BruttalFonts
|
|
1318
1315
|
}) => {
|
|
1319
|
-
return /* @__PURE__ */
|
|
1316
|
+
return /* @__PURE__ */React16.createElement(React16.Fragment, null, /* @__PURE__ */React16.createElement(ThemeUIProvider, {
|
|
1320
1317
|
theme
|
|
1321
|
-
}, /* @__PURE__ */
|
|
1318
|
+
}, /* @__PURE__ */React16.createElement(Global, {
|
|
1322
1319
|
styles: css`
|
|
1323
1320
|
${fonts.map(url => {
|
|
1324
1321
|
return `@import url('${url}');`;
|
package/dist/index.d.ts
CHANGED
|
@@ -90,17 +90,7 @@ type InputPasswordProps = Omit<InputProps, 'trailingIcon' | 'type'> & {
|
|
|
90
90
|
declare const InputPassword: ({ showPasswordByDefault, ...inputPasswordProps }: InputPasswordProps) => react_jsx_runtime.JSX.Element;
|
|
91
91
|
|
|
92
92
|
type LabelProps = LabelProps$1 & {
|
|
93
|
-
tooltip?:
|
|
94
|
-
render: string | React.ReactNode;
|
|
95
|
-
place: 'top' | 'right' | 'bottom' | 'left';
|
|
96
|
-
openOnClick?: boolean;
|
|
97
|
-
clickable?: boolean;
|
|
98
|
-
variant?: 'dark' | 'light' | 'success' | 'warning' | 'error' | 'info';
|
|
99
|
-
hidden?: boolean;
|
|
100
|
-
setIsOpen?: (value: boolean) => void;
|
|
101
|
-
isOpen?: boolean;
|
|
102
|
-
icon?: string;
|
|
103
|
-
};
|
|
93
|
+
tooltip?: TooltipProps;
|
|
104
94
|
};
|
|
105
95
|
declare const Label: ({ children, tooltip, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
|
|
106
96
|
|
|
@@ -191,4 +181,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
|
|
|
191
181
|
|
|
192
182
|
declare const useTheme: () => theme_ui.ThemeUIContextValue;
|
|
193
183
|
|
|
194
|
-
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, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Tag, type TagProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, useTheme };
|
|
184
|
+
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, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Tag, type TagProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, type TooltipProps, useTheme };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.1",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"jest": "^30.2.0",
|
|
45
45
|
"react": "^19.2.0",
|
|
46
46
|
"tsup": "^8.5.1",
|
|
47
|
+
"@ttoss/config": "^1.35.12",
|
|
47
48
|
"@ttoss/test-utils": "^3.0.4",
|
|
48
|
-
"@ttoss/react-icons": "^0.5.3"
|
|
49
|
-
"@ttoss/config": "^1.35.12"
|
|
49
|
+
"@ttoss/react-icons": "^0.5.3"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|
|
52
52
|
"React",
|