@vitus-labs/elements 2.0.0-alpha.27 → 2.0.0-alpha.28
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/README.md +6 -2
- package/lib/index.d.ts +25 -12
- package/lib/index.js +336 -260
- package/lib/vitus-labs-elements.native.js +129 -747
- package/package.json +22 -12
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Five composable components for building buttons, cards, lists, dropdowns, toolti
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm install @vitus-labs/elements @vitus-labs/core @vitus-labs/unistyle
|
|
24
|
+
npm install @vitus-labs/elements @vitus-labs/core @vitus-labs/unistyle
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Components
|
|
@@ -271,6 +271,10 @@ Every layout prop (direction, alignX, alignY, gap, block, equalCols) supports th
|
|
|
271
271
|
<Element direction={{ xs: 'rows', md: 'inline', lg: 'inline' }} />
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
+
## React Native
|
|
275
|
+
|
|
276
|
+
Elements includes a native entry point (`index.native.ts`) that excludes Portal and Overlay (which depend on `react-dom`). Element, Text, List, and Util work on React Native when initialized with `@vitus-labs/connector-native`.
|
|
277
|
+
|
|
274
278
|
## Peer Dependencies
|
|
275
279
|
|
|
276
280
|
| Package | Version |
|
|
@@ -279,7 +283,7 @@ Every layout prop (direction, alignX, alignY, gap, block, equalCols) supports th
|
|
|
279
283
|
| react-dom | >= 19 |
|
|
280
284
|
| @vitus-labs/core | * |
|
|
281
285
|
| @vitus-labs/unistyle | * |
|
|
282
|
-
|
|
|
286
|
+
| react-native | >= 0.76 (optional) |
|
|
283
287
|
|
|
284
288
|
## License
|
|
285
289
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Provider } from "@vitus-labs/unistyle";
|
|
2
2
|
import { BreakpointKeys, HTMLTags, HTMLTextTags, config, render } from "@vitus-labs/core";
|
|
3
|
-
import * as react from "react";
|
|
4
|
-
import { ComponentType, FC, ForwardRefExoticComponent, ForwardedRef,
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { ComponentType, FC, ForwardRefExoticComponent, ForwardedRef, ReactElement, ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/types.d.ts
|
|
7
7
|
type ExtractNullableKeys<T> = { [P in keyof T as T[P] extends null | undefined ? never : P]: T[P] };
|
|
@@ -24,8 +24,9 @@ type Direction = ContentDirection | ContentDirection[] | Partial<Record<Breakpoi
|
|
|
24
24
|
type ResponsiveBoolType = ContentBoolean | ContentBoolean[] | Partial<Record<BreakpointKeys, ContentBoolean>>;
|
|
25
25
|
type Responsive = ContentSimpleValue | ContentSimpleValue[] | Partial<Record<BreakpointKeys, number | string>>;
|
|
26
26
|
type ExtendCss = Css | Css[] | Partial<Record<BreakpointKeys, Css>>;
|
|
27
|
-
type
|
|
28
|
-
|
|
27
|
+
type VLComponent<P extends Record<string, any> = {}> = ((props: P & {
|
|
28
|
+
ref?: any;
|
|
29
|
+
}) => ReactElement | null) & VLStatic;
|
|
29
30
|
interface VLStatic {
|
|
30
31
|
/**
|
|
31
32
|
* React displayName
|
|
@@ -291,7 +292,9 @@ type Props = Partial<{
|
|
|
291
292
|
*/
|
|
292
293
|
afterContentCss: ExtendCss;
|
|
293
294
|
}>;
|
|
294
|
-
type VLElement<P extends Record<string, unknown> = {}> =
|
|
295
|
+
type VLElement<P extends Record<string, unknown> = {}> = ((props: Props & P & {
|
|
296
|
+
ref?: any;
|
|
297
|
+
}) => ReactElement | null) & VLStatic;
|
|
295
298
|
//#endregion
|
|
296
299
|
//#region src/Element/component.d.ts
|
|
297
300
|
declare const Component: VLElement;
|
|
@@ -385,10 +388,13 @@ declare const Component$3: FC<Context & {
|
|
|
385
388
|
children: ReactNode;
|
|
386
389
|
}>;
|
|
387
390
|
//#endregion
|
|
388
|
-
//#region src/Overlay/
|
|
391
|
+
//#region src/Overlay/positionMath.d.ts
|
|
389
392
|
type Align$1 = 'bottom' | 'top' | 'left' | 'right';
|
|
390
393
|
type AlignX$2 = 'left' | 'center' | 'right';
|
|
391
394
|
type AlignY$2 = 'bottom' | 'top' | 'center';
|
|
395
|
+
type OverlayType = 'dropdown' | 'tooltip' | 'popover' | 'modal' | 'custom';
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/Overlay/useOverlay.d.ts
|
|
392
398
|
type UseOverlayProps = Partial<{
|
|
393
399
|
/**
|
|
394
400
|
* Defines default state whether **Overlay** component should be active.
|
|
@@ -412,7 +418,7 @@ type UseOverlayProps = Partial<{
|
|
|
412
418
|
* has different positioning calculations than others.
|
|
413
419
|
* @defaultValue `dropdown`
|
|
414
420
|
*/
|
|
415
|
-
type:
|
|
421
|
+
type: OverlayType;
|
|
416
422
|
/**
|
|
417
423
|
* Defines how `content` is treated regarding CSS positioning.
|
|
418
424
|
* @defaultValue `fixed`
|
|
@@ -461,6 +467,12 @@ type UseOverlayProps = Partial<{
|
|
|
461
467
|
* @defaultValue `true`
|
|
462
468
|
*/
|
|
463
469
|
closeOnEsc: boolean;
|
|
470
|
+
/**
|
|
471
|
+
* Delay in milliseconds before hiding content on hover leave. Bridges the
|
|
472
|
+
* gap between trigger and content elements to prevent flicker.
|
|
473
|
+
* @defaultValue `100`
|
|
474
|
+
*/
|
|
475
|
+
hoverDelay: number;
|
|
464
476
|
/**
|
|
465
477
|
* When set to `true`, **Overlay** is automatically closed and is blocked for
|
|
466
478
|
* being opened.
|
|
@@ -491,12 +503,13 @@ declare const useOverlay: ({
|
|
|
491
503
|
throttleDelay,
|
|
492
504
|
parentContainer,
|
|
493
505
|
closeOnEsc,
|
|
506
|
+
hoverDelay,
|
|
494
507
|
disabled,
|
|
495
508
|
onOpen,
|
|
496
509
|
onClose
|
|
497
510
|
}?: Partial<UseOverlayProps>) => {
|
|
498
|
-
triggerRef: react.RefObject<HTMLElement | null>;
|
|
499
|
-
contentRef: (node: HTMLElement) => void;
|
|
511
|
+
triggerRef: _$react.RefObject<HTMLElement | null>;
|
|
512
|
+
contentRef: (node: HTMLElement | null) => void;
|
|
500
513
|
active: boolean;
|
|
501
514
|
align: Align$1;
|
|
502
515
|
alignX: "left" | "right" | "center";
|
|
@@ -506,8 +519,8 @@ declare const useOverlay: ({
|
|
|
506
519
|
blocked: boolean;
|
|
507
520
|
setBlocked: () => void;
|
|
508
521
|
setUnblocked: () => void;
|
|
509
|
-
Provider: react.FC<Context & {
|
|
510
|
-
children: react.ReactNode;
|
|
522
|
+
Provider: _$react.FC<Context & {
|
|
523
|
+
children: _$react.ReactNode;
|
|
511
524
|
}>;
|
|
512
525
|
};
|
|
513
526
|
//#endregion
|
|
@@ -601,7 +614,7 @@ type Props$5 = Partial<{
|
|
|
601
614
|
*/
|
|
602
615
|
css: ExtendCss;
|
|
603
616
|
}>;
|
|
604
|
-
declare const Component$5:
|
|
617
|
+
declare const Component$5: VLComponent<Props$5> & {
|
|
605
618
|
isText?: true;
|
|
606
619
|
};
|
|
607
620
|
//#endregion
|