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