@pingux/astro 2.104.0-alpha.3 → 2.104.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.
- package/lib/cjs/components/AIComponents/AIPanel/AIPanel.d.ts +4 -0
- package/lib/cjs/components/AIComponents/AIPanel/AIPanel.js +34 -0
- package/lib/cjs/components/AIComponents/AIPanel/AIPanel.stories.d.ts +7 -0
- package/lib/cjs/components/AIComponents/AIPanel/AIPanel.stories.js +107 -0
- package/lib/cjs/components/AIComponents/AIPanel/AIPanel.test.d.ts +1 -0
- package/lib/cjs/components/AIComponents/AIPanel/AIPanel.test.js +105 -0
- package/lib/cjs/components/AIComponents/AIPanel/AIPanelHeader.d.ts +4 -0
- package/lib/cjs/components/AIComponents/AIPanel/AIPanelHeader.js +56 -0
- package/lib/cjs/components/AIComponents/AIPanel/index.d.ts +2 -0
- package/lib/cjs/components/AIComponents/AIPanel/index.js +21 -0
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +16 -0
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +95 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +48 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.js +29 -1
- package/lib/cjs/styles/themes/next-gen/variants/text.d.ts +12 -0
- package/lib/cjs/styles/themes/next-gen/variants/text.js +15 -2
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +35 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +36 -1
- package/lib/cjs/types/aiPanel.d.ts +25 -0
- package/lib/cjs/types/aiPanel.js +6 -0
- package/lib/cjs/types/overlayPanel.d.ts +4 -1
- package/lib/components/AIComponents/AIPanel/AIPanel.js +25 -0
- package/lib/components/AIComponents/AIPanel/AIPanel.stories.js +92 -0
- package/lib/components/AIComponents/AIPanel/AIPanel.test.js +96 -0
- package/lib/components/AIComponents/AIPanel/AIPanelHeader.js +47 -0
- package/lib/components/AIComponents/AIPanel/index.js +2 -0
- package/lib/index.js +2 -0
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/styles/themes/next-gen/variants/button.js +29 -1
- package/lib/styles/themes/next-gen/variants/text.js +15 -2
- package/lib/styles/themes/next-gen/variants/variants.js +36 -1
- package/lib/types/aiPanel.js +1 -0
- package/package.json +1 -1
@@ -0,0 +1,34 @@
|
|
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 _index = require("../../../index");
|
13
|
+
var _react2 = require("@emotion/react");
|
14
|
+
var _excluded = ["state", "triggerRef", "isExpanded", "setIsExpanded", "onPanelClose", "children", "headerProps"];
|
15
|
+
var AIPanel = function AIPanel(props) {
|
16
|
+
var state = props.state,
|
17
|
+
triggerRef = props.triggerRef,
|
18
|
+
isExpanded = props.isExpanded,
|
19
|
+
setIsExpanded = props.setIsExpanded,
|
20
|
+
onPanelClose = props.onPanelClose,
|
21
|
+
children = props.children,
|
22
|
+
headerProps = props.headerProps,
|
23
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
24
|
+
return (0, _react2.jsx)(_index.OverlayProvider, null, (state.isOpen || state.isTransitioning) && (0, _react2.jsx)(_index.OverlayPanel, (0, _extends2["default"])({
|
25
|
+
isTransitioning: state === null || state === void 0 ? void 0 : state.isTransitioning,
|
26
|
+
isOpen: state.isOpen,
|
27
|
+
state: state,
|
28
|
+
triggerRef: triggerRef,
|
29
|
+
size: isExpanded ? 'full' : 'small',
|
30
|
+
variant: "overlayPanel.aiPanelContainer"
|
31
|
+
}, others), children));
|
32
|
+
};
|
33
|
+
var _default = AIPanel;
|
34
|
+
exports["default"] = _default;
|
@@ -0,0 +1,107 @@
|
|
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"] = exports.Default = void 0;
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
14
|
+
var _AutoAwesomeOutlineIcon = _interopRequireDefault(require("@pingux/mdi-react/AutoAwesomeOutlineIcon"));
|
15
|
+
var _DotsHorizontalIcon = _interopRequireDefault(require("@pingux/mdi-react/DotsHorizontalIcon"));
|
16
|
+
var _hooks = require("../../../hooks");
|
17
|
+
var _index = require("../../../index");
|
18
|
+
var _AIPanel = _interopRequireDefault(require("./AIPanel"));
|
19
|
+
var _AIPanelHeader = _interopRequireDefault(require("./AIPanelHeader"));
|
20
|
+
var _react2 = require("@emotion/react");
|
21
|
+
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); }
|
22
|
+
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; }
|
23
|
+
var _default = {
|
24
|
+
component: _AIPanel["default"],
|
25
|
+
title: 'AI Components/AI Panel'
|
26
|
+
};
|
27
|
+
exports["default"] = _default;
|
28
|
+
var AIMenuPopover = function AIMenuPopover() {
|
29
|
+
var _useState = (0, _react.useState)(false),
|
30
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
31
|
+
isOpen = _useState2[0],
|
32
|
+
setIsOpen = _useState2[1];
|
33
|
+
return (0, _react2.jsx)(_index.PopoverMenu, {
|
34
|
+
isOpen: isOpen,
|
35
|
+
onOpenChange: setIsOpen
|
36
|
+
}, (0, _react2.jsx)(_index.IconButton, {
|
37
|
+
"aria-label": "more options"
|
38
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
39
|
+
icon: _DotsHorizontalIcon["default"],
|
40
|
+
size: "sm",
|
41
|
+
title: {
|
42
|
+
name: 'Dots Vertical Icon'
|
43
|
+
}
|
44
|
+
})), (0, _react2.jsx)(_index.Menu, null, (0, _react2.jsx)(_index.Item, {
|
45
|
+
key: "edit"
|
46
|
+
}, "Edit"), (0, _react2.jsx)(_index.Item, {
|
47
|
+
key: "duplicate"
|
48
|
+
}, "Duplicate"), (0, _react2.jsx)(_index.Item, {
|
49
|
+
key: "delete",
|
50
|
+
textValue: "delete"
|
51
|
+
}, (0, _react2.jsx)(_index.Text, {
|
52
|
+
color: "critical.bright"
|
53
|
+
}, "Delete"))));
|
54
|
+
};
|
55
|
+
var Default = function Default() {
|
56
|
+
var _useOverlayPanelState = (0, _hooks.useOverlayPanelState)({
|
57
|
+
transitionDuration: 1000
|
58
|
+
}),
|
59
|
+
state = _useOverlayPanelState.state,
|
60
|
+
onClose = _useOverlayPanelState.onClose;
|
61
|
+
var triggerRef = (0, _react.useRef)(null);
|
62
|
+
var _useState3 = (0, _react.useState)(false),
|
63
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
64
|
+
isExpanded = _useState4[0],
|
65
|
+
setIsExpanded = _useState4[1];
|
66
|
+
var onPanelClose = function onPanelClose() {
|
67
|
+
state.close();
|
68
|
+
onClose();
|
69
|
+
};
|
70
|
+
var setIsPanelExpanded = function setIsPanelExpanded() {
|
71
|
+
setIsExpanded(!isExpanded);
|
72
|
+
};
|
73
|
+
return (0, _react2.jsx)(_index.Box, {
|
74
|
+
sx: {
|
75
|
+
maxWidth: state.isOpen ? 'calc(100% - 420px)' : '100%',
|
76
|
+
transition: '.4s all ease'
|
77
|
+
}
|
78
|
+
}, (0, _react2.jsx)(_index.Button, {
|
79
|
+
ref: triggerRef,
|
80
|
+
onPress: state.open,
|
81
|
+
"aria-expanded": state.isOpen,
|
82
|
+
variant: "aiChat",
|
83
|
+
title: "open ai chat panel"
|
84
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
85
|
+
icon: _AutoAwesomeOutlineIcon["default"]
|
86
|
+
}), "Open Panel"), (0, _react2.jsx)(_AIPanel["default"], {
|
87
|
+
state: state,
|
88
|
+
triggerRef: triggerRef,
|
89
|
+
isExpanded: isExpanded,
|
90
|
+
setIsExpanded: setIsPanelExpanded,
|
91
|
+
onPanelClose: onPanelClose
|
92
|
+
}, (0, _react2.jsx)(_AIPanelHeader["default"], {
|
93
|
+
slots: {
|
94
|
+
menuSlot: (0, _react2.jsx)(AIMenuPopover, null)
|
95
|
+
},
|
96
|
+
isExpanded: isExpanded,
|
97
|
+
setIsExpanded: setIsPanelExpanded,
|
98
|
+
onPanelClose: onPanelClose
|
99
|
+
}), (0, _react2.jsx)(_index.Box, {
|
100
|
+
gap: "md",
|
101
|
+
py: "md",
|
102
|
+
minHeight: "100%",
|
103
|
+
maxWidth: "768px",
|
104
|
+
alignSelf: "center"
|
105
|
+
}, "AI Component Children will render here")));
|
106
|
+
};
|
107
|
+
exports.Default = Default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,105 @@
|
|
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
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
var _hooks = require("../../../hooks");
|
12
|
+
var _index = require("../../../index");
|
13
|
+
var _testWrapper = require("../../../utils/testUtils/testWrapper");
|
14
|
+
var _AIPanel = _interopRequireDefault(require("./AIPanel"));
|
15
|
+
var _AIPanelHeader = _interopRequireDefault(require("./AIPanelHeader"));
|
16
|
+
var _react2 = require("@emotion/react");
|
17
|
+
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); }
|
18
|
+
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; }
|
19
|
+
var testId = 'test-overlayPanel';
|
20
|
+
var closeButtonId = 'close-button';
|
21
|
+
var defaultProps = {
|
22
|
+
'data-testid': testId
|
23
|
+
};
|
24
|
+
var slotText = 'slot text';
|
25
|
+
var AIMenuPopover = function AIMenuPopover() {
|
26
|
+
return (0, _react2.jsx)("p", null, slotText);
|
27
|
+
};
|
28
|
+
var Component = function Component(props) {
|
29
|
+
var slots = props.slots;
|
30
|
+
var _useOverlayPanelState = (0, _hooks.useOverlayPanelState)({
|
31
|
+
transitionDuration: 1000
|
32
|
+
}),
|
33
|
+
state = _useOverlayPanelState.state,
|
34
|
+
onClose = _useOverlayPanelState.onClose;
|
35
|
+
var triggerRef = (0, _react.useRef)(null);
|
36
|
+
var _useState = (0, _react.useState)(false),
|
37
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
38
|
+
isExpanded = _useState2[0],
|
39
|
+
setIsExpanded = _useState2[1];
|
40
|
+
var onPanelClose = function onPanelClose() {
|
41
|
+
state.close();
|
42
|
+
onClose();
|
43
|
+
};
|
44
|
+
var setIsPanelExpanded = function setIsPanelExpanded() {
|
45
|
+
setIsExpanded(!isExpanded);
|
46
|
+
};
|
47
|
+
return (0, _react2.jsx)(_index.Box, {
|
48
|
+
sx: {
|
49
|
+
maxWidth: state.isOpen ? 'calc(100% - 420px)' : '100%',
|
50
|
+
transition: '.4s all ease'
|
51
|
+
}
|
52
|
+
}, (0, _react2.jsx)(_index.Button, {
|
53
|
+
ref: triggerRef,
|
54
|
+
onPress: state.open,
|
55
|
+
"aria-expanded": state.isOpen
|
56
|
+
}, "Open Panel"), (0, _react2.jsx)(_AIPanel["default"], (0, _extends2["default"])({
|
57
|
+
triggerRef: triggerRef,
|
58
|
+
isExpanded: isExpanded,
|
59
|
+
setIsExpanded: setIsPanelExpanded,
|
60
|
+
onPanelClose: onPanelClose
|
61
|
+
}, defaultProps, {
|
62
|
+
state: state
|
63
|
+
}), (0, _react2.jsx)(_AIPanelHeader["default"], {
|
64
|
+
slots: slots,
|
65
|
+
isExpanded: isExpanded,
|
66
|
+
setIsExpanded: setIsPanelExpanded,
|
67
|
+
onPanelClose: onPanelClose
|
68
|
+
}), "AI Component Children will render here"));
|
69
|
+
};
|
70
|
+
test('AIPanel renders correctly', function () {
|
71
|
+
(0, _testWrapper.render)((0, _react2.jsx)(Component, null));
|
72
|
+
expect(_testWrapper.screen.getByText('Open Panel')).toBeInTheDocument();
|
73
|
+
});
|
74
|
+
test('AIPanel opens and closes correctly', function () {
|
75
|
+
(0, _testWrapper.render)((0, _react2.jsx)(Component, null));
|
76
|
+
var openButton = _testWrapper.screen.getByText('Open Panel');
|
77
|
+
_testWrapper.fireEvent.click(openButton);
|
78
|
+
expect(_testWrapper.screen.getByTestId(testId)).toBeInTheDocument();
|
79
|
+
var closeButton = _testWrapper.screen.getByTestId(closeButtonId);
|
80
|
+
_testWrapper.fireEvent.click(closeButton);
|
81
|
+
expect(_testWrapper.screen.queryByTestId(testId)).not.toHaveClass('is-open');
|
82
|
+
});
|
83
|
+
test('AIPanel expands and collapses correctly', function () {
|
84
|
+
(0, _testWrapper.render)((0, _react2.jsx)(Component, null));
|
85
|
+
var openButton = _testWrapper.screen.getByText('Open Panel');
|
86
|
+
_testWrapper.fireEvent.click(openButton);
|
87
|
+
expect(_testWrapper.screen.getByTestId(testId)).toBeInTheDocument();
|
88
|
+
var expandButton = _testWrapper.screen.getByTestId('expand-button');
|
89
|
+
_testWrapper.fireEvent.click(expandButton);
|
90
|
+
expect(_testWrapper.screen.getByTestId(testId)).toHaveClass('is-full');
|
91
|
+
_testWrapper.fireEvent.click(expandButton);
|
92
|
+
expect(_testWrapper.screen.getByTestId(testId)).not.toHaveClass('is-full');
|
93
|
+
});
|
94
|
+
test('AIPanel menuSlot renders correctly', function () {
|
95
|
+
(0, _testWrapper.render)((0, _react2.jsx)(Component, {
|
96
|
+
slots: {
|
97
|
+
menuSlot: (0, _react2.jsx)(AIMenuPopover, null)
|
98
|
+
}
|
99
|
+
}));
|
100
|
+
var openButton = _testWrapper.screen.getByText('Open Panel');
|
101
|
+
_testWrapper.fireEvent.click(openButton);
|
102
|
+
expect(_testWrapper.screen.getByTestId(testId)).toBeInTheDocument();
|
103
|
+
var thisSlot = _testWrapper.screen.getByText(slotText);
|
104
|
+
expect(thisSlot).toBeInTheDocument();
|
105
|
+
});
|
@@ -0,0 +1,56 @@
|
|
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 _react = _interopRequireDefault(require("react"));
|
11
|
+
var _ArrowCollapseIcon = _interopRequireDefault(require("@pingux/mdi-react/ArrowCollapseIcon"));
|
12
|
+
var _ArrowTopRightBottomLeftIcon = _interopRequireDefault(require("@pingux/mdi-react/ArrowTopRightBottomLeftIcon"));
|
13
|
+
var _CloseIcon = _interopRequireDefault(require("@pingux/mdi-react/CloseIcon"));
|
14
|
+
var _index = require("../../../index");
|
15
|
+
var _react2 = require("@emotion/react");
|
16
|
+
var AIPanelHeader = function AIPanelHeader(props) {
|
17
|
+
var setIsExpanded = props.setIsExpanded,
|
18
|
+
isExpanded = props.isExpanded,
|
19
|
+
onPanelClose = props.onPanelClose,
|
20
|
+
slots = props.slots,
|
21
|
+
expandButtonProps = props.expandButtonProps,
|
22
|
+
closeButtonProps = props.closeButtonProps;
|
23
|
+
var toggleExpanded = function toggleExpanded() {
|
24
|
+
if (setIsExpanded) {
|
25
|
+
setIsExpanded(!isExpanded);
|
26
|
+
}
|
27
|
+
};
|
28
|
+
return (0, _react2.jsx)(_index.Box, {
|
29
|
+
isRow: true,
|
30
|
+
alignItems: "center"
|
31
|
+
}, (0, _react2.jsx)(_index.Text, {
|
32
|
+
variant: "aiPanelHeader"
|
33
|
+
}, "AI Assistant"), (0, _react2.jsx)(_index.Box, {
|
34
|
+
sx: {
|
35
|
+
ml: 'auto',
|
36
|
+
mr: '0px'
|
37
|
+
},
|
38
|
+
isRow: true,
|
39
|
+
alignItems: "center",
|
40
|
+
gap: "xs"
|
41
|
+
}, (slots === null || slots === void 0 ? void 0 : slots.menuSlot) && slots.menuSlot, (0, _react2.jsx)(_index.IconButton, (0, _extends2["default"])({
|
42
|
+
onPress: toggleExpanded,
|
43
|
+
"data-testid": "expand-button",
|
44
|
+
title: "toggle panel expansion"
|
45
|
+
}, expandButtonProps), (0, _react2.jsx)(_index.Icon, {
|
46
|
+
icon: isExpanded ? _ArrowCollapseIcon["default"] : _ArrowTopRightBottomLeftIcon["default"]
|
47
|
+
})), (0, _react2.jsx)(_index.IconButton, (0, _extends2["default"])({
|
48
|
+
onPress: onPanelClose,
|
49
|
+
title: "close panel",
|
50
|
+
"data-testid": "close-button"
|
51
|
+
}, closeButtonProps), (0, _react2.jsx)(_index.Icon, {
|
52
|
+
icon: _CloseIcon["default"]
|
53
|
+
}))));
|
54
|
+
};
|
55
|
+
var _default = AIPanelHeader;
|
56
|
+
exports["default"] = _default;
|
@@ -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, "AIPanelHeader", {
|
9
|
+
enumerable: true,
|
10
|
+
get: function get() {
|
11
|
+
return _AIPanelHeader["default"];
|
12
|
+
}
|
13
|
+
});
|
14
|
+
_Object$defineProperty(exports, "default", {
|
15
|
+
enumerable: true,
|
16
|
+
get: function get() {
|
17
|
+
return _AIPanel["default"];
|
18
|
+
}
|
19
|
+
});
|
20
|
+
var _AIPanel = _interopRequireDefault(require("./AIPanel"));
|
21
|
+
var _AIPanelHeader = _interopRequireDefault(require("./AIPanelHeader"));
|
package/lib/cjs/index.d.ts
CHANGED
@@ -6,6 +6,8 @@ export { default as AccordionGroup } from './components/AccordionGroup';
|
|
6
6
|
export * from './components/AccordionGroup';
|
7
7
|
export { default as AccordionItem } from './components/AccordionItem';
|
8
8
|
export * from './components/AccordionItem';
|
9
|
+
export { default as AIPanel } from './components/AIComponents/AIPanel/AIPanel';
|
10
|
+
export { default as AIPanelHeader } from './components/AIComponents/AIPanel/AIPanelHeader';
|
9
11
|
export { default as Prompt } from './components/AIComponents/Prompt';
|
10
12
|
export { default as Response } from './components/AIComponents/Response';
|
11
13
|
export { default as ResponseAttachment } from './components/AIComponents/Response/ResponseAttachment';
|
package/lib/cjs/index.js
CHANGED
@@ -16,6 +16,8 @@ var _exportNames = {
|
|
16
16
|
AccordionGridItem: true,
|
17
17
|
AccordionGroup: true,
|
18
18
|
AccordionItem: true,
|
19
|
+
AIPanel: true,
|
20
|
+
AIPanelHeader: true,
|
19
21
|
Prompt: true,
|
20
22
|
Response: true,
|
21
23
|
ResponseAttachment: true,
|
@@ -147,6 +149,18 @@ var _exportNames = {
|
|
147
149
|
DataTableHeader: true,
|
148
150
|
DataTableRow: true
|
149
151
|
};
|
152
|
+
_Object$defineProperty(exports, "AIPanel", {
|
153
|
+
enumerable: true,
|
154
|
+
get: function get() {
|
155
|
+
return _AIPanel["default"];
|
156
|
+
}
|
157
|
+
});
|
158
|
+
_Object$defineProperty(exports, "AIPanelHeader", {
|
159
|
+
enumerable: true,
|
160
|
+
get: function get() {
|
161
|
+
return _AIPanelHeader["default"];
|
162
|
+
}
|
163
|
+
});
|
150
164
|
_Object$defineProperty(exports, "AccordionGridGroup", {
|
151
165
|
enumerable: true,
|
152
166
|
get: function get() {
|
@@ -999,6 +1013,8 @@ _forEachInstanceProperty(_context4 = _Object$keys(_AccordionItem)).call(_context
|
|
999
1013
|
}
|
1000
1014
|
});
|
1001
1015
|
});
|
1016
|
+
var _AIPanel = _interopRequireDefault(require("./components/AIComponents/AIPanel/AIPanel"));
|
1017
|
+
var _AIPanelHeader = _interopRequireDefault(require("./components/AIComponents/AIPanel/AIPanelHeader"));
|
1002
1018
|
var _Prompt = _interopRequireDefault(require("./components/AIComponents/Prompt"));
|
1003
1019
|
var _Response = _interopRequireDefault(require("./components/AIComponents/Response"));
|
1004
1020
|
var _ResponseAttachment = _interopRequireDefault(require("./components/AIComponents/Response/ResponseAttachment"));
|
@@ -17,7 +17,7 @@ var componentSpecificNextGenBlacklist = {
|
|
17
17
|
OverlayPanel: ['Expandable']
|
18
18
|
};
|
19
19
|
exports.componentSpecificNextGenBlacklist = componentSpecificNextGenBlacklist;
|
20
|
-
var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'Response'];
|
20
|
+
var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'AI Panel', 'Response'];
|
21
21
|
exports.nextGenOnlyComponents = nextGenOnlyComponents;
|
22
22
|
var _default = nextGenConvertedComponents;
|
23
23
|
exports["default"] = _default;
|
@@ -894,6 +894,54 @@ declare const _default: {
|
|
894
894
|
};
|
895
895
|
};
|
896
896
|
};
|
897
|
+
aiChat: {
|
898
|
+
maxWidth: string;
|
899
|
+
gap: string;
|
900
|
+
border: string;
|
901
|
+
backgroundColor: string;
|
902
|
+
color: string;
|
903
|
+
path: {
|
904
|
+
fill: string;
|
905
|
+
};
|
906
|
+
'&.is-focused': {
|
907
|
+
outline: string;
|
908
|
+
outlineColor: string;
|
909
|
+
outlineOffset: string;
|
910
|
+
};
|
911
|
+
'&.is-hovered': {
|
912
|
+
backgroundColor: string;
|
913
|
+
path: {
|
914
|
+
fill: string;
|
915
|
+
};
|
916
|
+
};
|
917
|
+
'&.is-pressed': {
|
918
|
+
backgroundColor: string;
|
919
|
+
path: {
|
920
|
+
fill: string;
|
921
|
+
};
|
922
|
+
};
|
923
|
+
display: string;
|
924
|
+
borderColor: string;
|
925
|
+
alignItems: string;
|
926
|
+
justifyContent: string;
|
927
|
+
minWidth: string;
|
928
|
+
cursor: string;
|
929
|
+
fontFamily: string;
|
930
|
+
fontSize: string;
|
931
|
+
flexGrow: string;
|
932
|
+
fontWeight: number;
|
933
|
+
textAlign: string;
|
934
|
+
verticalAlign: string;
|
935
|
+
lineHeight: number;
|
936
|
+
borderRadius: string;
|
937
|
+
px: string;
|
938
|
+
py: string;
|
939
|
+
height: string;
|
940
|
+
'&.is-disabled': {
|
941
|
+
opacity: number;
|
942
|
+
};
|
943
|
+
transition: string;
|
944
|
+
};
|
897
945
|
};
|
898
946
|
forms: {
|
899
947
|
input: import("theme-ui").ThemeUICSSObject;
|
@@ -1039,6 +1087,12 @@ declare const _default: {
|
|
1039
1087
|
md: string;
|
1040
1088
|
};
|
1041
1089
|
text: {
|
1090
|
+
aiPanelHeader: {
|
1091
|
+
fontFamily: string;
|
1092
|
+
color: string;
|
1093
|
+
fontSize: string;
|
1094
|
+
fontWeight: number;
|
1095
|
+
};
|
1042
1096
|
h1: {
|
1043
1097
|
fontSize: string;
|
1044
1098
|
fontWeight: number;
|
@@ -1085,6 +1139,12 @@ declare const _default: {
|
|
1085
1139
|
fontWeight: string;
|
1086
1140
|
letterSpacing: string;
|
1087
1141
|
};
|
1142
|
+
suggestion: {
|
1143
|
+
fontSize: string;
|
1144
|
+
fontFamily: string;
|
1145
|
+
color: string;
|
1146
|
+
lineHeight: string;
|
1147
|
+
};
|
1088
1148
|
modalTitle: {
|
1089
1149
|
fontSize: string;
|
1090
1150
|
fontWeight: string;
|
@@ -2310,6 +2370,41 @@ declare const _default: {
|
|
2310
2370
|
overlayPanel: {
|
2311
2371
|
container: {
|
2312
2372
|
backgroundColor: string;
|
2373
|
+
border: string;
|
2374
|
+
};
|
2375
|
+
aiPanelContainer: {
|
2376
|
+
backgroundColor: string;
|
2377
|
+
border: string;
|
2378
|
+
borderLeft: string;
|
2379
|
+
position: string;
|
2380
|
+
overflowY: string;
|
2381
|
+
top: number;
|
2382
|
+
bottom: number;
|
2383
|
+
alignItems: string;
|
2384
|
+
justifyContent: string;
|
2385
|
+
boxShadow: string;
|
2386
|
+
display: string;
|
2387
|
+
opacity: number;
|
2388
|
+
right: string;
|
2389
|
+
transition: string;
|
2390
|
+
maxWidth: string;
|
2391
|
+
p: string;
|
2392
|
+
'&.is-small': {
|
2393
|
+
width: string;
|
2394
|
+
};
|
2395
|
+
'&.is-full': {
|
2396
|
+
width: string;
|
2397
|
+
};
|
2398
|
+
'&.is-open.is-transitioning': {
|
2399
|
+
right: number;
|
2400
|
+
opacity: number;
|
2401
|
+
};
|
2402
|
+
};
|
2403
|
+
body: {
|
2404
|
+
gap: string;
|
2405
|
+
minHeight: string;
|
2406
|
+
maxWidth: string;
|
2407
|
+
alignSelf: string;
|
2313
2408
|
};
|
2314
2409
|
innerPanel: {
|
2315
2410
|
backgroundColor: string;
|
@@ -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 {};
|
@@ -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?:
|
25
|
+
state?: OverlayPanelState;
|
23
26
|
}
|
@@ -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;
|
package/lib/index.js
CHANGED
@@ -10,6 +10,8 @@ export { default as AccordionGroup } from './components/AccordionGroup';
|
|
10
10
|
export * from './components/AccordionGroup';
|
11
11
|
export { default as AccordionItem } from './components/AccordionItem';
|
12
12
|
export * from './components/AccordionItem';
|
13
|
+
export { default as AIPanel } from './components/AIComponents/AIPanel/AIPanel';
|
14
|
+
export { default as AIPanelHeader } from './components/AIComponents/AIPanel/AIPanelHeader';
|
13
15
|
export { default as Prompt } from './components/AIComponents/Prompt';
|
14
16
|
export { default as Response } from './components/AIComponents/Response';
|
15
17
|
export { default as ResponseAttachment } from './components/AIComponents/Response/ResponseAttachment';
|
@@ -9,5 +9,5 @@ export var componentSpecificNextGenBlacklist = {
|
|
9
9
|
TextField: ['Success'],
|
10
10
|
OverlayPanel: ['Expandable']
|
11
11
|
};
|
12
|
-
export var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'Response'];
|
12
|
+
export var nextGenOnlyComponents = ['NavigationHeader', 'Prompt', 'AI Panel', 'Response'];
|
13
13
|
export default nextGenConvertedComponents;
|
@@ -153,6 +153,33 @@ var primaryWithIcon = _objectSpread(_objectSpread({}, primary), {}, {
|
|
153
153
|
display: 'inline-flex',
|
154
154
|
color: 'white'
|
155
155
|
});
|
156
|
+
var aiChat = _objectSpread(_objectSpread({}, withIcon), {}, {
|
157
|
+
maxWidth: 'fit-content',
|
158
|
+
gap: 'sm',
|
159
|
+
border: 'none',
|
160
|
+
backgroundColor: 'transparent',
|
161
|
+
color: 'text.primary',
|
162
|
+
path: {
|
163
|
+
fill: 'text.primary'
|
164
|
+
},
|
165
|
+
'&.is-focused': {
|
166
|
+
outline: '2px solid',
|
167
|
+
outlineColor: 'primary',
|
168
|
+
outlineOffset: '3px'
|
169
|
+
},
|
170
|
+
'&.is-hovered': {
|
171
|
+
backgroundColor: 'gray-100',
|
172
|
+
path: {
|
173
|
+
fill: 'dark'
|
174
|
+
}
|
175
|
+
},
|
176
|
+
'&.is-pressed': {
|
177
|
+
backgroundColor: '#d5dfe8 !important',
|
178
|
+
path: {
|
179
|
+
fill: 'dark'
|
180
|
+
}
|
181
|
+
}
|
182
|
+
});
|
156
183
|
var baseIconButton = {
|
157
184
|
cursor: 'pointer',
|
158
185
|
transition: 'color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out',
|
@@ -274,6 +301,7 @@ var buttons = {
|
|
274
301
|
withIcon: withIcon,
|
275
302
|
primaryWithIcon: primaryWithIcon,
|
276
303
|
iconButtons: iconButtons,
|
277
|
-
modalCloseButton: modalCloseButton
|
304
|
+
modalCloseButton: modalCloseButton,
|
305
|
+
aiChat: aiChat
|
278
306
|
};
|
279
307
|
export default buttons;
|
@@ -48,7 +48,7 @@ var hTags = {
|
|
48
48
|
fontSize: 'xs'
|
49
49
|
}
|
50
50
|
};
|
51
|
-
export var text = _objectSpread({
|
51
|
+
export var text = _objectSpread(_objectSpread({
|
52
52
|
sideNavHeader: {
|
53
53
|
py: 'sm',
|
54
54
|
lineHeight: 'body',
|
@@ -58,6 +58,12 @@ export var text = _objectSpread({
|
|
58
58
|
fontWeight: '1',
|
59
59
|
letterSpacing: '1px'
|
60
60
|
},
|
61
|
+
suggestion: {
|
62
|
+
fontSize: 'md',
|
63
|
+
fontFamily: 'standard',
|
64
|
+
color: 'text.primary',
|
65
|
+
lineHeight: '24px'
|
66
|
+
},
|
61
67
|
modalTitle: {
|
62
68
|
fontSize: '20px',
|
63
69
|
fontWeight: '2',
|
@@ -94,4 +100,11 @@ export var text = _objectSpread({
|
|
94
100
|
display: 'list-item'
|
95
101
|
}
|
96
102
|
}
|
97
|
-
}, hTags)
|
103
|
+
}, hTags), {}, {
|
104
|
+
aiPanelHeader: {
|
105
|
+
fontFamily: 'standard',
|
106
|
+
color: 'text.primary',
|
107
|
+
fontSize: 'lg',
|
108
|
+
fontWeight: 2
|
109
|
+
}
|
110
|
+
});
|
@@ -257,7 +257,42 @@ var dataTable = {
|
|
257
257
|
};
|
258
258
|
var overlayPanel = {
|
259
259
|
container: {
|
260
|
-
backgroundColor: 'background.base'
|
260
|
+
backgroundColor: 'background.base',
|
261
|
+
border: 'none'
|
262
|
+
},
|
263
|
+
aiPanelContainer: {
|
264
|
+
backgroundColor: 'background.base',
|
265
|
+
border: 'none',
|
266
|
+
borderLeft: 'none',
|
267
|
+
position: 'fixed',
|
268
|
+
overflowY: 'scroll',
|
269
|
+
top: 0,
|
270
|
+
bottom: 0,
|
271
|
+
alignItems: 'center',
|
272
|
+
justifyContent: 'center',
|
273
|
+
boxShadow: '-2px 0px 2px 1px rgba(37, 55, 70, 0.15)',
|
274
|
+
display: 'flex !important',
|
275
|
+
opacity: 0,
|
276
|
+
right: '-50%',
|
277
|
+
transition: 'all 500ms',
|
278
|
+
maxWidth: '100%',
|
279
|
+
p: 'lg',
|
280
|
+
'&.is-small': {
|
281
|
+
width: '420px'
|
282
|
+
},
|
283
|
+
'&.is-full': {
|
284
|
+
width: 'container.full'
|
285
|
+
},
|
286
|
+
'&.is-open.is-transitioning': {
|
287
|
+
right: 0,
|
288
|
+
opacity: 1
|
289
|
+
}
|
290
|
+
},
|
291
|
+
body: {
|
292
|
+
gap: 'md',
|
293
|
+
minHeight: '100%',
|
294
|
+
maxWidth: '768px',
|
295
|
+
alignSelf: 'center'
|
261
296
|
},
|
262
297
|
innerPanel: {
|
263
298
|
backgroundColor: 'background.base'
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|