@smart-cloud/ai-kit-ui 1.1.3 → 1.1.5
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/ai-kit-ui.css +6 -3
- package/dist/index.cjs +9 -9
- package/dist/index.js +9 -9
- package/package.json +1 -1
- package/src/ShadowBoundary.tsx +8 -2
- package/src/ai-chatbot/AiChatbot.tsx +4 -1
- package/src/styles/ai-kit-ui.css +6 -3
- package/src/withAiKitShell.tsx +1 -0
package/package.json
CHANGED
package/src/ShadowBoundary.tsx
CHANGED
|
@@ -18,6 +18,8 @@ export type ShadowBoundaryProps = {
|
|
|
18
18
|
/** ID of the element inside the shadow root used as the portal target. */
|
|
19
19
|
rootElementId: string;
|
|
20
20
|
|
|
21
|
+
/** Variation of the shadow boundary behavior. */
|
|
22
|
+
variation?: "default" | "modal";
|
|
21
23
|
/**
|
|
22
24
|
* Where to create the shadow root:
|
|
23
25
|
* - "local": attach shadow to this component's host element (keeps layout positioning).
|
|
@@ -106,6 +108,7 @@ export function ShadowBoundary({
|
|
|
106
108
|
children,
|
|
107
109
|
rootElementId,
|
|
108
110
|
mode = "local",
|
|
111
|
+
variation = "default",
|
|
109
112
|
overlayRootId = "ai-kit-overlay-root",
|
|
110
113
|
}: ShadowBoundaryProps) {
|
|
111
114
|
const hostRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -144,8 +147,6 @@ export function ShadowBoundary({
|
|
|
144
147
|
overlayHost.style.inset = "0";
|
|
145
148
|
overlayHost.style.width = "0";
|
|
146
149
|
overlayHost.style.height = "0";
|
|
147
|
-
overlayHost.style.zIndex = "2147483647"; // max z-index
|
|
148
|
-
overlayHost.style.pointerEvents = "none";
|
|
149
150
|
|
|
150
151
|
doc.body.appendChild(overlayHost);
|
|
151
152
|
}
|
|
@@ -154,6 +155,11 @@ export function ShadowBoundary({
|
|
|
154
155
|
host = hostRef.current;
|
|
155
156
|
}
|
|
156
157
|
|
|
158
|
+
if (variation === "modal") {
|
|
159
|
+
host.style.zIndex = "2147483647"; // max z-index
|
|
160
|
+
host.style.pointerEvents = "none";
|
|
161
|
+
}
|
|
162
|
+
|
|
157
163
|
// 2) Ensure shadow root
|
|
158
164
|
const shadow = host.shadowRoot ?? host.attachShadow({ mode: "open" });
|
|
159
165
|
|
|
@@ -1033,7 +1033,10 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
|
|
|
1033
1033
|
}
|
|
1034
1034
|
}, [messages, lastUserSentAt, historyStorage]);
|
|
1035
1035
|
|
|
1036
|
-
if (
|
|
1036
|
+
if (
|
|
1037
|
+
(previewMode && !showChatbotPreview) ||
|
|
1038
|
+
(!previewMode && showChatbotPreview)
|
|
1039
|
+
) {
|
|
1037
1040
|
return null;
|
|
1038
1041
|
}
|
|
1039
1042
|
|
package/src/styles/ai-kit-ui.css
CHANGED
|
@@ -68,9 +68,12 @@
|
|
|
68
68
|
--ai-kit-color-success: #22c55e;
|
|
69
69
|
|
|
70
70
|
/* Brand / primary */
|
|
71
|
-
--ai-kit-color-primary: #
|
|
72
|
-
--ai-kit-color-primary-hover:
|
|
73
|
-
|
|
71
|
+
--ai-kit-color-primary: var(--mantine-primary-color-filled, #1c7ed6);
|
|
72
|
+
--ai-kit-color-primary-hover: var(
|
|
73
|
+
--mantine-primary-color-filled-hover,
|
|
74
|
+
#1971c2
|
|
75
|
+
);
|
|
76
|
+
--ai-kit-color-primary-contrast: var(--mantine-primary-color-contrast, #fff);
|
|
74
77
|
|
|
75
78
|
/* Back-compat aliases (existing names) */
|
|
76
79
|
--ai-kit-text-color: var(--ai-kit-color-text);
|
package/src/withAiKitShell.tsx
CHANGED
|
@@ -162,6 +162,7 @@ export function withAiKitShell<P extends object>(
|
|
|
162
162
|
return (
|
|
163
163
|
<ShadowBoundary
|
|
164
164
|
mode={variation === "modal" && !showOpenButton ? "overlay" : "local"}
|
|
165
|
+
variation={variation}
|
|
165
166
|
overlayRootId="ai-kit-overlay-root"
|
|
166
167
|
stylesheets={stylesheets}
|
|
167
168
|
innerCSS={innerCSS}
|