dara-ui 0.1.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/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/components/Accordion/Accordion.d.ts +23 -0
- package/dist/components/Accordion/index.d.ts +3 -0
- package/dist/components/AuroraBlobs/AuroraBlobs.d.ts +28 -0
- package/dist/components/AuroraBlobs/index.d.ts +3 -0
- package/dist/components/Avatar/Avatar.d.ts +65 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Badge/Badge.d.ts +38 -0
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/BlogCard/BlogCard.d.ts +97 -0
- package/dist/components/BlogCard/index.d.ts +3 -0
- package/dist/components/Button/Button.d.ts +49 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Card/Card.d.ts +43 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/CharacterCard/CharacterCard.d.ts +86 -0
- package/dist/components/CharacterCard/index.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +59 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.d.ts +90 -0
- package/dist/components/Dropdown/index.d.ts +3 -0
- package/dist/components/GradientRing/GradientRing.d.ts +42 -0
- package/dist/components/GradientRing/index.d.ts +3 -0
- package/dist/components/Icons/Icons.d.ts +192 -0
- package/dist/components/Icons/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +61 -0
- package/dist/components/Input/index.d.ts +3 -0
- package/dist/components/LanguageChanger/LanguageChanger.d.ts +168 -0
- package/dist/components/LanguageChanger/index.d.ts +4 -0
- package/dist/components/Modal/Modal.d.ts +53 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Navbar/Navbar.d.ts +27 -0
- package/dist/components/Navbar/index.d.ts +3 -0
- package/dist/components/NoiseOverlay/NoiseOverlay.d.ts +23 -0
- package/dist/components/NoiseOverlay/index.d.ts +3 -0
- package/dist/components/Particles/Particles.d.ts +43 -0
- package/dist/components/Particles/index.d.ts +3 -0
- package/dist/components/ProductCard/ProductCard.d.ts +104 -0
- package/dist/components/ProductCard/index.d.ts +3 -0
- package/dist/components/Progress/Progress.d.ts +89 -0
- package/dist/components/Progress/index.d.ts +3 -0
- package/dist/components/QuestCard/QuestCard.d.ts +67 -0
- package/dist/components/QuestCard/index.d.ts +3 -0
- package/dist/components/Radio/Radio.d.ts +66 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/Range/Range.d.ts +98 -0
- package/dist/components/Range/index.d.ts +3 -0
- package/dist/components/Sidebar/Sidebar.d.ts +163 -0
- package/dist/components/Sidebar/SidebarMobileTrigger.d.ts +33 -0
- package/dist/components/Sidebar/index.d.ts +5 -0
- package/dist/components/SocialMedia/SocialMedia.d.ts +31 -0
- package/dist/components/SocialMedia/index.d.ts +3 -0
- package/dist/components/StatsWidget/StatsWidget.d.ts +71 -0
- package/dist/components/StatsWidget/index.d.ts +3 -0
- package/dist/components/Switch/Switch.d.ts +62 -0
- package/dist/components/Switch/index.d.ts +3 -0
- package/dist/components/Tabs/Tabs.d.ts +21 -0
- package/dist/components/Tabs/index.d.ts +3 -0
- package/dist/components/ThemeChanger/ThemeChanger.d.ts +98 -0
- package/dist/components/ThemeChanger/index.d.ts +3 -0
- package/dist/components/Toast/Toast.d.ts +54 -0
- package/dist/components/Toast/ToastProvider.d.ts +78 -0
- package/dist/components/Toast/index.d.ts +5 -0
- package/dist/components/Tooltip/Tooltip.d.ts +83 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/XPBar/XPBar.d.ts +71 -0
- package/dist/components/XPBar/index.d.ts +3 -0
- package/dist/dara-ui.cjs.js +973 -0
- package/dist/dara-ui.es.js +9522 -0
- package/dist/hooks/useAppTranslation.d.ts +7 -0
- package/dist/hooks/useDirection.d.ts +7 -0
- package/dist/index.d.ts +66 -0
- package/dist/style.css +2 -0
- package/dist/translations/en.d.ts +732 -0
- package/dist/translations/fa.d.ts +732 -0
- package/dist/translations/fr.d.ts +731 -0
- package/dist/translations/index.d.ts +2200 -0
- package/package.json +92 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SidebarItem {
|
|
3
|
+
/**
|
|
4
|
+
* Unique identifier for the item
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Display label
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Icon element
|
|
13
|
+
*/
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the item is active
|
|
17
|
+
*/
|
|
18
|
+
active?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the item is disabled
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Sub-items for nested navigation
|
|
25
|
+
*/
|
|
26
|
+
subItems?: SidebarItem[];
|
|
27
|
+
/**
|
|
28
|
+
* Optional badge text or number
|
|
29
|
+
*/
|
|
30
|
+
badge?: string | number;
|
|
31
|
+
/**
|
|
32
|
+
* Optional href for link mode
|
|
33
|
+
*/
|
|
34
|
+
href?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Content to render when this item is selected
|
|
37
|
+
*/
|
|
38
|
+
content?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Click handler
|
|
41
|
+
*/
|
|
42
|
+
onClick?: () => void;
|
|
43
|
+
}
|
|
44
|
+
export interface SidebarGroup {
|
|
45
|
+
/**
|
|
46
|
+
* Group label
|
|
47
|
+
*/
|
|
48
|
+
label: string;
|
|
49
|
+
/**
|
|
50
|
+
* Group icon
|
|
51
|
+
*/
|
|
52
|
+
icon?: React.ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Items in this group
|
|
55
|
+
*/
|
|
56
|
+
items: SidebarItem[];
|
|
57
|
+
/**
|
|
58
|
+
* Whether the group is expanded
|
|
59
|
+
*/
|
|
60
|
+
defaultExpanded?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface SidebarProps {
|
|
63
|
+
/**
|
|
64
|
+
* Sidebar brand/logo
|
|
65
|
+
*/
|
|
66
|
+
brand?: React.ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Groups of sidebar items
|
|
69
|
+
*/
|
|
70
|
+
groups: SidebarGroup[];
|
|
71
|
+
/**
|
|
72
|
+
* Whether the sidebar is collapsible (desktop only)
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
collapsible?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Initially collapsed state (desktop only)
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
defaultCollapsed?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Controlled collapsed state (desktop only)
|
|
83
|
+
*/
|
|
84
|
+
collapsed?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Callback when collapse state changes (desktop only)
|
|
87
|
+
*/
|
|
88
|
+
onCollapseChange?: (collapsed: boolean) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Icon-only mode (desktop only)
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
iconOnly?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Whether to show group labels
|
|
96
|
+
* @default true
|
|
97
|
+
*/
|
|
98
|
+
showGroupLabels?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Active item ID (controlled)
|
|
101
|
+
*/
|
|
102
|
+
activeItemId?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Default active item ID (uncontrolled)
|
|
105
|
+
*/
|
|
106
|
+
defaultActiveItemId?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Callback when an item is clicked
|
|
109
|
+
*/
|
|
110
|
+
onItemClick?: (itemId: string) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Width when expanded (desktop only)
|
|
113
|
+
* @default "260px"
|
|
114
|
+
*/
|
|
115
|
+
expandedWidth?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Width when collapsed (desktop only)
|
|
118
|
+
* @default "64px"
|
|
119
|
+
*/
|
|
120
|
+
collapsedWidth?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Additional className
|
|
123
|
+
*/
|
|
124
|
+
className?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Footer content (desktop only)
|
|
127
|
+
*/
|
|
128
|
+
footer?: React.ReactNode;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the sidebar is fixed to the viewport
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
fixed?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Height of the sidebar container (desktop only)
|
|
136
|
+
* @default "100%"
|
|
137
|
+
*/
|
|
138
|
+
height?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Breakpoint (px) below which the sidebar renders as a horizontal
|
|
141
|
+
* scrollable tab strip instead of the vertical column
|
|
142
|
+
* @default 768
|
|
143
|
+
*/
|
|
144
|
+
mobileBreakpoint?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Force mobile layout regardless of viewport
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
149
|
+
forceMobile?: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Dara UI Sidebar - Responsive vertical sidebar with mobile horizontal tabs
|
|
153
|
+
*
|
|
154
|
+
* Features:
|
|
155
|
+
* - Desktop (>= 768px): classic vertical column — collapse/expand, Ctrl+B,
|
|
156
|
+
* group labels, nested sub-menus, icon-only mode, footer
|
|
157
|
+
* - Mobile (< 768px): auto-switches to a horizontal scrollable tab strip
|
|
158
|
+
* with edge-aware scroll arrows (each side hides itself once you've
|
|
159
|
+
* scrolled all the way in that direction) and a second row for sub-items
|
|
160
|
+
* - Full RTL support (items, chevrons, active bar, scroll direction, borders)
|
|
161
|
+
*/
|
|
162
|
+
export declare const Sidebar: React.FC<SidebarProps>;
|
|
163
|
+
export default Sidebar;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SidebarMobileTriggerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Sidebar content (rendered inside the drawer when open)
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Drawer width on mobile
|
|
9
|
+
* @default "85vw"
|
|
10
|
+
*/
|
|
11
|
+
width?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Show a floating action button
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
showFab?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Additional className for the container
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Dara UI SidebarMobileTrigger - Wraps a Sidebar for mobile usage
|
|
24
|
+
*
|
|
25
|
+
* Features:
|
|
26
|
+
* - Floating glass FAB button visible only on mobile
|
|
27
|
+
* - Slide-in drawer from the correct edge (RTL aware)
|
|
28
|
+
* - Backdrop with blur
|
|
29
|
+
* - Swipe-to-close from the drawer's edge
|
|
30
|
+
* - Body scroll lock while open
|
|
31
|
+
*/
|
|
32
|
+
export declare const SidebarMobileTrigger: React.FC<SidebarMobileTriggerProps>;
|
|
33
|
+
export default SidebarMobileTrigger;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Sidebar } from './Sidebar';
|
|
2
|
+
export type { SidebarProps, SidebarItem, SidebarGroup } from './Sidebar';
|
|
3
|
+
export { Sidebar as default } from './Sidebar';
|
|
4
|
+
export { SidebarMobileTrigger } from './SidebarMobileTrigger';
|
|
5
|
+
export type { SidebarMobileTriggerProps } from './SidebarMobileTrigger';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SocialLink {
|
|
3
|
+
platform: string;
|
|
4
|
+
url: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SocialMediaProps {
|
|
10
|
+
links: SocialLink[];
|
|
11
|
+
position?: "left" | "right";
|
|
12
|
+
offset?: number;
|
|
13
|
+
verticalOffset?: string | number;
|
|
14
|
+
size?: "sm" | "md" | "lg";
|
|
15
|
+
showLabels?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Dara UI SocialMedia - Floating social media links with expand/collapse
|
|
20
|
+
*
|
|
21
|
+
* Features:
|
|
22
|
+
* - Expandable side panel with social icons
|
|
23
|
+
* - Self-contained SVG icons (no external dependencies)
|
|
24
|
+
* - Light/dark mode adaptive colors
|
|
25
|
+
* - Click outside to close
|
|
26
|
+
* - Smooth expand/collapse animation
|
|
27
|
+
* - Left or right positioning
|
|
28
|
+
* - RTL aware
|
|
29
|
+
*/
|
|
30
|
+
export declare const SocialMedia: React.FC<SocialMediaProps>;
|
|
31
|
+
export default SocialMedia;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface StatsWidgetData {
|
|
3
|
+
/**
|
|
4
|
+
* Stat label (e.g., "Force Alignment", "Combat")
|
|
5
|
+
*/
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Current value
|
|
9
|
+
*/
|
|
10
|
+
value: number;
|
|
11
|
+
/**
|
|
12
|
+
* Maximum value (for percentage calculation)
|
|
13
|
+
* @default 100
|
|
14
|
+
*/
|
|
15
|
+
max?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Unit display (e.g., "%", "XP", "pts")
|
|
18
|
+
* @default "%"
|
|
19
|
+
*/
|
|
20
|
+
unit?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Trend change (e.g., +12, -5)
|
|
23
|
+
*/
|
|
24
|
+
trend?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Color variant for the progress
|
|
27
|
+
*/
|
|
28
|
+
color?: "primary" | "secondary" | "accent" | "success" | "danger" | "warning" | "gradient";
|
|
29
|
+
}
|
|
30
|
+
export interface StatsWidgetProps {
|
|
31
|
+
/**
|
|
32
|
+
* Stats data array
|
|
33
|
+
*/
|
|
34
|
+
stats: StatsWidgetData[];
|
|
35
|
+
/**
|
|
36
|
+
* Display variant
|
|
37
|
+
* @default "radial"
|
|
38
|
+
*/
|
|
39
|
+
variant?: "radial" | "bar";
|
|
40
|
+
/**
|
|
41
|
+
* Title of the widget
|
|
42
|
+
*/
|
|
43
|
+
title?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Glow variant color
|
|
46
|
+
* @default "none"
|
|
47
|
+
*/
|
|
48
|
+
glow?: "primary" | "secondary" | "accent" | "none";
|
|
49
|
+
/**
|
|
50
|
+
* Layout mode
|
|
51
|
+
* @default "vertical"
|
|
52
|
+
*/
|
|
53
|
+
layout?: "vertical" | "horizontal";
|
|
54
|
+
/**
|
|
55
|
+
* Additional className
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Dara UI StatsWidget - RPG-style stats display
|
|
61
|
+
*
|
|
62
|
+
* Features:
|
|
63
|
+
* - Radial and bar progress variants
|
|
64
|
+
* - Custom labels, units, and colors
|
|
65
|
+
* - Mini trend indicators
|
|
66
|
+
* - 3D tilt effect on hover
|
|
67
|
+
* - Theme-aware colors
|
|
68
|
+
* - Uses Progress component
|
|
69
|
+
*/
|
|
70
|
+
export declare const StatsWidget: React.FC<StatsWidgetProps>;
|
|
71
|
+
export default StatsWidget;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the switch is on
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Default checked state (uncontrolled)
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
defaultChecked?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when checked state changes
|
|
15
|
+
*/
|
|
16
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Label text – always rendered above the switch
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Switch size
|
|
23
|
+
* @default "md"
|
|
24
|
+
*/
|
|
25
|
+
size?: "sm" | "md" | "lg";
|
|
26
|
+
/**
|
|
27
|
+
* Glow effect when checked
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
glow?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Disabled state
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional icon shown inside the thumb when ON
|
|
38
|
+
*/
|
|
39
|
+
onIcon?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Optional icon shown inside the thumb when OFF
|
|
42
|
+
*/
|
|
43
|
+
offIcon?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Additional className for the outer wrapper
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Dara UI Switch – glassmorphism toggle
|
|
51
|
+
*
|
|
52
|
+
* Features:
|
|
53
|
+
* - Glass track + elevated thumb
|
|
54
|
+
* - Thumb overhangs the track when ON
|
|
55
|
+
* - Sparkle burst only when turning on
|
|
56
|
+
* - Optional glow
|
|
57
|
+
* - Optional on/off icons (none by default)
|
|
58
|
+
* - Label always above, inherits document dir
|
|
59
|
+
* - Full RTL mirroring (thumb travels the opposite way)
|
|
60
|
+
*/
|
|
61
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
62
|
+
export default Switch;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TabItem {
|
|
3
|
+
label: string;
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
value?: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TabsProps {
|
|
10
|
+
items: TabItem[];
|
|
11
|
+
activeValue?: string;
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
onChange?: (value: string) => void;
|
|
14
|
+
align?: "left" | "center" | "right";
|
|
15
|
+
size?: "sm" | "md" | "lg";
|
|
16
|
+
glowColor?: "primary" | "secondary" | "accent" | "success" | "danger" | "none";
|
|
17
|
+
fullWidth?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const Tabs: React.FC<TabsProps>;
|
|
21
|
+
export default Tabs;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ThemeOption {
|
|
3
|
+
/**
|
|
4
|
+
* Theme value (used as data-theme attribute)
|
|
5
|
+
*/
|
|
6
|
+
value: string;
|
|
7
|
+
/**
|
|
8
|
+
* Display label
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Optional icon (React node or SVG)
|
|
13
|
+
*/
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export interface ThemeChangerProps {
|
|
17
|
+
/**
|
|
18
|
+
* Controlled value
|
|
19
|
+
*/
|
|
20
|
+
value?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Default value (uncontrolled)
|
|
23
|
+
*/
|
|
24
|
+
defaultValue?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when theme changes
|
|
27
|
+
*/
|
|
28
|
+
onChange?: (theme: string) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Available themes (overrides auto-detect)
|
|
31
|
+
*/
|
|
32
|
+
availableThemes?: ThemeOption[];
|
|
33
|
+
/**
|
|
34
|
+
* Whether to auto-detect themes from CSS
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
autoDetect?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Component size
|
|
40
|
+
* @default "md"
|
|
41
|
+
*/
|
|
42
|
+
size?: "sm" | "md" | "lg";
|
|
43
|
+
/**
|
|
44
|
+
* If true, shows only the icon in a fixed-size circular button
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
iconOnly?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Fixed width for the dropdown trigger (in px or rem)
|
|
50
|
+
* @example "140px" or "10rem"
|
|
51
|
+
*/
|
|
52
|
+
fixedWidth?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Additional className
|
|
55
|
+
*/
|
|
56
|
+
className?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to use the Theme context
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
useContext?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Open the dropdown upward (useful inside mobile drawers / bottom of screen)
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
openUpward?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface ThemeContextValue {
|
|
69
|
+
theme: string;
|
|
70
|
+
setTheme: (theme: string) => void;
|
|
71
|
+
themes: ThemeOption[];
|
|
72
|
+
}
|
|
73
|
+
export interface ThemeProviderProps {
|
|
74
|
+
defaultTheme?: string;
|
|
75
|
+
themes?: ThemeOption[];
|
|
76
|
+
autoDetect?: boolean;
|
|
77
|
+
children: React.ReactNode;
|
|
78
|
+
}
|
|
79
|
+
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
80
|
+
export declare const useTheme: () => ThemeContextValue;
|
|
81
|
+
/**
|
|
82
|
+
* Dara UI ThemeChanger - Dropdown for switching between themes
|
|
83
|
+
*
|
|
84
|
+
* Features:
|
|
85
|
+
* - Auto-detects available themes from CSS
|
|
86
|
+
* - Supports custom theme lists
|
|
87
|
+
* - Clean dropdown with SVG icon support
|
|
88
|
+
* - Icon-only mode for compact navigation bars
|
|
89
|
+
* - Fixed width option for consistent sizing
|
|
90
|
+
* - Controlled or uncontrolled modes
|
|
91
|
+
* - Persists theme preference in localStorage
|
|
92
|
+
* - Size variants (sm, md, lg)
|
|
93
|
+
* - Dropdown is always centered under the trigger
|
|
94
|
+
* - Menu width matches the button when iconOnly or fixedWidth is used
|
|
95
|
+
* - All ThemeChanger instances sync through Theme context
|
|
96
|
+
*/
|
|
97
|
+
export declare const ThemeChanger: React.FC<ThemeChangerProps>;
|
|
98
|
+
export default ThemeChanger;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ToastType = "success" | "error" | "warning" | "info";
|
|
3
|
+
export interface ToastProps {
|
|
4
|
+
/**
|
|
5
|
+
* Toast message
|
|
6
|
+
*/
|
|
7
|
+
message: string;
|
|
8
|
+
/**
|
|
9
|
+
* Toast type
|
|
10
|
+
* @default "info"
|
|
11
|
+
*/
|
|
12
|
+
type?: ToastType;
|
|
13
|
+
/**
|
|
14
|
+
* Duration in ms before auto-dismiss
|
|
15
|
+
* @default 3000
|
|
16
|
+
*/
|
|
17
|
+
duration?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Callback when toast is dismissed
|
|
20
|
+
*/
|
|
21
|
+
onDismiss?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Toast ID for management
|
|
24
|
+
*/
|
|
25
|
+
id?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Individual Toast Component
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Glass-heavy styling with blur(30px) backdrop
|
|
32
|
+
* - Slide-in animation from the right edge
|
|
33
|
+
* - Auto-dismiss after duration
|
|
34
|
+
* - Manual dismiss with close button
|
|
35
|
+
* - Color-coded for different types
|
|
36
|
+
*/
|
|
37
|
+
export declare const Toast: React.FC<ToastProps>;
|
|
38
|
+
export interface ToastContainerProps {
|
|
39
|
+
toasts: (ToastProps & {
|
|
40
|
+
id: string;
|
|
41
|
+
})[];
|
|
42
|
+
onRemove: (id: string) => void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ToastContainer - Renders all active toasts via React Portal
|
|
46
|
+
*
|
|
47
|
+
* Features:
|
|
48
|
+
* - Renders toasts in a fixed position at top-right of the viewport
|
|
49
|
+
* - Uses React Portal to avoid z-index and stacking context issues
|
|
50
|
+
* - Each toast has its own width independent of others
|
|
51
|
+
* - FIFO ordering: newest toasts appear at the top
|
|
52
|
+
*/
|
|
53
|
+
export declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
54
|
+
export default Toast;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ToastType } from './Toast';
|
|
3
|
+
export interface ToastOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Toast message
|
|
6
|
+
*/
|
|
7
|
+
message: string;
|
|
8
|
+
/**
|
|
9
|
+
* Toast type
|
|
10
|
+
* @default "info"
|
|
11
|
+
*/
|
|
12
|
+
type?: ToastType;
|
|
13
|
+
/**
|
|
14
|
+
* Duration in ms before auto-dismiss
|
|
15
|
+
* @default 3000
|
|
16
|
+
*/
|
|
17
|
+
duration?: number;
|
|
18
|
+
}
|
|
19
|
+
interface ToastContextValue {
|
|
20
|
+
/**
|
|
21
|
+
* Show a toast notification
|
|
22
|
+
*/
|
|
23
|
+
showToast: (options: ToastOptions) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Show a success toast
|
|
26
|
+
*/
|
|
27
|
+
success: (message: string, duration?: number) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Show an error toast
|
|
30
|
+
*/
|
|
31
|
+
error: (message: string, duration?: number) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Show a warning toast
|
|
34
|
+
*/
|
|
35
|
+
warning: (message: string, duration?: number) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Show an info toast
|
|
38
|
+
*/
|
|
39
|
+
info: (message: string, duration?: number) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Clear all toasts
|
|
42
|
+
*/
|
|
43
|
+
clearAll: () => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Toast Provider - wraps your app to enable toast functionality
|
|
47
|
+
*
|
|
48
|
+
* Features:
|
|
49
|
+
* - Maximum 5 toasts visible at once (FIFO)
|
|
50
|
+
* - Auto-dismiss after duration
|
|
51
|
+
* - Multiple toast types: success, error, warning, info
|
|
52
|
+
* - Clean API with helper methods
|
|
53
|
+
*/
|
|
54
|
+
export declare const ToastProvider: React.FC<{
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* useToast hook - for showing toast notifications
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* const toast = useToast();
|
|
63
|
+
*
|
|
64
|
+
* // Show a success toast
|
|
65
|
+
* toast.success('Mission complete! +300 XP earned.');
|
|
66
|
+
*
|
|
67
|
+
* // Show an error toast
|
|
68
|
+
* toast.error('Connection lost. Retrying...');
|
|
69
|
+
*
|
|
70
|
+
* // Show a warning toast with custom duration
|
|
71
|
+
* toast.warning('Please check your connection', 5000);
|
|
72
|
+
*
|
|
73
|
+
* // Show an info toast
|
|
74
|
+
* toast.info('Archives are being indexed');
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare const useToast: () => ToastContextValue;
|
|
78
|
+
export default useToast;
|