@elicecontents/content-ui 1.0.2-alpha.0 → 1.0.2-alpha.2
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/components/layout/Layout.js +22 -25
- package/cjs/icons/ScrollMoreIcon.d.ts +3 -1
- package/cjs/icons/ScrollMoreIcon.js +9 -3
- package/es/components/index.js +2 -2
- package/es/components/layout/Layout.js +23 -26
- package/es/icons/ScrollMoreIcon.d.ts +3 -1
- package/es/icons/ScrollMoreIcon.js +9 -3
- package/package.json +1 -1
|
@@ -154,44 +154,44 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
154
154
|
}
|
|
155
155
|
var isScrollActive = context.isScrollActive,
|
|
156
156
|
setIsScrollActive = context.setIsScrollActive;
|
|
157
|
+
var _React$useState3 = React__default.default.useState(false),
|
|
158
|
+
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
159
|
+
hasScroll = _React$useState4[0],
|
|
160
|
+
setHasScroll = _React$useState4[1];
|
|
157
161
|
React__default.default.useEffect(function () {
|
|
158
|
-
var isInsideIframe = window.self !== window.top;
|
|
159
162
|
var handleScroll = function handleScroll() {
|
|
160
|
-
if (
|
|
161
|
-
setIsScrollActive(document.documentElement.scrollTop > 10);
|
|
162
|
-
} else if (contentRef.current) {
|
|
163
|
+
if (contentRef.current) {
|
|
163
164
|
var scrollTop = contentRef.current.scrollTop;
|
|
164
165
|
setIsScrollActive(scrollTop > 10);
|
|
165
166
|
}
|
|
166
167
|
};
|
|
167
|
-
|
|
168
|
-
window.addEventListener("scroll", handleScroll);
|
|
169
|
-
window.parent.postMessage({
|
|
170
|
-
type: "scrollUpdate",
|
|
171
|
-
scrollTop: document.documentElement.scrollTop
|
|
172
|
-
}, "*");
|
|
173
|
-
} else {
|
|
168
|
+
var checkScroll = function checkScroll() {
|
|
174
169
|
if (contentRef.current) {
|
|
175
|
-
contentRef.current
|
|
170
|
+
var _contentRef$current = contentRef.current,
|
|
171
|
+
scrollHeight = _contentRef$current.scrollHeight,
|
|
172
|
+
clientHeight = _contentRef$current.clientHeight;
|
|
173
|
+
setHasScroll(scrollHeight > clientHeight);
|
|
176
174
|
}
|
|
175
|
+
};
|
|
176
|
+
var element = contentRef.current;
|
|
177
|
+
if (element) {
|
|
178
|
+
element.addEventListener("scroll", handleScroll);
|
|
179
|
+
checkScroll();
|
|
177
180
|
}
|
|
178
181
|
return function () {
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
} else {
|
|
182
|
-
if (contentRef.current) {
|
|
183
|
-
contentRef.current.removeEventListener("scroll", handleScroll);
|
|
184
|
-
}
|
|
182
|
+
if (element) {
|
|
183
|
+
element.removeEventListener("scroll", handleScroll);
|
|
185
184
|
}
|
|
186
185
|
};
|
|
187
|
-
}, []);
|
|
186
|
+
}, [contentRef]);
|
|
188
187
|
return jsxRuntime.jsxs(_ContentContainer, {
|
|
189
188
|
ref: contentRef,
|
|
190
189
|
theme: theme,
|
|
191
|
-
children: [children, !isScrollActive && jsxRuntime.jsx(ScrollMoreButton, {
|
|
190
|
+
children: [children, hasScroll && !isScrollActive && jsxRuntime.jsx(ScrollMoreButton, {
|
|
192
191
|
children: jsxRuntime.jsx(ScrollMoreIcon.default, {
|
|
193
192
|
size: 32,
|
|
194
|
-
color: "white"
|
|
193
|
+
color: "white",
|
|
194
|
+
bgOpacity: 0.5
|
|
195
195
|
})
|
|
196
196
|
})]
|
|
197
197
|
});
|
|
@@ -223,10 +223,7 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
223
223
|
return jsxRuntime.jsx(_Content, {
|
|
224
224
|
alignment: alignment,
|
|
225
225
|
justifyContent: justifyContent,
|
|
226
|
-
children:
|
|
227
|
-
variant: "body1",
|
|
228
|
-
children: children
|
|
229
|
-
})
|
|
226
|
+
children: children
|
|
230
227
|
});
|
|
231
228
|
},
|
|
232
229
|
FooterContainer: function FooterContainer(_ref19) {
|
|
@@ -2,6 +2,8 @@ import { IconProps } from "./_types";
|
|
|
2
2
|
interface ScrollMoreIconProps extends IconProps {
|
|
3
3
|
bgColor?: string;
|
|
4
4
|
arrowColor?: string;
|
|
5
|
+
bgOpacity?: number;
|
|
6
|
+
arrowOpacity?: number;
|
|
5
7
|
}
|
|
6
|
-
declare const ScrollMoreIcon: ({ size, bgColor, arrowColor, ...other }: ScrollMoreIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const ScrollMoreIcon: ({ size, bgColor, arrowColor, bgOpacity, arrowOpacity, ...other }: ScrollMoreIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export default ScrollMoreIcon;
|
|
@@ -12,7 +12,11 @@ var ScrollMoreIcon = function ScrollMoreIcon(_a) {
|
|
|
12
12
|
bgColor = _a$bgColor === void 0 ? "#7D89C2" : _a$bgColor,
|
|
13
13
|
_a$arrowColor = _a.arrowColor,
|
|
14
14
|
arrowColor = _a$arrowColor === void 0 ? "white" : _a$arrowColor,
|
|
15
|
-
|
|
15
|
+
_a$bgOpacity = _a.bgOpacity,
|
|
16
|
+
bgOpacity = _a$bgOpacity === void 0 ? 1 : _a$bgOpacity,
|
|
17
|
+
_a$arrowOpacity = _a.arrowOpacity,
|
|
18
|
+
arrowOpacity = _a$arrowOpacity === void 0 ? 1 : _a$arrowOpacity,
|
|
19
|
+
other = tslib.__rest(_a, ["size", "bgColor", "arrowColor", "bgOpacity", "arrowOpacity"]);
|
|
16
20
|
return jsxRuntime.jsxs("svg", Object.assign({
|
|
17
21
|
width: size,
|
|
18
22
|
height: size,
|
|
@@ -24,10 +28,12 @@ var ScrollMoreIcon = function ScrollMoreIcon(_a) {
|
|
|
24
28
|
width: "36",
|
|
25
29
|
height: "36",
|
|
26
30
|
rx: "16",
|
|
27
|
-
fill: bgColor
|
|
31
|
+
fill: bgColor,
|
|
32
|
+
opacity: bgOpacity
|
|
28
33
|
}), jsxRuntime.jsx("path", {
|
|
29
34
|
d: "M17.1914 22.4336L12.6914 17.9336C12.375 17.6172 12.2695 17.125 12.4453 16.7031C12.6211 16.2812 13.043 16 13.5 16H22.5C22.957 16 23.3438 16.2812 23.5195 16.7031C23.6953 17.125 23.5898 17.6172 23.2734 17.9336L18.7734 22.4336C18.3516 22.8906 17.6133 22.8906 17.1914 22.4336Z",
|
|
30
|
-
fill: arrowColor
|
|
35
|
+
fill: arrowColor,
|
|
36
|
+
opacity: arrowOpacity
|
|
31
37
|
})]
|
|
32
38
|
}));
|
|
33
39
|
};
|
package/es/components/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { default as EliceChat } from './chat/Chat.js';
|
|
2
|
-
export { default as EliceAnswerFeedback } from './answer-feedback/AnswerFeedback.js';
|
|
3
1
|
export { default as EliceAIFeedback } from './AI-feedback/AIFeedback.js';
|
|
4
2
|
export { default as EliceBadge } from './badge/Badge.js';
|
|
5
3
|
export { default as EliceButton } from './button/Button.js';
|
|
4
|
+
export { default as EliceChat } from './chat/Chat.js';
|
|
6
5
|
export { default as EliceDialog } from './dialog/Dialog.js';
|
|
7
6
|
export { default as EliceDottedPagination } from './dotted-pagination/DottedPagination.js';
|
|
8
7
|
export { default as EliceLayout } from './layout/Layout.js';
|
|
9
8
|
export { default as EliceQuestion } from './question/Question.js';
|
|
10
9
|
export { default as EliceSelection } from './selection/Selection.js';
|
|
11
10
|
export { default as EliceIconButton } from './icon-button/IconButton.js';
|
|
11
|
+
export { default as EliceAnswerFeedback } from './answer-feedback/AnswerFeedback.js';
|
|
12
12
|
export { default as EliceTable } from './table/Table.js';
|
|
13
13
|
export { default as EliceTextarea } from './textarea/Textarea.js';
|
|
14
14
|
export { default as EliceTooltip } from './tooltip/Tooltip.js';
|
|
@@ -2,7 +2,7 @@ import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBab
|
|
|
2
2
|
import _styled from '@emotion/styled/base';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { Stack, Button,
|
|
5
|
+
import { Stack, Button, useTheme } from '@mui/material';
|
|
6
6
|
import useAIDTMediaQuery from '../../hooks/useAIDTMediaQuery.js';
|
|
7
7
|
import ScrollMoreIcon from '../../icons/ScrollMoreIcon.js';
|
|
8
8
|
import LayoutPagination from './layout-pagination/LayoutPagination.js';
|
|
@@ -145,44 +145,44 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
145
145
|
}
|
|
146
146
|
var isScrollActive = context.isScrollActive,
|
|
147
147
|
setIsScrollActive = context.setIsScrollActive;
|
|
148
|
+
var _React$useState3 = React.useState(false),
|
|
149
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
150
|
+
hasScroll = _React$useState4[0],
|
|
151
|
+
setHasScroll = _React$useState4[1];
|
|
148
152
|
React.useEffect(function () {
|
|
149
|
-
var isInsideIframe = window.self !== window.top;
|
|
150
153
|
var handleScroll = function handleScroll() {
|
|
151
|
-
if (
|
|
152
|
-
setIsScrollActive(document.documentElement.scrollTop > 10);
|
|
153
|
-
} else if (contentRef.current) {
|
|
154
|
+
if (contentRef.current) {
|
|
154
155
|
var scrollTop = contentRef.current.scrollTop;
|
|
155
156
|
setIsScrollActive(scrollTop > 10);
|
|
156
157
|
}
|
|
157
158
|
};
|
|
158
|
-
|
|
159
|
-
window.addEventListener("scroll", handleScroll);
|
|
160
|
-
window.parent.postMessage({
|
|
161
|
-
type: "scrollUpdate",
|
|
162
|
-
scrollTop: document.documentElement.scrollTop
|
|
163
|
-
}, "*");
|
|
164
|
-
} else {
|
|
159
|
+
var checkScroll = function checkScroll() {
|
|
165
160
|
if (contentRef.current) {
|
|
166
|
-
contentRef.current
|
|
161
|
+
var _contentRef$current = contentRef.current,
|
|
162
|
+
scrollHeight = _contentRef$current.scrollHeight,
|
|
163
|
+
clientHeight = _contentRef$current.clientHeight;
|
|
164
|
+
setHasScroll(scrollHeight > clientHeight);
|
|
167
165
|
}
|
|
166
|
+
};
|
|
167
|
+
var element = contentRef.current;
|
|
168
|
+
if (element) {
|
|
169
|
+
element.addEventListener("scroll", handleScroll);
|
|
170
|
+
checkScroll();
|
|
168
171
|
}
|
|
169
172
|
return function () {
|
|
170
|
-
if (
|
|
171
|
-
|
|
172
|
-
} else {
|
|
173
|
-
if (contentRef.current) {
|
|
174
|
-
contentRef.current.removeEventListener("scroll", handleScroll);
|
|
175
|
-
}
|
|
173
|
+
if (element) {
|
|
174
|
+
element.removeEventListener("scroll", handleScroll);
|
|
176
175
|
}
|
|
177
176
|
};
|
|
178
|
-
}, []);
|
|
177
|
+
}, [contentRef]);
|
|
179
178
|
return jsxs(_ContentContainer, {
|
|
180
179
|
ref: contentRef,
|
|
181
180
|
theme: theme,
|
|
182
|
-
children: [children, !isScrollActive && jsx(ScrollMoreButton, {
|
|
181
|
+
children: [children, hasScroll && !isScrollActive && jsx(ScrollMoreButton, {
|
|
183
182
|
children: jsx(ScrollMoreIcon, {
|
|
184
183
|
size: 32,
|
|
185
|
-
color: "white"
|
|
184
|
+
color: "white",
|
|
185
|
+
bgOpacity: 0.5
|
|
186
186
|
})
|
|
187
187
|
})]
|
|
188
188
|
});
|
|
@@ -214,10 +214,7 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
214
214
|
return jsx(_Content, {
|
|
215
215
|
alignment: alignment,
|
|
216
216
|
justifyContent: justifyContent,
|
|
217
|
-
children:
|
|
218
|
-
variant: "body1",
|
|
219
|
-
children: children
|
|
220
|
-
})
|
|
217
|
+
children: children
|
|
221
218
|
});
|
|
222
219
|
},
|
|
223
220
|
FooterContainer: function FooterContainer(_ref19) {
|
|
@@ -2,6 +2,8 @@ import { IconProps } from "./_types";
|
|
|
2
2
|
interface ScrollMoreIconProps extends IconProps {
|
|
3
3
|
bgColor?: string;
|
|
4
4
|
arrowColor?: string;
|
|
5
|
+
bgOpacity?: number;
|
|
6
|
+
arrowOpacity?: number;
|
|
5
7
|
}
|
|
6
|
-
declare const ScrollMoreIcon: ({ size, bgColor, arrowColor, ...other }: ScrollMoreIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const ScrollMoreIcon: ({ size, bgColor, arrowColor, bgOpacity, arrowOpacity, ...other }: ScrollMoreIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export default ScrollMoreIcon;
|
|
@@ -8,7 +8,11 @@ var ScrollMoreIcon = function ScrollMoreIcon(_a) {
|
|
|
8
8
|
bgColor = _a$bgColor === void 0 ? "#7D89C2" : _a$bgColor,
|
|
9
9
|
_a$arrowColor = _a.arrowColor,
|
|
10
10
|
arrowColor = _a$arrowColor === void 0 ? "white" : _a$arrowColor,
|
|
11
|
-
|
|
11
|
+
_a$bgOpacity = _a.bgOpacity,
|
|
12
|
+
bgOpacity = _a$bgOpacity === void 0 ? 1 : _a$bgOpacity,
|
|
13
|
+
_a$arrowOpacity = _a.arrowOpacity,
|
|
14
|
+
arrowOpacity = _a$arrowOpacity === void 0 ? 1 : _a$arrowOpacity,
|
|
15
|
+
other = __rest(_a, ["size", "bgColor", "arrowColor", "bgOpacity", "arrowOpacity"]);
|
|
12
16
|
return jsxs("svg", Object.assign({
|
|
13
17
|
width: size,
|
|
14
18
|
height: size,
|
|
@@ -20,10 +24,12 @@ var ScrollMoreIcon = function ScrollMoreIcon(_a) {
|
|
|
20
24
|
width: "36",
|
|
21
25
|
height: "36",
|
|
22
26
|
rx: "16",
|
|
23
|
-
fill: bgColor
|
|
27
|
+
fill: bgColor,
|
|
28
|
+
opacity: bgOpacity
|
|
24
29
|
}), jsx("path", {
|
|
25
30
|
d: "M17.1914 22.4336L12.6914 17.9336C12.375 17.6172 12.2695 17.125 12.4453 16.7031C12.6211 16.2812 13.043 16 13.5 16H22.5C22.957 16 23.3438 16.2812 23.5195 16.7031C23.6953 17.125 23.5898 17.6172 23.2734 17.9336L18.7734 22.4336C18.3516 22.8906 17.6133 22.8906 17.1914 22.4336Z",
|
|
26
|
-
fill: arrowColor
|
|
31
|
+
fill: arrowColor,
|
|
32
|
+
opacity: arrowOpacity
|
|
27
33
|
})]
|
|
28
34
|
}));
|
|
29
35
|
};
|
package/package.json
CHANGED