@atlaskit/rovo-agent-components 1.13.2 → 1.14.0
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/CHANGELOG.md +15 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/ui/agent-profile-info/agent-star-count/index.js +46 -0
- package/dist/cjs/ui/agent-profile-info/agent-star-count/messages.js +14 -0
- package/dist/cjs/ui/agent-profile-info/agent-star-count/utils.js +23 -0
- package/dist/cjs/ui/agent-profile-info/index.js +11 -44
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/ui/agent-profile-info/agent-star-count/index.js +41 -0
- package/dist/es2019/ui/agent-profile-info/agent-star-count/messages.js +8 -0
- package/dist/es2019/ui/agent-profile-info/agent-star-count/utils.js +17 -0
- package/dist/es2019/ui/agent-profile-info/index.js +0 -35
- package/dist/esm/index.js +2 -1
- package/dist/esm/ui/agent-profile-info/agent-star-count/index.js +39 -0
- package/dist/esm/ui/agent-profile-info/agent-star-count/messages.js +8 -0
- package/dist/esm/ui/agent-profile-info/agent-star-count/utils.js +17 -0
- package/dist/esm/ui/agent-profile-info/index.js +10 -43
- package/dist/types/index.d.ts +2 -1
- package/dist/types/ui/agent-profile-info/agent-star-count/index.d.ts +5 -0
- package/dist/types/ui/agent-profile-info/agent-star-count/messages.d.ts +7 -0
- package/dist/types/ui/agent-profile-info/agent-star-count/utils.d.ts +1 -0
- package/dist/types/ui/agent-profile-info/index.d.ts +0 -4
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/agent-profile-info/agent-star-count/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/agent-profile-info/agent-star-count/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/agent-profile-info/agent-star-count/utils.d.ts +1 -0
- package/dist/types-ts4.5/ui/agent-profile-info/index.d.ts +0 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-components
|
|
2
2
|
|
|
3
|
+
## 1.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#166276](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166276)
|
|
8
|
+
[`dbaae97cdc26d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dbaae97cdc26d) -
|
|
9
|
+
Fix OOTB agents in agent embed avatar to use agent.external_config_reference for namedId. Share
|
|
10
|
+
star components across agent embed, agent profile page, view agent modal, profile card; updated
|
|
11
|
+
copy and star formatting based on last discussion with content. Added optimistic update on
|
|
12
|
+
favourite behaviour and remove the background fetch on favourite/unfavourite click.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 1.13.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -42,7 +42,7 @@ Object.defineProperty(exports, "AgentProfileInfo", {
|
|
|
42
42
|
Object.defineProperty(exports, "AgentStarCount", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
get: function get() {
|
|
45
|
-
return
|
|
45
|
+
return _agentStarCount.AgentStarCount;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "BrowseAgentsPill", {
|
|
@@ -100,6 +100,7 @@ Object.defineProperty(exports, "getConversationStarters", {
|
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
var _agentProfileInfo = require("./ui/agent-profile-info");
|
|
103
|
+
var _agentStarCount = require("./ui/agent-profile-info/agent-star-count");
|
|
103
104
|
var _starIconButton = require("./common/ui/star-icon-button");
|
|
104
105
|
var _agentConversationStarters = require("./ui/agent-conversation-starters");
|
|
105
106
|
var _chatPill = require("./common/ui/chat-pill");
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AgentStarCount = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _starUnstarredStar = _interopRequireDefault(require("@atlaskit/icon/utility/migration/star-unstarred--star"));
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
12
|
+
var _skeleton = _interopRequireDefault(require("@atlaskit/skeleton"));
|
|
13
|
+
var _messages = require("./messages");
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
var countStyles = (0, _primitives.xcss)({
|
|
16
|
+
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
gap: 'space.050',
|
|
20
|
+
paddingInlineStart: 'space.025'
|
|
21
|
+
});
|
|
22
|
+
var AgentStarCount = exports.AgentStarCount = function AgentStarCount(_ref) {
|
|
23
|
+
var starCount = _ref.starCount,
|
|
24
|
+
isLoading = _ref.isLoading;
|
|
25
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
26
|
+
formatMessage = _useIntl.formatMessage;
|
|
27
|
+
if ((starCount === null || starCount === undefined) && !isLoading) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
31
|
+
xcss: countStyles
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_starUnstarredStar.default, {
|
|
33
|
+
LEGACY_margin: "0 ".concat("var(--ds-space-negative-025, -2px)"),
|
|
34
|
+
color: "currentColor",
|
|
35
|
+
label: "",
|
|
36
|
+
LEGACY_size: "small"
|
|
37
|
+
}), isLoading ? /*#__PURE__*/_react.default.createElement(_skeleton.default, {
|
|
38
|
+
testId: "agent-profile-info-star-count-skeleton",
|
|
39
|
+
isShimmering: true,
|
|
40
|
+
height: 16,
|
|
41
|
+
width: 75,
|
|
42
|
+
borderRadius: 3
|
|
43
|
+
}) : formatMessage(_messages.messages.starredCount, {
|
|
44
|
+
starCount: (0, _utils.formatNumber)(starCount !== null && starCount !== void 0 ? starCount : 0)
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.messages = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
+
starredCount: {
|
|
10
|
+
id: 'ai-mate.agent-profile-info.starred-count',
|
|
11
|
+
defaultMessage: '{starCount} {starCount, plural, one {user} other {users}}',
|
|
12
|
+
description: 'Text showing the number of times an agent has been favourited or starred'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatNumber = void 0;
|
|
7
|
+
/* Example usage
|
|
8
|
+
formatNumber(4100); // Output: "4.1k"
|
|
9
|
+
formatNumber(1234567); // Output: "1.2M"
|
|
10
|
+
formatNumber(9876543210); // Output: "9.9B"
|
|
11
|
+
formatNumber(500); // Output: "500"
|
|
12
|
+
*/
|
|
13
|
+
var formatNumber = exports.formatNumber = function formatNumber(inputNumber) {
|
|
14
|
+
if (inputNumber >= 1e9) {
|
|
15
|
+
return (inputNumber / 1e9).toFixed(1) + 'B';
|
|
16
|
+
} else if (inputNumber >= 1e6) {
|
|
17
|
+
return (inputNumber / 1e6).toFixed(1) + 'M';
|
|
18
|
+
} else if (inputNumber >= 1e3) {
|
|
19
|
+
return (inputNumber / 1e3).toFixed(1) + 'k';
|
|
20
|
+
} else {
|
|
21
|
+
return inputNumber.toString();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -4,11 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.AgentProfileInfo = exports.AgentProfileCreator = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
11
|
-
var _starUnstarredStar = _interopRequireDefault(require("@atlaskit/icon/utility/migration/star-unstarred--star"));
|
|
12
11
|
var _logo = require("@atlaskit/logo");
|
|
13
12
|
var _primitives = require("@atlaskit/primitives");
|
|
14
13
|
var _skeleton = _interopRequireDefault(require("@atlaskit/skeleton"));
|
|
@@ -21,13 +20,6 @@ var clickableItemStyles = (0, _primitives.xcss)({
|
|
|
21
20
|
alignItems: 'center',
|
|
22
21
|
gap: 'space.050'
|
|
23
22
|
});
|
|
24
|
-
var countStyles = (0, _primitives.xcss)({
|
|
25
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
26
|
-
display: 'flex',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
gap: 'space.050',
|
|
29
|
-
paddingInlineStart: 'space.025'
|
|
30
|
-
});
|
|
31
23
|
var nameStyles = (0, _primitives.xcss)({
|
|
32
24
|
justifyContent: 'space-between',
|
|
33
25
|
alignItems: 'flex-start'
|
|
@@ -94,31 +86,6 @@ var AgentProfileCreator = exports.AgentProfileCreator = function AgentProfileCre
|
|
|
94
86
|
size: "small"
|
|
95
87
|
}), creatorRender) : null;
|
|
96
88
|
};
|
|
97
|
-
var AgentStarCount = exports.AgentStarCount = function AgentStarCount(_ref2) {
|
|
98
|
-
var starCount = _ref2.starCount,
|
|
99
|
-
isLoading = _ref2.isLoading;
|
|
100
|
-
var _useIntl2 = (0, _reactIntlNext.useIntl)(),
|
|
101
|
-
formatMessage = _useIntl2.formatMessage;
|
|
102
|
-
if ((starCount === null || starCount === undefined) && !isLoading) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
106
|
-
xcss: countStyles
|
|
107
|
-
}, /*#__PURE__*/_react.default.createElement(_starUnstarredStar.default, {
|
|
108
|
-
LEGACY_margin: "0 ".concat("var(--ds-space-negative-025, -2px)"),
|
|
109
|
-
color: "currentColor",
|
|
110
|
-
label: "",
|
|
111
|
-
LEGACY_size: "small"
|
|
112
|
-
}), isLoading ? /*#__PURE__*/_react.default.createElement(_skeleton.default, {
|
|
113
|
-
testId: "agent-profile-info-star-count-skeleton",
|
|
114
|
-
isShimmering: true,
|
|
115
|
-
height: 16,
|
|
116
|
-
width: 75,
|
|
117
|
-
borderRadius: 3
|
|
118
|
-
}) : formatMessage(_messages.messages.starredCount, {
|
|
119
|
-
count: starCount
|
|
120
|
-
}));
|
|
121
|
-
};
|
|
122
89
|
var wrapperStyles = (0, _primitives.xcss)({
|
|
123
90
|
marginBottom: 'space.100'
|
|
124
91
|
});
|
|
@@ -131,16 +98,16 @@ var tooltipWrapperStyles = (0, _primitives.xcss)({
|
|
|
131
98
|
var headingWrapperStyles = (0, _primitives.xcss)({
|
|
132
99
|
position: 'relative'
|
|
133
100
|
});
|
|
134
|
-
var AgentProfileInfo = exports.AgentProfileInfo = function AgentProfileInfo(
|
|
135
|
-
var agentName =
|
|
136
|
-
agentDescription =
|
|
137
|
-
creatorRender =
|
|
138
|
-
starCountRender =
|
|
139
|
-
isStarred =
|
|
140
|
-
isHidden =
|
|
141
|
-
onStarToggle =
|
|
142
|
-
var
|
|
143
|
-
formatMessage =
|
|
101
|
+
var AgentProfileInfo = exports.AgentProfileInfo = function AgentProfileInfo(_ref2) {
|
|
102
|
+
var agentName = _ref2.agentName,
|
|
103
|
+
agentDescription = _ref2.agentDescription,
|
|
104
|
+
creatorRender = _ref2.creatorRender,
|
|
105
|
+
starCountRender = _ref2.starCountRender,
|
|
106
|
+
isStarred = _ref2.isStarred,
|
|
107
|
+
isHidden = _ref2.isHidden,
|
|
108
|
+
onStarToggle = _ref2.onStarToggle;
|
|
109
|
+
var _useIntl2 = (0, _reactIntlNext.useIntl)(),
|
|
110
|
+
formatMessage = _useIntl2.formatMessage;
|
|
144
111
|
return /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
|
|
145
112
|
space: "space.100",
|
|
146
113
|
xcss: wrapperStyles
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { AgentProfileInfo, AgentProfileCreator
|
|
1
|
+
export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
|
|
2
|
+
export { AgentStarCount } from './ui/agent-profile-info/agent-star-count';
|
|
2
3
|
export { StarIconButton } from './common/ui/star-icon-button';
|
|
3
4
|
export { AgentConversationStarters, ConversationStarters, getConversationStarters } from './ui/agent-conversation-starters';
|
|
4
5
|
export { ChatPill, BrowseAgentsPill, ConversationStarterPill } from './common/ui/chat-pill';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import StarIcon from '@atlaskit/icon/utility/migration/star-unstarred--star';
|
|
4
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import Skeleton from '@atlaskit/skeleton';
|
|
6
|
+
import { messages } from './messages';
|
|
7
|
+
import { formatNumber } from './utils';
|
|
8
|
+
const countStyles = xcss({
|
|
9
|
+
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gap: 'space.050',
|
|
13
|
+
paddingInlineStart: 'space.025'
|
|
14
|
+
});
|
|
15
|
+
export const AgentStarCount = ({
|
|
16
|
+
starCount,
|
|
17
|
+
isLoading
|
|
18
|
+
}) => {
|
|
19
|
+
const {
|
|
20
|
+
formatMessage
|
|
21
|
+
} = useIntl();
|
|
22
|
+
if ((starCount === null || starCount === undefined) && !isLoading) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
26
|
+
xcss: countStyles
|
|
27
|
+
}, /*#__PURE__*/React.createElement(StarIcon, {
|
|
28
|
+
LEGACY_margin: `0 ${"var(--ds-space-negative-025, -2px)"}`,
|
|
29
|
+
color: "currentColor",
|
|
30
|
+
label: "",
|
|
31
|
+
LEGACY_size: "small"
|
|
32
|
+
}), isLoading ? /*#__PURE__*/React.createElement(Skeleton, {
|
|
33
|
+
testId: "agent-profile-info-star-count-skeleton",
|
|
34
|
+
isShimmering: true,
|
|
35
|
+
height: 16,
|
|
36
|
+
width: 75,
|
|
37
|
+
borderRadius: 3
|
|
38
|
+
}) : formatMessage(messages.starredCount, {
|
|
39
|
+
starCount: formatNumber(starCount !== null && starCount !== void 0 ? starCount : 0)
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export const messages = defineMessages({
|
|
3
|
+
starredCount: {
|
|
4
|
+
id: 'ai-mate.agent-profile-info.starred-count',
|
|
5
|
+
defaultMessage: '{starCount} {starCount, plural, one {user} other {users}}',
|
|
6
|
+
description: 'Text showing the number of times an agent has been favourited or starred'
|
|
7
|
+
}
|
|
8
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* Example usage
|
|
2
|
+
formatNumber(4100); // Output: "4.1k"
|
|
3
|
+
formatNumber(1234567); // Output: "1.2M"
|
|
4
|
+
formatNumber(9876543210); // Output: "9.9B"
|
|
5
|
+
formatNumber(500); // Output: "500"
|
|
6
|
+
*/
|
|
7
|
+
export const formatNumber = inputNumber => {
|
|
8
|
+
if (inputNumber >= 1e9) {
|
|
9
|
+
return (inputNumber / 1e9).toFixed(1) + 'B';
|
|
10
|
+
} else if (inputNumber >= 1e6) {
|
|
11
|
+
return (inputNumber / 1e6).toFixed(1) + 'M';
|
|
12
|
+
} else if (inputNumber >= 1e3) {
|
|
13
|
+
return (inputNumber / 1e3).toFixed(1) + 'k';
|
|
14
|
+
} else {
|
|
15
|
+
return inputNumber.toString();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import Heading from '@atlaskit/heading';
|
|
4
|
-
import StarIcon from '@atlaskit/icon/utility/migration/star-unstarred--star';
|
|
5
4
|
import { AtlassianIcon, RovoIcon } from '@atlaskit/logo';
|
|
6
5
|
import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
|
|
7
6
|
import Skeleton from '@atlaskit/skeleton';
|
|
@@ -14,13 +13,6 @@ const clickableItemStyles = xcss({
|
|
|
14
13
|
alignItems: 'center',
|
|
15
14
|
gap: 'space.050'
|
|
16
15
|
});
|
|
17
|
-
const countStyles = xcss({
|
|
18
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
19
|
-
display: 'flex',
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
gap: 'space.050',
|
|
22
|
-
paddingInlineStart: 'space.025'
|
|
23
|
-
});
|
|
24
16
|
const nameStyles = xcss({
|
|
25
17
|
justifyContent: 'space-between',
|
|
26
18
|
alignItems: 'flex-start'
|
|
@@ -87,33 +79,6 @@ export const AgentProfileCreator = ({
|
|
|
87
79
|
size: "small"
|
|
88
80
|
}), creatorRender) : null;
|
|
89
81
|
};
|
|
90
|
-
export const AgentStarCount = ({
|
|
91
|
-
starCount,
|
|
92
|
-
isLoading
|
|
93
|
-
}) => {
|
|
94
|
-
const {
|
|
95
|
-
formatMessage
|
|
96
|
-
} = useIntl();
|
|
97
|
-
if ((starCount === null || starCount === undefined) && !isLoading) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
101
|
-
xcss: countStyles
|
|
102
|
-
}, /*#__PURE__*/React.createElement(StarIcon, {
|
|
103
|
-
LEGACY_margin: `0 ${"var(--ds-space-negative-025, -2px)"}`,
|
|
104
|
-
color: "currentColor",
|
|
105
|
-
label: "",
|
|
106
|
-
LEGACY_size: "small"
|
|
107
|
-
}), isLoading ? /*#__PURE__*/React.createElement(Skeleton, {
|
|
108
|
-
testId: "agent-profile-info-star-count-skeleton",
|
|
109
|
-
isShimmering: true,
|
|
110
|
-
height: 16,
|
|
111
|
-
width: 75,
|
|
112
|
-
borderRadius: 3
|
|
113
|
-
}) : formatMessage(messages.starredCount, {
|
|
114
|
-
count: starCount
|
|
115
|
-
}));
|
|
116
|
-
};
|
|
117
82
|
const wrapperStyles = xcss({
|
|
118
83
|
marginBottom: 'space.100'
|
|
119
84
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { AgentProfileInfo, AgentProfileCreator
|
|
1
|
+
export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
|
|
2
|
+
export { AgentStarCount } from './ui/agent-profile-info/agent-star-count';
|
|
2
3
|
export { StarIconButton } from './common/ui/star-icon-button';
|
|
3
4
|
export { AgentConversationStarters, ConversationStarters, getConversationStarters } from './ui/agent-conversation-starters';
|
|
4
5
|
export { ChatPill, BrowseAgentsPill, ConversationStarterPill } from './common/ui/chat-pill';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import StarIcon from '@atlaskit/icon/utility/migration/star-unstarred--star';
|
|
4
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import Skeleton from '@atlaskit/skeleton';
|
|
6
|
+
import { messages } from './messages';
|
|
7
|
+
import { formatNumber } from './utils';
|
|
8
|
+
var countStyles = xcss({
|
|
9
|
+
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gap: 'space.050',
|
|
13
|
+
paddingInlineStart: 'space.025'
|
|
14
|
+
});
|
|
15
|
+
export var AgentStarCount = function AgentStarCount(_ref) {
|
|
16
|
+
var starCount = _ref.starCount,
|
|
17
|
+
isLoading = _ref.isLoading;
|
|
18
|
+
var _useIntl = useIntl(),
|
|
19
|
+
formatMessage = _useIntl.formatMessage;
|
|
20
|
+
if ((starCount === null || starCount === undefined) && !isLoading) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
24
|
+
xcss: countStyles
|
|
25
|
+
}, /*#__PURE__*/React.createElement(StarIcon, {
|
|
26
|
+
LEGACY_margin: "0 ".concat("var(--ds-space-negative-025, -2px)"),
|
|
27
|
+
color: "currentColor",
|
|
28
|
+
label: "",
|
|
29
|
+
LEGACY_size: "small"
|
|
30
|
+
}), isLoading ? /*#__PURE__*/React.createElement(Skeleton, {
|
|
31
|
+
testId: "agent-profile-info-star-count-skeleton",
|
|
32
|
+
isShimmering: true,
|
|
33
|
+
height: 16,
|
|
34
|
+
width: 75,
|
|
35
|
+
borderRadius: 3
|
|
36
|
+
}) : formatMessage(messages.starredCount, {
|
|
37
|
+
starCount: formatNumber(starCount !== null && starCount !== void 0 ? starCount : 0)
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export var messages = defineMessages({
|
|
3
|
+
starredCount: {
|
|
4
|
+
id: 'ai-mate.agent-profile-info.starred-count',
|
|
5
|
+
defaultMessage: '{starCount} {starCount, plural, one {user} other {users}}',
|
|
6
|
+
description: 'Text showing the number of times an agent has been favourited or starred'
|
|
7
|
+
}
|
|
8
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* Example usage
|
|
2
|
+
formatNumber(4100); // Output: "4.1k"
|
|
3
|
+
formatNumber(1234567); // Output: "1.2M"
|
|
4
|
+
formatNumber(9876543210); // Output: "9.9B"
|
|
5
|
+
formatNumber(500); // Output: "500"
|
|
6
|
+
*/
|
|
7
|
+
export var formatNumber = function formatNumber(inputNumber) {
|
|
8
|
+
if (inputNumber >= 1e9) {
|
|
9
|
+
return (inputNumber / 1e9).toFixed(1) + 'B';
|
|
10
|
+
} else if (inputNumber >= 1e6) {
|
|
11
|
+
return (inputNumber / 1e6).toFixed(1) + 'M';
|
|
12
|
+
} else if (inputNumber >= 1e3) {
|
|
13
|
+
return (inputNumber / 1e3).toFixed(1) + 'k';
|
|
14
|
+
} else {
|
|
15
|
+
return inputNumber.toString();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import Heading from '@atlaskit/heading';
|
|
4
|
-
import StarIcon from '@atlaskit/icon/utility/migration/star-unstarred--star';
|
|
5
4
|
import { AtlassianIcon, RovoIcon } from '@atlaskit/logo';
|
|
6
5
|
import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
|
|
7
6
|
import Skeleton from '@atlaskit/skeleton';
|
|
@@ -14,13 +13,6 @@ var clickableItemStyles = xcss({
|
|
|
14
13
|
alignItems: 'center',
|
|
15
14
|
gap: 'space.050'
|
|
16
15
|
});
|
|
17
|
-
var countStyles = xcss({
|
|
18
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
19
|
-
display: 'flex',
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
gap: 'space.050',
|
|
22
|
-
paddingInlineStart: 'space.025'
|
|
23
|
-
});
|
|
24
16
|
var nameStyles = xcss({
|
|
25
17
|
justifyContent: 'space-between',
|
|
26
18
|
alignItems: 'flex-start'
|
|
@@ -87,31 +79,6 @@ export var AgentProfileCreator = function AgentProfileCreator(_ref) {
|
|
|
87
79
|
size: "small"
|
|
88
80
|
}), creatorRender) : null;
|
|
89
81
|
};
|
|
90
|
-
export var AgentStarCount = function AgentStarCount(_ref2) {
|
|
91
|
-
var starCount = _ref2.starCount,
|
|
92
|
-
isLoading = _ref2.isLoading;
|
|
93
|
-
var _useIntl2 = useIntl(),
|
|
94
|
-
formatMessage = _useIntl2.formatMessage;
|
|
95
|
-
if ((starCount === null || starCount === undefined) && !isLoading) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
99
|
-
xcss: countStyles
|
|
100
|
-
}, /*#__PURE__*/React.createElement(StarIcon, {
|
|
101
|
-
LEGACY_margin: "0 ".concat("var(--ds-space-negative-025, -2px)"),
|
|
102
|
-
color: "currentColor",
|
|
103
|
-
label: "",
|
|
104
|
-
LEGACY_size: "small"
|
|
105
|
-
}), isLoading ? /*#__PURE__*/React.createElement(Skeleton, {
|
|
106
|
-
testId: "agent-profile-info-star-count-skeleton",
|
|
107
|
-
isShimmering: true,
|
|
108
|
-
height: 16,
|
|
109
|
-
width: 75,
|
|
110
|
-
borderRadius: 3
|
|
111
|
-
}) : formatMessage(messages.starredCount, {
|
|
112
|
-
count: starCount
|
|
113
|
-
}));
|
|
114
|
-
};
|
|
115
82
|
var wrapperStyles = xcss({
|
|
116
83
|
marginBottom: 'space.100'
|
|
117
84
|
});
|
|
@@ -124,16 +91,16 @@ var tooltipWrapperStyles = xcss({
|
|
|
124
91
|
var headingWrapperStyles = xcss({
|
|
125
92
|
position: 'relative'
|
|
126
93
|
});
|
|
127
|
-
export var AgentProfileInfo = function AgentProfileInfo(
|
|
128
|
-
var agentName =
|
|
129
|
-
agentDescription =
|
|
130
|
-
creatorRender =
|
|
131
|
-
starCountRender =
|
|
132
|
-
isStarred =
|
|
133
|
-
isHidden =
|
|
134
|
-
onStarToggle =
|
|
135
|
-
var
|
|
136
|
-
formatMessage =
|
|
94
|
+
export var AgentProfileInfo = function AgentProfileInfo(_ref2) {
|
|
95
|
+
var agentName = _ref2.agentName,
|
|
96
|
+
agentDescription = _ref2.agentDescription,
|
|
97
|
+
creatorRender = _ref2.creatorRender,
|
|
98
|
+
starCountRender = _ref2.starCountRender,
|
|
99
|
+
isStarred = _ref2.isStarred,
|
|
100
|
+
isHidden = _ref2.isHidden,
|
|
101
|
+
onStarToggle = _ref2.onStarToggle;
|
|
102
|
+
var _useIntl2 = useIntl(),
|
|
103
|
+
formatMessage = _useIntl2.formatMessage;
|
|
137
104
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
138
105
|
space: "space.100",
|
|
139
106
|
xcss: wrapperStyles
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { AgentProfileInfo, AgentProfileCreator
|
|
1
|
+
export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
|
|
2
|
+
export { AgentStarCount } from './ui/agent-profile-info/agent-star-count';
|
|
2
3
|
export { StarIconButton } from './common/ui/star-icon-button';
|
|
3
4
|
export { AgentConversationStarters, ConversationStarters, type AgentConversationStartersProps, type ConversationStarter, type StaticAgentConversationStarter, type ConversationStartersProps, getConversationStarters, } from './ui/agent-conversation-starters';
|
|
4
5
|
export { ChatPill, type ChatPillProps, BrowseAgentsPill, ConversationStarterPill, } from './common/ui/chat-pill';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatNumber: (inputNumber: number) => string;
|
|
@@ -17,10 +17,6 @@ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoad
|
|
|
17
17
|
isLoading: boolean;
|
|
18
18
|
onCreatorLinkClick: () => void;
|
|
19
19
|
}) => JSX.Element | null;
|
|
20
|
-
export declare const AgentStarCount: ({ starCount, isLoading, }: {
|
|
21
|
-
starCount: number | null | undefined;
|
|
22
|
-
isLoading: boolean;
|
|
23
|
-
}) => JSX.Element | null;
|
|
24
20
|
export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCountRender, isStarred, isHidden, onStarToggle, }: {
|
|
25
21
|
agentName: string;
|
|
26
22
|
agentDescription?: string | null | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { AgentProfileInfo, AgentProfileCreator
|
|
1
|
+
export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
|
|
2
|
+
export { AgentStarCount } from './ui/agent-profile-info/agent-star-count';
|
|
2
3
|
export { StarIconButton } from './common/ui/star-icon-button';
|
|
3
4
|
export { AgentConversationStarters, ConversationStarters, type AgentConversationStartersProps, type ConversationStarter, type StaticAgentConversationStarter, type ConversationStartersProps, getConversationStarters, } from './ui/agent-conversation-starters';
|
|
4
5
|
export { ChatPill, type ChatPillProps, BrowseAgentsPill, ConversationStarterPill, } from './common/ui/chat-pill';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatNumber: (inputNumber: number) => string;
|
|
@@ -17,10 +17,6 @@ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoad
|
|
|
17
17
|
isLoading: boolean;
|
|
18
18
|
onCreatorLinkClick: () => void;
|
|
19
19
|
}) => JSX.Element | null;
|
|
20
|
-
export declare const AgentStarCount: ({ starCount, isLoading, }: {
|
|
21
|
-
starCount: number | null | undefined;
|
|
22
|
-
isLoading: boolean;
|
|
23
|
-
}) => JSX.Element | null;
|
|
24
20
|
export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCountRender, isStarred, isHidden, onStarToggle, }: {
|
|
25
21
|
agentName: string;
|
|
26
22
|
agentDescription?: string | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/rovo-agent-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "This package host public components related to rovo agents, the components here are needed for other public atlaskit packages",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@atlaskit/avatar": "^21.17.0",
|
|
41
41
|
"@atlaskit/button": "^20.3.0",
|
|
42
42
|
"@atlaskit/dropdown-menu": "^12.22.0",
|
|
43
|
-
"@atlaskit/heading": "^3.
|
|
43
|
+
"@atlaskit/heading": "^3.1.0",
|
|
44
44
|
"@atlaskit/icon": "^22.24.0",
|
|
45
45
|
"@atlaskit/legacy-custom-icons": "^0.16.0",
|
|
46
46
|
"@atlaskit/logo": "^14.3.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
48
48
|
"@atlaskit/primitives": "^13.2.0",
|
|
49
49
|
"@atlaskit/skeleton": "^1.0.0",
|
|
50
|
-
"@atlaskit/tokens": "^2.
|
|
50
|
+
"@atlaskit/tokens": "^2.3.0",
|
|
51
51
|
"@atlaskit/tooltip": "^18.9.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"react-intl-next": "npm:react-intl@^5.18.1",
|