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