@pingux/astro 2.112.0-alpha.2 → 2.112.0-alpha.4

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 (35) hide show
  1. package/lib/cjs/components/AIComponents/PromptInput/PromptInput.js +56 -14
  2. package/lib/cjs/components/AIComponents/PromptInput/PromptInput.test.js +73 -15
  3. package/lib/cjs/components/AIComponents/PromptInput/PromptUploadButton.js +1 -1
  4. package/lib/cjs/components/AIComponents/PromptInput/PromptUploadButton.test.d.ts +1 -0
  5. package/lib/cjs/components/AIComponents/PromptInput/PromptUploadButton.test.js +68 -0
  6. package/lib/cjs/components/AIComponents/Response/Response.stories.js +24 -24
  7. package/lib/cjs/components/AIComponents/Response/Response.test.jsx +40 -70
  8. package/lib/cjs/components/AIComponents/Response/ResponseAttachment.js +3 -2
  9. package/lib/cjs/components/AIComponents/Response/ResponseToolbar.js +23 -35
  10. package/lib/cjs/components/AIComponents/Response/ResponseToolbarIcon.d.ts +4 -0
  11. package/lib/cjs/components/AIComponents/Response/ResponseToolbarIcon.js +57 -0
  12. package/lib/cjs/components/AIComponents/Response/index.d.ts +1 -0
  13. package/lib/cjs/components/AIComponents/Response/index.js +8 -1
  14. package/lib/cjs/index.d.ts +1 -0
  15. package/lib/cjs/index.js +8 -0
  16. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +33 -0
  17. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +33 -0
  18. package/lib/cjs/styles/themes/next-gen/variants/button.js +6 -0
  19. package/lib/cjs/styles/themes/next-gen/variants/input.js +25 -3
  20. package/lib/cjs/types/promptInput.d.ts +3 -0
  21. package/lib/cjs/types/response.d.ts +10 -3
  22. package/lib/components/AIComponents/PromptInput/PromptInput.js +57 -15
  23. package/lib/components/AIComponents/PromptInput/PromptInput.test.js +73 -15
  24. package/lib/components/AIComponents/PromptInput/PromptUploadButton.js +1 -1
  25. package/lib/components/AIComponents/PromptInput/PromptUploadButton.test.js +65 -0
  26. package/lib/components/AIComponents/Response/Response.stories.js +24 -24
  27. package/lib/components/AIComponents/Response/Response.test.jsx +40 -70
  28. package/lib/components/AIComponents/Response/ResponseAttachment.js +3 -2
  29. package/lib/components/AIComponents/Response/ResponseToolbar.js +25 -37
  30. package/lib/components/AIComponents/Response/ResponseToolbarIcon.js +43 -0
  31. package/lib/components/AIComponents/Response/index.js +2 -1
  32. package/lib/index.js +1 -0
  33. package/lib/styles/themes/next-gen/variants/button.js +6 -0
  34. package/lib/styles/themes/next-gen/variants/input.js +25 -3
  35. package/package.json +1 -1
@@ -12,7 +12,8 @@ var ResponseAttachment = function ResponseAttachment(props) {
12
12
  iconProps = props.iconProps,
13
13
  className = props.className,
14
14
  animationIndex = props.animationIndex,
15
- shouldStartAnimation = props.shouldStartAnimation;
15
+ shouldStartAnimation = props.shouldStartAnimation,
16
+ text = props.text;
16
17
  var isLoaded = useRef(false);
17
18
  useEffect(function () {
18
19
  if (shouldStartAnimation && setAnimationIndex && animationIndex !== undefined && isLoaded.current === false) {
@@ -35,6 +36,6 @@ var ResponseAttachment = function ResponseAttachment(props) {
35
36
  title: {
36
37
  name: 'attachment icon'
37
38
  }
38
- }, iconProps)), ___EmotionJSX(Text, textProps, "Attachment text"));
39
+ }, iconProps)), ___EmotionJSX(Text, textProps, text));
39
40
  };
