@swisper.ai/web-chat-ui 0.2.4 → 0.2.6
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/chat-artifact/chat-artifact.d.ts +52 -0
- package/dist/components/chat-artifact/chat-artifact.d.ts.map +1 -0
- package/dist/components/chat-artifact/chat-artifact.stories.d.ts +18 -0
- package/dist/components/chat-artifact/chat-artifact.stories.d.ts.map +1 -0
- package/dist/components/chat-artifact/index.d.ts +2 -0
- package/dist/components/chat-artifact/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +2 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +316 -261
- package/dist/index.es.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat-artifact/chat-artifact.json +118 -0
- package/src/components/chat-artifact/chat-artifact.stories.tsx +212 -0
- package/src/components/chat-artifact/chat-artifact.tsx +151 -0
- package/src/components/chat-artifact/index.ts +14 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +14 -0
- package/src/components/index.ts +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { HtmlHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface ChatArtifactProps extends HtmlHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/** When true, merges props onto the single child instead of rendering a `div`. */
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
/** Classes merged last onto the root. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** The artifact parts: an icon, the content with title and caption, and the actions. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** A message-row control for a generated artifact: icon, title, caption and trailing actions. */
|
|
11
|
+
export declare function ChatArtifact({ asChild, className, children, ...rest }: ChatArtifactProps): import('react').JSX.Element;
|
|
12
|
+
export interface ChatArtifactIconProps {
|
|
13
|
+
/** Classes merged last onto the icon wrapper. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** The icon or thumbnail to show. */
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** Shrink-wrapped slot for a consumer-supplied icon or thumbnail. */
|
|
19
|
+
export declare function ChatArtifactIcon({ className, children }: ChatArtifactIconProps): import('react').JSX.Element;
|
|
20
|
+
export interface ChatArtifactContentProps {
|
|
21
|
+
/** Classes merged last onto the content element. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Usually a `ChatArtifactTitle` and optional `ChatArtifactCaption`. */
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/** The text column: takes the width left beside the icon and stacks title above caption. */
|
|
27
|
+
export declare function ChatArtifactContent({ className, children }: ChatArtifactContentProps): import('react').JSX.Element;
|
|
28
|
+
export interface ChatArtifactTitleProps {
|
|
29
|
+
/** Classes merged last onto the title element. */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** The artifact name. */
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/** The artifact name, truncated to one line. */
|
|
35
|
+
export declare function ChatArtifactTitle({ className, children }: ChatArtifactTitleProps): import('react').JSX.Element;
|
|
36
|
+
export interface ChatArtifactCaptionProps {
|
|
37
|
+
/** Classes merged last onto the caption element. */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** Secondary fact under the title, e.g. source or visibility. */
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
/** A quieter secondary line under the title, truncated to one line. */
|
|
43
|
+
export declare function ChatArtifactCaption({ className, children }: ChatArtifactCaptionProps): import('react').JSX.Element;
|
|
44
|
+
export interface ChatArtifactActionsProps {
|
|
45
|
+
/** Classes merged last onto the actions wrapper. */
|
|
46
|
+
className?: string;
|
|
47
|
+
/** Consumer-supplied controls, e.g. share and open buttons. */
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/** Trailing action slot on the right of the row. */
|
|
51
|
+
export declare function ChatArtifactActions({ className, children }: ChatArtifactActionsProps): import('react').JSX.Element;
|
|
52
|
+
//# sourceMappingURL=chat-artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-artifact.d.ts","sourceRoot":"","sources":["../../../src/components/chat-artifact/chat-artifact.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK3D,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,CAAC,iBAAiB,CAAC;IAC9E,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,EAAE,OAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,+BAyBhG;AAED,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,qBAAqB,+BAgB9E;AAED,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,wBAAwB,+BAUpF;AAED,MAAM,WAAW,sBAAsB;IACrC,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,gDAAgD;AAChD,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,sBAAsB,+BAWhF;AAED,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,wBAAwB,+BAWpF;AAED,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,oDAAoD;AACpD,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,wBAAwB,+BAWpF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ChatArtifact } from './chat-artifact';
|
|
3
|
+
declare const meta: Meta<typeof ChatArtifact>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChatArtifact>;
|
|
6
|
+
/** An artifact in a message: presentation icon, name, caption, and share plus open actions. */
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
/** The whole row is a link via `asChild` (no nested buttons — those belong on a `div` root). */
|
|
9
|
+
export declare const AsChildLink: Story;
|
|
10
|
+
/** Title only — caption and actions are optional. */
|
|
11
|
+
export declare const TitleOnly: Story;
|
|
12
|
+
/** A name and caption longer than the row: both ellipsize to one line, and the actions stay fully visible. */
|
|
13
|
+
export declare const LongTitle: Story;
|
|
14
|
+
/** Inside an assistant message, as it appears in a thread. */
|
|
15
|
+
export declare const Examples: Story;
|
|
16
|
+
/** Toggle className and asChild from the controls. */
|
|
17
|
+
export declare const Playground: Story;
|
|
18
|
+
//# sourceMappingURL=chat-artifact.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-artifact.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-artifact/chat-artifact.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAS5D,OAAO,EACL,YAAY,EAMb,MAAM,iBAAiB,CAAC;AAEzB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAiCnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3C,+FAA+F;AAC/F,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,WAAW,EAAE,KAezB,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,SAAS,EAAE,KAWvB,CAAC;AAEF,8GAA8G;AAC9G,eAAO,MAAM,SAAS,EAAE,KAwBvB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,QAAQ,EAAE,KA2BtB,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,UAAU,EAAE,KA0CxB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ChatArtifact, ChatArtifactIcon, ChatArtifactContent, ChatArtifactTitle, ChatArtifactCaption, ChatArtifactActions, type ChatArtifactProps, type ChatArtifactIconProps, type ChatArtifactContentProps, type ChatArtifactTitleProps, type ChatArtifactCaptionProps, type ChatArtifactActionsProps, } from './chat-artifact';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chat-artifact/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,iBAAiB,CAAC"}
|
package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export default meta;
|
|
|
7
7
|
type Story = StoryObj<typeof ChatMessageAttachmentCard>;
|
|
8
8
|
/** A file attached to the prompt before sending: its type icon, its name, and a remove button that shows on hover. */
|
|
9
9
|
export declare const Default: Story;
|
|
10
|
+
/** A file name longer than the chip: it truncates to one line instead of widening the card. */
|
|
11
|
+
export declare const LongTitle: Story;
|
|
10
12
|
/** A file that was sent with a question: static, with no hover background and no remove action. */
|
|
11
13
|
export declare const NonInteractive: Story;
|
|
12
14
|
/** An attached image as a 56px square thumbnail, in place of the icon and file name. */
|
package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-message-attachment-card.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAiB5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,yBAAyB,EAK1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,qCAAqC,CAAC;AAG7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,yBAAyB,CAuChD,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,yBAAyB,CAAC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CAkC3E,CAAC"}
|
|
1
|
+
{"version":3,"file":"chat-message-attachment-card.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAiB5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,yBAAyB,EAK1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,qCAAqC,CAAC;AAG7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,yBAAyB,CAuChD,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAExD,sHAAsH;AACtH,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,SAAS,EAAE,KAWvB,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,cAAc,EAAE,KAU5B,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC;AAEF,2GAA2G;AAC3G,eAAO,MAAM,IAAI,EAAE,KAiBlB,CAAC;AAEF,UAAU,yBAAyB;IACjC,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,sGAAsG;AACtG,iBAAS,oBAAoB,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,yBAAyB,sCAmClF;AAED,KAAK,kBAAkB,GAAG,QAAQ,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEhE,+IAA+I;AAC/I,eAAO,MAAM,aAAa,EAAE,kBAO3B,CAAC;AAEF,qHAAqH;AACrH,eAAO,MAAM,mBAAmB,EAAE,kBAuBjC,CAAC;AAEF,oJAAoJ;AACpJ,eAAO,MAAM,QAAQ,EAAE,KAmDtB,CAAC;AAEF,UAAU,wCAAwC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kCAAkC,CAAC,MAAM,CAAC,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,iBAAS,mCAAmC,CAAC,EAC3C,SAAS,EACT,IAAI,EACJ,KAAK,EACL,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,QAAQ,GACT,EAAE,wCAAwC,+BAoB1C;AAED,4IAA4I;AAC5I,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,mCAAmC,CAkC3E,CAAC"}
|
|
@@ -14,6 +14,7 @@ export * from './chat-notification-popup';
|
|
|
14
14
|
export * from './chat-reply';
|
|
15
15
|
export * from './chat-suggestion';
|
|
16
16
|
export * from './chat-thread';
|
|
17
|
+
export * from './chat-artifact';
|
|
17
18
|
export * from './canvas-shell';
|
|
18
19
|
export * from './new-chat-trigger';
|
|
19
20
|
export * from './chat-thinking-process';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,c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