Skip to content

Commit c94db9c

Browse files
PixeledCodenkrantz
authored andcommitted
feat(ai-chat-log): add footnote
1 parent 86aa037 commit c94db9c

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

packages/paste-core/components/ai-chat-log/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
"@twilio-paste/color-contrast-utils": "^5.0.0",
3434
"@twilio-paste/customization": "^9.0.0",
3535
"@twilio-paste/design-tokens": "^10.3.0",
36+
"@twilio-paste/footnote": "^0.0.0",
3637
"@twilio-paste/icons": "^13.0.0",
38+
"@twilio-paste/keyboard-key": "^2.0.0",
39+
"@twilio-paste/reakit-library": "^3.0.0",
3740
"@twilio-paste/screen-reader-only": "^14.0.0",
3841
"@twilio-paste/separator": "^9.0.1",
3942
"@twilio-paste/skeleton-loader": "^7.0.0",
@@ -43,6 +46,8 @@
4346
"@twilio-paste/styling-library": "^4.0.0",
4447
"@twilio-paste/text": "^11.0.0",
4548
"@twilio-paste/theme": "^12.0.0",
49+
"@twilio-paste/tooltip": "^13.0.1",
50+
"@twilio-paste/tooltip-primitive": "^3.0.0",
4651
"@twilio-paste/types": "^7.0.0",
4752
"@twilio-paste/uid-library": "^3.0.0",
4853
"@types/react": "^17.0.2 || ^18.0.27 || ^19.0.0",
@@ -59,7 +64,10 @@
5964
"@twilio-paste/color-contrast-utils": "^5.0.0",
6065
"@twilio-paste/customization": "^9.0.1",
6166
"@twilio-paste/design-tokens": "^10.15.0",
67+
"@twilio-paste/footnote": "^1.0.0",
6268
"@twilio-paste/icons": "^13.0.1",
69+
"@twilio-paste/keyboard-key": "^2.0.0",
70+
"@twilio-paste/reakit-library": "^3.0.0",
6371
"@twilio-paste/screen-reader-only": "^14.0.1",
6472
"@twilio-paste/separator": "^9.0.1",
6573
"@twilio-paste/skeleton-loader": "^7.0.1",
@@ -69,6 +77,8 @@
6977
"@twilio-paste/styling-library": "^4.0.1",
7078
"@twilio-paste/text": "^11.0.1",
7179
"@twilio-paste/theme": "^12.0.1",
80+
"@twilio-paste/tooltip": "^13.0.1",
81+
"@twilio-paste/tooltip-primitive": "^3.0.0",
7282
"@twilio-paste/types": "^7.0.1",
7383
"@twilio-paste/uid-library": "^3.0.1",
7484
"@types/react": "^19.0.8",

packages/paste-core/components/ai-chat-log/src/AIChatMessageSource.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import type { BoxElementProps } from "@twilio-paste/box";
22
import { Box, safelySpreadBoxProps } from "@twilio-paste/box";
3+
import { Footnote } from "@twilio-paste/footnote";
34
import type { HTMLPasteProps } from "@twilio-paste/types";
45
import * as React from "react";
56

67
export interface AIChatMessageSourceProps extends HTMLPasteProps<"div"> {
7-
children?: React.ReactNode;
8+
children: string;
89
/**
910
* Overrides the default element name to apply unique styles with the Customization Provider
1011
*
11-
* @default "AI_CHAT_MESSAGE"
12+
* @default "AI_CHAT_MESSAGE_SOURCE"
1213
* @type {BoxProps["element"]}
1314
* @memberof AIChatMessageSourceProps
1415
*/
@@ -18,17 +19,8 @@ export interface AIChatMessageSourceProps extends HTMLPasteProps<"div"> {
1819
export const AIChatMessageSource = React.forwardRef<HTMLDivElement, AIChatMessageSourceProps>(
1920
({ children, element = "AI_CHAT_MESSAGE_SOURCE", ...props }, ref) => {
2021
return (
21-
<Box
22-
as="sup"
23-
ref={ref}
24-
element={element}
25-
verticalAlign="inherit"
26-
fontSize="inherit"
27-
paddingX="space10"
28-
color="colorTextWeak"
29-
{...safelySpreadBoxProps(props)}
30-
>
31-
[{children}]
22+
<Box as="span" ref={ref} element={element} paddingX="space10" {...safelySpreadBoxProps(props)}>
23+
<Footnote element={`${element}_FOOTNOTE`}>{children}</Footnote>
3224
</Box>
3325
);
3426
},

packages/paste-core/components/ai-chat-log/src/AIChatMessageSourceLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface AIChatMessageSourceLinkProps extends HTMLPasteProps<"div"> {
99
/**
1010
* Overrides the default element name to apply unique styles with the Customization Provider
1111
*
12-
* @default "AI_CHAT_MESSAGE"
12+
* @default "AI_CHAT_MESSAGE_SOURCE_LINK"
1313
* @type {BoxProps["element"]}
1414
* @memberof AIChatMessageSourceLinkProps
1515
*/

packages/paste-core/components/ai-chat-log/type-docs.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15858,7 +15858,7 @@
1585815858
},
1585915859
"element": {
1586015860
"type": "string",
15861-
"defaultValue": "AI_CHAT_MESSAGE",
15861+
"defaultValue": "AI_CHAT_MESSAGE_SOURCE",
1586215862
"required": false,
1586315863
"externalProp": false,
1586415864
"description": "Overrides the default element name to apply unique styles with the Customization Provider"
@@ -17573,7 +17573,7 @@
1757317573
},
1757417574
"element": {
1757517575
"type": "string",
17576-
"defaultValue": "AI_CHAT_MESSAGE",
17576+
"defaultValue": "AI_CHAT_MESSAGE_SOURCE_LINK",
1757717577
"required": false,
1757817578
"externalProp": false,
1757917579
"description": "Overrides the default element name to apply unique styles with the Customization Provider"

packages/paste-core/components/footnote/src/Footnote.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const footnoteStyles: BoxStyleProps = {
3939
paddingX: "space30",
4040
borderRadius: "borderRadiusCircle",
4141
height: "sizeIcon40",
42+
minWidth: "sizeIcon40",
43+
textAlign: "center",
44+
verticalAlign: "middle",
4245
flexShrink: 0,
4346
color: "colorTextWeak",
4447
fontSize: "fontSize20",

yarn.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10803,6 +10803,7 @@ __metadata:
1080310803
"@twilio-paste/color-contrast-utils": ^5.0.0
1080410804
"@twilio-paste/customization": ^9.0.1
1080510805
"@twilio-paste/design-tokens": ^10.15.0
10806+
"@twilio-paste/footnote": ^1.0.0
1080610807
"@twilio-paste/icons": ^13.0.1
1080710808
"@twilio-paste/screen-reader-only": ^14.0.1
1080810809
"@twilio-paste/separator": ^9.0.1
@@ -10830,6 +10831,7 @@ __metadata:
1083010831
"@twilio-paste/color-contrast-utils": ^5.0.0
1083110832
"@twilio-paste/customization": ^9.0.0
1083210833
"@twilio-paste/design-tokens": ^10.3.0
10834+
"@twilio-paste/footnote": ^0.0.0
1083310835
"@twilio-paste/icons": ^13.0.0
1083410836
"@twilio-paste/screen-reader-only": ^14.0.0
1083510837
"@twilio-paste/separator": ^9.0.1

0 commit comments

Comments
 (0)