@spaced-out/ui-design-system 0.3.8 → 0.3.10
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/.cspell/custom-words.txt +1 -0
- package/CHANGELOG.md +18 -0
- package/design-tokens/color/app-color.json +6 -6
- package/lib/components/Banner/Banner.js +1 -0
- package/lib/components/Banner/Banner.js.flow +1 -0
- package/lib/components/ChatBubble/ChatBubble.js +152 -0
- package/lib/components/ChatBubble/ChatBubble.js.flow +218 -0
- package/lib/components/ChatBubble/ChatBubble.module.css +132 -0
- package/lib/components/ChatBubble/index.js +16 -0
- package/lib/components/ChatBubble/index.js.flow +3 -0
- package/lib/components/Disclaimer/Disclaimer.js +36 -0
- package/lib/components/Disclaimer/Disclaimer.js.flow +44 -0
- package/lib/components/Disclaimer/Disclaimer.module.css +14 -0
- package/lib/components/Disclaimer/index.js +16 -0
- package/lib/components/Disclaimer/index.js.flow +3 -0
- package/lib/components/InContextAlert/InContextAlert.js +17 -8
- package/lib/components/InContextAlert/InContextAlert.js.flow +11 -0
- package/lib/components/KPIBox/KPIBox.js.flow +1 -1
- package/lib/components/PromptChip/PromptChip.js +88 -0
- package/lib/components/PromptChip/PromptChip.js.flow +161 -0
- package/lib/components/PromptChip/PromptChip.module.css +82 -0
- package/lib/components/PromptChip/index.js +16 -0
- package/lib/components/PromptChip/index.js.flow +3 -0
- package/lib/components/PromptInput/PromptInput.js +119 -0
- package/lib/components/PromptInput/PromptInput.js.flow +190 -0
- package/lib/components/PromptInput/PromptInput.module.css +56 -0
- package/lib/components/PromptInput/index.js +16 -0
- package/lib/components/PromptInput/index.js.flow +3 -0
- package/lib/components/RadioTile/RadioTile.js +77 -0
- package/lib/components/RadioTile/RadioTile.js.flow +110 -0
- package/lib/components/RadioTile/RadioTile.module.css +41 -0
- package/lib/components/RadioTile/index.js +16 -0
- package/lib/components/RadioTile/index.js.flow +3 -0
- package/lib/components/ScoreBar/ScoreBar.js +11 -3
- package/lib/components/ScoreBar/ScoreBar.js.flow +25 -7
- package/lib/components/ScoreBar/ScoreBar.module.css +19 -13
- package/lib/components/Separator/Separator.js +41 -0
- package/lib/components/Separator/Separator.js.flow +62 -0
- package/lib/components/Separator/Separator.module.css +10 -0
- package/lib/components/Separator/index.js +16 -0
- package/lib/components/Separator/index.js.flow +3 -0
- package/lib/components/TextTile/TextTile.js +36 -0
- package/lib/components/TextTile/TextTile.js.flow +44 -0
- package/lib/components/TextTile/TextTile.module.css +27 -0
- package/lib/components/TextTile/index.js +16 -0
- package/lib/components/TextTile/index.js.flow +3 -0
- package/lib/components/Textarea/Textarea.js +2 -1
- package/lib/components/Textarea/Textarea.js.flow +2 -1
- package/lib/components/index.js +99 -0
- package/lib/components/index.js.flow +9 -0
- package/lib/styles/index.css +6 -6
- package/lib/styles/index.js +6 -6
- package/lib/styles/index.js.flow +6 -6
- package/lib/styles/variables/_color.css +6 -6
- package/lib/styles/variables/_color.js +6 -6
- package/lib/styles/variables/_color.js.flow +6 -6
- package/lib/utils/score-bar/score-bar.js +22 -8
- package/lib/utils/score-bar/score-bar.js.flow +35 -10
- package/package.json +1 -1
package/.cspell/custom-words.txt
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.3.10](https://github.com/spaced-out/ui-design-system/compare/v0.3.9...v0.3.10) (2024-12-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* chat bubble ([#304](https://github.com/spaced-out/ui-design-system/issues/304)) ([8c6464b](https://github.com/spaced-out/ui-design-system/commit/8c6464b1cc85638dfb04bea2a1398eb73a3d4ef9))
|
|
11
|
+
* introduces new disclaimer and prompt input components ([#299](https://github.com/spaced-out/ui-design-system/issues/299)) ([f6e2bac](https://github.com/spaced-out/ui-design-system/commit/f6e2bac64dc6431363df9bad6446a3140551d2a1))
|
|
12
|
+
* introduces new prompt chip and text tile components ([#303](https://github.com/spaced-out/ui-design-system/issues/303)) ([be62fea](https://github.com/spaced-out/ui-design-system/commit/be62fea58833d90e1882a66dd67fc6b7e98ae31a))
|
|
13
|
+
* radio tile component ([#300](https://github.com/spaced-out/ui-design-system/issues/300)) ([12a29a4](https://github.com/spaced-out/ui-design-system/commit/12a29a4f7e158d0a15d8e87c6f309580a7766aab))
|
|
14
|
+
* separator component ([#305](https://github.com/spaced-out/ui-design-system/issues/305)) ([716997c](https://github.com/spaced-out/ui-design-system/commit/716997cd29947e207caa8ccc126c3b6b98961aca))
|
|
15
|
+
|
|
16
|
+
### [0.3.9](https://github.com/spaced-out/ui-design-system/compare/v0.3.8...v0.3.9) (2024-12-17)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* [GDS-473] introduces withBorder and labelMap props in the score-bar component. ([#297](https://github.com/spaced-out/ui-design-system/issues/297)) ([9c741d2](https://github.com/spaced-out/ui-design-system/commit/9c741d285aa91f97f1afb35bc4e9379d3bf09d0b))
|
|
22
|
+
|
|
5
23
|
### [0.3.8](https://github.com/spaced-out/ui-design-system/compare/v0.3.8-beta.0...v0.3.8) (2024-12-13)
|
|
6
24
|
|
|
7
25
|
### [0.3.8-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.3.7...v0.3.8-beta.0) (2024-12-12)
|
|
@@ -261,23 +261,23 @@
|
|
|
261
261
|
"score-bar": {
|
|
262
262
|
"level": {
|
|
263
263
|
"1": {
|
|
264
|
-
"value": "{baseColor.
|
|
264
|
+
"value": "{baseColor.gray.400.value}"
|
|
265
265
|
},
|
|
266
266
|
"2": {
|
|
267
|
-
"value": "{baseColor.
|
|
267
|
+
"value": "{baseColor.red.400.value}"
|
|
268
268
|
},
|
|
269
269
|
"3": {
|
|
270
|
-
"value": "{baseColor.
|
|
270
|
+
"value": "{baseColor.orange.400.value}"
|
|
271
271
|
},
|
|
272
272
|
"4": {
|
|
273
|
-
"value": "{baseColor.
|
|
273
|
+
"value": "{baseColor.blue.400.value}"
|
|
274
274
|
},
|
|
275
275
|
"5": {
|
|
276
|
-
"value": "{baseColor.green.
|
|
276
|
+
"value": "{baseColor.green.400.value}"
|
|
277
277
|
}
|
|
278
278
|
},
|
|
279
279
|
"inactive": {
|
|
280
|
-
"value": "{baseColor.
|
|
280
|
+
"value": "{baseColor.gray.200.value}"
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
"gray.lightest": {
|
|
@@ -26,6 +26,7 @@ const Banner = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
26
26
|
semantic: semantic,
|
|
27
27
|
ref: ref,
|
|
28
28
|
classNames: {
|
|
29
|
+
...classNames,
|
|
29
30
|
wrapper: (0, _classify.default)(_BannerModule.default.bannerContainer, {
|
|
30
31
|
[_BannerModule.default.neutral]: semantic === _common.ALERT_SEMANTIC.neutral,
|
|
31
32
|
[_BannerModule.default.success]: semantic === _common.ALERT_SEMANTIC.success,
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChatFooterRightSlot = exports.ChatFooterLeftSlot = exports.ChatFooter = exports.ChatContent = exports.ChatBubble = exports.ChatBody = exports.ChatAnchor = exports.CHAT_BUBBLE_ORIENTATION = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _Avatar = require("../Avatar");
|
|
10
|
+
var _Icon = require("../Icon");
|
|
11
|
+
var _Tooltip = require("../Tooltip");
|
|
12
|
+
var _ChatBubbleModule = _interopRequireDefault(require("./ChatBubble.module.css"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
+
const getNamedComponent = (childrenArray, comp) => {
|
|
18
|
+
const nodes = [];
|
|
19
|
+
for (const child of childrenArray) {
|
|
20
|
+
if (
|
|
21
|
+
// $FlowFixMe
|
|
22
|
+
child?.type?.displayName === comp) {
|
|
23
|
+
nodes.push(child);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return nodes.length > 1 ? nodes : nodes[0] || null;
|
|
27
|
+
};
|
|
28
|
+
const CHAT_BUBBLE_ORIENTATION = Object.freeze({
|
|
29
|
+
left: 'left',
|
|
30
|
+
right: 'right '
|
|
31
|
+
});
|
|
32
|
+
exports.CHAT_BUBBLE_ORIENTATION = CHAT_BUBBLE_ORIENTATION;
|
|
33
|
+
const ChatBubble = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
34
|
+
let {
|
|
35
|
+
classNames,
|
|
36
|
+
orientation = 'left',
|
|
37
|
+
children
|
|
38
|
+
} = _ref;
|
|
39
|
+
const isLeftAligned = orientation === 'left';
|
|
40
|
+
const childrenArray = React.Children.toArray(children);
|
|
41
|
+
const anchorComponent = getNamedComponent(childrenArray, 'ChatAnchor');
|
|
42
|
+
const chatComponent = getNamedComponent(childrenArray, 'ChatContent');
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
ref: ref,
|
|
45
|
+
"data-testid": "ChatBubble",
|
|
46
|
+
className: (0, _classify.default)(_ChatBubbleModule.default.chatBubbleWrapper, {
|
|
47
|
+
[_ChatBubbleModule.default.chatBubbleWrapperLeft]: isLeftAligned,
|
|
48
|
+
[_ChatBubbleModule.default.chatBubbleWrapperRight]: !isLeftAligned
|
|
49
|
+
}, classNames?.wrapper)
|
|
50
|
+
}, anchorComponent, chatComponent);
|
|
51
|
+
});
|
|
52
|
+
exports.ChatBubble = ChatBubble;
|
|
53
|
+
const ChatAnchor = _ref2 => {
|
|
54
|
+
let {
|
|
55
|
+
isAI = true,
|
|
56
|
+
tooltip,
|
|
57
|
+
classNames,
|
|
58
|
+
avatarProps
|
|
59
|
+
} = _ref2;
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
"data-testid": "ChatAnchor",
|
|
62
|
+
className: (0, _classify.default)(_ChatBubbleModule.default.chatAnchorWrapper, classNames?.wrapper)
|
|
63
|
+
}, /*#__PURE__*/React.createElement(_Tooltip.Tooltip, _extends({}, tooltip, {
|
|
64
|
+
hidden: !tooltip
|
|
65
|
+
}), isAI ? /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
66
|
+
name: "sparkle",
|
|
67
|
+
color: "information",
|
|
68
|
+
type: "solid",
|
|
69
|
+
size: "large"
|
|
70
|
+
}) : /*#__PURE__*/React.createElement(_Avatar.Avatar, avatarProps)));
|
|
71
|
+
};
|
|
72
|
+
exports.ChatAnchor = ChatAnchor;
|
|
73
|
+
ChatAnchor.displayName = 'ChatAnchor';
|
|
74
|
+
const ChatContent = _ref3 => {
|
|
75
|
+
let {
|
|
76
|
+
classNames,
|
|
77
|
+
children
|
|
78
|
+
} = _ref3;
|
|
79
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
"data-testid": "ChatContent",
|
|
81
|
+
className: (0, _classify.default)(_ChatBubbleModule.default.chatContentWrapper, classNames?.wrapper)
|
|
82
|
+
}, children);
|
|
83
|
+
};
|
|
84
|
+
exports.ChatContent = ChatContent;
|
|
85
|
+
ChatContent.displayName = 'ChatContent';
|
|
86
|
+
const ChatBody = _ref4 => {
|
|
87
|
+
let {
|
|
88
|
+
withBgColor = true,
|
|
89
|
+
isLoading,
|
|
90
|
+
children,
|
|
91
|
+
loadingText = 'Generating',
|
|
92
|
+
classNames
|
|
93
|
+
} = _ref4;
|
|
94
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
"data-testid": "ChatBody",
|
|
96
|
+
className: (0, _classify.default)(_ChatBubbleModule.default.chatBodyWrapper, {
|
|
97
|
+
[_ChatBubbleModule.default.chatBodyWrapperLoading]: isLoading || !withBgColor,
|
|
98
|
+
[_ChatBubbleModule.default.chatBodyWrapperBgColor]: withBgColor
|
|
99
|
+
}, classNames?.wrapper)
|
|
100
|
+
}, isLoading ? /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: (0, _classify.default)(_ChatBubbleModule.default.loadingContainer, classNames?.wrapper)
|
|
102
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
103
|
+
className: _ChatBubbleModule.default.loadingText
|
|
104
|
+
}, loadingText), /*#__PURE__*/React.createElement("span", {
|
|
105
|
+
className: _ChatBubbleModule.default.loader
|
|
106
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: _ChatBubbleModule.default.dot
|
|
108
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
109
|
+
className: _ChatBubbleModule.default.dot
|
|
110
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
111
|
+
className: _ChatBubbleModule.default.dot
|
|
112
|
+
}))) : children);
|
|
113
|
+
};
|
|
114
|
+
exports.ChatBody = ChatBody;
|
|
115
|
+
ChatBody.displayName = 'ChatBody';
|
|
116
|
+
const ChatFooter = _ref5 => {
|
|
117
|
+
let {
|
|
118
|
+
children,
|
|
119
|
+
classNames
|
|
120
|
+
} = _ref5;
|
|
121
|
+
const childrenArray = React.Children.toArray(children);
|
|
122
|
+
const leftSlot = getNamedComponent(childrenArray, 'ChatFooterLeftSlot');
|
|
123
|
+
const rightSlot = getNamedComponent(childrenArray, 'ChatFooterRightSlot');
|
|
124
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
"data-testid": "ChatFooter",
|
|
126
|
+
className: (0, _classify.default)(_ChatBubbleModule.default.chatFooterWrapper, classNames?.wrapper)
|
|
127
|
+
}, leftSlot, rightSlot);
|
|
128
|
+
};
|
|
129
|
+
exports.ChatFooter = ChatFooter;
|
|
130
|
+
ChatFooter.displayName = 'ChatFooter';
|
|
131
|
+
const ChatFooterRightSlot = _ref6 => {
|
|
132
|
+
let {
|
|
133
|
+
children,
|
|
134
|
+
classNames
|
|
135
|
+
} = _ref6;
|
|
136
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: classNames?.wrapper
|
|
138
|
+
}, children);
|
|
139
|
+
};
|
|
140
|
+
exports.ChatFooterRightSlot = ChatFooterRightSlot;
|
|
141
|
+
ChatFooterRightSlot.displayName = 'ChatFooterRightSlot';
|
|
142
|
+
const ChatFooterLeftSlot = _ref7 => {
|
|
143
|
+
let {
|
|
144
|
+
children,
|
|
145
|
+
classNames
|
|
146
|
+
} = _ref7;
|
|
147
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
className: classNames?.wrapper
|
|
149
|
+
}, children);
|
|
150
|
+
};
|
|
151
|
+
exports.ChatFooterLeftSlot = ChatFooterLeftSlot;
|
|
152
|
+
ChatFooterLeftSlot.displayName = 'ChatFooterLeftSlot';
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import classify from '../../utils/classify';
|
|
6
|
+
import {Avatar} from '../Avatar';
|
|
7
|
+
import type {AvatarProps} from '../Avatar/Avatar.js';
|
|
8
|
+
import {Icon} from '../Icon';
|
|
9
|
+
import type {BaseTooltipProps} from '../Tooltip';
|
|
10
|
+
import {Tooltip} from '../Tooltip';
|
|
11
|
+
|
|
12
|
+
import css from './ChatBubble.module.css';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const getNamedComponent = (
|
|
16
|
+
childrenArray: Array<React.Node>,
|
|
17
|
+
comp: string,
|
|
18
|
+
): React.Node | React.Node[] | null => {
|
|
19
|
+
const nodes: React.Node[] = [];
|
|
20
|
+
for (const child of childrenArray) {
|
|
21
|
+
if (
|
|
22
|
+
// $FlowFixMe
|
|
23
|
+
child?.type?.displayName === comp
|
|
24
|
+
) {
|
|
25
|
+
nodes.push(child);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return nodes.length > 1 ? nodes : nodes[0] || null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
32
|
+
|
|
33
|
+
export const CHAT_BUBBLE_ORIENTATION = Object.freeze({
|
|
34
|
+
left: 'left',
|
|
35
|
+
right: 'right ',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type ChatBubbleOrientation = $Values<typeof CHAT_BUBBLE_ORIENTATION>;
|
|
39
|
+
|
|
40
|
+
export type ChatBubbleProps = {
|
|
41
|
+
classNames?: ClassNames,
|
|
42
|
+
orientation?: ChatBubbleOrientation,
|
|
43
|
+
children: React.Node,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const ChatBubble: React$AbstractComponent<
|
|
47
|
+
ChatBubbleProps,
|
|
48
|
+
HTMLDivElement,
|
|
49
|
+
> = React.forwardRef<ChatBubbleProps, HTMLDivElement>(
|
|
50
|
+
({classNames, orientation = 'left', children}: ChatBubbleProps, ref) => {
|
|
51
|
+
const isLeftAligned = orientation === 'left';
|
|
52
|
+
|
|
53
|
+
const childrenArray: React.Node[] = React.Children.toArray(children);
|
|
54
|
+
|
|
55
|
+
const anchorComponent = getNamedComponent(childrenArray, 'ChatAnchor');
|
|
56
|
+
const chatComponent = getNamedComponent(childrenArray, 'ChatContent');
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
ref={ref}
|
|
61
|
+
data-testid="ChatBubble"
|
|
62
|
+
className={classify(
|
|
63
|
+
css.chatBubbleWrapper,
|
|
64
|
+
{
|
|
65
|
+
[css.chatBubbleWrapperLeft]: isLeftAligned,
|
|
66
|
+
[css.chatBubbleWrapperRight]: !isLeftAligned,
|
|
67
|
+
},
|
|
68
|
+
classNames?.wrapper,
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
{anchorComponent}
|
|
72
|
+
{chatComponent}
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export type ChatAnchorProps = {
|
|
79
|
+
isAI?: boolean,
|
|
80
|
+
tooltip?: BaseTooltipProps,
|
|
81
|
+
classNames?: ClassNames,
|
|
82
|
+
avatarProps?: AvatarProps,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const ChatAnchor = ({
|
|
86
|
+
isAI = true,
|
|
87
|
+
tooltip,
|
|
88
|
+
classNames,
|
|
89
|
+
avatarProps,
|
|
90
|
+
}: ChatAnchorProps): React.Node => (
|
|
91
|
+
<div
|
|
92
|
+
data-testid="ChatAnchor"
|
|
93
|
+
className={classify(css.chatAnchorWrapper, classNames?.wrapper)}
|
|
94
|
+
>
|
|
95
|
+
<Tooltip {...tooltip} hidden={!tooltip}>
|
|
96
|
+
{isAI ? (
|
|
97
|
+
<Icon name="sparkle" color="information" type="solid" size="large" />
|
|
98
|
+
) : (
|
|
99
|
+
<Avatar {...avatarProps} />
|
|
100
|
+
)}
|
|
101
|
+
</Tooltip>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
ChatAnchor.displayName = 'ChatAnchor';
|
|
106
|
+
|
|
107
|
+
export type ChatContentProps = {classNames?: ClassNames, children?: React.Node};
|
|
108
|
+
|
|
109
|
+
export const ChatContent = ({
|
|
110
|
+
classNames,
|
|
111
|
+
children,
|
|
112
|
+
}: ChatContentProps): React.Node => (
|
|
113
|
+
<div
|
|
114
|
+
data-testid="ChatContent"
|
|
115
|
+
className={classify(css.chatContentWrapper, classNames?.wrapper)}
|
|
116
|
+
>
|
|
117
|
+
{children}
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
ChatContent.displayName = 'ChatContent';
|
|
122
|
+
|
|
123
|
+
export type ChatBodyClassNames = $ReadOnly<{wrapper?: string, loader: string}>;
|
|
124
|
+
|
|
125
|
+
export type ChatBodyProps = {
|
|
126
|
+
withBgColor?: boolean,
|
|
127
|
+
isLoading?: boolean,
|
|
128
|
+
loadingText?: string,
|
|
129
|
+
children?: React.Node,
|
|
130
|
+
classNames?: ClassNames,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const ChatBody = ({
|
|
134
|
+
withBgColor = true,
|
|
135
|
+
isLoading,
|
|
136
|
+
children,
|
|
137
|
+
loadingText = 'Generating',
|
|
138
|
+
classNames,
|
|
139
|
+
}: ChatBodyProps): React.Node => (
|
|
140
|
+
<div
|
|
141
|
+
data-testid="ChatBody"
|
|
142
|
+
className={classify(
|
|
143
|
+
css.chatBodyWrapper,
|
|
144
|
+
{
|
|
145
|
+
[css.chatBodyWrapperLoading]: isLoading || !withBgColor,
|
|
146
|
+
[css.chatBodyWrapperBgColor]: withBgColor,
|
|
147
|
+
},
|
|
148
|
+
classNames?.wrapper,
|
|
149
|
+
)}
|
|
150
|
+
>
|
|
151
|
+
{isLoading ? (
|
|
152
|
+
<div className={classify(css.loadingContainer, classNames?.wrapper)}>
|
|
153
|
+
<span className={css.loadingText}>{loadingText}</span>
|
|
154
|
+
<span className={css.loader}>
|
|
155
|
+
<span className={css.dot} />
|
|
156
|
+
<span className={css.dot} />
|
|
157
|
+
<span className={css.dot} />
|
|
158
|
+
</span>
|
|
159
|
+
</div>
|
|
160
|
+
) : (
|
|
161
|
+
children
|
|
162
|
+
)}
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
ChatBody.displayName = 'ChatBody';
|
|
167
|
+
|
|
168
|
+
export type ChatFooterProps = {classNames?: ClassNames, children?: React.Node};
|
|
169
|
+
|
|
170
|
+
export const ChatFooter = ({
|
|
171
|
+
children,
|
|
172
|
+
classNames,
|
|
173
|
+
}: ChatFooterProps): React.Node => {
|
|
174
|
+
const childrenArray: React.Node[] = React.Children.toArray(children);
|
|
175
|
+
|
|
176
|
+
const leftSlot = getNamedComponent(childrenArray, 'ChatFooterLeftSlot');
|
|
177
|
+
const rightSlot = getNamedComponent(childrenArray, 'ChatFooterRightSlot');
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<div
|
|
181
|
+
data-testid="ChatFooter"
|
|
182
|
+
className={classify(css.chatFooterWrapper, classNames?.wrapper)}
|
|
183
|
+
>
|
|
184
|
+
{leftSlot}
|
|
185
|
+
{rightSlot}
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
ChatFooter.displayName = 'ChatFooter';
|
|
191
|
+
|
|
192
|
+
export type ChatFooterRightSlotProps = {
|
|
193
|
+
children?: React.Node,
|
|
194
|
+
classNames?: ClassNames,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const ChatFooterRightSlot = ({
|
|
198
|
+
children,
|
|
199
|
+
classNames,
|
|
200
|
+
}: ChatFooterRightSlotProps): React.Node => (
|
|
201
|
+
<div className={classNames?.wrapper}>{children}</div>
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
ChatFooterRightSlot.displayName = 'ChatFooterRightSlot';
|
|
205
|
+
|
|
206
|
+
export type ChatFooterLeftSlotProps = {
|
|
207
|
+
children?: React.Node,
|
|
208
|
+
classNames?: ClassNames,
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const ChatFooterLeftSlot = ({
|
|
212
|
+
children,
|
|
213
|
+
classNames,
|
|
214
|
+
}: ChatFooterLeftSlotProps): React.Node => (
|
|
215
|
+
<div className={classNames?.wrapper}>{children}</div>
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
ChatFooterLeftSlot.displayName = 'ChatFooterLeftSlot';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
@value (spaceNone,spaceXSmall,spaceSmall) from '../../styles/variables/_space.css';
|
|
2
|
+
@value (colorBorderPrimary,
|
|
3
|
+
colorBackgroundTertiary,
|
|
4
|
+
colorNeutralLightest,
|
|
5
|
+
colorFillPrimary,
|
|
6
|
+
colorInformation) from '../../styles/variables/_color.css';
|
|
7
|
+
@value (borderWidthNone,
|
|
8
|
+
borderWidthPrimary,
|
|
9
|
+
borderRadiusSmall
|
|
10
|
+
) from '../../styles/variables/_border.css';
|
|
11
|
+
@value (size2,size4,size12,size24,size42,size580,sizeFluid) from
|
|
12
|
+
'../../styles/variables/_size.css';
|
|
13
|
+
@value (opacity100, opacity60,opacity80) from
|
|
14
|
+
'../../styles/variables/_opacity.css';
|
|
15
|
+
|
|
16
|
+
.chatBubbleWrapper {
|
|
17
|
+
display: flex;
|
|
18
|
+
gap: spaceSmall;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.chatBubbleWrapperLeft {
|
|
22
|
+
flex-direction: row; /* ChatAnchor comes first */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.chatBubbleWrapperRight {
|
|
26
|
+
flex-direction: row-reverse; /* ChatContent comes first */
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.chatAnchorWrapper {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
height: size42;
|
|
34
|
+
width: size42;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.chatContentWrapper {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
gap: spaceXSmall;
|
|
41
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
42
|
+
border-radius: borderRadiusSmall;
|
|
43
|
+
background-color: colorBackgroundTertiary;
|
|
44
|
+
padding: spaceSmall;
|
|
45
|
+
max-width: size580;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.chatBodyWrapper {
|
|
49
|
+
padding: spaceSmall;
|
|
50
|
+
border-radius: borderRadiusSmall;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.chatBodyWrapperBgColor {
|
|
54
|
+
background-color: colorNeutralLightest;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.chatBodyWrapperLoading {
|
|
58
|
+
padding: spaceNone;
|
|
59
|
+
background-color: colorBackgroundTertiary;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.chatFooterWrapper {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
gap: spaceXSmall;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.loadingContainer {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: flex-start;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.loadingText {
|
|
75
|
+
composes: buttonTextMedium from '../../styles/typography.module.css';
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
background: linear-gradient(
|
|
78
|
+
90deg,
|
|
79
|
+
colorFillPrimary 0%,
|
|
80
|
+
colorInformation 100%
|
|
81
|
+
);
|
|
82
|
+
-webkit-background-clip: text;
|
|
83
|
+
-webkit-text-fill-color: transparent;
|
|
84
|
+
background-clip: text;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.loader {
|
|
88
|
+
position: relative;
|
|
89
|
+
display: inline-flex;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
align-items: center;
|
|
92
|
+
gap: size2; /* Small gap between dots */
|
|
93
|
+
width: size24;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.dot {
|
|
97
|
+
width: calc(size12/4);
|
|
98
|
+
height: calc(size12/4);
|
|
99
|
+
background: linear-gradient(
|
|
100
|
+
90deg,
|
|
101
|
+
colorFillPrimary 0%,
|
|
102
|
+
colorInformation 100%
|
|
103
|
+
);
|
|
104
|
+
border-radius: 50%; /* Makes dots circular */
|
|
105
|
+
opacity: opacity80;
|
|
106
|
+
|
|
107
|
+
/* Bounce Animation */
|
|
108
|
+
animation: bounce 0.5s infinite ease-in-out alternate;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.dot:nth-child(1) {
|
|
112
|
+
animation-delay: 0s;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.dot:nth-child(2) {
|
|
116
|
+
animation-delay: 0.1s; /* Slight delay for second dot */
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.dot:nth-child(3) {
|
|
120
|
+
animation-delay: 0.2s; /* Slight delay for third dot */
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@keyframes bounce {
|
|
124
|
+
0% {
|
|
125
|
+
transform: translateY(0);
|
|
126
|
+
opacity: opacity60;
|
|
127
|
+
}
|
|
128
|
+
100% {
|
|
129
|
+
transform: translateY(size12); /* Higher bounce */
|
|
130
|
+
opacity: opacity100;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChatBubble = require("./ChatBubble");
|
|
7
|
+
Object.keys(_ChatBubble).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChatBubble[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChatBubble[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Disclaimer = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Banner = require("../Banner");
|
|
9
|
+
var _Icon = require("../Icon");
|
|
10
|
+
var _DisclaimerModule = _interopRequireDefault(require("./Disclaimer.module.css"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
const Disclaimer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
16
|
+
let {
|
|
17
|
+
classNames,
|
|
18
|
+
leftIconName = 'info-circle',
|
|
19
|
+
leftIconType = _Icon.ICON_TYPE.regular,
|
|
20
|
+
...restProps
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/React.createElement(_Banner.Banner, _extends({
|
|
23
|
+
ref: ref
|
|
24
|
+
}, restProps, {
|
|
25
|
+
// Do not let consumers control this
|
|
26
|
+
dismissable: true,
|
|
27
|
+
leftIconName: leftIconName,
|
|
28
|
+
leftIconType: leftIconType,
|
|
29
|
+
classNames: {
|
|
30
|
+
...classNames,
|
|
31
|
+
wrapper: _DisclaimerModule.default.disclaimerWrapper,
|
|
32
|
+
icon: _DisclaimerModule.default.iconWrapper
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
exports.Disclaimer = Disclaimer;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import type {BannerProps} from '../Banner';
|
|
6
|
+
import {Banner} from '../Banner';
|
|
7
|
+
import {ICON_TYPE} from '../Icon';
|
|
8
|
+
|
|
9
|
+
import css from './Disclaimer.module.css';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export type DisclaimerProps = {
|
|
13
|
+
...BannerProps,
|
|
14
|
+
selfDismiss?: boolean,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Disclaimer: React$AbstractComponent<
|
|
18
|
+
DisclaimerProps,
|
|
19
|
+
HTMLDivElement,
|
|
20
|
+
> = React.forwardRef<DisclaimerProps, HTMLDivElement>(
|
|
21
|
+
(
|
|
22
|
+
{
|
|
23
|
+
classNames,
|
|
24
|
+
leftIconName = 'info-circle',
|
|
25
|
+
leftIconType = ICON_TYPE.regular,
|
|
26
|
+
...restProps
|
|
27
|
+
}: DisclaimerProps,
|
|
28
|
+
ref,
|
|
29
|
+
) => (
|
|
30
|
+
<Banner
|
|
31
|
+
ref={ref}
|
|
32
|
+
{...restProps}
|
|
33
|
+
// Do not let consumers control this
|
|
34
|
+
dismissable
|
|
35
|
+
leftIconName={leftIconName}
|
|
36
|
+
leftIconType={leftIconType}
|
|
37
|
+
classNames={{
|
|
38
|
+
...classNames,
|
|
39
|
+
wrapper: css.disclaimerWrapper,
|
|
40
|
+
icon: css.iconWrapper,
|
|
41
|
+
}}
|
|
42
|
+
></Banner>
|
|
43
|
+
),
|
|
44
|
+
);
|