@xapp/chat-widget 1.77.0 → 1.78.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +0 -0
- package/dist/components/ButtonGroup/index.d.ts +0 -0
- package/dist/components/ChatButton/ChatButton.stories.d.ts +13 -1
- package/dist/components/ChatHeader/ChatHeader.stories.d.ts +5 -0
- package/dist/components/ChatMenu/ChatMenu.d.ts +0 -0
- package/dist/components/ChatWidget/ChatWidget.stories.d.ts +2 -0
- package/dist/components/CtaBubble/CtaBubble.d.ts +0 -0
- package/dist/components/CtaBubble/CtaBubble.stories.d.ts +2 -0
- package/dist/components/CtaBubble/CtaBubbleContainer.d.ts +0 -0
- package/dist/components/MenuButton/MenuButton.d.ts +0 -0
- package/dist/components/MenuButton/index.d.ts +0 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -0
- package/dist/index.es.js +137 -53
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +137 -53
- package/dist/index.js.map +1 -1
- package/dist/utils/deepMerge.d.ts +0 -0
- package/dist/utils/deepMerge.test.d.ts +1 -0
- package/dist/xapp-chat-widget.css +1 -1
- package/dist/xapp-chat-widget.js +3 -3
- package/dist/xapp-chat-widget.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -680,6 +680,12 @@ var CtaBubble = function (props) {
|
|
|
680
680
|
var _e = useDimensions(), ref = _e[0], rect = _e[1];
|
|
681
681
|
var animate = props.animate || false;
|
|
682
682
|
var animation = animate && props.buttonAnimation === "bounce" ? "bounce" : "none";
|
|
683
|
+
var handleDismiss = function (e) {
|
|
684
|
+
e.stopPropagation();
|
|
685
|
+
if (props.onDismiss) {
|
|
686
|
+
props.onDismiss();
|
|
687
|
+
}
|
|
688
|
+
};
|
|
683
689
|
return (React$1.createElement("div", { ref: ref, style: {
|
|
684
690
|
border: props.borderStyle ? 'solid' : 'none',
|
|
685
691
|
borderWidth: ((_a = props.borderStyle) === null || _a === void 0 ? void 0 : _a.width) || '0px',
|
|
@@ -687,11 +693,14 @@ var CtaBubble = function (props) {
|
|
|
687
693
|
animation: "".concat(animation, " 1s infinite"),
|
|
688
694
|
}, className: "cta-bubble", onClick: props.onClick },
|
|
689
695
|
React$1.createElement(CtaBubbleTail, { width: (_c = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _c !== void 0 ? _c : 0, height: (_d = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _d !== void 0 ? _d : 0, direction: 60, angle: 45, length: 16 }),
|
|
690
|
-
React$1.createElement("div", { className: "cta-bubble__content" }, props.children)
|
|
696
|
+
React$1.createElement("div", { className: "cta-bubble__content" }, props.children),
|
|
697
|
+
props.dismissible && (React$1.createElement("button", { className: "cta-bubble__dismiss", onClick: handleDismiss, "aria-label": "Dismiss" },
|
|
698
|
+
React$1.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
699
|
+
React$1.createElement("path", { d: "M11 1L1 11M1 1L11 11", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }))))));
|
|
691
700
|
};
|
|
692
701
|
|
|
693
702
|
var CtaBubbleContainer = function (props) {
|
|
694
|
-
var visible = props.visible, timeout = props.timeout, delay = props.delay, animate = props.animate, buttonAnimation = props.buttonAnimation, onClick = props.onClick, children = props.children;
|
|
703
|
+
var visible = props.visible, timeout = props.timeout, delay = props.delay, animate = props.animate, buttonAnimation = props.buttonAnimation, dismissible = props.dismissible, onClick = props.onClick, onDismiss = props.onDismiss, children = props.children;
|
|
695
704
|
var startTime = React$1.useMemo(function () {
|
|
696
705
|
return visible ? new Date().valueOf() : undefined;
|
|
697
706
|
}, [visible]);
|
|
@@ -728,7 +737,13 @@ var CtaBubbleContainer = function (props) {
|
|
|
728
737
|
isMounted.current = false;
|
|
729
738
|
};
|
|
730
739
|
}, [startTime, timeout, delay]);
|
|
731
|
-
|
|
740
|
+
var handleDismiss = function () {
|
|
741
|
+
setShowBubble(false);
|
|
742
|
+
if (onDismiss) {
|
|
743
|
+
onDismiss();
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
return (React$1.createElement(React$1.Fragment, null, visible && showBubble && (React$1.createElement(CtaBubble, { onClick: onClick, animate: animate, buttonAnimation: buttonAnimation, dismissible: dismissible, onDismiss: handleDismiss }, children))));
|
|
732
747
|
};
|
|
733
748
|
|
|
734
749
|
var ChatButton = function (_a) {
|
|
@@ -749,9 +764,12 @@ var ChatButton = function (_a) {
|
|
|
749
764
|
};
|
|
750
765
|
var configToApply = getConfigToApply();
|
|
751
766
|
React$1.useEffect(function () {
|
|
767
|
+
var _a;
|
|
752
768
|
var delayTimer;
|
|
753
769
|
var timeoutTimer;
|
|
754
|
-
|
|
770
|
+
// Use animationDelay if provided, otherwise fall back to delay for backwards compatibility
|
|
771
|
+
var animationDelayToUse = (_a = configToApply === null || configToApply === void 0 ? void 0 : configToApply.animationDelay) !== null && _a !== void 0 ? _a : configToApply === null || configToApply === void 0 ? void 0 : configToApply.delay;
|
|
772
|
+
if (animationDelayToUse) {
|
|
755
773
|
// Set a delay for the animation to start
|
|
756
774
|
delayTimer = setTimeout(function () {
|
|
757
775
|
setAnimate(true);
|
|
@@ -761,7 +779,7 @@ var ChatButton = function (_a) {
|
|
|
761
779
|
setAnimate(false);
|
|
762
780
|
}, configToApply.animationTimeout);
|
|
763
781
|
}
|
|
764
|
-
},
|
|
782
|
+
}, animationDelayToUse);
|
|
765
783
|
}
|
|
766
784
|
else if (configToApply === null || configToApply === void 0 ? void 0 : configToApply.animationTimeout) {
|
|
767
785
|
// Start animation immediately and set a timeout to stop it
|
|
@@ -782,18 +800,19 @@ var ChatButton = function (_a) {
|
|
|
782
800
|
clearTimeout(timeoutTimer);
|
|
783
801
|
};
|
|
784
802
|
}, [configToApply, setAnimate]);
|
|
785
|
-
var animation = animate ? (
|
|
803
|
+
var animation = animate ? (configToApply === null || configToApply === void 0 ? void 0 : configToApply.animation) || "wiggle" : "none";
|
|
786
804
|
React$1.useEffect(function () {
|
|
787
805
|
var handleResize = function () {
|
|
788
806
|
var screenWidth = window.innerWidth;
|
|
789
|
-
var newButtonWidth = screenWidth <
|
|
790
|
-
? defaultMobileWidgetButtonWidth
|
|
807
|
+
var newButtonWidth = screenWidth < parseInt(mobileWidth, 10)
|
|
808
|
+
? defaultMobileWidgetButtonWidth
|
|
809
|
+
: defaultWidgetButtonWidth;
|
|
791
810
|
setButtonWidth(newButtonWidth);
|
|
792
811
|
};
|
|
793
812
|
handleResize();
|
|
794
|
-
window.addEventListener(
|
|
813
|
+
window.addEventListener("resize", handleResize);
|
|
795
814
|
return function () {
|
|
796
|
-
window.removeEventListener(
|
|
815
|
+
window.removeEventListener("resize", handleResize);
|
|
797
816
|
};
|
|
798
817
|
}, [mobileWidth]);
|
|
799
818
|
var maxSvgSize = 22;
|
|
@@ -803,18 +822,18 @@ var ChatButton = function (_a) {
|
|
|
803
822
|
width: "".concat(buttonWidth, "px"),
|
|
804
823
|
height: "".concat(buttonWidth, "px"),
|
|
805
824
|
borderRadius: "".concat(+buttonWidth / 2, "px"),
|
|
806
|
-
border: borderStyle && borderStyle.width ?
|
|
807
|
-
borderWidth: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.width) ||
|
|
808
|
-
borderColor: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.color) ||
|
|
825
|
+
border: borderStyle && borderStyle.width ? "solid" : "none",
|
|
826
|
+
borderWidth: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.width) || "0px",
|
|
827
|
+
borderColor: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.color) || "transparent",
|
|
809
828
|
animation: "".concat(animation, " 1s infinite"),
|
|
810
829
|
} }, imageUrl ? (
|
|
811
830
|
// Display image from URL
|
|
812
|
-
React$1.createElement("img", { src: imageUrl, alt: "Chat Icon"
|
|
831
|
+
React$1.createElement("img", { src: imageUrl, alt: "Chat Icon" })) : (
|
|
813
832
|
// Fallback to default SVG
|
|
814
833
|
React$1.createElement("svg", { width: svgSize, height: svgSize, viewBox: "0 0 22 22" },
|
|
815
834
|
React$1.createElement("path", { d: "M13 22l-4-6H2c-1.11-.043-2-.935-2-2V2C0 .89.89 0 2 0h18c1.11 0 2 .892 2 2v12c0 1.067-.89 1.957-2 2h-3l-4 6zm3-8h4c-.005.3-.01-12 0-12-.01.004-18 .006-18 0 .005.006 0 12 0 12h8l3 5 3-5z", fill: "#FFF", fillRule: "evenodd" })))),
|
|
816
835
|
configToApply && configToApply.message && (React$1.createElement("div", { className: "xapp-chat-button__cta" },
|
|
817
|
-
React$1.createElement(CtaBubbleContainer, { timeout: configToApply === null || configToApply === void 0 ? void 0 : configToApply.timeout, delay: configToApply === null || configToApply === void 0 ? void 0 : configToApply.delay, animate: animate, buttonAnimation: animation, visible: !visible /** Why is this !visible */ }, configToApply === null || configToApply === void 0 ? void 0 : configToApply.message)))));
|
|
836
|
+
React$1.createElement(CtaBubbleContainer, { timeout: configToApply === null || configToApply === void 0 ? void 0 : configToApply.timeout, delay: configToApply === null || configToApply === void 0 ? void 0 : configToApply.delay, animate: animate, buttonAnimation: animation, dismissible: configToApply === null || configToApply === void 0 ? void 0 : configToApply.dismissible, visible: !visible /** Why is this !visible */ }, configToApply === null || configToApply === void 0 ? void 0 : configToApply.message)))));
|
|
818
837
|
};
|
|
819
838
|
|
|
820
839
|
var ChatCard = function (props) {
|
|
@@ -7704,6 +7723,11 @@ var ChatChipsContainer = function (_) {
|
|
|
7704
7723
|
React$1.createElement(ChatChips, { options: chips, onOptionClick: optionOnChange })));
|
|
7705
7724
|
};
|
|
7706
7725
|
|
|
7726
|
+
var ButtonGroup = function (_a) {
|
|
7727
|
+
var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
7728
|
+
return (React$1.createElement("div", { className: "button-group ".concat(className) }, children));
|
|
7729
|
+
};
|
|
7730
|
+
|
|
7707
7731
|
var CancelButton = function (props) {
|
|
7708
7732
|
return (React$1.createElement("div", { id: "xapp-widget-close", "aria-label": "close widget", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "cancel-button", onClick: props.onClick }));
|
|
7709
7733
|
};
|
|
@@ -7843,6 +7867,10 @@ var DrawerBars = function (props) {
|
|
|
7843
7867
|
return (React$1.createElement("button", { className: "drawer-bars", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, "aria-label": "open menu", "aria-hidden": false, onClick: props.onToggle }, getBars()));
|
|
7844
7868
|
};
|
|
7845
7869
|
|
|
7870
|
+
var MenuButton = function (props) {
|
|
7871
|
+
return (React$1.createElement("div", { id: "xapp-widget-menu", "aria-label": "open menu", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "menu-button", onClick: props.onClick }));
|
|
7872
|
+
};
|
|
7873
|
+
|
|
7846
7874
|
var MinimizeButton = function (props) {
|
|
7847
7875
|
return (React$1.createElement("div", { id: "xapp-widget-minimize", "aria-label": "minimize widget", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "minimize-button ".concat(props.showInRight ? "positionRight" : ""), onClick: props.onClick }));
|
|
7848
7876
|
};
|
|
@@ -7879,16 +7907,19 @@ var ChatHeader = function (props) {
|
|
|
7879
7907
|
var menuConfig = props.menuConfig, onSubmit = props.onSubmit;
|
|
7880
7908
|
var _s = React$1.useState(false), drawerOpen = _s[0], setDrawerState = _s[1]; // false initially
|
|
7881
7909
|
var menuPosition = (menuConfig === null || menuConfig === void 0 ? void 0 : menuConfig.menuButtonLocation) || "FOOTER";
|
|
7882
|
-
var
|
|
7883
|
-
var
|
|
7884
|
-
var
|
|
7885
|
-
var
|
|
7886
|
-
var
|
|
7910
|
+
var showMenuLeft = menuPosition === "HEADER_LEFT";
|
|
7911
|
+
var showMenuRight = menuPosition === "HEADER_RIGHT";
|
|
7912
|
+
var menuItemsRaw = menuConfig === null || menuConfig === void 0 ? void 0 : menuConfig.items;
|
|
7913
|
+
var menuItemsTabIndex = menuConfig === null || menuConfig === void 0 ? void 0 : menuConfig.itemsTabIndex;
|
|
7914
|
+
var menuButtonTabIndex = (_a = menuConfig === null || menuConfig === void 0 ? void 0 : menuConfig.button) === null || _a === void 0 ? void 0 : _a.tabIndex;
|
|
7915
|
+
var menuItems = React$1.useMemo(function () { return (menuItemsRaw ? menuItemsRaw : []); }, [menuItemsRaw]);
|
|
7916
|
+
// Check if we have a right-side menu
|
|
7917
|
+
var hasRightMenu = showMenuRight && menuItems.length > 0;
|
|
7887
7918
|
function toggleDrawer() {
|
|
7888
7919
|
var newDrawer = !drawerOpen;
|
|
7889
7920
|
setDrawerState(newDrawer);
|
|
7890
7921
|
innerDispatch(setVisualStatus({
|
|
7891
|
-
drawer: newDrawer
|
|
7922
|
+
drawer: newDrawer,
|
|
7892
7923
|
}));
|
|
7893
7924
|
}
|
|
7894
7925
|
function handleMenuItem(label) {
|
|
@@ -7908,20 +7939,27 @@ var ChatHeader = function (props) {
|
|
|
7908
7939
|
}
|
|
7909
7940
|
return (React$1.createElement(React$1.Fragment, null,
|
|
7910
7941
|
React$1.createElement("div", { className: "status-container background-header", "aria-label": ariaLabel, "aria-hidden": false },
|
|
7911
|
-
|
|
7942
|
+
showMenuLeft && menuItems.length ? (React$1.createElement(React$1.Fragment, null,
|
|
7912
7943
|
React$1.createElement("div", { className: "chat-footer__menu-icon" },
|
|
7913
|
-
React$1.createElement(DrawerBars, { bars: 3, tabIndex: menuButtonTabIndex, onToggle: toggleDrawer })))) : React$1.createElement(React$1.Fragment, null),
|
|
7914
|
-
((_b = props === null || props === void 0 ? void 0 : props.agent) === null || _b === void 0 ? void 0 : _b.avatarPath) === undefined ? React$1.createElement("div", null) :
|
|
7915
|
-
React$1.createElement(
|
|
7916
|
-
|
|
7917
|
-
|
|
7944
|
+
React$1.createElement(DrawerBars, { bars: 3, tabIndex: menuButtonTabIndex, onToggle: toggleDrawer })))) : (React$1.createElement(React$1.Fragment, null)),
|
|
7945
|
+
((_b = props === null || props === void 0 ? void 0 : props.agent) === null || _b === void 0 ? void 0 : _b.avatarPath) === undefined ? (React$1.createElement("div", null)) : (React$1.createElement("div", { className: "status-container__avatar" },
|
|
7946
|
+
React$1.createElement(Avatar, { entity: props.agent }))),
|
|
7947
|
+
React$1.createElement("div", { className: "\n ".concat("status-text", "\n ").concat(showMenuLeft && menuItems.length
|
|
7948
|
+
? "status-text-positionWithMenu"
|
|
7949
|
+
: ((_c = props === null || props === void 0 ? void 0 : props.agent) === null || _c === void 0 ? void 0 : _c.avatarPath) === undefined
|
|
7950
|
+
? "status-text-positionLeftNoAvatar"
|
|
7951
|
+
: "status-text-positionLeft", "\n ").concat(((_d = props.config) === null || _d === void 0 ? void 0 : _d.alignTextCenter)
|
|
7952
|
+
? "status-text-positionCenter"
|
|
7953
|
+
: "", " \n ") },
|
|
7918
7954
|
React$1.createElement("span", { className: "status-text-title" }, getStatusText(props.accountStatus, (_e = props.config) === null || _e === void 0 ? void 0 : _e.status)),
|
|
7919
7955
|
((_g = (_f = props.config) === null || _f === void 0 ? void 0 : _f.subtitle) === null || _g === void 0 ? void 0 : _g.enabled) && (React$1.createElement("span", { className: "status-text-subtitle" }, (_k = (_j = (_h = props.config) === null || _h === void 0 ? void 0 : _h.subtitle) === null || _j === void 0 ? void 0 : _j.text) !== null && _k !== void 0 ? _k : ""))),
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7956
|
+
React$1.createElement(ButtonGroup, null,
|
|
7957
|
+
hasRightMenu && (React$1.createElement(MenuButton, { onClick: toggleDrawer, tabIndex: menuButtonTabIndex })),
|
|
7958
|
+
props.canRefresh && (React$1.createElement(RefreshButton, { onClick: props.refreshOnClick, tabIndex: (_m = (_l = props.config) === null || _l === void 0 ? void 0 : _l.actions) === null || _m === void 0 ? void 0 : _m.refreshTabIndex, showInLeft: false, showInRight: false })),
|
|
7959
|
+
props.canMinimize && (React$1.createElement(MinimizeButton, { onClick: props.minimizeOnClick, tabIndex: (_p = (_o = props.config) === null || _o === void 0 ? void 0 : _o.actions) === null || _p === void 0 ? void 0 : _p.minimizeTabIndex, showInRight: false })),
|
|
7960
|
+
props.canCancel && (React$1.createElement(CancelButton, { onClick: props.cancelOnClick, tabIndex: (_r = (_q = props.config) === null || _q === void 0 ? void 0 : _q.actions) === null || _r === void 0 ? void 0 : _r.cancelTabIndex })))),
|
|
7923
7961
|
drawerOpen ? (React$1.createElement("div", { className: "xa-chat-menu-container" },
|
|
7924
|
-
React$1.createElement(ChatMenu, { openFrom: "left", opened: drawerOpen, tabIndex: menuItemsTabIndex, onItemClick: handleMenuItem, items: menuItems }))) : React$1.createElement(React$1.Fragment, null)));
|
|
7962
|
+
React$1.createElement(ChatMenu, { openFrom: showMenuRight ? "right" : "left", opened: drawerOpen, tabIndex: menuItemsTabIndex, onItemClick: handleMenuItem, items: menuItems }))) : (React$1.createElement(React$1.Fragment, null))));
|
|
7925
7963
|
};
|
|
7926
7964
|
|
|
7927
7965
|
var UnknownMessage = function () { return React$1.createElement(React$1.Fragment, null); };
|
|
@@ -31089,7 +31127,7 @@ function buildStyleContent(theme) {
|
|
|
31089
31127
|
function WidgetStylesheet(props) {
|
|
31090
31128
|
var theme = props.theme;
|
|
31091
31129
|
var stylesContent = buildStyleContent(theme);
|
|
31092
|
-
return
|
|
31130
|
+
return React$1.createElement("style", null, stylesContent);
|
|
31093
31131
|
}
|
|
31094
31132
|
function buildVariables(gen) {
|
|
31095
31133
|
var result = gen.next();
|
|
@@ -31161,16 +31199,14 @@ function single(key, value) {
|
|
|
31161
31199
|
}
|
|
31162
31200
|
});
|
|
31163
31201
|
}
|
|
31164
|
-
function empty() {
|
|
31165
|
-
return
|
|
31166
|
-
|
|
31167
|
-
});
|
|
31168
|
-
}
|
|
31202
|
+
function empty() { return __generator$1(this, function (_a) {
|
|
31203
|
+
return [2 /*return*/];
|
|
31204
|
+
}); }
|
|
31169
31205
|
function getChatButtonStyle(style) {
|
|
31170
31206
|
if (!style) {
|
|
31171
31207
|
return empty();
|
|
31172
31208
|
}
|
|
31173
|
-
return withPrefix("chat-button-", union(getMargins(style.margin), getBackgroundStyle(style.background)));
|
|
31209
|
+
return withPrefix("chat-button-", union(getMargins(style.margin), getBackgroundStyle(style.background), withPrefix("image-", getSize(style.imageSize)), getAnimationStyle(style.animation)));
|
|
31174
31210
|
}
|
|
31175
31211
|
function getMessagesStyle(style) {
|
|
31176
31212
|
if (!style) {
|
|
@@ -31179,27 +31215,69 @@ function getMessagesStyle(style) {
|
|
|
31179
31215
|
return union(withPrefix("mine-", getMessageStyle(style.mine)), withPrefix("others-", getMessageStyle(style.others)), getPaddings(style === null || style === void 0 ? void 0 : style.padding), single("max-width", style === null || style === void 0 ? void 0 : style.maxWidth));
|
|
31180
31216
|
}
|
|
31181
31217
|
function getMessageStyle(style) {
|
|
31182
|
-
return union(single(
|
|
31218
|
+
return union(single("bubble-color", style === null || style === void 0 ? void 0 : style.bubbleColor), getTextStyle(style === null || style === void 0 ? void 0 : style.text));
|
|
31183
31219
|
}
|
|
31184
31220
|
function getSize(style) {
|
|
31185
31221
|
return __generator$1(this, function (_a) {
|
|
31186
31222
|
switch (_a.label) {
|
|
31187
|
-
case 0: return [4 /*yield*/, [
|
|
31223
|
+
case 0: return [4 /*yield*/, ["width", style === null || style === void 0 ? void 0 : style.width]];
|
|
31188
31224
|
case 1:
|
|
31189
31225
|
_a.sent();
|
|
31190
|
-
return [4 /*yield*/, [
|
|
31226
|
+
return [4 /*yield*/, ["height", style === null || style === void 0 ? void 0 : style.height]];
|
|
31191
31227
|
case 2:
|
|
31192
31228
|
_a.sent();
|
|
31193
31229
|
return [2 /*return*/];
|
|
31194
31230
|
}
|
|
31195
31231
|
});
|
|
31196
31232
|
}
|
|
31233
|
+
function getAnimationStyle(style) {
|
|
31234
|
+
var primaryColor, secondaryColor, opacity, intenseBackground, lessIntenseBackground;
|
|
31235
|
+
return __generator$1(this, function (_a) {
|
|
31236
|
+
switch (_a.label) {
|
|
31237
|
+
case 0:
|
|
31238
|
+
if (!style) {
|
|
31239
|
+
return [2 /*return*/];
|
|
31240
|
+
}
|
|
31241
|
+
primaryColor = style.primaryColor || "0, 117, 170";
|
|
31242
|
+
secondaryColor = style.secondaryColor || "110, 178, 209";
|
|
31243
|
+
opacity = style.opacity || 0.75;
|
|
31244
|
+
// Generate CSS variables that can be used by any animation type
|
|
31245
|
+
return [4 /*yield*/, ["animation-primary-color", "".concat(primaryColor)]];
|
|
31246
|
+
case 1:
|
|
31247
|
+
// Generate CSS variables that can be used by any animation type
|
|
31248
|
+
_a.sent();
|
|
31249
|
+
return [4 /*yield*/, ["animation-secondary-color", "".concat(secondaryColor)]];
|
|
31250
|
+
case 2:
|
|
31251
|
+
_a.sent();
|
|
31252
|
+
return [4 /*yield*/, ["animation-opacity", "".concat(opacity)]];
|
|
31253
|
+
case 3:
|
|
31254
|
+
_a.sent();
|
|
31255
|
+
// Generate colors for box-shadow halo effects
|
|
31256
|
+
return [4 /*yield*/, ["animation-primary-rgba", "rgba(".concat(primaryColor, ", ").concat(opacity, ")")]];
|
|
31257
|
+
case 4:
|
|
31258
|
+
// Generate colors for box-shadow halo effects
|
|
31259
|
+
_a.sent();
|
|
31260
|
+
return [4 /*yield*/, ["animation-secondary-rgba", "rgba(".concat(secondaryColor, ", ").concat(opacity, ")")]];
|
|
31261
|
+
case 5:
|
|
31262
|
+
_a.sent();
|
|
31263
|
+
intenseBackground = "radial-gradient(40.83% 40.83% at 47.92% 52.5%, rgba(".concat(primaryColor, ", ").concat(opacity, ") 78.85%, rgba(").concat(secondaryColor, ", ").concat(opacity, ") 92.07%)");
|
|
31264
|
+
lessIntenseBackground = "radial-gradient(40.83% 40.83% at 47.92% 52.5%, rgba(".concat(primaryColor, ", ").concat(opacity, ") 20.46%, rgba(").concat(secondaryColor, ", ").concat(opacity, ") 92.07%)");
|
|
31265
|
+
return [4 /*yield*/, ["animation-pulse-intense", intenseBackground]];
|
|
31266
|
+
case 6:
|
|
31267
|
+
_a.sent();
|
|
31268
|
+
return [4 /*yield*/, ["animation-pulse-less-intense", lessIntenseBackground]];
|
|
31269
|
+
case 7:
|
|
31270
|
+
_a.sent();
|
|
31271
|
+
return [2 /*return*/];
|
|
31272
|
+
}
|
|
31273
|
+
});
|
|
31274
|
+
}
|
|
31197
31275
|
function getZIndex(style) {
|
|
31198
31276
|
return __generator$1(this, function (_a) {
|
|
31199
31277
|
switch (_a.label) {
|
|
31200
31278
|
case 0:
|
|
31201
31279
|
if (!style) return [3 /*break*/, 2];
|
|
31202
|
-
return [4 /*yield*/, [
|
|
31280
|
+
return [4 /*yield*/, ["z-index", style]];
|
|
31203
31281
|
case 1:
|
|
31204
31282
|
_a.sent();
|
|
31205
31283
|
_a.label = 2;
|
|
@@ -31256,19 +31334,19 @@ function getTextStyle(style) {
|
|
|
31256
31334
|
switch (_a.label) {
|
|
31257
31335
|
case 0:
|
|
31258
31336
|
if (!style) return [3 /*break*/, 6];
|
|
31259
|
-
return [4 /*yield*/, [
|
|
31337
|
+
return [4 /*yield*/, ["text-color", style.color]];
|
|
31260
31338
|
case 1:
|
|
31261
31339
|
_a.sent();
|
|
31262
|
-
return [4 /*yield*/, [
|
|
31340
|
+
return [4 /*yield*/, ["font-size", style.fontSize]];
|
|
31263
31341
|
case 2:
|
|
31264
31342
|
_a.sent();
|
|
31265
|
-
return [4 /*yield*/, [
|
|
31343
|
+
return [4 /*yield*/, ["font-family", style.fontFamily]];
|
|
31266
31344
|
case 3:
|
|
31267
31345
|
_a.sent();
|
|
31268
|
-
return [4 /*yield*/, [
|
|
31346
|
+
return [4 /*yield*/, ["font-weight", style.fontWeight]];
|
|
31269
31347
|
case 4:
|
|
31270
31348
|
_a.sent();
|
|
31271
|
-
return [4 /*yield*/, [
|
|
31349
|
+
return [4 /*yield*/, ["font-style", style.fontStyle]];
|
|
31272
31350
|
case 5:
|
|
31273
31351
|
_a.sent();
|
|
31274
31352
|
_a.label = 6;
|
|
@@ -31289,11 +31367,17 @@ function getBackgroundStyle(style) {
|
|
|
31289
31367
|
function getButtonStyle(style) {
|
|
31290
31368
|
return __generator$1(this, function (_a) {
|
|
31291
31369
|
switch (_a.label) {
|
|
31292
|
-
case 0: return [4 /*yield*/, [
|
|
31370
|
+
case 0: return [4 /*yield*/, ["button-color", style === null || style === void 0 ? void 0 : style.color]];
|
|
31293
31371
|
case 1:
|
|
31294
31372
|
_a.sent();
|
|
31295
|
-
return [4 /*yield*/, [
|
|
31373
|
+
return [4 /*yield*/, ["button-width", style === null || style === void 0 ? void 0 : style.width]];
|
|
31296
31374
|
case 2:
|
|
31375
|
+
_a.sent();
|
|
31376
|
+
return [4 /*yield*/, ["button-bg", style === null || style === void 0 ? void 0 : style.background]];
|
|
31377
|
+
case 3:
|
|
31378
|
+
_a.sent();
|
|
31379
|
+
return [4 /*yield*/, ["button-hover-bg", style === null || style === void 0 ? void 0 : style.hoverBackground]];
|
|
31380
|
+
case 4:
|
|
31297
31381
|
_a.sent();
|
|
31298
31382
|
return [2 /*return*/];
|
|
31299
31383
|
}
|
|
@@ -31310,13 +31394,13 @@ function getBorderStyle(style) {
|
|
|
31310
31394
|
switch (_a.label) {
|
|
31311
31395
|
case 0:
|
|
31312
31396
|
if (!style) return [3 /*break*/, 4];
|
|
31313
|
-
return [4 /*yield*/, [
|
|
31397
|
+
return [4 /*yield*/, ["border-color", style.color]];
|
|
31314
31398
|
case 1:
|
|
31315
31399
|
_a.sent();
|
|
31316
|
-
return [4 /*yield*/, [
|
|
31400
|
+
return [4 /*yield*/, ["border-width", style.width]];
|
|
31317
31401
|
case 2:
|
|
31318
31402
|
_a.sent();
|
|
31319
|
-
return [4 /*yield*/, [
|
|
31403
|
+
return [4 /*yield*/, ["border-radius", style.radius]];
|
|
31320
31404
|
case 3:
|
|
31321
31405
|
_a.sent();
|
|
31322
31406
|
_a.label = 4;
|
|
@@ -31328,7 +31412,7 @@ function getHeaderStyle(style) {
|
|
|
31328
31412
|
if (!style) {
|
|
31329
31413
|
return empty();
|
|
31330
31414
|
}
|
|
31331
|
-
return union(getBackgroundStyle(style.background), getTextStyle(style.text), withPrefix("subtitle-", getTextStyle(style.subtitle)), getBorderStyle(style.border));
|
|
31415
|
+
return union(getBackgroundStyle(style.background), getTextStyle(style.text), withPrefix("subtitle-", getTextStyle(style.subtitle)), getBorderStyle(style.border), getPaddings(style.padding), single("avatar-background", style.avatarBackground));
|
|
31332
31416
|
}
|
|
31333
31417
|
function getFooterStyle(style) {
|
|
31334
31418
|
var _a;
|