40
41
  export default ResponseAttachment;
@@ -1,44 +1,35 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["parentIndex", "setAnimationIndex", "readButtonProps", "copyButtonProps", "goodButtonProps", "badButtonProps", "rephraseButtonProps", "className", "shouldStartAnimation", "animationIndex"];
4
- import React, { useEffect, useRef } from 'react';
5
- import CopyIcon from '@pingux/mdi-react/ContentCopyIcon';
6
- import TextIcon from '@pingux/mdi-react/TextIcon';
7
- import ThumbDownOutlineIcon from '@pingux/mdi-react/ThumbDownOutlineIcon';
8
- import ThumbUpOutlineIcon from '@pingux/mdi-react/ThumbUpOutlineIcon';
9
- import VolumeHighIcon from '@pingux/mdi-react/VolumeHighIcon';
4
+ var _excluded = ["parentIndex", "setAnimationIndex", "children", "className", "shouldStartAnimation", "animationIndex", "delay"];
5
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
6
+ import React, { Children, useEffect, useRef, useState } from 'react';
10
7
  import { useStatusClasses } from '../../../hooks';
11
- import { Box, Icon, IconButton } from '../../../index';
8
+ import { Box } from '../../../index';
12
9
  import { jsx as ___EmotionJSX } from "@emotion/react";
13
- var ResponseToolbarIcon = function ResponseToolbarIcon(props) {
14
- var title = props.title,
15
- icon = props.icon;
16
- return ___EmotionJSX(IconButton, {
17
- title: title
18
- }, ___EmotionJSX(Icon, {
19
- icon: icon,
20
- title: {
21
- name: title
22
- }
23
- }));
24
- };
25
10
  var ResponseToolbar = function ResponseToolbar(props) {
26
11
  var parentIndex = props.parentIndex,
27
12
  setAnimationIndex = props.setAnimationIndex,
28
- readButtonProps = props.readButtonProps,
29
- copyButtonProps = props.copyButtonProps,
30
- goodButtonProps = props.goodButtonProps,
31
- badButtonProps = props.badButtonProps,
32
- rephraseButtonProps = props.rephraseButtonProps,
13
+ children = props.children,
33
14
  className = props.className,
34
15
  shouldStartAnimation = props.shouldStartAnimation,
35
16
  animationIndex = props.animationIndex,
17
+ delay = props.delay,
36
18
  others = _objectWithoutProperties(props, _excluded);
37
19
  var isLoaded = useRef(false);
20
+ var _useState = useState(-1),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ index = _useState2[0],
23
+ setIndex = _useState2[1];
24
+ useEffect(function () {
25
+ if (index === (children === null || children === void 0 ? void 0 : children.length) && animationIndex !== undefined && setAnimationIndex) {
26
+ setAnimationIndex(animationIndex + 1);
27
+ }
28
+ }, [setAnimationIndex, index, shouldStartAnimation, animationIndex, children === null || children === void 0 ? void 0 : children.length]);
38
29
  useEffect(function () {
39
30
  if (shouldStartAnimation && setAnimationIndex && animationIndex !== undefined && isLoaded.current === false) {
40
31
  isLoaded.current = true;
41
- setAnimationIndex(animationIndex + 1);
32
+ setIndex(0);
42
33
  }
43
34
  }, [setAnimationIndex, parentIndex, shouldStartAnimation, animationIndex]);
44
35
  var _useStatusClasses = useStatusClasses(className, {
@@ -50,16 +41,13 @@ var ResponseToolbar = function ResponseToolbar(props) {
50
41
  gap: "sm",
51
42
  variant: "response.toolbar",
52
43
  className: classNames
53
- }, others), (readButtonProps === null || readButtonProps === void 0 ? void 0 : readButtonProps.title) && ___EmotionJSX(ResponseToolbarIcon, _extends({
54
- icon: VolumeHighIcon
55
- }, readButtonProps)), (copyButtonProps === null || copyButtonProps === void 0 ? void 0 : copyButtonProps.title) && ___EmotionJSX(ResponseToolbarIcon, _extends({
56
- icon: CopyIcon
57
- }, copyButtonProps)), (goodButtonProps === null || goodButtonProps === void 0 ? void 0 : goodButtonProps.title) && ___EmotionJSX(ResponseToolbarIcon, _extends({
58
- icon: ThumbUpOutlineIcon
59
- }, goodButtonProps)), (badButtonProps === null || badButtonProps === void 0 ? void 0 : badButtonProps.title) && ___EmotionJSX(ResponseToolbarIcon, _extends({
60
- icon: ThumbDownOutlineIcon
61
- }, badButtonProps)), (rephraseButtonProps === null || rephraseButtonProps === void 0 ? void 0 : rephraseButtonProps.title) && ___EmotionJSX(ResponseToolbarIcon, _extends({
62
- icon: TextIcon
63
- }, rephraseButtonProps)));
44
+ }, others), _mapInstanceProperty(Children).call(Children, children, function (child, i) {
45
+ return ___EmotionJSX(React.Fragment, null, /*#__PURE__*/React.cloneElement(child, {
46
+ setAnimationIndex: setIndex,
47
+ animationIndex: i,
48
+ parentIndex: index,
49
+ delay: delay
50
+ }));
51
+ }));
64
52
  };
