@minutemailer/kit 0.2.0 → 1.0.1
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/components/ui/alert.d.ts +9 -0
- package/components/ui/alert.js +24 -0
- package/components/ui/avatar.d.ts +6 -0
- package/components/ui/avatar.js +13 -0
- package/components/ui/button.d.ts +10 -0
- package/components/ui/button.js +31 -0
- package/components/ui/checkbox.d.ts +4 -0
- package/components/ui/checkbox.js +9 -0
- package/components/ui/dropdown-menu.d.ts +25 -0
- package/components/ui/dropdown-menu.js +50 -0
- package/components/ui/input.d.ts +3 -0
- package/components/ui/input.js +6 -0
- package/components/ui/label.d.ts +4 -0
- package/components/ui/label.js +8 -0
- package/components/ui/separator.d.ts +4 -0
- package/components/ui/separator.js +7 -0
- package/components/ui/sheet.d.ts +13 -0
- package/components/ui/sheet.js +40 -0
- package/components/ui/sidebar.d.ts +69 -0
- package/components/ui/sidebar.js +222 -0
- package/components/ui/skeleton.d.ts +2 -0
- package/components/ui/skeleton.js +6 -0
- package/components/ui/sonner.d.ts +3 -0
- package/components/ui/sonner.js +12 -0
- package/components/ui/tooltip.d.ts +7 -0
- package/components/ui/tooltip.js +16 -0
- package/hooks/use-mobile.d.ts +1 -0
- package/hooks/use-mobile.js +15 -0
- package/icons/Alert.d.ts +1 -1
- package/icons/AlertFilled.d.ts +1 -1
- package/icons/Arrow.d.ts +1 -1
- package/icons/ArrowDown.d.ts +1 -1
- package/icons/Attachment.d.ts +1 -1
- package/icons/Automate.d.ts +1 -1
- package/icons/Bold.d.ts +1 -1
- package/icons/BorderBottom.d.ts +1 -1
- package/icons/BorderLeft.d.ts +1 -1
- package/icons/BorderRight.d.ts +1 -1
- package/icons/BorderTop.d.ts +1 -1
- package/icons/BottomAlign.d.ts +1 -1
- package/icons/BottomLeftCorner.d.ts +1 -1
- package/icons/BottomRightCorner.d.ts +1 -1
- package/icons/Button.d.ts +1 -1
- package/icons/Calendar.d.ts +1 -1
- package/icons/Center.d.ts +1 -1
- package/icons/Check.d.ts +1 -1
- package/icons/CheckFilled.d.ts +1 -1
- package/icons/Checkmark.d.ts +1 -1
- package/icons/Chevron.d.ts +1 -1
- package/icons/ChevronDown.d.ts +1 -1
- package/icons/ChevronLeft.d.ts +1 -1
- package/icons/ChevronUp.d.ts +1 -1
- package/icons/Close.d.ts +1 -1
- package/icons/CloseBold.d.ts +1 -1
- package/icons/CloseCircle.d.ts +1 -1
- package/icons/Column1.d.ts +1 -1
- package/icons/Column12.d.ts +1 -1
- package/icons/Column13.d.ts +1 -1
- package/icons/Column2.d.ts +1 -1
- package/icons/Column21.d.ts +1 -1
- package/icons/Column3.d.ts +1 -1
- package/icons/Column31.d.ts +1 -1
- package/icons/Column4.d.ts +1 -1
- package/icons/Contacts.d.ts +1 -1
- package/icons/Crop.d.ts +1 -1
- package/icons/Divider.d.ts +1 -1
- package/icons/Download.d.ts +1 -1
- package/icons/Duplicate.d.ts +1 -1
- package/icons/Email.d.ts +1 -1
- package/icons/Feedback.d.ts +1 -1
- package/icons/File.d.ts +1 -1
- package/icons/Filter.d.ts +1 -1
- package/icons/Flip.d.ts +1 -1
- package/icons/Flop.d.ts +1 -1
- package/icons/Form.d.ts +1 -1
- package/icons/Gift.d.ts +1 -1
- package/icons/HeartRound.d.ts +1 -1
- package/icons/Home.d.ts +1 -1
- package/icons/HorisontalCenter.d.ts +1 -1
- package/icons/Image.d.ts +1 -1
- package/icons/Images.d.ts +1 -1
- package/icons/Info.d.ts +1 -1
- package/icons/Integrations.d.ts +1 -1
- package/icons/Italics.d.ts +1 -1
- package/icons/Justified.d.ts +1 -1
- package/icons/Left.d.ts +1 -1
- package/icons/LeftAlign.d.ts +1 -1
- package/icons/LetterSpacing.d.ts +1 -1
- package/icons/LineHeight.d.ts +1 -1
- package/icons/LineThickness.d.ts +1 -1
- package/icons/Link.d.ts +1 -1
- package/icons/List.d.ts +1 -1
- package/icons/ListMenu.d.ts +1 -1
- package/icons/ListNumbered.d.ts +1 -1
- package/icons/Location.d.ts +1 -1
- package/icons/LockChain.d.ts +1 -1
- package/icons/Locked.d.ts +1 -1
- package/icons/Logo.d.ts +1 -1
- package/icons/Logout.d.ts +1 -1
- package/icons/Lowercase.d.ts +1 -1
- package/icons/Magic.d.ts +1 -1
- package/icons/MarginBottom.d.ts +1 -1
- package/icons/MarginLeft.d.ts +1 -1
- package/icons/MarginRight.d.ts +1 -1
- package/icons/MarginTop.d.ts +1 -1
- package/icons/Menu.d.ts +1 -1
- package/icons/Minus.d.ts +1 -1
- package/icons/MinusBold.d.ts +1 -1
- package/icons/More.d.ts +1 -1
- package/icons/Move.d.ts +1 -1
- package/icons/MoveDirections.d.ts +1 -1
- package/icons/MoveVertical.d.ts +1 -1
- package/icons/Openclose.d.ts +1 -1
- package/icons/Pen.d.ts +1 -1
- package/icons/Phone.d.ts +1 -1
- package/icons/Plane.d.ts +1 -1
- package/icons/PlaneOutline.d.ts +1 -1
- package/icons/Plus.d.ts +1 -1
- package/icons/PlusBold.d.ts +1 -1
- package/icons/PlusCircle.d.ts +1 -1
- package/icons/Result.d.ts +1 -1
- package/icons/Right.d.ts +1 -1
- package/icons/RightAlign.d.ts +1 -1
- package/icons/Rotate.d.ts +1 -1
- package/icons/Search.d.ts +1 -1
- package/icons/Settings.d.ts +1 -1
- package/icons/Sms.d.ts +1 -1
- package/icons/Spacing.d.ts +1 -1
- package/icons/Spinner.d.ts +1 -1
- package/icons/StarFilled.d.ts +1 -1
- package/icons/StarOutline.d.ts +1 -1
- package/icons/Stars.d.ts +1 -1
- package/icons/Stats.d.ts +1 -1
- package/icons/Stop.d.ts +1 -1
- package/icons/Strikethrough.d.ts +1 -1
- package/icons/Support.d.ts +1 -1
- package/icons/Tags.d.ts +1 -1
- package/icons/Team.d.ts +1 -1
- package/icons/Text.d.ts +1 -1
- package/icons/Thumbsdown.d.ts +1 -1
- package/icons/Thumbsup.d.ts +1 -1
- package/icons/TopAlign.d.ts +1 -1
- package/icons/TopLeftCorner.d.ts +1 -1
- package/icons/TopRightCorner.d.ts +1 -1
- package/icons/Trash.d.ts +1 -1
- package/icons/Underscore.d.ts +1 -1
- package/icons/Unlink.d.ts +1 -1
- package/icons/UnlockChain.d.ts +1 -1
- package/icons/Unlocked.d.ts +1 -1
- package/icons/Upload.d.ts +1 -1
- package/icons/Uppercase.d.ts +1 -1
- package/icons/VerticalCenter.d.ts +1 -1
- package/icons/Video.d.ts +1 -1
- package/icons/Warning.d.ts +1 -1
- package/icons/Website.d.ts +1 -1
- package/icons/Width.d.ts +1 -1
- package/icons/Write.d.ts +1 -1
- package/icons/index.d.ts +129 -129
- package/icons/index.js.map +1 -1
- package/package.json +68 -43
- package/state/index.js +3 -1
- package/state/index.js.map +2 -2
- package/state/index.test.js +15 -7
- package/store/index.js.map +1 -1
- package/store/useSelector.d.ts +1 -1
- package/store/useSelector.js +1 -1
- package/stories/Alert.stories.d.ts +12 -0
- package/stories/Alert.stories.js +29 -0
- package/stories/Button.stories.d.ts +17 -0
- package/stories/Button.stories.js +61 -0
- package/stories/Checkbox.stories.d.ts +14 -0
- package/stories/Checkbox.stories.js +37 -0
- package/stories/Input.stories.d.ts +14 -0
- package/stories/Input.stories.js +31 -0
- package/stories/Label.stories.d.ts +9 -0
- package/stories/Label.stories.js +12 -0
- package/stories/Separator.stories.d.ts +10 -0
- package/stories/Separator.stories.js +13 -0
- package/stories/Sidebar.stories.d.ts +9 -0
- package/stories/Sidebar.stories.js +53 -0
- package/stories/Skeleton.stories.d.ts +9 -0
- package/stories/Skeleton.stories.js +10 -0
- package/stories/Sonner.stories.d.ts +11 -0
- package/stories/Sonner.stories.js +22 -0
- package/stories/Todo.js +11 -7
- package/stories/Tooltip.stories.d.ts +9 -0
- package/stories/Tooltip.stories.js +11 -0
- package/stories/TrafficLights.js +5 -5
- package/utils/utils.d.ts +2 -0
- package/utils/utils.js +5 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider, useSidebar, } from '@/components/ui/sidebar';
|
|
3
|
+
import { BadgeCheck, Bell, ChartPie, ChevronsUpDown, Command, Contact, CreditCard, House, LogOut, SidebarIcon, Sparkles, } from 'lucide-react';
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu';
|
|
5
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
|
6
|
+
import { Separator } from '@/components/ui/separator';
|
|
7
|
+
import { Button } from '@/components/ui/button';
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'WIP/Sidebar',
|
|
10
|
+
component: Sidebar,
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
const data = {
|
|
14
|
+
user: {
|
|
15
|
+
name: 'Oskar Glauser',
|
|
16
|
+
email: 'oskar@minutemailer.com',
|
|
17
|
+
avatar: 'https://www.gravatar.com/avatar/5e05baf3b97434b88ab1a4f5f00bf241?s=300&d=https%3A%2F%2Fui-avatars.com%2Fapi%2FOskar%2BGlauser%2F300%2Fe3504e%2Ffff',
|
|
18
|
+
},
|
|
19
|
+
projects: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Dashboard',
|
|
22
|
+
url: '#',
|
|
23
|
+
icon: House,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'Contacts',
|
|
27
|
+
url: '#',
|
|
28
|
+
icon: Contact,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Results',
|
|
32
|
+
url: '#',
|
|
33
|
+
icon: ChartPie,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
function NavMain({ items, }) {
|
|
38
|
+
return (_jsx(SidebarGroup, { className: "group-data-[collapsible=icon]:sm", children: _jsx(SidebarMenu, { children: items.map((item) => (_jsx(SidebarMenuItem, { children: _jsx(SidebarMenuButton, { asChild: true, children: _jsxs("a", { href: item.url, children: [_jsx(item.icon, {}), _jsx("span", { children: item.name })] }) }) }, item.name))) }) }));
|
|
39
|
+
}
|
|
40
|
+
function NavUser({ user, }) {
|
|
41
|
+
const { isMobile } = useSidebar();
|
|
42
|
+
return (_jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(SidebarMenuButton, { size: "lg", className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground", children: [_jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [_jsx(AvatarImage, { src: user.avatar, alt: user.name }), _jsx(AvatarFallback, { className: "rounded-lg", children: "CN" })] }), _jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [_jsx("span", { className: "truncate font-medium", children: user.name }), _jsx("span", { className: "truncate text-xs", children: user.email })] }), _jsx(ChevronsUpDown, { className: "ml-auto size-4" })] }) }), _jsxs(DropdownMenuContent, { className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg", side: isMobile ? 'bottom' : 'right', align: "end", sideOffset: 4, children: [_jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [_jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [_jsx(AvatarImage, { src: user.avatar, alt: user.name }), _jsx(AvatarFallback, { className: "rounded-lg", children: "CN" })] }), _jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [_jsx("span", { className: "truncate font-medium", children: user.name }), _jsx("span", { className: "truncate text-xs", children: user.email })] })] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuGroup, { children: _jsxs(DropdownMenuItem, { children: [_jsx(Sparkles, {}), "Upgrade to Pro"] }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuGroup, { children: [_jsxs(DropdownMenuItem, { children: [_jsx(BadgeCheck, {}), "Account"] }), _jsxs(DropdownMenuItem, { children: [_jsx(CreditCard, {}), "Billing"] }), _jsxs(DropdownMenuItem, { children: [_jsx(Bell, {}), "Notifications"] })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { children: [_jsx(LogOut, {}), "Log out"] })] })] }) }) }));
|
|
43
|
+
}
|
|
44
|
+
function AppSidebar({ ...props }) {
|
|
45
|
+
return (_jsxs(Sidebar, { collapsible: "icon", className: "top-(--header-height) h-[calc(100svh-var(--header-height))]!", ...props, children: [_jsx(SidebarHeader, { children: _jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsx(SidebarMenuButton, { size: "lg", asChild: true, children: _jsxs("a", { href: "#", children: [_jsx("div", { className: "bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg", children: _jsx(Command, { className: "size-4" }) }), _jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [_jsx("span", { className: "truncate font-medium", children: "Minutemailer" }), _jsx("span", { className: "truncate text-xs", children: "Enterprise" })] })] }) }) }) }) }), _jsx(SidebarContent, { children: _jsx(NavMain, { items: data.projects }) }), _jsx(SidebarFooter, { children: _jsx(NavUser, { user: data.user }) })] }));
|
|
46
|
+
}
|
|
47
|
+
function SiteHeader() {
|
|
48
|
+
const { toggleSidebar } = useSidebar();
|
|
49
|
+
return (_jsx("header", { className: "bg-card sticky top-0 z-50 flex w-full items-center border-b", children: _jsxs("div", { className: "flex h-(--header-height) w-full items-center gap-2 px-4", children: [_jsx(Button, { className: "h-8 w-8", variant: "ghost", size: "icon", onClick: toggleSidebar, children: _jsx(SidebarIcon, {}) }), _jsx(Separator, { orientation: "vertical", className: "mr-2 h-4" })] }) }));
|
|
50
|
+
}
|
|
51
|
+
export const Default = {
|
|
52
|
+
render: (args) => (_jsx("div", { className: "fixed inset-0", children: _jsx("div", { className: "[--header-height:calc(--spacing(14))]", children: _jsxs(SidebarProvider, { className: "flex flex-col", children: [_jsx(SiteHeader, {}), _jsxs("div", { className: "flex flex-1", children: [_jsx(AppSidebar, {}), _jsx(SidebarInset, { children: _jsx("div", { className: "p-8 flex flex-1 flex-col gap-4", children: _jsxs("div", { className: "bg-white flex flex-1 flex-col gap-4 p-4", children: [_jsxs("div", { className: "grid auto-rows-min gap-4 md:grid-cols-3", children: [_jsx("div", { className: "bg-muted/50 aspect-video rounded-xl" }), _jsx("div", { className: "bg-muted/50 aspect-video rounded-xl" }), _jsx("div", { className: "bg-muted/50 aspect-video rounded-xl" })] }), _jsx("div", { className: "bg-muted/50 min-h-[100vh] flex-1 rounded-xl md:min-h-min" })] }) }) })] })] }) }) })),
|
|
53
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Skeleton } from '@/components/ui/skeleton';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof Skeleton;
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof meta>;
|
|
9
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from '@/components/ui/skeleton';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'WIP/Skeleton',
|
|
5
|
+
component: Skeleton,
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
render: (args) => (_jsxs("div", { className: "flex items-center space-x-4", children: [_jsx(Skeleton, { className: "h-12 w-12 rounded-full" }), _jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-4 w-[250px]" }), _jsx(Skeleton, { className: "h-4 w-[200px]" })] })] })),
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ ...props }: import("sonner").ToasterProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const Playground: Story;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Toaster } from '@/components/ui/sonner';
|
|
3
|
+
import { toast } from 'sonner';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'WIP/Toast',
|
|
7
|
+
component: Toaster,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
function Demo() {
|
|
14
|
+
return (_jsx("div", { className: "flex flex-col gap-3", children: _jsxs("div", { className: "flex gap-3 flex-wrap", children: [_jsx(Button, { variant: "outline", onClick: () => toast('This is a toast'), children: "Show toast" }), _jsx(Button, { variant: "outline", onClick: () => toast.success('Everything went well!'), children: "Success" }), _jsx(Button, { variant: "outline", onClick: () => toast.error('Something went wrong'), children: "Error" }), _jsx(Button, { variant: "outline", onClick: () => toast.promise(new Promise((res) => setTimeout(res, 1500)), {
|
|
15
|
+
loading: 'Saving…',
|
|
16
|
+
success: 'Saved!',
|
|
17
|
+
error: 'Could not save',
|
|
18
|
+
}), children: "Promise" })] }) }));
|
|
19
|
+
}
|
|
20
|
+
export const Playground = {
|
|
21
|
+
render: () => _jsx(Demo, {}),
|
|
22
|
+
};
|
package/stories/Todo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createStore, useSelector } from
|
|
3
|
-
import { useState } from
|
|
2
|
+
import { createStore, useSelector } from '@/store';
|
|
3
|
+
import { useState } from 'react';
|
|
4
4
|
const initialState = {
|
|
5
5
|
todos: [],
|
|
6
6
|
completed: 0,
|
|
@@ -34,11 +34,14 @@ const reducer = (state, action) => {
|
|
|
34
34
|
}
|
|
35
35
|
return state;
|
|
36
36
|
};
|
|
37
|
-
const store = createStore('todos', initialState, reducer, () => true, () => {
|
|
38
|
-
}, 'todos');
|
|
37
|
+
const store = createStore('todos', initialState, reducer, () => true, () => { }, 'todos');
|
|
39
38
|
function Todos() {
|
|
40
39
|
const todos = useSelector(store, (state) => state.todos);
|
|
41
|
-
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: todos.map((todo) => (_jsx("div", { style: {
|
|
40
|
+
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: todos.map((todo) => (_jsx("div", { style: {
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
gap: '1rem',
|
|
44
|
+
}, children: _jsxs("div", { className: "flex items-center space-x-3", children: [_jsx("button", { type: "button", role: "checkbox", "aria-checked": todo.completed, "data-state": todo.completed ? 'checked' : 'unchecked', value: "on", className: "peer size-5 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-accent-foreground", id: "remember", tabIndex: 3, onClick: () => store.dispatch({
|
|
42
45
|
type: !todo.completed
|
|
43
46
|
? 'COMPLETE_TODO'
|
|
44
47
|
: 'UNCOMPLETE_TODO',
|
|
@@ -49,13 +52,14 @@ function Todos() {
|
|
|
49
52
|
pointerEvents: 'none',
|
|
50
53
|
opacity: 0,
|
|
51
54
|
margin: 0,
|
|
52
|
-
width: '20px',
|
|
55
|
+
width: '20px',
|
|
56
|
+
height: '20px',
|
|
53
57
|
} }), _jsx("label", { className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", htmlFor: "remember", children: todo.text })] }) }, todo.id))) }));
|
|
54
58
|
}
|
|
55
59
|
function Status() {
|
|
56
60
|
const total = useSelector(store, (state) => state.total);
|
|
57
61
|
const completed = useSelector(store, (state) => state.completed);
|
|
58
|
-
return _jsx("p", { className: "mt-4 text-sm text-muted-foreground", children: `${completed} / ${total} todos completed` });
|
|
62
|
+
return (_jsx("p", { className: "mt-4 text-sm text-muted-foreground", children: `${completed} / ${total} todos completed` }));
|
|
59
63
|
}
|
|
60
64
|
function Form() {
|
|
61
65
|
const [value, setValue] = useState('');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Tooltip } from '@/components/ui/tooltip';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof Tooltip;
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof meta>;
|
|
9
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'WIP/Tooltip',
|
|
6
|
+
component: Tooltip,
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
export const Default = {
|
|
10
|
+
render: (args) => (_jsxs(Tooltip, { ...args, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Hover" }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Add to library" }) })] })),
|
|
11
|
+
};
|
package/stories/TrafficLights.js
CHANGED
|
@@ -7,18 +7,18 @@ const SimpleTrafficLight = () => {
|
|
|
7
7
|
const transitions = {
|
|
8
8
|
RED: { on: { NEXT: 'GREEN' } },
|
|
9
9
|
GREEN: { on: { NEXT: 'YELLOW' } },
|
|
10
|
-
YELLOW: { on: { NEXT: 'RED' } }
|
|
10
|
+
YELLOW: { on: { NEXT: 'RED' } },
|
|
11
11
|
};
|
|
12
12
|
const actions = {
|
|
13
13
|
NEXT: (context) => ({
|
|
14
|
-
count: context.count + 1
|
|
15
|
-
})
|
|
14
|
+
count: context.count + 1,
|
|
15
|
+
}),
|
|
16
16
|
};
|
|
17
17
|
// Create the machine with minimal context
|
|
18
18
|
const [machine] = useState(() => createMachine(transitions, actions, { count: 0 }, 'RED'));
|
|
19
19
|
// Get current state and count from the machine
|
|
20
20
|
const currentState = machine.useCurrentState();
|
|
21
|
-
const count = machine.useCurrentContext(ctx => ctx.count);
|
|
21
|
+
const count = machine.useCurrentContext((ctx) => ctx.count);
|
|
22
22
|
// Auto-transition every 1.5 seconds
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
const timer = setTimeout(() => {
|
|
@@ -30,7 +30,7 @@ const SimpleTrafficLight = () => {
|
|
|
30
30
|
const colors = {
|
|
31
31
|
RED: 'bg-rose-500',
|
|
32
32
|
YELLOW: 'bg-amber-400',
|
|
33
|
-
GREEN: 'bg-emerald-500'
|
|
33
|
+
GREEN: 'bg-emerald-500',
|
|
34
34
|
};
|
|
35
35
|
return (_jsxs("div", { className: "flex flex-col items-start p-4", children: [_jsx("div", { className: "bg-gray-800 p-3 rounded-lg mb-4 flex flex-col items-start gap-2", children: Object.entries(colors).map(([state, color]) => (_jsx("div", { className: `w-16 h-16 m-2 rounded-full ${currentState === state ? color : 'bg-gray-300'}` }, state))) }), _jsxs("div", { children: [_jsxs("p", { children: ["Current: ", _jsx("strong", { children: currentState })] }), _jsxs("p", { children: ["Cycles: ", count] }), _jsx("button", { onClick: () => machine.action('NEXT'), className: "mt-2 bg-blue-500 text-white px-4 py-2 rounded", children: "Next State" })] })] }));
|
|
36
36
|
};
|
package/utils/utils.d.ts
ADDED