@umami/shiso 0.54.0 → 0.61.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +9 -49
  3. package/bin/shiso.mjs +132 -0
  4. package/docs.schema.json +835 -0
  5. package/mdx.config.ts +143 -0
  6. package/package.json +73 -83
  7. package/scripts/check-package.mjs +18 -0
  8. package/scripts/generate-icon-registry.mjs +196 -0
  9. package/scripts/generate-last-modified.mjs +128 -0
  10. package/scripts/generate-search-index.mjs +252 -0
  11. package/scripts/load-docs-config.mjs +244 -0
  12. package/scripts/prerender.mjs +187 -0
  13. package/scripts/validate-config.mjs +104 -0
  14. package/scripts/vite-docs-config.mjs +60 -0
  15. package/src/App.tsx +39 -0
  16. package/src/components/Banner.tsx +69 -0
  17. package/src/components/CodeBlock.tsx +46 -0
  18. package/src/components/ConfiguredIcon.tsx +15 -0
  19. package/src/components/ContextualMenu.tsx +93 -0
  20. package/src/components/DocContent.tsx +100 -0
  21. package/src/components/Docs.tsx +126 -0
  22. package/src/components/Footer.tsx +84 -0
  23. package/src/components/Header.tsx +72 -0
  24. package/src/components/Layout.tsx +16 -0
  25. package/src/components/PageLinks.tsx +71 -0
  26. package/src/components/Search.tsx +208 -0
  27. package/src/components/SideNav.tsx +347 -0
  28. package/src/components/SocialIcon.tsx +88 -0
  29. package/src/components/ThemeToggle.tsx +34 -0
  30. package/src/components/TopNav.tsx +127 -0
  31. package/src/components/docs/Accordion.tsx +68 -0
  32. package/src/components/docs/Badge.tsx +171 -0
  33. package/src/components/docs/Callout.tsx +73 -0
  34. package/src/components/docs/Card.tsx +158 -0
  35. package/src/components/docs/CodeGroup.tsx +73 -0
  36. package/src/components/docs/Columns.tsx +20 -0
  37. package/src/components/docs/Expandable.tsx +28 -0
  38. package/src/components/docs/Frame.tsx +56 -0
  39. package/src/components/docs/Icon.tsx +30 -0
  40. package/src/components/docs/ParamField.tsx +45 -0
  41. package/src/components/docs/PropertiesTable.tsx +84 -0
  42. package/src/components/docs/ResponseField.tsx +36 -0
  43. package/src/components/docs/Steps.tsx +47 -0
  44. package/src/components/docs/Tabs.tsx +116 -0
  45. package/src/components/docs/Tooltip.tsx +21 -0
  46. package/src/components/docs/index.ts +15 -0
  47. package/src/components/docs/styles.ts +82 -0
  48. package/src/components/docs/utils.ts +118 -0
  49. package/src/components/icons/index.ts +17 -0
  50. package/src/components/ui/accordion.tsx +69 -0
  51. package/src/components/ui/alert.tsx +69 -0
  52. package/src/components/ui/badge.tsx +49 -0
  53. package/src/components/ui/button.tsx +58 -0
  54. package/src/components/ui/card.tsx +88 -0
  55. package/src/components/ui/collapsible.tsx +15 -0
  56. package/src/components/ui/command.tsx +173 -0
  57. package/src/components/ui/dialog.tsx +137 -0
  58. package/src/components/ui/dropdown-menu.tsx +257 -0
  59. package/src/components/ui/scroll-area.tsx +71 -0
  60. package/src/components/ui/sheet.tsx +124 -0
  61. package/src/components/ui/tabs.tsx +73 -0
  62. package/src/components/ui/tooltip.tsx +52 -0
  63. package/src/declarations.d.ts +9 -0
  64. package/src/entry-client.tsx +17 -0
  65. package/src/entry-server.tsx +77 -0
  66. package/src/generated/last-modified.ts +2 -0
  67. package/src/lib/content.ts +44 -0
  68. package/src/lib/docs-config.ts +682 -0
  69. package/src/lib/head.ts +220 -0
  70. package/src/lib/icon-registry.generated.ts +4 -0
  71. package/src/lib/icons.ts +29 -0
  72. package/src/lib/inline-markdown.tsx +86 -0
  73. package/src/lib/mdast.ts +56 -0
  74. package/src/lib/paths.ts +86 -0
  75. package/src/lib/remark-toc.ts +71 -0
  76. package/src/lib/search/config.ts +43 -0
  77. package/src/lib/search/provider.ts +80 -0
  78. package/src/lib/search/providers/local.ts +15 -0
  79. package/src/lib/search-index.generated.ts +4 -0
  80. package/src/lib/search.ts +100 -0
  81. package/src/lib/site-config.ts +104 -0
  82. package/src/lib/site-model.ts +221 -0
  83. package/src/lib/slug.ts +38 -0
  84. package/src/lib/types.ts +478 -0
  85. package/src/lib/utils.ts +6 -0
  86. package/src/pages/DocPage.tsx +33 -0
  87. package/src/styles/global.css +268 -0
  88. package/src/styles/tokens.css +114 -0
  89. package/types/client.d.ts +3 -0
  90. package/types/search.d.ts +17 -0
  91. package/vite.config.ts +342 -0
  92. package/LICENSE +0 -21
  93. package/dist/index.css +0 -189
  94. package/dist/index.d.ts +0 -57
  95. package/dist/index.js +0 -464
  96. package/dist/index.mjs +0 -437
  97. package/server/index.d.ts +0 -30
  98. package/server/index.js +0 -189
  99. package/styles.css +0 -4766
