create-nextjs-cms 0.5.23 → 0.5.25
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/index.js +11 -0
- package/package.json +6 -8
- package/templates/default/components/NewPage.tsx +2 -2
- package/templates/default/components/ProgressBar.tsx +46 -22
- package/templates/default/components/form/DateRangeFormInput.tsx +8 -6
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/components/form/inputs/DateFormInput.tsx +82 -34
- package/templates/default/components/form/inputs/MultipleSelectFormInput.tsx +40 -107
- package/templates/default/components/form/inputs/RichTextFormInput.tsx +2 -0
- package/templates/default/components/form/inputs/TagsFormInput.tsx +115 -26
- package/templates/default/components/form/inputs/TextFormInput.tsx +1 -1
- package/templates/default/components/multi-select.tsx +1144 -0
- package/templates/default/components/ui/badge.tsx +16 -12
- package/templates/default/components/ui/button.tsx +35 -30
- package/templates/default/components/ui/calendar.tsx +145 -47
- package/templates/default/components/ui/command.tsx +184 -0
- package/templates/default/components/ui/dialog.tsx +143 -0
- package/templates/default/components/ui/popover.tsx +39 -22
- package/templates/default/components/ui/progress.tsx +31 -0
- package/templates/default/components/ui/select.tsx +150 -149
- package/templates/default/components/ui/separator.tsx +28 -0
- package/templates/default/components.json +8 -3
- package/templates/default/{postinstall.js → lib/postinstall.js} +1 -1
- package/templates/default/lib/utils.ts +6 -0
- package/templates/default/{proxy.ts → middleware.ts} +3 -2
- package/templates/default/next-env.d.ts +1 -1
- package/templates/default/package.json +41 -53
- package/templates/default/public/tinymce/CHANGELOG.md +155 -0
- package/templates/default/public/tinymce/README.md +12 -12
- package/templates/default/public/tinymce/bower.json +1 -1
- package/templates/default/public/tinymce/composer.json +2 -2
- package/templates/default/public/tinymce/icons/default/icons.js +40 -32
- package/templates/default/public/tinymce/icons/default/icons.min.js +1 -1
- package/templates/default/public/tinymce/license.md +7 -4
- package/templates/default/public/tinymce/models/dom/model.js +36 -50
- package/templates/default/public/tinymce/models/dom/model.min.js +1 -1
- package/templates/default/public/tinymce/notices.txt +2 -2
- package/templates/default/public/tinymce/package.json +2 -2
- package/templates/default/public/tinymce/plugins/accordion/plugin.js +45 -21
- package/templates/default/public/tinymce/plugins/accordion/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/advlist/plugin.js +8 -6
- package/templates/default/public/tinymce/plugins/advlist/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/anchor/plugin.js +1 -1
- package/templates/default/public/tinymce/plugins/autolink/plugin.js +3 -6
- package/templates/default/public/tinymce/plugins/autolink/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/autoresize/plugin.js +4 -6
- package/templates/default/public/tinymce/plugins/autoresize/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/autosave/plugin.js +4 -7
- package/templates/default/public/tinymce/plugins/autosave/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/charmap/plugin.js +8 -8
- package/templates/default/public/tinymce/plugins/charmap/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/code/plugin.js +3 -2
- package/templates/default/public/tinymce/plugins/code/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/codesample/plugin.js +11 -10
- package/templates/default/public/tinymce/plugins/codesample/plugin.min.js +2 -2
- package/templates/default/public/tinymce/plugins/directionality/plugin.js +9 -11
- package/templates/default/public/tinymce/plugins/directionality/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/emoticons/plugin.js +7 -7
- package/templates/default/public/tinymce/plugins/emoticons/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/fullscreen/plugin.js +11 -13
- package/templates/default/public/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg-BG.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr-FR.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he-IL.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu-HU.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko-KR.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb-NO.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-BR.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-PT.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl-SI.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv-SE.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th-TH.js +93 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-CN.js +87 -0
- package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-TW.js +93 -0
- package/templates/default/public/tinymce/plugins/help/plugin.js +15 -17
- package/templates/default/public/tinymce/plugins/help/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/image/plugin.js +34 -32
- package/templates/default/public/tinymce/plugins/image/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/importcss/plugin.js +4 -6
- package/templates/default/public/tinymce/plugins/importcss/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/insertdatetime/plugin.js +4 -3
- package/templates/default/public/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/link/plugin.js +170 -38
- package/templates/default/public/tinymce/plugins/link/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/lists/plugin.js +111 -2053
- package/templates/default/public/tinymce/plugins/lists/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/media/plugin.js +15 -23
- package/templates/default/public/tinymce/plugins/media/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/nonbreaking/plugin.js +1 -1
- package/templates/default/public/tinymce/plugins/pagebreak/plugin.js +1 -1
- package/templates/default/public/tinymce/plugins/preview/plugin.js +88 -10
- package/templates/default/public/tinymce/plugins/preview/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/quickbars/plugin.js +9 -9
- package/templates/default/public/tinymce/plugins/quickbars/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/save/plugin.js +1 -1
- package/templates/default/public/tinymce/plugins/searchreplace/plugin.js +10 -13
- package/templates/default/public/tinymce/plugins/searchreplace/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/table/plugin.js +13 -24
- package/templates/default/public/tinymce/plugins/table/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/visualblocks/plugin.js +1 -1
- package/templates/default/public/tinymce/plugins/visualchars/plugin.js +9 -10
- package/templates/default/public/tinymce/plugins/visualchars/plugin.min.js +1 -1
- package/templates/default/public/tinymce/plugins/wordcount/plugin.js +1 -1
- package/templates/default/public/tinymce/skins/content/dark/content.min.ts +3 -0
- package/templates/default/public/tinymce/skins/content/dark/content.ts +3 -0
- package/templates/default/public/tinymce/skins/content/default/content.min.ts +3 -0
- package/templates/default/public/tinymce/skins/content/default/content.ts +3 -0
- package/templates/default/public/tinymce/skins/content/document/content.min.ts +3 -0
- package/templates/default/public/tinymce/skins/content/document/content.ts +3 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.ts +3 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5/content.ts +3 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.ts +3 -0
- package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.ts +3 -0
- package/templates/default/public/tinymce/skins/content/writer/content.min.ts +3 -0
- package/templates/default/public/tinymce/skins/content/writer/content.ts +3 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.css +144 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.css +144 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.js +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.inline.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.js +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide/content.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide/content.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide/content.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.css +923 -449
- package/templates/default/public/tinymce/skins/ui/oxide/skin.js +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide/skin.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide/skin.min.ts +507 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/oxide/skin.ts +507 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.css +144 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.css +144 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.js +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.js +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/content.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.css +926 -452
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.js +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.ts +507 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.ts +507 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.css +144 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.css +144 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.js +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.js +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/content.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.css +924 -450
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.js +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.ts +508 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.ts +508 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.css +144 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.css +144 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.js +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.ts +116 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.css +925 -451
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.ts +508 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.ts +9 -0
- package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.ts +508 -0
- package/templates/default/public/tinymce/themes/silver/theme.js +543 -593
- package/templates/default/public/tinymce/themes/silver/theme.min.js +1 -1
- package/templates/default/public/tinymce/tinymce.d.ts +559 -496
- package/templates/default/public/tinymce/tinymce.js +6788 -3964
- package/templates/default/public/tinymce/tinymce.min.js +3 -4
- package/templates/default/styles/globals.css +132 -107
- package/templates/default/tsconfig.json +45 -45
- package/templates/default/.prettierrc.json +0 -19
- package/templates/default/eslint.config.mjs +0 -38
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
2
3
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
4
|
|
|
4
|
-
import { cn } from '
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
5
6
|
|
|
6
7
|
const badgeVariants = cva(
|
|
7
|
-
'inline-flex items-center rounded-
|
|
8
|
+
'inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden',
|
|
8
9
|
{
|
|
9
10
|
variants: {
|
|
10
11
|
variant: {
|
|
11
|
-
default: 'border-transparent bg-primary text-primary-foreground
|
|
12
|
-
|
|
12
|
+
default: 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
|
|
13
|
+
primary: 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
|
|
14
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',
|
|
13
15
|
destructive:
|
|
14
|
-
'border-transparent bg-destructive text-destructive-
|
|
15
|
-
outline: 'text-foreground',
|
|
16
|
-
primary: 'border-transparent bg-primary text-primary-foreground shadow-sm hover:bg-primary/80',
|
|
17
|
-
success: 'border-transparent bg-success text-success-foreground shadow-sm hover:bg-success/80',
|
|
18
|
-
warning: 'border-transparent bg-warning text-warning-foreground shadow-sm hover:bg-warning/80',
|
|
16
|
+
'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
17
|
+
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
defaultVariants: {
|
|
@@ -24,10 +23,15 @@ const badgeVariants = cva(
|
|
|
24
23
|
},
|
|
25
24
|
)
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
function Badge({
|
|
27
|
+
className,
|
|
28
|
+
variant,
|
|
29
|
+
asChild = false,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
32
|
+
const Comp = asChild ? Slot : 'span'
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
return <div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
34
|
+
return <Comp data-slot='badge' className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export { Badge, badgeVariants }
|
|
@@ -2,29 +2,31 @@ import * as React from "react"
|
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot"
|
|
3
3
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
4
|
|
|
5
|
-
import { cn } from
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
7
|
const buttonVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
default:
|
|
13
|
-
"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
|
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14
13
|
destructive:
|
|
15
|
-
"bg-destructive text-destructive-
|
|
14
|
+
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
16
15
|
outline:
|
|
17
|
-
"border
|
|
16
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
18
17
|
secondary:
|
|
19
|
-
"bg-secondary text-secondary-foreground
|
|
20
|
-
ghost:
|
|
18
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
+
ghost:
|
|
20
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
21
21
|
link: "text-primary underline-offset-4 hover:underline",
|
|
22
22
|
},
|
|
23
23
|
size: {
|
|
24
|
-
default: "h-9 px-4 py-2",
|
|
25
|
-
sm: "h-8 rounded-md px-3
|
|
26
|
-
lg: "h-10 rounded-md px-
|
|
27
|
-
icon: "
|
|
24
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
+
icon: "size-9",
|
|
28
|
+
"icon-sm": "size-8",
|
|
29
|
+
"icon-lg": "size-10",
|
|
28
30
|
},
|
|
29
31
|
},
|
|
30
32
|
defaultVariants: {
|
|
@@ -34,24 +36,27 @@ const buttonVariants = cva(
|
|
|
34
36
|
}
|
|
35
37
|
)
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
function Button({
|
|
40
|
+
className,
|
|
41
|
+
variant = "default",
|
|
42
|
+
size = "default",
|
|
43
|
+
asChild = false,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<"button"> &
|
|
46
|
+
VariantProps<typeof buttonVariants> & {
|
|
47
|
+
asChild?: boolean
|
|
48
|
+
}) {
|
|
49
|
+
const Comp = asChild ? Slot : "button"
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
Button.displayName = "Button"
|
|
51
|
+
return (
|
|
52
|
+
<Comp
|
|
53
|
+
data-slot="button"
|
|
54
|
+
data-variant={variant}
|
|
55
|
+
data-size={size}
|
|
56
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
56
61
|
|
|
57
62
|
export { Button, buttonVariants }
|
|
@@ -1,68 +1,166 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import {
|
|
4
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
|
|
5
|
+
import { DayPicker, getDefaultClassNames, type DayButton } from 'react-day-picker'
|
|
5
6
|
|
|
6
|
-
import { cn } from '
|
|
7
|
-
import { buttonVariants } from '@/components/ui/button'
|
|
8
|
-
import { ChevronLeftIcon, ChevronRightIcon } from '@radix-ui/react-icons'
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
import { Button, buttonVariants } from '@/components/ui/button'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function Calendar({
|
|
11
|
+
className,
|
|
12
|
+
classNames,
|
|
13
|
+
showOutsideDays = true,
|
|
14
|
+
captionLayout = 'label',
|
|
15
|
+
buttonVariant = 'ghost',
|
|
16
|
+
formatters,
|
|
17
|
+
components,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
20
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant']
|
|
21
|
+
}) {
|
|
22
|
+
const defaultClassNames = getDefaultClassNames()
|
|
11
23
|
|
|
12
|
-
function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) {
|
|
13
24
|
return (
|
|
14
25
|
<DayPicker
|
|
15
26
|
showOutsideDays={showOutsideDays}
|
|
16
|
-
className={cn(
|
|
27
|
+
className={cn(
|
|
28
|
+
'bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent',
|
|
29
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
30
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
captionLayout={captionLayout}
|
|
34
|
+
formatters={{
|
|
35
|
+
formatMonthDropdown: (date) => date.toLocaleString('default', { month: 'short' }),
|
|
36
|
+
...formatters,
|
|
37
|
+
}}
|
|
17
38
|
classNames={{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
root: cn('w-fit', defaultClassNames.root),
|
|
40
|
+
months: cn('flex gap-4 flex-col md:flex-row relative', defaultClassNames.months),
|
|
41
|
+
month: cn('flex flex-col w-full gap-4', defaultClassNames.month),
|
|
42
|
+
nav: cn(
|
|
43
|
+
'flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between',
|
|
44
|
+
defaultClassNames.nav,
|
|
45
|
+
),
|
|
46
|
+
button_previous: cn(
|
|
47
|
+
buttonVariants({ variant: buttonVariant }),
|
|
48
|
+
'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none',
|
|
49
|
+
defaultClassNames.button_previous,
|
|
50
|
+
),
|
|
51
|
+
button_next: cn(
|
|
52
|
+
buttonVariants({ variant: buttonVariant }),
|
|
53
|
+
'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none',
|
|
54
|
+
defaultClassNames.button_next,
|
|
55
|
+
),
|
|
56
|
+
month_caption: cn(
|
|
57
|
+
'flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)',
|
|
58
|
+
defaultClassNames.month_caption,
|
|
59
|
+
),
|
|
60
|
+
dropdowns: cn(
|
|
61
|
+
'w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5',
|
|
62
|
+
defaultClassNames.dropdowns,
|
|
63
|
+
),
|
|
64
|
+
dropdown_root: cn(
|
|
65
|
+
'relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md',
|
|
66
|
+
defaultClassNames.dropdown_root,
|
|
26
67
|
),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md',
|
|
35
|
-
props.mode === 'range'
|
|
36
|
-
? '[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md'
|
|
37
|
-
: '[&:has([aria-selected])]:rounded-md',
|
|
68
|
+
dropdown: cn('absolute bg-popover inset-0 opacity-0', defaultClassNames.dropdown),
|
|
69
|
+
caption_label: cn(
|
|
70
|
+
'select-none font-medium',
|
|
71
|
+
captionLayout === 'label'
|
|
72
|
+
? 'text-sm'
|
|
73
|
+
: 'rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5',
|
|
74
|
+
defaultClassNames.caption_label,
|
|
38
75
|
),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
table: 'w-full border-collapse',
|
|
77
|
+
weekdays: cn('flex', defaultClassNames.weekdays),
|
|
78
|
+
weekday: cn(
|
|
79
|
+
'text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none',
|
|
80
|
+
defaultClassNames.weekday,
|
|
81
|
+
),
|
|
82
|
+
week: cn('flex w-full mt-2', defaultClassNames.week),
|
|
83
|
+
week_number_header: cn('select-none w-(--cell-size)', defaultClassNames.week_number_header),
|
|
84
|
+
week_number: cn('text-[0.8rem] select-none text-muted-foreground', defaultClassNames.week_number),
|
|
85
|
+
day: cn(
|
|
86
|
+
'relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none',
|
|
87
|
+
props.showWeekNumber
|
|
88
|
+
? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-md'
|
|
89
|
+
: '[&:first-child[data-selected=true]_button]:rounded-l-md',
|
|
90
|
+
defaultClassNames.day,
|
|
91
|
+
),
|
|
92
|
+
range_start: cn('rounded-l-md bg-accent', defaultClassNames.range_start),
|
|
93
|
+
range_middle: cn('rounded-none', defaultClassNames.range_middle),
|
|
94
|
+
range_end: cn('rounded-r-md bg-accent', defaultClassNames.range_end),
|
|
95
|
+
today: cn(
|
|
96
|
+
'bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none',
|
|
97
|
+
defaultClassNames.today,
|
|
98
|
+
),
|
|
99
|
+
outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
|
|
100
|
+
disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
|
|
101
|
+
hidden: cn('invisible', defaultClassNames.hidden),
|
|
50
102
|
...classNames,
|
|
51
103
|
}}
|
|
52
104
|
components={{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
105
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
106
|
+
return <div data-slot='calendar' ref={rootRef} className={cn(className)} {...props} />
|
|
107
|
+
},
|
|
108
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
109
|
+
if (orientation === 'left') {
|
|
110
|
+
return <ChevronLeftIcon className={cn('size-4', className)} {...props} />
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (orientation === 'right') {
|
|
114
|
+
return <ChevronRightIcon className={cn('size-4', className)} {...props} />
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return <ChevronDownIcon className={cn('size-4', className)} {...props} />
|
|
118
|
+
},
|
|
119
|
+
DayButton: CalendarDayButton,
|
|
120
|
+
WeekNumber: ({ children, ...props }) => {
|
|
121
|
+
return (
|
|
122
|
+
<td {...props}>
|
|
123
|
+
<div className='flex size-(--cell-size) items-center justify-center text-center'>
|
|
124
|
+
{children}
|
|
125
|
+
</div>
|
|
126
|
+
</td>
|
|
127
|
+
)
|
|
128
|
+
},
|
|
129
|
+
...components,
|
|
61
130
|
}}
|
|
62
131
|
{...props}
|
|
63
132
|
/>
|
|
64
133
|
)
|
|
65
134
|
}
|
|
66
|
-
Calendar.displayName = 'Calendar'
|
|
67
135
|
|
|
68
|
-
|
|
136
|
+
function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {
|
|
137
|
+
const defaultClassNames = getDefaultClassNames()
|
|
138
|
+
|
|
139
|
+
const ref = React.useRef<HTMLButtonElement>(null)
|
|
140
|
+
React.useEffect(() => {
|
|
141
|
+
if (modifiers.focused) ref.current?.focus()
|
|
142
|
+
}, [modifiers.focused])
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Button
|
|
146
|
+
ref={ref}
|
|
147
|
+
variant='ghost'
|
|
148
|
+
size='icon'
|
|
149
|
+
data-day={day.date.toLocaleDateString()}
|
|
150
|
+
data-selected-single={
|
|
151
|
+
modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle
|
|
152
|
+
}
|
|
153
|
+
data-range-start={modifiers.range_start}
|
|
154
|
+
data-range-end={modifiers.range_end}
|
|
155
|
+
data-range-middle={modifiers.range_middle}
|
|
156
|
+
className={cn(
|
|
157
|
+
'data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70',
|
|
158
|
+
defaultClassNames.day,
|
|
159
|
+
className,
|
|
160
|
+
)}
|
|
161
|
+
{...props}
|
|
162
|
+
/>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export { Calendar, CalendarDayButton }
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
5
|
+
import { SearchIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from "@/components/ui/dialog"
|
|
15
|
+
|
|
16
|
+
function Command({
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
20
|
+
return (
|
|
21
|
+
<CommandPrimitive
|
|
22
|
+
data-slot="command"
|
|
23
|
+
className={cn(
|
|
24
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function CommandDialog({
|
|
33
|
+
title = "Command Palette",
|
|
34
|
+
description = "Search for a command to run...",
|
|
35
|
+
children,
|
|
36
|
+
className,
|
|
37
|
+
showCloseButton = true,
|
|
38
|
+
...props
|
|
39
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
40
|
+
title?: string
|
|
41
|
+
description?: string
|
|
42
|
+
className?: string
|
|
43
|
+
showCloseButton?: boolean
|
|
44
|
+
}) {
|
|
45
|
+
return (
|
|
46
|
+
<Dialog {...props}>
|
|
47
|
+
<DialogHeader className="sr-only">
|
|
48
|
+
<DialogTitle>{title}</DialogTitle>
|
|
49
|
+
<DialogDescription>{description}</DialogDescription>
|
|
50
|
+
</DialogHeader>
|
|
51
|
+
<DialogContent
|
|
52
|
+
className={cn("overflow-hidden p-0", className)}
|
|
53
|
+
showCloseButton={showCloseButton}
|
|
54
|
+
>
|
|
55
|
+
<Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
56
|
+
{children}
|
|
57
|
+
</Command>
|
|
58
|
+
</DialogContent>
|
|
59
|
+
</Dialog>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function CommandInput({
|
|
64
|
+
className,
|
|
65
|
+
...props
|
|
66
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
data-slot="command-input-wrapper"
|
|
70
|
+
className="flex h-9 items-center gap-2 border-b px-3"
|
|
71
|
+
>
|
|
72
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
73
|
+
<CommandPrimitive.Input
|
|
74
|
+
data-slot="command-input"
|
|
75
|
+
className={cn(
|
|
76
|
+
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function CommandList({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
89
|
+
return (
|
|
90
|
+
<CommandPrimitive.List
|
|
91
|
+
data-slot="command-list"
|
|
92
|
+
className={cn(
|
|
93
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function CommandEmpty({
|
|
102
|
+
...props
|
|
103
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
104
|
+
return (
|
|
105
|
+
<CommandPrimitive.Empty
|
|
106
|
+
data-slot="command-empty"
|
|
107
|
+
className="py-6 text-center text-sm"
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function CommandGroup({
|
|
114
|
+
className,
|
|
115
|
+
...props
|
|
116
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
117
|
+
return (
|
|
118
|
+
<CommandPrimitive.Group
|
|
119
|
+
data-slot="command-group"
|
|
120
|
+
className={cn(
|
|
121
|
+
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
122
|
+
className
|
|
123
|
+
)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function CommandSeparator({
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
133
|
+
return (
|
|
134
|
+
<CommandPrimitive.Separator
|
|
135
|
+
data-slot="command-separator"
|
|
136
|
+
className={cn("bg-border -mx-1 h-px", className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function CommandItem({
|
|
143
|
+
className,
|
|
144
|
+
...props
|
|
145
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
146
|
+
return (
|
|
147
|
+
<CommandPrimitive.Item
|
|
148
|
+
data-slot="command-item"
|
|
149
|
+
className={cn(
|
|
150
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
151
|
+
className
|
|
152
|
+
)}
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function CommandShortcut({
|
|
159
|
+
className,
|
|
160
|
+
...props
|
|
161
|
+
}: React.ComponentProps<"span">) {
|
|
162
|
+
return (
|
|
163
|
+
<span
|
|
164
|
+
data-slot="command-shortcut"
|
|
165
|
+
className={cn(
|
|
166
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
Command,
|
|
176
|
+
CommandDialog,
|
|
177
|
+
CommandInput,
|
|
178
|
+
CommandList,
|
|
179
|
+
CommandEmpty,
|
|
180
|
+
CommandGroup,
|
|
181
|
+
CommandItem,
|
|
182
|
+
CommandShortcut,
|
|
183
|
+
CommandSeparator,
|
|
184
|
+
}
|