@vitus-labs/elements 0.17.0 → 0.19.0
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/analysis/vitus-labs-elements.browser.js.html +1 -1
- package/lib/analysis/vitus-labs-elements.js.html +1 -1
- package/lib/analysis/vitus-labs-elements.module.js.html +1 -1
- package/lib/analysis/vitus-labs-elements.native.js.html +1 -1
- package/lib/analysis/vitus-labs-elements.umd.js.html +1 -1
- package/lib/analysis/vitus-labs-elements.umd.min.js.html +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/types/Element/types.d.ts +0 -1
- package/lib/types/Element/utils.d.ts +0 -3
- package/lib/vitus-labs-elements.browser.js +52 -67
- package/lib/vitus-labs-elements.browser.js.map +1 -1
- package/lib/vitus-labs-elements.js +51 -72
- package/lib/vitus-labs-elements.js.map +1 -1
- package/lib/vitus-labs-elements.module.js +52 -73
- package/lib/vitus-labs-elements.module.js.map +1 -1
- package/lib/vitus-labs-elements.native.js +40 -59
- package/lib/vitus-labs-elements.native.js.map +1 -1
- package/lib/vitus-labs-elements.umd.js +51 -72
- package/lib/vitus-labs-elements.umd.js.map +1 -1
- package/lib/vitus-labs-elements.umd.min.js +23 -23
- package/lib/vitus-labs-elements.umd.min.js.map +1 -1
- package/package.json +9 -9
|
@@ -7060,7 +7060,7 @@ var drawChart = (function (exports) {
|
|
|
7060
7060
|
</script>
|
|
7061
7061
|
<script>
|
|
7062
7062
|
/*<!--*/
|
|
7063
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-elements.umd.min.js","children":[{"name":"src","children":[{"uid":"
|
|
7063
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-elements.umd.min.js","children":[{"name":"src","children":[{"uid":"faea-201","name":"constants.ts"},{"name":"helpers","children":[{"name":"Wrapper","children":[{"uid":"faea-203","name":"constants.ts"},{"uid":"faea-205","name":"utils.ts"},{"uid":"faea-207","name":"styled.ts"},{"uid":"faea-209","name":"component.tsx"}]},{"name":"Content","children":[{"uid":"faea-211","name":"styled.ts"},{"uid":"faea-213","name":"component.tsx"}]},{"name":"Iterator/component.tsx","uid":"faea-223"}]},{"name":"Element","children":[{"uid":"faea-215","name":"constants.ts"},{"uid":"faea-217","name":"utils.ts"},{"uid":"faea-219","name":"component.tsx"},{"uid":"faea-221","name":"withEqualSizeBeforeAfter.tsx"}]},{"name":"List","children":[{"uid":"faea-225","name":"component.tsx"},{"uid":"faea-227","name":"withActiveState.tsx"}]},{"name":"Portal/component.ts","uid":"faea-229"},{"name":"Overlay/component.tsx","uid":"faea-231"},{"name":"Text","children":[{"uid":"faea-233","name":"styled.ts"},{"uid":"faea-235","name":"component.tsx"}]},{"uid":"faea-237","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"faea-201":{"renderedLength":102,"gzipLength":117,"brotliLength":0,"mainUid":"faea-200"},"faea-203":{"renderedLength":262,"gzipLength":212,"brotliLength":0,"mainUid":"faea-202"},"faea-205":{"renderedLength":117,"gzipLength":132,"brotliLength":0,"mainUid":"faea-204"},"faea-207":{"renderedLength":1078,"gzipLength":467,"brotliLength":0,"mainUid":"faea-206"},"faea-209":{"renderedLength":1289,"gzipLength":483,"brotliLength":0,"mainUid":"faea-208"},"faea-211":{"renderedLength":1756,"gzipLength":649,"brotliLength":0,"mainUid":"faea-210"},"faea-213":{"renderedLength":563,"gzipLength":281,"brotliLength":0,"mainUid":"faea-212"},"faea-215":{"renderedLength":945,"gzipLength":269,"brotliLength":0,"mainUid":"faea-214"},"faea-217":{"renderedLength":142,"gzipLength":118,"brotliLength":0,"mainUid":"faea-216"},"faea-219":{"renderedLength":5078,"gzipLength":1167,"brotliLength":0,"mainUid":"faea-218"},"faea-221":{"renderedLength":1970,"gzipLength":607,"brotliLength":0,"mainUid":"faea-220"},"faea-223":{"renderedLength":7384,"gzipLength":1319,"brotliLength":0,"mainUid":"faea-222"},"faea-225":{"renderedLength":587,"gzipLength":309,"brotliLength":0,"mainUid":"faea-224"},"faea-227":{"renderedLength":4819,"gzipLength":1096,"brotliLength":0,"mainUid":"faea-226"},"faea-229":{"renderedLength":503,"gzipLength":293,"brotliLength":0,"mainUid":"faea-228"},"faea-231":{"renderedLength":11065,"gzipLength":1965,"brotliLength":0,"mainUid":"faea-230"},"faea-233":{"renderedLength":352,"gzipLength":237,"brotliLength":0,"mainUid":"faea-232"},"faea-235":{"renderedLength":615,"gzipLength":369,"brotliLength":0,"mainUid":"faea-234"},"faea-237":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"faea-236"}},"nodeMetas":{"faea-200":{"id":"/src/constants.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-201"},"imported":[],"importedBy":[{"uid":"faea-218"},{"uid":"faea-224"},{"uid":"faea-230"},{"uid":"faea-228"},{"uid":"faea-234"}]},"faea-202":{"id":"/src/helpers/Wrapper/constants.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-203"},"imported":[],"importedBy":[{"uid":"faea-204"}]},"faea-204":{"id":"/src/helpers/Wrapper/utils.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-205"},"imported":[{"uid":"faea-202"}],"importedBy":[{"uid":"faea-208"}]},"faea-206":{"id":"/src/helpers/Wrapper/styled.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-207"},"imported":[{"uid":"faea-245"},{"uid":"faea-238"}],"importedBy":[{"uid":"faea-208"}]},"faea-208":{"id":"/src/helpers/Wrapper/component.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-209"},"imported":[{"uid":"faea-244"},{"uid":"faea-204"},{"uid":"faea-206"}],"importedBy":[{"uid":"faea-249"}]},"faea-210":{"id":"/src/helpers/Content/styled.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-211"},"imported":[{"uid":"faea-245"},{"uid":"faea-238"}],"importedBy":[{"uid":"faea-212"}]},"faea-212":{"id":"/src/helpers/Content/component.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-213"},"imported":[{"uid":"faea-244"},{"uid":"faea-210"}],"importedBy":[{"uid":"faea-250"}]},"faea-214":{"id":"/src/Element/constants.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-215"},"imported":[],"importedBy":[{"uid":"faea-216"}]},"faea-216":{"id":"/src/Element/utils.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-217"},"imported":[{"uid":"faea-214"}],"importedBy":[{"uid":"faea-218"}]},"faea-218":{"id":"/src/Element/component.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-219"},"imported":[{"uid":"faea-244"},{"uid":"faea-245"},{"uid":"faea-200"},{"uid":"faea-246"},{"uid":"faea-216"}],"importedBy":[{"uid":"faea-239"}]},"faea-220":{"id":"/src/Element/withEqualSizeBeforeAfter.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-221"},"imported":[{"uid":"faea-244"},{"uid":"faea-245"}],"importedBy":[{"uid":"faea-239"}]},"faea-222":{"id":"/src/helpers/Iterator/component.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-223"},"imported":[{"uid":"faea-244"},{"uid":"faea-245"}],"importedBy":[{"uid":"faea-247"}]},"faea-224":{"id":"/src/List/component.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-225"},"imported":[{"uid":"faea-244"},{"uid":"faea-245"},{"uid":"faea-200"},{"uid":"faea-239"},{"uid":"faea-247"}],"importedBy":[{"uid":"faea-240"}]},"faea-226":{"id":"/src/List/withActiveState.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-227"},"imported":[{"uid":"faea-244"}],"importedBy":[{"uid":"faea-240"}]},"faea-228":{"id":"/src/Portal/component.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-229"},"imported":[{"uid":"faea-244"},{"uid":"faea-248"},{"uid":"faea-200"}],"importedBy":[{"uid":"faea-242"}]},"faea-230":{"id":"/src/Overlay/component.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-231"},"imported":[{"uid":"faea-244"},{"uid":"faea-245"},{"uid":"faea-238"},{"uid":"faea-200"},{"uid":"faea-242"}],"importedBy":[{"uid":"faea-241"}]},"faea-232":{"id":"/src/Text/styled.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-233"},"imported":[{"uid":"faea-245"},{"uid":"faea-238"}],"importedBy":[{"uid":"faea-234"}]},"faea-234":{"id":"/src/Text/component.tsx","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-235"},"imported":[{"uid":"faea-244"},{"uid":"faea-200"},{"uid":"faea-232"}],"importedBy":[{"uid":"faea-243"}]},"faea-236":{"id":"/src/index.ts","moduleParts":{"vitus-labs-elements.umd.min.js":"faea-237"},"imported":[{"uid":"faea-238"},{"uid":"faea-239"},{"uid":"faea-240"},{"uid":"faea-241"},{"uid":"faea-242"},{"uid":"faea-243"}],"importedBy":[],"isEntry":true},"faea-238":{"id":"@vitus-labs/unistyle","moduleParts":{},"imported":[],"importedBy":[{"uid":"faea-236"},{"uid":"faea-230"},{"uid":"faea-232"},{"uid":"faea-206"},{"uid":"faea-210"}],"isExternal":true},"faea-239":{"id":"/src/Element/index.ts","moduleParts":{},"imported":[{"uid":"faea-218"},{"uid":"faea-220"}],"importedBy":[{"uid":"faea-236"},{"uid":"faea-224"}]},"faea-240":{"id":"/src/List/index.ts","moduleParts":{},"imported":[{"uid":"faea-224"},{"uid":"faea-226"}],"importedBy":[{"uid":"faea-236"}]},"faea-241":{"id":"/src/Overlay/index.ts","moduleParts":{},"imported":[{"uid":"faea-230"}],"importedBy":[{"uid":"faea-236"}]},"faea-242":{"id":"/src/Portal/index.ts","moduleParts":{},"imported":[{"uid":"faea-228"}],"importedBy":[{"uid":"faea-236"},{"uid":"faea-230"}]},"faea-243":{"id":"/src/Text/index.ts","moduleParts":{},"imported":[{"uid":"faea-234"}],"importedBy":[{"uid":"faea-236"}]},"faea-244":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"faea-218"},{"uid":"faea-220"},{"uid":"faea-224"},{"uid":"faea-226"},{"uid":"faea-230"},{"uid":"faea-228"},{"uid":"faea-234"},{"uid":"faea-222"},{"uid":"faea-208"},{"uid":"faea-212"}],"isExternal":true},"faea-245":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"faea-218"},{"uid":"faea-220"},{"uid":"faea-224"},{"uid":"faea-230"},{"uid":"faea-232"},{"uid":"faea-222"},{"uid":"faea-206"},{"uid":"faea-210"}],"isExternal":true},"faea-246":{"id":"/src/helpers/index.ts","moduleParts":{},"imported":[{"uid":"faea-249"},{"uid":"faea-250"}],"importedBy":[{"uid":"faea-218"}]},"faea-247":{"id":"/src/helpers/Iterator/index.ts","moduleParts":{},"imported":[{"uid":"faea-222"}],"importedBy":[{"uid":"faea-224"}]},"faea-248":{"id":"react-dom","moduleParts":{},"imported":[],"importedBy":[{"uid":"faea-228"}],"isExternal":true},"faea-249":{"id":"/src/helpers/Wrapper/index.ts","moduleParts":{},"imported":[{"uid":"faea-208"}],"importedBy":[{"uid":"faea-246"}]},"faea-250":{"id":"/src/helpers/Content/index.ts","moduleParts":{},"imported":[{"uid":"faea-212"}],"importedBy":[{"uid":"faea-246"}]}},"env":{"rollup":"2.60.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
7064
7064
|
|
|
7065
7065
|
const run = () => {
|
|
7066
7066
|
const width = window.innerWidth;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
declare type Value<T = unknown> = T extends true ? 'rows' : 'inline';
|
|
2
|
-
declare type TransformVerticalProp = <T extends boolean | Record<string, boolean> | Array<boolean>>(vertical: T) => T extends boolean ? Value<T> : T extends Record<string, boolean> ? Record<keyof T, Value<T[keyof T]>> : T extends Array<boolean> ? Array<Value<T[number]>> : T;
|
|
3
|
-
export declare const transformVerticalProp: TransformVerticalProp;
|
|
4
1
|
declare type GetValue = (tag?: string) => boolean;
|
|
5
2
|
export declare const isInlineElement: GetValue;
|
|
6
3
|
export declare const getShouldBeEmpty: GetValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { makeItResponsive, alignContent, extendCss, value } from '@vitus-labs/unistyle';
|
|
2
2
|
export { Provider } from '@vitus-labs/unistyle';
|
|
3
|
-
import React, { forwardRef, memo, useMemo, createRef, Children, useState, useEffect, useContext, useRef } from 'react';
|
|
3
|
+
import React, { forwardRef, memo, useMemo, createRef, Children, useState, useEffect, useContext, useRef, useCallback } from 'react';
|
|
4
4
|
import { config, renderContent, get, isEmpty, pick, omit, context, throttle } from '@vitus-labs/core';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
|
|
@@ -19,38 +19,38 @@ const INLINE_ELEMENTS_FLEX_FIX = {
|
|
|
19
19
|
const isWebFixNeeded = (tag) => INLINE_ELEMENTS_FLEX_FIX[tag];
|
|
20
20
|
|
|
21
21
|
const styles$2 = ({ theme: t, css }) => css `
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
height: 100%;
|
|
25
|
-
`};
|
|
26
|
-
|
|
27
|
-
${css `
|
|
28
|
-
${({ $isInner }) => !$isInner &&
|
|
22
|
+
${css `
|
|
23
|
+
${({ $childFix }) => !$childFix &&
|
|
29
24
|
css `
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
display: ${t.block ? 'flex' : 'inline-flex'};
|
|
26
|
+
`};
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
${({ $parentFix }) => $parentFix &&
|
|
34
29
|
t.block &&
|
|
35
30
|
css `
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
width: 100%;
|
|
33
|
+
`};
|
|
34
|
+
`};
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
${t.contentAlignY === 'block' &&
|
|
42
37
|
css `
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
height: 100%;
|
|
39
|
+
`};
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
${alignContent({
|
|
47
42
|
direction: t.direction,
|
|
48
43
|
alignX: t.alignX,
|
|
49
44
|
alignY: t.alignY,
|
|
50
45
|
})};
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
${t.block &&
|
|
48
|
+
css `
|
|
49
|
+
align-self: stretch;
|
|
50
|
+
`}
|
|
51
|
+
|
|
52
|
+
${t.extraStyles && extendCss(t.extraStyles)};
|
|
53
|
+
`;
|
|
54
54
|
const platformStyles = config.css `
|
|
55
55
|
box-sizing: border-box;
|
|
56
56
|
`
|
|
@@ -59,7 +59,7 @@ var Styled$2 = config.styled(config.component) `
|
|
|
59
59
|
position: relative;
|
|
60
60
|
${platformStyles};
|
|
61
61
|
|
|
62
|
-
${({ $
|
|
62
|
+
${({ $childFix }) => $childFix &&
|
|
63
63
|
config.css `
|
|
64
64
|
display: flex;
|
|
65
65
|
flex: 1;
|
|
@@ -79,7 +79,7 @@ var Styled$2 = config.styled(config.component) `
|
|
|
79
79
|
const component$6 = forwardRef(({ children, tag, block, extendCss, direction, alignX, alignY, equalCols, isInline, ...props }, ref) => {
|
|
80
80
|
const debugProps = process.env.NODE_ENV !== 'production'
|
|
81
81
|
? {
|
|
82
|
-
'data-element': 'Element',
|
|
82
|
+
'data-vl-element': 'Element',
|
|
83
83
|
}
|
|
84
84
|
: {};
|
|
85
85
|
const COMMON_PROPS = {
|
|
@@ -100,11 +100,11 @@ const component$6 = forwardRef(({ children, tag, block, extendCss, direction, al
|
|
|
100
100
|
extraStyles: extendCss,
|
|
101
101
|
} }, children));
|
|
102
102
|
}
|
|
103
|
-
return (React.createElement(Styled$2, { ...COMMON_PROPS, "$
|
|
103
|
+
return (React.createElement(Styled$2, { ...COMMON_PROPS, "$parentFix": true, "$element": {
|
|
104
104
|
block,
|
|
105
105
|
extraStyles: extendCss,
|
|
106
106
|
} },
|
|
107
|
-
React.createElement(Styled$2, { as: isInline ? 'span' : 'div', "$
|
|
107
|
+
React.createElement(Styled$2, { as: isInline ? 'span' : 'div', "$childFix": true, "$element": {
|
|
108
108
|
direction,
|
|
109
109
|
alignX,
|
|
110
110
|
alignY,
|
|
@@ -251,34 +251,14 @@ const EMPTY_ELEMENTS = {
|
|
|
251
251
|
wbr: true,
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
const transformVerticalProp = (vertical) => {
|
|
255
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
256
|
-
if (vertical == null)
|
|
257
|
-
return undefined;
|
|
258
|
-
const verticalType = typeof vertical;
|
|
259
|
-
// vertical is a boolean value
|
|
260
|
-
if (verticalType === 'boolean') {
|
|
261
|
-
return vertical ? 'rows' : 'inline';
|
|
262
|
-
}
|
|
263
|
-
if (Array.isArray(vertical)) {
|
|
264
|
-
return vertical.map((item) => item ? 'rows' : 'inline');
|
|
265
|
-
}
|
|
266
|
-
if (verticalType === 'object') {
|
|
267
|
-
return Object.keys(vertical).reduce((accumulator, item) => {
|
|
268
|
-
// eslint-disable-next-line no-param-reassign
|
|
269
|
-
accumulator[item] = vertical[item] ? 'rows' : 'inline';
|
|
270
|
-
return accumulator;
|
|
271
|
-
}, {});
|
|
272
|
-
}
|
|
273
|
-
return undefined;
|
|
274
|
-
};
|
|
275
254
|
const isInlineElement = (tag) => tag ? INLINE_ELEMENTS[tag] : false;
|
|
276
255
|
const getShouldBeEmpty = (tag) => tag ? EMPTY_ELEMENTS[tag] : false;
|
|
277
256
|
|
|
278
257
|
const defaultDirection = 'inline';
|
|
258
|
+
const defaultContentDirection = 'rows';
|
|
279
259
|
const defaultAlignX = 'left';
|
|
280
260
|
const defaultAlignY = 'center';
|
|
281
|
-
const component$3 = forwardRef(({ innerRef, tag, label, content, children, beforeContent, afterContent, block, equalCols, gap,
|
|
261
|
+
const component$3 = forwardRef(({ innerRef, tag, label, content, children, beforeContent, afterContent, block, equalCols, gap, direction, alignX = defaultAlignX, alignY = defaultAlignY, css, contentCss, beforeContentCss, afterContentCss, contentDirection = defaultContentDirection, contentAlignX = defaultAlignX, contentAlignY = defaultAlignY, beforeContentDirection = defaultDirection, beforeContentAlignX = defaultAlignX, beforeContentAlignY = defaultAlignY, afterContentDirection = defaultDirection, afterContentAlignX = defaultAlignX, afterContentAlignY = defaultAlignY, ...props }, ref) => {
|
|
282
262
|
// --------------------------------------------------------
|
|
283
263
|
// check if should render only single element
|
|
284
264
|
// --------------------------------------------------------
|
|
@@ -305,18 +285,18 @@ const component$3 = forwardRef(({ innerRef, tag, label, content, children, befor
|
|
|
305
285
|
// --------------------------------------------------------
|
|
306
286
|
// if not single element, calculate values
|
|
307
287
|
// --------------------------------------------------------
|
|
308
|
-
const
|
|
288
|
+
const isSimpleElement = !beforeContent && !afterContent;
|
|
309
289
|
const CHILDREN = children || content || label;
|
|
310
290
|
const isInline = isInlineElement(tag) ;
|
|
311
291
|
const SUB_TAG = isInline ? 'span' : undefined;
|
|
312
292
|
// --------------------------------------------------------
|
|
313
293
|
// direction & alignX & alignY calculations
|
|
314
294
|
// --------------------------------------------------------
|
|
315
|
-
const calculateDirection = () => {
|
|
295
|
+
const calculateDirection = useMemo(() => {
|
|
316
296
|
let wrapperDirection;
|
|
317
297
|
let wrapperAlignX = alignX;
|
|
318
298
|
let wrapperAlignY = alignY;
|
|
319
|
-
if (
|
|
299
|
+
if (isSimpleElement) {
|
|
320
300
|
if (contentDirection)
|
|
321
301
|
wrapperDirection = contentDirection;
|
|
322
302
|
if (contentAlignX)
|
|
@@ -327,21 +307,27 @@ const component$3 = forwardRef(({ innerRef, tag, label, content, children, befor
|
|
|
327
307
|
else if (direction) {
|
|
328
308
|
wrapperDirection = direction;
|
|
329
309
|
}
|
|
330
|
-
else if (vertical !== undefined && vertical !== null) {
|
|
331
|
-
wrapperDirection = transformVerticalProp(vertical);
|
|
332
|
-
}
|
|
333
310
|
else {
|
|
334
311
|
wrapperDirection = defaultDirection;
|
|
335
312
|
}
|
|
336
313
|
return { wrapperDirection, wrapperAlignX, wrapperAlignY };
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
314
|
+
}, [
|
|
315
|
+
isSimpleElement,
|
|
316
|
+
contentDirection,
|
|
317
|
+
contentAlignX,
|
|
318
|
+
contentAlignY,
|
|
319
|
+
direction,
|
|
320
|
+
]);
|
|
321
|
+
const { wrapperDirection, wrapperAlignX, wrapperAlignY, } = calculateDirection;
|
|
322
|
+
const beforeContentRenderOutput = useMemo(() => renderContent(beforeContent), [beforeContent]);
|
|
323
|
+
const afterContentRenderOutput = useMemo(() => renderContent(afterContent), [afterContent]);
|
|
324
|
+
const contentRenderOutput = useMemo(() => renderContent(CHILDREN), [
|
|
325
|
+
CHILDREN,
|
|
326
|
+
]);
|
|
341
327
|
return (React.createElement(component$6, { ...props, ...WRAPPER_PROPS, isInline: isInline, direction: wrapperDirection, alignX: wrapperAlignX, alignY: wrapperAlignY },
|
|
342
|
-
beforeContent && (React.createElement(component$5, { tag: SUB_TAG, contentType: "before", parentDirection: wrapperDirection, extendCss: beforeContentCss, direction: beforeContentDirection, alignX: beforeContentAlignX, alignY: beforeContentAlignY, equalCols: equalCols, gap: gap },
|
|
343
|
-
|
|
344
|
-
afterContent && (React.createElement(component$5, { tag: SUB_TAG, contentType: "after", parentDirection: wrapperDirection, extendCss: afterContentCss, direction: afterContentDirection, alignX: afterContentAlignX, alignY: afterContentAlignY, equalCols: equalCols, gap: gap },
|
|
328
|
+
beforeContent && (React.createElement(component$5, { tag: SUB_TAG, contentType: "before", parentDirection: wrapperDirection, extendCss: beforeContentCss, direction: beforeContentDirection, alignX: beforeContentAlignX, alignY: beforeContentAlignY, equalCols: equalCols, gap: gap }, beforeContentRenderOutput)),
|
|
329
|
+
isSimpleElement ? (contentRenderOutput) : (React.createElement(component$5, { tag: SUB_TAG, contentType: "content", parentDirection: wrapperDirection, extendCss: contentCss, direction: contentDirection, alignX: contentAlignX, alignY: contentAlignY, equalCols: equalCols }, contentRenderOutput)),
|
|
330
|
+
afterContent && (React.createElement(component$5, { tag: SUB_TAG, contentType: "after", parentDirection: wrapperDirection, extendCss: afterContentCss, direction: afterContentDirection, alignX: afterContentAlignX, alignY: afterContentAlignY, equalCols: equalCols, gap: gap }, afterContentRenderOutput))));
|
|
345
331
|
});
|
|
346
332
|
const name$4 = `${PKG_NAME}/Element`;
|
|
347
333
|
component$3.displayName = name$4;
|
|
@@ -556,8 +542,7 @@ const component$2 = (props) => {
|
|
|
556
542
|
return renderItems();
|
|
557
543
|
};
|
|
558
544
|
component$2.isIterator = true;
|
|
559
|
-
component$2.RESERVED_PROPS = RESERVED_PROPS;
|
|
560
|
-
component$2.displayName = 'vitus-labs/elements/Iterator';
|
|
545
|
+
component$2.RESERVED_PROPS = RESERVED_PROPS;
|
|
561
546
|
|
|
562
547
|
const Component$2 = forwardRef(({ rootElement = false, ...props }, ref) => {
|
|
563
548
|
const renderedList = React.createElement(component$2, { ...pick(props, component$2.RESERVED_PROPS) });
|
|
@@ -767,18 +752,18 @@ offsetX = 0, offsetY = 0, throttleDelay = 200, }) => {
|
|
|
767
752
|
}
|
|
768
753
|
return false;
|
|
769
754
|
};
|
|
770
|
-
const showContent = () => {
|
|
755
|
+
const showContent = useCallback(() => {
|
|
771
756
|
setVisible(true);
|
|
772
757
|
if (type === 'modal' && document.body) {
|
|
773
758
|
document.body.style.overflow = 'hidden';
|
|
774
759
|
}
|
|
775
|
-
};
|
|
776
|
-
const hideContent = () => {
|
|
760
|
+
}, []);
|
|
761
|
+
const hideContent = useCallback(() => {
|
|
777
762
|
setVisible(false);
|
|
778
763
|
if (type === 'modal' && document.body) {
|
|
779
764
|
document.body.style.overflow = 'auto';
|
|
780
765
|
}
|
|
781
|
-
};
|
|
766
|
+
}, []);
|
|
782
767
|
const calculateContentPosition = () => {
|
|
783
768
|
if (!visible)
|
|
784
769
|
return;
|
|
@@ -936,7 +921,7 @@ offsetX = 0, offsetY = 0, throttleDelay = 200, }) => {
|
|
|
936
921
|
};
|
|
937
922
|
const handleWindow = throttle(calculateContentPosition, throttleDelay);
|
|
938
923
|
const handleMouseMove = throttle(handleDocumentClick, throttleDelay);
|
|
939
|
-
const passHandlers = openOn === 'manual' || closeOn === 'manual';
|
|
924
|
+
const passHandlers = useMemo(() => openOn === 'manual' || closeOn === 'manual', [openOn, closeOn]);
|
|
940
925
|
return (React.createElement(React.Fragment, null,
|
|
941
926
|
renderContent(trigger, {
|
|
942
927
|
[triggerRefName || refName]: triggerRef,
|