@pingux/astro 2.106.0-alpha.1 → 2.106.0-alpha.3

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 (48) hide show
  1. package/lib/cjs/components/AIComponents/Suggestions/Suggestion.d.ts +4 -0
  2. package/lib/cjs/components/AIComponents/Suggestions/Suggestion.js +46 -0
  3. package/lib/cjs/components/AIComponents/Suggestions/Suggestions.d.ts +4 -0
  4. package/lib/cjs/components/AIComponents/Suggestions/Suggestions.js +42 -0
  5. package/lib/cjs/components/AIComponents/Suggestions/Suggestions.stories.d.ts +8 -0
  6. package/lib/cjs/components/AIComponents/Suggestions/Suggestions.stories.js +49 -0
  7. package/lib/cjs/components/AIComponents/Suggestions/Suggestions.test.d.ts +1 -0
  8. package/lib/cjs/components/AIComponents/Suggestions/Suggestions.test.js +47 -0
  9. package/lib/cjs/components/AIComponents/Suggestions/index.d.ts +2 -0
  10. package/lib/cjs/components/AIComponents/Suggestions/index.js +21 -0
  11. package/lib/cjs/components/NavigationHeader/HeaderAccountMenu.d.ts +2 -1
  12. package/lib/cjs/components/NavigationHeader/HeaderAccountMenu.js +4 -3
  13. package/lib/cjs/components/NavigationHeader/NavigationHeader.test.js +117 -3
  14. package/lib/cjs/components/NavigationHeader/index.d.ts +1 -0
  15. package/lib/cjs/components/NavigationHeader/index.js +7 -0
  16. package/lib/cjs/index.d.ts +2 -0
  17. package/lib/cjs/index.js +15 -0
  18. package/lib/cjs/styles/themes/next-gen/colors/colors.d.ts +1 -0
  19. package/lib/cjs/styles/themes/next-gen/colors/colors.js +2 -1
  20. package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
  21. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +55 -0
  22. package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +38 -0
  23. package/lib/cjs/styles/themes/next-gen/variants/cards.js +27 -1
  24. package/lib/cjs/styles/themes/next-gen/variants/suggestion.d.ts +8 -0
  25. package/lib/cjs/styles/themes/next-gen/variants/suggestion.js +16 -0
  26. package/lib/cjs/styles/themes/next-gen/variants/suggestions.d.ts +10 -0
  27. package/lib/cjs/styles/themes/next-gen/variants/suggestions.js +17 -0
  28. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +16 -0
  29. package/lib/cjs/styles/themes/next-gen/variants/variants.js +4 -0
  30. package/lib/cjs/types/suggestions.d.ts +13 -0
  31. package/lib/cjs/types/suggestions.js +6 -0
  32. package/lib/components/AIComponents/Suggestions/Suggestion.js +37 -0
  33. package/lib/components/AIComponents/Suggestions/Suggestions.js +28 -0
  34. package/lib/components/AIComponents/Suggestions/Suggestions.stories.js +38 -0
  35. package/lib/components/AIComponents/Suggestions/Suggestions.test.js +44 -0
  36. package/lib/components/AIComponents/Suggestions/index.js +2 -0
  37. package/lib/components/NavigationHeader/HeaderAccountMenu.js +4 -3
  38. package/lib/components/NavigationHeader/NavigationHeader.test.js +114 -4
  39. package/lib/components/NavigationHeader/index.js +1 -0
  40. package/lib/index.js +2 -0
  41. package/lib/styles/themes/next-gen/colors/colors.js +2 -1
  42. package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
  43. package/lib/styles/themes/next-gen/variants/cards.js +27 -1
  44. package/lib/styles/themes/next-gen/variants/suggestion.js +8 -0
  45. package/lib/styles/themes/next-gen/variants/suggestions.js +9 -0
  46. package/lib/styles/themes/next-gen/variants/variants.js +4 -0
  47. package/lib/types/suggestions.js +1 -0
  48. package/package.json +1 -1
@@ -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,8 @@
1
+ declare const _default: {
2
+ iconContainer: {
3
+ ml: string;
4
+ mr: string;
5
+ minWidth: string;
6
+ };
7
+ };
8
+ export 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,10 @@
1
+ declare const _default: {
2
+ justifyContent: string;
3
+ gap: string;
4
+ flexDirection: string;
5
+ '&.is-full-screen': {
6
+ gap: string;
7
+ flexDirection: string;
8
+ };
9
+ };
10
+ export 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,6 @@
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
+ });
@@ -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
+ });
@@ -0,0 +1,2 @@
1
+ export { default as Suggestion } from './Suggestion';
2
+ export { default } from './Suggestions';
@@ -6,7 +6,8 @@ import useGetTheme from '../../hooks/useGetTheme';
6
6
  import { jsx as ___EmotionJSX } from "@emotion/react";
7
7
  var HeaderAccountMenu = function HeaderAccountMenu(props) {
8
8
  var userData = props.userData,
9
- avatarProps = props.avatarProps;
9
+ avatarProps = props.avatarProps,
10
+ buttonProps = props.buttonProps;
10
11
  var _ref = userData || {},
11
12
  image = _ref.image,
12
13
  firstName = _ref.firstName,
@@ -15,9 +16,9 @@ var HeaderAccountMenu = function HeaderAccountMenu(props) {
15
16
  var _useGetTheme = useGetTheme(),
16
17
  icons = _useGetTheme.icons;
17
18
  var MenuDown = icons.MenuDown;
18
- return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(PopoverMenu, null, ___EmotionJSX(Button, {
19
+ return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(PopoverMenu, null, ___EmotionJSX(Button, _extends({
19
20
  variant: "navigationHeader.accountButton"
20
- }, ___EmotionJSX(Box, {
21
+ }, buttonProps), ___EmotionJSX(Box, {
21
22
  isRow: true,
22
23
  alignItems: "center",
23
24
  gap: "xs"