@pingux/astro 2.104.0-alpha.3 → 2.104.0-alpha.5

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 (42) hide show
  1. package/lib/cjs/components/AIComponents/AIPanel/AIPanel.d.ts +4 -0
  2. package/lib/cjs/components/AIComponents/AIPanel/AIPanel.js +34 -0
  3. package/lib/cjs/components/AIComponents/AIPanel/AIPanel.stories.d.ts +7 -0
  4. package/lib/cjs/components/AIComponents/AIPanel/AIPanel.stories.js +107 -0
  5. package/lib/cjs/components/AIComponents/AIPanel/AIPanel.test.d.ts +1 -0
  6. package/lib/cjs/components/AIComponents/AIPanel/AIPanel.test.js +105 -0
  7. package/lib/cjs/components/AIComponents/AIPanel/AIPanelHeader.d.ts +4 -0
  8. package/lib/cjs/components/AIComponents/AIPanel/AIPanelHeader.js +56 -0
  9. package/lib/cjs/components/AIComponents/AIPanel/index.d.ts +2 -0
  10. package/lib/cjs/components/AIComponents/AIPanel/index.js +21 -0
  11. package/lib/cjs/components/ListViewItem/ListViewItem.stories.js +51 -3
  12. package/lib/cjs/components/ListViewItem/controls/ListViewItemEditButton.js +3 -2
  13. package/lib/cjs/index.d.ts +2 -0
  14. package/lib/cjs/index.js +16 -0
  15. package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
  16. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +95 -0
  17. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +48 -0
  18. package/lib/cjs/styles/themes/next-gen/variants/button.js +29 -1
  19. package/lib/cjs/styles/themes/next-gen/variants/text.d.ts +12 -0
  20. package/lib/cjs/styles/themes/next-gen/variants/text.js +15 -2
  21. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +35 -0
  22. package/lib/cjs/styles/themes/next-gen/variants/variants.js +36 -1
  23. package/lib/cjs/types/aiPanel.d.ts +25 -0
  24. package/lib/cjs/types/aiPanel.js +6 -0
  25. package/lib/cjs/types/overlayPanel.d.ts +4 -1
  26. package/lib/cjs/utils/designUtils/figmaLinks.d.ts +10 -0
  27. package/lib/cjs/utils/designUtils/figmaLinks.js +10 -0
  28. package/lib/components/AIComponents/AIPanel/AIPanel.js +25 -0
  29. package/lib/components/AIComponents/AIPanel/AIPanel.stories.js +92 -0
  30. package/lib/components/AIComponents/AIPanel/AIPanel.test.js +96 -0
  31. package/lib/components/AIComponents/AIPanel/AIPanelHeader.js +47 -0
  32. package/lib/components/AIComponents/AIPanel/index.js +2 -0
  33. package/lib/components/ListViewItem/ListViewItem.stories.js +50 -2
  34. package/lib/components/ListViewItem/controls/ListViewItemEditButton.js +3 -2
  35. package/lib/index.js +2 -0
  36. package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
  37. package/lib/styles/themes/next-gen/variants/button.js +29 -1
  38. package/lib/styles/themes/next-gen/variants/text.js +15 -2
  39. package/lib/styles/themes/next-gen/variants/variants.js +36 -1
  40. package/lib/types/aiPanel.js +1 -0
  41. package/lib/utils/designUtils/figmaLinks.js +10 -0
  42. package/package.json +1 -1
@@ -662,5 +662,53 @@ declare const buttons: {
662
662
  };
663
663
  };
664
664
  };
