@pingux/astro 2.120.0 → 2.121.0-alpha.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.
Files changed (32) hide show
  1. package/lib/cjs/components/AIComponents/Attachment/Attachment.d.ts +1 -6
  2. package/lib/cjs/components/AIComponents/Attachment/Attachment.js +10 -15
  3. package/lib/cjs/components/AIComponents/Attachment/Attachment.test.d.ts +1 -0
  4. package/lib/cjs/components/AIComponents/Attachment/Attachment.test.js +67 -0
  5. package/lib/cjs/components/AIComponents/Attachment/constants.d.ts +38 -0
  6. package/lib/cjs/components/AIComponents/Attachment/constants.js +51 -0
  7. package/lib/cjs/components/AIComponents/PromptInput/PromptInput.stories.js +2 -4
  8. package/lib/cjs/components/Text/Text.styles.d.ts +840 -0
  9. package/lib/cjs/components/Text/Text.styles.js +5 -1
  10. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.d.ts +11 -0
  11. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.js +14 -3
  12. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.d.ts +7 -0
  13. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +7 -0
  14. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +6 -0
  15. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +7 -0
  16. package/lib/cjs/styles/themes/next-gen/colors/colors.d.ts +10 -0
  17. package/lib/cjs/styles/themes/next-gen/colors/iconWrapper.d.ts +10 -0
  18. package/lib/cjs/styles/themes/next-gen/colors/iconWrapper.js +12 -2
  19. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +13 -6
  20. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +3 -6
  21. package/lib/cjs/styles/themes/next-gen/variants/button.js +5 -2
  22. package/lib/components/AIComponents/Attachment/Attachment.js +10 -15
  23. package/lib/components/AIComponents/Attachment/Attachment.test.js +64 -0
  24. package/lib/components/AIComponents/Attachment/constants.js +42 -0
  25. package/lib/components/AIComponents/PromptInput/PromptInput.stories.js +3 -5
  26. package/lib/components/Text/Text.styles.js +5 -1
  27. package/lib/styles/themeOverrides/nextGenDarkMode/colors.js +14 -3
  28. package/lib/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +7 -0
  29. package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +7 -0
  30. package/lib/styles/themes/next-gen/colors/iconWrapper.js +12 -2
  31. package/lib/styles/themes/next-gen/variants/button.js +5 -2
  32. package/package.json +1 -1
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
2
  import { AttachmentProps } from '../../../types/promptInput';
3
3
  export declare const getFileExtension: (fullString: string) => string;
4
- declare const Attachment: {
5
- (props: AttachmentProps): React.JSX.Element;
6
- defaultProps: {
7
- icon: import("@pingux/mdi-react").MdiReactIconComponentType;
8
- };
9
- };
4
+ declare const Attachment: (props: AttachmentProps) => React.JSX.Element;
10
5
  export default Attachment;
@@ -20,6 +20,7 @@ var _CloseIcon = _interopRequireDefault(require("@pingux/mdi-react/CloseIcon"));
20
20
  var _PaperOutlineIcon = _interopRequireDefault(require("@pingux/mdi-react/PaperOutlineIcon"));
21
21
  var _hooks = require("../../../hooks");
22
22
  var _index = require("../../../index");
23
+ var _constants = require("./constants");
23
24
  var _react2 = require("@emotion/react");
24
25
  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; }
25
26
  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; }
