dara-ui 0.1.0 → 0.3.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.
@@ -0,0 +1,83 @@
1
+ import { default as React } from 'react';
2
+ export type LoaderShape = "spinner" | "ring" | "dots" | "pulse" | "bars";
3
+ export type LoaderColor = "primary" | "secondary" | "accent" | "success" | "danger" | "warning";
4
+ export interface PageLoaderProps {
5
+ /**
6
+ * Whether the loader is visible
7
+ * @default true
8
+ */
9
+ isLoading?: boolean;
10
+ /**
11
+ * Loader shape/variant
12
+ * @default "spinner"
13
+ */
14
+ shape?: LoaderShape;
15
+ /**
16
+ * Semantic color variant
17
+ * @default "primary"
18
+ */
19
+ color?: LoaderColor;
20
+ /**
21
+ * Arbitrary CSS color (overrides `color` when provided)
22
+ * @example "var(--color-primary)" or "#7c5cff"
23
+ */
24
+ customColor?: string;
25
+ /**
26
+ * Loading label text
27
+ */
28
+ label?: string;
29
+ /**
30
+ * Progress value (0-100). Omit for indeterminate.
31
+ */
32
+ progress?: number;
33
+ /**
34
+ * Show progress percentage
35
+ * @default false
36
+ */
37
+ showProgress?: boolean;
38
+ /**
39
+ * Size of the loader
40
+ * @default "md"
41
+ */
42
+ size?: "sm" | "md" | "lg";
43
+ /**
44
+ * Blur the backdrop
45
+ * @default true
46
+ */
47
+ blur?: boolean;
48
+ /**
49
+ * Show the Dara UI brand mark
50
+ * @default false
51
+ */
52
+ showBrand?: boolean;
53
+ /**
54
+ * Minimum display time in ms (prevents flash)
55
+ * @default 0
56
+ */
57
+ minDuration?: number;
58
+ /**
59
+ * Render inline (no fixed positioning, no backdrop)
60
+ * Used for inline previews inside cards
61
+ * @default false
62
+ */
63
+ inline?: boolean;
64
+ /**
65
+ * Additional className
66
+ */
67
+ className?: string;
68
+ }
69
+ /**
70
+ * Dara UI PageLoader - Full-screen loading overlay
71
+ *
72
+ * Features:
73
+ * - Multiple loader shapes (spinner, ring, dots, pulse, bars)
74
+ * - Optional progress bar with percentage
75
+ * - Glass backdrop with blur
76
+ * - Theme-aware colors + custom color support
77
+ * - Minimum display time to prevent flash
78
+ * - Smooth fade in/out
79
+ * - `inline` mode for embedding inside cards / previews
80
+ * - Glows follow the painted shape via drop-shadow (not bounding box)
81
+ */
82
+ export declare const PageLoader: React.FC<PageLoaderProps>;
83
+ export default PageLoader;
@@ -0,0 +1,80 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { LoaderShape } from './PageLoader';
3
+ export interface PageLoaderOptions {
4
+ /**
5
+ * Loading label
6
+ */
7
+ label?: string;
8
+ /**
9
+ * Loader shape
10
+ * @default "spinner"
11
+ */
12
+ shape?: LoaderShape;
13
+ /**
14
+ * Minimum display time in ms
15
+ * @default 400
16
+ */
17
+ minDuration?: number;
18
+ /**
19
+ * Show progress
20
+ */
21
+ showProgress?: boolean;
22
+ /**
23
+ * Show brand mark
24
+ */
25
+ showBrand?: boolean;
26
+ }
27
+ interface PageLoaderContextValue {
28
+ /**
29
+ * Show the page loader
30
+ */
31
+ show: (options?: PageLoaderOptions) => void;
32
+ /**
33
+ * Hide the page loader
34
+ */
35
+ hide: () => void;
36
+ /**
37
+ * Whether the loader is currently visible
38
+ */
39
+ isLoading: boolean;
40
+ /**
41
+ * Update progress (0-100)
42
+ */
43
+ setProgress: (progress: number) => void;
44
+ /**
45
+ * Wrap an async operation with automatic loader
46
+ */
47
+ wrap: <T>(fn: () => Promise<T>, options?: PageLoaderOptions) => Promise<T>;
48
+ }
49
+ /**
50
+ * PageLoaderProvider - App-level page loader with imperative API
51
+ *
52
+ * Features:
53
+ * - show()/hide() imperative API
54
+ * - wrap() to auto-load during async ops
55
+ * - Route-change friendly
56
+ * - Progress support
57
+ */
58
+ export declare const PageLoaderProvider: React.FC<{
59
+ children: ReactNode;
60
+ }>;
61
+ /**
62
+ * usePageLoader - Imperative API for the page loader
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * const loader = usePageLoader();
67
+ *
68
+ * // Manual control
69
+ * loader.show({ label: "Loading...", showBrand: true });
70
+ * loader.hide();
71
+ *
72
+ * // Auto-wrap an async operation
73
+ * await loader.wrap(async () => {
74
+ * const data = await fetch("/api/data");
75
+ * return data.json();
76
+ * }, { label: "Fetching..." });
77
+ * ```
78
+ */
79
+ export declare const usePageLoader: () => PageLoaderContextValue;
80
+ export default usePageLoader;
@@ -0,0 +1,5 @@
1
+ export { PageLoader } from './PageLoader';
2
+ export type { PageLoaderProps, LoaderShape } from './PageLoader';
3
+ export { PageLoaderProvider, usePageLoader } from './PageLoaderProvider';
4
+ export type { PageLoaderOptions } from './PageLoaderProvider';
5
+ export { PageLoader as default } from './PageLoader';
@@ -0,0 +1,59 @@
1
+ import { default as React } from 'react';
2
+ export type ScrollRevealAnimation = "fade" | "fade-up" | "fade-down" | "fade-left" | "fade-right" | "zoom-in" | "zoom-out" | "flip-up" | "flip-down" | "slide-up" | "slide-down";
3
+ export interface ScrollRevealProps {
4
+ /**
5
+ * Content to reveal
6
+ */
7
+ children: React.ReactNode;
8
+ /**
9
+ * Animation type
10
+ * @default "fade-up"
11
+ */
12
+ animation?: ScrollRevealAnimation;
13
+ /**
14
+ * Delay before animation starts (ms)
15
+ * @default 0
16
+ */
17
+ delay?: number;
18
+ /**
19
+ * Duration of the animation (ms)
20
+ * @default 600
21
+ */
22
+ duration?: number;
23
+ /**
24
+ * Distance to travel in pixels (for directional animations)
25
+ * @default 40
26
+ */
27
+ distance?: number;
28
+ /**
29
+ * IntersectionObserver threshold (0-1)
30
+ * @default 0.15
31
+ */
32
+ threshold?: number;
33
+ /**
34
+ * Only animate once (don't re-trigger on scroll back)
35
+ * @default true
36
+ */
37
+ once?: boolean;
38
+ /**
39
+ * Root margin for IntersectionObserver
40
+ * @default "0px 0px -10% 0px"
41
+ */
42
+ rootMargin?: string;
43
+ /**
44
+ * Additional className
45
+ */
46
+ className?: string;
47
+ }
48
+ /**
49
+ * Dara UI ScrollReveal - Animate elements into view on scroll
50
+ *
51
+ * Features:
52
+ * - Multiple animation presets (fade, slide, zoom, flip)
53
+ * - Configurable delay, duration, distance
54
+ * - IntersectionObserver-based (performant)
55
+ * - Respects prefers-reduced-motion
56
+ * - Runs once by default
57
+ */
58
+ export declare const ScrollReveal: React.FC<ScrollRevealProps>;
59
+ export default ScrollReveal;
@@ -0,0 +1,5 @@
1
+ export { ScrollReveal } from './ScrollReveal';
2
+ export type { ScrollRevealProps, ScrollRevealAnimation } from './ScrollReveal';
3
+ export { useScrollReveal } from './useScrollReveal';
4
+ export type { UseScrollRevealOptions } from './useScrollReveal';
5
+ export { ScrollReveal as default } from './ScrollReveal';
@@ -0,0 +1,36 @@
1
+ export interface UseScrollRevealOptions {
2
+ /**
3
+ * IntersectionObserver threshold
4
+ * @default 0.15
5
+ */
6
+ threshold?: number;
7
+ /**
8
+ * Only trigger once
9
+ * @default true
10
+ */
11
+ once?: boolean;
12
+ /**
13
+ * Root margin
14
+ * @default "0px 0px -10% 0px"
15
+ */
16
+ rootMargin?: string;
17
+ }
18
+ /**
19
+ * useScrollReveal - Hook version of ScrollReveal for custom elements
20
+ *
21
+ * Returns a ref to attach and a boolean indicating visibility.
22
+ * Use with any element: cards, inputs, sections, etc.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * const { ref, isVisible } = useScrollReveal();
27
+ * <div ref={ref} style={{ opacity: isVisible ? 1 : 0 }}>
28
+ * Content
29
+ * </div>
30
+ * ```
31
+ */
32
+ export declare function useScrollReveal<T extends HTMLElement = HTMLDivElement>(options?: UseScrollRevealOptions): {
33
+ ref: import('react').RefObject<T | null>;
34
+ isVisible: boolean;
35
+ };
36
+ export default useScrollReveal;