665
+ aiChat: {
666
+ maxWidth: string;
667
+ gap: string;
668
+ border: string;
669
+ backgroundColor: string;
670
+ color: string;
671
+ path: {
672
+ fill: string;
673
+ };
674
+ '&.is-focused': {
675
+ outline: string;
676
+ outlineColor: string;
677
+ outlineOffset: string;
678
+ };
679
+ '&.is-hovered': {
680
+ backgroundColor: string;
681
+ path: {
682
+ fill: string;
683
+ };
684
+ };
685
+ '&.is-pressed': {
686
+ backgroundColor: string;
687
+ path: {
688
+ fill: string;
689
+ };
690
+ };
691
+ display: string;
692
+ borderColor: string;
693
+ alignItems: string;
694
+ justifyContent: string;
695
+ minWidth: string;
696
+ cursor: string;
697
+ fontFamily: string;
698
+ fontSize: string;
699
+ flexGrow: string;
700
+ fontWeight: number;
701
+ textAlign: string;
702
+ verticalAlign: string;
703
+ lineHeight: number;
704
+ borderRadius: string;
705
+ px: string;
706
+ py: string;
707
+ height: string;
708
+ '&.is-disabled': {
709
+ opacity: number;
710
+ };
711
+ transition: string;
712
+ };
665
713
  };
666
714
  export default buttons;
@@ -160,6 +160,33 @@ var primaryWithIcon = _objectSpread(_objectSpread({}, primary), {}, {
160
160
  display: 'inline-flex',
161
161
  color: 'white'
162
162
  });
