@super_studio/ecforce-ai-agent-react 0.2.0 → 0.3.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/chatbot-proivder.d.ts +15 -0
- package/dist/chatbot-proivder.d.ts.map +1 -0
- package/dist/chatbot-sheet.css +3 -4
- package/dist/chatbot-sheet.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -241
- package/dist/index.mjs +171 -269
- package/dist/sheet.d.ts +0 -15
- package/dist/sheet.d.ts.map +1 -1
- package/dist/tooltip.d.ts +0 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/agent-frame.tsx +3 -3
- package/src/chatbot-proivder.tsx +51 -0
- package/src/chatbot-sheet.css +3 -4
- package/src/chatbot-sheet.tsx +18 -19
- package/src/index.ts +1 -2
- package/src/sheet.tsx +6 -56
- package/src/tooltip.tsx +0 -1
- package/dist/chatbot-popover.css +0 -168
- package/dist/chatbot-popover.d.ts +0 -3
- package/dist/chatbot-popover.d.ts.map +0 -1
- package/dist/popover.d.ts +0 -9
- package/dist/popover.d.ts.map +0 -1
- package/src/chatbot-popover.css +0 -168
- package/src/chatbot-popover.tsx +0 -54
- package/src/popover.tsx +0 -54
- /package/dist/{tooltip.css → preset.css} +0 -0
- /package/src/{tooltip.css → preset.css} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
interface ChatbotContextType {
|
|
6
|
+
hasOpened: boolean;
|
|
7
|
+
open: boolean;
|
|
8
|
+
setOpen: (open: boolean) => void;
|
|
9
|
+
isExpanded: boolean;
|
|
10
|
+
setIsExpanded: (expanded: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ChatbotContext = React.createContext<ChatbotContextType | undefined>(
|
|
14
|
+
undefined,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export function useChatbot() {
|
|
18
|
+
const context = React.useContext(ChatbotContext);
|
|
19
|
+
if (!context) {
|
|
20
|
+
throw new Error("useChatbot must be used within a ChatbotProvider");
|
|
21
|
+
}
|
|
22
|
+
return context;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ChatbotProviderProps {
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function ChatbotProvider({ children }: ChatbotProviderProps) {
|
|
30
|
+
const [hasOpened, setHasOpened] = React.useState(false);
|
|
31
|
+
const [open, setOpen] = React.useState(false);
|
|
32
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
33
|
+
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (open) {
|
|
36
|
+
setHasOpened(true);
|
|
37
|
+
}
|
|
38
|
+
}, [open]);
|
|
39
|
+
|
|
40
|
+
const value = {
|
|
41
|
+
hasOpened,
|
|
42
|
+
open,
|
|
43
|
+
setOpen,
|
|
44
|
+
isExpanded,
|
|
45
|
+
setIsExpanded,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<ChatbotContext.Provider value={value}>{children}</ChatbotContext.Provider>
|
|
50
|
+
);
|
|
51
|
+
}
|
package/src/chatbot-sheet.css
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import "./tooltip.css";
|
|
2
|
-
|
|
3
1
|
/* Chatbot Trigger Button */
|
|
4
2
|
.chatbot-trigger {
|
|
5
3
|
position: fixed;
|
|
@@ -64,8 +62,9 @@
|
|
|
64
62
|
padding: 1rem;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
/*
|
|
68
|
-
.chatbot-sheet-title
|
|
65
|
+
/* Invisible Title and Description (For radix accessibility) */
|
|
66
|
+
.chatbot-sheet-title,
|
|
67
|
+
.chatbot-sheet-description {
|
|
69
68
|
position: absolute;
|
|
70
69
|
width: 1px;
|
|
71
70
|
height: 1px;
|
package/src/chatbot-sheet.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
Sheet,
|
|
9
9
|
SheetContent,
|
|
10
|
-
|
|
10
|
+
SheetDescription,
|
|
11
11
|
SheetTitle,
|
|
12
12
|
SheetTrigger,
|
|
13
13
|
} from "./sheet";
|
|
@@ -20,24 +20,23 @@ type ChatbotSheetProps = AgentFrameProps & {
|
|
|
20
20
|
export const ChatbotSheet = forwardRef<AgentElement, ChatbotSheetProps>(
|
|
21
21
|
({ sheetStyle, ...props }, ref) => {
|
|
22
22
|
return (
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</SheetProvider>
|
|
23
|
+
<Sheet>
|
|
24
|
+
<Tooltip
|
|
25
|
+
side="top"
|
|
26
|
+
align="end"
|
|
27
|
+
content="AIに質問してみましょう"
|
|
28
|
+
trigger={
|
|
29
|
+
<SheetTrigger>
|
|
30
|
+
<EcforceAiIcon />
|
|
31
|
+
</SheetTrigger>
|
|
32
|
+
}
|
|
33
|
+
/>
|
|
34
|
+
<SheetContent style={sheetStyle}>
|
|
35
|
+
<SheetTitle>AIに質問してみましょう</SheetTitle>
|
|
36
|
+
<SheetDescription>AIに質問してみましょう</SheetDescription>
|
|
37
|
+
<AgentFrame {...props} ref={ref} />
|
|
38
|
+
</SheetContent>
|
|
39
|
+
</Sheet>
|
|
41
40
|
);
|
|
42
41
|
},
|
|
43
42
|
);
|
package/src/index.ts
CHANGED
package/src/sheet.tsx
CHANGED
|
@@ -2,66 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
interface SheetContextType {
|
|
7
|
-
hasOpened: boolean;
|
|
8
|
-
sheetOpen: boolean;
|
|
9
|
-
setSheetOpen: (open: boolean) => void;
|
|
10
|
-
isExpanded: boolean;
|
|
11
|
-
setIsExpanded: (expanded: boolean) => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const SheetContext = React.createContext<SheetContextType | undefined>(
|
|
15
|
-
undefined,
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
export function useSheet() {
|
|
19
|
-
const context = React.useContext(SheetContext);
|
|
20
|
-
if (!context) {
|
|
21
|
-
throw new Error("useSheet must be used within a SheetProvider");
|
|
22
|
-
}
|
|
23
|
-
return context;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface SheetProviderProps {
|
|
27
|
-
children: React.ReactNode;
|
|
28
|
-
defaultWidth?: number;
|
|
29
|
-
minWidth?: number;
|
|
30
|
-
maxWidth?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function SheetProvider({ children }: SheetProviderProps) {
|
|
34
|
-
const [hasOpened, setHasOpened] = React.useState(false);
|
|
35
|
-
const [sheetOpen, setSheetOpen] = React.useState(false);
|
|
36
|
-
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
37
|
-
|
|
38
|
-
React.useEffect(() => {
|
|
39
|
-
if (sheetOpen) {
|
|
40
|
-
setHasOpened(true);
|
|
41
|
-
}
|
|
42
|
-
}, [sheetOpen]);
|
|
43
|
-
|
|
44
|
-
const value = {
|
|
45
|
-
hasOpened,
|
|
46
|
-
sheetOpen,
|
|
47
|
-
setSheetOpen,
|
|
48
|
-
isExpanded,
|
|
49
|
-
setIsExpanded,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<SheetContext.Provider value={value}>{children}</SheetContext.Provider>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
5
|
+
import { useChatbot } from "./chatbot-proivder";
|
|
56
6
|
|
|
57
7
|
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
58
|
-
const {
|
|
8
|
+
const { open, setOpen } = useChatbot();
|
|
59
9
|
return (
|
|
60
10
|
<SheetPrimitive.Root
|
|
61
11
|
data-slot="sheet"
|
|
62
12
|
modal={false}
|
|
63
|
-
open={
|
|
64
|
-
onOpenChange={
|
|
13
|
+
open={open}
|
|
14
|
+
onOpenChange={setOpen}
|
|
65
15
|
{...props}
|
|
66
16
|
/>
|
|
67
17
|
);
|
|
@@ -103,11 +53,11 @@ const SheetContent = React.forwardRef<
|
|
|
103
53
|
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
104
54
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>
|
|
105
55
|
>(({ className, children, style, ...props }, ref) => {
|
|
106
|
-
const { isExpanded,
|
|
56
|
+
const { isExpanded, open, hasOpened } = useChatbot();
|
|
107
57
|
const width = isExpanded ? "848px" : "400px";
|
|
108
58
|
|
|
109
59
|
// Use transform for better performance instead of right property
|
|
110
|
-
const translateX =
|
|
60
|
+
const translateX = open ? "0" : "100%";
|
|
111
61
|
|
|
112
62
|
// Create style object with CSS custom property for smoother animation
|
|
113
63
|
const contentStyle = {
|
package/src/tooltip.tsx
CHANGED
package/dist/chatbot-popover.css
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
@import "./tooltip.css";
|
|
2
|
-
|
|
3
|
-
/* Chatbot Trigger Button */
|
|
4
|
-
.chatbot-trigger {
|
|
5
|
-
position: fixed;
|
|
6
|
-
bottom: 1rem;
|
|
7
|
-
right: 1rem;
|
|
8
|
-
z-index: 50;
|
|
9
|
-
border-radius: 9999px;
|
|
10
|
-
border: 1px solid #f0f2f7;
|
|
11
|
-
background-color: #ffffff;
|
|
12
|
-
padding: 0.375rem;
|
|
13
|
-
color: #0061ff;
|
|
14
|
-
box-shadow:
|
|
15
|
-
0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
|
16
|
-
0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
17
|
-
transition: colors 200ms ease-in-out;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.chatbot-trigger:hover {
|
|
22
|
-
background-color: #f0f2f7;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/* Popover Backdrop */
|
|
26
|
-
.chatbot-popover-backdrop {
|
|
27
|
-
position: fixed;
|
|
28
|
-
top: 0;
|
|
29
|
-
right: 0;
|
|
30
|
-
bottom: 0;
|
|
31
|
-
left: 0;
|
|
32
|
-
z-index: 30;
|
|
33
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
34
|
-
animation: fade-in 150ms ease-out;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* Popover Content */
|
|
38
|
-
.chatbot-popover-content {
|
|
39
|
-
z-index: 50;
|
|
40
|
-
border-radius: 2rem;
|
|
41
|
-
background-color: #f7f9fa;
|
|
42
|
-
box-shadow:
|
|
43
|
-
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
44
|
-
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
45
|
-
outline: none;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
height: 80vh;
|
|
48
|
-
width: 600px;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* Animation states */
|
|
52
|
-
.chatbot-popover-content[data-state="closed"] {
|
|
53
|
-
display: none;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.chatbot-popover-content[data-state="open"] {
|
|
57
|
-
animation:
|
|
58
|
-
zoom-in 150ms ease-out,
|
|
59
|
-
fade-in 150ms ease-out;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.chatbot-popover-content[data-state="closed"] {
|
|
63
|
-
animation:
|
|
64
|
-
zoom-out 150ms ease-in,
|
|
65
|
-
fade-out 150ms ease-in;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/* Side-specific slide animations */
|
|
69
|
-
.chatbot-popover-content[data-side="bottom"] {
|
|
70
|
-
animation:
|
|
71
|
-
zoom-in 150ms ease-out,
|
|
72
|
-
fade-in 150ms ease-out,
|
|
73
|
-
slide-in-from-top 150ms ease-out;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.chatbot-popover-content[data-side="top"] {
|
|
77
|
-
animation:
|
|
78
|
-
zoom-in 150ms ease-out,
|
|
79
|
-
fade-in 150ms ease-out,
|
|
80
|
-
slide-in-from-bottom 150ms ease-out;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.chatbot-popover-content[data-side="left"] {
|
|
84
|
-
animation:
|
|
85
|
-
zoom-in 150ms ease-out,
|
|
86
|
-
fade-in 150ms ease-out,
|
|
87
|
-
slide-in-from-right 150ms ease-out;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.chatbot-popover-content[data-side="right"] {
|
|
91
|
-
animation:
|
|
92
|
-
zoom-in 150ms ease-out,
|
|
93
|
-
fade-in 150ms ease-out,
|
|
94
|
-
slide-in-from-left 150ms ease-out;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Keyframe Animations */
|
|
98
|
-
@keyframes fade-in {
|
|
99
|
-
from {
|
|
100
|
-
opacity: 0;
|
|
101
|
-
}
|
|
102
|
-
to {
|
|
103
|
-
opacity: 1;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@keyframes fade-out {
|
|
108
|
-
from {
|
|
109
|
-
opacity: 1;
|
|
110
|
-
}
|
|
111
|
-
to {
|
|
112
|
-
opacity: 0;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@keyframes zoom-in {
|
|
117
|
-
from {
|
|
118
|
-
transform: scale(0.95);
|
|
119
|
-
}
|
|
120
|
-
to {
|
|
121
|
-
transform: scale(1);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@keyframes zoom-out {
|
|
126
|
-
from {
|
|
127
|
-
transform: scale(1);
|
|
128
|
-
}
|
|
129
|
-
to {
|
|
130
|
-
transform: scale(0.95);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@keyframes slide-in-from-top {
|
|
135
|
-
from {
|
|
136
|
-
transform: translateY(-0.5rem);
|
|
137
|
-
}
|
|
138
|
-
to {
|
|
139
|
-
transform: translateY(0);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@keyframes slide-in-from-bottom {
|
|
144
|
-
from {
|
|
145
|
-
transform: translateY(0.5rem);
|
|
146
|
-
}
|
|
147
|
-
to {
|
|
148
|
-
transform: translateY(0);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
@keyframes slide-in-from-left {
|
|
153
|
-
from {
|
|
154
|
-
transform: translateX(-0.5rem);
|
|
155
|
-
}
|
|
156
|
-
to {
|
|
157
|
-
transform: translateX(0);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
@keyframes slide-in-from-right {
|
|
162
|
-
from {
|
|
163
|
-
transform: translateX(0.5rem);
|
|
164
|
-
}
|
|
165
|
-
to {
|
|
166
|
-
transform: translateX(0);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-popover.d.ts","sourceRoot":"","sources":["../src/chatbot-popover.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,cAAc,0GA2B1B,CAAC"}
|
package/dist/popover.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
|
-
declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
6
|
-
backdrop?: boolean;
|
|
7
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
export { Popover, PopoverTrigger, PopoverContent };
|
|
9
|
-
//# sourceMappingURL=popover.d.ts.map
|
package/dist/popover.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../src/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,QAAA,MAAM,OAAO,yCAAwB,CAAC;AAEtC,QAAA,MAAM,cAAc,sKASlB,CAAC;AAGH,QAAA,MAAM,cAAc;eAGL,OAAO;wCA4BrB,CAAC;AAGF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC"}
|
package/src/chatbot-popover.css
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
@import "./tooltip.css";
|
|
2
|
-
|
|
3
|
-
/* Chatbot Trigger Button */
|
|
4
|
-
.chatbot-trigger {
|
|
5
|
-
position: fixed;
|
|
6
|
-
bottom: 1rem;
|
|
7
|
-
right: 1rem;
|
|
8
|
-
z-index: 50;
|
|
9
|
-
border-radius: 9999px;
|
|
10
|
-
border: 1px solid #f0f2f7;
|
|
11
|
-
background-color: #ffffff;
|
|
12
|
-
padding: 0.375rem;
|
|
13
|
-
color: #0061ff;
|
|
14
|
-
box-shadow:
|
|
15
|
-
0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
|
16
|
-
0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
17
|
-
transition: colors 200ms ease-in-out;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.chatbot-trigger:hover {
|
|
22
|
-
background-color: #f0f2f7;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/* Popover Backdrop */
|
|
26
|
-
.chatbot-popover-backdrop {
|
|
27
|
-
position: fixed;
|
|
28
|
-
top: 0;
|
|
29
|
-
right: 0;
|
|
30
|
-
bottom: 0;
|
|
31
|
-
left: 0;
|
|
32
|
-
z-index: 30;
|
|
33
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
34
|
-
animation: fade-in 150ms ease-out;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* Popover Content */
|
|
38
|
-
.chatbot-popover-content {
|
|
39
|
-
z-index: 50;
|
|
40
|
-
border-radius: 2rem;
|
|
41
|
-
background-color: #f7f9fa;
|
|
42
|
-
box-shadow:
|
|
43
|
-
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
44
|
-
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
45
|
-
outline: none;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
height: 80vh;
|
|
48
|
-
width: 600px;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* Animation states */
|
|
52
|
-
.chatbot-popover-content[data-state="closed"] {
|
|
53
|
-
display: none;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.chatbot-popover-content[data-state="open"] {
|
|
57
|
-
animation:
|
|
58
|
-
zoom-in 150ms ease-out,
|
|
59
|
-
fade-in 150ms ease-out;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.chatbot-popover-content[data-state="closed"] {
|
|
63
|
-
animation:
|
|
64
|
-
zoom-out 150ms ease-in,
|
|
65
|
-
fade-out 150ms ease-in;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/* Side-specific slide animations */
|
|
69
|
-
.chatbot-popover-content[data-side="bottom"] {
|
|
70
|
-
animation:
|
|
71
|
-
zoom-in 150ms ease-out,
|
|
72
|
-
fade-in 150ms ease-out,
|
|
73
|
-
slide-in-from-top 150ms ease-out;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.chatbot-popover-content[data-side="top"] {
|
|
77
|
-
animation:
|
|
78
|
-
zoom-in 150ms ease-out,
|
|
79
|
-
fade-in 150ms ease-out,
|
|
80
|
-
slide-in-from-bottom 150ms ease-out;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.chatbot-popover-content[data-side="left"] {
|
|
84
|
-
animation:
|
|
85
|
-
zoom-in 150ms ease-out,
|
|
86
|
-
fade-in 150ms ease-out,
|
|
87
|
-
slide-in-from-right 150ms ease-out;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.chatbot-popover-content[data-side="right"] {
|
|
91
|
-
animation:
|
|
92
|
-
zoom-in 150ms ease-out,
|
|
93
|
-
fade-in 150ms ease-out,
|
|
94
|
-
slide-in-from-left 150ms ease-out;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Keyframe Animations */
|
|
98
|
-
@keyframes fade-in {
|
|
99
|
-
from {
|
|
100
|
-
opacity: 0;
|
|
101
|
-
}
|
|
102
|
-
to {
|
|
103
|
-
opacity: 1;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@keyframes fade-out {
|
|
108
|
-
from {
|
|
109
|
-
opacity: 1;
|
|
110
|
-
}
|
|
111
|
-
to {
|
|
112
|
-
opacity: 0;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@keyframes zoom-in {
|
|
117
|
-
from {
|
|
118
|
-
transform: scale(0.95);
|
|
119
|
-
}
|
|
120
|
-
to {
|
|
121
|
-
transform: scale(1);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@keyframes zoom-out {
|
|
126
|
-
from {
|
|
127
|
-
transform: scale(1);
|
|
128
|
-
}
|
|
129
|
-
to {
|
|
130
|
-
transform: scale(0.95);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@keyframes slide-in-from-top {
|
|
135
|
-
from {
|
|
136
|
-
transform: translateY(-0.5rem);
|
|
137
|
-
}
|
|
138
|
-
to {
|
|
139
|
-
transform: translateY(0);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@keyframes slide-in-from-bottom {
|
|
144
|
-
from {
|
|
145
|
-
transform: translateY(0.5rem);
|
|
146
|
-
}
|
|
147
|
-
to {
|
|
148
|
-
transform: translateY(0);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
@keyframes slide-in-from-left {
|
|
153
|
-
from {
|
|
154
|
-
transform: translateX(-0.5rem);
|
|
155
|
-
}
|
|
156
|
-
to {
|
|
157
|
-
transform: translateX(0);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
@keyframes slide-in-from-right {
|
|
162
|
-
from {
|
|
163
|
-
transform: translateX(0.5rem);
|
|
164
|
-
}
|
|
165
|
-
to {
|
|
166
|
-
transform: translateX(0);
|
|
167
|
-
}
|
|
168
|
-
}
|
package/src/chatbot-popover.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { forwardRef, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
AgentFrame,
|
|
4
|
-
type AgentElement,
|
|
5
|
-
type AgentFrameProps,
|
|
6
|
-
} from "./agent-frame";
|
|
7
|
-
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
8
|
-
|
|
9
|
-
export const ChatbotPopover = forwardRef<AgentElement, AgentFrameProps>(
|
|
10
|
-
(props, ref) => {
|
|
11
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
12
|
-
const [hasOpened, setHasOpened] = useState(false);
|
|
13
|
-
|
|
14
|
-
const handleOpenChange = (open: boolean) => {
|
|
15
|
-
setIsOpen(open);
|
|
16
|
-
if (open && !hasOpened) {
|
|
17
|
-
setHasOpened(true);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Popover open={isOpen} onOpenChange={handleOpenChange}>
|
|
23
|
-
<PopoverTrigger>
|
|
24
|
-
<EcforceAiIcon />
|
|
25
|
-
</PopoverTrigger>
|
|
26
|
-
<PopoverContent
|
|
27
|
-
align="end"
|
|
28
|
-
backdrop={isOpen}
|
|
29
|
-
forceMount={hasOpened || undefined} // チャットのStateを保持するために必要
|
|
30
|
-
>
|
|
31
|
-
<AgentFrame {...props} ref={ref} />
|
|
32
|
-
</PopoverContent>
|
|
33
|
-
</Popover>
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
function EcforceAiIcon() {
|
|
39
|
-
return (
|
|
40
|
-
<svg
|
|
41
|
-
width="24"
|
|
42
|
-
height="24"
|
|
43
|
-
viewBox="0 0 24 24"
|
|
44
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
45
|
-
fill="currentColor"
|
|
46
|
-
>
|
|
47
|
-
<path
|
|
48
|
-
fillRule="evenodd"
|
|
49
|
-
clipRule="evenodd"
|
|
50
|
-
d="M9.2 13.704s3.7-.812 4.325-3.74c.624-2.93.76-3.364 1.112-3.364.352 0 .42.309.5.618.08.309.51 2.276.613 2.745.102.47.783 2.93 3.712 3.616 2.93.686 3.338.697 3.338 1.12 0 .459-2.361.859-3.338 1.122-.976.263-3.042 1.007-3.587 3.49-.534 2.482-.681 3.489-1.238 3.489-.556 0-.545-.584-.613-.87-.068-.286-.34-1.819-.5-2.494-.147-.675-1.044-2.837-2.962-3.363-1.93-.527-3.962-.847-3.962-1.373s2.134-.824 2.6-.995ZM2.462 4.613s1.785-.39 2.08-1.798c.296-1.409.365-1.615.535-1.615.17 0 .205.149.239.298s.25 1.088.296 1.317c.045.229.375 1.409 1.785 1.74 1.41.333 1.603.333 1.603.54 0 .217-1.137.412-1.603.538-.466.126-1.467.48-1.729 1.683C5.407 8.507 5.338 9 5.078 9c-.262 0-.262-.286-.296-.424-.035-.137-.16-.882-.24-1.202-.079-.321-.5-1.363-1.432-1.615-.932-.252-1.91-.413-1.91-.665 0-.252 1.023-.4 1.25-.48h.012Z"
|
|
51
|
-
/>
|
|
52
|
-
</svg>
|
|
53
|
-
);
|
|
54
|
-
}
|
package/src/popover.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
const Popover = PopoverPrimitive.Root;
|
|
7
|
-
|
|
8
|
-
const PopoverTrigger = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof PopoverPrimitive.Trigger>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>
|
|
11
|
-
>(({ className, ...props }, ref) => (
|
|
12
|
-
<PopoverPrimitive.Trigger
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={`chatbot-trigger ${className}`}
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
17
|
-
));
|
|
18
|
-
PopoverTrigger.displayName = PopoverPrimitive.Trigger.displayName;
|
|
19
|
-
|
|
20
|
-
const PopoverContent = React.forwardRef<
|
|
21
|
-
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
22
|
-
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
|
|
23
|
-
backdrop?: boolean;
|
|
24
|
-
}
|
|
25
|
-
>(
|
|
26
|
-
(
|
|
27
|
-
{
|
|
28
|
-
className,
|
|
29
|
-
align = "center",
|
|
30
|
-
backdrop,
|
|
31
|
-
sideOffset = 4,
|
|
32
|
-
forceMount,
|
|
33
|
-
...props
|
|
34
|
-
},
|
|
35
|
-
ref,
|
|
36
|
-
) => (
|
|
37
|
-
<PopoverPrimitive.Portal forceMount={forceMount}>
|
|
38
|
-
<div>
|
|
39
|
-
{backdrop && <div className="chatbot-popover-backdrop" />}
|
|
40
|
-
<PopoverPrimitive.Content
|
|
41
|
-
ref={ref}
|
|
42
|
-
align={align}
|
|
43
|
-
sideOffset={sideOffset}
|
|
44
|
-
forceMount={forceMount}
|
|
45
|
-
className={`chatbot-popover-content ${className}`}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
</PopoverPrimitive.Portal>
|
|
50
|
-
),
|
|
51
|
-
);
|
|
52
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
53
|
-
|
|
54
|
-
export { Popover, PopoverTrigger, PopoverContent };
|
|
File without changes
|
|
File without changes
|