@@ -0,0 +1,49 @@
1
+ import { mergeProps } from '@base-ui/react/merge-props';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import { cva, type VariantProps } from 'class-variance-authority';
4
+
5
+ import { cn } from '@/lib/utils';
6
+
7
+ const badgeVariants = cva(
8
+ 'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!',
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
13
+ secondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',
14
+ destructive:
15
+ 'bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20',
16
+ outline: 'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground',
17
+ ghost: 'hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50',
18
+ link: 'text-primary underline-offset-4 hover:underline',
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ variant: 'default',
23
+ },
24
+ },
25
+ );
26
+
27
+ function Badge({
28
+ className,
29
+ variant = 'default',
30
+ render,
31
+ ...props
32
+ }: useRender.ComponentProps<'span'> & VariantProps<typeof badgeVariants>) {
33
+ return useRender({
34
+ defaultTagName: 'span',
35
+ props: mergeProps<'span'>(
36
+ {
37
+ className: cn(badgeVariants({ variant }), className),
38
+ },
39
+ props,
40
+ ),
41
+ render,
42
+ state: {
43
+ slot: 'badge',
44
+ variant,
45
+ },
46
+ });
47
+ }
48
+
49
+ export { Badge, badgeVariants };
@@ -0,0 +1,58 @@
1
+ import { Button as ButtonPrimitive } from '@base-ui/react/button';
2
+ import { cva, type VariantProps } from 'class-variance-authority';
3
+
4
+ import { cn } from '@/lib/utils';
5
+
6
+ const buttonVariants = cva(
7
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: 'bg-primary text-primary-foreground hover:bg-primary/80',
12
+ outline:
13
+ 'border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50',
14
+ secondary:
15
+ 'bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
16
+ ghost:
17
+ 'hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50',
18
+ destructive:
19
+ 'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40',
20
+ link: 'text-primary underline-offset-4 hover:underline',
21
+ },
22
+ size: {
23
+ default:
24
+ 'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
25
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
26
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
27
+ lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
28
+ icon: 'size-8',
29
+ 'icon-xs':
30
+ "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
31
+ 'icon-sm':
32
+ 'size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
33
+ 'icon-lg': 'size-9',
34
+ },
35
+ },
36
+ defaultVariants: {
37
+ variant: 'default',
38
+ size: 'default',
39
+ },
40
+ },
41
+ );
42
+
43
+ function Button({
44
+ className,
45
+ variant = 'default',
46
+ size = 'default',
47
+ ...props
48
+ }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
49
+ return (
50
+ <ButtonPrimitive
51
+ data-slot="button"
52
+ className={cn(buttonVariants({ variant, size, className }))}
53
+ {...props}
54
+ />
55
+ );
56
+ }
57
+
58
+ export { Button, buttonVariants };
@@ -0,0 +1,88 @@
1
+ import type * as React from 'react';
2
+
3
+ import { cn } from '@/lib/utils';
4
+
5
+ function Card({
6
+ className,
7
+ size = 'default',
8
+ ...props
9
+ }: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {
10
+ return (
11
+ <div
12
+ data-slot="card"
13
+ data-size={size}
14
+ className={cn(
15
+ 'group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',
16
+ className,
17
+ )}
18
+ {...props}
19
+ />
20
+ );
21
+ }
22
+
23
+ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
24
+ return (
25
+ <div
26
+ data-slot="card-header"
27
+ className={cn(
28
+ 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',
29
+ className,
30
+ )}
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
37
+ return (
38
+ <div
39
+ data-slot="card-title"
40
+ className={cn(
41
+ 'text-base leading-snug font-medium group-data-[size=sm]/card:text-sm',
42
+ className,
43
+ )}
44
+ {...props}
45
+ />
46
+ );
47
+ }
48
+
49
+ function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
50
+ return (
51
+ <div
52
+ data-slot="card-description"
53
+ className={cn('text-sm text-muted-foreground', className)}
54
+ {...props}
55
+ />
56
+ );
57
+ }
58
+
59
+ function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
60
+ return (
61
+ <div
62
+ data-slot="card-action"
63
+ className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}
64
+ {...props}
65
+ />
66
+ );
67
+ }
68
+
69
+ function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
70
+ return (
71
+ <div data-slot="card-content" className={cn('px-(--card-spacing)', className)} {...props} />
72
+ );
73
+ }
74
+
75
+ function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
76
+ return (
77
+ <div
78
+ data-slot="card-footer"
79
+ className={cn(
80
+ 'flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)',
81
+ className,
82
+ )}
83
+ {...props}
84
+ />
85
+ );
86
+ }
87
+
88
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,15 @@
1
+ import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';
2
+
3
+ function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
4
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
5
+ }
6
+
7
+ function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
8
+ return <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />;
9
+ }
10
+
11
+ function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
12
+ return <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />;
13
+ }
14
+
15
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
@@ -0,0 +1,173 @@
1
+ import { Command as CommandPrimitive } from 'cmdk';
2
+ import { CheckIcon, SearchIcon } from 'lucide-react';
3
+ import type * as React from 'react';
4
+ import {
5
+ Dialog,
6
+ DialogContent,
7
+ DialogDescription,
8
+ DialogHeader,
9
+ DialogTitle,
10
+ } from '@/components/ui/dialog';
11
+ import { cn } from '@/lib/utils';
12
+
13
+ function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
14
+ return (
15
+ <CommandPrimitive
16
+ data-slot="command"
17
+ className={cn(
18
+ 'flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground',
19
+ className,
20
+ )}
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+
26
+ function CommandDialog({
27
+ title = 'Command Palette',
28
+ description = 'Search for a command to run...',
29
+ children,
30
+ className,
31
+ showCloseButton = false,
32
+ ...props
33
+ }: Omit<React.ComponentProps<typeof Dialog>, 'children'> & {
34
+ title?: string;
35
+ description?: string;
36
+ className?: string;
37
+ showCloseButton?: boolean;
38
+ children: React.ReactNode;
39
+ }) {
40
+ return (
41
+ <Dialog {...props}>
42
+ <DialogHeader className="sr-only">
43
+ <DialogTitle>{title}</DialogTitle>
44
+ <DialogDescription>{description}</DialogDescription>
45
+ </DialogHeader>
46
+ <DialogContent
47
+ className={cn('top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0', className)}
48
+ showCloseButton={showCloseButton}
49
+ >
50
+ {children}
51
+ </DialogContent>
52
+ </Dialog>
53
+ );
54
+ }
55
+
56
+ function CommandInput({
57
+ className,
58
+ ...props
59
+ }: React.ComponentProps<typeof CommandPrimitive.Input>) {
60
+ return (
61
+ <div data-slot="command-input-wrapper" className="flex items-center gap-2 px-4 py-3">
62
+ <SearchIcon className="size-4 shrink-0 text-muted-foreground" />
63
+ <CommandPrimitive.Input
64
+ data-slot="command-input"
65
+ className={cn(
66
+ 'w-full border-0 bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
67
+ className,
68
+ )}
69
+ {...props}
70
+ />
71
+ </div>
72
+ );
73
+ }
74
+
75
+ function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
76
+ return (
77
+ <CommandPrimitive.List
78
+ data-slot="command-list"
79
+ className={cn(
80
+ 'no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none',
81
+ className,
82
+ )}
83
+ {...props}
84
+ />
85
+ );
86
+ }
87
+
88
+ function CommandEmpty({
89
+ className,
90
+ ...props
91
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
92
+ return (
93
+ <CommandPrimitive.Empty
94
+ data-slot="command-empty"
95
+ className={cn('py-6 text-center text-sm', className)}
96
+ {...props}
97
+ />
98
+ );
99
+ }
100
+
101
+ function CommandGroup({
102
+ className,
103
+ ...props
104
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
105
+ return (
106
+ <CommandPrimitive.Group
107
+ data-slot="command-group"
108
+ className={cn(
109
+ 'overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground',
110
+ className,
111
+ )}
112
+ {...props}
113
+ />
114
+ );
115
+ }
116
+
117
+ function CommandSeparator({
118
+ className,
119
+ ...props
120
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
121
+ return (
122
+ <CommandPrimitive.Separator
123
+ data-slot="command-separator"
124
+ className={cn('-mx-1 h-px bg-border', className)}
125
+ {...props}
126
+ />
127
+ );
128
+ }
129
+
130
+ function CommandItem({
131
+ className,
132
+ children,
133
+ ...props
134
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) {
135
+ return (
136
+ <CommandPrimitive.Item
137
+ data-slot="command-item"
138
+ className={cn(
139
+ "group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",
140
+ className,
141
+ )}
142
+ {...props}
143
+ >
144
+ {children}
145
+ <CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
146
+ </CommandPrimitive.Item>
147
+ );
148
+ }
149
+
150
+ function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
151
+ return (
152
+ <span
153
+ data-slot="command-shortcut"
154
+ className={cn(
155
+ 'ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground',
156
+ className,
157
+ )}
158
+ {...props}
159
+ />
160
+ );
161
+ }
162
+
163
+ export {
164
+ Command,
165
+ CommandDialog,
166
+ CommandEmpty,
167
+ CommandGroup,
168
+ CommandInput,
169
+ CommandItem,
170
+ CommandList,
171
+ CommandSeparator,
172
+ CommandShortcut,
173
+ };
@@ -0,0 +1,137 @@
1
+ import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
2
+ import { XIcon } from 'lucide-react';
3
+ import type * as React from 'react';
4
+ import { Button } from '@/components/ui/button';
5
+ import { cn } from '@/lib/utils';
6
+
7
+ function Dialog({ ...props }: DialogPrimitive.Root.Props) {
8
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
9
+ }
10
+
11
+ function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
12
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
13
+ }
14
+
15
+ function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
16
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
17
+ }
18
+
19
+ function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
20
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
21
+ }
22
+
23
+ function DialogOverlay({ className, ...props }: DialogPrimitive.Backdrop.Props) {
24
+ return (
25
+ <DialogPrimitive.Backdrop
26
+ data-slot="dialog-overlay"
27
+ className={cn(
28
+ 'fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
29
+ className,
30
+ )}
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ function DialogContent({
37
+ className,
38
+ children,
39
+ showCloseButton = true,
40
+ overlayClassName,
41
+ ...props
42
+ }: DialogPrimitive.Popup.Props & {
43
+ showCloseButton?: boolean;
44
+ overlayClassName?: string;
45
+ }) {
46
+ return (
47
+ <DialogPortal>
48
+ <DialogOverlay className={overlayClassName} />
49
+ <DialogPrimitive.Popup
50
+ data-slot="dialog-content"
51
+ className={cn(
52
+ 'fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
53
+ className,
54
+ )}
55
+ {...props}
56
+ >
57
+ {children}
58
+ {showCloseButton && (
59
+ <DialogPrimitive.Close
60
+ data-slot="dialog-close"
61
+ render={<Button variant="ghost" className="absolute top-2 right-2" size="icon-sm" />}
62
+ >
63
+ <XIcon />
64
+ <span className="sr-only">Close</span>
65
+ </DialogPrimitive.Close>
66
+ )}
67
+ </DialogPrimitive.Popup>
68
+ </DialogPortal>
69
+ );
70
+ }
71
+
72
+ function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
73
+ return (
74
+ <div data-slot="dialog-header" className={cn('flex flex-col gap-2', className)} {...props} />
75
+ );
76
+ }
77
+
78
+ function DialogFooter({
79
+ className,
80
+ showCloseButton = false,
81
+ children,
82
+ ...props
83
+ }: React.ComponentProps<'div'> & {
84
+ showCloseButton?: boolean;
85
+ }) {
86
+ return (
87
+ <div
88
+ data-slot="dialog-footer"
89
+ className={cn(
90
+ '-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end',
91
+ className,
92
+ )}
93
+ {...props}
94
+ >
95
+ {children}
96
+ {showCloseButton && (
97
+ <DialogPrimitive.Close render={<Button variant="outline" />}>Close</DialogPrimitive.Close>
98
+ )}
99
+ </div>
100
+ );
101
+ }
102
+
103
+ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
104
+ return (
105
+ <DialogPrimitive.Title
106
+ data-slot="dialog-title"
107
+ className={cn('text-base leading-none font-medium', className)}
108
+ {...props}
109
+ />
110
+ );
111
+ }
112
+
113
+ function DialogDescription({ className, ...props }: DialogPrimitive.Description.Props) {
114
+ return (
115
+ <DialogPrimitive.Description
116
+ data-slot="dialog-description"
117
+ className={cn(
118
+ 'text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
119
+ className,
120
+ )}
121
+ {...props}
122
+ />
123
+ );
124
+ }
125
+
126
+ export {
127
+ Dialog,
128
+ DialogClose,
129
+ DialogContent,
130
+ DialogDescription,
131
+ DialogFooter,
132
+ DialogHeader,
133
+ DialogOverlay,
134
+ DialogPortal,
135
+ DialogTitle,
136
+ DialogTrigger,
137
+ };