163
+ var aiChat = _objectSpread(_objectSpread({}, withIcon), {}, {
164
+ maxWidth: 'fit-content',
165
+ gap: 'sm',
166
+ border: 'none',
167
+ backgroundColor: 'transparent',
168
+ color: 'text.primary',
169
+ path: {
170
+ fill: 'text.primary'
171
+ },
172
+ '&.is-focused': {
173
+ outline: '2px solid',
174
+ outlineColor: 'primary',
175
+ outlineOffset: '3px'
176
+ },
177
+ '&.is-hovered': {
178
+ backgroundColor: 'gray-100',
179
+ path: {
180
+ fill: 'dark'
181
+ }
182
+ },
183
+ '&.is-pressed': {
184
+ backgroundColor: '#d5dfe8 !important',
185
+ path: {
186
+ fill: 'dark'
187
+ }
188
+ }
189
+ });
163
190
  var baseIconButton = {
164
191
  cursor: 'pointer',
165
192
  transition: 'color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out',
@@ -281,7 +308,8 @@ var buttons = {
281
308
  withIcon: withIcon,
282
309
  primaryWithIcon: primaryWithIcon,
283
310
  iconButtons: iconButtons,
284
- modalCloseButton: modalCloseButton
311
+ modalCloseButton: modalCloseButton,
312
+ aiChat: aiChat
285
313
  };
286
314
  var _default = buttons;
287
315
  exports["default"] = _default;
@@ -1,4 +1,10 @@
1
1
  export declare const text: {
2
+ aiPanelHeader: {
3
+ fontFamily: string;
4
+ color: string;
5
+ fontSize: string;
6
+ fontWeight: number;
7
+ };
2
8
  h1: {
3
9
  fontSize: string;
4
10
  fontWeight: number;
@@ -45,6 +51,12 @@ export declare const text: {
45
51
  fontWeight: string;
46
52
  letterSpacing: string;
47
53
  };
54
+ suggestion: {
55
+ fontSize: string;
56
+ fontFamily: string;
57
+ color: string;
58
+ lineHeight: string;
59
+ };
48
60
  modalTitle: {
49
61
  fontSize: string;
50
62
  fontWeight: string;
@@ -55,7 +55,7 @@ var hTags = {
55
55
  fontSize: 'xs'
56
56
  }
57
57
  };
58
- var text = _objectSpread({
58
+ var text = _objectSpread(_objectSpread({
59
59
  sideNavHeader: {
60
60
  py: 'sm',
61
61
  lineHeight: 'body',
@@ -65,6 +65,12 @@ var text = _objectSpread({
65
65
  fontWeight: '1',
66
66
  letterSpacing: '1px'
67
67
  },
68
+ suggestion: {
69
+ fontSize: 'md',
70
+ fontFamily: 'standard',
71
+ color: 'text.primary',
72
+ lineHeight: '24px'
73
+ },
68
74
  modalTitle: {
69
75
  fontSize: '20px',
70
76
  fontWeight: '2',
@@ -101,5 +107,12 @@ var text = _objectSpread({
101
107
  display: 'list-item'
102
108
  }
103
109
  }
104
- }, hTags);
110
+ }, hTags), {}, {
111
+ aiPanelHeader: {
112
+ fontFamily: 'standard',
113
+ color: 'text.primary',
114
+ fontSize: 'lg',
115
+ fontWeight: 2
116
+ }
117
+ });
105
118
  exports.text = text;
@@ -839,6 +839,41 @@ declare const _default: {
839
839
  overlayPanel: {
840
840
  container: {
841
841
  backgroundColor: string;
842
+ border: string;
843
+ };
844
+ aiPanelContainer: {
845
+ backgroundColor: string;
846
+ border: string;
847
+ borderLeft: string;
848
+ position: string;
849
+ overflowY: string;
850
+ top: number;
851
+ bottom: number;
852
+ alignItems: string;
853
+ justifyContent: string;
854
+ boxShadow: string;
855
+ display: string;
856
+ opacity: number;
857
+ right: string;
858
+ transition: string;
859
+ maxWidth: string;
860
+ p: string;
861
+ '&.is-small': {
862
+ width: string;
863
+ };
864
+ '&.is-full': {
865
+ width: string;
866
+ };
867
+ '&.is-open.is-transitioning': {
868
+ right: number;
869
+ opacity: number;
870
+ };
871
+ };
872
+ body: {
873
+ gap: string;
874
+ minHeight: string;
875
+ maxWidth: string;
876
+ alignSelf: string;
842
877
  };
843
878
  innerPanel: {
844
879
  backgroundColor: string;
@@ -266,7 +266,42 @@ var dataTable = {
266
266
  };
267
267
  var overlayPanel = {
268
268
  container: {
269
- backgroundColor: 'background.base'
269
+ backgroundColor: 'background.base',
270
+ border: 'none'
271
+ },
272
+ aiPanelContainer: {
273
+ backgroundColor: 'background.base',
274
+ border: 'none',
275
+ borderLeft: 'none',
276
+ position: 'fixed',
277
+ overflowY: 'scroll',
278
+ top: 0,
279
+ bottom: 0,
280
+ alignItems: 'center',
281
+ justifyContent: 'center',
282
+ boxShadow: '-2px 0px 2px 1px rgba(37, 55, 70, 0.15)',
283
+ display: 'flex !important',
284
+ opacity: 0,
285
+ right: '-50%',
286
+ transition: 'all 500ms',
287
+ maxWidth: '100%',
288
+ p: 'lg',
289
+ '&.is-small': {
290
+ width: '420px'
291
+ },
292
+ '&.is-full': {
293
+ width: 'container.full'
294
+ },
295
+ '&.is-open.is-transitioning': {
296
+ right: 0,
297
+ opacity: 1
298
+ }
299
+ },
300
+ body: {
301
+ gap: 'md',
302
+ minHeight: '100%',
303
+ maxWidth: '768px',
304
+ alignSelf: 'center'
270
305
  },
271
306
  innerPanel: {
272
307
  backgroundColor: 'background.base'
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { BoxProps } from './box';
3
+ import { IconButtonProps } from './iconButton';
4
+ import { OverlayPanelProps, OverlayPanelState } from './overlayPanel';
5
+ interface SharedAIPanelProps {
6
+ isExpanded?: boolean;
7
+ setIsExpanded?: (isExpanded: boolean) => void;
8
+ onPanelClose?: () => void;
9
+ }
10
+ export interface AIPanelProps extends OverlayPanelProps, SharedAIPanelProps {
11
+ headerProps?: object;
12
+ state: OverlayPanelState;
13
+ }
14
+ export interface AIPanelHeaderProps extends BoxProps, SharedAIPanelProps {
15
+ onClose?: () => void;
16
+ setIsExpanded?: (isExpanded: boolean) => void;
17
+ isExpanded?: boolean;
18
+ onPanelClose?: () => void;
19
+ expandButtonProps?: IconButtonProps;
20
+ closeButtonProps?: IconButtonProps;
21
+ slots?: {
22
+ menuSlot?: React.ReactNode;
23
+ };
24
+ }
25
+ export {};
@@ -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
+ });
@@ -5,6 +5,9 @@ import { UseOverlayPanelStateReturnOnClose } from '../hooks/useOverlayPanelState
5
5
  import { TestingAttributes } from './shared/test';
6
6
  import { BoxProps } from './box';
7
7
  import { PanelSize } from './shared';
8
+ export interface OverlayPanelState extends OverlayTriggerState {
9
+ isTransitioning?: boolean;
10
+ }
8
11
  export interface OverlayPanelProps extends BoxProps, TestingAttributes {
9
12
  /** Sets the open state of the menu. */
10
13
  isOpen?: boolean;
@@ -19,5 +22,5 @@ export interface OverlayPanelProps extends BoxProps, TestingAttributes {
19
22
  triggerRef?: React.RefObject<HTMLButtonElement>;
20
23
  /** Inline styling prop for item */
21
24
  sx?: ThemeUICSSObject;
22
- state?: OverlayTriggerState;
25
+ state?: OverlayPanelState;
23
26
  }
@@ -209,4 +209,14 @@ export declare const FIGMA_LINKS: {
209
209
  editButton: {
210
210
  default: string;
211
211
  };
212
+ listViewItem: {
213
+ default: string;
214
+ withSubText: string;
215
+ withImage: string;
216
+ withControls: string;
217
+ withRightOfDataSlot: string;
218
+ withLeftOfDataSlot: string;
219
+ withCharts: string;
220
+ withExtraLongText: string;
221
+ };
212
222
  };
@@ -215,6 +215,16 @@ var FIGMA_LINKS = {
215
215
  },
216
216
  editButton: {
217
217
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58623-6267&t=pXTSE3YlGbL0X49N-4'
218
+ },
219
+ listViewItem: {
220
+ "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44688-39754&t=r7CoWppWfQQ6G2t8-4',
221
+ withSubText: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44688-39756&t=r7CoWppWfQQ6G2t8-4',
222
+ withImage: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44691-39794&t=r7CoWppWfQQ6G2t8-4',
223
+ withControls: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44691-39816&t=r7CoWppWfQQ6G2t8-4',
224
+ withRightOfDataSlot: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44693-39854&t=r7CoWppWfQQ6G2t8-4',
225
+ withLeftOfDataSlot: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44693-39909&t=r7CoWppWfQQ6G2t8-4',
226
+ withCharts: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44694-39944&t=r7CoWppWfQQ6G2t8-4',
227
+ withExtraLongText: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44694-40069&t=r7CoWppWfQQ6G2t8-4'
218
228
  }
219
229
  };
220
230
  exports.FIGMA_LINKS = FIGMA_LINKS;
@@ -0,0 +1,25 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["state", "triggerRef", "isExpanded", "setIsExpanded", "onPanelClose", "children", "headerProps"];
4
+ import React from 'react';
5
+ import { OverlayPanel, OverlayProvider } from '../../../index';
6
+ import { jsx as ___EmotionJSX } from "@emotion/react";
7
+ var AIPanel = function AIPanel(props) {
8
+ var state = props.state,
9
+ triggerRef = props.triggerRef,
10
+ isExpanded = props.isExpanded,
11
+ setIsExpanded = props.setIsExpanded,
12
+ onPanelClose = props.onPanelClose,
13
+ children = props.children,
14
+ headerProps = props.headerProps,
15
+ others = _objectWithoutProperties(props, _excluded);
16
+ return ___EmotionJSX(OverlayProvider, null, (state.isOpen || state.isTransitioning) && ___EmotionJSX(OverlayPanel, _extends({
17
+ isTransitioning: state === null || state === void 0 ? void 0 : state.isTransitioning,
18
+ isOpen: state.isOpen,
19
+ state: state,
20
+ triggerRef: triggerRef,
21
+ size: isExpanded ? 'full' : 'small',
22
+ variant: "overlayPanel.aiPanelContainer"
23
+ }, others), children));
24
+ };
25
+ export default AIPanel;
@@ -0,0 +1,92 @@
1
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
+ import React, { useRef, useState } from 'react';
3
+ import AutoAwesomeIcon from '@pingux/mdi-react/AutoAwesomeOutlineIcon';
4
+ import DotsIcon from '@pingux/mdi-react/DotsHorizontalIcon';
5
+ import { useOverlayPanelState } from '../../../hooks';
6
+ import { Box, Button, Icon, IconButton, Item, Menu, PopoverMenu, Text } from '../../../index';
7
+ import AIPanel from './AIPanel';
8
+ import AIPanelHeader from './AIPanelHeader';
9
+ import { jsx as ___EmotionJSX } from "@emotion/react";
10
+ export default {
11
+ component: AIPanel,
12
+ title: 'AI Components/AI Panel'
13
+ };
14
+ var AIMenuPopover = function AIMenuPopover() {
15
+ var _useState = useState(false),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ isOpen = _useState2[0],
18
+ setIsOpen = _useState2[1];
19
+ return ___EmotionJSX(PopoverMenu, {
20
+ isOpen: isOpen,
21
+ onOpenChange: setIsOpen
22
+ }, ___EmotionJSX(IconButton, {
23
+ "aria-label": "more options"
24
+ }, ___EmotionJSX(Icon, {
25
+ icon: DotsIcon,
26
+ size: "sm",
27
+ title: {
28
+ name: 'Dots Vertical Icon'
29
+ }
30
+ })), ___EmotionJSX(Menu, null, ___EmotionJSX(Item, {
31
+ key: "edit"
32
+ }, "Edit"), ___EmotionJSX(Item, {
33
+ key: "duplicate"
34
+ }, "Duplicate"), ___EmotionJSX(Item, {
35
+ key: "delete",
36
+ textValue: "delete"
37
+ }, ___EmotionJSX(Text, {
38
+ color: "critical.bright"
39
+ }, "Delete"))));
40
+ };
41
+ export var Default = function Default() {
42
+ var _useOverlayPanelState = useOverlayPanelState({
43
+ transitionDuration: 1000
44
+ }),
45
+ state = _useOverlayPanelState.state,
46
+ onClose = _useOverlayPanelState.onClose;
47
+ var triggerRef = useRef(null);
48
+ var _useState3 = useState(false),
49
+ _useState4 = _slicedToArray(_useState3, 2),
50
+ isExpanded = _useState4[0],
51
+ setIsExpanded = _useState4[1];
52
+ var onPanelClose = function onPanelClose() {
53
+ state.close();
54
+ onClose();
55
+ };
56
+ var setIsPanelExpanded = function setIsPanelExpanded() {
57
+ setIsExpanded(!isExpanded);
58
+ };
59
+ return ___EmotionJSX(Box, {
60
+ sx: {
61
+ maxWidth: state.isOpen ? 'calc(100% - 420px)' : '100%',
62
+ transition: '.4s all ease'
63
+ }
64
+ }, ___EmotionJSX(Button, {
65
+ ref: triggerRef,
66
+ onPress: state.open,
67
+ "aria-expanded": state.isOpen,
68
+ variant: "aiChat",
69
+ title: "open ai chat panel"
70
+ }, ___EmotionJSX(Icon, {
71
+ icon: AutoAwesomeIcon
72
+ }), "Open Panel"), ___EmotionJSX(AIPanel, {
73
+ state: state,
74
+ triggerRef: triggerRef,
75
+ isExpanded: isExpanded,
76
+ setIsExpanded: setIsPanelExpanded,
77
+ onPanelClose: onPanelClose
78
+ }, ___EmotionJSX(AIPanelHeader, {
79
+ slots: {
80
+ menuSlot: ___EmotionJSX(AIMenuPopover, null)
81
+ },
82
+ isExpanded: isExpanded,
83
+ setIsExpanded: setIsPanelExpanded,
84
+ onPanelClose: onPanelClose
85
+ }), ___EmotionJSX(Box, {
86
+ gap: "md",
87
+ py: "md",
88
+ minHeight: "100%",
89
+ maxWidth: "768px",
90
+ alignSelf: "center"
91
+ }, "AI Component Children will render here")));
92
+ };
@@ -0,0 +1,96 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
+ import React, { useRef, useState } from 'react';
4
+ import { useOverlayPanelState } from '../../../hooks';
5
+ import { Box, Button } from '../../../index';
6
+ import { fireEvent, render, screen } from '../../../utils/testUtils/testWrapper';
7
+ import AIPanel from './AIPanel';
8
+ import AIPanelHeader from './AIPanelHeader';
9
+ import { jsx as ___EmotionJSX } from "@emotion/react";
10
+ var testId = 'test-overlayPanel';
11
+ var closeButtonId = 'close-button';
12
+ var defaultProps = {
13
+ 'data-testid': testId
14
+ };
15
+ var slotText = 'slot text';
16
+ var AIMenuPopover = function AIMenuPopover() {
17
+ return ___EmotionJSX("p", null, slotText);
18
+ };
19
+ var Component = function Component(props) {
20
+ var slots = props.slots;
21
+ var _useOverlayPanelState = useOverlayPanelState({
22
+ transitionDuration: 1000
23
+ }),
24
+ state = _useOverlayPanelState.state,
25
+ onClose = _useOverlayPanelState.onClose;
26
+ var triggerRef = useRef(null);
27
+ var _useState = useState(false),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ isExpanded = _useState2[0],
30
+ setIsExpanded = _useState2[1];
31
+ var onPanelClose = function onPanelClose() {
32
+ state.close();
33
+ onClose();
34
+ };
35
+ var setIsPanelExpanded = function setIsPanelExpanded() {
36
+ setIsExpanded(!isExpanded);
37
+ };
38
+ return ___EmotionJSX(Box, {
39
+ sx: {
40
+ maxWidth: state.isOpen ? 'calc(100% - 420px)' : '100%',
41
+ transition: '.4s all ease'
42
+ }
43
+ }, ___EmotionJSX(Button, {
44
+ ref: triggerRef,
45
+ onPress: state.open,
46
+ "aria-expanded": state.isOpen
47
+ }, "Open Panel"), ___EmotionJSX(AIPanel, _extends({
48
+ triggerRef: triggerRef,
49
+ isExpanded: isExpanded,
50
+ setIsExpanded: setIsPanelExpanded,
51
+ onPanelClose: onPanelClose
52
+ }, defaultProps, {
53
+ state: state
54
+ }), ___EmotionJSX(AIPanelHeader, {
55
+ slots: slots,
56
+ isExpanded: isExpanded,
57
+ setIsExpanded: setIsPanelExpanded,
58
+ onPanelClose: onPanelClose
59
+ }), "AI Component Children will render here"));
60
+ };
61
+ test('AIPanel renders correctly', function () {
62
+ render(___EmotionJSX(Component, null));
63
+ expect(screen.getByText('Open Panel')).toBeInTheDocument();
64
+ });
65
+ test('AIPanel opens and closes correctly', function () {
66
+ render(___EmotionJSX(Component, null));
67
+ var openButton = screen.getByText('Open Panel');
68
+ fireEvent.click(openButton);
69
+ expect(screen.getByTestId(testId)).toBeInTheDocument();
70
+ var closeButton = screen.getByTestId(closeButtonId);
71
+ fireEvent.click(closeButton);
72
+ expect(screen.queryByTestId(testId)).not.toHaveClass('is-open');
73
+ });
74
+ test('AIPanel expands and collapses correctly', function () {
75
+ render(___EmotionJSX(Component, null));
76
+ var openButton = screen.getByText('Open Panel');
77
+ fireEvent.click(openButton);
78
+ expect(screen.getByTestId(testId)).toBeInTheDocument();
79
+ var expandButton = screen.getByTestId('expand-button');
80
+ fireEvent.click(expandButton);
81
+ expect(screen.getByTestId(testId)).toHaveClass('is-full');
82
+ fireEvent.click(expandButton);
83
+ expect(screen.getByTestId(testId)).not.toHaveClass('is-full');
84
+ });
85
+ test('AIPanel menuSlot renders correctly', function () {
86
+ render(___EmotionJSX(Component, {
87
+ slots: {
88
+ menuSlot: ___EmotionJSX(AIMenuPopover, null)
89
+ }
90
+ }));
91
+ var openButton = screen.getByText('Open Panel');
92
+ fireEvent.click(openButton);
93
+ expect(screen.getByTestId(testId)).toBeInTheDocument();
94
+ var thisSlot = screen.getByText(slotText);
95
+ expect(thisSlot).toBeInTheDocument();
96
+ });
@@ -0,0 +1,47 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import React from 'react';
3
+ import CollapseIcon from '@pingux/mdi-react/ArrowCollapseIcon';
4
+ import OpenIcon from '@pingux/mdi-react/ArrowTopRightBottomLeftIcon';
5
+ import CloseIcon from '@pingux/mdi-react/CloseIcon';
6
+ import { Box, Icon, IconButton, Text } from '../../../index';
7
+ import { jsx as ___EmotionJSX } from "@emotion/react";
8
+ var AIPanelHeader = function AIPanelHeader(props) {
9
+ var setIsExpanded = props.setIsExpanded,
10
+ isExpanded = props.isExpanded,
11
+ onPanelClose = props.onPanelClose,
12
+ slots = props.slots,
13
+ expandButtonProps = props.expandButtonProps,
14
+ closeButtonProps = props.closeButtonProps;
15
+ var toggleExpanded = function toggleExpanded() {
16
+ if (setIsExpanded) {
17
+ setIsExpanded(!isExpanded);
18
+ }
19
+ };
20
+ return ___EmotionJSX(Box, {
21
+ isRow: true,
22
+ alignItems: "center"
23
+ }, ___EmotionJSX(Text, {
24
+ variant: "aiPanelHeader"
25
+ }, "AI Assistant"), ___EmotionJSX(Box, {
26
+ sx: {
27
+ ml: 'auto',
28
+ mr: '0px'
29
+ },
30
+ isRow: true,
31
+ alignItems: "center",
32
+ gap: "xs"
33
+ }, (slots === null || slots === void 0 ? void 0 : slots.menuSlot) && slots.menuSlot, ___EmotionJSX(IconButton, _extends({
34
+ onPress: toggleExpanded,
35
+ "data-testid": "expand-button",
36
+ title: "toggle panel expansion"
37
+ }, expandButtonProps), ___EmotionJSX(Icon, {
38
+ icon: isExpanded ? CollapseIcon : OpenIcon
39
+ })), ___EmotionJSX(IconButton, _extends({
40
+ onPress: onPanelClose,
41
+ title: "close panel",
42
+ "data-testid": "close-button"
43
+ }, closeButtonProps), ___EmotionJSX(Icon, {
44
+ icon: CloseIcon
45
+ }))));
46
+ };
47
+ export default AIPanelHeader;
@@ -0,0 +1,2 @@
1
+ export { default } from './AIPanel';
2
+ export { default as AIPanelHeader } from './AIPanelHeader';