@atlaskit/rovo-agent-components 0.0.1 → 0.0.2

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/common/ui/star-icon-button/index.js +56 -0
  3. package/dist/cjs/common/ui/star-icon-button/messages.js +19 -0
  4. package/dist/cjs/index.js +20 -4
  5. package/dist/cjs/ui/agent-profile-info/index.js +117 -0
  6. package/dist/cjs/ui/agent-profile-info/messages.js +19 -0
  7. package/dist/es2019/common/ui/star-icon-button/index.js +39 -0
  8. package/dist/es2019/common/ui/star-icon-button/messages.js +13 -0
  9. package/dist/es2019/index.js +2 -1
  10. package/dist/es2019/ui/agent-profile-info/index.js +112 -0
  11. package/dist/es2019/ui/agent-profile-info/messages.js +13 -0
  12. package/dist/esm/common/ui/star-icon-button/index.js +46 -0
  13. package/dist/esm/common/ui/star-icon-button/messages.js +13 -0
  14. package/dist/esm/index.js +2 -3
  15. package/dist/esm/ui/agent-profile-info/index.js +110 -0
  16. package/dist/esm/ui/agent-profile-info/messages.js +13 -0
  17. package/dist/types/common/ui/star-icon-button/index.d.ts +6 -0
  18. package/dist/types/common/ui/star-icon-button/messages.d.ts +13 -0
  19. package/dist/types/index.d.ts +2 -2
  20. package/dist/types/ui/agent-profile-info/index.d.ts +17 -0
  21. package/dist/types/ui/agent-profile-info/messages.d.ts +12 -0
  22. package/dist/types-ts4.5/common/ui/star-icon-button/index.d.ts +6 -0
  23. package/dist/types-ts4.5/common/ui/star-icon-button/messages.d.ts +13 -0
  24. package/dist/types-ts4.5/index.d.ts +2 -2
  25. package/dist/types-ts4.5/ui/agent-profile-info/index.d.ts +17 -0
  26. package/dist/types-ts4.5/ui/agent-profile-info/messages.d.ts +12 -0
  27. package/package.json +9 -2
