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