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