package/CHANGELOG.md CHANGED
@@ -1 +1,8 @@
1
1
  # @atlaskit/rovo-agent-components
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b52fe103ff593`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b52fe103ff593) -
8
+ Extracting AgentProfileInfo to atlaskit component and fixing ARI utils
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.StarIconButton = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _reactIntlNext = require("react-intl-next");
12
+ var _star = _interopRequireDefault(require("@atlaskit/icon/glyph/star"));
13
+ var _starFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/star-filled"));
14
+ var _primitives = require("@atlaskit/primitives");
15
+ var _messages = _interopRequireDefault(require("./messages"));
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+ var pressableStarIconStyles = (0, _primitives.xcss)({
19
+ background: 'transparent',
20
+ padding: 'space.0',
21
+ height: '32px',
22
+ width: '32px'
23
+ });
24
+ var hiddenStyles = (0, _primitives.xcss)({
25
+ opacity: 0
26
+ });
27
+ var StarIconButton = exports.StarIconButton = function StarIconButton(_ref) {
28
+ var isStarred = _ref.isStarred,
29
+ handleToggle = _ref.handleToggle,
30
+ _ref$visible = _ref.visible,
31
+ visible = _ref$visible === void 0 ? true : _ref$visible;
32
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
33
+ formatMessage = _useIntl.formatMessage;
34
+ var _useState = (0, _react.useState)(false),
35
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
36
+ isHovered = _useState2[0],
37
+ setIsHovered = _useState2[1];
38
+ return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
39
+ xcss: [pressableStarIconStyles, !visible && hiddenStyles],
40
+ onClick: handleToggle,
41
+ onMouseEnter: function onMouseEnter() {
42
+ return setIsHovered(true);
43
+ },
44
+ onMouseLeave: function onMouseLeave() {
45
+ return setIsHovered(false);
46
+ }
47
+ }, isStarred || isHovered ? /*#__PURE__*/_react.default.createElement(_starFilled.default, {
48
+ size: "medium",
49
+ label: formatMessage(_messages.default.removeFromFavouritesLabel),
50
+ primaryColor: "var(--ds-background-accent-yellow-subtler-pressed, #E2B203)"
51
+ }) : /*#__PURE__*/_react.default.createElement(_star.default, {
52
+ size: "medium",
53
+ label: formatMessage(_messages.default.clickToFavouriteLabel),
54
+ primaryColor: "var(--ds-background-accent-gray-bolder-hovered, #44546F)"
55
+ }));
56
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactIntlNext = require("react-intl-next");
8
+ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
9
+ removeFromFavouritesLabel: {
10
+ id: 'rovo-chat.browse-agents.remove-from-favourites-label',
11
+ defaultMessage: 'Remove from favourites',
12
+ description: 'Remove from favourites label'
13
+ },
14
+ clickToFavouriteLabel: {
15
+ id: 'rovo-chat.browse-agents.click-to-favourite-label',
16
+ defaultMessage: 'Not favourited, click to favourite',
17
+ description: 'Click to favourite agent label'
18
+ }
19
+ });
package/dist/cjs/index.js CHANGED
@@ -3,7 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
- var _default = exports.default = function _default() {
8
- return 'Test';
9
- };
6
+ Object.defineProperty(exports, "AgentProfileCreator", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _agentProfileInfo.AgentProfileCreator;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "AgentProfileInfo", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _agentProfileInfo.AgentProfileInfo;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "StarIconButton", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _starIconButton.StarIconButton;
22
+ }
23
+ });
24
+ var _agentProfileInfo = require("./ui/agent-profile-info");
25
+ var _starIconButton = require("./common/ui/star-icon-button");
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AgentProfileInfo = exports.AgentProfileCreator = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _heading = _interopRequireDefault(require("@atlaskit/heading"));
11
+ var _star = _interopRequireDefault(require("@atlaskit/icon/glyph/star"));
12
+ var _logo = require("@atlaskit/logo");
13
+ var _primitives = require("@atlaskit/primitives");
14
+ var _skeleton = _interopRequireDefault(require("@atlaskit/skeleton"));
15
+ var _starIconButton = require("../../common/ui/star-icon-button");
16
+ var _messages = require("./messages");
17
+ var clickableItemStyles = (0, _primitives.xcss)({
18
+ display: 'flex',
19
+ alignItems: 'center',
20
+ gap: 'space.050'
21
+ });
22
+ var countStyles = (0, _primitives.xcss)({
23
+ fontSize: '11px',
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ gap: 'space.025'
27
+ });
28
+ var nameStyles = (0, _primitives.xcss)({
29
+ justifyContent: 'space-between',
30
+ alignItems: 'flex-start'
31
+ });
32
+ var descriptionStyles = (0, _primitives.xcss)({
33
+ marginTop: 'space.0',
34
+ marginBottom: 'space.100'
35
+ });
36
+ var AgentProfileCreator = exports.AgentProfileCreator = function AgentProfileCreator(_ref) {
37
+ var creator = _ref.creator,
38
+ onCreatorLinkClick = _ref.onCreatorLinkClick,
39
+ isLoading = _ref.isLoading;
40
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
41
+ formatMessage = _useIntl.formatMessage;
42
+ var getCreatorRender = function getCreatorRender() {
43
+ if (isLoading) {
44
+ return formatMessage(_messages.messages.agentCreatedBy, {
45
+ creatorNameWithLink: /*#__PURE__*/_react.default.createElement(_skeleton.default, {
46
+ testId: "agent-profile-creator-skeleton",
47
+ isShimmering: true,
48
+ height: 18,
49
+ width: 100,
50
+ borderRadius: 3
51
+ })
52
+ });
53
+ }
54
+ if (!creator) {
55
+ return null;
56
+ }
57
+ if (creator === 'SYSTEM') {
58
+ return formatMessage(_messages.messages.agentCreatedBy, {
59
+ creatorNameWithLink: /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
60
+ alignBlock: "center",
61
+ testId: "atlassian-icon"
62
+ }, /*#__PURE__*/_react.default.createElement(_logo.AtlassianIcon, {
63
+ size: "small",
64
+ appearance: "brand"
65
+ }), /*#__PURE__*/_react.default.createElement(_primitives.Box, null, "Atlassian"))
66
+ });
67
+ }
68
+ return formatMessage(_messages.messages.agentCreatedBy, {
69
+ creatorNameWithLink: /*#__PURE__*/_react.default.createElement("a", {
70
+ href: creator.profileLink,
71
+ onClick: function onClick() {
72
+ return onCreatorLinkClick();
73
+ },
74
+ target: "_blank"
75
+ }, creator.name)
76
+ });
77
+ };
78
+ var creatorRender = getCreatorRender();
79
+ return creatorRender ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
80
+ xcss: clickableItemStyles
81
+ }, /*#__PURE__*/_react.default.createElement(_logo.RovoIcon, {
82
+ appearance: "brand",
83
+ size: "small"
84
+ }), creatorRender) : null;
85
+ };
86
+ var AgentProfileInfo = exports.AgentProfileInfo = function AgentProfileInfo(_ref2) {
87
+ var agentName = _ref2.agentName,
88
+ agentDescription = _ref2.agentDescription,
89
+ creatorRender = _ref2.creatorRender,
90
+ starCount = _ref2.starCount,
91
+ isStarred = _ref2.isStarred,
92
+ onStarToggle = _ref2.onStarToggle;
93
+ var _useIntl2 = (0, _reactIntlNext.useIntl)(),
94
+ formatMessage = _useIntl2.formatMessage;
95
+ return /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
96
+ space: "space.100"
97
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
98
+ xcss: nameStyles,
99
+ space: "space.100",
100
+ alignBlock: "center"
101
+ }, /*#__PURE__*/_react.default.createElement(_heading.default, {
102
+ size: "xlarge"
103
+ }, agentName), /*#__PURE__*/_react.default.createElement(_starIconButton.StarIconButton, {
104
+ isStarred: isStarred,
105
+ handleToggle: onStarToggle
106
+ })), creatorRender, !!agentDescription && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
107
+ xcss: descriptionStyles,
108
+ as: "p"
109
+ }, agentDescription), starCount !== 0 && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
110
+ xcss: countStyles
111
+ }, /*#__PURE__*/_react.default.createElement(_star.default, {
112
+ label: "",
113
+ size: "small"
114
+ }), formatMessage(_messages.messages.starredCount, {
115
+ count: starCount
116
+ })));
117
+ };
@@ -0,0 +1,19 @@
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
+ agentCreatedBy: {
10
+ id: 'ai-mate.agent-profile-info.created-by',
11
+ defaultMessage: 'Rovo agent by {creatorNameWithLink}',
12
+ description: 'Message to show who created this Rovo agent'
13
+ },
14
+ starredCount: {
15
+ id: 'ai-mate.agent-profile-info.starred-count',
16
+ defaultMessage: '{count} starred',
17
+ description: 'Message to show how many times this agent has been starred by users'
18
+ }
19
+ });
@@ -0,0 +1,39 @@
1
+ import React, { useState } from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import StarIcon from '@atlaskit/icon/glyph/star';
4
+ import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
5
+ import { Pressable, xcss } from '@atlaskit/primitives';
6
+ import messages from './messages';
7
+ const pressableStarIconStyles = xcss({
8
+ background: 'transparent',
9
+ padding: 'space.0',
10
+ height: '32px',
11
+ width: '32px'
12
+ });
13
+ const hiddenStyles = xcss({
14
+ opacity: 0
15
+ });
16
+ export const StarIconButton = ({
17
+ isStarred,
18
+ handleToggle,
19
+ visible = true
20
+ }) => {
21
+ const {
22
+ formatMessage
23
+ } = useIntl();
24
+ const [isHovered, setIsHovered] = useState(false);
25
+ return /*#__PURE__*/React.createElement(Pressable, {
26
+ xcss: [pressableStarIconStyles, !visible && hiddenStyles],
27
+ onClick: handleToggle,
28
+ onMouseEnter: () => setIsHovered(true),
29
+ onMouseLeave: () => setIsHovered(false)
30
+ }, isStarred || isHovered ? /*#__PURE__*/React.createElement(StarFilledIcon, {
31
+ size: "medium",
32
+ label: formatMessage(messages.removeFromFavouritesLabel),
33
+ primaryColor: "var(--ds-background-accent-yellow-subtler-pressed, #E2B203)"
34
+ }) : /*#__PURE__*/React.createElement(StarIcon, {
35
+ size: "medium",
36
+ label: formatMessage(messages.clickToFavouriteLabel),
37
+ primaryColor: "var(--ds-background-accent-gray-bolder-hovered, #44546F)"
38
+ }));
39
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export default defineMessages({
3
+ removeFromFavouritesLabel: {
4
+ id: 'rovo-chat.browse-agents.remove-from-favourites-label',
5
+ defaultMessage: 'Remove from favourites',
6
+ description: 'Remove from favourites label'
7
+ },
8
+ clickToFavouriteLabel: {
9
+ id: 'rovo-chat.browse-agents.click-to-favourite-label',
10
+ defaultMessage: 'Not favourited, click to favourite',
11
+ description: 'Click to favourite agent label'
12
+ }
13
+ });
@@ -1 +1,2 @@
1
- export default (() => 'Test');
1
+ export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,112 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import Heading from '@atlaskit/heading';
4
+ import StarIcon from '@atlaskit/icon/glyph/star';
5
+ import { AtlassianIcon, RovoIcon } from '@atlaskit/logo';
6
+ import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
7
+ import Skeleton from '@atlaskit/skeleton';
8
+ import { StarIconButton } from '../../common/ui/star-icon-button';
9
+ import { messages } from './messages';
10
+ const clickableItemStyles = xcss({
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ gap: 'space.050'
14
+ });
15
+ const countStyles = xcss({
16
+ fontSize: '11px',
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ gap: 'space.025'
20
+ });
21
+ const nameStyles = xcss({
22
+ justifyContent: 'space-between',
23
+ alignItems: 'flex-start'
24
+ });
25
+ const descriptionStyles = xcss({
26
+ marginTop: 'space.0',
27
+ marginBottom: 'space.100'
28
+ });
29
+ export const AgentProfileCreator = ({
30
+ creator,
31
+ onCreatorLinkClick,
32
+ isLoading: isLoading
33
+ }) => {
34
+ const {
35
+ formatMessage
36
+ } = useIntl();
37
+ const getCreatorRender = () => {
38
+ if (isLoading) {
39
+ return formatMessage(messages.agentCreatedBy, {
40
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Skeleton, {
41
+ testId: "agent-profile-creator-skeleton",
42
+ isShimmering: true,
43
+ height: 18,
44
+ width: 100,
45
+ borderRadius: 3
46
+ })
47
+ });
48
+ }
49
+ if (!creator) {
50
+ return null;
51
+ }
52
+ if (creator === 'SYSTEM') {
53
+ return formatMessage(messages.agentCreatedBy, {
54
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Inline, {
55
+ alignBlock: "center",
56
+ testId: "atlassian-icon"
57
+ }, /*#__PURE__*/React.createElement(AtlassianIcon, {
58
+ size: "small",
59
+ appearance: "brand"
60
+ }), /*#__PURE__*/React.createElement(Box, null, "Atlassian"))
61
+ });
62
+ }
63
+ return formatMessage(messages.agentCreatedBy, {
64
+ creatorNameWithLink: /*#__PURE__*/React.createElement("a", {
65
+ href: creator.profileLink,
66
+ onClick: () => onCreatorLinkClick(),
67
+ target: "_blank"
68
+ }, creator.name)
69
+ });
70
+ };
71
+ const creatorRender = getCreatorRender();
72
+ return creatorRender ? /*#__PURE__*/React.createElement(Box, {
73
+ xcss: clickableItemStyles
74
+ }, /*#__PURE__*/React.createElement(RovoIcon, {
75
+ appearance: "brand",
76
+ size: "small"
77
+ }), creatorRender) : null;
78
+ };
79
+ export const AgentProfileInfo = ({
80
+ agentName,
81
+ agentDescription,
82
+ creatorRender,
83
+ starCount,
84
+ isStarred,
85
+ onStarToggle
86
+ }) => {
87
+ const {
88
+ formatMessage
89
+ } = useIntl();
90
+ return /*#__PURE__*/React.createElement(Stack, {
91
+ space: "space.100"
92
+ }, /*#__PURE__*/React.createElement(Inline, {
93
+ xcss: nameStyles,
94
+ space: "space.100",
95
+ alignBlock: "center"
96
+ }, /*#__PURE__*/React.createElement(Heading, {
97
+ size: "xlarge"
98
+ }, agentName), /*#__PURE__*/React.createElement(StarIconButton, {
99
+ isStarred: isStarred,
100
+ handleToggle: onStarToggle
101
+ })), creatorRender, !!agentDescription && /*#__PURE__*/React.createElement(Box, {
102
+ xcss: descriptionStyles,
103
+ as: "p"
104
+ }, agentDescription), starCount !== 0 && /*#__PURE__*/React.createElement(Box, {
105
+ xcss: countStyles
106
+ }, /*#__PURE__*/React.createElement(StarIcon, {
107
+ label: "",
108
+ size: "small"
109
+ }), formatMessage(messages.starredCount, {
110
+ count: starCount
111
+ })));
112
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export const messages = defineMessages({
3
+ agentCreatedBy: {
4
+ id: 'ai-mate.agent-profile-info.created-by',
5
+ defaultMessage: 'Rovo agent by {creatorNameWithLink}',
6
+ description: 'Message to show who created this Rovo agent'
7
+ },
8
+ starredCount: {
9
+ id: 'ai-mate.agent-profile-info.starred-count',
10
+ defaultMessage: '{count} starred',
11
+ description: 'Message to show how many times this agent has been starred by users'
12
+ }
13
+ });
@@ -0,0 +1,46 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useState } from 'react';
3
+ import { useIntl } from 'react-intl-next';
4
+ import StarIcon from '@atlaskit/icon/glyph/star';
5
+ import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
6
+ import { Pressable, xcss } from '@atlaskit/primitives';
7
+ import messages from './messages';
8
+ var pressableStarIconStyles = xcss({
9
+ background: 'transparent',
10
+ padding: 'space.0',
11
+ height: '32px',
12
+ width: '32px'
13
+ });
14
+ var hiddenStyles = xcss({
15
+ opacity: 0
16
+ });
17
+ export var StarIconButton = function StarIconButton(_ref) {
18
+ var isStarred = _ref.isStarred,
19
+ handleToggle = _ref.handleToggle,
20
+ _ref$visible = _ref.visible,
21
+ visible = _ref$visible === void 0 ? true : _ref$visible;
22
+ var _useIntl = useIntl(),
23
+ formatMessage = _useIntl.formatMessage;
24
+ var _useState = useState(false),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ isHovered = _useState2[0],
27
+ setIsHovered = _useState2[1];
28
+ return /*#__PURE__*/React.createElement(Pressable, {
29
+ xcss: [pressableStarIconStyles, !visible && hiddenStyles],
30
+ onClick: handleToggle,
31
+ onMouseEnter: function onMouseEnter() {
32
+ return setIsHovered(true);
33
+ },
34
+ onMouseLeave: function onMouseLeave() {
35
+ return setIsHovered(false);
36
+ }
37
+ }, isStarred || isHovered ? /*#__PURE__*/React.createElement(StarFilledIcon, {
38
+ size: "medium",
39
+ label: formatMessage(messages.removeFromFavouritesLabel),
40
+ primaryColor: "var(--ds-background-accent-yellow-subtler-pressed, #E2B203)"
41
+ }) : /*#__PURE__*/React.createElement(StarIcon, {
42
+ size: "medium",
43
+ label: formatMessage(messages.clickToFavouriteLabel),
44
+ primaryColor: "var(--ds-background-accent-gray-bolder-hovered, #44546F)"
45
+ }));
46
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export default defineMessages({
3
+ removeFromFavouritesLabel: {
4
+ id: 'rovo-chat.browse-agents.remove-from-favourites-label',
5
+ defaultMessage: 'Remove from favourites',
6
+ description: 'Remove from favourites label'
7
+ },
8
+ clickToFavouriteLabel: {
9
+ id: 'rovo-chat.browse-agents.click-to-favourite-label',
10
+ defaultMessage: 'Not favourited, click to favourite',
11
+ description: 'Click to favourite agent label'
12
+ }
13
+ });
package/dist/esm/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export default (function () {
2
- return 'Test';
3
- });
1
+ export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,110 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import Heading from '@atlaskit/heading';
4
+ import StarIcon from '@atlaskit/icon/glyph/star';
5
+ import { AtlassianIcon, RovoIcon } from '@atlaskit/logo';
6
+ import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
7
+ import Skeleton from '@atlaskit/skeleton';
8
+ import { StarIconButton } from '../../common/ui/star-icon-button';
9
+ import { messages } from './messages';
10
+ var clickableItemStyles = xcss({
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ gap: 'space.050'
14
+ });
15
+ var countStyles = xcss({
16
+ fontSize: '11px',
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ gap: 'space.025'
20
+ });
21
+ var nameStyles = xcss({
22
+ justifyContent: 'space-between',
23
+ alignItems: 'flex-start'
24
+ });
25
+ var descriptionStyles = xcss({
26
+ marginTop: 'space.0',
27
+ marginBottom: 'space.100'
28
+ });
29
+ export var AgentProfileCreator = function AgentProfileCreator(_ref) {
30
+ var creator = _ref.creator,
31
+ onCreatorLinkClick = _ref.onCreatorLinkClick,
32
+ isLoading = _ref.isLoading;
33
+ var _useIntl = useIntl(),
34
+ formatMessage = _useIntl.formatMessage;
35
+ var getCreatorRender = function getCreatorRender() {
36
+ if (isLoading) {
37
+ return formatMessage(messages.agentCreatedBy, {
38
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Skeleton, {
39
+ testId: "agent-profile-creator-skeleton",
40
+ isShimmering: true,
41
+ height: 18,
42
+ width: 100,
43
+ borderRadius: 3
44
+ })
45
+ });
46
+ }
47
+ if (!creator) {
48
+ return null;
49
+ }
50
+ if (creator === 'SYSTEM') {
51
+ return formatMessage(messages.agentCreatedBy, {
52
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Inline, {
53
+ alignBlock: "center",
54
+ testId: "atlassian-icon"
55
+ }, /*#__PURE__*/React.createElement(AtlassianIcon, {
56
+ size: "small",
57
+ appearance: "brand"
58
+ }), /*#__PURE__*/React.createElement(Box, null, "Atlassian"))
59
+ });
60
+ }
61
+ return formatMessage(messages.agentCreatedBy, {
62
+ creatorNameWithLink: /*#__PURE__*/React.createElement("a", {
63
+ href: creator.profileLink,
64
+ onClick: function onClick() {
65
+ return onCreatorLinkClick();
66
+ },
67
+ target: "_blank"
68
+ }, creator.name)
69
+ });
70
+ };
71
+ var creatorRender = getCreatorRender();
72
+ return creatorRender ? /*#__PURE__*/React.createElement(Box, {
73
+ xcss: clickableItemStyles
74
+ }, /*#__PURE__*/React.createElement(RovoIcon, {
75
+ appearance: "brand",
76
+ size: "small"
77
+ }), creatorRender) : null;
78
+ };
79
+ export var AgentProfileInfo = function AgentProfileInfo(_ref2) {
80
+ var agentName = _ref2.agentName,
81
+ agentDescription = _ref2.agentDescription,
82
+ creatorRender = _ref2.creatorRender,
83
+ starCount = _ref2.starCount,
84
+ isStarred = _ref2.isStarred,
85
+ onStarToggle = _ref2.onStarToggle;
86
+ var _useIntl2 = useIntl(),
87
+ formatMessage = _useIntl2.formatMessage;
88
+ return /*#__PURE__*/React.createElement(Stack, {
89
+ space: "space.100"
90
+ }, /*#__PURE__*/React.createElement(Inline, {
91
+ xcss: nameStyles,
92
+ space: "space.100",
93
+ alignBlock: "center"
94
+ }, /*#__PURE__*/React.createElement(Heading, {
95
+ size: "xlarge"
96
+ }, agentName), /*#__PURE__*/React.createElement(StarIconButton, {
97
+ isStarred: isStarred,
98
+ handleToggle: onStarToggle
99
+ })), creatorRender, !!agentDescription && /*#__PURE__*/React.createElement(Box, {
100
+ xcss: descriptionStyles,
101
+ as: "p"
102
+ }, agentDescription), starCount !== 0 && /*#__PURE__*/React.createElement(Box, {
103
+ xcss: countStyles
104
+ }, /*#__PURE__*/React.createElement(StarIcon, {
105
+ label: "",
106
+ size: "small"
107
+ }), formatMessage(messages.starredCount, {
108
+ count: starCount
109
+ })));
110
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var messages = defineMessages({
3
+ agentCreatedBy: {
4
+ id: 'ai-mate.agent-profile-info.created-by',
5
+ defaultMessage: 'Rovo agent by {creatorNameWithLink}',
6
+ description: 'Message to show who created this Rovo agent'
7
+ },
8
+ starredCount: {
9
+ id: 'ai-mate.agent-profile-info.starred-count',
10
+ defaultMessage: '{count} starred',
11
+ description: 'Message to show how many times this agent has been starred by users'
12
+ }
13
+ });
@@ -0,0 +1,6 @@
1
+ import { type KeyboardEvent, type MouseEvent } from 'react';
2
+ export declare const StarIconButton: ({ isStarred, handleToggle, visible, }: {
3
+ isStarred: boolean;
4
+ handleToggle: (e: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element>) => void;
5
+ visible?: boolean | undefined;
6
+ }) => JSX.Element;
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ removeFromFavouritesLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ clickToFavouriteLabel: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
13
+ export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: () => string;
2
- export default _default;
1
+ export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoading: isLoading, }: {
3
+ creator?: {
4
+ name: string;
5
+ profileLink: string;
6
+ } | "SYSTEM" | undefined;
7
+ isLoading: boolean;
8
+ onCreatorLinkClick: () => void;
9
+ }) => JSX.Element | null;
10
+ export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCount, isStarred, onStarToggle, }: {
11
+ agentName: string;
12
+ agentDescription?: string | null | undefined;
13
+ creatorRender: React.ReactNode;
14
+ starCount: number;
15
+ isStarred: boolean;
16
+ onStarToggle: () => void;
17
+ }) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ export declare const messages: {
2
+ agentCreatedBy: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ starredCount: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
@@ -0,0 +1,6 @@
1
+ import { type KeyboardEvent, type MouseEvent } from 'react';
2
+ export declare const StarIconButton: ({ isStarred, handleToggle, visible, }: {
3
+ isStarred: boolean;
4
+ handleToggle: (e: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element>) => void;
5
+ visible?: boolean | undefined;
6
+ }) => JSX.Element;
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ removeFromFavouritesLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ clickToFavouriteLabel: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
13
+ export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: () => string;
2
- export default _default;
1
+ export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoading: isLoading, }: {
3
+ creator?: {
4
+ name: string;
5
+ profileLink: string;
6
+ } | "SYSTEM" | undefined;
7
+ isLoading: boolean;
8
+ onCreatorLinkClick: () => void;
9
+ }) => JSX.Element | null;
10
+ export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCount, isStarred, onStarToggle, }: {
11
+ agentName: string;
12
+ agentDescription?: string | null | undefined;
13
+ creatorRender: React.ReactNode;
14
+ starCount: number;
15
+ isStarred: boolean;
16
+ onStarToggle: () => void;
17
+ }) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ export declare const messages: {
2
+ agentCreatedBy: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ starredCount: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-agent-components",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
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",
@@ -36,7 +36,14 @@
36
36
  ".": "./src/index.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@babel/runtime": "^7.0.0"
39
+ "@atlaskit/heading": "^2.4.3",
40
+ "@atlaskit/icon": "^22.7.0",
41
+ "@atlaskit/logo": "^14.1.0",
42
+ "@atlaskit/primitives": "^11.1.0",
43
+ "@atlaskit/skeleton": "^0.4.0",
44
+ "@atlaskit/tokens": "^1.56.0",
45
+ "@babel/runtime": "^7.0.0",
46
+ "react-intl-next": "npm:react-intl@^5.18.1"
40
47
  },
41
48
  "peerDependencies": {
42
49
  "react": "^16.8.0"