@elliemae/ds-chat 2.0.0-alpha.1 → 2.0.0-alpha.13
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/cjs/ChatDataTestids.js +27 -0
- package/cjs/index.js +1 -0
- package/cjs/parts/bubble/ChatBubble.js +33 -20
- package/cjs/parts/bubble/ChatBubbleArrow.js +64 -61
- package/cjs/parts/bubble/config/useValidateProps.js +31 -0
- package/cjs/parts/bubble/index.js +1 -0
- package/cjs/parts/bubble/props.js +5 -5
- package/cjs/parts/bubble/styled.js +12 -41
- package/cjs/parts/chat-card/ChatCard.js +26 -20
- package/cjs/parts/chat-card/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-card/props.js +3 -3
- package/cjs/parts/chat-card/styled.js +6 -6
- package/cjs/parts/chat-composer/ChatContainerComposer.js +50 -25
- package/cjs/parts/chat-composer/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-composer/props.js +10 -4
- package/cjs/parts/chat-composer/styled.js +8 -8
- package/cjs/parts/chat-container/ChatContainer.js +79 -29
- package/cjs/parts/chat-container/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-container/props.js +12 -7
- package/cjs/parts/chat-container/styled.js +5 -5
- package/cjs/parts/chat-container-header/ChatContainerHeader.js +7 -7
- package/cjs/parts/chat-container-header/helpers.js +31 -0
- package/cjs/parts/chat-container-header/styled.js +6 -6
- package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +214 -34
- package/cjs/parts/chat-container-messages-list/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-container-messages-list/props.js +6 -10
- package/cjs/parts/chat-container-messages-list/styled.js +11 -14
- package/cjs/parts/chat-empty-state/ChatEmptyState.js +22 -12
- package/cjs/parts/chat-empty-state/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-empty-state/props.js +2 -1
- package/cjs/parts/chat-empty-state/styled.js +2 -2
- package/cjs/parts/chat-sidebar/SideBarChat.js +70 -36
- package/cjs/parts/chat-sidebar/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-sidebar/props.js +11 -1
- package/cjs/parts/chat-sidebar/styled.js +4 -4
- package/cjs/parts/floating-button/FloatingButton.js +18 -10
- package/cjs/parts/floating-button/props.js +6 -2
- package/cjs/parts/floating-button/styled.js +1 -1
- package/cjs/parts/floating-container/styled.js +1 -1
- package/cjs/parts/grid-influencer/InfluencerContainer.js +2 -2
- package/cjs/parts/grid-influencer/styled.js +4 -8
- package/cjs/parts/message-delimiter/MessageDelimiter.js +18 -12
- package/cjs/parts/message-delimiter/config/useValidateProps.js +11 -0
- package/cjs/parts/message-delimiter/props.js +1 -1
- package/cjs/parts/message-delimiter/styled.js +4 -4
- package/cjs/parts/sidebar-button/SidebarButton.js +12 -7
- package/cjs/parts/sidebar-button/props.js +3 -4
- package/cjs/parts/sidebar-button/styled.js +4 -4
- package/cjs/parts/system-message/SystemMessage.js +21 -15
- package/cjs/parts/system-message/config/useValidateProps.js +11 -0
- package/cjs/parts/system-message/style.js +6 -6
- package/cjs/parts/tile-button/TileButton.js +40 -34
- package/cjs/parts/tile-button/config/useValidateProps.js +11 -0
- package/cjs/parts/tile-button/props.js +15 -13
- package/cjs/parts/tile-button/styled.js +22 -15
- package/cjs/styled.js +1 -1
- package/esm/ChatDataTestids.js +23 -0
- package/esm/index.js +1 -1
- package/esm/parts/bubble/ChatBubble.js +24 -12
- package/esm/parts/bubble/ChatBubbleArrow.js +64 -61
- package/esm/parts/bubble/config/useValidateProps.js +27 -0
- package/esm/parts/bubble/index.js +1 -1
- package/esm/parts/bubble/props.js +4 -4
- package/esm/parts/bubble/styled.js +3 -32
- package/esm/parts/chat-card/ChatCard.js +26 -20
- package/esm/parts/chat-card/config/useValidateProps.js +7 -0
- package/esm/parts/chat-card/props.js +3 -3
- package/esm/parts/chat-composer/ChatContainerComposer.js +33 -7
- package/esm/parts/chat-composer/config/useValidateProps.js +7 -0
- package/esm/parts/chat-composer/props.js +10 -4
- package/esm/parts/chat-composer/styled.js +2 -2
- package/esm/parts/chat-container/ChatContainer.js +68 -18
- package/esm/parts/chat-container/config/useValidateProps.js +7 -0
- package/esm/parts/chat-container/props.js +12 -7
- package/esm/parts/chat-container/styled.js +2 -2
- package/esm/parts/chat-container-header/ChatContainerHeader.js +3 -2
- package/esm/parts/chat-container-header/helpers.js +23 -0
- package/esm/parts/chat-container-header/styled.js +6 -6
- package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +202 -22
- package/esm/parts/chat-container-messages-list/config/useValidateProps.js +7 -0
- package/esm/parts/chat-container-messages-list/props.js +6 -10
- package/esm/parts/chat-container-messages-list/styled.js +6 -10
- package/esm/parts/chat-empty-state/ChatEmptyState.js +16 -6
- package/esm/parts/chat-empty-state/config/useValidateProps.js +7 -0
- package/esm/parts/chat-empty-state/props.js +2 -1
- package/esm/parts/chat-sidebar/SideBarChat.js +69 -34
- package/esm/parts/chat-sidebar/config/useValidateProps.js +7 -0
- package/esm/parts/chat-sidebar/props.js +11 -1
- package/esm/parts/chat-sidebar/styled.js +2 -2
- package/esm/parts/floating-button/FloatingButton.js +18 -9
- package/esm/parts/floating-button/props.js +6 -2
- package/esm/parts/grid-influencer/styled.js +2 -6
- package/esm/parts/message-delimiter/MessageDelimiter.js +18 -12
- package/esm/parts/message-delimiter/config/useValidateProps.js +7 -0
- package/esm/parts/message-delimiter/props.js +1 -1
- package/esm/parts/message-delimiter/styled.js +1 -1
- package/esm/parts/sidebar-button/SidebarButton.js +6 -1
- package/esm/parts/sidebar-button/props.js +1 -1
- package/esm/parts/sidebar-button/styled.js +1 -1
- package/esm/parts/system-message/SystemMessage.js +21 -15
- package/esm/parts/system-message/config/useValidateProps.js +7 -0
- package/esm/parts/system-message/style.js +1 -1
- package/esm/parts/tile-button/TileButton.js +35 -27
- package/esm/parts/tile-button/config/useValidateProps.js +7 -0
- package/esm/parts/tile-button/props.js +14 -7
- package/esm/parts/tile-button/styled.js +15 -10
- package/esm/styled.js +1 -1
- package/package.json +69 -6
- package/types/ChatDataTestids.d.ts +21 -0
- package/types/index.d.ts +1 -1
- package/types/parts/bubble/ChatBubble.d.ts +20 -5
- package/types/parts/bubble/config/useValidateProps.d.ts +2 -0
- package/types/parts/bubble/index.d.ts +1 -1
- package/types/parts/bubble/props.d.ts +13 -4
- package/types/parts/bubble/styled.d.ts +9 -9
- package/types/parts/bubble/tests/ChatBubble.test.d.ts +1 -0
- package/types/parts/chat-card/ChatCard.d.ts +25 -5
- package/types/parts/chat-card/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-card/props.d.ts +19 -3
- package/types/parts/chat-card/styled.d.ts +6 -6
- package/types/parts/chat-composer/ChatContainerComposer.d.ts +48 -12
- package/types/parts/chat-composer/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-composer/styled.d.ts +117 -24
- package/types/parts/chat-composer/tests/ChatContainerComposer.test.d.ts +1 -0
- package/types/parts/chat-container/ChatContainer.d.ts +54 -12
- package/types/parts/chat-container/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-container/styled.d.ts +4 -4
- package/types/parts/chat-container/tests/ChatContainer.test.d.ts +1 -0
- package/types/parts/chat-container-header/helpers.d.ts +6 -0
- package/types/parts/chat-container-header/styled.d.ts +3 -3
- package/types/parts/chat-container-messages-list/ChatContainerMessagesList.d.ts +39 -9
- package/types/parts/chat-container-messages-list/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-container-messages-list/styled.d.ts +7 -6
- package/types/parts/chat-empty-state/ChatEmptyState.d.ts +19 -1
- package/types/parts/chat-empty-state/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-empty-state/props.d.ts +7 -1
- package/types/parts/chat-empty-state/styled.d.ts +2 -2
- package/types/parts/chat-sidebar/SideBarChat.d.ts +40 -10
- package/types/parts/chat-sidebar/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-sidebar/props.d.ts +39 -9
- package/types/parts/chat-sidebar/styled.d.ts +2 -2
- package/types/parts/floating-button/FloatingButton.d.ts +11 -2
- package/types/parts/floating-button/props.d.ts +13 -1
- package/types/parts/floating-button/styled.d.ts +1 -1
- package/types/parts/floating-container/styled.d.ts +1 -2
- package/types/parts/grid-influencer/styled.d.ts +2 -2
- package/types/parts/message-delimiter/MessageDelimiter.d.ts +22 -5
- package/types/parts/message-delimiter/config/useValidateProps.d.ts +2 -0
- package/types/parts/message-delimiter/props.d.ts +16 -3
- package/types/parts/message-delimiter/styled.d.ts +3 -3
- package/types/parts/sidebar-button/SidebarButton.d.ts +16 -5
- package/types/parts/sidebar-button/props.d.ts +16 -5
- package/types/parts/sidebar-button/styled.d.ts +3 -3
- package/types/parts/system-message/SystemMessage.d.ts +13 -3
- package/types/parts/system-message/config/useValidateProps.d.ts +2 -0
- package/types/parts/system-message/props.d.ts +7 -1
- package/types/parts/system-message/style.d.ts +5 -5
- package/types/parts/tile-button/TileButton.d.ts +66 -17
- package/types/parts/tile-button/config/useValidateProps.d.ts +2 -0
- package/types/parts/tile-button/props.d.ts +64 -16
- package/types/parts/tile-button/styled.d.ts +9 -8
- package/types/prop-types.d.ts +28 -9
- package/types/tests/utils.d.ts +27 -0
- package/cjs/package.json +0 -4
- package/esm/package.json +0 -4
- package/types/parts/chat-composer/props.d.ts +0 -32
- package/types/parts/chat-container/props.d.ts +0 -38
- package/types/parts/chat-container-messages-list/props.d.ts +0 -31
|
@@ -2,10 +2,14 @@ import { PropTypes } from 'react-desc';
|
|
|
2
2
|
import { noop } from 'lodash';
|
|
3
3
|
|
|
4
4
|
const defaultFloatingButton = {
|
|
5
|
-
onClick: noop
|
|
5
|
+
onClick: noop,
|
|
6
|
+
onFocus: noop,
|
|
7
|
+
innerRef: null
|
|
6
8
|
};
|
|
7
9
|
const propsFloatingButton = {
|
|
8
|
-
onClick: PropTypes.func.description('The function to call when the chat is opened via the footer').defaultValue(defaultFloatingButton.onClick)
|
|
10
|
+
onClick: PropTypes.func.description('The function to call when the chat is opened via the footer').defaultValue(defaultFloatingButton.onClick),
|
|
11
|
+
onFocus: PropTypes.func.description('The function to call when button is being focused').defaultValue(defaultFloatingButton.onFocus),
|
|
12
|
+
innerRef: PropTypes.object.description('Ref to the component container').defaultValue(null)
|
|
9
13
|
};
|
|
10
14
|
|
|
11
15
|
export { defaultFloatingButton, propsFloatingButton };
|
|
@@ -4,13 +4,9 @@ import { MIN_WIDTH_SIDEBAR } from '../../styled.js';
|
|
|
4
4
|
|
|
5
5
|
const StyledChatContainer = /*#__PURE__*/styled(Grid).withConfig({
|
|
6
6
|
componentId: "sc-b6t5vk-0"
|
|
7
|
-
})(["height:100%;width:", ";background:", ";box-shadow:-1px 0 0 0 ", ";transition:width ", " 350ms;"], props => props.expanded ?
|
|
7
|
+
})(["height:100%;width:", ";background:", ";box-shadow:-1px 0 0 0 ", ";transition:width ", " 350ms;"], props => props.expanded ? "".concat(props.expandedWidth, "px") : "".concat(MIN_WIDTH_SIDEBAR, "px"), props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral[100], props => props.expanded ? 'ease-out' : 'ease-in');
|
|
8
8
|
const StyledChatContainerContent = /*#__PURE__*/styled(Grid).withConfig({
|
|
9
9
|
componentId: "sc-b6t5vk-1"
|
|
10
|
-
})(["height:100%;overflow:hidden;background:", ";", ""], props => props.theme.colors.neutral['050'], props => props.floating ?
|
|
11
|
-
width: ${props.expandedWidth}px;
|
|
12
|
-
` : `
|
|
13
|
-
width: ${props.expandedWidth - MIN_WIDTH_SIDEBAR}px;
|
|
14
|
-
`);
|
|
10
|
+
})(["height:100%;overflow:hidden;background:", ";", ""], props => props.theme.colors.neutral['050'], props => props.floating ? "\n width: ".concat(props.expandedWidth, "px;\n") : "\n width: ".concat(props.expandedWidth - MIN_WIDTH_SIDEBAR, "px;\n"));
|
|
15
11
|
|
|
16
12
|
export { StyledChatContainer, StyledChatContainerContent };
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.url.to-json.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import { describe } from 'react-desc';
|
|
4
5
|
import { Wrapper, Line, Text } from './styled.js';
|
|
5
6
|
import { messageDelimiterProps, defaultProps } from './props.js';
|
|
7
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
6
8
|
|
|
7
9
|
var _Line, _Line2;
|
|
8
10
|
|
|
9
|
-
const MessageDelimiter =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
const MessageDelimiter = props => {
|
|
12
|
+
useValidateProps(props, MessageDelimiterWithSchema.toJSON());
|
|
13
|
+
const {
|
|
14
|
+
title,
|
|
15
|
+
size,
|
|
16
|
+
extraProps,
|
|
17
|
+
verticalMargin
|
|
18
|
+
} = props;
|
|
19
|
+
return /*#__PURE__*/_jsx(Wrapper, {
|
|
20
|
+
cols: ['1fr', 'auto', '1fr']
|
|
21
|
+
}, void 0, _Line || (_Line = /*#__PURE__*/_jsx(Line, {})), /*#__PURE__*/_jsx(Text, {
|
|
22
|
+
size: size,
|
|
23
|
+
verticalMargin: verticalMargin,
|
|
24
|
+
"data-testid": extraProps['data-testid']
|
|
25
|
+
}, void 0, title), _Line2 || (_Line2 = /*#__PURE__*/_jsx(Line, {})));
|
|
26
|
+
};
|
|
21
27
|
|
|
22
28
|
MessageDelimiter.defaultProps = defaultProps;
|
|
23
29
|
const MessageDelimiterWithSchema = describe(MessageDelimiter);
|
|
@@ -12,7 +12,7 @@ const messageDelimiterProps = {
|
|
|
12
12
|
title: PropTypes.string.isRequired.description('Text to display in the delimiter'),
|
|
13
13
|
size: PropTypes.oneOf(['s', 'l']).description('size of the delimiter').defaultValue('s'),
|
|
14
14
|
extraProps: PropTypes.object.description('extra props for delimiter'),
|
|
15
|
-
verticalMargin: PropTypes.string.description('Configurable css vertical margin property for flexibilty')
|
|
15
|
+
verticalMargin: PropTypes.oneOf(['string', 'number']).description('Configurable css vertical margin property for flexibilty')
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export { defaultProps, messageDelimiterProps };
|
|
@@ -9,6 +9,6 @@ const Line = /*#__PURE__*/styled.span.withConfig({
|
|
|
9
9
|
})(["border-top:1px solid ", ";"], props => props.theme.colors.neutral['400']);
|
|
10
10
|
const Text = /*#__PURE__*/styled.p.withConfig({
|
|
11
11
|
componentId: "sc-upz0rt-2"
|
|
12
|
-
})(["color:", ";font-size:", ";font-weight:", ";margin:", ";"], props => props.theme.colors.neutral['600'], props => props.size === 's' ? '12px' : '14px', props => props.theme.fontWeights.semibold, props => typeof props.verticalMargin === 'number' ?
|
|
12
|
+
})(["color:", ";font-size:", ";font-weight:", ";margin:", ";"], props => props.theme.colors.neutral['600'], props => props.size === 's' ? '12px' : '14px', props => props.theme.fontWeights.semibold, props => typeof props.verticalMargin === 'number' ? "".concat(props.verticalMargin, "px 8px") : "".concat(props.verticalMargin, " 8px"));
|
|
13
13
|
|
|
14
14
|
export { Line, Text, Wrapper };
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
@@ -24,7 +29,7 @@ const SidebarButton = _ref => {
|
|
|
24
29
|
onClick(dsId);
|
|
25
30
|
}, [onClick, dsId]);
|
|
26
31
|
return /*#__PURE__*/jsxs(StyledSidebarButton, _objectSpread(_objectSpread({
|
|
27
|
-
"data-testid":
|
|
32
|
+
"data-testid": "sidebar-button-".concat(dsId),
|
|
28
33
|
onClick: handleClick
|
|
29
34
|
}, rest), {}, {
|
|
30
35
|
children: [/*#__PURE__*/_jsx(StyledSidebarButtonIcon, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import propsTypes from 'prop-types';
|
|
2
2
|
import { PropTypes } from 'react-desc';
|
|
3
3
|
import { noop } from 'lodash';
|
|
4
|
-
import Comments from '@elliemae/ds-icons
|
|
4
|
+
import { Comments } from '@elliemae/ds-icons';
|
|
5
5
|
|
|
6
6
|
const defaultSidebarButton = {
|
|
7
7
|
Icon: Comments,
|
|
@@ -4,7 +4,7 @@ import { BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR } from '../../styled.js';
|
|
|
4
4
|
|
|
5
5
|
const StyledSidebarButton = /*#__PURE__*/styled.button.withConfig({
|
|
6
6
|
componentId: "sc-6ygly3-0"
|
|
7
|
-
})(["display:flex;align-items:center;justify-content:center;outline:none;height:", "px;width:", "px;position:relative;border:0;background:transparent;&:focus,&:hover{background:", ";}cursor:pointer;border-bottom:1px solid ", ";"], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR, props => props.theme.colors.neutral['080'], props => props.theme.colors.neutral['200']);
|
|
7
|
+
})(["display:flex;align-items:center;justify-content:center;outline:none;height:", "px;width:", "px;position:relative;border:0;background:transparent;&:focus,&:hover{background:", ";}cursor:pointer;border-bottom:1px solid ", ";svg{fill:", ";}"], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR, props => props.theme.colors.neutral['080'], props => props.theme.colors.neutral['200'], props => props.theme.colors.neutral[500]);
|
|
8
8
|
const StyledSidebarButtonIcon = /*#__PURE__*/styled(Grid).withConfig({
|
|
9
9
|
componentId: "sc-6ygly3-1"
|
|
10
10
|
})(["position:relative;"]);
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.url.to-json.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import { describe } from 'react-desc';
|
|
4
5
|
import { Wrapper, Header, Title, Time, Message } from './style.js';
|
|
5
6
|
import { systemMessageProps, defaultProps } from './props.js';
|
|
7
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
6
8
|
|
|
7
9
|
var _span;
|
|
8
10
|
|
|
9
|
-
const SystemMessage =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
const SystemMessage = props => {
|
|
12
|
+
useValidateProps(props, SystemMessageWithSchema.toJSON());
|
|
13
|
+
const {
|
|
14
|
+
title,
|
|
15
|
+
time,
|
|
16
|
+
body
|
|
17
|
+
} = props;
|
|
18
|
+
return /*#__PURE__*/_jsx(Wrapper, {
|
|
19
|
+
rows: ['auto', 'auto']
|
|
20
|
+
}, void 0, /*#__PURE__*/_jsx(Header, {
|
|
21
|
+
cols: ['1fr', 'auto', '1fr']
|
|
22
|
+
}, void 0, _span || (_span = /*#__PURE__*/_jsx("span", {})), /*#__PURE__*/_jsx(Title, {
|
|
23
|
+
"data-testid": "chat-system-message-title"
|
|
24
|
+
}, void 0, title), /*#__PURE__*/_jsx(Time, {
|
|
25
|
+
"data-testid": "chat-system-message-time"
|
|
26
|
+
}, void 0, time)), /*#__PURE__*/_jsx(Message, {
|
|
27
|
+
"data-testid": "chat-system-message-body"
|
|
28
|
+
}, void 0, body));
|
|
29
|
+
};
|
|
24
30
|
|
|
25
31
|
SystemMessage.defaultProps = defaultProps;
|
|
26
32
|
const SystemMessageWithSchema = describe(SystemMessage);
|
|
@@ -3,7 +3,7 @@ import { Grid } from '@elliemae/ds-grid';
|
|
|
3
3
|
|
|
4
4
|
const Wrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
5
5
|
componentId: "sc-80w41d-0"
|
|
6
|
-
})(["align-items:center;justify-content:center;
|
|
6
|
+
})(["align-items:center;justify-content:center;max-width:100%;padding:0 8px 8px;border:1px solid ", ";border-radius:10px;background-color:", ";box-shadow:none;"], props => props.theme.colors.neutral['100'], props => props.theme.colors.neutral['080']);
|
|
7
7
|
const Header = /*#__PURE__*/styled(Grid).withConfig({
|
|
8
8
|
componentId: "sc-80w41d-1"
|
|
9
9
|
})(["align-items:center;height:36px;"]);
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.url.to-json.js';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { describe } from 'react-desc';
|
|
4
|
-
import
|
|
5
|
+
import { DSTooltipV3 } from '@elliemae/ds-tooltip';
|
|
5
6
|
import { Grid } from '@elliemae/ds-grid';
|
|
6
|
-
import CloseXsmall from '@elliemae/ds-icons
|
|
7
|
-
import { StyledWrapperCentralContent, StyledTileButtonIcon, StyledStatusBadge, StyledTileButtonLabel, StyledTileButton, StyledWrapper, StyledWrapperLeftBorder, CloseButton } from './styled.js';
|
|
7
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
8
|
+
import { StyledWrapperCentralContent, StyledTileButtonIcon, StyledStatusBadge, StyledTileButtonLabel, StyledTileButton, StyledWrapper, StyledWrapperLeftBorder, CloseButton, StyledTooltipV3ButtonWrapper } from './styled.js';
|
|
8
9
|
import { propsTileButton, defaultTileButton } from './props.js';
|
|
10
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
12
|
|
|
10
13
|
var _StyledWrapperLeftBor, _CloseXsmall;
|
|
11
14
|
|
|
12
15
|
const TileButton = props => {
|
|
13
|
-
var _Icon,
|
|
16
|
+
var _Icon, _StyledTileButtonLabe, _span;
|
|
14
17
|
|
|
18
|
+
useValidateProps(props, TileButtonWithSchema.toJSON());
|
|
15
19
|
const {
|
|
16
20
|
label,
|
|
17
21
|
title,
|
|
@@ -28,7 +32,10 @@ const TileButton = props => {
|
|
|
28
32
|
disabled,
|
|
29
33
|
selected,
|
|
30
34
|
isHeader,
|
|
31
|
-
ariaLabel
|
|
35
|
+
ariaLabel,
|
|
36
|
+
tooltipPlacement,
|
|
37
|
+
disableTooltip,
|
|
38
|
+
innerRef
|
|
32
39
|
} = props;
|
|
33
40
|
const handleClick = React.useCallback(() => {
|
|
34
41
|
onClick(dsId, title);
|
|
@@ -44,17 +51,19 @@ const TileButton = props => {
|
|
|
44
51
|
justifyContent: "center"
|
|
45
52
|
}, void 0, _Icon || (_Icon = /*#__PURE__*/_jsx(Icon, {
|
|
46
53
|
size: "m"
|
|
47
|
-
})), badge ?
|
|
54
|
+
})), badge ? /*#__PURE__*/_jsx(StyledStatusBadge, {
|
|
48
55
|
badgeColor: badgeColor,
|
|
49
|
-
badgePosition: badgePosition
|
|
50
|
-
|
|
56
|
+
badgePosition: badgePosition,
|
|
57
|
+
"data-testid": "tile-badge-".concat(dsId)
|
|
58
|
+
}) : null)), !isHeader ? /*#__PURE__*/_jsx(Grid, {
|
|
51
59
|
width: "100%",
|
|
52
60
|
justifyContent: "center"
|
|
53
61
|
}, void 0, label ? _StyledTileButtonLabe || (_StyledTileButtonLabe = /*#__PURE__*/_jsx(StyledTileButtonLabel, {}, void 0, label)) : null) : null), [isHeader, Icon, badge, badgeColor, badgePosition, label]);
|
|
54
|
-
|
|
62
|
+
const Btn = React.useMemo(() => /*#__PURE__*/jsx(StyledTileButton, {
|
|
55
63
|
isHeader: isHeader,
|
|
56
64
|
value: dsId,
|
|
57
|
-
"data-testid":
|
|
65
|
+
"data-testid": "tile-button-".concat(dsId),
|
|
66
|
+
"data-key": dsId,
|
|
58
67
|
onClick: handleClick,
|
|
59
68
|
onFocus: onFocus,
|
|
60
69
|
onBlur: onBlur,
|
|
@@ -63,23 +72,22 @@ const TileButton = props => {
|
|
|
63
72
|
badgeColor: badgeColor,
|
|
64
73
|
badgePosition: badgePosition,
|
|
65
74
|
"aria-pressed": selected,
|
|
66
|
-
"aria-label": ariaLabel
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, void 0, _CloseXsmall || (_CloseXsmall = /*#__PURE__*/_jsx(CloseXsmall, {}))) : null));
|
|
75
|
+
"aria-label": ariaLabel,
|
|
76
|
+
ref: innerRef,
|
|
77
|
+
children: /*#__PURE__*/_jsx(StyledWrapper, {
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center"
|
|
80
|
+
}, void 0, _span || (_span = /*#__PURE__*/_jsx("span", {}, void 0, MainContent)), _StyledWrapperLeftBor || (_StyledWrapperLeftBor = /*#__PURE__*/_jsx(StyledWrapperLeftBorder, {})), showClose && !disabled ? /*#__PURE__*/_jsx(CloseButton, {
|
|
81
|
+
onClick: onClose,
|
|
82
|
+
value: dsId,
|
|
83
|
+
"data-testid": "tile-close-btn-".concat(dsId)
|
|
84
|
+
}, void 0, _CloseXsmall || (_CloseXsmall = /*#__PURE__*/_jsx(CloseXsmall, {}))) : null)
|
|
85
|
+
}, dsId), [MainContent, ariaLabel, badgeColor, badgePosition, disabled, dsId, handleClick, isHeader, onBlur, onClose, onFocus, selected, showClose, innerRef]);
|
|
86
|
+
return title && !disableTooltip ? /*#__PURE__*/_jsx(StyledTooltipV3ButtonWrapper, {}, void 0, /*#__PURE__*/_jsx(DSTooltipV3, {
|
|
87
|
+
id: "ds-chat-tile-tooltip-button-".concat(dsId),
|
|
88
|
+
text: title,
|
|
89
|
+
startPlacementPreference: tooltipPlacement
|
|
90
|
+
}, void 0, Btn)) : Btn;
|
|
83
91
|
};
|
|
84
92
|
|
|
85
93
|
TileButton.defaultProps = defaultTileButton;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import propsTypes from 'prop-types';
|
|
2
1
|
import { PropTypes } from 'react-desc';
|
|
3
2
|
import { noop } from 'lodash';
|
|
4
|
-
import Comments from '@elliemae/ds-icons
|
|
3
|
+
import { Comments } from '@elliemae/ds-icons';
|
|
5
4
|
|
|
6
5
|
const defaultTileButton = {
|
|
7
6
|
Icon: Comments,
|
|
@@ -19,11 +18,14 @@ const defaultTileButton = {
|
|
|
19
18
|
disabled: false,
|
|
20
19
|
selected: false,
|
|
21
20
|
isHeader: false,
|
|
22
|
-
ariaLabel: 'Tile button'
|
|
21
|
+
ariaLabel: 'Tile button',
|
|
22
|
+
tooltipPlacement: 'right',
|
|
23
|
+
disableTooltip: false,
|
|
24
|
+
innerRef: noop
|
|
23
25
|
};
|
|
24
26
|
const propsTileButton = {
|
|
25
|
-
Icon: PropTypes.
|
|
26
|
-
dsId: PropTypes.
|
|
27
|
+
Icon: PropTypes.func.description('Icon component').defaultValue(defaultTileButton.Icon),
|
|
28
|
+
dsId: PropTypes.oneOf(['number', 'string']).description('Unique id for the button').defaultValue(defaultTileButton.dsId),
|
|
27
29
|
label: PropTypes.string.description('It will display under the icon').defaultValue(defaultTileButton.label),
|
|
28
30
|
title: PropTypes.string.description('Tooltip').defaultValue(defaultTileButton.title),
|
|
29
31
|
onClick: PropTypes.func.description('The function to call when is clicked').defaultValue(defaultTileButton.onClick),
|
|
@@ -33,11 +35,16 @@ const propsTileButton = {
|
|
|
33
35
|
showClose: PropTypes.bool.description('It will display the X').defaultValue(defaultTileButton.showClose),
|
|
34
36
|
badge: PropTypes.bool.description('It will display the badge').defaultValue(defaultTileButton.badge),
|
|
35
37
|
badgeColor: PropTypes.oneOf(['blue', 'green']).description('Color badge: blue or green').defaultValue(defaultTileButton.badgeColor),
|
|
36
|
-
badgePosition: PropTypes.oneOf(['
|
|
38
|
+
badgePosition: PropTypes.oneOf(['left', 'right']).description('Color badge: blue or green').defaultValue(defaultTileButton.badgePosition),
|
|
37
39
|
disabled: PropTypes.bool.description('It will disabled the button').defaultValue(defaultTileButton.disabled),
|
|
38
40
|
selected: PropTypes.bool.description('Indicate that the button is selected').defaultValue(defaultTileButton.disabled),
|
|
39
41
|
isHeader: PropTypes.bool.description("It won't render the label").defaultValue(defaultTileButton.disabled),
|
|
40
|
-
ariaLabel: PropTypes.string.description('aria-label attribute').defaultValue(defaultTileButton.ariaLabel)
|
|
42
|
+
ariaLabel: PropTypes.string.description('aria-label attribute').defaultValue(defaultTileButton.ariaLabel),
|
|
43
|
+
tooltipPlacement: PropTypes.oneOf(['top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']).description('start placement preferences, as per popperjs placement option').defaultValue("'right'"),
|
|
44
|
+
disableTooltip: PropTypes.bool.description('Disable tooltip option').defaultValue(defaultTileButton.disableTooltip),
|
|
45
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
46
|
+
current: PropTypes.any
|
|
47
|
+
})]).description('reference to the component')
|
|
41
48
|
};
|
|
42
49
|
|
|
43
50
|
export { defaultTileButton, propsTileButton };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { css } from '@elliemae/ds-system';
|
|
2
4
|
import { Grid } from '@elliemae/ds-grid';
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
var _templateObject;
|
|
5
7
|
const MIN_WIDTH_SIDEBAR = 48;
|
|
6
8
|
const BUTTON_SIDEBAR_HEIGHT = 48; // Buttons
|
|
7
9
|
|
|
@@ -38,7 +40,7 @@ const StyledWrapperCentralContent = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
38
40
|
})(["width:24px;height:40px;"]);
|
|
39
41
|
const StyledTileButtonIcon = /*#__PURE__*/styled(Grid).withConfig({
|
|
40
42
|
componentId: "sc-1ebp1zs-3"
|
|
41
|
-
})(["position:relative;height:24px;width:24px;svg{fill:", ";}"], props => props.theme.colors.neutral[500]);
|
|
43
|
+
})(["position:relative;height:24px;width:24px;svg{fill:", ";}&:focus{svg{fill:", ";}}"], props => props.theme.colors.neutral[500], props => props.theme.colors.brand[800]);
|
|
42
44
|
const StyledTileButtonLabel = /*#__PURE__*/styled.div.withConfig({
|
|
43
45
|
componentId: "sc-1ebp1zs-4"
|
|
44
46
|
})(["width:24px;height:", ";text-transform:uppercase;overflow:hidden;text-align:center;font-size:13px;color:", ";line-height:17px;"], props => props.theme.space.xs, props => props.theme.colors.neutral[600]);
|
|
@@ -46,9 +48,12 @@ const CloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
46
48
|
componentId: "sc-1ebp1zs-5"
|
|
47
49
|
})(["outline:none;background:none;height:9px;width:9px;position:absolute;top:1px;right:1px;overflow:hidden;padding:0;border:none;span{position:absolute;left:-3px;top:-4px;}&:focus,&:hover{svg{fill:", ";}&:after{display:block;content:'';position:absolute;top:0;left:0;width:100%;height:100%;border:solid 1px ", ";border-radius:2px;}}cursor:pointer;"], props => props.theme.colors.brand[600], props => props.theme.colors.brand[600]); // MAIN WRAPPER
|
|
48
50
|
|
|
49
|
-
const
|
|
51
|
+
const StyledTooltipV3ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
50
52
|
componentId: "sc-1ebp1zs-6"
|
|
51
|
-
})(["
|
|
53
|
+
})(["height:", "px;width:", "px;"], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR);
|
|
54
|
+
const StyledTileButton = /*#__PURE__*/styled.button.withConfig({
|
|
55
|
+
componentId: "sc-1ebp1zs-7"
|
|
56
|
+
})(["outline:none;background:transparent;height:", "px;width:", "px;position:relative;padding:0;border:none;cursor:pointer;border-bottom:", ";&:focus,&:hover,&:active,&:disabled{background:", ";& ", "{border:2px solid ", ";margin-top:-2px;", ";}}&:focus,&:hover{& ", "{background:", ";}& ", "{color:", ";}& svg{fill:", ";}}&:active:not(:disabled){background:", ";& ", "{background:", ";}& ", "{color:", ";font-weight:600;}& svg{fill:", ";}& ", "{border:2px solid ", ";}}&:disabled{background:", ";", "{background:", ";}& ", "{background:", ";border:2px solid ", ";}", "{svg{fill:", ";}}", "{color:", ";}}", ""], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR, props => props.isHeader ? "1px solid ".concat(props.theme.colors.neutral['200']) : 'none', props => props.theme.colors.neutral['080'], StyledStatusBadge, props => props.theme.colors.neutral['080'], props => {
|
|
52
57
|
switch (props.badgePosition) {
|
|
53
58
|
case 'left':
|
|
54
59
|
return 'margin-left: -2px;';
|
|
@@ -59,15 +64,15 @@ const StyledTileButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
59
64
|
default:
|
|
60
65
|
return 'margin-left: -2px;';
|
|
61
66
|
}
|
|
62
|
-
}, StyledWrapperLeftBorder, props => props.theme.colors.brand[800], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.neutral['050'], StyledWrapperLeftBorder, props => props.theme.colors.brand[600], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[600], StyledStatusBadge, props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral['080'], StyledWrapperLeftBorder, props => props.theme.colors.neutral['400'], StyledStatusBadge, props => props.theme.colors.neutral['500'], props => props.theme.colors.neutral['080'], StyledTileButtonIcon, props => props.theme.colors.neutral[400], StyledTileButtonLabel, props => props.theme.colors.neutral[400], props => {
|
|
67
|
+
}, StyledWrapperLeftBorder, props => props.theme.colors.brand[800], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[800], props => props.theme.colors.neutral['050'], StyledWrapperLeftBorder, props => props.theme.colors.brand[600], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[600], StyledStatusBadge, props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral['080'], StyledWrapperLeftBorder, props => props.theme.colors.neutral['400'], StyledStatusBadge, props => props.theme.colors.neutral['500'], props => props.theme.colors.neutral['080'], StyledTileButtonIcon, props => props.theme.colors.neutral[400], StyledTileButtonLabel, props => props.theme.colors.neutral[400], props => {
|
|
63
68
|
if (props.selected) {
|
|
64
|
-
return css(["& ", "{background:", "
|
|
69
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & ", " {\n background: ", ";\n }\n "])), StyledWrapperLeftBorder, nestedProps => nestedProps.theme.colors.brand[600]);
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
return '';
|
|
68
73
|
});
|
|
69
74
|
const StyledWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
70
|
-
componentId: "sc-1ebp1zs-
|
|
71
|
-
})(["height:100%;width:100%;position:relative
|
|
75
|
+
componentId: "sc-1ebp1zs-8"
|
|
76
|
+
})(["height:100%;width:100%;position:relative;"]);
|
|
72
77
|
|
|
73
|
-
export { CloseButton, StyledStatusBadge, StyledTileButton, StyledTileButtonIcon, StyledTileButtonLabel, StyledWrapper, StyledWrapperCentralContent, StyledWrapperLeftBorder };
|
|
78
|
+
export { CloseButton, StyledStatusBadge, StyledTileButton, StyledTileButtonIcon, StyledTileButtonLabel, StyledTooltipV3ButtonWrapper, StyledWrapper, StyledWrapperCentralContent, StyledWrapperLeftBorder };
|
package/esm/styled.js
CHANGED
|
@@ -3,6 +3,6 @@ const BUTTON_SIDEBAR_HEIGHT = 48;
|
|
|
3
3
|
const BUTTON_FLOATING = 56;
|
|
4
4
|
const BOX_SHADOW = '0 5px 8px 0 rgba(53,60,70,0.55)';
|
|
5
5
|
const BOX_SHADOW_FLOATING = '0 5px 8px 0 rgba(53,60,70,0.35)';
|
|
6
|
-
const BOX_SHADOW_INSET =
|
|
6
|
+
const BOX_SHADOW_INSET = "inset 100px 3px 4px 0 rgba(53,60,70,0.50)";
|
|
7
7
|
|
|
8
8
|
export { BOX_SHADOW, BOX_SHADOW_FLOATING, BOX_SHADOW_INSET, BUTTON_FLOATING, BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR };
|