@ttoss/ui 5.5.10 → 5.6.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 +233 -87
- package/dist/index.d.ts +19 -4
- package/package.json +5 -4
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 {
|
|
268
|
-
import { jsx as jsx6
|
|
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__ */
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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__ */
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
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__ */
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
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__ */
|
|
655
|
+
return /* @__PURE__ */jsxs5(LabelUi, {
|
|
684
656
|
"data-tooltip-id": tooltipId,
|
|
685
657
|
sx: {
|
|
686
658
|
alignItems: "center",
|
|
@@ -691,13 +663,13 @@ var Label = ({
|
|
|
691
663
|
...sx
|
|
692
664
|
},
|
|
693
665
|
...props,
|
|
694
|
-
children: [children, tooltip && /* @__PURE__ */
|
|
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(
|
|
672
|
+
children: [/* @__PURE__ */jsx14(Icon6, {
|
|
701
673
|
inline: true,
|
|
702
674
|
icon: "fluent:info-24-regular"
|
|
703
675
|
}), /* @__PURE__ */jsx14(Tooltip, {
|
|
@@ -734,11 +706,185 @@ import { Paragraph } from "theme-ui";
|
|
|
734
706
|
// src/components/Radio.tsx
|
|
735
707
|
import { Radio } from "theme-ui";
|
|
736
708
|
|
|
737
|
-
// src/components/
|
|
738
|
-
import { Icon as Icon8 } from "@ttoss/react-icons";
|
|
709
|
+
// src/components/SegmentedControl.tsx
|
|
739
710
|
import * as React11 from "react";
|
|
711
|
+
import { Box as Box3, Flex as Flex2 } from "theme-ui";
|
|
712
|
+
import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
713
|
+
var SegmentedControl = ({
|
|
714
|
+
options,
|
|
715
|
+
value: propValue,
|
|
716
|
+
defaultValue,
|
|
717
|
+
onChange,
|
|
718
|
+
disabled,
|
|
719
|
+
className,
|
|
720
|
+
sx,
|
|
721
|
+
...rest
|
|
722
|
+
}) => {
|
|
723
|
+
const [internalValue, setInternalValue] = React11.useState(propValue || defaultValue);
|
|
724
|
+
React11.useEffect(() => {
|
|
725
|
+
if (propValue !== void 0) {
|
|
726
|
+
setInternalValue(propValue);
|
|
727
|
+
}
|
|
728
|
+
}, [propValue]);
|
|
729
|
+
const handleChange = newValue => {
|
|
730
|
+
setInternalValue(newValue);
|
|
731
|
+
if (onChange) {
|
|
732
|
+
onChange(newValue);
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
const normalizedOptions = options.map(option => {
|
|
736
|
+
return typeof option === "string" || typeof option === "number" ? {
|
|
737
|
+
label: option,
|
|
738
|
+
value: option
|
|
739
|
+
} : option;
|
|
740
|
+
});
|
|
741
|
+
const currentValue = propValue !== void 0 ? propValue : internalValue;
|
|
742
|
+
return /* @__PURE__ */jsx16(Flex2, {
|
|
743
|
+
className,
|
|
744
|
+
sx: {
|
|
745
|
+
width: "100%",
|
|
746
|
+
borderRadius: "4xl",
|
|
747
|
+
border: "sm",
|
|
748
|
+
borderColor: "display.border.primary.default",
|
|
749
|
+
overflow: "hidden",
|
|
750
|
+
position: "relative",
|
|
751
|
+
".rc-segmented": {
|
|
752
|
+
width: "100%",
|
|
753
|
+
padding: "0",
|
|
754
|
+
backgroundColor: "display.background.primary.default",
|
|
755
|
+
position: "relative",
|
|
756
|
+
display: "flex",
|
|
757
|
+
flexGrow: 1
|
|
758
|
+
},
|
|
759
|
+
".rc-segmented-group, .custom-segmented-group": {
|
|
760
|
+
borderRadius: "4xl",
|
|
761
|
+
gap: "0",
|
|
762
|
+
display: "flex",
|
|
763
|
+
width: "100%",
|
|
764
|
+
position: "relative"
|
|
765
|
+
},
|
|
766
|
+
".rc-segmented-item": {
|
|
767
|
+
borderRadius: "4xl",
|
|
768
|
+
margin: 0,
|
|
769
|
+
paddingX: "5",
|
|
770
|
+
paddingY: "3",
|
|
771
|
+
fontSize: "lg",
|
|
772
|
+
display: "flex",
|
|
773
|
+
alignItems: "center",
|
|
774
|
+
justifyContent: "center",
|
|
775
|
+
color: "action.text.accent.default",
|
|
776
|
+
flex: "1 1 auto",
|
|
777
|
+
minWidth: "min-content",
|
|
778
|
+
whiteSpace: "nowrap",
|
|
779
|
+
overflow: "hidden",
|
|
780
|
+
textOverflow: "ellipsis",
|
|
781
|
+
zIndex: 2,
|
|
782
|
+
transition: "background-color 0.2s ease, color 0.2s ease",
|
|
783
|
+
cursor: "pointer",
|
|
784
|
+
"&:focus": {
|
|
785
|
+
outline: "2px solid",
|
|
786
|
+
outlineColor: "action.background.accent.default",
|
|
787
|
+
outlineOffset: "2px",
|
|
788
|
+
boxShadow: "0 0 0 1px rgba(0, 0, 0, 0.1)"
|
|
789
|
+
},
|
|
790
|
+
"&:focus-visible": {
|
|
791
|
+
outline: "2px solid",
|
|
792
|
+
outlineColor: "action.background.accent.default",
|
|
793
|
+
outlineOffset: "2px"
|
|
794
|
+
},
|
|
795
|
+
"&:hover:not(.rc-segmented-item-selected)": {
|
|
796
|
+
backgroundColor: "action.background.muted.default"
|
|
797
|
+
},
|
|
798
|
+
'input[type="radio"]': {
|
|
799
|
+
display: "none"
|
|
800
|
+
}
|
|
801
|
+
},
|
|
802
|
+
".rc-segmented-item-selected": {
|
|
803
|
+
backgroundColor: "action.background.accent.default",
|
|
804
|
+
color: "action.text.accent.active"
|
|
805
|
+
},
|
|
806
|
+
".rc-segmented-thumb": {
|
|
807
|
+
backgroundColor: "action.background.accent.default",
|
|
808
|
+
borderRadius: "4xl",
|
|
809
|
+
zIndex: -1,
|
|
810
|
+
margin: 0,
|
|
811
|
+
position: "absolute",
|
|
812
|
+
height: "100%",
|
|
813
|
+
width: "100%",
|
|
814
|
+
left: 0,
|
|
815
|
+
transition: "transform 0.2s ease, left 0.2s ease"
|
|
816
|
+
},
|
|
817
|
+
".rc-segmented-item-disabled": {
|
|
818
|
+
opacity: 0.5,
|
|
819
|
+
cursor: "not-allowed",
|
|
820
|
+
backgroundColor: "action.background.muted.disabled"
|
|
821
|
+
},
|
|
822
|
+
...sx
|
|
823
|
+
},
|
|
824
|
+
...rest,
|
|
825
|
+
children: /* @__PURE__ */jsx16("div", {
|
|
826
|
+
className: "rc-segmented",
|
|
827
|
+
children: /* @__PURE__ */jsxs6(Flex2, {
|
|
828
|
+
className: "rc-segmented-group custom-segmented-group",
|
|
829
|
+
children: [normalizedOptions.map((option, index) => {
|
|
830
|
+
const isSelected = option.value === currentValue;
|
|
831
|
+
const isLastItem = index === normalizedOptions.length - 1;
|
|
832
|
+
const isItemDisabled = disabled || option.disabled;
|
|
833
|
+
const showDivider = !isLastItem && option.value !== currentValue && normalizedOptions[index + 1].value !== currentValue;
|
|
834
|
+
return /* @__PURE__ */jsxs6(React11.Fragment, {
|
|
835
|
+
children: [/* @__PURE__ */jsxs6(Box3, {
|
|
836
|
+
as: "label",
|
|
837
|
+
className: `rc-segmented-item ${isSelected ? "rc-segmented-item-selected" : ""} ${isItemDisabled ? "rc-segmented-item-disabled" : ""}`,
|
|
838
|
+
onClick: () => {
|
|
839
|
+
if (!disabled && !option.disabled) {
|
|
840
|
+
handleChange(option.value);
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
children: [/* @__PURE__ */jsx16("input", {
|
|
844
|
+
type: "radio",
|
|
845
|
+
value: option.value,
|
|
846
|
+
checked: isSelected,
|
|
847
|
+
disabled: isItemDisabled,
|
|
848
|
+
onChange: e => {
|
|
849
|
+
if (!disabled && !option.disabled && e.target.checked) {
|
|
850
|
+
handleChange(option.value);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}), /* @__PURE__ */jsx16("div", {
|
|
854
|
+
className: "rc-segmented-item-label",
|
|
855
|
+
children: option.label
|
|
856
|
+
})]
|
|
857
|
+
}), showDivider && /* @__PURE__ */jsx16(Box3, {
|
|
858
|
+
className: "segmented-divider",
|
|
859
|
+
sx: {
|
|
860
|
+
height: "60%",
|
|
861
|
+
width: "1px",
|
|
862
|
+
backgroundColor: "action.text.accent.default",
|
|
863
|
+
opacity: 0.4,
|
|
864
|
+
alignSelf: "center",
|
|
865
|
+
zIndex: 3
|
|
866
|
+
}
|
|
867
|
+
})]
|
|
868
|
+
}, `${index}-${option.value}`);
|
|
869
|
+
}), currentValue !== void 0 && /* @__PURE__ */jsx16("div", {
|
|
870
|
+
className: "rc-segmented-thumb",
|
|
871
|
+
style: {
|
|
872
|
+
width: `${100 / normalizedOptions.length}%`,
|
|
873
|
+
transform: `translateX(${normalizedOptions.findIndex(option => {
|
|
874
|
+
return option.value === currentValue;
|
|
875
|
+
}) * 100}%)`
|
|
876
|
+
}
|
|
877
|
+
})]
|
|
878
|
+
})
|
|
879
|
+
})
|
|
880
|
+
});
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// src/components/Select.tsx
|
|
884
|
+
import { Icon as Icon7 } from "@ttoss/react-icons";
|
|
885
|
+
import * as React12 from "react";
|
|
740
886
|
import ReactSelect, { components } from "react-select";
|
|
741
|
-
import { jsx as
|
|
887
|
+
import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
742
888
|
var Control = props => {
|
|
743
889
|
const isDisabled = props.selectProps.isDisabled;
|
|
744
890
|
const hasError = props.selectProps["aria-invalid"] === "true";
|
|
@@ -757,7 +903,7 @@ var Control = props => {
|
|
|
757
903
|
}
|
|
758
904
|
return "display.background.secondary.default";
|
|
759
905
|
})();
|
|
760
|
-
return /* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */jsx17(Box, {
|
|
761
907
|
sx: {
|
|
762
908
|
".react-select__control": {
|
|
763
909
|
borderColor,
|
|
@@ -766,7 +912,7 @@ var Control = props => {
|
|
|
766
912
|
paddingY: "3"
|
|
767
913
|
}
|
|
768
914
|
},
|
|
769
|
-
children: /* @__PURE__ */
|
|
915
|
+
children: /* @__PURE__ */jsx17(components.Control, {
|
|
770
916
|
...props
|
|
771
917
|
})
|
|
772
918
|
});
|
|
@@ -779,7 +925,7 @@ var DropdownIndicator = props => {
|
|
|
779
925
|
}
|
|
780
926
|
return "text";
|
|
781
927
|
})();
|
|
782
|
-
return /* @__PURE__ */
|
|
928
|
+
return /* @__PURE__ */jsx17(Text, {
|
|
783
929
|
sx: {
|
|
784
930
|
fontSize: "md",
|
|
785
931
|
color,
|
|
@@ -787,7 +933,7 @@ var DropdownIndicator = props => {
|
|
|
787
933
|
display: "flex",
|
|
788
934
|
alignItems: "center"
|
|
789
935
|
},
|
|
790
|
-
children: /* @__PURE__ */
|
|
936
|
+
children: /* @__PURE__ */jsx17(Icon7, {
|
|
791
937
|
icon: "picker-down"
|
|
792
938
|
})
|
|
793
939
|
});
|
|
@@ -795,7 +941,7 @@ var DropdownIndicator = props => {
|
|
|
795
941
|
var IndicatorsContainer = ({
|
|
796
942
|
children
|
|
797
943
|
}) => {
|
|
798
|
-
return /* @__PURE__ */
|
|
944
|
+
return /* @__PURE__ */jsx17(Box, {
|
|
799
945
|
sx: {
|
|
800
946
|
marginLeft: "4",
|
|
801
947
|
border: "none"
|
|
@@ -806,7 +952,7 @@ var IndicatorsContainer = ({
|
|
|
806
952
|
var Placeholder = ({
|
|
807
953
|
children
|
|
808
954
|
}) => {
|
|
809
|
-
return /* @__PURE__ */
|
|
955
|
+
return /* @__PURE__ */jsx17(Text, {
|
|
810
956
|
sx: {
|
|
811
957
|
color: "onMuted",
|
|
812
958
|
alignSelf: "center"
|
|
@@ -825,10 +971,10 @@ var SelectContainer = ({
|
|
|
825
971
|
return (
|
|
826
972
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
827
973
|
/* @__PURE__ */
|
|
828
|
-
|
|
974
|
+
jsx17(Box, {
|
|
829
975
|
sx,
|
|
830
976
|
css: css2,
|
|
831
|
-
children: /* @__PURE__ */
|
|
977
|
+
children: /* @__PURE__ */jsx17(components.SelectContainer, {
|
|
832
978
|
...props,
|
|
833
979
|
children
|
|
834
980
|
})
|
|
@@ -863,23 +1009,23 @@ var ValueContainer = ({
|
|
|
863
1009
|
gap: "4",
|
|
864
1010
|
flex: 1
|
|
865
1011
|
},
|
|
866
|
-
children: [finalLeadingIcon && /* @__PURE__ */
|
|
1012
|
+
children: [finalLeadingIcon && /* @__PURE__ */jsx17(Text, {
|
|
867
1013
|
sx: {
|
|
868
1014
|
alignSelf: "center",
|
|
869
1015
|
pointerEvents: "none",
|
|
870
1016
|
lineHeight: 0,
|
|
871
1017
|
fontSize: "md"
|
|
872
1018
|
},
|
|
873
|
-
children: /* @__PURE__ */
|
|
1019
|
+
children: /* @__PURE__ */jsx17(Icon7, {
|
|
874
1020
|
icon: finalLeadingIcon
|
|
875
1021
|
})
|
|
876
|
-
}), /* @__PURE__ */
|
|
1022
|
+
}), /* @__PURE__ */jsx17(Flex, {
|
|
877
1023
|
sx: {
|
|
878
1024
|
flex: 1,
|
|
879
1025
|
alignItems: "center"
|
|
880
1026
|
},
|
|
881
1027
|
children
|
|
882
|
-
}), (trailingIcon || hasError) && /* @__PURE__ */
|
|
1028
|
+
}), (trailingIcon || hasError) && /* @__PURE__ */jsx17(Text, {
|
|
883
1029
|
className: hasError ? "error-icon" : "",
|
|
884
1030
|
sx: {
|
|
885
1031
|
alignSelf: "center",
|
|
@@ -888,13 +1034,13 @@ var ValueContainer = ({
|
|
|
888
1034
|
fontSize: "md",
|
|
889
1035
|
color: trailingIconColor
|
|
890
1036
|
},
|
|
891
|
-
children: /* @__PURE__ */
|
|
1037
|
+
children: /* @__PURE__ */jsx17(Icon7, {
|
|
892
1038
|
icon: hasError ? "warning-alt" : trailingIcon
|
|
893
1039
|
})
|
|
894
1040
|
})]
|
|
895
1041
|
});
|
|
896
1042
|
};
|
|
897
|
-
var Select =
|
|
1043
|
+
var Select = React12.forwardRef(({
|
|
898
1044
|
...props
|
|
899
1045
|
}, ref) => {
|
|
900
1046
|
const value = props.options?.find(option => {
|
|
@@ -903,7 +1049,7 @@ var Select = React11.forwardRef(({
|
|
|
903
1049
|
}
|
|
904
1050
|
return false;
|
|
905
1051
|
});
|
|
906
|
-
return /* @__PURE__ */
|
|
1052
|
+
return /* @__PURE__ */jsx17(ReactSelect, {
|
|
907
1053
|
ref,
|
|
908
1054
|
components: {
|
|
909
1055
|
Control,
|
|
@@ -939,9 +1085,9 @@ import { Slider } from "theme-ui";
|
|
|
939
1085
|
import { Spinner } from "theme-ui";
|
|
940
1086
|
|
|
941
1087
|
// src/components/Stack.tsx
|
|
942
|
-
import { jsx as
|
|
1088
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
943
1089
|
var Stack = props => {
|
|
944
|
-
return /* @__PURE__ */
|
|
1090
|
+
return /* @__PURE__ */jsx18(Flex, {
|
|
945
1091
|
...props,
|
|
946
1092
|
sx: {
|
|
947
1093
|
flexDirection: "column",
|
|
@@ -953,9 +1099,9 @@ var Stack = props => {
|
|
|
953
1099
|
|
|
954
1100
|
// src/components/Switch.tsx
|
|
955
1101
|
import { Switch as SwitchUi } from "theme-ui";
|
|
956
|
-
import { jsx as
|
|
1102
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
957
1103
|
var Switch = props => {
|
|
958
|
-
return /* @__PURE__ */
|
|
1104
|
+
return /* @__PURE__ */jsx19(SwitchUi, {
|
|
959
1105
|
...props,
|
|
960
1106
|
role: "switch",
|
|
961
1107
|
"aria-checked": props.checked || false,
|
|
@@ -980,11 +1126,11 @@ var Switch = props => {
|
|
|
980
1126
|
};
|
|
981
1127
|
|
|
982
1128
|
// src/components/Textarea.tsx
|
|
983
|
-
import { Icon as
|
|
984
|
-
import * as
|
|
1129
|
+
import { Icon as Icon8 } from "@ttoss/react-icons";
|
|
1130
|
+
import * as React13 from "react";
|
|
985
1131
|
import { Textarea as TextareaUI } from "theme-ui";
|
|
986
|
-
import { jsx as
|
|
987
|
-
var Textarea =
|
|
1132
|
+
import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1133
|
+
var Textarea = React13.forwardRef(({
|
|
988
1134
|
trailingIcon,
|
|
989
1135
|
className,
|
|
990
1136
|
sx,
|
|
@@ -998,7 +1144,7 @@ var Textarea = React12.forwardRef(({
|
|
|
998
1144
|
padding: 0,
|
|
999
1145
|
border: "none"
|
|
1000
1146
|
},
|
|
1001
|
-
children: [/* @__PURE__ */
|
|
1147
|
+
children: [/* @__PURE__ */jsx20(TextareaUI, {
|
|
1002
1148
|
ref,
|
|
1003
1149
|
sx: {
|
|
1004
1150
|
fontFamily: "body",
|
|
@@ -1010,13 +1156,13 @@ var Textarea = React12.forwardRef(({
|
|
|
1010
1156
|
},
|
|
1011
1157
|
className,
|
|
1012
1158
|
...textareaProps
|
|
1013
|
-
}), trailingIcon && /* @__PURE__ */
|
|
1159
|
+
}), trailingIcon && /* @__PURE__ */jsx20(Text, {
|
|
1014
1160
|
sx: {
|
|
1015
1161
|
position: "absolute",
|
|
1016
1162
|
right: "1.25rem",
|
|
1017
1163
|
top: "0.75rem"
|
|
1018
1164
|
},
|
|
1019
|
-
children: /* @__PURE__ */
|
|
1165
|
+
children: /* @__PURE__ */jsx20(Icon8, {
|
|
1020
1166
|
inline: true,
|
|
1021
1167
|
icon: trailingIcon
|
|
1022
1168
|
})
|
|
@@ -1027,10 +1173,10 @@ Textarea.displayName = "Textarea";
|
|
|
1027
1173
|
|
|
1028
1174
|
// src/components/Tooltip.tsx
|
|
1029
1175
|
import { Tooltip as TooltipReact } from "react-tooltip";
|
|
1030
|
-
import { jsx as
|
|
1176
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1031
1177
|
var Tooltip = props => {
|
|
1032
1178
|
const className = "tooltip-component";
|
|
1033
|
-
return /* @__PURE__ */
|
|
1179
|
+
return /* @__PURE__ */jsx21(Box, {
|
|
1034
1180
|
sx: ({
|
|
1035
1181
|
fonts
|
|
1036
1182
|
}) => {
|
|
@@ -1057,7 +1203,7 @@ var Tooltip = props => {
|
|
|
1057
1203
|
}
|
|
1058
1204
|
};
|
|
1059
1205
|
},
|
|
1060
|
-
children: /* @__PURE__ */
|
|
1206
|
+
children: /* @__PURE__ */jsx21(TooltipReact, {
|
|
1061
1207
|
className,
|
|
1062
1208
|
...props,
|
|
1063
1209
|
children: props.children
|
|
@@ -1069,16 +1215,16 @@ var Tooltip = props => {
|
|
|
1069
1215
|
import { css, Global } from "@emotion/react";
|
|
1070
1216
|
import { BruttalFonts, BruttalTheme } from "@ttoss/theme/Bruttal";
|
|
1071
1217
|
import { ThemeUIProvider } from "theme-ui";
|
|
1072
|
-
import { Fragment, jsx as
|
|
1218
|
+
import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1073
1219
|
var ThemeProvider = ({
|
|
1074
1220
|
children,
|
|
1075
1221
|
theme = BruttalTheme,
|
|
1076
1222
|
fonts = BruttalFonts
|
|
1077
1223
|
}) => {
|
|
1078
|
-
return /* @__PURE__ */
|
|
1224
|
+
return /* @__PURE__ */jsx22(Fragment2, {
|
|
1079
1225
|
children: /* @__PURE__ */jsxs9(ThemeUIProvider, {
|
|
1080
1226
|
theme,
|
|
1081
|
-
children: [/* @__PURE__ */
|
|
1227
|
+
children: [/* @__PURE__ */jsx22(Global, {
|
|
1082
1228
|
styles: css`
|
|
1083
1229
|
${fonts.map(url => {
|
|
1084
1230
|
return `@import url('${url}');`;
|
|
@@ -1097,4 +1243,4 @@ var useTheme = useThemeUI;
|
|
|
1097
1243
|
import { keyframes } from "@emotion/react";
|
|
1098
1244
|
import { useBreakpointIndex, useResponsiveValue } from "@theme-ui/match-media";
|
|
1099
1245
|
import { BaseStyles, Global as Global2 } from "theme-ui";
|
|
1100
|
-
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, Tooltip, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
|
|
1246
|
+
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, SegmentedControl, Select, Slider, Spinner, Stack, Switch, Text, Textarea, ThemeProvider, Tooltip, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
|
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,
|
|
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 =
|
|
45
|
-
|
|
44
|
+
type CloseButtonProps = CloseProps & {
|
|
45
|
+
ariaLabel?: string;
|
|
46
46
|
};
|
|
47
47
|
declare const CloseButton: (props: CloseButtonProps) => react_jsx_runtime.JSX.Element;
|
|
48
48
|
|
|
@@ -97,6 +97,21 @@ type LinkProps = LinkProps$1 & {
|
|
|
97
97
|
};
|
|
98
98
|
declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
99
99
|
|
|
100
|
+
interface SegmentedControlProps {
|
|
101
|
+
options: (string | number | {
|
|
102
|
+
label: React.ReactNode;
|
|
103
|
+
value: string | number;
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
})[];
|
|
106
|
+
value?: string | number;
|
|
107
|
+
defaultValue?: string | number;
|
|
108
|
+
onChange?: (value: string | number) => void;
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
className?: string;
|
|
111
|
+
sx?: FlexProps['sx'];
|
|
112
|
+
}
|
|
113
|
+
declare const SegmentedControl: ({ options, value: propValue, defaultValue, onChange, disabled, className, sx, ...rest }: SegmentedControlProps) => react_jsx_runtime.JSX.Element;
|
|
114
|
+
|
|
100
115
|
/**
|
|
101
116
|
* We're using React Select component to build ttoss Select.
|
|
102
117
|
* More info about React Select: https://react-select.com/home
|
|
@@ -158,4 +173,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
|
|
|
158
173
|
|
|
159
174
|
declare const useTheme: () => theme_ui.ThemeUIContextValue;
|
|
160
175
|
|
|
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 };
|
|
176
|
+
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, 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.
|
|
3
|
+
"version": "5.6.1",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -25,10 +25,11 @@
|
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@theme-ui/match-media": "^0.17.1",
|
|
28
|
+
"rc-segmented": "^2.7.0",
|
|
28
29
|
"react-select": "^5.9.0",
|
|
29
30
|
"react-tooltip": "^5.28.0",
|
|
30
31
|
"theme-ui": "^0.17.1",
|
|
31
|
-
"@ttoss/theme": "^2.5.
|
|
32
|
+
"@ttoss/theme": "^2.5.8"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"@emotion/react": "^11",
|
|
@@ -44,8 +45,8 @@
|
|
|
44
45
|
"react": "^19.0.0",
|
|
45
46
|
"tsup": "^8.3.5",
|
|
46
47
|
"@ttoss/config": "^1.35.3",
|
|
47
|
-
"@ttoss/
|
|
48
|
-
"@ttoss/
|
|
48
|
+
"@ttoss/react-icons": "^0.4.11",
|
|
49
|
+
"@ttoss/test-utils": "^2.1.23"
|
|
49
50
|
},
|
|
50
51
|
"keywords": [
|
|
51
52
|
"React",
|