@lark-apaas/coding-templates 0.1.4 → 0.1.6

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 (85) hide show
  1. package/package.json +1 -1
  2. package/template-vite-react/README.md +175 -0
  3. package/template-vite-react/client/index.html +2 -1
  4. package/template-vite-react/client/src/app.tsx +3 -1
  5. package/template-vite-react/client/src/components/layout.tsx +0 -2
  6. package/template-vite-react/client/src/components/ui/README.md +134 -0
  7. package/template-vite-react/client/src/components/ui/accordion.tsx +22 -28
  8. package/template-vite-react/client/src/components/ui/alert-dialog.tsx +34 -64
  9. package/template-vite-react/client/src/components/ui/alert.tsx +10 -15
  10. package/template-vite-react/client/src/components/ui/aspect-ratio.tsx +5 -16
  11. package/template-vite-react/client/src/components/ui/avatar.tsx +11 -67
  12. package/template-vite-react/client/src/components/ui/badge.tsx +21 -31
  13. package/template-vite-react/client/src/components/ui/breadcrumb.tsx +23 -39
  14. package/template-vite-react/client/src/components/ui/button.tsx +36 -25
  15. package/template-vite-react/client/src/components/ui/calendar.tsx +37 -43
  16. package/template-vite-react/client/src/components/ui/card.tsx +73 -94
  17. package/template-vite-react/client/src/components/ui/carousel.tsx +7 -8
  18. package/template-vite-react/client/src/components/ui/chart.tsx +35 -49
  19. package/template-vite-react/client/src/components/ui/checkbox.tsx +10 -7
  20. package/template-vite-react/client/src/components/ui/collapsible.tsx +20 -6
  21. package/template-vite-react/client/src/components/ui/command.tsx +52 -40
  22. package/template-vite-react/client/src/components/ui/context-menu.tsx +170 -117
  23. package/template-vite-react/client/src/components/ui/dialog.tsx +37 -52
  24. package/template-vite-react/client/src/components/ui/drawer.tsx +12 -9
  25. package/template-vite-react/client/src/components/ui/dropdown-menu.tsx +194 -133
  26. package/template-vite-react/client/src/components/ui/hover-card.tsx +24 -29
  27. package/template-vite-react/client/src/components/ui/input-group.tsx +39 -29
  28. package/template-vite-react/client/src/components/ui/input-otp.tsx +7 -17
  29. package/template-vite-react/client/src/components/ui/input.tsx +4 -3
  30. package/template-vite-react/client/src/components/ui/label.tsx +9 -3
  31. package/template-vite-react/client/src/components/ui/menubar.tsx +160 -92
  32. package/template-vite-react/client/src/components/ui/navigation-menu.tsx +45 -45
  33. package/template-vite-react/client/src/components/ui/pagination.tsx +32 -35
  34. package/template-vite-react/client/src/components/ui/popover.tsx +20 -62
  35. package/template-vite-react/client/src/components/ui/progress.tsx +14 -64
  36. package/template-vite-react/client/src/components/ui/radio-group.tsx +20 -13
  37. package/template-vite-react/client/src/components/ui/resizable.tsx +18 -10
  38. package/template-vite-react/client/src/components/ui/scroll-area.tsx +13 -10
  39. package/template-vite-react/client/src/components/ui/select.tsx +122 -78
  40. package/template-vite-react/client/src/components/ui/separator.tsx +7 -4
  41. package/template-vite-react/client/src/components/ui/sheet.tsx +42 -41
  42. package/template-vite-react/client/src/components/ui/sidebar.tsx +162 -156
  43. package/template-vite-react/client/src/components/ui/skeleton.tsx +1 -1
  44. package/template-vite-react/client/src/components/ui/slider.tsx +52 -22
  45. package/template-vite-react/client/src/components/ui/sonner.tsx +44 -26
  46. package/template-vite-react/client/src/components/ui/switch.tsx +9 -8
  47. package/template-vite-react/client/src/components/ui/table.tsx +5 -5
  48. package/template-vite-react/client/src/components/ui/tabs.tsx +24 -38
  49. package/template-vite-react/client/src/components/ui/textarea.tsx +1 -1
  50. package/template-vite-react/client/src/components/ui/toggle-group.tsx +14 -20
  51. package/template-vite-react/client/src/components/ui/toggle.tsx +13 -10
  52. package/template-vite-react/client/src/components/ui/tooltip.tsx +30 -33
  53. package/template-vite-react/client/src/index.css +130 -0
  54. package/template-vite-react/client/src/main.tsx +1 -4
  55. package/template-vite-react/client/src/pages/home/index.tsx +5 -5
  56. package/template-vite-react/components.json +2 -6
  57. package/template-vite-react/eslint.config.js +11 -0
  58. package/template-vite-react/package.json +27 -2
  59. package/template-vite-react/vite.config.ts +5 -0
  60. package/template-vite-react/client/src/components/header.tsx +0 -22
  61. package/template-vite-react/client/src/components/theme-provider.tsx +0 -45
  62. package/template-vite-react/client/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -21
  63. package/template-vite-react/client/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -36
  64. package/template-vite-react/client/src/components/ui/icons/file-android-colorful-icon.tsx +0 -33
  65. package/template-vite-react/client/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -21
  66. package/template-vite-react/client/src/components/ui/icons/file-code-colorful-icon.tsx +0 -28
  67. package/template-vite-react/client/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -21
  68. package/template-vite-react/client/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -29
  69. package/template-vite-react/client/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -25
  70. package/template-vite-react/client/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -29
  71. package/template-vite-react/client/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -29
  72. package/template-vite-react/client/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -21
  73. package/template-vite-react/client/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -21
  74. package/template-vite-react/client/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -21
  75. package/template-vite-react/client/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -29
  76. package/template-vite-react/client/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -23
  77. package/template-vite-react/client/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -27
  78. package/template-vite-react/client/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -20
  79. package/template-vite-react/client/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -21
  80. package/template-vite-react/client/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -12
  81. package/template-vite-react/client/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -14
  82. package/template-vite-react/client/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -23
  83. package/template-vite-react/client/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -38
  84. package/template-vite-react/client/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -21
  85. package/template-vite-react/client/src/types/index.ts +0 -1
