@framingui/ui 0.6.10 → 0.6.11

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 CHANGED
@@ -10,33 +10,54 @@ Use this package when you want FramingUI components directly in an app, whether
10
10
  pnpm add @framingui/ui
11
11
  ```
12
12
 
13
- Import the shared styles when your app uses the FramingUI-native style contract:
13
+ Import the shared styles once at the app root when your app uses the FramingUI-native style contract:
14
14
 
15
- ```tsx
16
- import '@framingui/ui/styles';
15
+ ```css
16
+ /* app/globals.css */
17
+ @import '@framingui/ui/styles';
17
18
  ```
18
19
 
19
- ## Basic Usage
20
+ Then mount `FramingUIProvider` near your root layout. Pass a full theme object when you want FramingUI to inject the CSS variables for you.
20
21
 
21
22
  ```tsx
22
- import '@framingui/ui/styles';
23
- import { Button, Card, CardContent, CardHeader, CardTitle, Input } from '@framingui/ui';
24
-
25
- export function SignupCard() {
23
+ import {
24
+ FramingUIProvider,
25
+ Button,
26
+ Card,
27
+ CardContent,
28
+ CardHeader,
29
+ CardTitle,
30
+ Input,
31
+ } from '@framingui/ui';
32
+ import theme from './neutral-workspace.json';
33
+
34
+ export function App() {
26
35
  return (
27
- <Card>
28
- <CardHeader>
29
- <CardTitle>Create account</CardTitle>
30
- </CardHeader>
31
- <CardContent>
32
- <Input type="email" placeholder="Email" />
33
- <Button>Create account</Button>
34
- </CardContent>
35
- </Card>
36
+ <FramingUIProvider theme={theme}>
37
+ <Card>
38
+ <CardHeader>
39
+ <CardTitle>Create account</CardTitle>
40
+ </CardHeader>
41
+ <CardContent>
42
+ <Input type="email" placeholder="Email" />
43
+ <Button>Create account</Button>
44
+ </CardContent>
45
+ </Card>
46
+ </FramingUIProvider>
36
47
  );
37
48
  }
38
49
  ```
39
50
 
51
+ If your app already loads theme CSS separately, you can use the provider just to keep `data-theme` in sync:
52
+
53
+ ```tsx
54
+ import { FramingUIProvider } from '@framingui/ui';
55
+
56
+ export function App() {
57
+ return <FramingUIProvider themeId="neutral-workspace">{/* app */}</FramingUIProvider>;
58
+ }
59
+ ```
60
+
40
61
  ## What You Get
41
62
 
42
63
  - core components such as `Button`, `Input`, `Card`, `Badge`, `Avatar`, and `Select`
package/dist/index.d.mts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { ClassValue } from 'clsx';
2
2
  import { TokenReference } from '@framingui/tokens';
3
- import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React$1 from 'react';
5
+ import { ReactNode } from 'react';
6
+ import * as class_variance_authority_types from 'class-variance-authority/types';
5
7
  import { VariantProps } from 'class-variance-authority';
6
8
  import { Variants, Transition } from 'framer-motion';
7
9
  import * as LabelPrimitive from '@radix-ui/react-label';
8
- import * as react_jsx_runtime from 'react/jsx-runtime';
9
10
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
10
11
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
11
12
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
@@ -77,23 +78,6 @@ type TektonTokenVars = typeof tokenVars;
77
78
  declare function isTokenReference(value: string): value is TokenReference;
78
79
  declare function extractTokenName(token: TokenReference): string;
79
80
 