65
53
  export default ResponseToolbar;
@@ -0,0 +1,43 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["title", "icon", "className", "parentIndex", "animationIndex", "setAnimationIndex", "delay", "iconProps"];
4
+ import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
5
+ import React, { useEffect, useRef } from 'react';
6
+ import { useStatusClasses } from '../../../hooks';
7
+ import { Icon, IconButton } from '../../../index';
8
+ import { jsx as ___EmotionJSX } from "@emotion/react";
9
+ var ResponseToolbarIcon = function ResponseToolbarIcon(props) {
10
+ var title = props.title,
11
+ icon = props.icon,
12
+ className = props.className,
13
+ parentIndex = props.parentIndex,
14
+ animationIndex = props.animationIndex,
15
+ setAnimationIndex = props.setAnimationIndex,
16
+ delay = props.delay,
17
+ iconProps = props.iconProps,
18
+ others = _objectWithoutProperties(props, _excluded);
19
+ var isLoaded = useRef(false);
20
+ useEffect(function () {
21
+ if (parentIndex === animationIndex && setAnimationIndex && parentIndex !== undefined) {
22
+ _setTimeout(function () {
23
+ isLoaded.current = true;
24
+ setAnimationIndex(parentIndex + 1);
25
+ }, delay);
26
+ }
27
+ }, [parentIndex, animationIndex, setAnimationIndex, delay]);
28
+ var _useStatusClasses = useStatusClasses(className, {
29
+ isNotLoaded: !isLoaded.current
30
+ }),
31
+ classNames = _useStatusClasses.classNames;
32
+ return ___EmotionJSX(IconButton, _extends({
33
+ title: title,
34
+ className: classNames,
35
+ variant: "responseToolbar"
36
+ }, others), ___EmotionJSX(Icon, _extends({
37
+ icon: icon,
38
+ title: {
39
+ name: title
40
+ }
41
+ }, iconProps)));
42
+ };
43
+ export default ResponseToolbarIcon;
@@ -2,4 +2,5 @@ export { default } from './Response';
2
2
  export { default as ResponseAttachment } from './ResponseAttachment';
3
3
  export { default as ResponseList } from './ResponseList';
4
4
  export { default as ResponseText } from './ResponseText';
