@app-studio/web 0.3.64 → 0.3.65
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/bot/Bot.d.ts +13 -0
- package/dist/bot/Cache.d.ts +13 -0
- package/dist/bot/Config.d.ts +13 -0
- package/dist/bot/ContentFetcher.d.ts +9 -0
- package/dist/bot/DocuCode.d.ts +12 -0
- package/dist/bot/FileHandler.d.ts +18 -0
- package/dist/bot/OpenAIConnector.d.ts +24 -0
- package/dist/bot/data.d.ts +19 -0
- package/dist/bot/extractors.d.ts +8 -0
- package/dist/bot/index.d.ts +1 -0
- package/dist/bot/prompt/1-project.d.ts +1 -0
- package/dist/bot/prompt/2-response.d.ts +1 -0
- package/dist/bot/prompt/3-comment.d.ts +1 -0
- package/dist/components/Alert/Alert/Alert.props.d.ts +9 -0
- package/dist/components/Alert/Alert/Alert.state.d.ts +5 -0
- package/dist/components/Alert/Alert/Alert.style.d.ts +47 -0
- package/dist/components/Alert/Alert/Alert.type.d.ts +8 -0
- package/dist/components/Alert/Alert/Alert.view.d.ts +3 -0
- package/dist/components/Alert/Alert.d.ts +3 -0
- package/dist/components/Alert/examples/default.d.ts +2 -0
- package/dist/components/Alert/examples/icon.d.ts +2 -0
- package/dist/components/Alert/examples/index.d.ts +4 -0
- package/dist/components/Alert/examples/styles.d.ts +2 -0
- package/dist/components/Alert/examples/variant.d.ts +2 -0
- package/dist/components/AspectRatio/AspectRatio/AspectRatio.props.d.ts +6 -0
- package/dist/components/AspectRatio/AspectRatio/AspectRatio.view.d.ts +3 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +3 -0
- package/dist/components/AspectRatio/examples/default.d.ts +2 -0
- package/dist/components/AspectRatio/examples/index.d.ts +2 -0
- package/dist/components/AspectRatio/examples/ratio.d.ts +2 -0
- package/dist/components/Avatar/Avatar/Avatar.props.d.ts +12 -0
- package/dist/components/Avatar/Avatar/Avatar.state.d.ts +5 -0
- package/dist/components/Avatar/Avatar/Avatar.style.d.ts +2 -0
- package/dist/components/Avatar/Avatar/Avatar.type.d.ts +7 -0
- package/dist/components/Avatar/Avatar/Avatar.view.d.ts +3 -0
- package/dist/components/Avatar/Avatar.d.ts +3 -0
- package/dist/components/Avatar/examples/default.d.ts +2 -0
- package/dist/components/Avatar/examples/fallback.d.ts +2 -0
- package/dist/components/Avatar/examples/index.d.ts +4 -0
- package/dist/components/Avatar/examples/size.d.ts +2 -0
- package/dist/components/Avatar/examples/styles.d.ts +2 -0
- package/dist/components/Badge/Badge/Badge.props.d.ts +11 -0
- package/dist/components/Badge/Badge/Badge.style.d.ts +8 -0
- package/dist/components/Badge/Badge/Badge.type.d.ts +9 -0
- package/dist/components/Badge/Badge/Badge.view.d.ts +4 -0
- package/dist/components/Badge/Badge.d.ts +3 -0
- package/dist/components/Badge/examples/colorScheme.d.ts +2 -0
- package/dist/components/Badge/examples/content.d.ts +2 -0
- package/dist/components/Badge/examples/default.d.ts +2 -0
- package/dist/components/Badge/examples/index.d.ts +8 -0
- package/dist/components/Badge/examples/position.d.ts +2 -0
- package/dist/components/Badge/examples/shape.d.ts +2 -0
- package/dist/components/Badge/examples/size.d.ts +2 -0
- package/dist/components/Badge/examples/styles.d.ts +2 -0
- package/dist/components/Badge/examples/variant.d.ts +2 -0
- package/dist/components/Button/Button/Button.props.d.ts +2 -1
- package/dist/components/Button/examples/effect.d.ts +2 -0
- package/dist/components/Button/examples/index.d.ts +11 -9
- package/dist/components/Form/Checkbox/examples/index.d.ts +11 -11
- package/dist/components/Form/CountryPicker/examples/index.d.ts +12 -12
- package/dist/components/Form/DatePicker/examples/index.d.ts +10 -10
- package/dist/components/Form/Password/Password/Password.state.d.ts +2 -2
- package/dist/components/Form/Select/examples/index.d.ts +11 -0
- package/dist/components/Form/Switch/Switch/Switch.state.d.ts +2 -2
- package/dist/components/Form/Switch/examples/index.d.ts +9 -0
- package/dist/components/Form/TextArea/examples/index.d.ts +14 -13
- package/dist/components/Form/TextField/examples/colorScheme.d.ts +2 -0
- package/dist/components/Form/TextField/examples/index.d.ts +15 -15
- package/dist/components/Form/TextField/examples/isClearable.d.ts +2 -0
- package/dist/components/Formik/examples/index.d.ts +3 -4
- package/dist/components/Layout/Horizontal/examples/index.d.ts +4 -4
- package/dist/components/Link/examples/index.d.ts +3 -0
- package/dist/components/Loader/examples/index.d.ts +7 -7
- package/dist/components/Svg/DustBin.d.ts +1 -0
- package/dist/components/Svg/Warning.d.ts +8 -0
- package/dist/components/Svg/index.d.ts +1 -0
- package/dist/components/Tabs/Tabs/Tabs.props.d.ts +12 -0
- package/dist/components/Tabs/Tabs/Tabs.state.d.ts +8 -0
- package/dist/components/Tabs/Tabs/Tabs.view.d.ts +3 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -0
- package/dist/components/Tabs/examples/default.d.ts +2 -0
- package/dist/components/Tabs/examples/index.d.ts +2 -0
- package/dist/components/Tabs/examples/styles.d.ts +2 -0
- package/dist/components/Toggle/Toggle/Toggle.props.d.ts +18 -0
- package/dist/components/Toggle/Toggle/Toggle.state.d.ts +7 -0
- package/dist/components/Toggle/Toggle/Toggle.style.d.ts +2 -0
- package/dist/components/Toggle/Toggle/Toggle.type.d.ts +2 -0
- package/dist/components/Toggle/Toggle/Toggle.view.d.ts +4 -0
- package/dist/components/Toggle/Toggle.d.ts +3 -0
- package/dist/components/Toggle/examples/colorScheme.d.ts +2 -0
- package/dist/components/Toggle/examples/default.d.ts +2 -0
- package/dist/components/Toggle/examples/index.d.ts +7 -0
- package/dist/components/Toggle/examples/isDisabled.d.ts +2 -0
- package/dist/components/Toggle/examples/isToggled.d.ts +2 -0
- package/dist/components/Toggle/examples/onToggle.d.ts +2 -0
- package/dist/components/Toggle/examples/shape.d.ts +2 -0
- package/dist/components/Toggle/examples/variant.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup/ToggleGroup.props.d.ts +16 -0
- package/dist/components/ToggleGroup/ToggleGroup/ToggleGroup.state.d.ts +5 -0
- package/dist/components/ToggleGroup/ToggleGroup/ToggleGroup.style.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup/ToggleGroup.type.d.ts +10 -0
- package/dist/components/ToggleGroup/ToggleGroup/ToggleGroup.view.d.ts +3 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +3 -0
- package/dist/components/ToggleGroup/examples/colorScheme.d.ts +2 -0
- package/dist/components/ToggleGroup/examples/default.d.ts +2 -0
- package/dist/components/ToggleGroup/examples/index.d.ts +6 -0
- package/dist/components/ToggleGroup/examples/items.d.ts +2 -0
- package/dist/components/ToggleGroup/examples/onToggleChange.d.ts +2 -0
- package/dist/components/ToggleGroup/examples/shape.d.ts +2 -0
- package/dist/components/ToggleGroup/examples/variant.d.ts +2 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/pages/alert.page.d.ts +3 -0
- package/dist/pages/aspectRatio.page.d.ts +3 -0
- package/dist/pages/avatar.page.d.ts +3 -0
- package/dist/pages/badge.page.d.ts +3 -0
- package/dist/pages/tabs.page.d.ts +3 -0
- package/dist/pages/toggle.page.d.ts +3 -0
- package/dist/pages/toggleGroup.page.d.ts +3 -0
- package/dist/web.cjs.development.js +683 -45
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +677 -46
- package/dist/web.esm.js.map +1 -1
- package/package.json +15 -3
- package/dist/components/Form/TextField/examples/ClearInput.d.ts +0 -2
- package/dist/components/Form/TextField/examples/ColorScheme.d.ts +0 -2
- package/dist/components/Layout/Vertical/examples/index.d.ts +0 -5
- /package/dist/components/Button/examples/{AutoFocusButton.d.ts → autofocus.d.ts} +0 -0
- /package/dist/components/Button/examples/{ColoredButtons.d.ts → colorScheme.d.ts} +0 -0
- /package/dist/components/Button/examples/{DefaultButton.d.ts → default.d.ts} +0 -0
- /package/dist/components/Button/examples/{IconButtons.d.ts → icon.d.ts} +0 -0
- /package/dist/components/Button/examples/{BorderedButtons.d.ts → isAuto.d.ts} +0 -0
- /package/dist/components/Button/examples/{DisabledButton.d.ts → isDisabled.d.ts} +0 -0
- /package/dist/components/Button/examples/{LoaderButtons.d.ts → loaderProps.d.ts} +0 -0
- /package/dist/components/Button/examples/{ShadowButton.d.ts → shadow.d.ts} +0 -0
- /package/dist/components/Button/examples/{SizeButtons.d.ts → size.d.ts} +0 -0
- /package/dist/components/Button/examples/{VariantButtons.d.ts → variant.d.ts} +0 -0
- /package/dist/pages/{input.page.d.ts → textfield.page.d.ts} +0 -0
|
@@ -11,6 +11,9 @@ var reactRouterDom = require('react-router-dom');
|
|
|
11
11
|
var format = _interopDefault(require('date-fns/format'));
|
|
12
12
|
var formik = require('formik');
|
|
13
13
|
var zustand = require('zustand');
|
|
14
|
+
var View$1 = require('src/components/Layout/View/View');
|
|
15
|
+
var components = require('src/components');
|
|
16
|
+
var Svg = require('src/components/Svg');
|
|
14
17
|
|
|
15
18
|
var useButtonState = function useButtonState() {
|
|
16
19
|
var _React$useState = React__default.useState(false),
|
|
@@ -772,7 +775,7 @@ var LoaderComponent = function LoaderComponent(props) {
|
|
|
772
775
|
*/
|
|
773
776
|
var Loader = LoaderComponent;
|
|
774
777
|
|
|
775
|
-
var _excluded$c = ["icon", "shadow", "children", "ariaLabel", "externalHref", "isAuto", "isFilled", "isIconRounded", "isLoading", "isDisabled", "size", "variant", "iconPosition", "colorScheme", "shape", "onClick", "loaderProps", "loaderPosition"];
|
|
778
|
+
var _excluded$c = ["icon", "shadow", "children", "ariaLabel", "externalHref", "isAuto", "isFilled", "isIconRounded", "isLoading", "isDisabled", "size", "variant", "iconPosition", "colorScheme", "shape", "onClick", "loaderProps", "loaderPosition", "effect", "isHovered"];
|
|
776
779
|
var ButtonView = function ButtonView(_ref) {
|
|
777
780
|
var _props$onClick;
|
|
778
781
|
var icon = _ref.icon,
|
|
@@ -806,34 +809,46 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
806
809
|
loaderProps = _ref$loaderProps === void 0 ? {} : _ref$loaderProps,
|
|
807
810
|
_ref$loaderPosition = _ref.loaderPosition,
|
|
808
811
|
loaderPosition = _ref$loaderPosition === void 0 ? 'left' : _ref$loaderPosition,
|
|
812
|
+
_ref$effect = _ref.effect,
|
|
813
|
+
effect = _ref$effect === void 0 ? 'default' : _ref$effect,
|
|
814
|
+
isHovered = _ref.isHovered,
|
|
809
815
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
810
816
|
var isActive = !(isDisabled || isLoading);
|
|
811
817
|
var defaultNativeProps = {
|
|
812
818
|
disabled: !isActive
|
|
813
819
|
};
|
|
814
820
|
var buttonColor = isActive ? colorScheme : 'theme.disabled';
|
|
821
|
+
var hovering = isHovered && effect === 'hover';
|
|
822
|
+
var reverse = isHovered && effect === 'reverse';
|
|
815
823
|
var ButtonVariants = {
|
|
816
824
|
filled: {
|
|
817
|
-
backgroundColor: buttonColor,
|
|
818
|
-
color: 'color.white'
|
|
825
|
+
backgroundColor: reverse ? 'transparent' : buttonColor,
|
|
826
|
+
color: reverse ? buttonColor : 'color.white',
|
|
827
|
+
borderWidth: 1,
|
|
828
|
+
borderStyle: 'solid',
|
|
829
|
+
borderColor: reverse ? buttonColor : 'transparent'
|
|
819
830
|
},
|
|
820
831
|
outline: {
|
|
821
|
-
backgroundColor: 'transparent',
|
|
832
|
+
backgroundColor: reverse ? buttonColor : 'transparent',
|
|
822
833
|
borderWidth: 1,
|
|
823
834
|
borderStyle: 'solid',
|
|
824
|
-
borderColor: colorScheme,
|
|
825
|
-
color: buttonColor
|
|
835
|
+
borderColor: reverse ? buttonColor : colorScheme,
|
|
836
|
+
color: reverse ? 'white' : buttonColor
|
|
826
837
|
},
|
|
827
838
|
link: {
|
|
828
839
|
backgroundColor: 'transparent',
|
|
829
|
-
|
|
840
|
+
borderWidth: 1,
|
|
841
|
+
borderStyle: 'solid',
|
|
842
|
+
borderColor: reverse ? buttonColor : 'transparent',
|
|
830
843
|
color: buttonColor,
|
|
831
|
-
|
|
844
|
+
textDecoration: reverse ? 'none' : 'underline'
|
|
832
845
|
},
|
|
833
846
|
ghost: {
|
|
834
|
-
backgroundColor: 'transparent',
|
|
835
|
-
|
|
836
|
-
|
|
847
|
+
backgroundColor: reverse ? buttonColor : 'transparent',
|
|
848
|
+
color: reverse ? 'color.white' : buttonColor,
|
|
849
|
+
borderWidth: 1,
|
|
850
|
+
borderStyle: 'solid',
|
|
851
|
+
borderColor: reverse ? buttonColor : 'transparent'
|
|
837
852
|
}
|
|
838
853
|
};
|
|
839
854
|
var buttonSizeStyles = ButtonSizes[size];
|
|
@@ -845,7 +860,7 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
845
860
|
padding: isIconRounded ? IconSizes$1[size].padding : ButtonSizes[size].padding
|
|
846
861
|
};
|
|
847
862
|
var content = React__default.createElement(Horizontal, {
|
|
848
|
-
gap:
|
|
863
|
+
gap: 10
|
|
849
864
|
}, isLoading && loaderPosition === 'left' && React__default.createElement(Loader, Object.assign({}, loaderProps)), icon && iconPosition === 'left' && !isLoading && icon, children, icon && iconPosition === 'right' && !isLoading && icon, isLoading && loaderPosition === 'right' && React__default.createElement(Loader, Object.assign({}, loaderProps)));
|
|
850
865
|
return React__default.createElement(appStudio.Element, Object.assign({
|
|
851
866
|
gap: 8,
|
|
@@ -860,7 +875,10 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
860
875
|
backgroundColor: buttonColor,
|
|
861
876
|
borderRadius: ButtonShapes[shape],
|
|
862
877
|
onClick: (_props$onClick = props.onClick) != null ? _props$onClick : onClick,
|
|
863
|
-
cursor: isActive ? 'pointer' : 'default'
|
|
878
|
+
cursor: isActive ? 'pointer' : 'default',
|
|
879
|
+
filter: hovering ? 'brightness(0.85)' : 'brightness(1)',
|
|
880
|
+
transition: hovering && !props.isDisabled ? 'transform 0.3s ease' : '',
|
|
881
|
+
transform: hovering && !props.isDisabled ? 'translateY(-5px)' : ''
|
|
864
882
|
}, defaultNativeProps, buttonSizeStyles, buttonVariant, scaleWidth, changePadding, shadow, props), variant === 'link' && externalHref ? React__default.createElement(Link, {
|
|
865
883
|
href: externalHref,
|
|
866
884
|
textDecorationColor: colorScheme,
|
|
@@ -877,9 +895,10 @@ var ButtonComponent = function ButtonComponent(props) {
|
|
|
877
895
|
return setIsHovered(!isHovered);
|
|
878
896
|
};
|
|
879
897
|
return React__default.createElement(ButtonView, Object.assign({
|
|
898
|
+
isHovered: isHovered,
|
|
899
|
+
setIsHovered: setIsHovered,
|
|
880
900
|
onMouseEnter: handleHover,
|
|
881
|
-
onMouseLeave: handleHover
|
|
882
|
-
filter: isHovered ? 'brightness(0.85)' : 'brightness(1)'
|
|
901
|
+
onMouseLeave: handleHover
|
|
883
902
|
}, props));
|
|
884
903
|
};
|
|
885
904
|
/**
|
|
@@ -2601,32 +2620,6 @@ var useCountryPickerState = function useCountryPickerState(_ref) {
|
|
|
2601
2620
|
};
|
|
2602
2621
|
};
|
|
2603
2622
|
|
|
2604
|
-
var _excluded$f = ["children", "wrap", "justify", "isReversed"];
|
|
2605
|
-
var VerticalView = function VerticalView(_ref) {
|
|
2606
|
-
var children = _ref.children,
|
|
2607
|
-
_ref$wrap = _ref.wrap,
|
|
2608
|
-
wrap = _ref$wrap === void 0 ? 'nowrap' : _ref$wrap,
|
|
2609
|
-
_ref$justify = _ref.justify,
|
|
2610
|
-
justify = _ref$justify === void 0 ? 'flex-start' : _ref$justify,
|
|
2611
|
-
_ref$isReversed = _ref.isReversed,
|
|
2612
|
-
isReversed = _ref$isReversed === void 0 ? false : _ref$isReversed,
|
|
2613
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
2614
|
-
return React__default.createElement(appStudio.View, Object.assign({
|
|
2615
|
-
display: "flex",
|
|
2616
|
-
flexWrap: wrap,
|
|
2617
|
-
flexDirection: isReversed ? 'column-reverse' : 'column',
|
|
2618
|
-
justifyContent: justify
|
|
2619
|
-
}, props), children);
|
|
2620
|
-
};
|
|
2621
|
-
|
|
2622
|
-
/**
|
|
2623
|
-
* Vertical layout aligns all the elements in a container on the vertical axis.
|
|
2624
|
-
*/
|
|
2625
|
-
var VerticalComponent = function VerticalComponent(props) {
|
|
2626
|
-
return React__default.createElement(VerticalView, Object.assign({}, props));
|
|
2627
|
-
};
|
|
2628
|
-
var Vertical = VerticalComponent;
|
|
2629
|
-
|
|
2630
2623
|
var HeadingSizes$1 = {
|
|
2631
2624
|
h1: {
|
|
2632
2625
|
fontSize: 96,
|
|
@@ -2660,7 +2653,7 @@ var HeadingSizes$1 = {
|
|
|
2660
2653
|
}
|
|
2661
2654
|
};
|
|
2662
2655
|
|
|
2663
|
-
var _excluded$
|
|
2656
|
+
var _excluded$f = ["children", "heading", "maxLines", "isItalic", "isUnderlined", "isSub", "isSup", "isStriked", "isTruncated", "weight", "size"];
|
|
2664
2657
|
var TextContent = function TextContent(_ref) {
|
|
2665
2658
|
var children = _ref.children,
|
|
2666
2659
|
isSub = _ref.isSub,
|
|
@@ -2724,7 +2717,7 @@ var TextView = function TextView(_ref3) {
|
|
|
2724
2717
|
weight = _ref3$weight === void 0 ? 'normal' : _ref3$weight,
|
|
2725
2718
|
_ref3$size = _ref3.size,
|
|
2726
2719
|
size = _ref3$size === void 0 ? 'md' : _ref3$size,
|
|
2727
|
-
props = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
|
2720
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded$f);
|
|
2728
2721
|
var headingStyles = heading ? HeadingSizes$1[heading] : {};
|
|
2729
2722
|
var noLineBreak = isSub || isSup ? {
|
|
2730
2723
|
display: 'inline'
|
|
@@ -2754,14 +2747,14 @@ var TextComponent = function TextComponent(props) {
|
|
|
2754
2747
|
*/
|
|
2755
2748
|
var Text = TextComponent;
|
|
2756
2749
|
|
|
2757
|
-
var _excluded$
|
|
2750
|
+
var _excluded$g = ["children", "styles"];
|
|
2758
2751
|
var HelperText = function HelperText(_ref) {
|
|
2759
2752
|
var children = _ref.children,
|
|
2760
2753
|
_ref$styles = _ref.styles,
|
|
2761
2754
|
styles = _ref$styles === void 0 ? {
|
|
2762
2755
|
helperText: {}
|
|
2763
2756
|
} : _ref$styles,
|
|
2764
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
2757
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
|
2765
2758
|
return React__default.createElement(Text, Object.assign({
|
|
2766
2759
|
size: "xs",
|
|
2767
2760
|
marginVertical: 0,
|
|
@@ -2770,6 +2763,32 @@ var HelperText = function HelperText(_ref) {
|
|
|
2770
2763
|
}, styles['helperText'], props), children);
|
|
2771
2764
|
};
|
|
2772
2765
|
|
|
2766
|
+
var _excluded$h = ["children", "wrap", "justify", "isReversed"];
|
|
2767
|
+
var VerticalView = function VerticalView(_ref) {
|
|
2768
|
+
var children = _ref.children,
|
|
2769
|
+
_ref$wrap = _ref.wrap,
|
|
2770
|
+
wrap = _ref$wrap === void 0 ? 'nowrap' : _ref$wrap,
|
|
2771
|
+
_ref$justify = _ref.justify,
|
|
2772
|
+
justify = _ref$justify === void 0 ? 'flex-start' : _ref$justify,
|
|
2773
|
+
_ref$isReversed = _ref.isReversed,
|
|
2774
|
+
isReversed = _ref$isReversed === void 0 ? false : _ref$isReversed,
|
|
2775
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
|
2776
|
+
return React__default.createElement(appStudio.View, Object.assign({
|
|
2777
|
+
display: "flex",
|
|
2778
|
+
flexWrap: wrap,
|
|
2779
|
+
flexDirection: isReversed ? 'column-reverse' : 'column',
|
|
2780
|
+
justifyContent: justify
|
|
2781
|
+
}, props), children);
|
|
2782
|
+
};
|
|
2783
|
+
|
|
2784
|
+
/**
|
|
2785
|
+
* Vertical layout aligns all the elements in a container on the vertical axis.
|
|
2786
|
+
*/
|
|
2787
|
+
var VerticalComponent = function VerticalComponent(props) {
|
|
2788
|
+
return React__default.createElement(VerticalView, Object.assign({}, props));
|
|
2789
|
+
};
|
|
2790
|
+
var Vertical = VerticalComponent;
|
|
2791
|
+
|
|
2773
2792
|
var _excluded$i = ["children", "helperText", "error", "styles"];
|
|
2774
2793
|
var FieldContainer = function FieldContainer(_ref) {
|
|
2775
2794
|
var children = _ref.children,
|
|
@@ -4936,6 +4955,622 @@ var FileImage = function FileImage(_ref2) {
|
|
|
4936
4955
|
}, props));
|
|
4937
4956
|
};
|
|
4938
4957
|
|
|
4958
|
+
var useTabsState = function useTabsState(propTabs) {
|
|
4959
|
+
// Defines a custom hook, named `useTabsState`, that manages the state of tabs within a component.
|
|
4960
|
+
var _useState = React.useState(propTabs[0]),
|
|
4961
|
+
isActive = _useState[0],
|
|
4962
|
+
setIsActive = _useState[1];
|
|
4963
|
+
// Initializes 'isActive' state with the first tab from the 'propTabs' array, indicating the currently active tab.
|
|
4964
|
+
var _useState2 = React.useState(propTabs),
|
|
4965
|
+
tabsState = _useState2[0],
|
|
4966
|
+
setTabsState = _useState2[1];
|
|
4967
|
+
// Initializes 'tabsState' as a stateful array that reflects the tabs passed through 'propTabs' prop, setting the initial state of tabs.
|
|
4968
|
+
return {
|
|
4969
|
+
// The hook returns an object containing both the state and the functions to update the state, allowing components to control and access the current state of the tabs.
|
|
4970
|
+
isActive: isActive,
|
|
4971
|
+
setIsActive: setIsActive,
|
|
4972
|
+
tabsState: tabsState,
|
|
4973
|
+
setTabsState: setTabsState
|
|
4974
|
+
};
|
|
4975
|
+
};
|
|
4976
|
+
|
|
4977
|
+
var TabsView = function TabsView(props) {
|
|
4978
|
+
var tabs = props.tabs,
|
|
4979
|
+
styles = props.styles,
|
|
4980
|
+
isActive = props.isActive,
|
|
4981
|
+
setIsActive = props.setIsActive,
|
|
4982
|
+
tabsState = props.tabsState,
|
|
4983
|
+
setTabsState = props.setTabsState;
|
|
4984
|
+
var moveSelectedTabToTop = function moveSelectedTabToTop(idx) {
|
|
4985
|
+
var newTabs = [].concat(tabs);
|
|
4986
|
+
var selectedTab = newTabs.splice(idx, 1);
|
|
4987
|
+
newTabs.unshift(selectedTab[0]);
|
|
4988
|
+
setTabsState(newTabs);
|
|
4989
|
+
setIsActive(newTabs[0]);
|
|
4990
|
+
};
|
|
4991
|
+
var isContentActive = function isContentActive(tab) {
|
|
4992
|
+
return tab.value === tabsState[0].value;
|
|
4993
|
+
};
|
|
4994
|
+
return React__default.createElement(components.Horizontal, Object.assign({
|
|
4995
|
+
width: "100w",
|
|
4996
|
+
height: '100%'
|
|
4997
|
+
}, styles == null ? void 0 : styles.container), React__default.createElement(components.Horizontal, Object.assign({
|
|
4998
|
+
marginBottom: 20
|
|
4999
|
+
}, styles == null ? void 0 : styles.headerTabs), tabs.map(function (tab, idx) {
|
|
5000
|
+
return React__default.createElement(components.Button, Object.assign({
|
|
5001
|
+
key: tab.title,
|
|
5002
|
+
onClick: function onClick() {
|
|
5003
|
+
moveSelectedTabToTop(idx);
|
|
5004
|
+
},
|
|
5005
|
+
variant: isActive.value === tab.value ? 'filled' : 'ghost',
|
|
5006
|
+
shape: "pillShaped",
|
|
5007
|
+
cursor: "pointer",
|
|
5008
|
+
isAuto: true
|
|
5009
|
+
}, styles == null ? void 0 : styles.tab, isActive.value === tab.value ? styles == null ? void 0 : styles.activeTab : {}), React__default.createElement(components.Text, Object.assign({}, styles == null ? void 0 : styles.title, isActive.value === tab.value ? styles == null ? void 0 : styles.activeText : {}), tab.title));
|
|
5010
|
+
})), React__default.createElement(View$1.View, Object.assign({
|
|
5011
|
+
width: '100%',
|
|
5012
|
+
height: "100%"
|
|
5013
|
+
}, styles == null ? void 0 : styles.content), tabsState.map(function (tab, idx) {
|
|
5014
|
+
return isContentActive(tab) && React__default.createElement(View$1.View, {
|
|
5015
|
+
key: idx
|
|
5016
|
+
}, tab.content);
|
|
5017
|
+
})));
|
|
5018
|
+
};
|
|
5019
|
+
|
|
5020
|
+
// Define the functional component TabsComponent that utilizes the TabsProps interface for its props.
|
|
5021
|
+
var TabsComponent = function TabsComponent(_ref) {
|
|
5022
|
+
var tabs = _ref.tabs,
|
|
5023
|
+
styles = _ref.styles;
|
|
5024
|
+
// Destructure the 'tabs' and 'styles' properties from the component's props.
|
|
5025
|
+
var _useTabsState = useTabsState(tabs),
|
|
5026
|
+
isActive = _useTabsState.isActive,
|
|
5027
|
+
setIsActive = _useTabsState.setIsActive,
|
|
5028
|
+
tabsState = _useTabsState.tabsState,
|
|
5029
|
+
setTabsState = _useTabsState.setTabsState;
|
|
5030
|
+
// Invoke the useTabsState custom hook with 'tabs' to manage state related to tab activities like the active tab and tab state management.
|
|
5031
|
+
return React__default.createElement(TabsView, {
|
|
5032
|
+
tabs: tabs,
|
|
5033
|
+
styles: styles,
|
|
5034
|
+
isActive: isActive,
|
|
5035
|
+
tabsState: tabsState,
|
|
5036
|
+
setTabsState: setTabsState,
|
|
5037
|
+
setIsActive: setIsActive
|
|
5038
|
+
});
|
|
5039
|
+
};
|
|
5040
|
+
var Tabs = /*#__PURE__*/React__default.memo(TabsComponent);
|
|
5041
|
+
|
|
5042
|
+
var Themes = {
|
|
5043
|
+
default: {
|
|
5044
|
+
container: {
|
|
5045
|
+
backgroundColor: 'white',
|
|
5046
|
+
border: 'color.blackAlpha.800'
|
|
5047
|
+
},
|
|
5048
|
+
content: {
|
|
5049
|
+
color: 'color.blackAlpha.800'
|
|
5050
|
+
}
|
|
5051
|
+
},
|
|
5052
|
+
info: {
|
|
5053
|
+
container: {
|
|
5054
|
+
backgroundColor: 'color.blue.200',
|
|
5055
|
+
border: 'color.blue.400'
|
|
5056
|
+
},
|
|
5057
|
+
content: {
|
|
5058
|
+
color: '#60a5fa'
|
|
5059
|
+
}
|
|
5060
|
+
},
|
|
5061
|
+
success: {
|
|
5062
|
+
container: {
|
|
5063
|
+
backgroundColor: 'color.green.200',
|
|
5064
|
+
border: 'color.green.400'
|
|
5065
|
+
},
|
|
5066
|
+
content: {
|
|
5067
|
+
color: '#22c55e'
|
|
5068
|
+
}
|
|
5069
|
+
},
|
|
5070
|
+
error: {
|
|
5071
|
+
container: {
|
|
5072
|
+
backgroundColor: 'color.red.200',
|
|
5073
|
+
border: 'color.red.400'
|
|
5074
|
+
},
|
|
5075
|
+
content: {
|
|
5076
|
+
color: '#ef4444'
|
|
5077
|
+
}
|
|
5078
|
+
},
|
|
5079
|
+
warning: {
|
|
5080
|
+
container: {
|
|
5081
|
+
backgroundColor: 'color.orange.200',
|
|
5082
|
+
border: 'color.orange.400'
|
|
5083
|
+
},
|
|
5084
|
+
content: {
|
|
5085
|
+
color: '#f97316'
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5088
|
+
};
|
|
5089
|
+
|
|
5090
|
+
var AlertView = function AlertView(_ref) {
|
|
5091
|
+
var _styles$icon$color;
|
|
5092
|
+
var icon = _ref.icon,
|
|
5093
|
+
title = _ref.title,
|
|
5094
|
+
styles = _ref.styles,
|
|
5095
|
+
description = _ref.description,
|
|
5096
|
+
_ref$variant = _ref.variant,
|
|
5097
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant;
|
|
5098
|
+
return React__default.createElement(components.Horizontal, Object.assign({
|
|
5099
|
+
gap: 15,
|
|
5100
|
+
borderRadius: 10,
|
|
5101
|
+
borderWidth: 1,
|
|
5102
|
+
borderStyle: "solid",
|
|
5103
|
+
padding: 16,
|
|
5104
|
+
wrap: "nowrap",
|
|
5105
|
+
borderColor: Themes[variant].container.border
|
|
5106
|
+
}, styles == null ? void 0 : styles.container), React__default.createElement(components.View, {
|
|
5107
|
+
alignSelf: 'center'
|
|
5108
|
+
}, icon ? icon : React__default.createElement(Svg.WarningSvg, {
|
|
5109
|
+
size: 24,
|
|
5110
|
+
color: (_styles$icon$color = styles == null ? void 0 : styles.icon.color) != null ? _styles$icon$color : Themes[variant].content.color
|
|
5111
|
+
})), React__default.createElement(components.Vertical, {
|
|
5112
|
+
gap: 10
|
|
5113
|
+
}, React__default.createElement(components.Text, Object.assign({
|
|
5114
|
+
fontSize: "16px",
|
|
5115
|
+
color: Themes[variant].content.color
|
|
5116
|
+
}, styles == null ? void 0 : styles.title), title), React__default.createElement(components.Text, Object.assign({
|
|
5117
|
+
fontSize: "14px",
|
|
5118
|
+
color: Themes[variant].content.color
|
|
5119
|
+
}, styles == null ? void 0 : styles.description), description)));
|
|
5120
|
+
};
|
|
5121
|
+
|
|
5122
|
+
var AlertComponent = function AlertComponent(_ref) {
|
|
5123
|
+
var icon = _ref.icon,
|
|
5124
|
+
title = _ref.title,
|
|
5125
|
+
styles = _ref.styles,
|
|
5126
|
+
description = _ref.description,
|
|
5127
|
+
variant = _ref.variant;
|
|
5128
|
+
return React__default.createElement(AlertView, {
|
|
5129
|
+
icon: icon,
|
|
5130
|
+
title: title,
|
|
5131
|
+
styles: styles,
|
|
5132
|
+
description: description,
|
|
5133
|
+
variant: variant
|
|
5134
|
+
});
|
|
5135
|
+
};
|
|
5136
|
+
var Alert = AlertComponent;
|
|
5137
|
+
|
|
5138
|
+
var _excluded$A = ["ratio", "children"];
|
|
5139
|
+
var AspectRatioView = function AspectRatioView(_ref) {
|
|
5140
|
+
var _ref$ratio = _ref.ratio,
|
|
5141
|
+
ratio = _ref$ratio === void 0 ? 16 / 9 : _ref$ratio,
|
|
5142
|
+
children = _ref.children,
|
|
5143
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$A);
|
|
5144
|
+
return React__default.createElement(components.Center, Object.assign({
|
|
5145
|
+
width: '100%',
|
|
5146
|
+
position: "relative",
|
|
5147
|
+
overflow: "hidden",
|
|
5148
|
+
paddingTop: 1 / ratio * 100 + "%",
|
|
5149
|
+
borderRadius: 8
|
|
5150
|
+
}, props), React__default.createElement(components.View, {
|
|
5151
|
+
position: "absolute",
|
|
5152
|
+
top: 0,
|
|
5153
|
+
right: 0,
|
|
5154
|
+
bottom: 0,
|
|
5155
|
+
left: 0
|
|
5156
|
+
}, children));
|
|
5157
|
+
};
|
|
5158
|
+
|
|
5159
|
+
var _excluded$B = ["ratio", "children"];
|
|
5160
|
+
var AspectRatioComponent = function AspectRatioComponent(_ref) {
|
|
5161
|
+
var ratio = _ref.ratio,
|
|
5162
|
+
children = _ref.children,
|
|
5163
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$B);
|
|
5164
|
+
return React__default.createElement(AspectRatioView, Object.assign({
|
|
5165
|
+
ratio: ratio
|
|
5166
|
+
}, props), children);
|
|
5167
|
+
};
|
|
5168
|
+
var AspectRatio = AspectRatioComponent;
|
|
5169
|
+
|
|
5170
|
+
var useAvatarState = function useAvatarState() {
|
|
5171
|
+
var _useState = React.useState(false),
|
|
5172
|
+
imageError = _useState[0],
|
|
5173
|
+
setImageError = _useState[1];
|
|
5174
|
+
return {
|
|
5175
|
+
imageError: imageError,
|
|
5176
|
+
setImageError: setImageError
|
|
5177
|
+
};
|
|
5178
|
+
};
|
|
5179
|
+
|
|
5180
|
+
var AvatarSizeMap = {
|
|
5181
|
+
xs: 24,
|
|
5182
|
+
sm: 32,
|
|
5183
|
+
md: 48,
|
|
5184
|
+
lg: 64,
|
|
5185
|
+
xl: 80
|
|
5186
|
+
};
|
|
5187
|
+
|
|
5188
|
+
var AvatarView = function AvatarView(_ref) {
|
|
5189
|
+
var src = _ref.src,
|
|
5190
|
+
_ref$size = _ref.size,
|
|
5191
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
5192
|
+
_ref$fallback = _ref.fallback,
|
|
5193
|
+
fallback = _ref$fallback === void 0 ? 'IM' : _ref$fallback,
|
|
5194
|
+
styles = _ref.styles,
|
|
5195
|
+
imageError = _ref.imageError,
|
|
5196
|
+
setImageError = _ref.setImageError;
|
|
5197
|
+
var avatarSize = AvatarSizeMap[size];
|
|
5198
|
+
var imageStyle = _extends({
|
|
5199
|
+
objectFit: 'cover'
|
|
5200
|
+
}, (styles == null ? void 0 : styles.image) || {});
|
|
5201
|
+
return React__default.createElement(components.Center, Object.assign({
|
|
5202
|
+
role: "avatar",
|
|
5203
|
+
width: avatarSize,
|
|
5204
|
+
height: avatarSize,
|
|
5205
|
+
borderRadius: "50%",
|
|
5206
|
+
overflow: "hidden",
|
|
5207
|
+
borderWidth: "1px",
|
|
5208
|
+
borderStyle: "solid",
|
|
5209
|
+
borderColor: imageError ? 'black' : 'transparent',
|
|
5210
|
+
boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.25)" // Add shadow effect
|
|
5211
|
+
}, styles == null ? void 0 : styles.container), !imageError ? React__default.createElement(appStudio.Image, {
|
|
5212
|
+
alt: "IM",
|
|
5213
|
+
src: src,
|
|
5214
|
+
style: imageStyle,
|
|
5215
|
+
width: avatarSize,
|
|
5216
|
+
height: avatarSize,
|
|
5217
|
+
onError: function onError() {
|
|
5218
|
+
return setImageError(true);
|
|
5219
|
+
}
|
|
5220
|
+
}) : React__default.createElement(components.Text, Object.assign({
|
|
5221
|
+
size: size
|
|
5222
|
+
}, styles == null ? void 0 : styles.fallback), fallback));
|
|
5223
|
+
};
|
|
5224
|
+
|
|
5225
|
+
var AvatarComponent = function AvatarComponent(_ref) {
|
|
5226
|
+
var src = _ref.src,
|
|
5227
|
+
size = _ref.size,
|
|
5228
|
+
styles = _ref.styles,
|
|
5229
|
+
fallback = _ref.fallback;
|
|
5230
|
+
var _useAvatarState = useAvatarState(),
|
|
5231
|
+
imageError = _useAvatarState.imageError,
|
|
5232
|
+
setImageError = _useAvatarState.setImageError;
|
|
5233
|
+
return React__default.createElement(AvatarView, {
|
|
5234
|
+
src: src,
|
|
5235
|
+
size: size,
|
|
5236
|
+
styles: styles,
|
|
5237
|
+
fallback: fallback,
|
|
5238
|
+
imageError: imageError,
|
|
5239
|
+
setImageError: setImageError
|
|
5240
|
+
});
|
|
5241
|
+
};
|
|
5242
|
+
var Avatar = AvatarComponent;
|
|
5243
|
+
|
|
5244
|
+
var BadgeSizes = {
|
|
5245
|
+
xs: {
|
|
5246
|
+
minWidth: '20px',
|
|
5247
|
+
height: '20px',
|
|
5248
|
+
padding: '0 6px'
|
|
5249
|
+
},
|
|
5250
|
+
sm: {
|
|
5251
|
+
minWidth: '24px',
|
|
5252
|
+
height: '24px',
|
|
5253
|
+
padding: '0 8px'
|
|
5254
|
+
},
|
|
5255
|
+
md: {
|
|
5256
|
+
minWidth: '28px',
|
|
5257
|
+
height: '28px',
|
|
5258
|
+
padding: '0 10px'
|
|
5259
|
+
},
|
|
5260
|
+
lg: {
|
|
5261
|
+
minWidth: '32px',
|
|
5262
|
+
height: '32px',
|
|
5263
|
+
padding: '0 12px'
|
|
5264
|
+
},
|
|
5265
|
+
xl: {
|
|
5266
|
+
minWidth: '36px',
|
|
5267
|
+
height: '36px',
|
|
5268
|
+
padding: '0 14px'
|
|
5269
|
+
}
|
|
5270
|
+
};
|
|
5271
|
+
var BadgeShapes = {
|
|
5272
|
+
sharp: 0,
|
|
5273
|
+
rounded: 4,
|
|
5274
|
+
pillShaped: 24
|
|
5275
|
+
};
|
|
5276
|
+
// Example of how you might adjust styles based on the 'position' prop
|
|
5277
|
+
var PositionStyles = {
|
|
5278
|
+
'top-right': {
|
|
5279
|
+
top: 0,
|
|
5280
|
+
right: 0,
|
|
5281
|
+
position: 'absolute'
|
|
5282
|
+
},
|
|
5283
|
+
'top-left': {
|
|
5284
|
+
top: 0,
|
|
5285
|
+
left: 0,
|
|
5286
|
+
position: 'absolute'
|
|
5287
|
+
},
|
|
5288
|
+
'bottom-right': {
|
|
5289
|
+
bottom: 0,
|
|
5290
|
+
right: 0,
|
|
5291
|
+
position: 'absolute'
|
|
5292
|
+
},
|
|
5293
|
+
'bottom-left': {
|
|
5294
|
+
bottom: 0,
|
|
5295
|
+
left: 0,
|
|
5296
|
+
position: 'absolute'
|
|
5297
|
+
}
|
|
5298
|
+
};
|
|
5299
|
+
|
|
5300
|
+
var BadgeView = function BadgeView(_ref) {
|
|
5301
|
+
var content = _ref.content,
|
|
5302
|
+
position = _ref.position,
|
|
5303
|
+
_ref$shape = _ref.shape,
|
|
5304
|
+
shape = _ref$shape === void 0 ? 'pillShaped' : _ref$shape,
|
|
5305
|
+
_ref$colorScheme = _ref.colorScheme,
|
|
5306
|
+
colorScheme = _ref$colorScheme === void 0 ? 'theme.primary' : _ref$colorScheme,
|
|
5307
|
+
_ref$variant = _ref.variant,
|
|
5308
|
+
variant = _ref$variant === void 0 ? 'filled' : _ref$variant,
|
|
5309
|
+
_ref$size = _ref.size,
|
|
5310
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
5311
|
+
styles = _ref.styles;
|
|
5312
|
+
var BadgeVariants = {
|
|
5313
|
+
filled: {
|
|
5314
|
+
backgroundColor: colorScheme,
|
|
5315
|
+
color: 'color.white',
|
|
5316
|
+
borderWidth: 1,
|
|
5317
|
+
borderStyle: 'solid',
|
|
5318
|
+
borderColor: 'transparent'
|
|
5319
|
+
},
|
|
5320
|
+
outline: {
|
|
5321
|
+
backgroundColor: 'transparent',
|
|
5322
|
+
borderWidth: 1,
|
|
5323
|
+
borderStyle: 'solid',
|
|
5324
|
+
borderColor: colorScheme,
|
|
5325
|
+
color: colorScheme
|
|
5326
|
+
},
|
|
5327
|
+
link: {
|
|
5328
|
+
backgroundColor: 'transparent',
|
|
5329
|
+
borderWidth: 1,
|
|
5330
|
+
borderStyle: 'solid',
|
|
5331
|
+
borderColor: 'transparent',
|
|
5332
|
+
color: colorScheme,
|
|
5333
|
+
textDecoration: 'underline'
|
|
5334
|
+
},
|
|
5335
|
+
ghost: {
|
|
5336
|
+
backgroundColor: 'transparent',
|
|
5337
|
+
color: colorScheme,
|
|
5338
|
+
borderWidth: 1,
|
|
5339
|
+
borderStyle: 'solid',
|
|
5340
|
+
borderColor: 'transparent'
|
|
5341
|
+
}
|
|
5342
|
+
};
|
|
5343
|
+
var combinedStyles = _extends({
|
|
5344
|
+
width: 'fit-content',
|
|
5345
|
+
borderRadius: BadgeShapes[shape]
|
|
5346
|
+
}, BadgeSizes[size], BadgeVariants[variant], position ? PositionStyles[position] : {}, styles == null ? void 0 : styles.container);
|
|
5347
|
+
return React__default.createElement(components.Center, Object.assign({
|
|
5348
|
+
role: "badge"
|
|
5349
|
+
}, combinedStyles), React__default.createElement(components.Text, Object.assign({
|
|
5350
|
+
role: "badgeText",
|
|
5351
|
+
size: size
|
|
5352
|
+
}, styles == null ? void 0 : styles.text), content));
|
|
5353
|
+
};
|
|
5354
|
+
|
|
5355
|
+
var Badge = function Badge(_ref) {
|
|
5356
|
+
var content = _ref.content,
|
|
5357
|
+
shape = _ref.shape,
|
|
5358
|
+
colorScheme = _ref.colorScheme,
|
|
5359
|
+
position = _ref.position,
|
|
5360
|
+
variant = _ref.variant,
|
|
5361
|
+
size = _ref.size,
|
|
5362
|
+
styles = _ref.styles;
|
|
5363
|
+
return React__default.createElement(BadgeView, {
|
|
5364
|
+
content: content,
|
|
5365
|
+
shape: shape,
|
|
5366
|
+
colorScheme: colorScheme,
|
|
5367
|
+
position: position,
|
|
5368
|
+
variant: variant,
|
|
5369
|
+
size: size,
|
|
5370
|
+
styles: styles
|
|
5371
|
+
});
|
|
5372
|
+
};
|
|
5373
|
+
|
|
5374
|
+
var useToggleState = function useToggleState(defaultToggled) {
|
|
5375
|
+
var _useState = React.useState(false),
|
|
5376
|
+
isHovered = _useState[0],
|
|
5377
|
+
setIsHovered = _useState[1];
|
|
5378
|
+
var _useState2 = React.useState(defaultToggled),
|
|
5379
|
+
isToggle = _useState2[0],
|
|
5380
|
+
setIsToggled = _useState2[1];
|
|
5381
|
+
return {
|
|
5382
|
+
isHovered: isHovered,
|
|
5383
|
+
setIsHovered: setIsHovered,
|
|
5384
|
+
isToggle: isToggle,
|
|
5385
|
+
setIsToggled: setIsToggled
|
|
5386
|
+
};
|
|
5387
|
+
};
|
|
5388
|
+
|
|
5389
|
+
var ToggleShapes = {
|
|
5390
|
+
sharp: 0,
|
|
5391
|
+
rounded: 4,
|
|
5392
|
+
pillShaped: 24
|
|
5393
|
+
};
|
|
5394
|
+
|
|
5395
|
+
var _excluded$C = ["children", "shape", "colorScheme", "variant", "isHovered", "setIsHovered", "isDisabled", "isToggle", "setIsToggled", "onToggle"];
|
|
5396
|
+
var ToggleView = function ToggleView(_ref) {
|
|
5397
|
+
var children = _ref.children,
|
|
5398
|
+
_ref$shape = _ref.shape,
|
|
5399
|
+
shape = _ref$shape === void 0 ? 'rounded' : _ref$shape,
|
|
5400
|
+
_ref$colorScheme = _ref.colorScheme,
|
|
5401
|
+
colorScheme = _ref$colorScheme === void 0 ? 'color.trueGray.400' : _ref$colorScheme,
|
|
5402
|
+
_ref$variant = _ref.variant,
|
|
5403
|
+
variant = _ref$variant === void 0 ? 'ghost' : _ref$variant,
|
|
5404
|
+
isHovered = _ref.isHovered,
|
|
5405
|
+
setIsHovered = _ref.setIsHovered,
|
|
5406
|
+
isDisabled = _ref.isDisabled,
|
|
5407
|
+
isToggle = _ref.isToggle,
|
|
5408
|
+
setIsToggled = _ref.setIsToggled,
|
|
5409
|
+
onToggle = _ref.onToggle,
|
|
5410
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$C);
|
|
5411
|
+
var toggleColor = !isDisabled ? colorScheme : 'theme.disabled';
|
|
5412
|
+
var isActive = !!(isToggle || isHovered);
|
|
5413
|
+
var ToggleVariants = {
|
|
5414
|
+
outline: {
|
|
5415
|
+
borderWidth: 1,
|
|
5416
|
+
borderStyle: 'solid',
|
|
5417
|
+
borderColor: colorScheme
|
|
5418
|
+
},
|
|
5419
|
+
link: {
|
|
5420
|
+
borderWidth: 1,
|
|
5421
|
+
borderStyle: 'solid',
|
|
5422
|
+
borderColor: isActive ? toggleColor : 'transparent',
|
|
5423
|
+
textDecoration: 'underline'
|
|
5424
|
+
},
|
|
5425
|
+
ghost: {}
|
|
5426
|
+
};
|
|
5427
|
+
var handleToggle = function handleToggle() {
|
|
5428
|
+
if (!isDisabled) {
|
|
5429
|
+
setIsToggled(function (prev) {
|
|
5430
|
+
var newState = !prev;
|
|
5431
|
+
if (onToggle) {
|
|
5432
|
+
// Check if onToggle is defined before calling it
|
|
5433
|
+
onToggle(newState);
|
|
5434
|
+
}
|
|
5435
|
+
return newState; // Expecting the onToggle to possibly do something with the newState
|
|
5436
|
+
});
|
|
5437
|
+
}
|
|
5438
|
+
};
|
|
5439
|
+
|
|
5440
|
+
return React__default.createElement(components.Center, Object.assign({
|
|
5441
|
+
role: "Toggle",
|
|
5442
|
+
padding: shape === 'pillShaped' ? '10px 12px' : '8px',
|
|
5443
|
+
width: "fit-content",
|
|
5444
|
+
color: isActive ? 'color.white' : toggleColor,
|
|
5445
|
+
backgroundColor: isActive ? toggleColor : 'transparent',
|
|
5446
|
+
onMouseEnter: function onMouseEnter() {
|
|
5447
|
+
return setIsHovered(true);
|
|
5448
|
+
},
|
|
5449
|
+
onMouseLeave: function onMouseLeave() {
|
|
5450
|
+
return setIsHovered(false);
|
|
5451
|
+
},
|
|
5452
|
+
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
5453
|
+
borderRadius: ToggleShapes[shape],
|
|
5454
|
+
onClick: handleToggle
|
|
5455
|
+
}, ToggleVariants[variant], props), children);
|
|
5456
|
+
};
|
|
5457
|
+
|
|
5458
|
+
var _excluded$D = ["children", "shape", "colorScheme", "variant", "isDisabled", "isToggled", "onToggle"];
|
|
5459
|
+
var ToggleComponent = function ToggleComponent(_ref) {
|
|
5460
|
+
var children = _ref.children,
|
|
5461
|
+
shape = _ref.shape,
|
|
5462
|
+
colorScheme = _ref.colorScheme,
|
|
5463
|
+
variant = _ref.variant,
|
|
5464
|
+
isDisabled = _ref.isDisabled,
|
|
5465
|
+
_ref$isToggled = _ref.isToggled,
|
|
5466
|
+
isToggled = _ref$isToggled === void 0 ? false : _ref$isToggled,
|
|
5467
|
+
onToggle = _ref.onToggle,
|
|
5468
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$D);
|
|
5469
|
+
var _useToggleState = useToggleState(isToggled),
|
|
5470
|
+
isHovered = _useToggleState.isHovered,
|
|
5471
|
+
setIsHovered = _useToggleState.setIsHovered,
|
|
5472
|
+
isToggle = _useToggleState.isToggle,
|
|
5473
|
+
setIsToggled = _useToggleState.setIsToggled;
|
|
5474
|
+
React.useEffect(function () {
|
|
5475
|
+
setIsToggled(isToggled);
|
|
5476
|
+
}, [isToggled]);
|
|
5477
|
+
return React__default.createElement(ToggleView, Object.assign({
|
|
5478
|
+
shape: shape,
|
|
5479
|
+
colorScheme: colorScheme,
|
|
5480
|
+
variant: variant,
|
|
5481
|
+
isDisabled: isDisabled,
|
|
5482
|
+
isHovered: isHovered,
|
|
5483
|
+
setIsHovered: setIsHovered,
|
|
5484
|
+
isToggle: isToggle,
|
|
5485
|
+
setIsToggled: setIsToggled,
|
|
5486
|
+
onToggle: onToggle
|
|
5487
|
+
}, props), children);
|
|
5488
|
+
};
|
|
5489
|
+
var Toggle = ToggleComponent;
|
|
5490
|
+
|
|
5491
|
+
var useToggleGroupState = function useToggleGroupState() {
|
|
5492
|
+
var _useState = React.useState([]),
|
|
5493
|
+
activeToggles = _useState[0],
|
|
5494
|
+
setActiveToggles = _useState[1];
|
|
5495
|
+
return {
|
|
5496
|
+
activeToggles: activeToggles,
|
|
5497
|
+
setActiveToggles: setActiveToggles
|
|
5498
|
+
};
|
|
5499
|
+
};
|
|
5500
|
+
|
|
5501
|
+
var ToggleGroupView = function ToggleGroupView(_ref) {
|
|
5502
|
+
var items = _ref.items,
|
|
5503
|
+
onToggleChange = _ref.onToggleChange,
|
|
5504
|
+
activeToggles = _ref.activeToggles,
|
|
5505
|
+
setActiveToggles = _ref.setActiveToggles,
|
|
5506
|
+
_ref$shape = _ref.shape,
|
|
5507
|
+
shape = _ref$shape === void 0 ? 'rounded' : _ref$shape,
|
|
5508
|
+
_ref$variant = _ref.variant,
|
|
5509
|
+
variant = _ref$variant === void 0 ? 'ghost' : _ref$variant,
|
|
5510
|
+
_ref$colorScheme = _ref.colorScheme,
|
|
5511
|
+
colorScheme = _ref$colorScheme === void 0 ? 'color.trueGray.400' : _ref$colorScheme;
|
|
5512
|
+
var handleToggle = React.useCallback(function (id, isActive) {
|
|
5513
|
+
setActiveToggles(function (prevActiveToggles) {
|
|
5514
|
+
var newActiveToggles;
|
|
5515
|
+
if (isActive) {
|
|
5516
|
+
// Add the ID only if it's not already included
|
|
5517
|
+
newActiveToggles = prevActiveToggles.includes(id) ? prevActiveToggles : [].concat(prevActiveToggles, [id]);
|
|
5518
|
+
} else {
|
|
5519
|
+
// Remove the ID if it's included
|
|
5520
|
+
newActiveToggles = prevActiveToggles.filter(function (toggleId) {
|
|
5521
|
+
return toggleId !== id;
|
|
5522
|
+
});
|
|
5523
|
+
}
|
|
5524
|
+
onToggleChange == null || onToggleChange(newActiveToggles);
|
|
5525
|
+
return newActiveToggles;
|
|
5526
|
+
});
|
|
5527
|
+
}, [onToggleChange, setActiveToggles]);
|
|
5528
|
+
return React__default.createElement(components.Horizontal, {
|
|
5529
|
+
role: "ToggleGroup",
|
|
5530
|
+
display: "flex",
|
|
5531
|
+
gap: 5
|
|
5532
|
+
}, items.map(function (item) {
|
|
5533
|
+
return React__default.createElement(components.Toggle, {
|
|
5534
|
+
role: "toggle-" + item.id,
|
|
5535
|
+
key: item.id,
|
|
5536
|
+
colorScheme: colorScheme,
|
|
5537
|
+
shape: shape,
|
|
5538
|
+
variant: variant,
|
|
5539
|
+
isToggled: activeToggles.includes(item.id) || item.isActive,
|
|
5540
|
+
onToggle: function onToggle(state) {
|
|
5541
|
+
return handleToggle(item.id, state);
|
|
5542
|
+
},
|
|
5543
|
+
isDisabled: item.isDisabled,
|
|
5544
|
+
isIntern: true
|
|
5545
|
+
}, item.value);
|
|
5546
|
+
}));
|
|
5547
|
+
};
|
|
5548
|
+
|
|
5549
|
+
var ToggleGroupComponent = function ToggleGroupComponent(_ref) {
|
|
5550
|
+
var items = _ref.items,
|
|
5551
|
+
shape = _ref.shape,
|
|
5552
|
+
colorScheme = _ref.colorScheme,
|
|
5553
|
+
variant = _ref.variant,
|
|
5554
|
+
onToggleChange = _ref.onToggleChange;
|
|
5555
|
+
var _useToggleGroupState = useToggleGroupState(),
|
|
5556
|
+
activeToggles = _useToggleGroupState.activeToggles,
|
|
5557
|
+
setActiveToggles = _useToggleGroupState.setActiveToggles;
|
|
5558
|
+
return React__default.createElement(ToggleGroupView, {
|
|
5559
|
+
items: items,
|
|
5560
|
+
shape: shape,
|
|
5561
|
+
colorScheme: colorScheme,
|
|
5562
|
+
variant: variant,
|
|
5563
|
+
activeToggles: activeToggles,
|
|
5564
|
+
setActiveToggles: setActiveToggles,
|
|
5565
|
+
onToggleChange: onToggleChange
|
|
5566
|
+
});
|
|
5567
|
+
};
|
|
5568
|
+
var ToggleGroup = ToggleGroupComponent;
|
|
5569
|
+
|
|
5570
|
+
exports.Alert = Alert;
|
|
5571
|
+
exports.AspectRatio = AspectRatio;
|
|
5572
|
+
exports.Avatar = Avatar;
|
|
5573
|
+
exports.Badge = Badge;
|
|
4939
5574
|
exports.Bottom = Bottom;
|
|
4940
5575
|
exports.Button = Button;
|
|
4941
5576
|
exports.Center = Center;
|
|
@@ -4963,9 +5598,12 @@ exports.Password = Password;
|
|
|
4963
5598
|
exports.Right = Right;
|
|
4964
5599
|
exports.Select = Select;
|
|
4965
5600
|
exports.Switch = Switch;
|
|
5601
|
+
exports.Tabs = Tabs;
|
|
4966
5602
|
exports.Text = Text;
|
|
4967
5603
|
exports.TextArea = TextArea;
|
|
4968
5604
|
exports.TextField = TextField;
|
|
5605
|
+
exports.Toggle = Toggle;
|
|
5606
|
+
exports.ToggleGroup = ToggleGroup;
|
|
4969
5607
|
exports.Top = Top;
|
|
4970
5608
|
exports.Vertical = Vertical;
|
|
4971
5609
|
exports.View = View;
|