livemark 0.2.0 → 0.7.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/LICENSE.md +9 -0
- package/README.md +5 -1
- package/build/actions/changelog/build.d.ts +14 -0
- package/build/actions/changelog/build.js +158 -0
- package/build/actions/changelog/build.unit.js +66 -0
- package/build/actions/config/define.d.ts +6 -0
- package/build/actions/config/define.js +8 -0
- package/build/actions/config/define.unit.js +29 -0
- package/build/actions/config/load.d.ts +5 -0
- package/build/actions/config/load.js +25 -0
- package/build/actions/config/load.unit.js +23 -0
- package/build/commands/build.d.ts +5 -0
- package/build/commands/build.js +14 -0
- package/build/commands/escape.d.ts +9 -0
- package/build/commands/escape.js +56 -0
- package/build/commands/preview.d.ts +5 -0
- package/build/commands/preview.js +18 -0
- package/build/commands/start.d.ts +5 -0
- package/build/commands/start.js +19 -0
- package/build/docs/markdown/includes/example.d.ts +58 -0
- package/build/docs/markdown/includes/example.js +5 -0
- package/build/entrypoints/main.d.ts +2 -0
- package/build/entrypoints/main.js +12 -0
- package/build/helpers/program.d.ts +2 -0
- package/build/helpers/program.js +5 -0
- package/build/index.d.ts +1 -4
- package/build/index.js +2 -5
- package/build/livemark.config.d.ts +58 -0
- package/build/livemark.config.js +25 -0
- package/build/models/config.d.ts +340 -0
- package/build/models/config.js +34 -0
- package/build/models/link.d.ts +13 -0
- package/build/models/link.js +9 -0
- package/build/models/patch.d.ts +21 -0
- package/build/models/patch.js +7 -0
- package/build/models/section.d.ts +75 -0
- package/build/models/section.js +26 -0
- package/build/models/theme.d.ts +72 -0
- package/build/models/theme.js +73 -0
- package/build/program.d.ts +2 -0
- package/build/program.js +16 -0
- package/build/vite.config.d.ts +2 -0
- package/build/vite.config.js +48 -0
- package/build/website/assets/logo.svg +117 -0
- package/build/website/client.tsx +10 -0
- package/build/website/components/Abbr.tsx +17 -0
- package/build/website/components/AnsiCode.tsx +15 -0
- package/build/website/components/Article.tsx +172 -0
- package/build/website/components/BackToTop.tsx +32 -0
- package/build/website/components/Banner.tsx +32 -0
- package/build/website/components/BlogIndex.tsx +121 -0
- package/build/website/components/BlogSidebar.tsx +162 -0
- package/build/website/components/Breadcrumbs.tsx +22 -0
- package/build/website/components/Callout.tsx +72 -0
- package/build/website/components/Card.tsx +48 -0
- package/build/website/components/Cards.tsx +8 -0
- package/build/website/components/ChangelogIndex.tsx +111 -0
- package/build/website/components/ChangelogSidebar.tsx +120 -0
- package/build/website/components/CodeBlock.tsx +135 -0
- package/build/website/components/CodeTabs.tsx +83 -0
- package/build/website/components/Column.tsx +4 -0
- package/build/website/components/Columns.tsx +12 -0
- package/build/website/components/Content.tsx +7 -0
- package/build/website/components/ContentTab.tsx +7 -0
- package/build/website/components/ContentTabs.tsx +82 -0
- package/build/website/components/DefaultCatchBoundary.tsx +54 -0
- package/build/website/components/DefinitionList.tsx +21 -0
- package/build/website/components/Details.tsx +30 -0
- package/build/website/components/FileTree.tsx +52 -0
- package/build/website/components/Footer.tsx +16 -0
- package/build/website/components/FootnoteRef.tsx +52 -0
- package/build/website/components/Heading.tsx +20 -0
- package/build/website/components/InlineBadge.tsx +9 -0
- package/build/website/components/InlineIcon.tsx +10 -0
- package/build/website/components/InlineToc.tsx +31 -0
- package/build/website/components/Layout.tsx +190 -0
- package/build/website/components/LinkButton.tsx +31 -0
- package/build/website/components/Mermaid.tsx +18 -0
- package/build/website/components/MermaidRenderer.tsx +37 -0
- package/build/website/components/MiniSidebar.tsx +49 -0
- package/build/website/components/NotFound.tsx +27 -0
- package/build/website/components/PackageTabs.tsx +74 -0
- package/build/website/components/PageToolbar.tsx +75 -0
- package/build/website/components/PrevNext.tsx +60 -0
- package/build/website/components/Search.tsx +28 -0
- package/build/website/components/SearchDialog.tsx +245 -0
- package/build/website/components/Section.tsx +24 -0
- package/build/website/components/SectionHeader.tsx +35 -0
- package/build/website/components/Sidebar.tsx +160 -0
- package/build/website/components/SidebarLinks.tsx +70 -0
- package/build/website/components/SidebarSections.tsx +71 -0
- package/build/website/components/SiteTitle.tsx +21 -0
- package/build/website/components/SortableTable.tsx +81 -0
- package/build/website/components/SoundCloud.tsx +16 -0
- package/build/website/components/TagIndex.tsx +120 -0
- package/build/website/components/Theme.tsx +39 -0
- package/build/website/components/Toc.tsx +226 -0
- package/build/website/components/YouTube.tsx +16 -0
- package/build/website/components/ZoomImage.tsx +25 -0
- package/build/website/content/article.ts +78 -0
- package/build/website/content/tag.ts +29 -0
- package/build/website/content-collections.ts +208 -0
- package/build/website/elements/accordion.tsx +78 -0
- package/build/website/elements/alert-dialog.tsx +185 -0
- package/build/website/elements/alert.tsx +74 -0
- package/build/website/elements/aspect-ratio.tsx +22 -0
- package/build/website/elements/avatar.tsx +107 -0
- package/build/website/elements/badge.tsx +51 -0
- package/build/website/elements/breadcrumb.tsx +120 -0
- package/build/website/elements/button-group.tsx +87 -0
- package/build/website/elements/button.tsx +57 -0
- package/build/website/elements/calendar.tsx +229 -0
- package/build/website/elements/card.tsx +102 -0
- package/build/website/elements/carousel.tsx +240 -0
- package/build/website/elements/chart.tsx +372 -0
- package/build/website/elements/checkbox.tsx +26 -0
- package/build/website/elements/collapsible.tsx +19 -0
- package/build/website/elements/command.tsx +210 -0
- package/build/website/elements/context-menu.tsx +270 -0
- package/build/website/elements/dialog.tsx +152 -0
- package/build/website/elements/direction.tsx +4 -0
- package/build/website/elements/drawer.tsx +127 -0
- package/build/website/elements/dropdown-menu.tsx +260 -0
- package/build/website/elements/empty.tsx +104 -0
- package/build/website/elements/field.tsx +235 -0
- package/build/website/elements/hover-card.tsx +49 -0
- package/build/website/elements/input-group.tsx +171 -0
- package/build/website/elements/input-otp.tsx +84 -0
- package/build/website/elements/input.tsx +18 -0
- package/build/website/elements/item.tsx +199 -0
- package/build/website/elements/kbd.tsx +26 -0
- package/build/website/elements/label.tsx +17 -0
- package/build/website/elements/menubar.tsx +282 -0
- package/build/website/elements/native-select.tsx +56 -0
- package/build/website/elements/navigation-menu.tsx +171 -0
- package/build/website/elements/pagination.tsx +133 -0
- package/build/website/elements/popover.tsx +88 -0
- package/build/website/elements/progress.tsx +81 -0
- package/build/website/elements/radio-group.tsx +36 -0
- package/build/website/elements/resizable.tsx +48 -0
- package/build/website/elements/scroll-area.tsx +51 -0
- package/build/website/elements/select.tsx +200 -0
- package/build/website/elements/separator.tsx +22 -0
- package/build/website/elements/sheet.tsx +130 -0
- package/build/website/elements/sidebar.tsx +717 -0
- package/build/website/elements/skeleton.tsx +13 -0
- package/build/website/elements/slider.tsx +57 -0
- package/build/website/elements/sonner.tsx +40 -0
- package/build/website/elements/spinner.tsx +16 -0
- package/build/website/elements/switch.tsx +30 -0
- package/build/website/elements/table.tsx +112 -0
- package/build/website/elements/tabs.tsx +79 -0
- package/build/website/elements/textarea.tsx +16 -0
- package/build/website/elements/toggle-group.tsx +87 -0
- package/build/website/elements/toggle.tsx +43 -0
- package/build/website/elements/tooltip.tsx +67 -0
- package/build/website/env.d.ts +14 -0
- package/build/website/helpers/article-icon.ts +61 -0
- package/build/website/helpers/article.ts +90 -0
- package/build/website/helpers/changelog-source.ts +16 -0
- package/build/website/helpers/changelog-source.unit.ts +38 -0
- package/build/website/helpers/dynamic-icon-resolver.tsx +19 -0
- package/build/website/helpers/dynamic-icon.tsx +12 -0
- package/build/website/helpers/favicon.ts +7 -0
- package/build/website/helpers/model.ts +4 -0
- package/build/website/helpers/resolve-asset-path.ts +9 -0
- package/build/website/helpers/resolve-includes.ts +131 -0
- package/build/website/helpers/resolve-includes.unit.ts +126 -0
- package/build/website/helpers/search-text.ts +15 -0
- package/build/website/helpers/section.ts +50 -0
- package/build/website/helpers/section.unit.ts +71 -0
- package/build/website/helpers/style.ts +6 -0
- package/build/website/helpers/theme.ts +27 -0
- package/build/website/helpers/toc-context.ts +10 -0
- package/build/website/helpers/toc.ts +46 -0
- package/build/website/helpers/toc.unit.ts +74 -0
- package/build/website/hooks/in-view.ts +30 -0
- package/build/website/hooks/media.ts +19 -0
- package/build/website/models/article.ts +55 -0
- package/build/website/models/toc.ts +5 -0
- package/build/website/plugins/rehype-inline-code.ts +107 -0
- package/build/website/plugins/rehype-task-list-a11y.ts +33 -0
- package/build/website/plugins/remark-abbr.ts +46 -0
- package/build/website/plugins/remark-abbr.unit.ts +99 -0
- package/build/website/plugins/remark-ansi.ts +248 -0
- package/build/website/plugins/remark-ansi.unit.ts +197 -0
- package/build/website/plugins/remark-badge.ts +50 -0
- package/build/website/plugins/remark-badge.unit.ts +96 -0
- package/build/website/plugins/remark-button.ts +60 -0
- package/build/website/plugins/remark-button.unit.ts +147 -0
- package/build/website/plugins/remark-callout.ts +57 -0
- package/build/website/plugins/remark-card.ts +80 -0
- package/build/website/plugins/remark-code-tabs.ts +87 -0
- package/build/website/plugins/remark-columns.ts +66 -0
- package/build/website/plugins/remark-custom-heading-id.ts +70 -0
- package/build/website/plugins/remark-custom-heading-id.unit.ts +131 -0
- package/build/website/plugins/remark-deflist.ts +36 -0
- package/build/website/plugins/remark-details.ts +49 -0
- package/build/website/plugins/remark-filetree.ts +89 -0
- package/build/website/plugins/remark-filetree.unit.ts +137 -0
- package/build/website/plugins/remark-github-callout.ts +71 -0
- package/build/website/plugins/remark-icon.ts +42 -0
- package/build/website/plugins/remark-image.ts +34 -0
- package/build/website/plugins/remark-media.ts +62 -0
- package/build/website/plugins/remark-media.unit.ts +74 -0
- package/build/website/plugins/remark-mermaid.ts +23 -0
- package/build/website/plugins/remark-npm.ts +52 -0
- package/build/website/plugins/remark-steps.ts +36 -0
- package/build/website/plugins/remark-steps.unit.ts +97 -0
- package/build/website/plugins/remark-tab.ts +100 -0
- package/build/website/plugins/remark-tab.unit.ts +181 -0
- package/build/website/plugins/remark-toc.ts +39 -0
- package/build/website/plugins/remark-toc.unit.ts +82 -0
- package/build/website/plugins/shiki-icon.ts +82 -0
- package/build/website/plugins/shiki-line-highlight.ts +174 -0
- package/build/website/plugins/vite-livemark.ts +91 -0
- package/build/website/routeTree.gen.ts +86 -0
- package/build/website/router.tsx +34 -0
- package/build/website/routes/$.tsx +92 -0
- package/build/website/routes/__root.tsx +97 -0
- package/build/website/server.ts +7 -0
- package/build/website/styles/general.css +163 -0
- package/build/website/styles/markdown.css +214 -0
- package/build/website/vite.config.ts +71 -0
- package/entrypoints/main.ts +12 -0
- package/package.json +120 -12
- package/build/descriptor/index.d.ts +0 -3
- package/build/descriptor/index.js +0 -4
- package/build/descriptor/load.d.ts +0 -8
- package/build/descriptor/load.js +0 -40
- package/build/descriptor/node.d.ts +0 -125
- package/build/descriptor/node.js +0 -9
- package/build/descriptor/save.d.ts +0 -8
- package/build/descriptor/save.js +0 -17
- package/build/descriptor/save.spec.js +0 -80
- package/build/descriptor/validate.d.ts +0 -9
- package/build/descriptor/validate.js +0 -14
- package/build/descriptor/validate.spec.js +0 -124
- package/build/dialect/Dialect.d.ts +0 -88
- package/build/dialect/Dialect.js +0 -2
- package/build/dialect/index.d.ts +0 -3
- package/build/dialect/index.js +0 -3
- package/build/dialect/load.d.ts +0 -4
- package/build/dialect/load.js +0 -7
- package/build/dialect/save.d.ts +0 -9
- package/build/dialect/save.js +0 -13
- package/build/dialect/validate.d.ts +0 -1
- package/build/dialect/validate.js +0 -4
- package/build/metadata/index.d.ts +0 -3
- package/build/metadata/index.js +0 -4
- package/build/metadata/load.d.ts +0 -10
- package/build/metadata/load.js +0 -55
- package/build/metadata/node.d.ts +0 -125
- package/build/metadata/node.js +0 -9
- package/build/metadata/save.d.ts +0 -8
- package/build/metadata/save.js +0 -17
- package/build/metadata/save.spec.js +0 -80
- package/build/metadata/validate.d.ts +0 -9
- package/build/metadata/validate.js +0 -14
- package/build/metadata/validate.spec.d.ts +0 -1
- package/build/metadata/validate.spec.js +0 -124
- package/build/package/Contributor.d.ts +0 -21
- package/build/package/Contributor.js +0 -2
- package/build/package/Package.d.ts +0 -65
- package/build/package/Package.js +0 -2
- package/build/package/index.d.ts +0 -4
- package/build/package/index.js +0 -3
- package/build/package/load.d.ts +0 -4
- package/build/package/load.js +0 -7
- package/build/package/save.d.ts +0 -9
- package/build/package/save.js +0 -13
- package/build/package/validate.d.ts +0 -1
- package/build/package/validate.js +0 -4
- package/build/resource/License.d.ts +0 -18
- package/build/resource/License.js +0 -2
- package/build/resource/Resource.d.ts +0 -67
- package/build/resource/Resource.js +0 -2
- package/build/resource/Source.d.ts +0 -17
- package/build/resource/Source.js +0 -2
- package/build/resource/index.d.ts +0 -5
- package/build/resource/index.js +0 -2
- package/build/resource/load.d.ts +0 -1
- package/build/resource/load.js +0 -2
- package/build/resource/save.d.ts +0 -9
- package/build/resource/save.js +0 -13
- package/build/resource/types/index.d.ts +0 -1
- package/build/resource/types/index.js +0 -2
- package/build/resource/types/table.d.ts +0 -29
- package/build/resource/types/table.js +0 -2
- package/build/resource/validate.d.ts +0 -1
- package/build/resource/validate.js +0 -4
- package/build/schema/Field.d.ts +0 -5
- package/build/schema/Field.js +0 -2
- package/build/schema/Schema.d.ts +0 -55
- package/build/schema/Schema.js +0 -2
- package/build/schema/fields/any.d.ts +0 -20
- package/build/schema/fields/any.js +0 -2
- package/build/schema/fields/array.d.ts +0 -32
- package/build/schema/fields/array.js +0 -2
- package/build/schema/fields/base.d.ts +0 -42
- package/build/schema/fields/base.js +0 -2
- package/build/schema/fields/boolean.d.ts +0 -28
- package/build/schema/fields/boolean.js +0 -2
- package/build/schema/fields/date.d.ts +0 -35
- package/build/schema/fields/date.js +0 -2
- package/build/schema/fields/datetime.d.ts +0 -35
- package/build/schema/fields/datetime.js +0 -2
- package/build/schema/fields/duration.d.ts +0 -28
- package/build/schema/fields/duration.js +0 -2
- package/build/schema/fields/geojson.d.ts +0 -26
- package/build/schema/fields/geojson.js +0 -2
- package/build/schema/fields/geopoint.d.ts +0 -27
- package/build/schema/fields/geopoint.js +0 -2
- package/build/schema/fields/index.d.ts +0 -16
- package/build/schema/fields/index.js +0 -17
- package/build/schema/fields/integer.d.ts +0 -37
- package/build/schema/fields/integer.js +0 -2
- package/build/schema/fields/list.d.ts +0 -36
- package/build/schema/fields/list.js +0 -2
- package/build/schema/fields/number.d.ts +0 -40
- package/build/schema/fields/number.js +0 -2
- package/build/schema/fields/object.d.ts +0 -32
- package/build/schema/fields/object.js +0 -2
- package/build/schema/fields/string.d.ts +0 -40
- package/build/schema/fields/string.js +0 -2
- package/build/schema/fields/time.d.ts +0 -35
- package/build/schema/fields/time.js +0 -2
- package/build/schema/fields/year.d.ts +0 -28
- package/build/schema/fields/year.js +0 -2
- package/build/schema/fields/yearmonth.d.ts +0 -28
- package/build/schema/fields/yearmonth.js +0 -2
- package/build/schema/index.d.ts +0 -4
- package/build/schema/index.js +0 -2
- package/build/schema/load.d.ts +0 -1
- package/build/schema/load.js +0 -2
- package/build/schema/save.d.ts +0 -9
- package/build/schema/save.js +0 -13
- package/build/schema/validate.d.ts +0 -1
- package/build/schema/validate.js +0 -4
- package/build/tsconfig.tsbuildinfo +0 -1
- package/index.ts +0 -0
- package/tsconfig.json +0 -10
- package/typedoc.json +0 -4
- /package/build/{descriptor/save.spec.d.ts → actions/changelog/build.unit.d.ts} +0 -0
- /package/build/{descriptor/validate.spec.d.ts → actions/config/define.unit.d.ts} +0 -0
- /package/build/{metadata/save.spec.d.ts → actions/config/load.unit.d.ts} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
|
|
2
|
+
import { CheckIcon } from "lucide-react"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../helpers/style.ts"
|
|
5
|
+
|
|
6
|
+
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
7
|
+
return (
|
|
8
|
+
<CheckboxPrimitive.Root
|
|
9
|
+
data-slot="checkbox"
|
|
10
|
+
className={cn(
|
|
11
|
+
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<CheckboxPrimitive.Indicator
|
|
17
|
+
data-slot="checkbox-indicator"
|
|
18
|
+
className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
|
|
19
|
+
>
|
|
20
|
+
<CheckIcon />
|
|
21
|
+
</CheckboxPrimitive.Indicator>
|
|
22
|
+
</CheckboxPrimitive.Root>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Checkbox }
|
|
@@ -0,0 +1,19 @@
|
|
|
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 (
|
|
9
|
+
<CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
|
|
14
|
+
return (
|
|
15
|
+
<CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
3
|
+
import { CheckIcon, SearchIcon, XIcon } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../helpers/style.ts"
|
|
6
|
+
import {
|
|
7
|
+
Dialog,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogHeader,
|
|
11
|
+
DialogTitle,
|
|
12
|
+
} from "./dialog.tsx"
|
|
13
|
+
import { InputGroup, InputGroupAddon } from "./input-group.tsx"
|
|
14
|
+
|
|
15
|
+
function Command({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
19
|
+
return (
|
|
20
|
+
<CommandPrimitive
|
|
21
|
+
data-slot="command"
|
|
22
|
+
className={cn(
|
|
23
|
+
"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function CommandDialog({
|
|
32
|
+
title = "Command Palette",
|
|
33
|
+
description = "Search for a command to run...",
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
showCloseButton = false,
|
|
37
|
+
shouldFilter,
|
|
38
|
+
loop,
|
|
39
|
+
...props
|
|
40
|
+
}: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
41
|
+
title?: string
|
|
42
|
+
description?: string
|
|
43
|
+
className?: string
|
|
44
|
+
showCloseButton?: boolean
|
|
45
|
+
shouldFilter?: boolean
|
|
46
|
+
loop?: boolean
|
|
47
|
+
children: React.ReactNode
|
|
48
|
+
}) {
|
|
49
|
+
return (
|
|
50
|
+
<Dialog {...props}>
|
|
51
|
+
<DialogHeader className="sr-only">
|
|
52
|
+
<DialogTitle>{title}</DialogTitle>
|
|
53
|
+
<DialogDescription>{description}</DialogDescription>
|
|
54
|
+
</DialogHeader>
|
|
55
|
+
<DialogContent
|
|
56
|
+
className={cn(
|
|
57
|
+
"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
showCloseButton={showCloseButton}
|
|
61
|
+
>
|
|
62
|
+
<Command shouldFilter={shouldFilter} loop={loop}>
|
|
63
|
+
{children}
|
|
64
|
+
</Command>
|
|
65
|
+
</DialogContent>
|
|
66
|
+
</Dialog>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function CommandInput({
|
|
71
|
+
className,
|
|
72
|
+
onClear,
|
|
73
|
+
...props
|
|
74
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input> & {
|
|
75
|
+
onClear?: () => void
|
|
76
|
+
}) {
|
|
77
|
+
const showClear = !!props.value
|
|
78
|
+
return (
|
|
79
|
+
<div data-slot="command-input-wrapper" className="p-1 pb-2">
|
|
80
|
+
<InputGroup className="h-12! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-3!">
|
|
81
|
+
<CommandPrimitive.Input
|
|
82
|
+
data-slot="command-input"
|
|
83
|
+
className={cn(
|
|
84
|
+
"w-full text-lg outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
85
|
+
className,
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
<InputGroupAddon>
|
|
90
|
+
<SearchIcon className="size-5 shrink-0 opacity-50" />
|
|
91
|
+
</InputGroupAddon>
|
|
92
|
+
{showClear && onClear && (
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
onClick={onClear}
|
|
96
|
+
className="pr-3 cursor-pointer opacity-50 hover:opacity-100 transition-opacity"
|
|
97
|
+
>
|
|
98
|
+
<XIcon className="size-4" />
|
|
99
|
+
</button>
|
|
100
|
+
)}
|
|
101
|
+
</InputGroup>
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function CommandList({
|
|
107
|
+
className,
|
|
108
|
+
...props
|
|
109
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
110
|
+
return (
|
|
111
|
+
<CommandPrimitive.List
|
|
112
|
+
data-slot="command-list"
|
|
113
|
+
className={cn(
|
|
114
|
+
"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
|
|
115
|
+
className,
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function CommandEmpty({
|
|
123
|
+
className,
|
|
124
|
+
...props
|
|
125
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
126
|
+
return (
|
|
127
|
+
<CommandPrimitive.Empty
|
|
128
|
+
data-slot="command-empty"
|
|
129
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function CommandGroup({
|
|
136
|
+
className,
|
|
137
|
+
...props
|
|
138
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
139
|
+
return (
|
|
140
|
+
<CommandPrimitive.Group
|
|
141
|
+
data-slot="command-group"
|
|
142
|
+
className={cn(
|
|
143
|
+
"overflow-hidden p-1 text-foreground **:[[cmdk-group-items]]:space-y-2 **:[[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",
|
|
144
|
+
className,
|
|
145
|
+
)}
|
|
146
|
+
{...props}
|
|
147
|
+
/>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function CommandSeparator({
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
155
|
+
return (
|
|
156
|
+
<CommandPrimitive.Separator
|
|
157
|
+
data-slot="command-separator"
|
|
158
|
+
className={cn("-mx-1 h-px w-auto bg-border", className)}
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function CommandItem({
|
|
165
|
+
className,
|
|
166
|
+
children,
|
|
167
|
+
...props
|
|
168
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
169
|
+
return (
|
|
170
|
+
<CommandPrimitive.Item
|
|
171
|
+
data-slot="command-item"
|
|
172
|
+
className={cn(
|
|
173
|
+
"group/command-item relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none bg-muted/50 in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-primary/10 data-[selected=true]:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[selected=true]:**:[svg]:text-foreground",
|
|
174
|
+
className,
|
|
175
|
+
)}
|
|
176
|
+
{...props}
|
|
177
|
+
>
|
|
178
|
+
{children}
|
|
179
|
+
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
180
|
+
</CommandPrimitive.Item>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function CommandShortcut({
|
|
185
|
+
className,
|
|
186
|
+
...props
|
|
187
|
+
}: React.ComponentProps<"span">) {
|
|
188
|
+
return (
|
|
189
|
+
<span
|
|
190
|
+
data-slot="command-shortcut"
|
|
191
|
+
className={cn(
|
|
192
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
|
|
193
|
+
className,
|
|
194
|
+
)}
|
|
195
|
+
{...props}
|
|
196
|
+
/>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
Command,
|
|
202
|
+
CommandDialog,
|
|
203
|
+
CommandInput,
|
|
204
|
+
CommandList,
|
|
205
|
+
CommandEmpty,
|
|
206
|
+
CommandGroup,
|
|
207
|
+
CommandItem,
|
|
208
|
+
CommandShortcut,
|
|
209
|
+
CommandSeparator,
|
|
210
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu"
|
|
3
|
+
import { CheckIcon, ChevronRightIcon } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../helpers/style.ts"
|
|
6
|
+
|
|
7
|
+
function ContextMenu({ ...props }: ContextMenuPrimitive.Root.Props) {
|
|
8
|
+
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function ContextMenuPortal({ ...props }: ContextMenuPrimitive.Portal.Props) {
|
|
12
|
+
return (
|
|
13
|
+
<ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function ContextMenuTrigger({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: ContextMenuPrimitive.Trigger.Props) {
|
|
21
|
+
return (
|
|
22
|
+
<ContextMenuPrimitive.Trigger
|
|
23
|
+
data-slot="context-menu-trigger"
|
|
24
|
+
className={cn("select-none", className)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function ContextMenuContent({
|
|
31
|
+
className,
|
|
32
|
+
align = "start",
|
|
33
|
+
alignOffset = 4,
|
|
34
|
+
side = "right",
|
|
35
|
+
sideOffset = 0,
|
|
36
|
+
...props
|
|
37
|
+
}: ContextMenuPrimitive.Popup.Props &
|
|
38
|
+
Pick<
|
|
39
|
+
ContextMenuPrimitive.Positioner.Props,
|
|
40
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
41
|
+
>) {
|
|
42
|
+
return (
|
|
43
|
+
<ContextMenuPrimitive.Portal>
|
|
44
|
+
<ContextMenuPrimitive.Positioner
|
|
45
|
+
className="isolate z-50 outline-none"
|
|
46
|
+
align={align}
|
|
47
|
+
alignOffset={alignOffset}
|
|
48
|
+
side={side}
|
|
49
|
+
sideOffset={sideOffset}
|
|
50
|
+
>
|
|
51
|
+
<ContextMenuPrimitive.Popup
|
|
52
|
+
data-slot="context-menu-content"
|
|
53
|
+
className={cn(
|
|
54
|
+
"cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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",
|
|
55
|
+
className,
|
|
56
|
+
)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
</ContextMenuPrimitive.Positioner>
|
|
60
|
+
</ContextMenuPrimitive.Portal>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function ContextMenuGroup({ ...props }: ContextMenuPrimitive.Group.Props) {
|
|
65
|
+
return (
|
|
66
|
+
<ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function ContextMenuLabel({
|
|
71
|
+
className,
|
|
72
|
+
inset,
|
|
73
|
+
...props
|
|
74
|
+
}: ContextMenuPrimitive.GroupLabel.Props & {
|
|
75
|
+
inset?: boolean
|
|
76
|
+
}) {
|
|
77
|
+
return (
|
|
78
|
+
<ContextMenuPrimitive.GroupLabel
|
|
79
|
+
data-slot="context-menu-label"
|
|
80
|
+
data-inset={inset}
|
|
81
|
+
className={cn(
|
|
82
|
+
"px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8",
|
|
83
|
+
className,
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function ContextMenuItem({
|
|
91
|
+
className,
|
|
92
|
+
inset,
|
|
93
|
+
variant = "default",
|
|
94
|
+
...props
|
|
95
|
+
}: ContextMenuPrimitive.Item.Props & {
|
|
96
|
+
inset?: boolean
|
|
97
|
+
variant?: "default" | "destructive"
|
|
98
|
+
}) {
|
|
99
|
+
return (
|
|
100
|
+
<ContextMenuPrimitive.Item
|
|
101
|
+
data-slot="context-menu-item"
|
|
102
|
+
data-inset={inset}
|
|
103
|
+
data-variant={variant}
|
|
104
|
+
className={cn(
|
|
105
|
+
"group/context-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",
|
|
106
|
+
className,
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function ContextMenuSub({ ...props }: ContextMenuPrimitive.SubmenuRoot.Props) {
|
|
114
|
+
return (
|
|
115
|
+
<ContextMenuPrimitive.SubmenuRoot data-slot="context-menu-sub" {...props} />
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function ContextMenuSubTrigger({
|
|
120
|
+
className,
|
|
121
|
+
inset,
|
|
122
|
+
children,
|
|
123
|
+
...props
|
|
124
|
+
}: ContextMenuPrimitive.SubmenuTrigger.Props & {
|
|
125
|
+
inset?: boolean
|
|
126
|
+
}) {
|
|
127
|
+
return (
|
|
128
|
+
<ContextMenuPrimitive.SubmenuTrigger
|
|
129
|
+
data-slot="context-menu-sub-trigger"
|
|
130
|
+
data-inset={inset}
|
|
131
|
+
className={cn(
|
|
132
|
+
"flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
133
|
+
className,
|
|
134
|
+
)}
|
|
135
|
+
{...props}
|
|
136
|
+
>
|
|
137
|
+
{children}
|
|
138
|
+
<ChevronRightIcon className="cn-rtl-flip ml-auto" />
|
|
139
|
+
</ContextMenuPrimitive.SubmenuTrigger>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function ContextMenuSubContent({
|
|
144
|
+
...props
|
|
145
|
+
}: React.ComponentProps<typeof ContextMenuContent>) {
|
|
146
|
+
return (
|
|
147
|
+
<ContextMenuContent
|
|
148
|
+
data-slot="context-menu-sub-content"
|
|
149
|
+
className="cn-menu-target cn-menu-translucent shadow-lg"
|
|
150
|
+
side="right"
|
|
151
|
+
{...props}
|
|
152
|
+
/>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function ContextMenuCheckboxItem({
|
|
157
|
+
className,
|
|
158
|
+
children,
|
|
159
|
+
checked,
|
|
160
|
+
inset,
|
|
161
|
+
...props
|
|
162
|
+
}: ContextMenuPrimitive.CheckboxItem.Props & {
|
|
163
|
+
inset?: boolean
|
|
164
|
+
}) {
|
|
165
|
+
return (
|
|
166
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
167
|
+
data-slot="context-menu-checkbox-item"
|
|
168
|
+
data-inset={inset}
|
|
169
|
+
className={cn(
|
|
170
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
171
|
+
className,
|
|
172
|
+
)}
|
|
173
|
+
checked={checked}
|
|
174
|
+
{...props}
|
|
175
|
+
>
|
|
176
|
+
<span className="pointer-events-none absolute right-2">
|
|
177
|
+
<ContextMenuPrimitive.CheckboxItemIndicator>
|
|
178
|
+
<CheckIcon />
|
|
179
|
+
</ContextMenuPrimitive.CheckboxItemIndicator>
|
|
180
|
+
</span>
|
|
181
|
+
{children}
|
|
182
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function ContextMenuRadioGroup({
|
|
187
|
+
...props
|
|
188
|
+
}: ContextMenuPrimitive.RadioGroup.Props) {
|
|
189
|
+
return (
|
|
190
|
+
<ContextMenuPrimitive.RadioGroup
|
|
191
|
+
data-slot="context-menu-radio-group"
|
|
192
|
+
{...props}
|
|
193
|
+
/>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function ContextMenuRadioItem({
|
|
198
|
+
className,
|
|
199
|
+
children,
|
|
200
|
+
inset,
|
|
201
|
+
...props
|
|
202
|
+
}: ContextMenuPrimitive.RadioItem.Props & {
|
|
203
|
+
inset?: boolean
|
|
204
|
+
}) {
|
|
205
|
+
return (
|
|
206
|
+
<ContextMenuPrimitive.RadioItem
|
|
207
|
+
data-slot="context-menu-radio-item"
|
|
208
|
+
data-inset={inset}
|
|
209
|
+
className={cn(
|
|
210
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
211
|
+
className,
|
|
212
|
+
)}
|
|
213
|
+
{...props}
|
|
214
|
+
>
|
|
215
|
+
<span className="pointer-events-none absolute right-2">
|
|
216
|
+
<ContextMenuPrimitive.RadioItemIndicator>
|
|
217
|
+
<CheckIcon />
|
|
218
|
+
</ContextMenuPrimitive.RadioItemIndicator>
|
|
219
|
+
</span>
|
|
220
|
+
{children}
|
|
221
|
+
</ContextMenuPrimitive.RadioItem>
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function ContextMenuSeparator({
|
|
226
|
+
className,
|
|
227
|
+
...props
|
|
228
|
+
}: ContextMenuPrimitive.Separator.Props) {
|
|
229
|
+
return (
|
|
230
|
+
<ContextMenuPrimitive.Separator
|
|
231
|
+
data-slot="context-menu-separator"
|
|
232
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
233
|
+
{...props}
|
|
234
|
+
/>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function ContextMenuShortcut({
|
|
239
|
+
className,
|
|
240
|
+
...props
|
|
241
|
+
}: React.ComponentProps<"span">) {
|
|
242
|
+
return (
|
|
243
|
+
<span
|
|
244
|
+
data-slot="context-menu-shortcut"
|
|
245
|
+
className={cn(
|
|
246
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground",
|
|
247
|
+
className,
|
|
248
|
+
)}
|
|
249
|
+
{...props}
|
|
250
|
+
/>
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export {
|
|
255
|
+
ContextMenu,
|
|
256
|
+
ContextMenuTrigger,
|
|
257
|
+
ContextMenuContent,
|
|
258
|
+
ContextMenuItem,
|
|
259
|
+
ContextMenuCheckboxItem,
|
|
260
|
+
ContextMenuRadioItem,
|
|
261
|
+
ContextMenuLabel,
|
|
262
|
+
ContextMenuSeparator,
|
|
263
|
+
ContextMenuShortcut,
|
|
264
|
+
ContextMenuGroup,
|
|
265
|
+
ContextMenuPortal,
|
|
266
|
+
ContextMenuSub,
|
|
267
|
+
ContextMenuSubContent,
|
|
268
|
+
ContextMenuSubTrigger,
|
|
269
|
+
ContextMenuRadioGroup,
|
|
270
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
|
|
2
|
+
import { XIcon } from "lucide-react"
|
|
3
|
+
import { cn } from "../helpers/style.ts"
|
|
4
|
+
import { Button } from "./button.tsx"
|
|
5
|
+
|
|
6
|
+
function Dialog({ ...props }: DialogPrimitive.Root.Props) {
|
|
7
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
|
|
11
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
|
|
15
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
|
|
19
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function DialogOverlay({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: DialogPrimitive.Backdrop.Props) {
|
|
26
|
+
return (
|
|
27
|
+
<DialogPrimitive.Backdrop
|
|
28
|
+
data-slot="dialog-overlay"
|
|
29
|
+
className={cn(
|
|
30
|
+
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function DialogContent({
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
showCloseButton = true,
|
|
42
|
+
...props
|
|
43
|
+
}: DialogPrimitive.Popup.Props & {
|
|
44
|
+
showCloseButton?: boolean
|
|
45
|
+
}) {
|
|
46
|
+
return (
|
|
47
|
+
<DialogPortal>
|
|
48
|
+
<DialogOverlay />
|
|
49
|
+
<DialogPrimitive.Popup
|
|
50
|
+
data-slot="dialog-content"
|
|
51
|
+
className={cn(
|
|
52
|
+
"bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-6 rounded-xl p-6 text-sm ring-1 duration-100 sm:max-w-md fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none",
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
{showCloseButton && (
|
|
59
|
+
<DialogPrimitive.Close
|
|
60
|
+
data-slot="dialog-close"
|
|
61
|
+
render={
|
|
62
|
+
<Button
|
|
63
|
+
variant="ghost"
|
|
64
|
+
className="absolute top-4 right-4"
|
|
65
|
+
size="icon-sm"
|
|
66
|
+
/>
|
|
67
|
+
}
|
|
68
|
+
>
|
|
69
|
+
<XIcon />
|
|
70
|
+
<span className="sr-only">Close</span>
|
|
71
|
+
</DialogPrimitive.Close>
|
|
72
|
+
)}
|
|
73
|
+
</DialogPrimitive.Popup>
|
|
74
|
+
</DialogPortal>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
data-slot="dialog-header"
|
|
82
|
+
className={cn("gap-2 flex flex-col", className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function DialogFooter({
|
|
89
|
+
className,
|
|
90
|
+
showCloseButton = false,
|
|
91
|
+
children,
|
|
92
|
+
...props
|
|
93
|
+
}: React.ComponentProps<"div"> & {
|
|
94
|
+
showCloseButton?: boolean
|
|
95
|
+
}) {
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
data-slot="dialog-footer"
|
|
99
|
+
className={cn(
|
|
100
|
+
"gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
{showCloseButton && (
|
|
107
|
+
<DialogPrimitive.Close render={<Button variant="outline" />}>
|
|
108
|
+
Close
|
|
109
|
+
</DialogPrimitive.Close>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
116
|
+
return (
|
|
117
|
+
<DialogPrimitive.Title
|
|
118
|
+
data-slot="dialog-title"
|
|
119
|
+
className={cn("leading-none font-medium", className)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function DialogDescription({
|
|
126
|
+
className,
|
|
127
|
+
...props
|
|
128
|
+
}: DialogPrimitive.Description.Props) {
|
|
129
|
+
return (
|
|
130
|
+
<DialogPrimitive.Description
|
|
131
|
+
data-slot="dialog-description"
|
|
132
|
+
className={cn(
|
|
133
|
+
"text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",
|
|
134
|
+
className,
|
|
135
|
+
)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
Dialog,
|
|
143
|
+
DialogClose,
|
|
144
|
+
DialogContent,
|
|
145
|
+
DialogDescription,
|
|
146
|
+
DialogFooter,
|
|
147
|
+
DialogHeader,
|
|
148
|
+
DialogOverlay,
|
|
149
|
+
DialogPortal,
|
|
150
|
+
DialogTitle,
|
|
151
|
+
DialogTrigger,
|
|
152
|
+
}
|