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.
Files changed (192) hide show
  1. package/dist/index.js +11 -0
  2. package/package.json +6 -8
  3. package/templates/default/components/NewPage.tsx +2 -2
  4. package/templates/default/components/ProgressBar.tsx +46 -22
  5. package/templates/default/components/form/DateRangeFormInput.tsx +8 -6
  6. package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
  7. package/templates/default/components/form/inputs/DateFormInput.tsx +82 -34
  8. package/templates/default/components/form/inputs/MultipleSelectFormInput.tsx +40 -107
  9. package/templates/default/components/form/inputs/RichTextFormInput.tsx +2 -0
  10. package/templates/default/components/form/inputs/TagsFormInput.tsx +115 -26
  11. package/templates/default/components/form/inputs/TextFormInput.tsx +1 -1
  12. package/templates/default/components/multi-select.tsx +1144 -0
  13. package/templates/default/components/ui/badge.tsx +16 -12
  14. package/templates/default/components/ui/button.tsx +35 -30
  15. package/templates/default/components/ui/calendar.tsx +145 -47
  16. package/templates/default/components/ui/command.tsx +184 -0
  17. package/templates/default/components/ui/dialog.tsx +143 -0
  18. package/templates/default/components/ui/popover.tsx +39 -22
  19. package/templates/default/components/ui/progress.tsx +31 -0
  20. package/templates/default/components/ui/select.tsx +150 -149
  21. package/templates/default/components/ui/separator.tsx +28 -0
  22. package/templates/default/components.json +8 -3
  23. package/templates/default/{postinstall.js → lib/postinstall.js} +1 -1
  24. package/templates/default/lib/utils.ts +6 -0
  25. package/templates/default/{proxy.ts → middleware.ts} +3 -2
  26. package/templates/default/next-env.d.ts +1 -1
  27. package/templates/default/package.json +41 -53
  28. package/templates/default/public/tinymce/CHANGELOG.md +155 -0
  29. package/templates/default/public/tinymce/README.md +12 -12
  30. package/templates/default/public/tinymce/bower.json +1 -1
  31. package/templates/default/public/tinymce/composer.json +2 -2
  32. package/templates/default/public/tinymce/icons/default/icons.js +40 -32
  33. package/templates/default/public/tinymce/icons/default/icons.min.js +1 -1
  34. package/templates/default/public/tinymce/license.md +7 -4
  35. package/templates/default/public/tinymce/models/dom/model.js +36 -50
  36. package/templates/default/public/tinymce/models/dom/model.min.js +1 -1
  37. package/templates/default/public/tinymce/notices.txt +2 -2
  38. package/templates/default/public/tinymce/package.json +2 -2
  39. package/templates/default/public/tinymce/plugins/accordion/plugin.js +45 -21
  40. package/templates/default/public/tinymce/plugins/accordion/plugin.min.js +1 -1
  41. package/templates/default/public/tinymce/plugins/advlist/plugin.js +8 -6
  42. package/templates/default/public/tinymce/plugins/advlist/plugin.min.js +1 -1
  43. package/templates/default/public/tinymce/plugins/anchor/plugin.js +1 -1
  44. package/templates/default/public/tinymce/plugins/autolink/plugin.js +3 -6
  45. package/templates/default/public/tinymce/plugins/autolink/plugin.min.js +1 -1
  46. package/templates/default/public/tinymce/plugins/autoresize/plugin.js +4 -6
  47. package/templates/default/public/tinymce/plugins/autoresize/plugin.min.js +1 -1
  48. package/templates/default/public/tinymce/plugins/autosave/plugin.js +4 -7
  49. package/templates/default/public/tinymce/plugins/autosave/plugin.min.js +1 -1
  50. package/templates/default/public/tinymce/plugins/charmap/plugin.js +8 -8
  51. package/templates/default/public/tinymce/plugins/charmap/plugin.min.js +1 -1
  52. package/templates/default/public/tinymce/plugins/code/plugin.js +3 -2
  53. package/templates/default/public/tinymce/plugins/code/plugin.min.js +1 -1
  54. package/templates/default/public/tinymce/plugins/codesample/plugin.js +11 -10
  55. package/templates/default/public/tinymce/plugins/codesample/plugin.min.js +2 -2
  56. package/templates/default/public/tinymce/plugins/directionality/plugin.js +9 -11
  57. package/templates/default/public/tinymce/plugins/directionality/plugin.min.js +1 -1
  58. package/templates/default/public/tinymce/plugins/emoticons/plugin.js +7 -7
  59. package/templates/default/public/tinymce/plugins/emoticons/plugin.min.js +1 -1
  60. package/templates/default/public/tinymce/plugins/fullscreen/plugin.js +11 -13
  61. package/templates/default/public/tinymce/plugins/fullscreen/plugin.min.js +1 -1
  62. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg-BG.js +93 -0
  63. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr-FR.js +93 -0
  64. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he-IL.js +93 -0
  65. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu-HU.js +93 -0
  66. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko-KR.js +93 -0
  67. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb-NO.js +93 -0
  68. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-BR.js +93 -0
  69. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-PT.js +93 -0
  70. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl-SI.js +93 -0
  71. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv-SE.js +93 -0
  72. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th-TH.js +93 -0
  73. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-CN.js +87 -0
  74. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-TW.js +93 -0
  75. package/templates/default/public/tinymce/plugins/help/plugin.js +15 -17
  76. package/templates/default/public/tinymce/plugins/help/plugin.min.js +1 -1
  77. package/templates/default/public/tinymce/plugins/image/plugin.js +34 -32
  78. package/templates/default/public/tinymce/plugins/image/plugin.min.js +1 -1
  79. package/templates/default/public/tinymce/plugins/importcss/plugin.js +4 -6
  80. package/templates/default/public/tinymce/plugins/importcss/plugin.min.js +1 -1
  81. package/templates/default/public/tinymce/plugins/insertdatetime/plugin.js +4 -3
  82. package/templates/default/public/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
  83. package/templates/default/public/tinymce/plugins/link/plugin.js +170 -38
  84. package/templates/default/public/tinymce/plugins/link/plugin.min.js +1 -1
  85. package/templates/default/public/tinymce/plugins/lists/plugin.js +111 -2053
  86. package/templates/default/public/tinymce/plugins/lists/plugin.min.js +1 -1
  87. package/templates/default/public/tinymce/plugins/media/plugin.js +15 -23
  88. package/templates/default/public/tinymce/plugins/media/plugin.min.js +1 -1
  89. package/templates/default/public/tinymce/plugins/nonbreaking/plugin.js +1 -1
  90. package/templates/default/public/tinymce/plugins/pagebreak/plugin.js +1 -1
  91. package/templates/default/public/tinymce/plugins/preview/plugin.js +88 -10
  92. package/templates/default/public/tinymce/plugins/preview/plugin.min.js +1 -1
  93. package/templates/default/public/tinymce/plugins/quickbars/plugin.js +9 -9
  94. package/templates/default/public/tinymce/plugins/quickbars/plugin.min.js +1 -1
  95. package/templates/default/public/tinymce/plugins/save/plugin.js +1 -1
  96. package/templates/default/public/tinymce/plugins/searchreplace/plugin.js +10 -13
  97. package/templates/default/public/tinymce/plugins/searchreplace/plugin.min.js +1 -1
  98. package/templates/default/public/tinymce/plugins/table/plugin.js +13 -24
  99. package/templates/default/public/tinymce/plugins/table/plugin.min.js +1 -1
  100. package/templates/default/public/tinymce/plugins/visualblocks/plugin.js +1 -1
  101. package/templates/default/public/tinymce/plugins/visualchars/plugin.js +9 -10
  102. package/templates/default/public/tinymce/plugins/visualchars/plugin.min.js +1 -1
  103. package/templates/default/public/tinymce/plugins/wordcount/plugin.js +1 -1
  104. package/templates/default/public/tinymce/skins/content/dark/content.min.ts +3 -0
  105. package/templates/default/public/tinymce/skins/content/dark/content.ts +3 -0
  106. package/templates/default/public/tinymce/skins/content/default/content.min.ts +3 -0
  107. package/templates/default/public/tinymce/skins/content/default/content.ts +3 -0
  108. package/templates/default/public/tinymce/skins/content/document/content.min.ts +3 -0
  109. package/templates/default/public/tinymce/skins/content/document/content.ts +3 -0
  110. package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.ts +3 -0
  111. package/templates/default/public/tinymce/skins/content/tinymce-5/content.ts +3 -0
  112. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.ts +3 -0
  113. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.ts +3 -0
  114. package/templates/default/public/tinymce/skins/content/writer/content.min.ts +3 -0
  115. package/templates/default/public/tinymce/skins/content/writer/content.ts +3 -0
  116. package/templates/default/public/tinymce/skins/ui/oxide/content.css +144 -0
  117. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.css +144 -0
  118. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.js +1 -1
  119. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  120. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.ts +116 -0
  121. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.ts +116 -0
  122. package/templates/default/public/tinymce/skins/ui/oxide/content.js +1 -1
  123. package/templates/default/public/tinymce/skins/ui/oxide/content.min.css +1 -1
  124. package/templates/default/public/tinymce/skins/ui/oxide/content.min.ts +116 -0
  125. package/templates/default/public/tinymce/skins/ui/oxide/content.ts +116 -0
  126. package/templates/default/public/tinymce/skins/ui/oxide/skin.css +923 -449
  127. package/templates/default/public/tinymce/skins/ui/oxide/skin.js +1 -1
  128. package/templates/default/public/tinymce/skins/ui/oxide/skin.min.css +1 -1
  129. package/templates/default/public/tinymce/skins/ui/oxide/skin.min.ts +507 -0
  130. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.ts +9 -0
  131. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.ts +9 -0
  132. package/templates/default/public/tinymce/skins/ui/oxide/skin.ts +507 -0
  133. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.css +144 -0
  134. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.css +144 -0
  135. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.js +1 -1
  136. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  137. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.ts +116 -0
  138. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.ts +116 -0
  139. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.js +1 -1
  140. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  141. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.ts +116 -0
  142. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.ts +116 -0
  143. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.css +926 -452
  144. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.js +1 -1
  145. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  146. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.ts +507 -0
  147. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.ts +9 -0
  148. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.ts +9 -0
  149. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.ts +507 -0
  150. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.css +144 -0
  151. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.css +144 -0
  152. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.js +1 -1
  153. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  154. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.ts +116 -0
  155. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.ts +116 -0
  156. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.js +1 -1
  157. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  158. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.ts +116 -0
  159. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.ts +116 -0
  160. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.css +924 -450
  161. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.js +1 -1
  162. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  163. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.ts +508 -0
  164. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.ts +9 -0
  165. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.ts +9 -0
  166. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.ts +508 -0
  167. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.css +144 -0
  168. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.css +144 -0
  169. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -1
  170. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  171. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.ts +116 -0
  172. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.ts +116 -0
  173. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.js +1 -1
  174. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  175. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.ts +116 -0
  176. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.ts +116 -0
  177. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.css +925 -451
  178. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -1
  179. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  180. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.ts +508 -0
  181. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.ts +9 -0
  182. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.ts +9 -0
  183. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.ts +508 -0
  184. package/templates/default/public/tinymce/themes/silver/theme.js +543 -593
  185. package/templates/default/public/tinymce/themes/silver/theme.min.js +1 -1
  186. package/templates/default/public/tinymce/tinymce.d.ts +559 -496
  187. package/templates/default/public/tinymce/tinymce.js +6788 -3964
  188. package/templates/default/public/tinymce/tinymce.min.js +3 -4
  189. package/templates/default/styles/globals.css +132 -107
  190. package/templates/default/tsconfig.json +45 -45
  191. package/templates/default/.prettierrc.json +0 -19
  192. 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 'nextjs-cms/utils'
