create-ec-app 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -17
- package/dist/cssScope.js +3 -5
- package/dist/cssScope.js.map +1 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +129 -53
- package/dist/index.js.map +1 -1
- package/dist/libFunctions.d.ts +13 -6
- package/dist/libFunctions.d.ts.map +1 -1
- package/dist/libFunctions.js +24 -9
- package/dist/libFunctions.js.map +1 -1
- package/dist/pcf.d.ts.map +1 -1
- package/dist/pcf.js +4 -1
- package/dist/pcf.js.map +1 -1
- package/dist/portalContainers.js +7 -5
- package/dist/portalContainers.js.map +1 -1
- package/package.json +18 -11
- package/scripts/build-generated.mjs +59 -0
- package/scripts/refresh-shadcn-template.ts +406 -0
- package/scripts/smoke-scaffold.mjs +245 -0
- package/templates/base/eslint.config.js +1 -1
- package/templates/base/package-lock.json +380 -476
- package/templates/base/package.json +14 -19
- package/templates/pcf/base/package-lock.json +35 -53
- package/templates/targets/code-apps/AGENTS.md +187 -0
- package/templates/targets/code-apps/CLAUDE.md +1 -0
- package/templates/targets/code-apps/package.patch.json +1 -1
- package/templates/targets/power-pages/AGENTS.md +192 -0
- package/templates/targets/power-pages/CLAUDE.md +1 -0
- package/templates/targets/power-pages/README.md +22 -2
- package/templates/targets/power-pages/src/App.patch.tsx +3 -1
- package/templates/targets/power-pages/src/components/shared/AuthError.tsx +18 -0
- package/templates/targets/power-pages/src/context/AuthContext.tsx +0 -4
- package/templates/targets/swa/AGENTS.md +181 -0
- package/templates/targets/swa/CLAUDE.md +1 -0
- package/templates/targets/webresource/AGENTS.md +179 -67
- package/templates/targets/webresource/CLAUDE.md +1 -0
- package/templates/targets/webresource/README.md +5 -5
- package/templates/ui/kendo/package.patch.json +2 -2
- package/templates/ui/shadcn-ui/SHADCN_TEMPLATE.md +20 -0
- package/templates/ui/shadcn-ui/package.patch.json +18 -9
- package/templates/ui/shadcn-ui/src/components/ui/accordion.tsx +79 -0
- package/templates/ui/shadcn-ui/src/components/ui/alert-dialog.tsx +199 -0
- package/templates/ui/shadcn-ui/src/components/ui/alert.tsx +76 -0
- package/templates/ui/shadcn-ui/src/components/ui/aspect-ratio.tsx +11 -0
- package/templates/ui/shadcn-ui/src/components/ui/attachment.tsx +206 -0
- package/templates/ui/shadcn-ui/src/components/ui/avatar.tsx +110 -0
- package/templates/ui/shadcn-ui/src/components/ui/badge.tsx +49 -0
- package/templates/ui/shadcn-ui/src/components/ui/breadcrumb.tsx +122 -0
- package/templates/ui/shadcn-ui/src/components/ui/bubble.tsx +125 -0
- package/templates/ui/shadcn-ui/src/components/ui/button-group.tsx +83 -0
- package/templates/ui/shadcn-ui/src/components/ui/button.tsx +67 -0
- package/templates/ui/shadcn-ui/src/components/ui/calendar.tsx +222 -0
- package/templates/ui/shadcn-ui/src/components/ui/card.tsx +103 -0
- package/templates/ui/shadcn-ui/src/components/ui/carousel.tsx +240 -0
- package/templates/ui/shadcn-ui/src/components/ui/chart.tsx +373 -0
- package/templates/ui/shadcn-ui/src/components/ui/checkbox.tsx +31 -0
- package/templates/ui/shadcn-ui/src/components/ui/collapsible.tsx +33 -0
- package/templates/ui/shadcn-ui/src/components/ui/combobox.tsx +299 -0
- package/templates/ui/shadcn-ui/src/components/ui/command.tsx +195 -0
- package/templates/ui/shadcn-ui/src/components/ui/context-menu.tsx +264 -0
- package/templates/ui/shadcn-ui/src/components/ui/dialog.tsx +170 -0
- package/templates/ui/shadcn-ui/src/components/ui/direction.tsx +22 -0
- package/templates/ui/shadcn-ui/src/components/ui/drawer.tsx +134 -0
- package/templates/ui/shadcn-ui/src/components/ui/dropdown-menu.tsx +272 -0
- package/templates/ui/shadcn-ui/src/components/ui/empty.tsx +104 -0
- package/templates/ui/shadcn-ui/src/components/ui/field.tsx +236 -0
- package/templates/ui/shadcn-ui/src/components/ui/hover-card.tsx +44 -0
- package/templates/ui/shadcn-ui/src/components/ui/input-group.tsx +156 -0
- package/templates/ui/shadcn-ui/src/components/ui/input-otp.tsx +87 -0
- package/templates/ui/shadcn-ui/src/components/ui/input.tsx +19 -0
- package/templates/ui/shadcn-ui/src/components/ui/item.tsx +196 -0
- package/templates/ui/shadcn-ui/src/components/ui/kbd.tsx +26 -0
- package/templates/ui/shadcn-ui/src/components/ui/label.tsx +22 -0
- package/templates/ui/shadcn-ui/src/components/ui/marker.tsx +69 -0
- package/templates/ui/shadcn-ui/src/components/ui/menubar.tsx +282 -0
- package/templates/ui/shadcn-ui/src/components/ui/message-scroller.tsx +129 -0
- package/templates/ui/shadcn-ui/src/components/ui/message.tsx +92 -0
- package/templates/ui/shadcn-ui/src/components/ui/native-select.tsx +61 -0
- package/templates/ui/shadcn-ui/src/components/ui/navigation-menu.tsx +164 -0
- package/templates/ui/shadcn-ui/src/components/ui/pagination.tsx +129 -0
- package/templates/ui/shadcn-ui/src/components/ui/popover.tsx +89 -0
- package/templates/ui/shadcn-ui/src/components/ui/progress.tsx +31 -0
- package/templates/ui/shadcn-ui/src/components/ui/radio-group.tsx +42 -0
- package/templates/ui/shadcn-ui/src/components/ui/resizable.tsx +50 -0
- package/templates/ui/shadcn-ui/src/components/ui/scroll-area.tsx +53 -0
- package/templates/ui/shadcn-ui/src/components/ui/select.tsx +194 -0
- package/templates/ui/shadcn-ui/src/components/ui/separator.tsx +26 -0
- package/templates/ui/shadcn-ui/src/components/ui/sheet.tsx +149 -0
- package/templates/ui/shadcn-ui/src/components/ui/sidebar.tsx +702 -0
- package/templates/ui/shadcn-ui/src/components/ui/skeleton.tsx +13 -0
- package/templates/ui/shadcn-ui/src/components/ui/slider.tsx +59 -0
- package/templates/ui/shadcn-ui/src/components/ui/sonner.tsx +47 -0
- package/templates/ui/shadcn-ui/src/components/ui/spinner.tsx +10 -0
- package/templates/ui/shadcn-ui/src/components/ui/switch.tsx +33 -0
- package/templates/ui/shadcn-ui/src/components/ui/table.tsx +114 -0
- package/templates/ui/shadcn-ui/src/components/ui/tabs.tsx +90 -0
- package/templates/ui/shadcn-ui/src/components/ui/textarea.tsx +18 -0
- package/templates/ui/shadcn-ui/src/components/ui/toggle-group.tsx +87 -0
- package/templates/ui/shadcn-ui/src/components/ui/toggle.tsx +45 -0
- package/templates/ui/shadcn-ui/src/components/ui/tooltip.tsx +59 -0
- package/templates/ui/shadcn-ui/src/index.patch.css +0 -118
- package/templates/ui/shadcn-ui/src/runtime/PortalContainer.ts +8 -0
- package/templates/base/biome.json +0 -54
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Menubar as MenubarPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { CheckIcon, ChevronRightIcon } from "lucide-react"
|
|
8
|
+
import { usePortalContainer } from "@/runtime/PortalContainer"
|
|
9
|
+
|
|
10
|
+
function Menubar({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<MenubarPrimitive.Root
|
|
16
|
+
data-slot="menubar"
|
|
17
|
+
className={cn(
|
|
18
|
+
"flex h-8 items-center gap-0.5 rounded-lg border p-[3px]",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function MenubarMenu({
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
|
|
29
|
+
return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function MenubarGroup({
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Group>) {
|
|
35
|
+
return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function MenubarPortal({
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
|
|
41
|
+
const portalContainer = usePortalContainer()
|
|
42
|
+
return <MenubarPrimitive.Portal container={portalContainer ?? undefined} data-slot="menubar-portal" {...props} />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function MenubarRadioGroup({
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
|
|
48
|
+
return (
|
|
49
|
+
<MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function MenubarTrigger({
|
|
54
|
+
className,
|
|
55
|
+
...props
|
|
56
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
|
|
57
|
+
return (
|
|
58
|
+
<MenubarPrimitive.Trigger
|
|
59
|
+
data-slot="menubar-trigger"
|
|
60
|
+
className={cn(
|
|
61
|
+
"flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function MenubarContent({
|
|
70
|
+
className,
|
|
71
|
+
align = "start",
|
|
72
|
+
alignOffset = -4,
|
|
73
|
+
sideOffset = 8,
|
|
74
|
+
...props
|
|
75
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Content>) {
|
|
76
|
+
return (
|
|
77
|
+
<MenubarPortal>
|
|
78
|
+
<MenubarPrimitive.Content
|
|
79
|
+
data-slot="menubar-content"
|
|
80
|
+
align={align}
|
|
81
|
+
alignOffset={alignOffset}
|
|
82
|
+
sideOffset={sideOffset}
|
|
83
|
+
className={cn("z-50 min-w-36 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95", className )}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
</MenubarPortal>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function MenubarItem({
|
|
91
|
+
className,
|
|
92
|
+
inset,
|
|
93
|
+
variant = "default",
|
|
94
|
+
...props
|
|
95
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Item> & {
|
|
96
|
+
inset?: boolean
|
|
97
|
+
variant?: "default" | "destructive"
|
|
98
|
+
}) {
|
|
99
|
+
return (
|
|
100
|
+
<MenubarPrimitive.Item
|
|
101
|
+
data-slot="menubar-item"
|
|
102
|
+
data-inset={inset}
|
|
103
|
+
data-variant={variant}
|
|
104
|
+
className={cn(
|
|
105
|
+
"group/menubar-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
|
|
106
|
+
className
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function MenubarCheckboxItem({
|
|
114
|
+
className,
|
|
115
|
+
children,
|
|
116
|
+
checked,
|
|
117
|
+
inset,
|
|
118
|
+
...props
|
|
119
|
+
}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem> & {
|
|
120
|
+
inset?: boolean
|
|
121
|
+
}) {
|
|
122
|
+
return (
|
|
123
|
+
<MenubarPrimitive.CheckboxItem
|
|
124
|
+
data-slot="menubar-checkbox-item"
|
|
125
|
+
data-inset={inset}
|
|
126
|
+
className={cn(
|
|
127
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
128
|
+
className
|
|
129
|
+
)}
|
|
130
|
+
checked={checked}
|
|
131
|
+
{...props}
|
|
132
|
+
>
|
|
133
|
+
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
134
|
+
<MenubarPrimitive.ItemIndicator>
|
|
135
|
+
<CheckIcon
|
|
136
|
+
/>
|
|
137
|
+
</MenubarPrimitive.ItemIndicator>
|
|
138
|
+
</span>
|
|
139
|
+
{children}
|
|
140
|
+
</MenubarPrimitive.CheckboxItem>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function MenubarRadioItem({
|
|
145
|
+
className,
|
|
146
|
+
children,
|
|
147
|
+
inset,
|
|
148
|
+
...props
|
|
149
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioItem> & {
|
|
150
|
+
inset?: boolean
|
|
151
|
+
}) {
|
|
152
|
+
return (
|
|
153
|
+
<MenubarPrimitive.RadioItem
|
|
154
|
+
data-slot="menubar-radio-item"
|
|
155
|
+
data-inset={inset}
|
|
156
|
+
className={cn(
|
|
157
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
158
|
+
className
|
|
159
|
+
)}
|
|
160
|
+
{...props}
|
|
161
|
+
>
|
|
162
|
+
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
163
|
+
<MenubarPrimitive.ItemIndicator>
|
|
164
|
+
<CheckIcon
|
|
165
|
+
/>
|
|
166
|
+
</MenubarPrimitive.ItemIndicator>
|
|
167
|
+
</span>
|
|
168
|
+
{children}
|
|
169
|
+
</MenubarPrimitive.RadioItem>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function MenubarLabel({
|
|
174
|
+
className,
|
|
175
|
+
inset,
|
|
176
|
+
...props
|
|
177
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Label> & {
|
|
178
|
+
inset?: boolean
|
|
179
|
+
}) {
|
|
180
|
+
return (
|
|
181
|
+
<MenubarPrimitive.Label
|
|
182
|
+
data-slot="menubar-label"
|
|
183
|
+
data-inset={inset}
|
|
184
|
+
className={cn(
|
|
185
|
+
"px-1.5 py-1 text-sm font-medium data-inset:pl-7",
|
|
186
|
+
className
|
|
187
|
+
)}
|
|
188
|
+
{...props}
|
|
189
|
+
/>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function MenubarSeparator({
|
|
194
|
+
className,
|
|
195
|
+
...props
|
|
196
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
|
|
197
|
+
return (
|
|
198
|
+
<MenubarPrimitive.Separator
|
|
199
|
+
data-slot="menubar-separator"
|
|
200
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
201
|
+
{...props}
|
|
202
|
+
/>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function MenubarShortcut({
|
|
207
|
+
className,
|
|
208
|
+
...props
|
|
209
|
+
}: React.ComponentProps<"span">) {
|
|
210
|
+
return (
|
|
211
|
+
<span
|
|
212
|
+
data-slot="menubar-shortcut"
|
|
213
|
+
className={cn(
|
|
214
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground",
|
|
215
|
+
className
|
|
216
|
+
)}
|
|
217
|
+
{...props}
|
|
218
|
+
/>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function MenubarSub({
|
|
223
|
+
...props
|
|
224
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
|
|
225
|
+
return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function MenubarSubTrigger({
|
|
229
|
+
className,
|
|
230
|
+
inset,
|
|
231
|
+
children,
|
|
232
|
+
...props
|
|
233
|
+
}: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
|
|
234
|
+
inset?: boolean
|
|
235
|
+
}) {
|
|
236
|
+
return (
|
|
237
|
+
<MenubarPrimitive.SubTrigger
|
|
238
|
+
data-slot="menubar-sub-trigger"
|
|
239
|
+
data-inset={inset}
|
|
240
|
+
className={cn(
|
|
241
|
+
"flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
242
|
+
className
|
|
243
|
+
)}
|
|
244
|
+
{...props}
|
|
245
|
+
>
|
|
246
|
+
{children}
|
|
247
|
+
<ChevronRightIcon className="ml-auto size-4" />
|
|
248
|
+
</MenubarPrimitive.SubTrigger>
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function MenubarSubContent({
|
|
253
|
+
className,
|
|
254
|
+
...props
|
|
255
|
+
}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
|
|
256
|
+
return (
|
|
257
|
+
<MenubarPrimitive.SubContent
|
|
258
|
+
data-slot="menubar-sub-content"
|
|
259
|
+
className={cn("z-50 min-w-32 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
260
|
+
{...props}
|
|
261
|
+
/>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export {
|
|
266
|
+
Menubar,
|
|
267
|
+
MenubarPortal,
|
|
268
|
+
MenubarMenu,
|
|
269
|
+
MenubarTrigger,
|
|
270
|
+
MenubarContent,
|
|
271
|
+
MenubarGroup,
|
|
272
|
+
MenubarSeparator,
|
|
273
|
+
MenubarLabel,
|
|
274
|
+
MenubarItem,
|
|
275
|
+
MenubarShortcut,
|
|
276
|
+
MenubarCheckboxItem,
|
|
277
|
+
MenubarRadioGroup,
|
|
278
|
+
MenubarRadioItem,
|
|
279
|
+
MenubarSub,
|
|
280
|
+
MenubarSubTrigger,
|
|
281
|
+
MenubarSubContent,
|
|
282
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
MessageScroller as MessageScrollerPrimitive,
|
|
4
|
+
useMessageScroller,
|
|
5
|
+
useMessageScrollerScrollable,
|
|
6
|
+
useMessageScrollerVisibility,
|
|
7
|
+
} from "@shadcn/react/message-scroller"
|
|
8
|
+
|
|
9
|
+
import { cn } from "@/lib/utils"
|
|
10
|
+
import { Button } from "@/components/ui/button"
|
|
11
|
+
import { ArrowDownIcon } from "lucide-react"
|
|
12
|
+
|
|
13
|
+
function MessageScrollerProvider(
|
|
14
|
+
props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>
|
|
15
|
+
) {
|
|
16
|
+
return <MessageScrollerPrimitive.Provider {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function MessageScroller({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
|
|
23
|
+
return (
|
|
24
|
+
<MessageScrollerPrimitive.Root
|
|
25
|
+
data-slot="message-scroller"
|
|
26
|
+
className={cn(
|
|
27
|
+
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function MessageScrollerViewport({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
|
|
39
|
+
return (
|
|
40
|
+
<MessageScrollerPrimitive.Viewport
|
|
41
|
+
data-slot="message-scroller-viewport"
|
|
42
|
+
className={cn(
|
|
43
|
+
"size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-none",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function MessageScrollerContent({
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<MessageScrollerPrimitive.Content
|
|
57
|
+
data-slot="message-scroller-content"
|
|
58
|
+
className={cn("flex h-max min-h-full flex-col gap-6", className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function MessageScrollerItem({
|
|
65
|
+
className,
|
|
66
|
+
scrollAnchor = false,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
|
|
69
|
+
return (
|
|
70
|
+
<MessageScrollerPrimitive.Item
|
|
71
|
+
data-slot="message-scroller-item"
|
|
72
|
+
scrollAnchor={scrollAnchor}
|
|
73
|
+
className={cn(
|
|
74
|
+
"min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
75
|
+
className
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function MessageScrollerButton({
|
|
83
|
+
direction = "end",
|
|
84
|
+
className,
|
|
85
|
+
children,
|
|
86
|
+
render,
|
|
87
|
+
variant = "secondary",
|
|
88
|
+
size = "icon-sm",
|
|
89
|
+
...props
|
|
90
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
|
|
91
|
+
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
|
92
|
+
return (
|
|
93
|
+
<MessageScrollerPrimitive.Button
|
|
94
|
+
data-slot="message-scroller-button"
|
|
95
|
+
data-direction={direction}
|
|
96
|
+
data-variant={variant}
|
|
97
|
+
data-size={size}
|
|
98
|
+
direction={direction}
|
|
99
|
+
className={cn(
|
|
100
|
+
"absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
101
|
+
className
|
|
102
|
+
)}
|
|
103
|
+
render={render ?? <Button variant={variant} size={size} />}
|
|
104
|
+
{...props}
|
|
105
|
+
>
|
|
106
|
+
{children ?? (
|
|
107
|
+
<>
|
|
108
|
+
<ArrowDownIcon
|
|
109
|
+
/>
|
|
110
|
+
<span className="sr-only">
|
|
111
|
+
{direction === "end" ? "Scroll to end" : "Scroll to start"}
|
|
112
|
+
</span>
|
|
113
|
+
</>
|
|
114
|
+
)}
|
|
115
|
+
</MessageScrollerPrimitive.Button>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
MessageScrollerProvider,
|
|
121
|
+
MessageScroller,
|
|
122
|
+
MessageScrollerViewport,
|
|
123
|
+
MessageScrollerContent,
|
|
124
|
+
MessageScrollerItem,
|
|
125
|
+
MessageScrollerButton,
|
|
126
|
+
useMessageScroller,
|
|
127
|
+
useMessageScrollerScrollable,
|
|
128
|
+
useMessageScrollerVisibility,
|
|
129
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="message-group"
|
|
9
|
+
className={cn("flex min-w-0 flex-col gap-2", className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function Message({
|
|
16
|
+
className,
|
|
17
|
+
align = "start",
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
data-slot="message"
|
|
23
|
+
data-align={align}
|
|
24
|
+
className={cn(
|
|
25
|
+
"group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
data-slot="message-avatar"
|
|
37
|
+
className={cn(
|
|
38
|
+
"flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
data-slot="message-content"
|
|
50
|
+
className={cn(
|
|
51
|
+
"flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
data-slot="message-header"
|
|
63
|
+
className={cn(
|
|
64
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot="message-footer"
|
|
76
|
+
className={cn(
|
|
77
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
MessageGroup,
|
|
87
|
+
Message,
|
|
88
|
+
MessageAvatar,
|
|
89
|
+
MessageContent,
|
|
90
|
+
MessageFooter,
|
|
91
|
+
MessageHeader,
|
|
92
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
|
|
7
|
+
size?: "sm" | "default"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function NativeSelect({
|
|
11
|
+
className,
|
|
12
|
+
size = "default",
|
|
13
|
+
...props
|
|
14
|
+
}: NativeSelectProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={cn(
|
|
18
|
+
"group/native-select relative w-fit has-[select:disabled]:opacity-50",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
data-slot="native-select-wrapper"
|
|
22
|
+
data-size={size}
|
|
23
|
+
>
|
|
24
|
+
<select
|
|
25
|
+
data-slot="native-select"
|
|
26
|
+
data-size={size}
|
|
27
|
+
className="h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
<ChevronDownIcon className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none" aria-hidden="true" data-slot="native-select-icon" />
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function NativeSelectOption({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<"option">) {
|
|
39
|
+
return (
|
|
40
|
+
<option
|
|
41
|
+
data-slot="native-select-option"
|
|
42
|
+
className={cn("bg-[Canvas] text-[CanvasText]", className)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function NativeSelectOptGroup({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<"optgroup">) {
|
|
52
|
+
return (
|
|
53
|
+
<optgroup
|
|
54
|
+
data-slot="native-select-optgroup"
|
|
55
|
+
className={cn("bg-[Canvas] text-[CanvasText]", className)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }
|