@spaced-out/ui-design-system 0.3.11 → 0.3.13
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 +2 -0
- package/CHANGELOG.md +17 -0
- package/lib/components/ChatBubble/ChatBubble.js +4 -5
- package/lib/components/ChatBubble/ChatBubble.js.flow +11 -7
- package/lib/components/ChatBubble/ChatBubble.module.css +33 -29
- package/lib/components/PromptInput/PromptInput.js +8 -4
- package/lib/components/PromptInput/PromptInput.js.flow +8 -4
- package/lib/components/PromptInput/PromptInput.module.css +1 -0
- package/package.json +1 -1
package/.cspell/custom-words.txt
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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.13](https://github.com/spaced-out/ui-design-system/compare/v0.3.12...v0.3.13) (2024-12-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Removed stories that are not required in Chatbubble ([#308](https://github.com/spaced-out/ui-design-system/issues/308)) ([4b65c32](https://github.com/spaced-out/ui-design-system/commit/4b65c32e544f8c9953de78d375ee4959957670d1))
|
|
11
|
+
|
|
12
|
+
### [0.3.12](https://github.com/spaced-out/ui-design-system/compare/v0.3.11...v0.3.12) (2024-12-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* ai-components ([#307](https://github.com/spaced-out/ui-design-system/issues/307)) ([0ebf223](https://github.com/spaced-out/ui-design-system/commit/0ebf223719c8413a4c99e782be232f654cd2e637))
|
|
18
|
+
* promptinput bug fix on height ([4c8b116](https://github.com/spaced-out/ui-design-system/commit/4c8b116543348da082b327e04536466ff96d2835))
|
|
19
|
+
* some random prompting magic ([317d296](https://github.com/spaced-out/ui-design-system/commit/317d296cfebad106951153b5b34bf6a03c60a216))
|
|
20
|
+
* tidy up the states ([27e4678](https://github.com/spaced-out/ui-design-system/commit/27e4678061cf3563db22d865ddc9fd63d0932977))
|
|
21
|
+
|
|
5
22
|
### [0.3.11](https://github.com/spaced-out/ui-design-system/compare/v0.3.10...v0.3.11) (2024-12-18)
|
|
6
23
|
|
|
7
24
|
|
|
@@ -14,12 +14,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
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
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
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,
|
|
17
|
+
const getNamedComponent = (childrenArray, componentDisplayName) => {
|
|
18
18
|
const nodes = [];
|
|
19
19
|
for (const child of childrenArray) {
|
|
20
20
|
if (
|
|
21
21
|
// $FlowFixMe
|
|
22
|
-
child?.type?.displayName ===
|
|
22
|
+
child?.type?.displayName === componentDisplayName) {
|
|
23
23
|
nodes.push(child);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -44,7 +44,6 @@ const ChatBubble = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
44
44
|
ref: ref,
|
|
45
45
|
"data-testid": "ChatBubble",
|
|
46
46
|
className: (0, _classify.default)(_ChatBubbleModule.default.chatBubbleWrapper, {
|
|
47
|
-
[_ChatBubbleModule.default.chatBubbleWrapperLeft]: isLeftAligned,
|
|
48
47
|
[_ChatBubbleModule.default.chatBubbleWrapperRight]: !isLeftAligned
|
|
49
48
|
}, classNames?.wrapper)
|
|
50
49
|
}, anchorComponent, chatComponent);
|
|
@@ -65,8 +64,8 @@ const ChatAnchor = _ref2 => {
|
|
|
65
64
|
}), isAI ? /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
66
65
|
name: "sparkle",
|
|
67
66
|
color: "information",
|
|
68
|
-
type:
|
|
69
|
-
size:
|
|
67
|
+
type: _Icon.ICON_TYPE.solid,
|
|
68
|
+
size: _Icon.ICON_SIZE.large
|
|
70
69
|
}) : /*#__PURE__*/React.createElement(_Avatar.Avatar, avatarProps)));
|
|
71
70
|
};
|
|
72
71
|
exports.ChatAnchor = ChatAnchor;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
5
|
import classify from '../../utils/classify';
|
|
6
|
+
import type {AvatarProps} from '../Avatar';
|
|
6
7
|
import {Avatar} from '../Avatar';
|
|
7
|
-
import
|
|
8
|
-
import {Icon} from '../Icon';
|
|
8
|
+
import {Icon, ICON_SIZE, ICON_TYPE} from '../Icon';
|
|
9
9
|
import type {BaseTooltipProps} from '../Tooltip';
|
|
10
10
|
import {Tooltip} from '../Tooltip';
|
|
11
11
|
|
|
@@ -14,13 +14,13 @@ import css from './ChatBubble.module.css';
|
|
|
14
14
|
|
|
15
15
|
const getNamedComponent = (
|
|
16
16
|
childrenArray: Array<React.Node>,
|
|
17
|
-
|
|
18
|
-
): React.Node | React.Node[]
|
|
17
|
+
componentDisplayName: string,
|
|
18
|
+
): ?React.Node | React.Node[] => {
|
|
19
19
|
const nodes: React.Node[] = [];
|
|
20
20
|
for (const child of childrenArray) {
|
|
21
21
|
if (
|
|
22
22
|
// $FlowFixMe
|
|
23
|
-
child?.type?.displayName ===
|
|
23
|
+
child?.type?.displayName === componentDisplayName
|
|
24
24
|
) {
|
|
25
25
|
nodes.push(child);
|
|
26
26
|
}
|
|
@@ -62,7 +62,6 @@ export const ChatBubble: React$AbstractComponent<
|
|
|
62
62
|
className={classify(
|
|
63
63
|
css.chatBubbleWrapper,
|
|
64
64
|
{
|
|
65
|
-
[css.chatBubbleWrapperLeft]: isLeftAligned,
|
|
66
65
|
[css.chatBubbleWrapperRight]: !isLeftAligned,
|
|
67
66
|
},
|
|
68
67
|
classNames?.wrapper,
|
|
@@ -94,7 +93,12 @@ export const ChatAnchor = ({
|
|
|
94
93
|
>
|
|
95
94
|
<Tooltip {...tooltip} hidden={!tooltip}>
|
|
96
95
|
{isAI ? (
|
|
97
|
-
<Icon
|
|
96
|
+
<Icon
|
|
97
|
+
name="sparkle"
|
|
98
|
+
color="information"
|
|
99
|
+
type={ICON_TYPE.solid}
|
|
100
|
+
size={ICON_SIZE.large}
|
|
101
|
+
/>
|
|
98
102
|
) : (
|
|
99
103
|
<Avatar {...avatarProps} />
|
|
100
104
|
)}
|
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
@value (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
@value (
|
|
2
|
+
spaceNone,
|
|
3
|
+
spaceXSmall,
|
|
4
|
+
spaceSmall
|
|
5
|
+
) from '../../styles/variables/_space.css';
|
|
6
|
+
@value (
|
|
7
|
+
colorBorderPrimary,
|
|
8
|
+
colorBackgroundTertiary,
|
|
9
|
+
colorNeutralLightest,
|
|
10
|
+
colorFillPrimary,
|
|
11
|
+
colorInformation
|
|
12
|
+
) from '../../styles/variables/_color.css';
|
|
13
|
+
@value (
|
|
14
|
+
borderWidthPrimary,
|
|
15
|
+
borderRadiusSmall,
|
|
16
|
+
borderRadiusCircle
|
|
10
17
|
) from '../../styles/variables/_border.css';
|
|
11
|
-
@value (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
@value (
|
|
19
|
+
size2,
|
|
20
|
+
size12,
|
|
21
|
+
size24,
|
|
22
|
+
size42,
|
|
23
|
+
size580
|
|
24
|
+
) from '../../styles/variables/_size.css';
|
|
25
|
+
@value (
|
|
26
|
+
opacity100,
|
|
27
|
+
opacity60,
|
|
28
|
+
opacity80
|
|
29
|
+
) from '../../styles/variables/_opacity.css';
|
|
15
30
|
|
|
16
31
|
.chatBubbleWrapper {
|
|
17
32
|
display: flex;
|
|
18
33
|
gap: spaceSmall;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.chatBubbleWrapperLeft {
|
|
22
|
-
flex-direction: row; /* ChatAnchor comes first */
|
|
34
|
+
flex-direction: row;
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
.chatBubbleWrapperRight {
|
|
26
|
-
flex-direction: row-reverse;
|
|
38
|
+
flex-direction: row-reverse;
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
.chatAnchorWrapper {
|
|
@@ -74,11 +86,7 @@ borderRadiusSmall
|
|
|
74
86
|
.loadingText {
|
|
75
87
|
composes: buttonTextMedium from '../../styles/typography.module.css';
|
|
76
88
|
display: inline-flex;
|
|
77
|
-
background: linear-gradient(
|
|
78
|
-
90deg,
|
|
79
|
-
colorFillPrimary 0%,
|
|
80
|
-
colorInformation 100%
|
|
81
|
-
);
|
|
89
|
+
background: linear-gradient(90deg, colorFillPrimary, colorInformation);
|
|
82
90
|
-webkit-background-clip: text;
|
|
83
91
|
-webkit-text-fill-color: transparent;
|
|
84
92
|
background-clip: text;
|
|
@@ -96,12 +104,8 @@ borderRadiusSmall
|
|
|
96
104
|
.dot {
|
|
97
105
|
width: calc(size12/4);
|
|
98
106
|
height: calc(size12/4);
|
|
99
|
-
background: linear-gradient(
|
|
100
|
-
|
|
101
|
-
colorFillPrimary 0%,
|
|
102
|
-
colorInformation 100%
|
|
103
|
-
);
|
|
104
|
-
border-radius: 50%; /* Makes dots circular */
|
|
107
|
+
background: linear-gradient(90deg, colorFillPrimary, colorInformation);
|
|
108
|
+
border-radius: borderRadiusCircle;
|
|
105
109
|
opacity: opacity80;
|
|
106
110
|
|
|
107
111
|
/* Bounce Animation */
|
|
@@ -53,16 +53,21 @@ const PromptInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
53
53
|
const handleInput = () => {
|
|
54
54
|
const textarea = textareaRef.current;
|
|
55
55
|
if (textarea) {
|
|
56
|
-
textarea.style.height = 'auto';
|
|
56
|
+
textarea.style.height = 'auto'; // Reset height to auto to shrink
|
|
57
57
|
if (textarea.scrollHeight > parseInt(_size.size200)) {
|
|
58
|
-
textarea.style.height = _size.size200;
|
|
58
|
+
textarea.style.height = _size.size200; // Limit height to size200
|
|
59
59
|
textarea.style.overflowY = 'auto';
|
|
60
60
|
} else {
|
|
61
|
-
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
61
|
+
textarea.style.height = `${textarea.scrollHeight}px`; // Adjust to content height
|
|
62
62
|
textarea.style.overflowY = 'hidden';
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
+
|
|
67
|
+
// Reset height on value change
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
handleInput();
|
|
70
|
+
}, [value]);
|
|
66
71
|
const textCountError = React.useMemo(() => {
|
|
67
72
|
const charCount = value ? value.length : 0;
|
|
68
73
|
return textCountLimit != null && charCount > textCountLimit;
|
|
@@ -81,7 +86,6 @@ const PromptInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
81
86
|
textarea: (0, _classify.default)(_PromptInputModule.default.textarea, classNames?.textarea)
|
|
82
87
|
},
|
|
83
88
|
ref: textareaRef,
|
|
84
|
-
onInput: handleInput,
|
|
85
89
|
value: value,
|
|
86
90
|
onChange: onInputChange,
|
|
87
91
|
onFocus: onInputFocus,
|
|
@@ -102,17 +102,22 @@ export const PromptInput: React$AbstractComponent<
|
|
|
102
102
|
const handleInput = () => {
|
|
103
103
|
const textarea = textareaRef.current;
|
|
104
104
|
if (textarea) {
|
|
105
|
-
textarea.style.height = 'auto';
|
|
105
|
+
textarea.style.height = 'auto'; // Reset height to auto to shrink
|
|
106
106
|
if (textarea.scrollHeight > parseInt(size200)) {
|
|
107
|
-
textarea.style.height = size200;
|
|
107
|
+
textarea.style.height = size200; // Limit height to size200
|
|
108
108
|
textarea.style.overflowY = 'auto';
|
|
109
109
|
} else {
|
|
110
|
-
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
110
|
+
textarea.style.height = `${textarea.scrollHeight}px`; // Adjust to content height
|
|
111
111
|
textarea.style.overflowY = 'hidden';
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
// Reset height on value change
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
handleInput();
|
|
119
|
+
}, [value]);
|
|
120
|
+
|
|
116
121
|
const textCountError = React.useMemo(() => {
|
|
117
122
|
const charCount = value ? value.length : 0;
|
|
118
123
|
return textCountLimit != null && charCount > textCountLimit;
|
|
@@ -135,7 +140,6 @@ export const PromptInput: React$AbstractComponent<
|
|
|
135
140
|
textarea: classify(css.textarea, classNames?.textarea),
|
|
136
141
|
}}
|
|
137
142
|
ref={textareaRef}
|
|
138
|
-
onInput={handleInput}
|
|
139
143
|
value={value}
|
|
140
144
|
onChange={onInputChange}
|
|
141
145
|
onFocus={onInputFocus}
|