@@ -41,12 +42,16 @@ var Attachment = function Attachment(props) {
41
42
  id = props.id,
42
43
  containerProps = props.containerProps,
43
44
  iconWrapperProps = props.iconWrapperProps,
44
- icon = props.icon,
45
45
  deleteButtonProps = props.deleteButtonProps;
46
46
  var _useStatusClasses = (0, _hooks.useStatusClasses)(className, {
47
47
  isFullScreen: isFullScreen
48
48
  }),
49
49
  classNames = _useStatusClasses.classNames;
50
+ var defaultIconProps = {
51
+ icon: _PaperOutlineIcon["default"],
52
+ color: 'lightBlue'
53
+ };
54
+ var iconProps = _constants.fileTypeConfig[fileType] || defaultIconProps;
50
55
  return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
51
56
  variant: "attachment.container",
52
57
  className: classNames
@@ -55,13 +60,11 @@ var Attachment = function Attachment(props) {
55
60
  alignItems: "center",
56
61
  px: "lg",
57
62
  py: "md"
58
- }, (0, _react2.jsx)(_index.IconWrapper, {
63
+ }, (0, _react2.jsx)(_index.IconWrapper, (0, _extends2["default"])({
59
64
  isCircle: true,
60
65
  title: {
61
- name: 'File Icon'
66
+ name: "".concat(fileType, " File Icon")
62
67
  },
63
- icon: icon,
64
- color: "red",
65
68
  size: "sm",
66
69
  wrapperProps: _objectSpread({
67
70
  size: '36px',
@@ -69,18 +72,13 @@ var Attachment = function Attachment(props) {
69
72
  minWidth: '36px',
70
73
  p: '9px'
71
74
  }, iconWrapperProps)
72
- }), (0, _react2.jsx)(_index.Box, {
75
+ }, iconProps)), (0, _react2.jsx)(_index.Box, {
73
76
  sx: {
74
77
  ml: 'md'
75
78
  }
76
79
  }, (0, _react2.jsx)(_index.Text, {
77
80
  as: "h5",
78
- sx: {
79
- fontWeight: 2,
80
- textOverflow: 'ellipsis',
81
- whiteSpace: 'nowrap',
82
- overflow: 'hidden'
83
- }
81
+ variant: "attachmentTitle"
84
82
  }, title), (0, _react2.jsx)(_index.Text, {
85
83
  sx: {
86
84
  textOverflow: 'ellipsis'
@@ -102,8 +100,5 @@ var Attachment = function Attachment(props) {
102
100
  icon: _CloseIcon["default"]
103
101
  }))));
104
102
  };
105
- Attachment.defaultProps = {
106
- icon: _PaperOutlineIcon["default"]
107
- };
108
103
  var _default = Attachment;
109
104
  exports["default"] = _default;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
5
+ var _react = _interopRequireDefault(require("react"));
6
+ var _testWrapper = require("../../../utils/testUtils/testWrapper");
7
+ var _Attachment = _interopRequireDefault(require("./Attachment"));
8
+ var _react2 = require("@emotion/react");
9
+ var mockFileName = 'sampleFile';
10
+ var defaultProps = {
11
+ key: 'file_key',
12
+ title: mockFileName,
13
+ fileType: 'PPT',
14
+ removeFile: function removeFile() {
15
+ return false;
16
+ },
17
+ id: 'Example Title'
18
+ };
19
+ var getComponent = function getComponent() {
20
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21
+ return (0, _testWrapper.render)((0, _react2.jsx)(_Attachment["default"], (0, _extends2["default"])({}, defaultProps, props)));
22
+ };
23
+ describe('Attachment', function () {
24
+ test('renders with PPT file format ', function () {
25
+ getComponent();
26
+ _testWrapper.screen.getByRole('img', {
27
+ name: /ppt file icon/i
28
+ });
29
+ _testWrapper.screen.getByRole('heading', {
30
+ name: mockFileName
31
+ });
32
+ _testWrapper.screen.getAllByText(/ppt/i);
33
+ _testWrapper.screen.getByRole('button', {
34
+ name: /remove attachment/i
35
+ });
36
+ });
37
+ test('renders with PDF file format', function () {
38
+ getComponent({
39
+ fileType: 'pdf'
40
+ });
41
+ _testWrapper.screen.getByRole('img', {
42
+ name: /pdf file icon/i
43
+ });
44
+ _testWrapper.screen.getByRole('heading', {
45
+ name: mockFileName
46
+ });
47
+ _testWrapper.screen.getAllByText(/pdf/i);
48
+ });
49
+ test('renders with CSV file format', function () {
50
+ getComponent({
51
+ fileType: 'csv'
52
+ });
53
+ _testWrapper.screen.getAllByText(/csv/i);
54
+ });
55
+ test('renders with JS file format', function () {
56
+ getComponent({
57
+ fileType: 'js'
58
+ });
59
+ _testWrapper.screen.getAllByText(/js/i);
60
+ });
61
+ test('renders with ZIP file format', function () {
62
+ getComponent({
63
+ fileType: 'zip'
64
+ });
65
+ _testWrapper.screen.getAllByText(/zip/i);
66
+ });
67
+ });
@@ -0,0 +1,38 @@
1
+ export declare const fileTypeConfig: {
2
+ pdf: {
3
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
4
+ color: string;
5
+ };
6
+ doc: {
7
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
8
+ color: string;
9
+ };
10
+ docx: {
11
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
12
+ color: string;
13
+ };
14
+ text: {
15
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
16
+ color: string;
17
+ };
18
+ csv: {
19
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
20
+ color: string;
21
+ };
22
+ xls: {
23
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
24
+ color: string;
25
+ };
26
+ xlsx: {
27
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
28
+ color: string;
29
+ };
30
+ js: {
31
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
32
+ color: string;
33
+ };
34
+ zip: {
35
+ icon: import("@pingux/mdi-react").MdiReactIconComponentType;
36
+ color: string;
37
+ };
38
+ };
@@ -0,0 +1,51 @@
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.fileTypeConfig = void 0;
9
+ var _CodeTagsIcon = _interopRequireDefault(require("@pingux/mdi-react/CodeTagsIcon"));
10
+ var _FileDocumentOutlineIcon = _interopRequireDefault(require("@pingux/mdi-react/FileDocumentOutlineIcon"));
11
+ var _FolderZipOutlineIcon = _interopRequireDefault(require("@pingux/mdi-react/FolderZipOutlineIcon"));
12
+ var _TableLargeIcon = _interopRequireDefault(require("@pingux/mdi-react/TableLargeIcon"));
13
+ var fileTypeConfig = {
14
+ pdf: {
15
+ icon: _FileDocumentOutlineIcon["default"],
16
+ color: 'lightPink'
17
+ },
18
+ doc: {
19
+ icon: _FileDocumentOutlineIcon["default"],
20
+ color: 'lightPink'
21
+ },
22
+ docx: {
23
+ icon: _FileDocumentOutlineIcon["default"],
24
+ color: 'lightPink'
25
+ },
26
+ text: {
27
+ icon: _FileDocumentOutlineIcon["default"],
28
+ color: 'lightPink'
29
+ },
30
+ csv: {
31
+ icon: _TableLargeIcon["default"],
32
+ color: 'lightGreen'
33
+ },
34
+ xls: {
35
+ icon: _TableLargeIcon["default"],
36
+ color: 'lightGreen'
37
+ },
38
+ xlsx: {
39
+ icon: _TableLargeIcon["default"],
40
+ color: 'lightGreen'
41
+ },
42
+ js: {
43
+ icon: _CodeTagsIcon["default"],
44
+ color: 'lightYellow'
45
+ },
46
+ zip: {
47
+ icon: _FolderZipOutlineIcon["default"],
48
+ color: 'lightIndigo'
49
+ }
50
+ };
51
+ exports.fileTypeConfig = fileTypeConfig;
@@ -66,9 +66,7 @@ var Default = function Default(args) {
66
66
  console.log('submit');
67
67
  setValue('');
68
68
  };
69
- return (0, _react2.jsx)(_.AstroProvider, {
70
- themeOverrides: [_.NextGenTheme]
71
- }, (0, _react2.jsx)(_.Box, {
69
+ return (0, _react2.jsx)(_.Box, {
72
70
  maxWidth: "768px"
73
71
  }, (0, _react2.jsx)(_PromptInput["default"], (0, _extends2["default"])({}, args, {
74
72
  placeholder: "Enter a prompt here",
@@ -80,6 +78,6 @@ var Default = function Default(args) {
80
78
  onFileChange: onFileChange,
81
79
  onSubmit: onSubmit,
82
80
  onCancel: onCancel
83
- }))));
81
+ })));
84
82
  };
85
83
  exports.Default = Default;