oa-componentbook 0.18.20 → 0.18.22

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.
@@ -40,7 +40,7 @@ const stylesObj = {
40
40
  width: '440px',
41
41
  marginTop: '24px',
42
42
  marginBottom: '8px',
43
- overflow: 'auto'
43
+ wordBreak: 'anywhere'
44
44
  },
45
45
  chatContainer: {
46
46
  display: 'flex',
@@ -65,11 +65,19 @@ function ChatWidget(_ref) {
65
65
  inputMaxLength
66
66
  } = _ref;
67
67
  const [message, setMessage] = (0, _react.useState)(initialMsg || '');
68
+ const chatContainerRef = (0, _react.useRef)(null);
68
69
  const onClearInput = () => clearInput && setMessage('');
69
70
  const onMsgSend = () => {
70
71
  onMessageInput(message);
71
72
  onClearInput();
72
73
  };
74
+ const scrollToBottom = () => {
75
+ var _chatContainerRef$cur;
76
+ (_chatContainerRef$cur = chatContainerRef.current) === null || _chatContainerRef$cur === void 0 || _chatContainerRef$cur.scrollIntoView();
77
+ };
78
+ (0, _react.useEffect)(() => {
79
+ scrollToBottom();
80
+ }, [queryMessages, message]);
73
81
  return /*#__PURE__*/_react.default.createElement(StyledCustomDrawer, {
74
82
  open: show,
75
83
  onClose: onClose,
@@ -96,7 +104,7 @@ function ChatWidget(_ref) {
96
104
  }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
97
105
  color: "primary-content",
98
106
  className: "type-t1-500"
99
- }, bodyTitle), /*#__PURE__*/_react.default.createElement("div", null, isContentLoading ? [...Array((0, _utils.getRandomInt)(2, 5))].map((_, ind) => ind % 2 ?
107
+ }, bodyTitle), /*#__PURE__*/_react.default.createElement("div", null, isContentLoading && [...Array((0, _utils.getRandomInt)(2, 5))].map((_, ind) => ind % 2 ?
100
108
  /*#__PURE__*/
101
109
  // Info : This container is to show the loading of the chats
102
110
  // (our chats) in the right side of chat body while chats are fetching.
@@ -121,9 +129,10 @@ function ChatWidget(_ref) {
121
129
  transform: 'scale(-1, 1)'
122
130
  }
123
131
  }, /*#__PURE__*/_react.default.createElement("div", {
124
- flexDirection: "column",
125
- style: _objectSpread({}, stylesObj.chatUi),
126
- gap: "2px"
132
+ style: _objectSpread(_objectSpread({}, stylesObj.chatUi), {}, {
133
+ flexDirection: 'column',
134
+ gap: '2px'
135
+ })
127
136
  }, /*#__PURE__*/_react.default.createElement("div", {
128
137
  style: _objectSpread({
129
138
  display: 'flex',
@@ -137,7 +146,7 @@ function ChatWidget(_ref) {
137
146
  alignSelf: 'flex-end',
138
147
  width: 'fit-content'
139
148
  }
140
- }, (0, _dayjs.default)().fromNow()))))) : queryMessages !== null && queryMessages !== void 0 && queryMessages.length ? queryMessages.map(msg => msg.isUser ?
149
+ }, (0, _dayjs.default)().fromNow()))))) || (queryMessages !== null && queryMessages !== void 0 && queryMessages.length ? queryMessages.map(msg => msg.isUser ?
141
150
  /*#__PURE__*/
142
151
  // Info : This is the chat box of right side which will show messages from user.
143
152
  _react.default.createElement("div", {
@@ -162,7 +171,9 @@ function ChatWidget(_ref) {
162
171
  color: "secondary-content"
163
172
  }, msg.createdAt))) :
164
173
  /*#__PURE__*/
165
- // Info : This is the chat box of left side which will show messages from other user.
174
+ /*
175
+ Info : This is the chat box of left side which will show messages from other user.
176
+ */
166
177
  _react.default.createElement("div", {
167
178
  style: {
168
179
  display: 'flex',
@@ -184,7 +195,9 @@ function ChatWidget(_ref) {
184
195
  }, msg.createdAt))) : /*#__PURE__*/_react.default.createElement(_antd.Alert, {
185
196
  type: "info",
186
197
  message: "Send a chat to start your chat history for this ticket."
187
- }))));
198
+ })))), /*#__PURE__*/_react.default.createElement("diV", {
199
+ ref: chatContainerRef
200
+ }));
188
201
  }
