@tomny-dev/uzi 0.1.4 → 0.1.6

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/dist/index.d.ts CHANGED
@@ -1,22 +1,34 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ButtonHTMLAttributes, AnchorHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
2
+ import * as React from 'react';
3
+ import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, AnchorHTMLAttributes } from 'react';
4
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
5
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
6
 
4
- type ButtonVariant = "primary" | "secondary" | "outline" | "ghost";
5
- type ButtonSize = "sm" | "md" | "lg";
7
+ type ButtonVariant = "default" | "primary" | "secondary" | "outline" | "ghost" | "destructive" | "link";
8
+ type ButtonSize = "default" | "sm" | "md" | "lg" | "icon";
6
9
  type BaseProps = {
7
10
  variant?: ButtonVariant;
8
11
  size?: ButtonSize;
9
12
  className?: string;
10
13
  children?: React.ReactNode;
14
+ asChild?: boolean;
11
15
  };
12
- type AsButton = BaseProps & ButtonHTMLAttributes<HTMLButtonElement> & {
16
+ type AsButton = BaseProps & React.ButtonHTMLAttributes<HTMLButtonElement> & {
13
17
  as?: "button";
14
18
  };
15
- type AsAnchor = BaseProps & AnchorHTMLAttributes<HTMLAnchorElement> & {
19
+ type AsAnchor = BaseProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
16
20
  as: "a";
17
21
  };
18
22
  type ButtonProps = AsButton | AsAnchor;
19
- declare function Button({ as, variant, size, className, children, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
23
+ declare function Button({ as, variant, size, className, children, asChild, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
24
+
25
+ type AvatarSize = "sm" | "md" | "lg";
26
+ type AvatarProps = React.ComponentProps<typeof AvatarPrimitive.Root> & {
27
+ size?: AvatarSize;
28
+ };
29
+ declare function Avatar({ className, size, ...props }: AvatarProps): react_jsx_runtime.JSX.Element;
30
+ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>): react_jsx_runtime.JSX.Element;
31
+ declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>): react_jsx_runtime.JSX.Element;
20
32
 
21
33
  type CardTone = "default" | "muted" | "contrast";
22
34
  type CardPadding = "none" | "sm" | "md" | "lg";
@@ -48,19 +60,33 @@ type PillProps = HTMLAttributes<HTMLElement> & {
48
60
  };
49
61
  declare function Pill({ as, tone, size, icon, className, children, ...rest }: PillProps): react_jsx_runtime.JSX.Element;
50
62
 
51
- type ModalSize = "sm" | "md" | "lg";
63
+ type ModalOverlayProps = {
64
+ open: boolean;
65
+ onClose: () => void;
66
+ /** Extra class applied to the backdrop */
67
+ className?: string;
68
+ children: ReactNode;
69
+ };
70
+ declare function ModalOverlay({ open, onClose, className, children }: ModalOverlayProps): react_jsx_runtime.JSX.Element | null;
71
+ type ModalSize = "sm" | "md" | "lg" | "xl";
52
72
  type ModalProps = {
53
73
  open: boolean;
54
74
  onClose: () => void;
55
75
  title: string;
56
76
  subtitle?: string;
57
77
  size?: ModalSize;
58
- /** Content between the header and footer */
59
78
  children: ReactNode;
60
- /** Rendered inside the footer row — typically action buttons */
61
79
  footer?: ReactNode;
62
80
  };
63
- declare function Modal({ open, onClose, title, subtitle, size, children, footer }: ModalProps): react_jsx_runtime.JSX.Element | null;
81
+ declare function Modal({ open, onClose, title, subtitle, size, children, footer }: ModalProps): react_jsx_runtime.JSX.Element;
82
+
83
+ type AlertTone = "success" | "error" | "warning" | "info";
84
+ type AlertProps = {
85
+ tone: AlertTone;
86
+ children: ReactNode;
87
+ className?: string;
88
+ };
89
+ declare function Alert({ tone, children, className }: AlertProps): react_jsx_runtime.JSX.Element;
64
90
 
65
91
  /** Visual intent for a toast. Drives colors and icons. */
66
92
  type ToastType = "success" | "error" | "warning" | "info";
@@ -133,6 +159,15 @@ declare function ToastProvider({ children, config, }: {
133
159
  */
134
160
  declare function useToast(): ToastContextValue;
135
161
 
162
+ type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
163
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
164
+
165
+ type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement>;
166
+ declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
167
+
168
+ type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement>;
169
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
170
+
136
171
  interface DropdownOption {
137
172
  label: string;
138
173
  value: string;
@@ -157,6 +192,53 @@ interface DropdownProps {
157
192
  }
158
193
  declare function Dropdown({ options, value, onChange, placeholder, className, allowClear, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, }: DropdownProps): react_jsx_runtime.JSX.Element;
159
194
 
195
+ declare function DropdownMenu(props: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): react_jsx_runtime.JSX.Element;
196
+ declare function DropdownMenuTrigger(props: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
197
+ declare function DropdownMenuGroup(props: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): react_jsx_runtime.JSX.Element;
198
+ declare function DropdownMenuPortal(props: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): react_jsx_runtime.JSX.Element;
199
+ declare function DropdownMenuSub(props: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): react_jsx_runtime.JSX.Element;
200
+ declare function DropdownMenuRadioGroup(props: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): react_jsx_runtime.JSX.Element;
201
+ declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): react_jsx_runtime.JSX.Element;
202
+ declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
203
+ inset?: boolean;
204
+ variant?: "default" | "destructive";
205
+ }): react_jsx_runtime.JSX.Element;
206
+ declare function DropdownMenuCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): react_jsx_runtime.JSX.Element;
207
+ declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): react_jsx_runtime.JSX.Element;
208
+ declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
209
+ inset?: boolean;
210
+ }): react_jsx_runtime.JSX.Element;
211
+ declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): react_jsx_runtime.JSX.Element;
212
+ declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
213
+ inset?: boolean;
214
+ }): react_jsx_runtime.JSX.Element;
215
+ declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): react_jsx_runtime.JSX.Element;
216
+
217
+ type ThemeToggleButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
218
+ showLabel?: boolean;
219
+ lightLabel?: string;
220
+ darkLabel?: string;
221
+ };
222
+ declare function ThemeToggleButton({ showLabel, lightLabel, darkLabel, className, onClick, ...rest }: ThemeToggleButtonProps): react_jsx_runtime.JSX.Element;
223
+
224
+ type TopBarProps = HTMLAttributes<HTMLElement> & {
225
+ leading?: ReactNode;
226
+ brand?: ReactNode;
227
+ brandHref?: string;
228
+ brandingLocation?: "left" | "center";
229
+ /** Content rendered after the brand in the left region (e.g. breadcrumbs, search). */
230
+ start?: ReactNode;
231
+ /** Content rendered in the center region. */
232
+ center?: ReactNode;
233
+ actions?: ReactNode;
234
+ showThemeToggle?: boolean;
235
+ themeToggleProps?: ThemeToggleButtonProps;
236
+ innerClassName?: string;
237
+ isSticky?: boolean;
238
+ sticky?: boolean;
239
+ };
240
+ declare function TopBar({ leading, brand, brandHref, brandingLocation, start, center, actions, showThemeToggle, themeToggleProps, className, innerClassName, isSticky, sticky, children, ...rest }: TopBarProps): react_jsx_runtime.JSX.Element;
241
+
160
242
  type AppShellProps = {
161
243
  /** Primary page content rendered in the main area. */
162
244
  children: ReactNode;
@@ -170,6 +252,10 @@ type AppShellProps = {
170
252
  topbarStart?: ReactNode;
171
253
  /** Optional content aligned to the right side of the top bar. */
172
254
  topbarEnd?: ReactNode;
255
+ /** Optional built-in theme toggle for the top bar. */
256
+ showThemeToggle?: boolean;
257
+ themeToggleProps?: TopBarProps["themeToggleProps"];
258
+ topBarBrandingLocation?: TopBarProps["brandingLocation"];
173
259
  /** Custom class names for styling overrides. */
174
260
  className?: string;
175
261
  sidebarClassName?: string;
@@ -195,34 +281,72 @@ type AppShellProps = {
195
281
  * - Provides optional hook to close the sidebar when a prop value changes
196
282
  * (e.g., route transitions).
197
283
  */
198
- declare function AppShell({ children, sidebar, brand, brandHref, topbarStart, topbarEnd, className, sidebarClassName, topbarClassName, mainClassName, sidebarWidth, closeSidebarOnChangeKey, hamburgerLabel, onSidebarToggle, }: AppShellProps): react_jsx_runtime.JSX.Element;
284
+ declare function AppShell({ children, sidebar, brand, brandHref, topbarStart, topbarEnd, showThemeToggle, themeToggleProps, topBarBrandingLocation, className, sidebarClassName, topbarClassName, mainClassName, sidebarWidth, closeSidebarOnChangeKey, hamburgerLabel, onSidebarToggle, }: AppShellProps): react_jsx_runtime.JSX.Element;
199
285
 
200
286
  type SidebarNavItem = {
201
287
  label: string;
202
- href: string;
288
+ href?: string;
203
289
  icon?: ReactNode;
290
+ description?: ReactNode;
204
291
  badge?: ReactNode;
205
292
  active?: boolean;
293
+ disabled?: boolean;
294
+ title?: string;
206
295
  target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
207
296
  rel?: AnchorHTMLAttributes<HTMLAnchorElement>["rel"];
208
297
  onClick?: () => void;
209
298
  };
210
- type SidebarNavProps = {
299
+ type SidebarNavSection = {
300
+ id?: string;
301
+ label?: ReactNode;
211
302
  items: SidebarNavItem[];
212
- /** Optional path-like value used for default active matching. */
303
+ };
304
+ type SidebarNavProps = {
305
+ items?: SidebarNavItem[];
306
+ sections?: SidebarNavSection[];
213
307
  currentPath?: string;
214
- /**
215
- * Custom active matcher. Defaults to prefix matching (with a special case for `/`).
216
- * If `item.active` is provided, it wins over this function.
217
- */
218
308
  getIsActive?: (item: SidebarNavItem, currentPath?: string) => boolean;
219
- /** Called after the item click handler (if provided). */
220
309
  onItemClick?: (item: SidebarNavItem) => void;
310
+ header?: ReactNode;
311
+ footer?: ReactNode;
312
+ ariaLabel?: string;
313
+ collapsed?: boolean;
314
+ iconSize?: number | string;
221
315
  className?: string;
222
316
  itemClassName?: string;
317
+ sectionClassName?: string;
318
+ };
319
+ declare function SidebarNav({ items, sections, currentPath, getIsActive, onItemClick, header, footer, ariaLabel, collapsed, iconSize, className, itemClassName, sectionClassName, }: SidebarNavProps): react_jsx_runtime.JSX.Element;
320
+
321
+ declare const UZI_THEMES: readonly ["light", "dark", "system"];
322
+ declare const UZI_ACCENTS: readonly ["blue", "cyan", "violet", "emerald", "amber", "rose"];
323
+
324
+ type UziTheme = typeof UZI_THEMES[number];
325
+ type UziResolvedTheme = "light" | "dark";
326
+ type UziAccent = typeof UZI_ACCENTS[number];
327
+ type ThemeContextValue = {
328
+ theme: UziTheme;
329
+ resolvedTheme: UziResolvedTheme;
330
+ accent: UziAccent;
331
+ setTheme: (theme: UziTheme) => void;
332
+ setAccent: (accent: UziAccent) => void;
333
+ toggleTheme: () => void;
334
+ };
335
+ type ThemeProviderProps = {
336
+ children: ReactNode;
337
+ theme?: UziTheme;
338
+ defaultTheme?: UziTheme;
339
+ accent?: UziAccent;
340
+ defaultAccent?: UziAccent;
341
+ onThemeChange?: (theme: UziTheme) => void;
342
+ onAccentChange?: (accent: UziAccent) => void;
343
+ storageKey?: string;
344
+ accentStorageKey?: string;
345
+ disableStorage?: boolean;
223
346
  };
224
- declare function SidebarNav({ items, currentPath, getIsActive, onItemClick, className, itemClassName, }: SidebarNavProps): react_jsx_runtime.JSX.Element;
347
+ declare function ThemeProvider({ children, theme, defaultTheme, accent, defaultAccent, onThemeChange, onAccentChange, storageKey, accentStorageKey, disableStorage, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
348
+ declare function useTheme(): ThemeContextValue;
225
349
 
226
350
  declare function cx(...values: Array<string | false | null | undefined>): string;
227
351
 
228
- export { AppShell, type AppShellProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardPadding, type CardProps, type CardTone, Dropdown, type DropdownOption, type DropdownProps, Modal, type ModalProps, type ModalSize, Pill, type PillProps, type PillSize, type PillTone, SidebarNav, type SidebarNavItem, type SidebarNavProps, type Toast, type ToastConfig, type ToastContextValue, type ToastOptions, type ToastPosition, ToastProvider, type ToastType, cx, useToast };
352
+ export { Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Avatar, AvatarFallback, AvatarImage, type AvatarProps, type AvatarSize, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardPadding, type CardProps, type CardTone, Checkbox, type CheckboxProps, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownOption, type DropdownProps, Input, type InputProps, Label, type LabelProps, Modal, ModalOverlay, type ModalOverlayProps, type ModalProps, type ModalSize, Pill, type PillProps, type PillSize, type PillTone, SidebarNav, type SidebarNavItem, type SidebarNavProps, type SidebarNavSection, ThemeProvider, ThemeToggleButton, type ThemeToggleButtonProps, type Toast, type ToastConfig, type ToastContextValue, type ToastOptions, type ToastPosition, ToastProvider, type ToastType, TopBar, type TopBarProps, type UziAccent, type UziResolvedTheme, type UziTheme, cx, useTheme, useToast };