@postxl/generators 1.1.1 → 1.2.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/dist/frontend-core/frontend.generator.d.ts +0 -58
- package/dist/frontend-core/frontend.generator.js +6 -172
- package/dist/frontend-core/frontend.generator.js.map +1 -1
- package/dist/frontend-core/template/README.md +1 -1
- package/dist/frontend-core/template/src/components/admin/table-filter.tsx +1 -5
- package/dist/frontend-core/template/src/components/ui/color-mode-toggle/color-mode-toggle.tsx +10 -4
- package/dist/frontend-core/template/src/pages/dashboard/dashboard.page.tsx +2 -3
- package/dist/frontend-core/template/src/pages/error/default-error.page.tsx +1 -1
- package/dist/frontend-core/template/src/pages/error/not-found-error.page.tsx +1 -1
- package/dist/frontend-core/template/src/styles/styles.css +13 -1
- package/dist/frontend-core/template/tsconfig.json +2 -0
- package/dist/frontend-core/types/component.d.ts +1 -1
- package/dist/frontend-forms/generators/discriminated-union/fields.generator.js +4 -6
- package/dist/frontend-forms/generators/discriminated-union/fields.generator.js.map +1 -1
- package/dist/frontend-forms/generators/discriminated-union/inputs.generator.js +1 -1
- package/dist/frontend-forms/generators/discriminated-union/inputs.generator.js.map +1 -1
- package/dist/frontend-forms/generators/enum/inputs.generator.js +1 -1
- package/dist/frontend-forms/generators/enum/inputs.generator.js.map +1 -1
- package/dist/frontend-forms/generators/model/forms.generator.js +8 -12
- package/dist/frontend-forms/generators/model/forms.generator.js.map +1 -1
- package/dist/frontend-forms/generators/model/inputs.generator.js +2 -6
- package/dist/frontend-forms/generators/model/inputs.generator.js.map +1 -1
- package/dist/frontend-forms/template/src/components/ui/field/field.tsx +1 -4
- package/dist/frontend-tables/generators/model-table.generator.js +1 -5
- package/dist/frontend-tables/generators/model-table.generator.js.map +1 -1
- package/package.json +3 -2
- package/dist/frontend-core/template/src/components/ui/accordion/accordion.stories.tsx +0 -47
- package/dist/frontend-core/template/src/components/ui/accordion/accordion.tsx +0 -52
- package/dist/frontend-core/template/src/components/ui/admin-sidebar/admin-sidebar.tsx +0 -195
- package/dist/frontend-core/template/src/components/ui/alert/alert.stories.tsx +0 -61
- package/dist/frontend-core/template/src/components/ui/alert/alert.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/alert-dialog/alert-dialog.stories.tsx +0 -52
- package/dist/frontend-core/template/src/components/ui/alert-dialog/alert-dialog.tsx +0 -105
- package/dist/frontend-core/template/src/components/ui/avatar/avatar.stories.tsx +0 -30
- package/dist/frontend-core/template/src/components/ui/avatar/avatar.tsx +0 -39
- package/dist/frontend-core/template/src/components/ui/badge/badge.stories.tsx +0 -78
- package/dist/frontend-core/template/src/components/ui/badge/badge.tsx +0 -48
- package/dist/frontend-core/template/src/components/ui/breadcrumb/breadcrumb.stories.tsx +0 -67
- package/dist/frontend-core/template/src/components/ui/breadcrumb/breadcrumb.tsx +0 -85
- package/dist/frontend-core/template/src/components/ui/button/button.stories.tsx +0 -150
- package/dist/frontend-core/template/src/components/ui/button/button.tsx +0 -68
- package/dist/frontend-core/template/src/components/ui/calendar/calendar.stories.tsx +0 -160
- package/dist/frontend-core/template/src/components/ui/calendar/calendar.tsx +0 -293
- package/dist/frontend-core/template/src/components/ui/card/card.stories.tsx +0 -77
- package/dist/frontend-core/template/src/components/ui/card/card.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/card-hover/card-hover.stories.tsx +0 -29
- package/dist/frontend-core/template/src/components/ui/card-hover/card-hover.tsx +0 -28
- package/dist/frontend-core/template/src/components/ui/carousel/carousel.stories.tsx +0 -154
- package/dist/frontend-core/template/src/components/ui/carousel/carousel.tsx +0 -227
- package/dist/frontend-core/template/src/components/ui/checkbox/checkbox.stories.tsx +0 -106
- package/dist/frontend-core/template/src/components/ui/checkbox/checkbox.tsx +0 -88
- package/dist/frontend-core/template/src/components/ui/checkbox/shadcn-checkbox.stories.tsx +0 -90
- package/dist/frontend-core/template/src/components/ui/checkbox/shadcn-checkbox.tsx +0 -54
- package/dist/frontend-core/template/src/components/ui/collapse/collapse.stories.tsx +0 -52
- package/dist/frontend-core/template/src/components/ui/collapse/collapse.tsx +0 -9
- package/dist/frontend-core/template/src/components/ui/combobox/combobox.stories.tsx +0 -207
- package/dist/frontend-core/template/src/components/ui/combobox/combobox.tsx +0 -79
- package/dist/frontend-core/template/src/components/ui/command/command.stories.tsx +0 -186
- package/dist/frontend-core/template/src/components/ui/command/command.tsx +0 -165
- package/dist/frontend-core/template/src/components/ui/command-palette/command-palette.stories.tsx +0 -160
- package/dist/frontend-core/template/src/components/ui/command-palette/command-palette.tsx +0 -134
- package/dist/frontend-core/template/src/components/ui/content-frame/content-frame.stories.tsx +0 -198
- package/dist/frontend-core/template/src/components/ui/content-frame/content-frame.tsx +0 -100
- package/dist/frontend-core/template/src/components/ui/context-menu/context-menu.stories.tsx +0 -78
- package/dist/frontend-core/template/src/components/ui/context-menu/context-menu.tsx +0 -179
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/cell-variant-types.ts +0 -11
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/checkbox-cell.tsx +0 -116
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/date-cell.tsx +0 -157
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/gantt-cell.tsx +0 -82
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/long-text-cell.tsx +0 -180
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/multi-select-cell.tsx +0 -280
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/number-cell.tsx +0 -169
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/react-node-cell.tsx +0 -33
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/select-cell.tsx +0 -175
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/short-text-cell.tsx +0 -138
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/utils/gantt-timeline.tsx +0 -92
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/utils/gantt-timerange-picker.tsx +0 -330
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-cell-wrapper.tsx +0 -212
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-cell.tsx +0 -157
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-column-header.tsx +0 -340
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-context-menu.tsx +0 -271
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-row.tsx +0 -123
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-search.tsx +0 -211
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-types.ts +0 -159
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-utils.ts +0 -67
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-view-menu.tsx +0 -360
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid.stories.tsx +0 -780
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid.tsx +0 -217
- package/dist/frontend-core/template/src/components/ui/data-grid/hooks/use-callback-ref.ts +0 -22
- package/dist/frontend-core/template/src/components/ui/data-grid/hooks/use-data-grid.tsx +0 -1892
- package/dist/frontend-core/template/src/components/ui/data-grid/hooks/use-debounced-callback.ts +0 -19
- package/dist/frontend-core/template/src/components/ui/data-grid/styles.css +0 -3
- package/dist/frontend-core/template/src/components/ui/data-table/context-menu-simple.tsx +0 -141
- package/dist/frontend-core/template/src/components/ui/data-table/data-table.stories.tsx +0 -146
- package/dist/frontend-core/template/src/components/ui/data-table/data-table.tsx +0 -447
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/country-array-cell-renderer.tsx +0 -77
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/country-cell-renderer.tsx +0 -56
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/favorite-cell-renderer.tsx +0 -68
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/links-cell-renderer.tsx +0 -205
- package/dist/frontend-core/template/src/components/ui/data-table/utils/columns.ts +0 -351
- package/dist/frontend-core/template/src/components/ui/data-table/utils/data-table.utils.ts +0 -49
- package/dist/frontend-core/template/src/components/ui/date-picker/date-picker.stories.tsx +0 -149
- package/dist/frontend-core/template/src/components/ui/date-picker/date-picker.tsx +0 -30
- package/dist/frontend-core/template/src/components/ui/dialog/dialog.stories.tsx +0 -80
- package/dist/frontend-core/template/src/components/ui/dialog/dialog.tsx +0 -134
- package/dist/frontend-core/template/src/components/ui/drawer/drawer.stories.tsx +0 -104
- package/dist/frontend-core/template/src/components/ui/drawer/drawer.tsx +0 -87
- package/dist/frontend-core/template/src/components/ui/dropdown-menu/dropdown-menu.stories.tsx +0 -168
- package/dist/frontend-core/template/src/components/ui/dropdown-menu/dropdown-menu.tsx +0 -225
- package/dist/frontend-core/template/src/components/ui/input/input.stories.tsx +0 -141
- package/dist/frontend-core/template/src/components/ui/input/input.tsx +0 -47
- package/dist/frontend-core/template/src/components/ui/label/label.stories.tsx +0 -41
- package/dist/frontend-core/template/src/components/ui/label/label.tsx +0 -20
- package/dist/frontend-core/template/src/components/ui/loader/loader.stories.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/loader/loader.tsx +0 -17
- package/dist/frontend-core/template/src/components/ui/mark-value-renderer/mark-value-renderer.stories.tsx +0 -114
- package/dist/frontend-core/template/src/components/ui/mark-value-renderer/mark-value-renderer.tsx +0 -48
- package/dist/frontend-core/template/src/components/ui/menubar/menu.stories.tsx +0 -134
- package/dist/frontend-core/template/src/components/ui/menubar/menubar.tsx +0 -208
- package/dist/frontend-core/template/src/components/ui/modal/modal.stories.tsx +0 -297
- package/dist/frontend-core/template/src/components/ui/modal/modal.tsx +0 -80
- package/dist/frontend-core/template/src/components/ui/navigation-menu/navigation-menu.stories.tsx +0 -213
- package/dist/frontend-core/template/src/components/ui/navigation-menu/navigation-menu.tsx +0 -142
- package/dist/frontend-core/template/src/components/ui/pagination/pagination.stories.tsx +0 -49
- package/dist/frontend-core/template/src/components/ui/pagination/pagination.tsx +0 -84
- package/dist/frontend-core/template/src/components/ui/popover/popover.stories.tsx +0 -82
- package/dist/frontend-core/template/src/components/ui/popover/popover.tsx +0 -55
- package/dist/frontend-core/template/src/components/ui/progress/progress.stories.tsx +0 -80
- package/dist/frontend-core/template/src/components/ui/progress/progress.tsx +0 -17
- package/dist/frontend-core/template/src/components/ui/radio-group/radio-group.stories.tsx +0 -154
- package/dist/frontend-core/template/src/components/ui/radio-group/radio-group.tsx +0 -68
- package/dist/frontend-core/template/src/components/ui/resizable/resizable.stories.tsx +0 -73
- package/dist/frontend-core/template/src/components/ui/resizable/resizeable.tsx +0 -38
- package/dist/frontend-core/template/src/components/ui/scroll-area/scroll-area.stories.tsx +0 -55
- package/dist/frontend-core/template/src/components/ui/scroll-area/scroll-area.tsx +0 -39
- package/dist/frontend-core/template/src/components/ui/select/select.stories.tsx +0 -297
- package/dist/frontend-core/template/src/components/ui/select/select.tsx +0 -227
- package/dist/frontend-core/template/src/components/ui/separator/separator.tsx +0 -21
- package/dist/frontend-core/template/src/components/ui/separator/seperator.stories.tsx +0 -25
- package/dist/frontend-core/template/src/components/ui/sheet/sheet.stories.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/sheet/sheet.tsx +0 -107
- package/dist/frontend-core/template/src/components/ui/skeleton/skeleton.stories.tsx +0 -26
- package/dist/frontend-core/template/src/components/ui/skeleton/skeleton.tsx +0 -7
- package/dist/frontend-core/template/src/components/ui/slider/slider.stories.tsx +0 -101
- package/dist/frontend-core/template/src/components/ui/slider/slider.tsx +0 -98
- package/dist/frontend-core/template/src/components/ui/spinner/spinner.stories.tsx +0 -19
- package/dist/frontend-core/template/src/components/ui/spinner/spinner.tsx +0 -21
- package/dist/frontend-core/template/src/components/ui/switch/switch.stories.tsx +0 -33
- package/dist/frontend-core/template/src/components/ui/switch/switch.tsx +0 -28
- package/dist/frontend-core/template/src/components/ui/tabs/tabs.stories.tsx +0 -215
- package/dist/frontend-core/template/src/components/ui/tabs/tabs.tsx +0 -70
- package/dist/frontend-core/template/src/components/ui/textarea/textarea.stories.tsx +0 -138
- package/dist/frontend-core/template/src/components/ui/textarea/textarea.tsx +0 -40
- package/dist/frontend-core/template/src/components/ui/toast/toast.mdx +0 -31
- package/dist/frontend-core/template/src/components/ui/toast/toast.stories.tsx +0 -89
- package/dist/frontend-core/template/src/components/ui/toggle/toggle.stories.tsx +0 -65
- package/dist/frontend-core/template/src/components/ui/toggle/toggle.tsx +0 -38
- package/dist/frontend-core/template/src/components/ui/toggle-group/toggle-group.stories.tsx +0 -85
- package/dist/frontend-core/template/src/components/ui/toggle-group/toggle-group.tsx +0 -54
- package/dist/frontend-core/template/src/components/ui/tooltip/tooltip.stories.tsx +0 -29
- package/dist/frontend-core/template/src/components/ui/tooltip/tooltip.tsx +0 -29
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { cn } from '@lib/utils'
|
|
2
|
-
|
|
3
|
-
export function Spinner({ classNames }: Readonly<{ classNames?: string }>) {
|
|
4
|
-
return (
|
|
5
|
-
<div className={cn('flex justify-center items-center w-full h-full', classNames)}>
|
|
6
|
-
<svg
|
|
7
|
-
className="w-auto text-[inherit] h-full animate-spin"
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
fill="none"
|
|
10
|
-
viewBox="0 0 24 24"
|
|
11
|
-
>
|
|
12
|
-
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
|
|
13
|
-
<path
|
|
14
|
-
className="opacity-75"
|
|
15
|
-
fill="currentColor"
|
|
16
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
import { Switch } from './switch'
|
|
3
|
-
import { Label } from '@components/ui/label/label'
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Switch> = {
|
|
6
|
-
title: 'Switch',
|
|
7
|
-
component: Switch,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: 'centered',
|
|
11
|
-
},
|
|
12
|
-
argTypes: {
|
|
13
|
-
disabled: {
|
|
14
|
-
control: 'boolean',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default meta
|
|
20
|
-
|
|
21
|
-
export const Default: StoryObj<typeof meta> = {
|
|
22
|
-
args: {
|
|
23
|
-
disabled: false,
|
|
24
|
-
},
|
|
25
|
-
render: (args) => (
|
|
26
|
-
<div className="flex items-center justify-center">
|
|
27
|
-
<div className="flex items-center space-x-2">
|
|
28
|
-
<Switch id="airplane-mode" disabled={args.disabled} />
|
|
29
|
-
<Label htmlFor="airplane-mode">Airplane Mode</Label>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
),
|
|
33
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as SwitchPrimitives from '@radix-ui/react-switch'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@lib/utils'
|
|
6
|
-
|
|
7
|
-
const Switch = React.forwardRef<
|
|
8
|
-
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
10
|
-
>(({ className, ...props }, ref) => (
|
|
11
|
-
<SwitchPrimitives.Root
|
|
12
|
-
className={cn(
|
|
13
|
-
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
ref={ref}
|
|
18
|
-
>
|
|
19
|
-
<SwitchPrimitives.Thumb
|
|
20
|
-
className={cn(
|
|
21
|
-
'pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',
|
|
22
|
-
)}
|
|
23
|
-
/>
|
|
24
|
-
</SwitchPrimitives.Root>
|
|
25
|
-
))
|
|
26
|
-
Switch.displayName = SwitchPrimitives.Root.displayName
|
|
27
|
-
|
|
28
|
-
export { Switch }
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
import { expect, userEvent, screen } from 'storybook/test'
|
|
3
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs'
|
|
4
|
-
|
|
5
|
-
// Create a wrapper component for Storybook that accepts our custom args
|
|
6
|
-
const TabsStory = (args: TabStoryArgs) => {
|
|
7
|
-
return <div>Tabs Story Container</div> // Not used directly, stories use render function
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const meta = {
|
|
11
|
-
title: 'Tabs',
|
|
12
|
-
component: TabsStory,
|
|
13
|
-
tags: ['autodocs'],
|
|
14
|
-
parameters: {
|
|
15
|
-
layout: 'centered',
|
|
16
|
-
},
|
|
17
|
-
argTypes: {
|
|
18
|
-
variantTabsList: {
|
|
19
|
-
control: 'select',
|
|
20
|
-
options: ['default', 'protocol'],
|
|
21
|
-
},
|
|
22
|
-
variantTabsTrigger: {
|
|
23
|
-
control: 'select',
|
|
24
|
-
options: ['default', 'protocol'],
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
control: 'select',
|
|
28
|
-
options: ['default', 'sm', 'lg'],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
args: {
|
|
32
|
-
variantTabsList: 'default',
|
|
33
|
-
variantTabsTrigger: 'default',
|
|
34
|
-
size: 'default',
|
|
35
|
-
},
|
|
36
|
-
} satisfies Meta<TabStoryArgs>
|
|
37
|
-
|
|
38
|
-
export default meta
|
|
39
|
-
|
|
40
|
-
interface TabStoryArgs {
|
|
41
|
-
variantTabsList?: 'default' | 'protocol'
|
|
42
|
-
variantTabsTrigger?: 'default' | 'protocol'
|
|
43
|
-
size?: 'default' | 'sm' | 'lg'
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
type Story = StoryObj<TabStoryArgs>
|
|
47
|
-
|
|
48
|
-
export const Default: Story = {
|
|
49
|
-
render: (args) => (
|
|
50
|
-
<Tabs className="w-[400px]">
|
|
51
|
-
<TabsList variant={args.variantTabsList} className="grid grid-cols-3 w-full" size={args.size}>
|
|
52
|
-
<TabsTrigger variant={args.variantTabsTrigger} value="example1" className="cursor-pointer">
|
|
53
|
-
Example 1
|
|
54
|
-
</TabsTrigger>
|
|
55
|
-
<TabsTrigger variant={args.variantTabsTrigger} value="example2" className="cursor-pointer">
|
|
56
|
-
Example 2
|
|
57
|
-
</TabsTrigger>
|
|
58
|
-
<TabsTrigger variant={args.variantTabsTrigger} value="example3" className="cursor-pointer">
|
|
59
|
-
Example 3
|
|
60
|
-
</TabsTrigger>
|
|
61
|
-
</TabsList>
|
|
62
|
-
<TabsContent value="example1">
|
|
63
|
-
<div className="p-4 rounded-lg border mt-2">Example Content 1</div>
|
|
64
|
-
</TabsContent>
|
|
65
|
-
<TabsContent value="example2">
|
|
66
|
-
<div className="p-4 rounded-lg border mt-2">Example Content 2</div>
|
|
67
|
-
</TabsContent>
|
|
68
|
-
<TabsContent value="example3">
|
|
69
|
-
<div className="p-4 rounded-lg border mt-2">Example Content 3</div>
|
|
70
|
-
</TabsContent>
|
|
71
|
-
</Tabs>
|
|
72
|
-
),
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export const Variants: Story = {
|
|
76
|
-
render: () => (
|
|
77
|
-
<div className="grid grid-cols-3 mt-8 space-x-10">
|
|
78
|
-
<Tabs>
|
|
79
|
-
<TabsList variant="default" size="default">
|
|
80
|
-
<TabsTrigger variant="default" value="small" className="cursor-pointer w-[100px]">
|
|
81
|
-
default
|
|
82
|
-
</TabsTrigger>
|
|
83
|
-
</TabsList>
|
|
84
|
-
<TabsContent value="small">
|
|
85
|
-
<div className="p-4 rounded-lg border mt-2">Content</div>
|
|
86
|
-
</TabsContent>
|
|
87
|
-
</Tabs>
|
|
88
|
-
<Tabs>
|
|
89
|
-
<TabsList variant="protocol" size="default">
|
|
90
|
-
<TabsTrigger variant="default" value="default" className="cursor-pointer w-[100px]">
|
|
91
|
-
TabsList protocol
|
|
92
|
-
</TabsTrigger>
|
|
93
|
-
</TabsList>
|
|
94
|
-
<TabsContent value="default">
|
|
95
|
-
<div className="p-4 rounded-lg border mt-2">Content</div>
|
|
96
|
-
</TabsContent>
|
|
97
|
-
</Tabs>
|
|
98
|
-
<Tabs>
|
|
99
|
-
<TabsList variant="protocol" size="default">
|
|
100
|
-
<TabsTrigger variant="protocol" value="large" className="cursor-pointer w-[100px]">
|
|
101
|
-
TabsList & -Trigger protocol
|
|
102
|
-
</TabsTrigger>
|
|
103
|
-
</TabsList>
|
|
104
|
-
<TabsContent value="large">
|
|
105
|
-
<div className="p-4 rounded-lg border mt-2">Content</div>
|
|
106
|
-
</TabsContent>
|
|
107
|
-
</Tabs>
|
|
108
|
-
</div>
|
|
109
|
-
),
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export const Sizes: Story = {
|
|
113
|
-
render: () => (
|
|
114
|
-
<div className="grid grid-cols-3 mt-8">
|
|
115
|
-
<Tabs>
|
|
116
|
-
<TabsList variant="default" size="sm">
|
|
117
|
-
<TabsTrigger variant="default" value="small" className="cursor-pointer w-[100px]">
|
|
118
|
-
sm
|
|
119
|
-
</TabsTrigger>
|
|
120
|
-
</TabsList>
|
|
121
|
-
<TabsContent value="small">
|
|
122
|
-
<div className="p-4 rounded-lg border mt-2">Small Size Content</div>
|
|
123
|
-
</TabsContent>
|
|
124
|
-
</Tabs>
|
|
125
|
-
<Tabs>
|
|
126
|
-
<TabsList variant="default" size="default">
|
|
127
|
-
<TabsTrigger variant="default" value="default" className="cursor-pointer w-[100px]">
|
|
128
|
-
default
|
|
129
|
-
</TabsTrigger>
|
|
130
|
-
</TabsList>
|
|
131
|
-
<TabsContent value="default">
|
|
132
|
-
<div className="p-4 rounded-lg border mt-2">Default Size Content</div>
|
|
133
|
-
</TabsContent>
|
|
134
|
-
</Tabs>
|
|
135
|
-
<Tabs>
|
|
136
|
-
<TabsList variant="default" size="lg">
|
|
137
|
-
<TabsTrigger variant="default" value="large" className="cursor-pointer w-[100px]">
|
|
138
|
-
lg
|
|
139
|
-
</TabsTrigger>
|
|
140
|
-
</TabsList>
|
|
141
|
-
<TabsContent value="large">
|
|
142
|
-
<div className="p-4 rounded-lg border mt-2">Large Size Content</div>
|
|
143
|
-
</TabsContent>
|
|
144
|
-
</Tabs>
|
|
145
|
-
</div>
|
|
146
|
-
),
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export const Disabled: Story = {
|
|
150
|
-
render: () => (
|
|
151
|
-
<Tabs defaultValue="tab1" className="w-[400px]">
|
|
152
|
-
<TabsList className="grid grid-cols-2 w-full">
|
|
153
|
-
<TabsTrigger value="tab1" className="cursor-pointer">
|
|
154
|
-
Available
|
|
155
|
-
</TabsTrigger>
|
|
156
|
-
<TabsTrigger value="tab2" className="cursor-pointer" disabled>
|
|
157
|
-
Disabled
|
|
158
|
-
</TabsTrigger>
|
|
159
|
-
</TabsList>
|
|
160
|
-
<TabsContent value="tab1">
|
|
161
|
-
<div className="p-4 rounded-lg border border mt-2">This tab is available.</div>
|
|
162
|
-
</TabsContent>
|
|
163
|
-
<TabsContent value="tab2">
|
|
164
|
-
<div className="p-4 rounded-lg border border mt-2">This content won't be accessible.</div>
|
|
165
|
-
</TabsContent>
|
|
166
|
-
</Tabs>
|
|
167
|
-
),
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export const InteractiveTest: Story = {
|
|
171
|
-
render: () => (
|
|
172
|
-
<Tabs defaultValue="example1" className="w-[400px]">
|
|
173
|
-
<TabsList variant="default" className="grid grid-cols-3 w-full">
|
|
174
|
-
<TabsTrigger value="example1" className="cursor-pointer" data-testid="tab-example1">
|
|
175
|
-
Example 1
|
|
176
|
-
</TabsTrigger>
|
|
177
|
-
<TabsTrigger value="example2" className="cursor-pointer" data-testid="tab-example2">
|
|
178
|
-
Example 2
|
|
179
|
-
</TabsTrigger>
|
|
180
|
-
<TabsTrigger value="example3" className="cursor-pointer">
|
|
181
|
-
Example 3
|
|
182
|
-
</TabsTrigger>
|
|
183
|
-
</TabsList>
|
|
184
|
-
<TabsContent value="example1">
|
|
185
|
-
<div className="p-4 rounded-lg border mt-2" data-testid="example1-content">
|
|
186
|
-
Example Content 1
|
|
187
|
-
</div>
|
|
188
|
-
</TabsContent>
|
|
189
|
-
<TabsContent value="example2">
|
|
190
|
-
<div className="p-4 rounded-lg border mt-2" data-testid="example2-content">
|
|
191
|
-
Example Content 2
|
|
192
|
-
</div>
|
|
193
|
-
</TabsContent>
|
|
194
|
-
<TabsContent value="example3">
|
|
195
|
-
<div className="p-4 rounded-lg border mt-2">Example Content 3</div>
|
|
196
|
-
</TabsContent>
|
|
197
|
-
</Tabs>
|
|
198
|
-
),
|
|
199
|
-
play: async () => {
|
|
200
|
-
const example1Tab = screen.getByTestId('tab-example1')
|
|
201
|
-
const accountContent = screen.getByTestId('example1-content')
|
|
202
|
-
const example2Tab = screen.getByTestId('tab-example2')
|
|
203
|
-
|
|
204
|
-
await expect(example1Tab).toHaveAttribute('data-state', 'active')
|
|
205
|
-
await expect(accountContent).toBeVisible()
|
|
206
|
-
|
|
207
|
-
await userEvent.click(example2Tab)
|
|
208
|
-
|
|
209
|
-
await expect(example2Tab).toHaveAttribute('data-state', 'active')
|
|
210
|
-
await expect(example1Tab).toHaveAttribute('data-state', 'inactive')
|
|
211
|
-
|
|
212
|
-
const passwordContent = screen.getByTestId('example2-content')
|
|
213
|
-
await expect(passwordContent).toBeVisible()
|
|
214
|
-
},
|
|
215
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Slot } from '@radix-ui/react-slot'
|
|
2
|
-
import * as TabsPrimitive from '@radix-ui/react-tabs'
|
|
3
|
-
|
|
4
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
-
import type { ComponentProps } from 'react'
|
|
6
|
-
|
|
7
|
-
import { cn } from '@lib/utils'
|
|
8
|
-
|
|
9
|
-
function Tabs({ className, ...props }: ComponentProps<typeof TabsPrimitive.Root>) {
|
|
10
|
-
return <TabsPrimitive.Root data-slot="tabs" className={cn('flex flex-col gap-2', className)} {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const tabsListVariants = cva('w-fit text-muted-foreground inline-flex items-center justify-center rounded-lg', {
|
|
14
|
-
variants: {
|
|
15
|
-
variant: {
|
|
16
|
-
default: 'bg-muted p-[3px]',
|
|
17
|
-
protocol: 'bg-transparent',
|
|
18
|
-
},
|
|
19
|
-
size: {
|
|
20
|
-
default: 'h-9',
|
|
21
|
-
sm: 'h-6',
|
|
22
|
-
lg: 'h-10',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
variant: 'default',
|
|
27
|
-
size: 'default',
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
function TabsList({
|
|
32
|
-
className,
|
|
33
|
-
variant,
|
|
34
|
-
size,
|
|
35
|
-
asChild = false,
|
|
36
|
-
...props
|
|
37
|
-
}: ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants> & { asChild?: boolean }) {
|
|
38
|
-
const Comp = asChild ? Slot : TabsPrimitive.List
|
|
39
|
-
return <Comp data-slot="tabs-list" className={cn(tabsListVariants({ variant, size, className }))} {...props} />
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const tabsTriggerVariants = cva(
|
|
43
|
-
"h-[100%] text-lg inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 text-foreground",
|
|
44
|
-
{
|
|
45
|
-
variants: {
|
|
46
|
-
variant: {
|
|
47
|
-
default:
|
|
48
|
-
'h-[calc(100%-1px)] flex-1 rounded-md border border-transparent px-2 py-1 transition-[color,box-shadow] dark:text-muted-foreground data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:shadow-sm',
|
|
49
|
-
protocol:
|
|
50
|
-
'bg-transparent border-b-2 border-b-transparent hover:text-primary hover:border-b-primary data-[state=active]:border-b-primary data-[state=active]:text-primary',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
function TabsTrigger({
|
|
57
|
-
className,
|
|
58
|
-
variant,
|
|
59
|
-
asChild = false,
|
|
60
|
-
...props
|
|
61
|
-
}: ComponentProps<typeof TabsPrimitive.Trigger> & VariantProps<typeof tabsTriggerVariants> & { asChild?: boolean }) {
|
|
62
|
-
const Comp = asChild ? Slot : TabsPrimitive.Trigger
|
|
63
|
-
return <Comp data-slot="tabs-trigger" className={cn(tabsTriggerVariants({ variant, className }))} {...props} />
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function TabsContent({ className, ...props }: ComponentProps<typeof TabsPrimitive.Content>) {
|
|
67
|
-
return <TabsPrimitive.Content data-slot="tabs-content" className={cn('flex-1 outline-none', className)} {...props} />
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
|
|
3
|
-
import { Textarea } from './textarea'
|
|
4
|
-
import { useState } from 'react'
|
|
5
|
-
import { Button } from '@components/ui/button/button'
|
|
6
|
-
import { expect, userEvent, within } from 'storybook/test'
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Textarea',
|
|
10
|
-
component: Textarea,
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
parameters: {
|
|
13
|
-
layout: 'centered',
|
|
14
|
-
},
|
|
15
|
-
argTypes: {
|
|
16
|
-
variant: {
|
|
17
|
-
control: 'select',
|
|
18
|
-
options: ['default', 'simple'],
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
} satisfies Meta<typeof Textarea>
|
|
22
|
-
export default meta
|
|
23
|
-
|
|
24
|
-
type Story = StoryObj<typeof meta>
|
|
25
|
-
|
|
26
|
-
export const Default: Story = {
|
|
27
|
-
render: (args) => <Textarea {...args} className="w-[350px]" placeholder="Simple Textarea..." />,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const Variants: Story = {
|
|
31
|
-
render: () => (
|
|
32
|
-
<div className="flex flex-wrap gap-4 items-center">
|
|
33
|
-
<Textarea variant="default" className="w-[250px]" placeholder="default" />
|
|
34
|
-
<Textarea variant="simple" className="w-[250px]" placeholder="simple" />
|
|
35
|
-
</div>
|
|
36
|
-
),
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const Disabled: Story = {
|
|
40
|
-
render: (args) => (
|
|
41
|
-
<div className="flex flex-wrap gap-4 items-center">
|
|
42
|
-
<Textarea disabled {...args} className="w-[350px]" placeholder="Disabled" />
|
|
43
|
-
</div>
|
|
44
|
-
),
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const ManagedResizing: Story = {
|
|
48
|
-
render: () => (
|
|
49
|
-
<div className="flex flex-col gap-4 items-center">
|
|
50
|
-
<Textarea className="h-12.5 w-[350px] resize-none" placeholder="No resizing - locked 2 lines 350px" />
|
|
51
|
-
<Textarea
|
|
52
|
-
className="min-h-6.5 max-h-24.5 w-[350px] resize-y"
|
|
53
|
-
placeholder="Vertical resizing - minimum 2, maximum 5 lines."
|
|
54
|
-
/>
|
|
55
|
-
<Textarea
|
|
56
|
-
className="h-15.5 min-w-[200px] w-[350px] max-w-[500px] resize-x"
|
|
57
|
-
placeholder="Horizontal resizing - minimum 200px, maximum 500px."
|
|
58
|
-
/>
|
|
59
|
-
<Textarea
|
|
60
|
-
className="min-h-12.5 min-w-[200px] max-h-24.5 max-w-[500px] w-[350px] resize"
|
|
61
|
-
placeholder="Free resizing - minimum 200px 2 lines, maximum 500px 5 lines"
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
),
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const EmailForm: Story = {
|
|
68
|
-
render: () => {
|
|
69
|
-
const [value, setValue] = useState('')
|
|
70
|
-
const [error, setError] = useState<string | null>(null)
|
|
71
|
-
const [submitted, setSubmitted] = useState(false)
|
|
72
|
-
const [touched, setTouched] = useState(false)
|
|
73
|
-
|
|
74
|
-
function validateEmail(email: string) {
|
|
75
|
-
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) // simple email regex
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function validate(value: string) {
|
|
79
|
-
if (!value) return 'Field is required.'
|
|
80
|
-
if (!validateEmail(value)) return 'Not a valid email.'
|
|
81
|
-
return null
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const handleSubmit = (e: React.FormEvent) => {
|
|
85
|
-
e.preventDefault()
|
|
86
|
-
setSubmitted(true)
|
|
87
|
-
setError(validate(value))
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const handleBlur = () => {
|
|
91
|
-
setTouched(true)
|
|
92
|
-
setError(validate(value))
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<form className="flex flex-col gap-2 items-center w-[350px]" onSubmit={handleSubmit} noValidate>
|
|
97
|
-
<Textarea
|
|
98
|
-
className="w-full"
|
|
99
|
-
placeholder="Enter an email..."
|
|
100
|
-
value={value}
|
|
101
|
-
onChange={(e) => {
|
|
102
|
-
setValue(e.target.value)
|
|
103
|
-
if (submitted || touched) setError(validate(e.target.value))
|
|
104
|
-
}}
|
|
105
|
-
onBlur={handleBlur}
|
|
106
|
-
aria-invalid={!!error}
|
|
107
|
-
/>
|
|
108
|
-
{error && (touched || submitted) && (
|
|
109
|
-
<span className="text-destructive mt-1" role="alert">
|
|
110
|
-
{error}
|
|
111
|
-
</span>
|
|
112
|
-
)}
|
|
113
|
-
<Button type="submit" size="smLow">
|
|
114
|
-
Submit
|
|
115
|
-
</Button>
|
|
116
|
-
</form>
|
|
117
|
-
)
|
|
118
|
-
},
|
|
119
|
-
play: async ({ canvasElement }) => {
|
|
120
|
-
const canvas = within(canvasElement)
|
|
121
|
-
const textarea = canvas.getByPlaceholderText('Enter an email...')
|
|
122
|
-
const submitButton = canvas.getByRole('button', { name: /submit/i })
|
|
123
|
-
|
|
124
|
-
// Submit with empty input
|
|
125
|
-
await userEvent.clear(textarea)
|
|
126
|
-
await userEvent.click(submitButton)
|
|
127
|
-
expect(await canvas.findByRole('alert')).toHaveTextContent('Field is required.')
|
|
128
|
-
// Enter invalid email and submit
|
|
129
|
-
await userEvent.type(textarea, 'not-an-email')
|
|
130
|
-
await userEvent.click(submitButton)
|
|
131
|
-
expect(await canvas.findByRole('alert')).toHaveTextContent('Not a valid email.')
|
|
132
|
-
// Enter valid email and submit
|
|
133
|
-
await userEvent.clear(textarea)
|
|
134
|
-
await userEvent.type(textarea, 'test@example.com')
|
|
135
|
-
await userEvent.click(submitButton)
|
|
136
|
-
expect(canvas.queryByRole('alert')).toBeNull()
|
|
137
|
-
},
|
|
138
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@lib/utils'
|
|
5
|
-
|
|
6
|
-
const textareaVariants = cva(
|
|
7
|
-
'border-input placeholder:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
|
12
|
-
simple: '',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
defaultVariants: {
|
|
16
|
-
variant: 'default',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
type TextareaProps = React.ComponentProps<'textarea'> &
|
|
22
|
-
VariantProps<typeof textareaVariants> & {
|
|
23
|
-
/**
|
|
24
|
-
* E2E test_id to identify the input.
|
|
25
|
-
*/
|
|
26
|
-
__e2e_test_id__?: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function Textarea({ className, variant, __e2e_test_id__, ...props }: TextareaProps) {
|
|
30
|
-
return (
|
|
31
|
-
<textarea
|
|
32
|
-
data-slot="textarea"
|
|
33
|
-
className={cn(textareaVariants({ variant, className }))}
|
|
34
|
-
{...props}
|
|
35
|
-
data-test-id={__e2e_test_id__}
|
|
36
|
-
/>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { Textarea }
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from '@storybook/addon-docs/blocks'
|
|
2
|
-
|
|
3
|
-
import * as ToastStories from './toast.stories.tsx';
|
|
4
|
-
|
|
5
|
-
<Meta of={ToastStories} />
|
|
6
|
-
|
|
7
|
-
# Toast with Sonner
|
|
8
|
-
|
|
9
|
-
We create a toast with sonner. For more documentation, please check the [Sonner Docs](https://sonner.emilkowal.ski/) repository.
|
|
10
|
-
|
|
11
|
-
### Usage
|
|
12
|
-
```tsx
|
|
13
|
-
import { Toaster, toast } from 'sonner'
|
|
14
|
-
|
|
15
|
-
// ...
|
|
16
|
-
|
|
17
|
-
function App() {
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<Toaster />
|
|
21
|
-
<button onClick={() => toast('My first toast')}>
|
|
22
|
-
Give me a toast
|
|
23
|
-
</button>
|
|
24
|
-
</div>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
<Canvas of={ToastStories.ToastExamples} />
|
|
30
|
-
|
|
31
|
-
<Controls />
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Button } from '@components/ui/button/button'
|
|
2
|
-
import { toast, Toaster } from 'sonner'
|
|
3
|
-
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Toaster> = {
|
|
6
|
-
title: 'Toast',
|
|
7
|
-
parameters: {},
|
|
8
|
-
argTypes: {
|
|
9
|
-
closeButton: {
|
|
10
|
-
control: 'boolean',
|
|
11
|
-
},
|
|
12
|
-
richColors: {
|
|
13
|
-
control: 'boolean',
|
|
14
|
-
},
|
|
15
|
-
position: {
|
|
16
|
-
control: 'select',
|
|
17
|
-
options: ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'],
|
|
18
|
-
},
|
|
19
|
-
expand: {
|
|
20
|
-
control: 'boolean',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default meta
|
|
26
|
-
|
|
27
|
-
export const ToastExamples: StoryObj<typeof meta> = {
|
|
28
|
-
args: {
|
|
29
|
-
closeButton: false,
|
|
30
|
-
richColors: true,
|
|
31
|
-
position: 'bottom-right',
|
|
32
|
-
expand: false,
|
|
33
|
-
},
|
|
34
|
-
render: (args) => (
|
|
35
|
-
<div className="h-[250px]">
|
|
36
|
-
<Toaster
|
|
37
|
-
position={args.position}
|
|
38
|
-
expand={args.expand}
|
|
39
|
-
richColors={args.richColors}
|
|
40
|
-
closeButton={args.closeButton}
|
|
41
|
-
/>
|
|
42
|
-
<div className="flex gap-2">
|
|
43
|
-
<Button variant="outline" onClick={() => toast('default toast message')}>
|
|
44
|
-
default toast
|
|
45
|
-
</Button>
|
|
46
|
-
<Button variant="outline" onClick={() => toast.error('uh oh')}>
|
|
47
|
-
error toast
|
|
48
|
-
</Button>
|
|
49
|
-
<Button
|
|
50
|
-
variant="outline"
|
|
51
|
-
onClick={() =>
|
|
52
|
-
toast('Event has been created', {
|
|
53
|
-
action: {
|
|
54
|
-
label: 'Undo',
|
|
55
|
-
onClick: () => alert('can not be undone *hohoho'),
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
>
|
|
60
|
-
action toast
|
|
61
|
-
</Button>
|
|
62
|
-
<Button
|
|
63
|
-
variant="outline"
|
|
64
|
-
onClick={() =>
|
|
65
|
-
toast.message('Event has been created', {
|
|
66
|
-
description: 'Monday, January 3rd at 6:00pm',
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
>
|
|
70
|
-
description toast
|
|
71
|
-
</Button>
|
|
72
|
-
<Button
|
|
73
|
-
variant="outline"
|
|
74
|
-
onClick={() =>
|
|
75
|
-
toast.custom((t) => (
|
|
76
|
-
<div className="flex flex-col border border-border p-3 gap-2 rounded shadow bg-(--sidebar-primary-foreground)">
|
|
77
|
-
<h2>such a beautiful toast</h2>
|
|
78
|
-
<p className="mb-2">lorem ipsum dolor sit amet</p>
|
|
79
|
-
<button onClick={() => toast.dismiss(t)}>Dismiss</button>
|
|
80
|
-
</div>
|
|
81
|
-
))
|
|
82
|
-
}
|
|
83
|
-
>
|
|
84
|
-
bla
|
|
85
|
-
</Button>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
),
|
|
89
|
-
}
|