5
+ import { cn } from '@/lib/utils'
5
6
 
6
7
  const badgeVariants = cva(
7
- 'inline-flex items-center rounded-md border px-1.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2',
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 shadow-sm hover:bg-primary/80',
12
- secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
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-foreground shadow-sm hover:bg-destructive/80',
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
- export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
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
- function Badge({ className, variant, ...props }: BadgeProps) {
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 'nextjs-cms/utils'
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-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
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-foreground shadow-xs hover:bg-destructive/90",
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 border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
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 shadow-xs hover:bg-secondary/80",
20
- ghost: "hover:bg-accent hover:text-accent-foreground",
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 text-xs",
26
- lg: "h-10 rounded-md px-8",
27
- icon: "h-9 w-9",
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
- export interface ButtonProps
38
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39
- VariantProps<typeof buttonVariants> {
40
- asChild?: boolean
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
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44
- ({ className, variant, size, asChild = false, ...props }, ref) => {
45
- const Comp = asChild ? Slot : "button"
46
- return (
47
- <Comp
48
- className={cn(buttonVariants({ variant, size, className }))}
49
- ref={ref}
50
- {...props}
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 { DayPicker } from 'react-day-picker'
4
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
5
+ import { DayPicker, getDefaultClassNames, type DayButton } from 'react-day-picker'
5
6
 
6
- import { cn } from 'nextjs-cms/utils'
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
- export type CalendarProps = React.ComponentProps<typeof DayPicker>
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('p-3', className)}
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
- months: 'flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0',
19
- month: 'space-y-4',
20
- caption: 'flex justify-center pt-1 relative items-center',
21
- caption_label: 'text-sm font-medium',
22
- nav: 'space-x-1 flex items-center',
23
- nav_button: cn(
24
- buttonVariants({ variant: 'outline' }),
25
- 'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100',
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
- nav_button_previous: 'absolute left-1',
28
- nav_button_next: 'absolute right-1',
29
- table: 'w-full border-collapse space-y-1',
30
- head_row: 'flex',
31
- head_cell: 'text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]',
32
- row: 'flex w-full mt-2',
33
- cell: cn(
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
- day: cn(buttonVariants({ variant: 'ghost' }), 'h-8 w-8 p-0 font-normal aria-selected:opacity-100'),
40
- day_range_start: 'day-range-start',
41
- day_range_end: 'day-range-end',
42
- day_selected:
43
- 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground',
44
- day_today: 'bg-accent text-accent-foreground',
45
- day_outside:
46
- 'day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground',
47
- day_disabled: 'text-muted-foreground opacity-50',
48
- day_range_middle: 'aria-selected:bg-accent aria-selected:text-accent-foreground',
49
- day_hidden: 'invisible',
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
- IconLeft: ({ className, ...props }) => (
54
- // @ts-ignore
55
- <ChevronLeftIcon className={cn('h-4 w-4', className)} {...props} />
56
- ),
57
- IconRight: ({ className, ...props }) => (
58
- // @ts-ignore
59
- <ChevronRightIcon className={cn('h-4 w-4', className)} {...props} />
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
- export { Calendar }
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
+ }