@pingux/astro 2.106.0-alpha.2 → 2.106.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/lib/cjs/components/AIComponents/Suggestions/Suggestion.d.ts +4 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestion.js +46 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestions.d.ts +4 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestions.js +42 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestions.stories.d.ts +8 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestions.stories.js +49 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestions.test.d.ts +1 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestions.test.js +47 -0
- package/lib/cjs/components/AIComponents/Suggestions/index.d.ts +2 -0
- package/lib/cjs/components/AIComponents/Suggestions/index.js +21 -0
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +15 -0
- package/lib/cjs/styles/themes/next-gen/colors/colors.d.ts +1 -0
- package/lib/cjs/styles/themes/next-gen/colors/colors.js +2 -1
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +55 -0
- package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +38 -0
- package/lib/cjs/styles/themes/next-gen/variants/cards.js +27 -1
- package/lib/cjs/styles/themes/next-gen/variants/suggestion.d.ts +8 -0
- package/lib/cjs/styles/themes/next-gen/variants/suggestion.js +16 -0
- package/lib/cjs/styles/themes/next-gen/variants/suggestions.d.ts +10 -0
- package/lib/cjs/styles/themes/next-gen/variants/suggestions.js +17 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +16 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +4 -0
- package/lib/cjs/types/suggestions.d.ts +13 -0
- package/lib/cjs/types/suggestions.js +6 -0
- package/lib/components/AIComponents/Suggestions/Suggestion.js +37 -0
- package/lib/components/AIComponents/Suggestions/Suggestions.js +28 -0
- package/lib/components/AIComponents/Suggestions/Suggestions.stories.js +38 -0
- package/lib/components/AIComponents/Suggestions/Suggestions.test.js +44 -0
- package/lib/components/AIComponents/Suggestions/index.js +2 -0
- package/lib/index.js +2 -0
- package/lib/styles/themes/next-gen/colors/colors.js +2 -1
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/styles/themes/next-gen/variants/cards.js +27 -1
- package/lib/styles/themes/next-gen/variants/suggestion.js +8 -0
- package/lib/styles/themes/next-gen/variants/suggestions.js +9 -0
- package/lib/styles/themes/next-gen/variants/variants.js +4 -0
- package/lib/types/suggestions.js +1 -0
- package/package.json +1 -1
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports["default"] = void 0;
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
12
|
+
var _PlusIcon = _interopRequireDefault(require("@pingux/mdi-react/PlusIcon"));
|
13
|
+
var _index = require("../../../index");
|
14
|
+
var _react2 = require("@emotion/react");
|
15
|
+
var _excluded = ["isFullScreen", "text", "textProps", "iconProps"];
|
16
|
+
var Suggestion = function Suggestion(props) {
|
17
|
+
var isFullScreen = props.isFullScreen,
|
18
|
+
text = props.text,
|
19
|
+
textProps = props.textProps,
|
20
|
+
iconProps = props.iconProps,
|
21
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
22
|
+
if (isFullScreen) {
|
23
|
+
return (0, _react2.jsx)(_index.Card, (0, _extends2["default"])({
|
24
|
+
variant: "cards.suggestionColumn",
|
25
|
+
tabIndex: "0"
|
26
|
+
}, others), (0, _react2.jsx)(_index.Icon, (0, _extends2["default"])({
|
27
|
+
icon: _PlusIcon["default"]
|
28
|
+
}, iconProps)), (0, _react2.jsx)(_index.Text, (0, _extends2["default"])({
|
29
|
+
variant: "suggestion"
|
30
|
+
}, textProps), text));
|
31
|
+
}
|
32
|
+
return (0, _react2.jsx)(_index.Card, (0, _extends2["default"])({
|
33
|
+
variant: "cards.suggestionRow",
|
34
|
+
isRow: true,
|
35
|
+
alignItems: "center",
|
36
|
+
tabIndex: "0"
|
37
|
+
}, others), (0, _react2.jsx)(_index.Text, (0, _extends2["default"])({
|
38
|
+
variant: "suggestion"
|
39
|
+
}, textProps), text), (0, _react2.jsx)(_index.Box, {
|
40
|
+
variant: "suggestion.iconContainer"
|
41
|
+
}, (0, _react2.jsx)(_index.Icon, (0, _extends2["default"])({
|
42
|
+
icon: _PlusIcon["default"]
|
43
|
+
}, iconProps))));
|
44
|
+
};
|
45
|
+
var _default = Suggestion;
|
46
|
+
exports["default"] = _default;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
8
|
+
_Object$defineProperty(exports, "__esModule", {
|
9
|
+
value: true
|
10
|
+
});
|
11
|
+
exports["default"] = void 0;
|
12
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
16
|
+
var _hooks = require("../../../hooks");
|
17
|
+
var _index = require("../../../index");
|
18
|
+
var _react2 = require("@emotion/react");
|
19
|
+
var _excluded = ["children", "isFullScreen", "className"];
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
|
+
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; }
|
22
|
+
var Suggestions = function Suggestions(props) {
|
23
|
+
var children = props.children,
|
24
|
+
isFullScreen = props.isFullScreen,
|
25
|
+
className = props.className,
|
26
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
27
|
+
var _useStatusClasses = (0, _hooks.useStatusClasses)(className, {
|
28
|
+
isFullScreen: isFullScreen
|
29
|
+
}),
|
30
|
+
classNames = _useStatusClasses.classNames;
|
31
|
+
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, others, {
|
32
|
+
className: classNames,
|
33
|
+
isRow: isFullScreen,
|
34
|
+
variant: "suggestions"
|
35
|
+
}), (0, _map["default"])(_react.Children).call(_react.Children, children, function (child) {
|
36
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].cloneElement(child, {
|
37
|
+
isFullScreen: isFullScreen
|
38
|
+
}));
|
39
|
+
}));
|
40
|
+
};
|
41
|
+
var _default = Suggestions;
|
42
|
+
exports["default"] = _default;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
component: (props: import("../../../types/suggestions").SuggestionsProps) => React.JSX.Element;
|
5
|
+
};
|
6
|
+
export default _default;
|
7
|
+
export declare const Default: () => React.JSX.Element;
|
8
|
+
export declare const FullScreen: () => React.JSX.Element;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports["default"] = exports.FullScreen = exports.Default = void 0;
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
10
|
+
var _index = require("../../../index");
|
11
|
+
var _Suggestion = _interopRequireDefault(require("./Suggestion"));
|
12
|
+
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
13
|
+
var _react2 = require("@emotion/react");
|
14
|
+
var _default = {
|
15
|
+
title: 'Ai Components/Suggestions',
|
16
|
+
component: _Suggestions["default"]
|
17
|
+
};
|
18
|
+
exports["default"] = _default;
|
19
|
+
var lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
|
20
|
+
var Default = function Default() {
|
21
|
+
return (0, _react2.jsx)(_index.AstroWrapper, {
|
22
|
+
theme: _index.NextGenTheme
|
23
|
+
}, (0, _react2.jsx)(_Suggestions["default"], null, (0, _react2.jsx)(_Suggestion["default"], {
|
24
|
+
text: lorem
|
25
|
+
}), (0, _react2.jsx)(_Suggestion["default"], {
|
26
|
+
text: lorem
|
27
|
+
}), (0, _react2.jsx)(_Suggestion["default"], {
|
28
|
+
text: lorem
|
29
|
+
}), (0, _react2.jsx)(_Suggestion["default"], {
|
30
|
+
text: lorem
|
31
|
+
})));
|
32
|
+
};
|
33
|
+
exports.Default = Default;
|
34
|
+
var FullScreen = function FullScreen() {
|
35
|
+
return (0, _react2.jsx)(_index.AstroWrapper, {
|
36
|
+
theme: _index.NextGenTheme
|
37
|
+
}, (0, _react2.jsx)(_Suggestions["default"], {
|
38
|
+
isFullScreen: true
|
39
|
+
}, (0, _react2.jsx)(_Suggestion["default"], {
|
40
|
+
text: lorem
|
41
|
+
}), (0, _react2.jsx)(_Suggestion["default"], {
|
42
|
+
text: lorem
|
43
|
+
}), (0, _react2.jsx)(_Suggestion["default"], {
|
44
|
+
text: lorem
|
45
|
+
}), (0, _react2.jsx)(_Suggestion["default"], {
|
46
|
+
text: lorem
|
47
|
+
})));
|
48
|
+
};
|
49
|
+
exports.FullScreen = FullScreen;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
5
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
7
|
+
var _ = require("../../..");
|
8
|
+
var _testWrapper = require("../../../utils/testUtils/testWrapper");
|
9
|
+
var _Suggestion = _interopRequireDefault(require("./Suggestion"));
|
10
|
+
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
11
|
+
var _react2 = require("@emotion/react");
|
12
|
+
var containerTestId = 'suggestions-container';
|
13
|
+
var defaultProps = {
|
14
|
+
isFullScreen: false,
|
15
|
+
'data-testid': containerTestId
|
16
|
+
};
|
17
|
+
var getComponent = function getComponent() {
|
18
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_.AstroProvider, {
|
20
|
+
theme: _.NextGenTheme
|
21
|
+
}, (0, _react2.jsx)(_Suggestions["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_Suggestion["default"], {
|
22
|
+
text: "Suggestion 1"
|
23
|
+
}))));
|
24
|
+
};
|
25
|
+
test('Suggestions component renders correctly', function () {
|
26
|
+
(0, _defineProperty["default"])(window, 'matchMedia', {
|
27
|
+
writable: true,
|
28
|
+
value: jest.fn().mockImplementation(function (query) {
|
29
|
+
return {
|
30
|
+
matches: query === '(max-width: 993px)',
|
31
|
+
media: query,
|
32
|
+
onchange: null,
|
33
|
+
addListener: jest.fn(),
|
34
|
+
removeListener: jest.fn()
|
35
|
+
};
|
36
|
+
})
|
37
|
+
});
|
38
|
+
getComponent();
|
39
|
+
expect(_testWrapper.screen.getAllByText('Suggestion 1')[0]).toBeInTheDocument();
|
40
|
+
});
|
41
|
+
test('Suggestions component applies isFullScreen prop correctly', function () {
|
42
|
+
getComponent({
|
43
|
+
isFullScreen: true
|
44
|
+
});
|
45
|
+
var suggestions = _testWrapper.screen.getByTestId(containerTestId);
|
46
|
+
expect(suggestions).toHaveClass('is-full-screen');
|
47
|
+
});
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
_Object$defineProperty(exports, "Suggestion", {
|
9
|
+
enumerable: true,
|
10
|
+
get: function get() {
|
11
|
+
return _Suggestion["default"];
|
12
|
+
}
|
13
|
+
});
|
14
|
+
_Object$defineProperty(exports, "default", {
|
15
|
+
enumerable: true,
|
16
|
+
get: function get() {
|
17
|
+
return _Suggestions["default"];
|
18
|
+
}
|
19
|
+
});
|
20
|
+
var _Suggestion = _interopRequireDefault(require("./Suggestion"));
|
21
|
+
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
package/lib/cjs/index.d.ts
CHANGED
@@ -14,6 +14,8 @@ export { default as ResponseAttachment } from './components/AIComponents/Respons
|
|
14
14
|
export { default as ResponseList } from './components/AIComponents/Response/ResponseList';
|
15
15
|
export { default as ResponseText } from './components/AIComponents/Response/ResponseText';
|
16
16
|
export { default as ResponseToolbar } from './components/AIComponents/Response/ResponseToolbar';
|
17
|
+
export { default } from './components/AIComponents/Suggestions';
|
18
|
+
export { default as Suggestion } from './components/AIComponents/Suggestions/Suggestion';
|
17
19
|
export { default as ArrayField } from './components/ArrayField';
|
18
20
|
export * from './components/ArrayField';
|
19
21
|
export { default as AstroWrapper } from './components/AstroProvider';
|
package/lib/cjs/index.js
CHANGED
@@ -24,6 +24,7 @@ var _exportNames = {
|
|
24
24
|
ResponseList: true,
|
25
25
|
ResponseText: true,
|
26
26
|
ResponseToolbar: true,
|
27
|
+
Suggestion: true,
|
27
28
|
ArrayField: true,
|
28
29
|
AstroWrapper: true,
|
29
30
|
AstroProvider: true,
|
@@ -841,6 +842,12 @@ _Object$defineProperty(exports, "SuccessCalloutBadge", {
|
|
841
842
|
return _SuccessCalloutBadge["default"];
|
842
843
|
}
|
843
844
|
});
|
845
|
+
_Object$defineProperty(exports, "Suggestion", {
|
846
|
+
enumerable: true,
|
847
|
+
get: function get() {
|
848
|
+
return _Suggestion["default"];
|
849
|
+
}
|
850
|
+
});
|
844
851
|
_Object$defineProperty(exports, "Switch", {
|
845
852
|
enumerable: true,
|
846
853
|
get: function get() {
|
@@ -955,6 +962,12 @@ _Object$defineProperty(exports, "WarningCalloutBadge", {
|
|
955
962
|
return _WarningCalloutBadge["default"];
|
956
963
|
}
|
957
964
|
});
|
965
|
+
_Object$defineProperty(exports, "default", {
|
966
|
+
enumerable: true,
|
967
|
+
get: function get() {
|
968
|
+
return _Suggestions["default"];
|
969
|
+
}
|
970
|
+
});
|
958
971
|
_Object$defineProperty(exports, "useOverlayPosition", {
|
959
972
|
enumerable: true,
|
960
973
|
get: function get() {
|
@@ -1035,6 +1048,8 @@ var _ResponseAttachment = _interopRequireDefault(require("./components/AICompone
|
|
1035
1048
|
var _ResponseList = _interopRequireDefault(require("./components/AIComponents/Response/ResponseList"));
|
1036
1049
|
var _ResponseText = _interopRequireDefault(require("./components/AIComponents/Response/ResponseText"));
|
1037
1050
|
var _ResponseToolbar = _interopRequireDefault(require("./components/AIComponents/Response/ResponseToolbar"));
|
1051
|
+
var _Suggestions = _interopRequireDefault(require("./components/AIComponents/Suggestions"));
|
1052
|
+
var _Suggestion = _interopRequireDefault(require("./components/AIComponents/Suggestions/Suggestion"));
|
1038
1053
|
var _ArrayField = _interopRequireWildcard(require("./components/ArrayField"));
|
1039
1054
|
_forEachInstanceProperty(_context5 = _Object$keys(_ArrayField)).call(_context5, function (key) {
|
1040
1055
|
if (key === "default" || key === "__esModule") return;
|
@@ -108,7 +108,8 @@ var overrides = {
|
|
108
108
|
var background = {
|
109
109
|
base: 'white',
|
110
110
|
secondary: _colorTokens.nextGenColors['gray-100'],
|
111
|
-
card: _colorTokens.nextGenColors['blue-100']
|
111
|
+
card: _colorTokens.nextGenColors['blue-100'],
|
112
|
+
suggestion: '#ecf0f5'
|
112
113
|
};
|
113
114
|
var card = {
|
114
115
|
blue: _colorTokens.nextGenColors['blue-100'],
|
@@ -17,7 +17,7 @@ var componentSpecificNextGenBlacklist = {
|
|
17
17
|
OverlayPanel: ['Expandable']
|
18
18
|
};
|
19
19
|
exports.componentSpecificNextGenBlacklist = componentSpecificNextGenBlacklist;
|
20
|
-
var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'AI Panel', 'Response'];
|
20
|
+
var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'AI Panel', 'Response', 'Suggestions'];
|
21
21
|
exports.nextGenOnlyComponents = nextGenOnlyComponents;
|
22
22
|
var _default = nextGenConvertedComponents;
|
23
23
|
exports["default"] = _default;
|
@@ -38,6 +38,7 @@ declare const _default: {
|
|
38
38
|
base: string;
|
39
39
|
secondary: string;
|
40
40
|
card: string;
|
41
|
+
suggestion: string;
|
41
42
|
};
|
42
43
|
iconWrapper: {
|
43
44
|
wrapper: {
|
@@ -1806,6 +1807,44 @@ declare const _default: {
|
|
1806
1807
|
fontWeight: number;
|
1807
1808
|
flex: string;
|
1808
1809
|
};
|
1810
|
+
suggestionColumn: {
|
1811
|
+
display: string;
|
1812
|
+
backgroundColor: string;
|
1813
|
+
borderRadius: string;
|
1814
|
+
p: string;
|
1815
|
+
'&.is-hovered': {
|
1816
|
+
cursor: string;
|
1817
|
+
backgroundColor: string;
|
1818
|
+
};
|
1819
|
+
gap: string;
|
1820
|
+
flexGrow: number;
|
1821
|
+
transition: string;
|
1822
|
+
'&.is-focused': {
|
1823
|
+
outline: string;
|
1824
|
+
outlineColor: string;
|
1825
|
+
outlineOffset: string;
|
1826
|
+
backgroundColor: string;
|
1827
|
+
};
|
1828
|
+
};
|
1829
|
+
suggestionRow: {
|
1830
|
+
display: string;
|
1831
|
+
backgroundColor: string;
|
1832
|
+
borderRadius: string;
|
1833
|
+
p: string;
|
1834
|
+
'&.is-hovered': {
|
1835
|
+
cursor: string;
|
1836
|
+
backgroundColor: string;
|
1837
|
+
};
|
1838
|
+
gap: string;
|
1839
|
+
flexGrow: number;
|
1840
|
+
transition: string;
|
1841
|
+
'&.is-focused': {
|
1842
|
+
outline: string;
|
1843
|
+
outlineColor: string;
|
1844
|
+
outlineOffset: string;
|
1845
|
+
backgroundColor: string;
|
1846
|
+
};
|
1847
|
+
};
|
1809
1848
|
};
|
1810
1849
|
variants: {
|
1811
1850
|
navBar: {
|
@@ -2480,6 +2519,22 @@ declare const _default: {
|
|
2480
2519
|
backgroundColor: string;
|
2481
2520
|
};
|
2482
2521
|
};
|
2522
|
+
suggestions: {
|
2523
|
+
justifyContent: string;
|
2524
|
+
gap: string;
|
2525
|
+
flexDirection: string;
|
2526
|
+
'&.is-full-screen': {
|
2527
|
+
gap: string;
|
2528
|
+
flexDirection: string;
|
2529
|
+
};
|
2530
|
+
};
|
2531
|
+
suggestion: {
|
2532
|
+
iconContainer: {
|
2533
|
+
ml: string;
|
2534
|
+
mr: string;
|
2535
|
+
minWidth: string;
|
2536
|
+
};
|
2537
|
+
};
|
2483
2538
|
response: {
|
2484
2539
|
iconWrapper: {
|
2485
2540
|
border: string;
|
@@ -72,5 +72,43 @@ declare const _default: {
|
|
72
72
|
fontWeight: number;
|
73
73
|
flex: string;
|
74
74
|
};
|
75
|
+
suggestionColumn: {
|
76
|
+
display: string;
|
77
|
+
backgroundColor: string;
|
78
|
+
borderRadius: string;
|
79
|
+
p: string;
|
80
|
+
'&.is-hovered': {
|
81
|
+
cursor: string;
|
82
|
+
backgroundColor: string;
|
83
|
+
};
|
84
|
+
gap: string;
|
85
|
+
flexGrow: number;
|
86
|
+
transition: string;
|
87
|
+
'&.is-focused': {
|
88
|
+
outline: string;
|
89
|
+
outlineColor: string;
|
90
|
+
outlineOffset: string;
|
91
|
+
backgroundColor: string;
|
92
|
+
};
|
93
|
+
};
|
94
|
+
suggestionRow: {
|
95
|
+
display: string;
|
96
|
+
backgroundColor: string;
|
97
|
+
borderRadius: string;
|
98
|
+
p: string;
|
99
|
+
'&.is-hovered': {
|
100
|
+
cursor: string;
|
101
|
+
backgroundColor: string;
|
102
|
+
};
|
103
|
+
gap: string;
|
104
|
+
flexGrow: number;
|
105
|
+
transition: string;
|
106
|
+
'&.is-focused': {
|
107
|
+
outline: string;
|
108
|
+
outlineColor: string;
|
109
|
+
outlineOffset: string;
|
110
|
+
backgroundColor: string;
|
111
|
+
};
|
112
|
+
};
|
75
113
|
};
|
76
114
|
export default _default;
|
@@ -57,11 +57,37 @@ var activeCard = _objectSpread(_objectSpread({}, interactive), {}, {
|
|
57
57
|
bg: 'default'
|
58
58
|
}
|
59
59
|
});
|
60
|
+
var baseSuggestion = {
|
61
|
+
backgroundColor: 'light',
|
62
|
+
borderRadius: '4px',
|
63
|
+
p: 'md',
|
64
|
+
'&.is-hovered': {
|
65
|
+
cursor: 'pointer',
|
66
|
+
backgroundColor: 'background.suggestion'
|
67
|
+
},
|
68
|
+
gap: 'md',
|
69
|
+
flexGrow: 1,
|
70
|
+
transition: 'all .2s ease',
|
71
|
+
'&.is-focused': {
|
72
|
+
outline: '2px solid',
|
73
|
+
outlineColor: 'focus',
|
74
|
+
outlineOffset: '0px',
|
75
|
+
backgroundColor: 'background.suggestion'
|
76
|
+
}
|
77
|
+
};
|
78
|
+
var suggestionRow = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
|
79
|
+
display: 'flex'
|
80
|
+
});
|
81
|
+
var suggestionColumn = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
|
82
|
+
display: 'flex'
|
83
|
+
});
|
60
84
|
var _default = {
|
61
85
|
interactive: interactive,
|
62
86
|
dark: dark,
|
63
87
|
light: light,
|
64
88
|
activeCard: activeCard,
|
65
|
-
container: container
|
89
|
+
container: container,
|
90
|
+
suggestionColumn: suggestionColumn,
|
91
|
+
suggestionRow: suggestionRow
|
66
92
|
};
|
67
93
|
exports["default"] = _default;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports["default"] = void 0;
|
8
|
+
var iconContainer = {
|
9
|
+
ml: 'auto',
|
10
|
+
mr: '0px',
|
11
|
+
minWidth: '25px'
|
12
|
+
};
|
13
|
+
var _default = {
|
14
|
+
iconContainer: iconContainer
|
15
|
+
};
|
16
|
+
exports["default"] = _default;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports["default"] = void 0;
|
8
|
+
var _default = {
|
9
|
+
justifyContent: 'space-between',
|
10
|
+
gap: 'sm',
|
11
|
+
flexDirection: 'column',
|
12
|
+
'&.is-full-screen': {
|
13
|
+
gap: 'lg',
|
14
|
+
flexDirection: 'row'
|
15
|
+
}
|
16
|
+
};
|
17
|
+
exports["default"] = _default;
|
@@ -879,6 +879,22 @@ declare const _default: {
|
|
879
879
|
backgroundColor: string;
|
880
880
|
};
|
881
881
|
};
|
882
|
+
suggestions: {
|
883
|
+
justifyContent: string;
|
884
|
+
gap: string;
|
885
|
+
flexDirection: string;
|
886
|
+
'&.is-full-screen': {
|
887
|
+
gap: string;
|
888
|
+
flexDirection: string;
|
889
|
+
};
|
890
|
+
};
|
891
|
+
suggestion: {
|
892
|
+
iconContainer: {
|
893
|
+
ml: string;
|
894
|
+
mr: string;
|
895
|
+
minWidth: string;
|
896
|
+
};
|
897
|
+
};
|
882
898
|
response: {
|
883
899
|
iconWrapper: {
|
884
900
|
border: string;
|
@@ -24,6 +24,8 @@ var _messages = require("./messages");
|
|
24
24
|
var _navbar = require("./navbar");
|
25
25
|
var _prompt = _interopRequireDefault(require("./prompt"));
|
26
26
|
var _response = _interopRequireDefault(require("./response"));
|
27
|
+
var _suggestion = _interopRequireDefault(require("./suggestion"));
|
28
|
+
var _suggestions = _interopRequireDefault(require("./suggestions"));
|
27
29
|
var _tabs = require("./tabs");
|
28
30
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
29
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
@@ -328,6 +330,8 @@ var _default = {
|
|
328
330
|
menu: _menu.menu,
|
329
331
|
iconWrapper: _iconWrapper["default"],
|
330
332
|
overlayPanel: overlayPanel,
|
333
|
+
suggestions: _suggestions["default"],
|
334
|
+
suggestion: _suggestion["default"],
|
331
335
|
response: _response["default"]
|
332
336
|
};
|
333
337
|
exports["default"] = _default;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BoxProps } from './box';
|
2
|
+
import { CardProps } from './card';
|
3
|
+
import { IconProps } from './icon';
|
4
|
+
import { TextProps } from './text';
|
5
|
+
export interface SuggestionProps extends CardProps {
|
6
|
+
iconProps?: IconProps;
|
7
|
+
textProps?: TextProps;
|
8
|
+
text: string;
|
9
|
+
isFullScreen?: boolean;
|
10
|
+
}
|
11
|
+
export interface SuggestionsProps extends BoxProps {
|
12
|
+
isFullScreen?: boolean;
|
13
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
|
+
var _excluded = ["isFullScreen", "text", "textProps", "iconProps"];
|
4
|
+
import React from 'react';
|
5
|
+
import PlusIcon from '@pingux/mdi-react/PlusIcon';
|
6
|
+
import { Box, Card, Icon, Text } from '../../../index';
|
7
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
|
+
var Suggestion = function Suggestion(props) {
|
9
|
+
var isFullScreen = props.isFullScreen,
|
10
|
+
text = props.text,
|
11
|
+
textProps = props.textProps,
|
12
|
+
iconProps = props.iconProps,
|
13
|
+
others = _objectWithoutProperties(props, _excluded);
|
14
|
+
if (isFullScreen) {
|
15
|
+
return ___EmotionJSX(Card, _extends({
|
16
|
+
variant: "cards.suggestionColumn",
|
17
|
+
tabIndex: "0"
|
18
|
+
}, others), ___EmotionJSX(Icon, _extends({
|
19
|
+
icon: PlusIcon
|
20
|
+
}, iconProps)), ___EmotionJSX(Text, _extends({
|
21
|
+
variant: "suggestion"
|
22
|
+
}, textProps), text));
|
23
|
+
}
|
24
|
+
return ___EmotionJSX(Card, _extends({
|
25
|
+
variant: "cards.suggestionRow",
|
26
|
+
isRow: true,
|
27
|
+
alignItems: "center",
|
28
|
+
tabIndex: "0"
|
29
|
+
}, others), ___EmotionJSX(Text, _extends({
|
30
|
+
variant: "suggestion"
|
31
|
+
}, textProps), text), ___EmotionJSX(Box, {
|
32
|
+
variant: "suggestion.iconContainer"
|
33
|
+
}, ___EmotionJSX(Icon, _extends({
|
34
|
+
icon: PlusIcon
|
35
|
+
}, iconProps))));
|
36
|
+
};
|
37
|
+
export default Suggestion;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
|
+
var _excluded = ["children", "isFullScreen", "className"];
|
4
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
5
|
+
import React, { Children } from 'react';
|
6
|
+
import { useStatusClasses } from '../../../hooks';
|
7
|
+
import { Box } from '../../../index';
|
8
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
|
+
var Suggestions = function Suggestions(props) {
|
10
|
+
var children = props.children,
|
11
|
+
isFullScreen = props.isFullScreen,
|
12
|
+
className = props.className,
|
13
|
+
others = _objectWithoutProperties(props, _excluded);
|
14
|
+
var _useStatusClasses = useStatusClasses(className, {
|
15
|
+
isFullScreen: isFullScreen
|
16
|
+
}),
|
17
|
+
classNames = _useStatusClasses.classNames;
|
18
|
+
return ___EmotionJSX(Box, _extends({}, others, {
|
19
|
+
className: classNames,
|
20
|
+
isRow: isFullScreen,
|
21
|
+
variant: "suggestions"
|
22
|
+
}), _mapInstanceProperty(Children).call(Children, children, function (child) {
|
23
|
+
return ___EmotionJSX(React.Fragment, null, /*#__PURE__*/React.cloneElement(child, {
|
24
|
+
isFullScreen: isFullScreen
|
25
|
+
}));
|
26
|
+
}));
|
27
|
+
};
|
28
|
+
export default Suggestions;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { AstroWrapper, NextGenTheme } from '../../../index';
|
3
|
+
import Suggestion from './Suggestion';
|
4
|
+
import Suggestions from './Suggestions';
|
5
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
6
|
+
export default {
|
7
|
+
title: 'Ai Components/Suggestions',
|
8
|
+
component: Suggestions
|
9
|
+
};
|
10
|
+
var lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
|
11
|
+
export var Default = function Default() {
|
12
|
+
return ___EmotionJSX(AstroWrapper, {
|
13
|
+
theme: NextGenTheme
|
14
|
+
}, ___EmotionJSX(Suggestions, null, ___EmotionJSX(Suggestion, {
|
15
|
+
text: lorem
|
16
|
+
}), ___EmotionJSX(Suggestion, {
|
17
|
+
text: lorem
|
18
|
+
}), ___EmotionJSX(Suggestion, {
|
19
|
+
text: lorem
|
20
|
+
}), ___EmotionJSX(Suggestion, {
|
21
|
+
text: lorem
|
22
|
+
})));
|
23
|
+
};
|
24
|
+
export var FullScreen = function FullScreen() {
|
25
|
+
return ___EmotionJSX(AstroWrapper, {
|
26
|
+
theme: NextGenTheme
|
27
|
+
}, ___EmotionJSX(Suggestions, {
|
28
|
+
isFullScreen: true
|
29
|
+
}, ___EmotionJSX(Suggestion, {
|
30
|
+
text: lorem
|
31
|
+
}), ___EmotionJSX(Suggestion, {
|
32
|
+
text: lorem
|
33
|
+
}), ___EmotionJSX(Suggestion, {
|
34
|
+
text: lorem
|
35
|
+
}), ___EmotionJSX(Suggestion, {
|
36
|
+
text: lorem
|
37
|
+
})));
|
38
|
+
};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
3
|
+
import React from 'react';
|
4
|
+
import { AstroProvider, NextGenTheme } from '../../..';
|
5
|
+
import { render, screen } from '../../../utils/testUtils/testWrapper';
|
6
|
+
import Suggestion from './Suggestion';
|
7
|
+
import Suggestions from './Suggestions';
|
8
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
|
+
var containerTestId = 'suggestions-container';
|
10
|
+
var defaultProps = {
|
11
|
+
isFullScreen: false,
|
12
|
+
'data-testid': containerTestId
|
13
|
+
};
|
14
|
+
var getComponent = function getComponent() {
|
15
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
16
|
+
return render(___EmotionJSX(AstroProvider, {
|
17
|
+
theme: NextGenTheme
|
18
|
+
}, ___EmotionJSX(Suggestions, _extends({}, defaultProps, props), ___EmotionJSX(Suggestion, {
|
19
|
+
text: "Suggestion 1"
|
20
|
+
}))));
|
21
|
+
};
|
22
|
+
test('Suggestions component renders correctly', function () {
|
23
|
+
_Object$defineProperty(window, 'matchMedia', {
|
24
|
+
writable: true,
|
25
|
+
value: jest.fn().mockImplementation(function (query) {
|
26
|
+
return {
|
27
|
+
matches: query === '(max-width: 993px)',
|
28
|
+
media: query,
|
29
|
+
onchange: null,
|
30
|
+
addListener: jest.fn(),
|
31
|
+
removeListener: jest.fn()
|
32
|
+
};
|
33
|
+
})
|
34
|
+
});
|
35
|
+
getComponent();
|
36
|
+
expect(screen.getAllByText('Suggestion 1')[0]).toBeInTheDocument();
|
37
|
+
});
|
38
|
+
test('Suggestions component applies isFullScreen prop correctly', function () {
|
39
|
+
getComponent({
|
40
|
+
isFullScreen: true
|
41
|
+
});
|
42
|
+
var suggestions = screen.getByTestId(containerTestId);
|
43
|
+
expect(suggestions).toHaveClass('is-full-screen');
|
44
|
+
});
|
package/lib/index.js
CHANGED
@@ -18,6 +18,8 @@ export { default as ResponseAttachment } from './components/AIComponents/Respons
|
|
18
18
|
export { default as ResponseList } from './components/AIComponents/Response/ResponseList';
|
19
19
|
export { default as ResponseText } from './components/AIComponents/Response/ResponseText';
|
20
20
|
export { default as ResponseToolbar } from './components/AIComponents/Response/ResponseToolbar';
|
21
|
+
export { default } from './components/AIComponents/Suggestions';
|
22
|
+
export { default as Suggestion } from './components/AIComponents/Suggestions/Suggestion';
|
21
23
|
export { default as ArrayField } from './components/ArrayField';
|
22
24
|
export * from './components/ArrayField';
|
23
25
|
export { default as AstroWrapper } from './components/AstroProvider';
|
@@ -98,7 +98,8 @@ var overrides = {
|
|
98
98
|
var background = {
|
99
99
|
base: 'white',
|
100
100
|
secondary: nextGenColors['gray-100'],
|
101
|
-
card: nextGenColors['blue-100']
|
101
|
+
card: nextGenColors['blue-100'],
|
102
|
+
suggestion: '#ecf0f5'
|
102
103
|
};
|
103
104
|
var card = {
|
104
105
|
blue: nextGenColors['blue-100'],
|
@@ -9,5 +9,5 @@ export var componentSpecificNextGenBlacklist = {
|
|
9
9
|
TextField: ['Success'],
|
10
10
|
OverlayPanel: ['Expandable']
|
11
11
|
};
|
12
|
-
export var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'AI Panel', 'Response'];
|
12
|
+
export var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'AI Panel', 'Response', 'Suggestions'];
|
13
13
|
export default nextGenConvertedComponents;
|
@@ -49,10 +49,36 @@ var activeCard = _objectSpread(_objectSpread({}, interactive), {}, {
|
|
49
49
|
bg: 'default'
|
50
50
|
}
|
51
51
|
});
|
52
|
+
var baseSuggestion = {
|
53
|
+
backgroundColor: 'light',
|
54
|
+
borderRadius: '4px',
|
55
|
+
p: 'md',
|
56
|
+
'&.is-hovered': {
|
57
|
+
cursor: 'pointer',
|
58
|
+
backgroundColor: 'background.suggestion'
|
59
|
+
},
|
60
|
+
gap: 'md',
|
61
|
+
flexGrow: 1,
|
62
|
+
transition: 'all .2s ease',
|
63
|
+
'&.is-focused': {
|
64
|
+
outline: '2px solid',
|
65
|
+
outlineColor: 'focus',
|
66
|
+
outlineOffset: '0px',
|
67
|
+
backgroundColor: 'background.suggestion'
|
68
|
+
}
|
69
|
+
};
|
70
|
+
var suggestionRow = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
|
71
|
+
display: 'flex'
|
72
|
+
});
|
73
|
+
var suggestionColumn = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
|
74
|
+
display: 'flex'
|
75
|
+
});
|
52
76
|
export default {
|
53
77
|
interactive: interactive,
|
54
78
|
dark: dark,
|
55
79
|
light: light,
|
56
80
|
activeCard: activeCard,
|
57
|
-
container: container
|
81
|
+
container: container,
|
82
|
+
suggestionColumn: suggestionColumn,
|
83
|
+
suggestionRow: suggestionRow
|
58
84
|
};
|
@@ -19,6 +19,8 @@ import { message } from './messages';
|
|
19
19
|
import { navBar } from './navbar';
|
20
20
|
import prompt from './prompt';
|
21
21
|
import response from './response';
|
22
|
+
import suggestion from './suggestion';
|
23
|
+
import suggestions from './suggestions';
|
22
24
|
import { menuTab, tab, tabs } from './tabs';
|
23
25
|
var fieldHelperText = {
|
24
26
|
title: {
|
@@ -319,5 +321,7 @@ export default {
|
|
319
321
|
menu: menu,
|
320
322
|
iconWrapper: iconWrapper,
|
321
323
|
overlayPanel: overlayPanel,
|
324
|
+
suggestions: suggestions,
|
325
|
+
suggestion: suggestion,
|
322
326
|
response: response
|
323
327
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|