@vitus-labs/elements 0.37.0 → 0.40.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 +27 -20
- package/lib/types/Util/component.d.ts +2 -2
- package/lib/types/helpers/Iterator/types.d.ts +1 -1
- package/lib/types/index.d.ts +4 -3
- package/lib/vitus-labs-elements.browser.js +82 -63
- package/lib/vitus-labs-elements.browser.js.map +1 -1
- package/lib/vitus-labs-elements.js +87 -67
- package/lib/vitus-labs-elements.js.map +1 -1
- package/lib/vitus-labs-elements.module.js +80 -61
- package/lib/vitus-labs-elements.module.js.map +1 -1
- package/lib/vitus-labs-elements.native.js +80 -61
- package/lib/vitus-labs-elements.native.js.map +1 -1
- package/lib/vitus-labs-elements.umd.js +90 -71
- package/lib/vitus-labs-elements.umd.js.map +1 -1
- package/lib/vitus-labs-elements.umd.min.js +6 -6
- package/lib/vitus-labs-elements.umd.min.js.map +1 -1
- package/package.json +8 -5
package/lib/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ declare type VLStatic = {
|
|
|
50
50
|
VITUS_LABS__COMPONENT?: `@vitus-labs/${string}`;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
declare type Props$
|
|
53
|
+
declare type Props$8 = Partial<{
|
|
54
54
|
tag: HTMLTags;
|
|
55
55
|
innerRef: InnerRef;
|
|
56
56
|
children: Content;
|
|
@@ -82,20 +82,20 @@ declare type Props$7 = Partial<{
|
|
|
82
82
|
declare type VLElement<P extends Record<string, unknown> = {}> = {
|
|
83
83
|
<T extends HTMLTags>(props: {
|
|
84
84
|
tag?: T;
|
|
85
|
-
} & Props$
|
|
85
|
+
} & Props$8 & P & {
|
|
86
86
|
ref?: ForwardedRef<any>;
|
|
87
87
|
}): ReactElement | null;
|
|
88
88
|
} & VLStatic;
|
|
89
89
|
|
|
90
|
-
declare const component$
|
|
90
|
+
declare const component$7: VLElement;
|
|
91
91
|
|
|
92
|
-
declare type Props$
|
|
92
|
+
declare type Props$7 = Partial<{
|
|
93
93
|
equalBeforeAfter: boolean;
|
|
94
94
|
vertical?: boolean;
|
|
95
95
|
afterContent?: React__default.ReactNode;
|
|
96
96
|
beforeContent?: React__default.ReactNode;
|
|
97
97
|
}>;
|
|
98
|
-
declare const withEqualBeforeAfter: SimpleHoc<Props$
|
|
98
|
+
declare const withEqualBeforeAfter: SimpleHoc<Props$7>;
|
|
99
99
|
|
|
100
100
|
declare type MaybeNull = undefined | null;
|
|
101
101
|
declare type TObj = Record<string, unknown>;
|
|
@@ -116,8 +116,8 @@ declare type DataArrayObject = Partial<{
|
|
|
116
116
|
component: ElementType;
|
|
117
117
|
}> & Record<string, unknown>;
|
|
118
118
|
declare type PropsCallback = TObj | ((itemProps: Record<string, never> | Record<string, SimpleValue> | DataArrayObject, extendedProps: ExtendedProps) => TObj);
|
|
119
|
-
declare type Props$
|
|
120
|
-
children: ReactNode
|
|
119
|
+
declare type Props$6 = Partial<{
|
|
120
|
+
children: ReactNode;
|
|
121
121
|
data: Array<SimpleValue | DataArrayObject | MaybeNull>;
|
|
122
122
|
component: ElementType;
|
|
123
123
|
valueName: string;
|
|
@@ -127,24 +127,24 @@ declare type Props$5 = Partial<{
|
|
|
127
127
|
itemKey?: keyof DataArrayObject | ((item: SimpleValue | Omit<DataArrayObject, 'component'>, index: number) => SimpleValue);
|
|
128
128
|
}>;
|
|
129
129
|
|
|
130
|
-
declare type Props$
|
|
131
|
-
Props$
|
|
130
|
+
declare type Props$5 = MergeTypes<[
|
|
131
|
+
Props$6,
|
|
132
132
|
{
|
|
133
133
|
rootElement?: boolean;
|
|
134
134
|
label: never;
|
|
135
135
|
content: never;
|
|
136
136
|
}
|
|
137
137
|
]>;
|
|
138
|
-
declare const component$
|
|
138
|
+
declare const component$6: VLElement<Props$5>;
|
|
139
139
|
|
|
140
140
|
declare type Key = string | number;
|
|
141
|
-
declare type Props$
|
|
141
|
+
declare type Props$4 = {
|
|
142
142
|
type?: 'single' | 'multi';
|
|
143
143
|
activeItemRequired?: boolean;
|
|
144
144
|
activeItems?: Key | Array<string | number>;
|
|
145
145
|
itemProps?: Record<string, unknown> | ((props: Record<string, unknown>) => Record<string, unknown>);
|
|
146
146
|
};
|
|
147
|
-
declare const component$
|
|
147
|
+
declare const component$5: SimpleHoc<Props$4>;
|
|
148
148
|
|
|
149
149
|
declare type Align$1 = 'bottom' | 'top' | 'left' | 'bottom' | 'right';
|
|
150
150
|
declare type AlignX$1 = 'left' | 'center' | 'right';
|
|
@@ -197,38 +197,45 @@ declare type ContentRenderer = (props: Partial<{
|
|
|
197
197
|
alignX: AlignX;
|
|
198
198
|
alignY: AlignY;
|
|
199
199
|
}>) => Content;
|
|
200
|
-
declare type Props$
|
|
200
|
+
declare type Props$3 = {
|
|
201
201
|
children: Content | TriggerRenderer;
|
|
202
202
|
trigger: Content | ContentRenderer;
|
|
203
203
|
DOMLocation?: HTMLElement;
|
|
204
204
|
triggerRefName?: string;
|
|
205
205
|
contentRefName?: string;
|
|
206
206
|
} & UseOverlayProps;
|
|
207
|
-
declare const component$
|
|
207
|
+
declare const component$4: VLComponent<Props$3>;
|
|
208
208
|
|
|
209
209
|
declare type Context = {
|
|
210
210
|
blocked: boolean;
|
|
211
211
|
setBlocked: () => void;
|
|
212
212
|
setUnblocked: () => void;
|
|
213
213
|
};
|
|
214
|
-
declare const component$
|
|
214
|
+
declare const component$3: FC<Context>;
|
|
215
215
|
|
|
216
|
-
declare type Props$
|
|
216
|
+
declare type Props$2 = {
|
|
217
217
|
position?: HTMLElement;
|
|
218
218
|
children: ReactNode;
|
|
219
219
|
tag?: string;
|
|
220
220
|
};
|
|
221
|
-
declare const component$
|
|
221
|
+
declare const component$2: VLComponent<Props$2>;
|
|
222
222
|
|
|
223
|
-
declare type Props = Partial<{
|
|
223
|
+
declare type Props$1 = Partial<{
|
|
224
224
|
paragraph: boolean;
|
|
225
225
|
label: ReactNode;
|
|
226
226
|
children: ReactNode;
|
|
227
227
|
tag: HTMLTagsText;
|
|
228
228
|
extendCss: ExtendCss;
|
|
229
229
|
}>;
|
|
230
|
-
declare const component: VLForwardedComponent<Props> & {
|
|
230
|
+
declare const component$1: VLForwardedComponent<Props$1> & {
|
|
231
231
|
isText?: true;
|
|
232
232
|
};
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
declare type Props = {
|
|
235
|
+
children: ReactNode;
|
|
236
|
+
className?: string | string[];
|
|
237
|
+
style?: Record<string, unknown>;
|
|
238
|
+
};
|
|
239
|
+
declare const component: VLComponent<Props>;
|
|
240
|
+
|
|
241
|
+
export { component$7 as Element, Props$8 as ElementProps, component$6 as List, Props$5 as ListProps, component$4 as Overlay, Props$3 as OverlayProps, component$3 as OverlayProvider, component$2 as Portal, Props$2 as PortalProps, component$1 as Text, Props$1 as TextProps, UseOverlayProps, component as Util, Props as UtilProps, _default as useOverlay, component$5 as withActiveState, withEqualBeforeAfter as withEqualSizeBeforeAfter };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import type { VLComponent } from "../types";
|
|
3
3
|
export declare type Props = {
|
|
4
|
-
children:
|
|
4
|
+
children: ReactNode;
|
|
5
5
|
className?: string | string[];
|
|
6
6
|
style?: Record<string, unknown>;
|
|
7
7
|
};
|
|
@@ -20,7 +20,7 @@ export declare type DataArrayObject = Partial<{
|
|
|
20
20
|
}> & Record<string, unknown>;
|
|
21
21
|
export declare type PropsCallback = TObj | ((itemProps: Record<string, never> | Record<string, SimpleValue> | DataArrayObject, extendedProps: ExtendedProps) => TObj);
|
|
22
22
|
export declare type Props = Partial<{
|
|
23
|
-
children: ReactNode
|
|
23
|
+
children: ReactNode;
|
|
24
24
|
data: Array<SimpleValue | DataArrayObject | MaybeNull>;
|
|
25
25
|
component: ElementType;
|
|
26
26
|
valueName: string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Provider } from '@vitus-labs/unistyle';
|
|
2
|
-
import Element, { Props as ElementProps,
|
|
2
|
+
import Element, { Props as ElementProps, withEqualSizeBeforeAfter } from "./Element";
|
|
3
3
|
import List, { Props as ListProps, withActiveState } from "./List";
|
|
4
4
|
import Overlay, { Props as OverlayProps, useOverlay, OverlayProvider, UseOverlayProps } from "./Overlay";
|
|
5
5
|
import Portal, { Props as PortalProps } from "./Portal";
|
|
6
6
|
import Text, { Props as TextProps } from "./Text";
|
|
7
|
-
|
|
8
|
-
export {
|
|
7
|
+
import Util, { Props as UtilProps } from "./Util";
|
|
8
|
+
export type { ElementProps, ListProps, OverlayProps, UseOverlayProps, PortalProps, TextProps, UtilProps, };
|
|
9
|
+
export { Element, withEqualSizeBeforeAfter, withActiveState, List, Overlay, useOverlay, OverlayProvider, Portal, Text, Util, Provider, };
|
|
@@ -2,6 +2,7 @@ import { makeItResponsive, alignContent, extendCss, value } from '@vitus-labs/un
|
|
|
2
2
|
export { Provider } from '@vitus-labs/unistyle';
|
|
3
3
|
import React, { forwardRef, memo, useMemo, createRef, useCallback, Children, useState, useEffect, createContext, useContext, useRef } from 'react';
|
|
4
4
|
import { config, renderContent, get, isEmpty, pick, omit, context as context$1, throttle } from '@vitus-labs/core';
|
|
5
|
+
import { isFragment } from 'react-is';
|
|
5
6
|
import { createPortal } from 'react-dom';
|
|
6
7
|
|
|
7
8
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -72,7 +73,7 @@ var Styled$2 = config.styled(config.component) `
|
|
|
72
73
|
})};
|
|
73
74
|
`;
|
|
74
75
|
|
|
75
|
-
const component$
|
|
76
|
+
const component$b = forwardRef(({ children, tag, block, extendCss, direction, alignX, alignY, equalCols, isInline, ...props }, ref) => {
|
|
76
77
|
const debugProps = process.env.NODE_ENV !== 'production'
|
|
77
78
|
? {
|
|
78
79
|
'data-vl-element': 'Element',
|
|
@@ -180,7 +181,7 @@ var Styled$1 = config.styled(config.component) `
|
|
|
180
181
|
})};
|
|
181
182
|
`;
|
|
182
183
|
|
|
183
|
-
const component$
|
|
184
|
+
const component$9 = ({ contentType, tag, parentDirection, direction, alignX, alignY, equalCols, gap, extendCss, ...props }) => {
|
|
184
185
|
const debugProps = process.env.NODE_ENV !== 'production'
|
|
185
186
|
? {
|
|
186
187
|
'data-vl-element': contentType,
|
|
@@ -196,7 +197,7 @@ const component$8 = ({ contentType, tag, parentDirection, direction, alignX, ali
|
|
|
196
197
|
extraStyles: extendCss,
|
|
197
198
|
}, ...debugProps, ...props }));
|
|
198
199
|
};
|
|
199
|
-
var component$
|
|
200
|
+
var component$a = memo(component$9);
|
|
200
201
|
|
|
201
202
|
const INLINE_ELEMENTS = {
|
|
202
203
|
span: true,
|
|
@@ -256,7 +257,7 @@ const defaultDirection = 'inline';
|
|
|
256
257
|
const defaultContentDirection = 'rows';
|
|
257
258
|
const defaultAlignX = 'left';
|
|
258
259
|
const defaultAlignY = 'center';
|
|
259
|
-
const component$
|
|
260
|
+
const component$8 = 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) => {
|
|
260
261
|
// --------------------------------------------------------
|
|
261
262
|
// check if should render only single element
|
|
262
263
|
// --------------------------------------------------------
|
|
@@ -317,18 +318,18 @@ const component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
|
|
|
317
318
|
// return simple/empty element like input or image etc.
|
|
318
319
|
// --------------------------------------------------------
|
|
319
320
|
if (shouldBeEmpty) {
|
|
320
|
-
return React.createElement(component$
|
|
321
|
+
return React.createElement(component$b, { ...props, ...WRAPPER_PROPS });
|
|
321
322
|
}
|
|
322
323
|
const contentRenderOutput = renderContent(CHILDREN);
|
|
323
|
-
return (React.createElement(component$
|
|
324
|
-
beforeContent && (React.createElement(component$
|
|
325
|
-
isSimpleElement ? (contentRenderOutput) : (React.createElement(component$
|
|
326
|
-
afterContent && (React.createElement(component$
|
|
324
|
+
return (React.createElement(component$b, { ...props, ...WRAPPER_PROPS, isInline: isInline },
|
|
325
|
+
beforeContent && (React.createElement(component$a, { tag: SUB_TAG, contentType: "before", parentDirection: wrapperDirection, extendCss: beforeContentCss, direction: beforeContentDirection, alignX: beforeContentAlignX, alignY: beforeContentAlignY, equalCols: equalCols, gap: gap }, renderContent(beforeContent))),
|
|
326
|
+
isSimpleElement ? (contentRenderOutput) : (React.createElement(component$a, { tag: SUB_TAG, contentType: "content", parentDirection: wrapperDirection, extendCss: contentCss, direction: contentDirection, alignX: contentAlignX, alignY: contentAlignY, equalCols: equalCols }, contentRenderOutput)),
|
|
327
|
+
afterContent && (React.createElement(component$a, { tag: SUB_TAG, contentType: "after", parentDirection: wrapperDirection, extendCss: afterContentCss, direction: afterContentDirection, alignX: afterContentAlignX, alignY: afterContentAlignY, equalCols: equalCols, gap: gap }, renderContent(afterContent)))));
|
|
327
328
|
});
|
|
328
|
-
const name$
|
|
329
|
-
component$
|
|
330
|
-
component$
|
|
331
|
-
component$
|
|
329
|
+
const name$5 = `${PKG_NAME}/Element`;
|
|
330
|
+
component$8.displayName = name$5;
|
|
331
|
+
component$8.pkgName = PKG_NAME;
|
|
332
|
+
component$8.VITUS_LABS__COMPONENT = name$5;
|
|
332
333
|
|
|
333
334
|
/* eslint-disable no-param-reassign */
|
|
334
335
|
const isNumber = (a, b) => Number.isInteger(a) && Number.isInteger(b);
|
|
@@ -393,7 +394,7 @@ const attachItemProps = ({ i, length, }) => {
|
|
|
393
394
|
position,
|
|
394
395
|
};
|
|
395
396
|
};
|
|
396
|
-
const component$
|
|
397
|
+
const component$7 = (props) => {
|
|
397
398
|
const { itemKey, valueName, children, component, data, wrapComponent: Wrapper, wrapProps, itemProps, } = props;
|
|
398
399
|
const renderedElement = renderContent;
|
|
399
400
|
const injectItemProps = useMemo(() => (typeof itemProps === 'function' ? itemProps : () => itemProps), [itemProps]);
|
|
@@ -403,34 +404,46 @@ const component$6 = (props) => {
|
|
|
403
404
|
return itemKey(item, index);
|
|
404
405
|
return index;
|
|
405
406
|
}, []);
|
|
407
|
+
const renderChild = (child, total = 1, i = 0) => {
|
|
408
|
+
const extendedProps = attachItemProps({
|
|
409
|
+
i,
|
|
410
|
+
length: total,
|
|
411
|
+
});
|
|
412
|
+
const finalItemProps = itemProps ? injectItemProps({}, extendedProps) : {};
|
|
413
|
+
const finalWrapProps = wrapProps
|
|
414
|
+
? injectWrapItemProps({}, extendedProps)
|
|
415
|
+
: {};
|
|
416
|
+
// if no props extension is required, just return children
|
|
417
|
+
if (!itemProps && !Wrapper)
|
|
418
|
+
return child;
|
|
419
|
+
if (Wrapper) {
|
|
420
|
+
return (React.createElement(Wrapper, { key: i, ...finalWrapProps }, renderedElement(child, finalItemProps)));
|
|
421
|
+
}
|
|
422
|
+
return renderContent(child, {
|
|
423
|
+
key: i,
|
|
424
|
+
...finalItemProps,
|
|
425
|
+
});
|
|
426
|
+
};
|
|
406
427
|
// --------------------------------------------------------
|
|
407
428
|
// render children
|
|
408
429
|
// --------------------------------------------------------
|
|
409
430
|
const renderChildren = () => {
|
|
410
431
|
if (!children)
|
|
411
432
|
return null;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
const finalItemProps = itemProps ? injectItemProps({}, extendedProps) : {};
|
|
423
|
-
const finalWrapProps = wrapProps
|
|
424
|
-
? injectWrapItemProps({}, extendedProps)
|
|
425
|
-
: {};
|
|
426
|
-
if (Wrapper) {
|
|
427
|
-
return (React.createElement(Wrapper, { key: key, ...finalWrapProps }, renderedElement(item, finalItemProps)));
|
|
428
|
-
}
|
|
429
|
-
return renderContent(item, {
|
|
430
|
-
key: i,
|
|
431
|
-
...finalItemProps,
|
|
433
|
+
// if children is Array
|
|
434
|
+
if (Array.isArray(children)) {
|
|
435
|
+
return Children.map(children, (item, i) => renderChild(item, children.length, i));
|
|
436
|
+
}
|
|
437
|
+
// if children is Fragment
|
|
438
|
+
if (isFragment(children)) {
|
|
439
|
+
const fragmentChildren = children.props.children;
|
|
440
|
+
return fragmentChildren.map((item, i) => {
|
|
441
|
+
console.log(item);
|
|
442
|
+
return renderChild(item, fragmentChildren.length, i);
|
|
432
443
|
});
|
|
433
|
-
}
|
|
444
|
+
}
|
|
445
|
+
// if single child
|
|
446
|
+
return renderChild(children);
|
|
434
447
|
};
|
|
435
448
|
// --------------------------------------------------------
|
|
436
449
|
// render array of strings or numbers
|
|
@@ -531,19 +544,19 @@ const component$6 = (props) => {
|
|
|
531
544
|
};
|
|
532
545
|
return renderItems();
|
|
533
546
|
};
|
|
534
|
-
component$
|
|
535
|
-
component$
|
|
547
|
+
component$7.isIterator = true;
|
|
548
|
+
component$7.RESERVED_PROPS = RESERVED_PROPS;
|
|
536
549
|
|
|
537
|
-
const component$
|
|
538
|
-
const renderedList = React.createElement(component$
|
|
550
|
+
const component$6 = forwardRef(({ rootElement = false, ...props }, ref) => {
|
|
551
|
+
const renderedList = React.createElement(component$7, { ...pick(props, component$7.RESERVED_PROPS) });
|
|
539
552
|
if (!rootElement)
|
|
540
553
|
return renderedList;
|
|
541
|
-
return (React.createElement(component$
|
|
554
|
+
return (React.createElement(component$8, { ref: ref, ...omit(props, component$7.RESERVED_PROPS) }, renderedList));
|
|
542
555
|
});
|
|
543
|
-
const name$
|
|
544
|
-
component$
|
|
545
|
-
component$
|
|
546
|
-
component$
|
|
556
|
+
const name$4 = `${PKG_NAME}/List`;
|
|
557
|
+
component$6.displayName = name$4;
|
|
558
|
+
component$6.pkgName = PKG_NAME;
|
|
559
|
+
component$6.VITUS_LABS__COMPONENT = name$4;
|
|
547
560
|
|
|
548
561
|
const RESERVED_KEYS = [
|
|
549
562
|
'type',
|
|
@@ -551,7 +564,7 @@ const RESERVED_KEYS = [
|
|
|
551
564
|
'itemProps',
|
|
552
565
|
'activeItemRequired',
|
|
553
566
|
];
|
|
554
|
-
const component$
|
|
567
|
+
const component$5 = (WrappedComponent) => {
|
|
555
568
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
556
569
|
const Enhanced = (props) => {
|
|
557
570
|
const { type = 'single', activeItemRequired, activeItems, itemProps = {}, ...rest } = props;
|
|
@@ -674,7 +687,7 @@ const component$4 = (WrappedComponent) => {
|
|
|
674
687
|
return Enhanced;
|
|
675
688
|
};
|
|
676
689
|
|
|
677
|
-
const component$
|
|
690
|
+
const component$4 = ({ position = document.body , tag = 'div', children, }) => {
|
|
678
691
|
const [element] = useState(document.createElement(tag) );
|
|
679
692
|
if (!position || !element)
|
|
680
693
|
return null;
|
|
@@ -686,15 +699,15 @@ const component$3 = ({ position = document.body , tag = 'div', children, }) => {
|
|
|
686
699
|
}, []);
|
|
687
700
|
return createPortal(children, element);
|
|
688
701
|
};
|
|
689
|
-
const name$
|
|
690
|
-
component$
|
|
691
|
-
component$
|
|
692
|
-
component$
|
|
702
|
+
const name$3 = `${PKG_NAME}/Portal`;
|
|
703
|
+
component$4.displayName = name$3;
|
|
704
|
+
component$4.pkgName = PKG_NAME;
|
|
705
|
+
component$4.VITUS_LABS__COMPONENT = name$3;
|
|
693
706
|
|
|
694
707
|
const context = createContext({});
|
|
695
708
|
const { Provider } = context;
|
|
696
709
|
const useOverlayContext = () => useContext(context);
|
|
697
|
-
const component$
|
|
710
|
+
const component$3 = ({ children, blocked, setBlocked, setUnblocked, }) => (React.createElement(Provider, { value: { blocked, setBlocked, setUnblocked } }, children));
|
|
698
711
|
|
|
699
712
|
/* eslint-disable no-console */
|
|
700
713
|
var useOverlay = ({ isOpen = false, openOn = 'click', // click | hover
|
|
@@ -1024,7 +1037,7 @@ offsetX = 0, offsetY = 0, throttleDelay = 200, customScrollListener, closeOnEsc
|
|
|
1024
1037
|
};
|
|
1025
1038
|
};
|
|
1026
1039
|
|
|
1027
|
-
const component$
|
|
1040
|
+
const component$2 = ({ children, trigger, DOMLocation, triggerRefName = 'ref', contentRefName = 'ref', ...props }) => {
|
|
1028
1041
|
const { active, triggerRef, contentRef, showContent, hideContent, align, alignX, alignY, ...ctx } = useOverlay(props);
|
|
1029
1042
|
const { openOn, closeOn } = props;
|
|
1030
1043
|
const passHandlers = useMemo(() => openOn === 'manual' ||
|
|
@@ -1036,8 +1049,8 @@ const component$1 = ({ children, trigger, DOMLocation, triggerRefName = 'ref', c
|
|
|
1036
1049
|
active,
|
|
1037
1050
|
...(passHandlers ? { showContent, hideContent } : {}),
|
|
1038
1051
|
}),
|
|
1039
|
-
active && (React.createElement(component$
|
|
1040
|
-
React.createElement(component$
|
|
1052
|
+
active && (React.createElement(component$4, { position: DOMLocation },
|
|
1053
|
+
React.createElement(component$3, { ...ctx }, renderContent(children, {
|
|
1041
1054
|
[contentRefName]: contentRef,
|
|
1042
1055
|
active,
|
|
1043
1056
|
align,
|
|
@@ -1046,10 +1059,10 @@ const component$1 = ({ children, trigger, DOMLocation, triggerRefName = 'ref', c
|
|
|
1046
1059
|
...(passHandlers ? { showContent, hideContent } : {}),
|
|
1047
1060
|
}))))));
|
|
1048
1061
|
};
|
|
1049
|
-
const name$
|
|
1050
|
-
component$
|
|
1051
|
-
component$
|
|
1052
|
-
component$
|
|
1062
|
+
const name$2 = `${PKG_NAME}/Overlay`;
|
|
1063
|
+
component$2.displayName = name$2;
|
|
1064
|
+
component$2.pkgName = PKG_NAME;
|
|
1065
|
+
component$2.VITUS_LABS__COMPONENT = name$2;
|
|
1053
1066
|
|
|
1054
1067
|
const styles = ({ css, theme: t }) => css `
|
|
1055
1068
|
${t.extraStyles && extendCss(t.extraStyles)};
|
|
@@ -1067,17 +1080,23 @@ var Styled = config.styled(config.textComponent) `
|
|
|
1067
1080
|
})};
|
|
1068
1081
|
`;
|
|
1069
1082
|
|
|
1070
|
-
const component = forwardRef(({ paragraph, label, children, tag, extendCss, ...props }, ref) => {
|
|
1083
|
+
const component$1 = forwardRef(({ paragraph, label, children, tag, extendCss, ...props }, ref) => {
|
|
1071
1084
|
const renderContent = (as = undefined) => (React.createElement(Styled, { ref: ref, as: as, "$text": { extraStyles: extendCss }, ...props }, children || label));
|
|
1072
1085
|
// eslint-disable-next-line no-nested-ternary
|
|
1073
1086
|
const finalTag = (paragraph ? 'p' : tag) ;
|
|
1074
1087
|
return renderContent(finalTag);
|
|
1075
1088
|
});
|
|
1076
|
-
const name = `${PKG_NAME}/Text`;
|
|
1089
|
+
const name$1 = `${PKG_NAME}/Text`;
|
|
1090
|
+
component$1.displayName = name$1;
|
|
1091
|
+
component$1.pkgName = PKG_NAME;
|
|
1092
|
+
component$1.VITUS_LABS__COMPONENT = name$1;
|
|
1093
|
+
component$1.isText = true;
|
|
1094
|
+
|
|
1095
|
+
const component = ({ children, className = '', style = { color: 'blue' }, }) => renderContent(children, { className, style });
|
|
1096
|
+
const name = `${PKG_NAME}/Util`;
|
|
1077
1097
|
component.displayName = name;
|
|
1078
1098
|
component.pkgName = PKG_NAME;
|
|
1079
|
-
component.VITUS_LABS__COMPONENT = name;
|
|
1080
|
-
component.isText = true;
|
|
1099
|
+
component.VITUS_LABS__COMPONENT = name;
|
|
1081
1100
|
|
|
1082
|
-
export { component$
|
|
1101
|
+
export { component$8 as Element, component$6 as List, component$2 as Overlay, component$3 as OverlayProvider, component$4 as Portal, component$1 as Text, component as Util, useOverlay, component$5 as withActiveState, withEqualBeforeAfter as withEqualSizeBeforeAfter };
|
|
1083
1102
|
//# sourceMappingURL=vitus-labs-elements.browser.js.map
|