80
- declare const headingVariants: (props?: ({
81
- level?: 1 | 2 | 3 | 4 | 5 | 6 | null | undefined;
82
- } & class_variance_authority_types.ClassProp) | undefined) => string;
83
- interface HeadingProps extends React$1.HTMLAttributes<HTMLHeadingElement>, VariantProps<typeof headingVariants> {
84
- level?: 1 | 2 | 3 | 4 | 5 | 6;
85
- }
86
- declare const Heading: React$1.ForwardRefExoticComponent<HeadingProps & React$1.RefAttributes<HTMLHeadingElement>>;
87
-
88
- declare const textVariants: (props?: ({
89
- variant?: "body" | "caption" | "label" | "code" | null | undefined;
90
- size?: "sm" | "default" | "lg" | null | undefined;
91
- } & class_variance_authority_types.ClassProp) | undefined) => string;
92
- interface TextProps extends React$1.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof textVariants> {
93
- as?: 'span' | 'p' | 'div';
94
- }
95
- declare const Text: React$1.ForwardRefExoticComponent<TextProps & React$1.RefAttributes<HTMLElement>>;
96
-
97
81
  interface ThemeDefinition {
98
82
  id: string;
99
83
  name: string;
@@ -164,6 +148,30 @@ declare function injectThemeCSS(theme: ThemeDefinition): void;
164
148
  declare function getCurrentThemeId(): string | null;
165
149
  declare function setThemeId(themeId: string): void;
166
150
 
151
+ interface FramingUIProviderProps {
152
+ children: ReactNode;
153
+ theme?: ThemeDefinition | null;
154
+ themeId?: string;
155
+ }
156
+ declare function FramingUIProvider({ children, theme, themeId }: FramingUIProviderProps): react_jsx_runtime.JSX.Element;
157
+
158
+ declare const headingVariants: (props?: ({
159
+ level?: 1 | 2 | 3 | 4 | 5 | 6 | null | undefined;
160
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
161
+ interface HeadingProps extends React$1.HTMLAttributes<HTMLHeadingElement>, VariantProps<typeof headingVariants> {
162
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
163
+ }
164
+ declare const Heading: React$1.ForwardRefExoticComponent<HeadingProps & React$1.RefAttributes<HTMLHeadingElement>>;
165
+
166
+ declare const textVariants: (props?: ({
167
+ variant?: "body" | "caption" | "code" | "label" | null | undefined;
168
+ size?: "sm" | "default" | "lg" | null | undefined;
169
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
170
+ interface TextProps extends React$1.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof textVariants> {
171
+ as?: 'span' | 'p' | 'div';
172
+ }
173
+ declare const Text: React$1.ForwardRefExoticComponent<TextProps & React$1.RefAttributes<HTMLElement>>;
174
+
167
175
  declare const motionTokens: {
168
176
  readonly duration: {
169
177
  readonly instant: 0;
@@ -596,4 +604,4 @@ declare namespace Calendar {
596
604
  var displayName: string;
597
605
  }
598
606
 
599
- export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Heading, type HeadingProps, Input, type InputProps, Label, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, type OKLCHColor, Popover, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, SidebarHeader, type SidebarHeaderProps, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, type SidebarSectionProps, SidebarSectionTitle, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TektonTokenVars, Text, type TextProps, Textarea, type TextareaProps, type ThemeDefinition, Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, extractTokenName, fadeVariants, getCurrentThemeId, getMotionTransition, headingVariants, injectThemeCSS, isTokenReference, motionTokens, navigationMenuTriggerStyle, oklchToCSS, resolveSemanticToken, scaleVariants, setThemeId, sidebarVariants, slideVariants, textVariants, themeToCSS, tokenVars, transitions, useMotionSafe };
607
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FramingUIProvider, type FramingUIProviderProps, Heading, type HeadingProps, Input, type InputProps, Label, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, type OKLCHColor, Popover, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, SidebarHeader, type SidebarHeaderProps, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, type SidebarSectionProps, SidebarSectionTitle, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TektonTokenVars, Text, type TextProps, Textarea, type TextareaProps, type ThemeDefinition, Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, extractTokenName, fadeVariants, getCurrentThemeId, getMotionTransition, headingVariants, injectThemeCSS, isTokenReference, motionTokens, navigationMenuTriggerStyle, oklchToCSS, resolveSemanticToken, scaleVariants, setThemeId, sidebarVariants, slideVariants, textVariants, themeToCSS, tokenVars, transitions, useMotionSafe };