@@ -1,26 +1,29 @@
1
1
  "use client"
2
2
 
3
- import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
3
+ import * as React from "react"
4
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
5
+ import { CheckIcon } from "lucide-react"
4
6
 
5
7
  import { cn } from "@/lib/utils"
6
- import { CheckIcon } from "lucide-react"
7
8
 
8
- function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
9
+ function Checkbox({
10
+ className,
11
+ ...props
12
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
9
13
  return (
10
14
  <CheckboxPrimitive.Root
11
15
  data-slot="checkbox"
12
16
  className={cn(
13
- "peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors 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",
17
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
14
18
  className
15
19
  )}
16
20
  {...props}
17
21
  >
18
22
  <CheckboxPrimitive.Indicator
19
23
  data-slot="checkbox-indicator"
20
- className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
24
+ className="grid place-content-center text-current transition-none"
21
25
  >
22
- <CheckIcon
23
- />
26
+ <CheckIcon className="size-3.5" />
24
27
  </CheckboxPrimitive.Indicator>
25
28
  </CheckboxPrimitive.Root>
26
29
  )
@@ -1,18 +1,32 @@
1
- import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
1
+ "use client"
2
2
 
3
- function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
3
+ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
4
+
5
+ function Collapsible({
6
+ ...props
7
+ }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
4
8
  return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
5
9
  }
6
10
 
7
- function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
11
+ function CollapsibleTrigger({
12
+ ...props
13
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
8
14
  return (
9
- <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
15
+ <CollapsiblePrimitive.CollapsibleTrigger
16
+ data-slot="collapsible-trigger"
17
+ {...props}
18
+ />
10
19
  )
11
20
  }
12
21
 
13
- function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
22
+ function CollapsibleContent({
23
+ ...props
24
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
14
25
  return (
15
- <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
26
+ <CollapsiblePrimitive.CollapsibleContent
27
+ data-slot="collapsible-content"
28
+ {...props}
29
+ />
16
30
  )
17
31
  }
18
32
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  import * as React from "react"
4
4
  import { Command as CommandPrimitive } from "cmdk"
5
+ import { SearchIcon } from "lucide-react"
5
6
 
6
7
  import { cn } from "@/lib/utils"
7
8
  import {
@@ -11,11 +12,6 @@ import {
11
12
  DialogHeader,
12
13
  DialogTitle,
13
14
  } from "@/components/ui/dialog"
14
- import {
15
- InputGroup,
16
- InputGroupAddon,
17
- } from "@/components/ui/input-group"
18
- import { SearchIcon, CheckIcon } from "lucide-react"
19
15
 
20
16
  function Command({
21
17
  className,
@@ -25,7 +21,7 @@ function Command({
25
21
  <CommandPrimitive
26
22
  data-slot="command"
27
23
  className={cn(
28
- "flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
24
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
29
25
  className
30
26
  )}
31
27
  {...props}
@@ -38,14 +34,13 @@ function CommandDialog({
38
34
  description = "Search for a command to run...",
39
35
  children,
40
36
  className,
41
- showCloseButton = false,
37
+ showCloseButton = true,
42
38
  ...props
43
- }: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
39
+ }: React.ComponentProps<typeof Dialog> & {
44
40
  title?: string
45
41
  description?: string
46
42
  className?: string
47
43
  showCloseButton?: boolean
48
- children: React.ReactNode
49
44
  }) {
50
45
  return (
51
46
  <Dialog {...props}>
@@ -54,13 +49,12 @@ function CommandDialog({
54
49
  <DialogDescription>{description}</DialogDescription>
55
50
  </DialogHeader>
56
51
  <DialogContent
57
- className={cn(
58
- "top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
59
- className
60
- )}
52
+ className={cn("overflow-hidden p-0", className)}
61
53
  showCloseButton={showCloseButton}
62
54
  >
63
- {children}
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>
64
58
  </DialogContent>
65
59
  </Dialog>
66
60
  )
@@ -71,20 +65,19 @@ function CommandInput({
71
65
  ...props
72
66
  }: React.ComponentProps<typeof CommandPrimitive.Input>) {
73
67
  return (
74
- <div data-slot="command-input-wrapper" className="p-1 pb-0">
75
- <InputGroup className="h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!">
76
- <CommandPrimitive.Input
77
- data-slot="command-input"
78
- className={cn(
79
- "w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
80
- className
81
- )}
82
- {...props}
83
- />
84
- <InputGroupAddon>
85
- <SearchIcon className="size-4 shrink-0 opacity-50" />
86
- </InputGroupAddon>
87
- </InputGroup>
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
+ />
88
81
  </div>
89
82
  )
90
83
  }
@@ -97,7 +90,7 @@ function CommandList({
97
90
  <CommandPrimitive.List
98
91
  data-slot="command-list"
99
92
  className={cn(
100
- "no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
93
+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
101
94
  className
102
95
  )}
103
96
  {...props}
@@ -106,13 +99,12 @@ function CommandList({
106
99
  }
107
100
 
108
101
  function CommandEmpty({
109
- className,
110
102
  ...props
111
103
  }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
112
104
  return (
113
105
  <CommandPrimitive.Empty
114
106
  data-slot="command-empty"
115
- className={cn("py-6 text-center text-sm", className)}
107
+ className="py-6 text-center text-sm"
116
108
  {...props}
117
109
  />
118
110
  )
@@ -126,7 +118,7 @@ function CommandGroup({
126
118
  <CommandPrimitive.Group
127
119
  data-slot="command-group"
128
120
  className={cn(
129
- "overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",
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",
130
122
  className
131
123
  )}
132
124
  {...props}
@@ -141,7 +133,7 @@ function CommandSeparator({
141
133
  return (
142
134
  <CommandPrimitive.Separator
143
135
  data-slot="command-separator"
144
- className={cn("-mx-1 h-px bg-border", className)}
136
+ className={cn("bg-border -mx-1 h-px", className)}
145
137
  {...props}
146
138
  />
147
139
  )
@@ -149,21 +141,41 @@ function CommandSeparator({
149
141
 
150
142
  function CommandItem({
151
143
  className,
152
- children,
144
+ disabled,
145
+ onClick,
146
+ onMouseDown,
147
+ onKeyDown,
148
+ onKeyUp,
149
+ onPointerDown,
153
150
  ...props
154
151
  }: React.ComponentProps<typeof CommandPrimitive.Item>) {
155
152
  return (
156
153
  <CommandPrimitive.Item
157
154
  data-slot="command-item"
158
155
  className={cn(
159
- "group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",
156
+ "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]:cursor-not-allowed data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
160
157
  className
161
158
  )}
159
+ disabled={disabled}
160
+ onClick={(event) => {
161
+ if (disabled) {
162
+ event.preventDefault()
163
+ return
164
+ }
165
+ onClick?.(event)
166
+ }}
167
+ onMouseDown={disabled ? undefined : onMouseDown}
168
+ onKeyDown={disabled ? undefined : onKeyDown}
169
+ onKeyUp={disabled ? undefined : onKeyUp}
170
+ onPointerDown={(event) => {
171
+ if (disabled) {
172
+ event.preventDefault()
173
+ return
174
+ }
175
+ onPointerDown?.(event)
176
+ }}
162
177
  {...props}
163
- >
164
- {children}
165
- <CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
166
- </CommandPrimitive.Item>
178
+ />
167
179
  )
168
180
  }
169
181
 
@@ -175,7 +187,7 @@ function CommandShortcut({
175
187
  <span
176
188
  data-slot="command-shortcut"
177
189
  className={cn(
178
- "ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
190
+ "text-muted-foreground ml-auto text-xs tracking-widest",
179
191
  className
180
192
  )}
181
193
  {...props}