189
202
  ChatWidget.propTypes = {
190
203
  show: _propTypes.default.bool,
@@ -45,7 +45,7 @@ function KeyValueDataView(_ref) {
45
45
  }
46
46
  }, /*#__PURE__*/_react.default.createElement("span", {
47
47
  style: {
48
- color: "var(--color-primary-content)"
48
+ color: 'var(--color-primary-content)'
49
49
  }
50
50
  }, key), /*#__PURE__*/_react.default.createElement("span", {
51
51
  style: {
@@ -8,7 +8,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _templateObject, _templateObject2, _templateObject3, _templateObject4; // KeyValueWidgetStyles.js
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
- const KeyValueGroup = exports.KeyValueGroup = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .col-md-4:last-child,.col-md-12:last-child,.col-md-3:last-child,.col-md-6:last-child {\n padding: 0;\n }\n \n .valuestyle {\n display: flex;\n gap: 16px;\n padding: 0 0 8px;\n }\n\n .valuestyle b {\n width: 38.734%;\n font-style: normal;\n color: var(--color-primary-content); \n }\n\n .valuestyle span {\n max-width: 180px;\n font-style: normal;\n color: var(--color-secondary-content);\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .valuestyle span span{\n color: var(--color-primary-content);\n font-size: 12px;\n margin: 0 4px 0 0;\n }\n"])));
11
+ const KeyValueGroup = exports.KeyValueGroup = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .col-md-4:last-child,.col-md-12:last-child,.col-md-3:last-child,.col-md-6:last-child {\n padding: 0;\n }\n \n .valuestyle {\n display: flex;\n gap: 16px;\n padding: 0 0 8px;\n }\n\n .valuestyle b {\n width: 38.734%;\n font-style: normal;\n color: var(--color-primary-content); \n }\n\n .valuestyle span {\n max-width: 180px;\n font-style: normal;\n color: var(--color-secondary-content);\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .valuestyle span + span{\n color: var(--color-primary-content);\n font-size: 14px;\n padding: 0 4px 0 0;\n }\n"])));
12
12
  const KeyValueGroups = exports.KeyValueGroups = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n.container {\n max-width: 1154px;\n margin: 0 auto;\n padding: 0 16px;\n}\n.container-fluid{\n width: 100%;\n padding: 0 16px;\n}\n.row {\n display: flex;\n flex-direction: column;\n}\n.row::after {\n content: \"\";\n clear: both;\n display: table;\n}\n.col-xs-1 {\n width: 8.33333%;\n}\n\n.col-xs-2 {\n width: 16.66667%;\n}\n\n.col-xs-3 {\n width: 25%;\n}\n\n.col-xs-4 {\n width: 33.33333%;\n}\n\n.col-xs-5 {\n width: 41.66667%;\n}\n\n.col-xs-6 {\n width: 50%;\n}\n\n.col-xs-7 {\n width: 58.33333%;\n}\n\n.col-xs-8 {\n width: 66.66667%;\n}\n\n.col-xs-9 {\n width: 75%;\n}\n\n.col-xs-10 {\n width: 83.33333%;\n}\n\n.col-xs-11 {\n width: 91.66667%;\n}\n\n.col-xs-12 {\n width: 100%;\n}\n@media (min-width: 768px) {\n .row {\n flex-direction: row;\n}\n .col-sm-1 {\n width: 8.33333%;\n }\n\n .col-sm-2 {\n width: 16.66667%;\n }\n\n .col-sm-3 {\n width: 25%;\n }\n\n .col-sm-4 {\n width: 33.33333%;\n }\n\n .col-sm-5 {\n width: 41.66667%;\n }\n\n .col-sm-6 {\n width: 50%;\n }\n .col-sm-7 {\n width: 58.33333%;\n }\n .col-sm-8 {\n width: 66.66667%;\n }\n .col-sm-9 {\n width: 75%;\n }\n .col-sm-10 {\n width: 83.33333%;\n }\n .col-sm-11 {\n width: 91.66667%;\n }\n .col-sm-12 {\n width: 100%;\n }\n}\n\n@media (min-width: 768px) {\n .col-md-1 {\n width: 8.33333%;\n }\n .col-md-2 {\n width: 16.66667%;\n }\n .col-md-3 {\n width: 25%;\n }\n .col-md-4 {\n width: 33.33333%;\n float: left;\n }\n\n .col-md-5 {\n width: 41.66667%;\n }\n\n .col-md-6 {\n width: 50%;\n }\n\n .col-md-7 {\n width: 58.33333%;\n }\n\n .col-md-8 {\n width: 66.66667%;\n }\n\n .col-md-9 {\n width: 75%;\n }\n\n .col-md-10 {\n width: 83.33333%;\n }\n .col-md-11 {\n width: 91.66667%;\n }\n\n .col-md-12 {\n width: 100%;\n }\n\n}\n/* Large Devices (desktops) */\n@media (min-width: 992px) {\n .gutter{\n padding: 0 24px 0 0;\n }\n .col-lg-1 {\n width: 8.33333%;\n }\n .col-lg-2 {\n width: 16.66667%;\n }\n .col-lg-3 {\n width: 25%;\n float: left;\n }\n .col-lg-4 {\n width: 33.33333%;\n float: left;\n }\n .col-lg-5 {\n width: 41.66667%;\n }\n .col-lg-6 {\n width: 50%;\n }\n .col-lg-7 {\n width: 58.33333%;\n }\n .col-lg-8 {\n width: 66.66667%;\n }\n .col-lg-9 {\n width: 75%;\n }\n .col-lg-10 {\n width: 83.33333%;\n }\n\n .col-lg-11 {\n width: 91.66667%;\n }\n\n .col-lg-12 {\n width: 100%;\n }\n}\n\n@media (min-width: 1200px) {\n .gutter{\n padding: 0 32px 0 0;\n }\n .col-xl-1 {\n width: 8.33333%;\n }\n\n \n}\n@media (max-width: 767px) {\n .gutter{\n padding: 0;\n }\n}\n"])));
13
13
  const StyledBold = exports.StyledBold = _styledComponents.default.b(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: var(--color-primary-content);\n font-weight: 400;\n"])));
14
14
  const StyledSpan = exports.StyledSpan = _styledComponents.default.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n /* vertical-align: bottom; */\n color: var(--color-secondary-content);\n font-weight: 400;\n word-break: break-word;\n"])));
@@ -94,7 +94,8 @@ function ViewPreviousDescriptionWidget(_ref) {
94
94
  }, "Show translated text"), /*#__PURE__*/_react.default.createElement(_CustomToggle.default, {
95
95
  "data-test": dataTest ? "".concat(dataTest, "--translate-toggle") : undefined,
96
96
  checked: isTranslationOn,
97
- onClick: onToggleChange
97
+ onClick: onToggleChange,
98
+ size: "small"
98
99
  })), isTranslationOn && /*#__PURE__*/_react.default.createElement("p", {
99
100
  className: "type-b3-400"
100
101
  }, "Note: These responses are auto-translated. Please read the answers carefully as there might be minor typo.")), /*#__PURE__*/_react.default.createElement(_styles.UnderlinedContainer, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "0.18.20",
3
+ "version": "0.18.22",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",