@raxrai/stylelab-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.
- package/README.md +45 -32
- package/dist/index.cjs +1004 -690
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +83 -9
- package/dist/index.d.ts +83 -9
- package/dist/index.mjs +1033 -723
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -57,6 +57,10 @@ declare const Badge: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElem
|
|
|
57
57
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
58
58
|
dot?: boolean;
|
|
59
59
|
theme?: StyleLabTheme;
|
|
60
|
+
/** Override background (e.g. hex) when you need a specific color. */
|
|
61
|
+
bgOverride?: string;
|
|
62
|
+
/** Override text color (e.g. hex). */
|
|
63
|
+
textOverride?: string;
|
|
60
64
|
} & react.RefAttributes<HTMLSpanElement>>;
|
|
61
65
|
|
|
62
66
|
declare function BentoGrid({ children, className, style, }: {
|
|
@@ -108,6 +112,22 @@ type CalendarProps = {
|
|
|
108
112
|
};
|
|
109
113
|
declare function Calendar({ value: controlledValue, defaultValue, onSelect, min, max, className, theme: themeProp, }: CalendarProps): react.JSX.Element;
|
|
110
114
|
|
|
115
|
+
declare const cardVariants: (props?: ({
|
|
116
|
+
padding?: "none" | "sm" | "md" | null | undefined;
|
|
117
|
+
isHoverable?: boolean | null | undefined;
|
|
118
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
119
|
+
type CardClassNames = {
|
|
120
|
+
root?: string;
|
|
121
|
+
header?: string;
|
|
122
|
+
body?: string;
|
|
123
|
+
footer?: string;
|
|
124
|
+
};
|
|
125
|
+
type CardProps = HTMLAttributes<HTMLDivElement> & VariantProps<typeof cardVariants> & {
|
|
126
|
+
header?: ReactNode;
|
|
127
|
+
footer?: ReactNode;
|
|
128
|
+
theme?: StyleLabTheme;
|
|
129
|
+
classNames?: CardClassNames;
|
|
130
|
+
};
|
|
111
131
|
declare const Card: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
112
132
|
padding?: "none" | "sm" | "md" | null | undefined;
|
|
113
133
|
isHoverable?: boolean | null | undefined;
|
|
@@ -115,6 +135,7 @@ declare const Card: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElemen
|
|
|
115
135
|
header?: ReactNode;
|
|
116
136
|
footer?: ReactNode;
|
|
117
137
|
theme?: StyleLabTheme;
|
|
138
|
+
classNames?: CardClassNames;
|
|
118
139
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
119
140
|
|
|
120
141
|
type DashboardNavItem = {
|
|
@@ -182,8 +203,16 @@ type DropdownItem = {
|
|
|
182
203
|
label: ReactNode;
|
|
183
204
|
disabled?: boolean;
|
|
184
205
|
};
|
|
206
|
+
type DropdownClassNames = {
|
|
207
|
+
trigger?: string;
|
|
208
|
+
popover?: string;
|
|
209
|
+
item?: string;
|
|
210
|
+
};
|
|
185
211
|
type DropdownProps = {
|
|
186
|
-
trigger
|
|
212
|
+
/** Custom trigger node. If omitted, a default button is shown using placeholder or selected label. */
|
|
213
|
+
trigger?: ReactNode;
|
|
214
|
+
/** Placeholder when no value is selected (used with default trigger). */
|
|
215
|
+
placeholder?: string;
|
|
187
216
|
items: DropdownItem[];
|
|
188
217
|
value?: string;
|
|
189
218
|
defaultValue?: string;
|
|
@@ -191,8 +220,10 @@ type DropdownProps = {
|
|
|
191
220
|
className?: string;
|
|
192
221
|
style?: React.CSSProperties;
|
|
193
222
|
theme?: StyleLabTheme;
|
|
223
|
+
/** Slot classNames for trigger, popover, and item. */
|
|
224
|
+
classNames?: DropdownClassNames;
|
|
194
225
|
};
|
|
195
|
-
declare function Dropdown({ trigger, items, value: controlledValue, defaultValue, onValueChange, className, style, theme: themeProp, }: DropdownProps): react.JSX.Element;
|
|
226
|
+
declare function Dropdown({ trigger: triggerProp, placeholder, items, value: controlledValue, defaultValue, onValueChange, className, style, theme: themeProp, classNames, }: DropdownProps): react.JSX.Element;
|
|
196
227
|
|
|
197
228
|
type FlashcardProps = {
|
|
198
229
|
question: string;
|
|
@@ -231,11 +262,23 @@ type ModalProps = VariantProps<typeof modalVariants> & {
|
|
|
231
262
|
};
|
|
232
263
|
declare function Modal({ open, onClose, title, size, className, style, children, theme: themeProp, }: ModalProps): react.JSX.Element | null;
|
|
233
264
|
|
|
234
|
-
|
|
235
|
-
|
|
265
|
+
type NavbarItem = {
|
|
266
|
+
href: string;
|
|
267
|
+
label: ReactNode;
|
|
268
|
+
};
|
|
269
|
+
type NavbarProps = {
|
|
270
|
+
/** Main content when using custom layout (no logo/items). */
|
|
271
|
+
children?: ReactNode;
|
|
272
|
+
/** Logo/brand node (left side). Used when `items` is provided. */
|
|
273
|
+
logo?: ReactNode;
|
|
274
|
+
/** Nav links. When provided, desktop shows horizontal links; mobile shows hamburger that toggles a menu. */
|
|
275
|
+
items?: NavbarItem[];
|
|
276
|
+
/** Optional slot for right side (e.g. theme switcher, user menu). Shown after nav items on desktop, in header row on mobile. */
|
|
277
|
+
right?: ReactNode;
|
|
236
278
|
className?: string;
|
|
237
279
|
style?: React.CSSProperties;
|
|
238
|
-
}
|
|
280
|
+
};
|
|
281
|
+
declare function Navbar({ children, logo, items, right, className, style, }: NavbarProps): react.JSX.Element;
|
|
239
282
|
|
|
240
283
|
type Tier = {
|
|
241
284
|
name: string;
|
|
@@ -252,14 +295,18 @@ declare function PricingCard({ tier, onSelect, className, style, }: {
|
|
|
252
295
|
style?: React.CSSProperties;
|
|
253
296
|
}): react.JSX.Element;
|
|
254
297
|
|
|
255
|
-
type
|
|
298
|
+
type ProgressBarProps = {
|
|
256
299
|
value: number;
|
|
257
300
|
max?: number;
|
|
258
301
|
segmented?: boolean;
|
|
259
302
|
className?: string;
|
|
260
303
|
style?: React.CSSProperties;
|
|
304
|
+
/** Override track background (e.g. hex). */
|
|
305
|
+
trackColor?: string;
|
|
306
|
+
/** Override fill/active bar color (e.g. hex). */
|
|
307
|
+
activeColor?: string;
|
|
261
308
|
};
|
|
262
|
-
declare function ProgressBar({ value, max, segmented, className, style, }:
|
|
309
|
+
declare function ProgressBar({ value, max, segmented, className, style, trackColor, activeColor, }: ProgressBarProps): react.JSX.Element;
|
|
263
310
|
|
|
264
311
|
declare function SectionHeader({ title, subtitle, className, style, }: {
|
|
265
312
|
title: string;
|
|
@@ -368,12 +415,39 @@ type ThemeContextValue = {
|
|
|
368
415
|
theme: StyleLabTheme;
|
|
369
416
|
setTheme: (theme: StyleLabTheme) => void;
|
|
370
417
|
};
|
|
371
|
-
declare function ThemeProvider({ children, defaultTheme, }: {
|
|
418
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, }: {
|
|
372
419
|
children: ReactNode;
|
|
373
420
|
defaultTheme?: StyleLabTheme;
|
|
421
|
+
/** localStorage key for persisting theme. Defaults to "stylelab-theme". */
|
|
422
|
+
storageKey?: string;
|
|
374
423
|
}): react.JSX.Element;
|
|
375
424
|
declare function useTheme(): ThemeContextValue;
|
|
376
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Background and UI color recommendations per theme.
|
|
428
|
+
* Use these as guidelines when laying out pages so components look correct.
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
type ThemeRecommendation = {
|
|
432
|
+
/** Recommended page or main wrapper background (matches gallery). */
|
|
433
|
+
background: string;
|
|
434
|
+
/** Recommended surface for cards, modals, panels. */
|
|
435
|
+
surface: string;
|
|
436
|
+
/** Recommended body/text color (matches gallery). */
|
|
437
|
+
text: string;
|
|
438
|
+
/** Primary accent color for CTAs and highlights. */
|
|
439
|
+
accent: string;
|
|
440
|
+
/** Recommended navbar styling (from theme-resolver navbar default). */
|
|
441
|
+
navbar: string;
|
|
442
|
+
/** Optional short guideline. */
|
|
443
|
+
notes?: string;
|
|
444
|
+
};
|
|
445
|
+
/** Background + text classes used in the gallery for each theme. Use these for page layout. */
|
|
446
|
+
declare const THEME_BACKGROUNDS: Record<StyleLabTheme, string>;
|
|
447
|
+
/** Navbar default class per theme (from theme-resolver). */
|
|
448
|
+
declare const THEME_NAVBAR: Record<StyleLabTheme, string>;
|
|
449
|
+
declare const THEME_RECOMMENDATIONS: Record<StyleLabTheme, ThemeRecommendation>;
|
|
450
|
+
|
|
377
451
|
/**
|
|
378
452
|
* Merges class names with Tailwind-aware deduplication.
|
|
379
453
|
* Use for all component className composition.
|
|
@@ -415,4 +489,4 @@ declare function useKeyboardNavigation(options: {
|
|
|
415
489
|
*/
|
|
416
490
|
declare function getNextListIndex(current: number, direction: "up" | "down", length: number): number;
|
|
417
491
|
|
|
418
|
-
export { Accordion, Alert, Avatar, AvatarGroup, Badge, BentoGrid, Breadcrumbs, Button, Calendar, Card, CommandPalette, type ComponentName, DashboardShell, DataTable, DocumentAccordion, Dropdown, Flashcard, GraphicCard, Input, Modal, Navbar, PricingCard, ProgressBar, SectionHeader, Sidebar, Skeleton, Slider, StatsCard, type StyleLabTheme, THEMES, Tabs, Terminal, ThemeProvider, Timeline, Toast, Toggle, Tooltip, cn, getNextListIndex, getThemeClass, useClickOutside, useFocusTrap, useKeyboardNavigation, useTheme };
|
|
492
|
+
export { Accordion, Alert, Avatar, AvatarGroup, Badge, BentoGrid, Breadcrumbs, Button, Calendar, Card, type CardClassNames, type CardProps, CommandPalette, type ComponentName, DashboardShell, DataTable, DocumentAccordion, Dropdown, type DropdownClassNames, type DropdownItem, type DropdownProps, Flashcard, GraphicCard, Input, Modal, Navbar, type NavbarItem, type NavbarProps, PricingCard, ProgressBar, SectionHeader, Sidebar, Skeleton, Slider, StatsCard, type StyleLabTheme, THEMES, THEME_BACKGROUNDS, THEME_NAVBAR, THEME_RECOMMENDATIONS, Tabs, Terminal, ThemeProvider, type ThemeRecommendation, Timeline, Toast, Toggle, Tooltip, cn, getNextListIndex, getThemeClass, useClickOutside, useFocusTrap, useKeyboardNavigation, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,10 @@ declare const Badge: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElem
|
|
|
57
57
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
58
58
|
dot?: boolean;
|
|
59
59
|
theme?: StyleLabTheme;
|
|
60
|
+
/** Override background (e.g. hex) when you need a specific color. */
|
|
61
|
+
bgOverride?: string;
|
|
62
|
+
/** Override text color (e.g. hex). */
|
|
63
|
+
textOverride?: string;
|
|
60
64
|
} & react.RefAttributes<HTMLSpanElement>>;
|
|
61
65
|
|
|
62
66
|
declare function BentoGrid({ children, className, style, }: {
|
|
@@ -108,6 +112,22 @@ type CalendarProps = {
|
|
|
108
112
|
};
|
|
109
113
|
declare function Calendar({ value: controlledValue, defaultValue, onSelect, min, max, className, theme: themeProp, }: CalendarProps): react.JSX.Element;
|
|
110
114
|
|
|
115
|
+
declare const cardVariants: (props?: ({
|
|
116
|
+
padding?: "none" | "sm" | "md" | null | undefined;
|
|
117
|
+
isHoverable?: boolean | null | undefined;
|
|
118
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
119
|
+
type CardClassNames = {
|
|
120
|
+
root?: string;
|
|
121
|
+
header?: string;
|
|
122
|
+
body?: string;
|
|
123
|
+
footer?: string;
|
|
124
|
+
};
|
|
125
|
+
type CardProps = HTMLAttributes<HTMLDivElement> & VariantProps<typeof cardVariants> & {
|
|
126
|
+
header?: ReactNode;
|
|
127
|
+
footer?: ReactNode;
|
|
128
|
+
theme?: StyleLabTheme;
|
|
129
|
+
classNames?: CardClassNames;
|
|
130
|
+
};
|
|
111
131
|
declare const Card: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
112
132
|
padding?: "none" | "sm" | "md" | null | undefined;
|
|
113
133
|
isHoverable?: boolean | null | undefined;
|
|
@@ -115,6 +135,7 @@ declare const Card: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElemen
|
|
|
115
135
|
header?: ReactNode;
|
|
116
136
|
footer?: ReactNode;
|
|
117
137
|
theme?: StyleLabTheme;
|
|
138
|
+
classNames?: CardClassNames;
|
|
118
139
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
119
140
|
|
|
120
141
|
type DashboardNavItem = {
|
|
@@ -182,8 +203,16 @@ type DropdownItem = {
|
|
|
182
203
|
label: ReactNode;
|
|
183
204
|
disabled?: boolean;
|
|
184
205
|
};
|
|
206
|
+
type DropdownClassNames = {
|
|
207
|
+
trigger?: string;
|
|
208
|
+
popover?: string;
|
|
209
|
+
item?: string;
|
|
210
|
+
};
|
|
185
211
|
type DropdownProps = {
|
|
186
|
-
trigger
|
|
212
|
+
/** Custom trigger node. If omitted, a default button is shown using placeholder or selected label. */
|
|
213
|
+
trigger?: ReactNode;
|
|
214
|
+
/** Placeholder when no value is selected (used with default trigger). */
|
|
215
|
+
placeholder?: string;
|
|
187
216
|
items: DropdownItem[];
|
|
188
217
|
value?: string;
|
|
189
218
|
defaultValue?: string;
|
|
@@ -191,8 +220,10 @@ type DropdownProps = {
|
|
|
191
220
|
className?: string;
|
|
192
221
|
style?: React.CSSProperties;
|
|
193
222
|
theme?: StyleLabTheme;
|
|
223
|
+
/** Slot classNames for trigger, popover, and item. */
|
|
224
|
+
classNames?: DropdownClassNames;
|
|
194
225
|
};
|
|
195
|
-
declare function Dropdown({ trigger, items, value: controlledValue, defaultValue, onValueChange, className, style, theme: themeProp, }: DropdownProps): react.JSX.Element;
|
|
226
|
+
declare function Dropdown({ trigger: triggerProp, placeholder, items, value: controlledValue, defaultValue, onValueChange, className, style, theme: themeProp, classNames, }: DropdownProps): react.JSX.Element;
|
|
196
227
|
|
|
197
228
|
type FlashcardProps = {
|
|
198
229
|
question: string;
|
|
@@ -231,11 +262,23 @@ type ModalProps = VariantProps<typeof modalVariants> & {
|
|
|
231
262
|
};
|
|
232
263
|
declare function Modal({ open, onClose, title, size, className, style, children, theme: themeProp, }: ModalProps): react.JSX.Element | null;
|
|
233
264
|
|
|
234
|
-
|
|
235
|
-
|
|
265
|
+
type NavbarItem = {
|
|
266
|
+
href: string;
|
|
267
|
+
label: ReactNode;
|
|
268
|
+
};
|
|
269
|
+
type NavbarProps = {
|
|
270
|
+
/** Main content when using custom layout (no logo/items). */
|
|
271
|
+
children?: ReactNode;
|
|
272
|
+
/** Logo/brand node (left side). Used when `items` is provided. */
|
|
273
|
+
logo?: ReactNode;
|
|
274
|
+
/** Nav links. When provided, desktop shows horizontal links; mobile shows hamburger that toggles a menu. */
|
|
275
|
+
items?: NavbarItem[];
|
|
276
|
+
/** Optional slot for right side (e.g. theme switcher, user menu). Shown after nav items on desktop, in header row on mobile. */
|
|
277
|
+
right?: ReactNode;
|
|
236
278
|
className?: string;
|
|
237
279
|
style?: React.CSSProperties;
|
|
238
|
-
}
|
|
280
|
+
};
|
|
281
|
+
declare function Navbar({ children, logo, items, right, className, style, }: NavbarProps): react.JSX.Element;
|
|
239
282
|
|
|
240
283
|
type Tier = {
|
|
241
284
|
name: string;
|
|
@@ -252,14 +295,18 @@ declare function PricingCard({ tier, onSelect, className, style, }: {
|
|
|
252
295
|
style?: React.CSSProperties;
|
|
253
296
|
}): react.JSX.Element;
|
|
254
297
|
|
|
255
|
-
type
|
|
298
|
+
type ProgressBarProps = {
|
|
256
299
|
value: number;
|
|
257
300
|
max?: number;
|
|
258
301
|
segmented?: boolean;
|
|
259
302
|
className?: string;
|
|
260
303
|
style?: React.CSSProperties;
|
|
304
|
+
/** Override track background (e.g. hex). */
|
|
305
|
+
trackColor?: string;
|
|
306
|
+
/** Override fill/active bar color (e.g. hex). */
|
|
307
|
+
activeColor?: string;
|
|
261
308
|
};
|
|
262
|
-
declare function ProgressBar({ value, max, segmented, className, style, }:
|
|
309
|
+
declare function ProgressBar({ value, max, segmented, className, style, trackColor, activeColor, }: ProgressBarProps): react.JSX.Element;
|
|
263
310
|
|
|
264
311
|
declare function SectionHeader({ title, subtitle, className, style, }: {
|
|
265
312
|
title: string;
|
|
@@ -368,12 +415,39 @@ type ThemeContextValue = {
|
|
|
368
415
|
theme: StyleLabTheme;
|
|
369
416
|
setTheme: (theme: StyleLabTheme) => void;
|
|
370
417
|
};
|
|
371
|
-
declare function ThemeProvider({ children, defaultTheme, }: {
|
|
418
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, }: {
|
|
372
419
|
children: ReactNode;
|
|
373
420
|
defaultTheme?: StyleLabTheme;
|
|
421
|
+
/** localStorage key for persisting theme. Defaults to "stylelab-theme". */
|
|
422
|
+
storageKey?: string;
|
|
374
423
|
}): react.JSX.Element;
|
|
375
424
|
declare function useTheme(): ThemeContextValue;
|
|
376
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Background and UI color recommendations per theme.
|
|
428
|
+
* Use these as guidelines when laying out pages so components look correct.
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
type ThemeRecommendation = {
|
|
432
|
+
/** Recommended page or main wrapper background (matches gallery). */
|
|
433
|
+
background: string;
|
|
434
|
+
/** Recommended surface for cards, modals, panels. */
|
|
435
|
+
surface: string;
|
|
436
|
+
/** Recommended body/text color (matches gallery). */
|
|
437
|
+
text: string;
|
|
438
|
+
/** Primary accent color for CTAs and highlights. */
|
|
439
|
+
accent: string;
|
|
440
|
+
/** Recommended navbar styling (from theme-resolver navbar default). */
|
|
441
|
+
navbar: string;
|
|
442
|
+
/** Optional short guideline. */
|
|
443
|
+
notes?: string;
|
|
444
|
+
};
|
|
445
|
+
/** Background + text classes used in the gallery for each theme. Use these for page layout. */
|
|
446
|
+
declare const THEME_BACKGROUNDS: Record<StyleLabTheme, string>;
|
|
447
|
+
/** Navbar default class per theme (from theme-resolver). */
|
|
448
|
+
declare const THEME_NAVBAR: Record<StyleLabTheme, string>;
|
|
449
|
+
declare const THEME_RECOMMENDATIONS: Record<StyleLabTheme, ThemeRecommendation>;
|
|
450
|
+
|
|
377
451
|
/**
|
|
378
452
|
* Merges class names with Tailwind-aware deduplication.
|
|
379
453
|
* Use for all component className composition.
|
|
@@ -415,4 +489,4 @@ declare function useKeyboardNavigation(options: {
|
|
|
415
489
|
*/
|
|
416
490
|
declare function getNextListIndex(current: number, direction: "up" | "down", length: number): number;
|
|
417
491
|
|
|
418
|
-
export { Accordion, Alert, Avatar, AvatarGroup, Badge, BentoGrid, Breadcrumbs, Button, Calendar, Card, CommandPalette, type ComponentName, DashboardShell, DataTable, DocumentAccordion, Dropdown, Flashcard, GraphicCard, Input, Modal, Navbar, PricingCard, ProgressBar, SectionHeader, Sidebar, Skeleton, Slider, StatsCard, type StyleLabTheme, THEMES, Tabs, Terminal, ThemeProvider, Timeline, Toast, Toggle, Tooltip, cn, getNextListIndex, getThemeClass, useClickOutside, useFocusTrap, useKeyboardNavigation, useTheme };
|
|
492
|
+
export { Accordion, Alert, Avatar, AvatarGroup, Badge, BentoGrid, Breadcrumbs, Button, Calendar, Card, type CardClassNames, type CardProps, CommandPalette, type ComponentName, DashboardShell, DataTable, DocumentAccordion, Dropdown, type DropdownClassNames, type DropdownItem, type DropdownProps, Flashcard, GraphicCard, Input, Modal, Navbar, type NavbarItem, type NavbarProps, PricingCard, ProgressBar, SectionHeader, Sidebar, Skeleton, Slider, StatsCard, type StyleLabTheme, THEMES, THEME_BACKGROUNDS, THEME_NAVBAR, THEME_RECOMMENDATIONS, Tabs, Terminal, ThemeProvider, type ThemeRecommendation, Timeline, Toast, Toggle, Tooltip, cn, getNextListIndex, getThemeClass, useClickOutside, useFocusTrap, useKeyboardNavigation, useTheme };
|