5
- export { default as ResponseToolbar } from './ResponseToolbar';
5
+ export { default as ResponseToolbar } from './ResponseToolbar';
6
+ export { default as ResponseToolbarIcon } from './ResponseToolbarIcon';
package/lib/index.js CHANGED
@@ -20,6 +20,7 @@ export { default as ResponseAttachment } from './components/AIComponents/Respons
20
20
  export { default as ResponseList } from './components/AIComponents/Response/ResponseList';
21
21
  export { default as ResponseText } from './components/AIComponents/Response/ResponseText';
22
22
  export { default as ResponseToolbar } from './components/AIComponents/Response/ResponseToolbar';
23
+ export { default as ResponseToolbarIcon } from './components/AIComponents/Response/ResponseToolbarIcon';
23
24
  export { default as Suggestions } from './components/AIComponents/Suggestions';
24
25
  export { default as Suggestion } from './components/AIComponents/Suggestions/Suggestion';
25
26
  export { default as ArrayField } from './components/ArrayField';
@@ -243,6 +243,12 @@ var iconButtons = {
243
243
  base: _objectSpread({}, baseIconButton),
244
244
  nextGen: _objectSpread({}, onyxIconButton),
245
245
  onyx: _objectSpread({}, onyxIconButton),
246
+ responseToolbar: _objectSpread(_objectSpread({}, baseIconButton), {}, {
247
+ '&.is-not-loaded': {
248
+ display: 'none'
249
+ },
250
+ display: 'inline-flex'
251
+ }),
246
252
  modalCloseButton: modalCloseButton,
247
253
  badge: {
248
254
  deleteButton: _objectSpread(_objectSpread({}, baseIconButton), {}, {
@@ -28,13 +28,19 @@ export var input = {
28
28
  '&.is-focused': _objectSpread({}, defaultFocus),
29
29
  borderRadius: '4px',
30
30
  fontWeight: 1,
31
- height: '50px',
32
31
  '&::placeholder': text.placeholder
33
32
  };
34
33
  input.promptInput = _objectSpread(_objectSpread({}, input), {}, {
34
+ position: 'absolute',
35
35
  pl: '0px',
36
36
  border: 'none',
37
37
  outline: 'none !important',
38
+ overflowY: 'hidden',
39
+ resize: 'none',
40
+ lineHeight: '24px',
41
+ minHeight: '26px',
42
+ height: '26px',
43
+ p: '0px',
38
44
  '&.is-focused': {
39
45
  border: 'none !important',
40
46
  outline: 'none !important'
@@ -112,8 +118,8 @@ input.fieldControlWrapper = _objectSpread({}, fieldControlWrapper);
112
118
  input.promptInputWrapper = _objectSpread(_objectSpread({}, fieldControlWrapper), {}, {
113
119
  border: '1px solid',
114
120
  borderColor: 'border.input',
115
- px: '.75rem',
116
121
  borderRadius: '4px',
122
+ minHeight: '50px',
117
123
  '&.is-focused': {
118
124
  boxShadow: '0 1px 1px rgba(0,0,0,.075), 0 0 0 .0625rem blue'
119
125
  }
@@ -149,4 +155,20 @@ input.multivaluesWrapper = _objectSpread(_objectSpread({}, fieldControlWrapper),
149
155
  });
150
156
  input.numberField = _objectSpread(_objectSpread({}, input), {}, {
151
157
  pr: '28px'
152
- });
158
+ });
159
+ input.promptInputRow = {
160
+ alignItems: 'center',
161
+ position: 'relative',
162
+ justifyContent: 'center',
163
+ flexGrow: '1',
164
+ overflowX: 'hidden',
165
+ overflowY: 'auto',
166
+ py: '12px'
167
+ };
168
+ input.promptInputAttachmentWrapper = {
169
+ gap: '1.5rem',
170
+ overflowX: 'auto',
171
+ overflowY: 'hidden',
172
+ whiteSpace: 'nowrap',
173
+ px: '.75rem'
174
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.112.0-alpha.2",
3
+ "version": "2.112.0-alpha.4",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",