@chobantonov/jsonforms-react-shadcn-webcomponent 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +91 -2
- package/dist/JsonFormsShadcnElement.d.ts +29 -0
- package/dist/index.d.ts +3 -0
- package/dist/jsonforms-react-shadcn.js +1 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.js +6 -0
- package/dist/register.js.map +1 -0
- package/dist/renderers.d.ts +2 -0
- package/dist/src-CLRAt7jc.mjs +9482 -0
- package/dist/src-CLRAt7jc.mjs.map +1 -0
- package/dist/standalone/AgGridControlRenderer.impl-BZS8_ocu-Dp2429lF.mjs +39184 -0
- package/dist/standalone/AgGridControlRenderer.impl-BZS8_ocu-Dp2429lF.mjs.map +1 -0
- package/dist/standalone/DynamicJSXRenderer-DyB3ZpZV-Dr83kPeb.mjs +14893 -0
- package/dist/standalone/DynamicJSXRenderer-DyB3ZpZV-Dr83kPeb.mjs.map +1 -0
- package/dist/standalone/FileArrayInput.esm-BG196JYM.mjs +760 -0
- package/dist/standalone/FileArrayInput.esm-BG196JYM.mjs.map +1 -0
- package/dist/standalone/MarkupLabelRenderer.impl-CWfdcUuH-BgJ-v1Ei.mjs +12 -0
- package/dist/standalone/MarkupLabelRenderer.impl-CWfdcUuH-BgJ-v1Ei.mjs.map +1 -0
- package/dist/standalone/MonacoControlRenderer.impl-CyjMHbOd-BP-CDX3S.mjs +773 -0
- package/dist/standalone/MonacoControlRenderer.impl-CyjMHbOd-BP-CDX3S.mjs.map +1 -0
- package/dist/standalone/RactiveTemplate-Cat7CxUp-BnyPMY_h.mjs +8028 -0
- package/dist/standalone/RactiveTemplate-Cat7CxUp-BnyPMY_h.mjs.map +1 -0
- package/dist/standalone/celTemplate-D_AGhaIL-ryXLzhcw.mjs +137 -0
- package/dist/standalone/celTemplate-D_AGhaIL-ryXLzhcw.mjs.map +1 -0
- package/dist/standalone/classPrivateFieldGet2-CAMXi-8L.mjs +22 -0
- package/dist/standalone/dynamicCel.esm-DrqwYtar.mjs +43 -0
- package/dist/standalone/dynamicCel.esm-DrqwYtar.mjs.map +1 -0
- package/dist/standalone/index.js +24493 -0
- package/dist/standalone/index.js.map +1 -0
- package/dist/standalone/jsonforms-react-extended.esm-CFwqhFcu.mjs +13760 -0
- package/dist/standalone/jsonforms-react-extended.esm-CFwqhFcu.mjs.map +1 -0
- package/dist/standalone/lib-DHN5bkVZ.mjs +3149 -0
- package/dist/standalone/lib-DHN5bkVZ.mjs.map +1 -0
- package/dist/standalone/markdown-C_y73Q0w-DE-0r4-5.mjs +3060 -0
- package/dist/standalone/markdown-C_y73Q0w-DE-0r4-5.mjs.map +1 -0
- package/dist/standalone/plainRecord.esm-D_l3rehZ.mjs +123 -0
- package/dist/standalone/plainRecord.esm-D_l3rehZ.mjs.map +1 -0
- package/dist/standalone/react-dom-DUZYP7tL.mjs +5644 -0
- package/dist/standalone/react-dom-DUZYP7tL.mjs.map +1 -0
- package/package.json +82 -3
- package/src/JsonFormsShadcnElement.tsx +208 -0
- package/src/components/ui/alert.tsx +65 -0
- package/src/components/ui/avatar.tsx +108 -0
- package/src/components/ui/breadcrumb.tsx +111 -0
- package/src/components/ui/button.tsx +64 -0
- package/src/components/ui/calendar.tsx +223 -0
- package/src/components/ui/card.tsx +91 -0
- package/src/components/ui/checkbox.tsx +31 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/dialog.tsx +175 -0
- package/src/components/ui/index.ts +12 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/item.tsx +193 -0
- package/src/components/ui/pagination.tsx +132 -0
- package/src/components/ui/popover.tsx +88 -0
- package/src/components/ui/radio-group.tsx +44 -0
- package/src/components/ui/resizable.tsx +52 -0
- package/src/components/ui/scroll-area.tsx +57 -0
- package/src/components/ui/select.tsx +189 -0
- package/src/components/ui/separator.tsx +27 -0
- package/src/components/ui/slider.tsx +62 -0
- package/src/components/ui/switch.tsx +34 -0
- package/src/components/ui/tabs.tsx +90 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/tooltip.tsx +56 -0
- package/src/components/ui/utils.ts +5 -0
- package/src/index.tsx +4 -0
- package/src/register.ts +13 -0
- package/src/renderers.ts +14 -0
- package/src/styles.css +29 -0
- package/src/vite-env.d.ts +4 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { useCalendarLocalization } from "@chobantonov/jsonforms-react-renderer-common/locale/calendar"
|
|
3
|
+
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import { cn } from "./utils"
|
|
6
|
+
import {
|
|
7
|
+
ChevronDownIcon,
|
|
8
|
+
ChevronLeftIcon,
|
|
9
|
+
ChevronRightIcon,
|
|
10
|
+
} from "lucide-react"
|
|
11
|
+
import {
|
|
12
|
+
DayPicker,
|
|
13
|
+
getDefaultClassNames,
|
|
14
|
+
type DayButton,
|
|
15
|
+
} from "react-day-picker"
|
|
16
|
+
|
|
17
|
+
import { Button, buttonVariants } from "./button"
|
|
18
|
+
|
|
19
|
+
function Calendar({
|
|
20
|
+
className,
|
|
21
|
+
classNames,
|
|
22
|
+
showOutsideDays = true,
|
|
23
|
+
captionLayout = "label",
|
|
24
|
+
buttonVariant = "ghost",
|
|
25
|
+
formatters,
|
|
26
|
+
labels,
|
|
27
|
+
components,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
30
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
|
|
31
|
+
}) {
|
|
32
|
+
const localization = useCalendarLocalization(props.locale?.code)
|
|
33
|
+
const defaultClassNames = getDefaultClassNames()
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<DayPicker
|
|
37
|
+
showOutsideDays={showOutsideDays}
|
|
38
|
+
className={cn(
|
|
39
|
+
"group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
40
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
41
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
captionLayout={captionLayout}
|
|
45
|
+
formatters={{
|
|
46
|
+
...localization.formatters,
|
|
47
|
+
...formatters,
|
|
48
|
+
}}
|
|
49
|
+
labels={{ ...localization.labels, ...labels }}
|
|
50
|
+
classNames={{
|
|
51
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
52
|
+
months: cn(
|
|
53
|
+
"relative flex flex-col gap-4 md:flex-row",
|
|
54
|
+
defaultClassNames.months
|
|
55
|
+
),
|
|
56
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
57
|
+
nav: cn(
|
|
58
|
+
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
59
|
+
defaultClassNames.nav
|
|
60
|
+
),
|
|
61
|
+
button_previous: cn(
|
|
62
|
+
buttonVariants({ variant: buttonVariant }),
|
|
63
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
64
|
+
defaultClassNames.button_previous
|
|
65
|
+
),
|
|
66
|
+
button_next: cn(
|
|
67
|
+
buttonVariants({ variant: buttonVariant }),
|
|
68
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
69
|
+
defaultClassNames.button_next
|
|
70
|
+
),
|
|
71
|
+
month_caption: cn(
|
|
72
|
+
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
73
|
+
defaultClassNames.month_caption
|
|
74
|
+
),
|
|
75
|
+
dropdowns: cn(
|
|
76
|
+
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
77
|
+
defaultClassNames.dropdowns
|
|
78
|
+
),
|
|
79
|
+
dropdown_root: cn(
|
|
80
|
+
"relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
|
|
81
|
+
defaultClassNames.dropdown_root
|
|
82
|
+
),
|
|
83
|
+
dropdown: cn(
|
|
84
|
+
"absolute inset-0 bg-popover opacity-0",
|
|
85
|
+
defaultClassNames.dropdown
|
|
86
|
+
),
|
|
87
|
+
caption_label: cn(
|
|
88
|
+
"font-medium select-none",
|
|
89
|
+
captionLayout === "label"
|
|
90
|
+
? "text-sm"
|
|
91
|
+
: "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
92
|
+
defaultClassNames.caption_label
|
|
93
|
+
),
|
|
94
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
95
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
96
|
+
weekday: cn(
|
|
97
|
+
"flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",
|
|
98
|
+
defaultClassNames.weekday
|
|
99
|
+
),
|
|
100
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
101
|
+
week_number_header: cn(
|
|
102
|
+
"w-(--cell-size) select-none",
|
|
103
|
+
defaultClassNames.week_number_header
|
|
104
|
+
),
|
|
105
|
+
week_number: cn(
|
|
106
|
+
"text-[0.8rem] text-muted-foreground select-none",
|
|
107
|
+
defaultClassNames.week_number
|
|
108
|
+
),
|
|
109
|
+
day: cn(
|
|
110
|
+
"group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md",
|
|
111
|
+
props.showWeekNumber
|
|
112
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
113
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
114
|
+
defaultClassNames.day
|
|
115
|
+
),
|
|
116
|
+
range_start: cn(
|
|
117
|
+
"rounded-l-md bg-accent",
|
|
118
|
+
defaultClassNames.range_start
|
|
119
|
+
),
|
|
120
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
121
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
122
|
+
today: cn(
|
|
123
|
+
"rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none",
|
|
124
|
+
defaultClassNames.today
|
|
125
|
+
),
|
|
126
|
+
outside: cn(
|
|
127
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
128
|
+
defaultClassNames.outside
|
|
129
|
+
),
|
|
130
|
+
disabled: cn(
|
|
131
|
+
"text-muted-foreground opacity-50",
|
|
132
|
+
defaultClassNames.disabled
|
|
133
|
+
),
|
|
134
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
135
|
+
...classNames,
|
|
136
|
+
}}
|
|
137
|
+
components={{
|
|
138
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
139
|
+
return (
|
|
140
|
+
<div
|
|
141
|
+
data-slot="calendar"
|
|
142
|
+
ref={rootRef}
|
|
143
|
+
className={cn(className)}
|
|
144
|
+
{...props}
|
|
145
|
+
/>
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
149
|
+
if (orientation === "left") {
|
|
150
|
+
return (
|
|
151
|
+
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (orientation === "right") {
|
|
156
|
+
return (
|
|
157
|
+
<ChevronRightIcon
|
|
158
|
+
className={cn("size-4", className)}
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
166
|
+
)
|
|
167
|
+
},
|
|
168
|
+
DayButton: CalendarDayButton,
|
|
169
|
+
WeekNumber: ({ children, ...props }) => {
|
|
170
|
+
return (
|
|
171
|
+
<td {...props}>
|
|
172
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
173
|
+
{children}
|
|
174
|
+
</div>
|
|
175
|
+
</td>
|
|
176
|
+
)
|
|
177
|
+
},
|
|
178
|
+
...components,
|
|
179
|
+
}}
|
|
180
|
+
{...props}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function CalendarDayButton({
|
|
186
|
+
className,
|
|
187
|
+
day,
|
|
188
|
+
modifiers,
|
|
189
|
+
...props
|
|
190
|
+
}: React.ComponentProps<typeof DayButton>) {
|
|
191
|
+
const defaultClassNames = getDefaultClassNames()
|
|
192
|
+
|
|
193
|
+
const ref = React.useRef<HTMLButtonElement>(null)
|
|
194
|
+
React.useEffect(() => {
|
|
195
|
+
if (modifiers.focused) ref.current?.focus()
|
|
196
|
+
}, [modifiers.focused])
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<Button
|
|
200
|
+
ref={ref}
|
|
201
|
+
variant="ghost"
|
|
202
|
+
size="icon"
|
|
203
|
+
data-day={day.date.toLocaleDateString()}
|
|
204
|
+
data-selected-single={
|
|
205
|
+
modifiers.selected &&
|
|
206
|
+
!modifiers.range_start &&
|
|
207
|
+
!modifiers.range_end &&
|
|
208
|
+
!modifiers.range_middle
|
|
209
|
+
}
|
|
210
|
+
data-range-start={modifiers.range_start}
|
|
211
|
+
data-range-end={modifiers.range_end}
|
|
212
|
+
data-range-middle={modifiers.range_middle}
|
|
213
|
+
className={cn(
|
|
214
|
+
"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:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
215
|
+
defaultClassNames.day,
|
|
216
|
+
className
|
|
217
|
+
)}
|
|
218
|
+
{...props}
|
|
219
|
+
/>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { Calendar, CalendarDayButton }
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "./utils"
|
|
3
|
+
|
|
4
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
data-slot="card"
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
|
|
10
|
+
className
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
data-slot="card-header"
|
|
21
|
+
className={cn(
|
|
22
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
data-slot="card-title"
|
|
34
|
+
className={cn("leading-none font-semibold", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
data-slot="card-description"
|
|
44
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
data-slot="card-action"
|
|
54
|
+
className={cn(
|
|
55
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
data-slot="card-content"
|
|
67
|
+
className={cn("px-6", className)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="card-footer"
|
|
77
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
Card,
|
|
85
|
+
CardHeader,
|
|
86
|
+
CardFooter,
|
|
87
|
+
CardTitle,
|
|
88
|
+
CardAction,
|
|
89
|
+
CardDescription,
|
|
90
|
+
CardContent,
|
|
91
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "./utils"
|
|
5
|
+
import { CheckIcon } from "lucide-react"
|
|
6
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui"
|
|
7
|
+
|
|
8
|
+
function Checkbox({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<CheckboxPrimitive.Root
|
|
14
|
+
data-slot="checkbox"
|
|
15
|
+
className={cn(
|
|
16
|
+
"peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<CheckboxPrimitive.Indicator
|
|
22
|
+
data-slot="checkbox-indicator"
|
|
23
|
+
className="grid place-content-center text-current transition-none"
|
|
24
|
+
>
|
|
25
|
+
<CheckIcon className="size-3.5" />
|
|
26
|
+
</CheckboxPrimitive.Indicator>
|
|
27
|
+
</CheckboxPrimitive.Root>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Checkbox }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
|
|
4
|
+
|
|
5
|
+
function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
|
|
6
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
|
|
10
|
+
return (
|
|
11
|
+
<CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
|
|
16
|
+
return (
|
|
17
|
+
<CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useI18n } from "@chobantonov/jsonforms-react-renderer-common/locale/translate"
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import { cn } from "./utils"
|
|
6
|
+
import { XIcon } from "lucide-react"
|
|
7
|
+
import { Dialog as DialogPrimitive } from "radix-ui"
|
|
8
|
+
|
|
9
|
+
import { Button } from "./button"
|
|
10
|
+
|
|
11
|
+
// Keep portals inside the styled shadow tree instead of document.body.
|
|
12
|
+
const DialogPortalContainer = React.createContext<HTMLElement | null>(null)
|
|
13
|
+
|
|
14
|
+
function Dialog({
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
17
|
+
const [container, setContainer] = React.useState<HTMLDivElement | null>(null)
|
|
18
|
+
return <div ref={setContainer} style={{ display: "contents" }}>
|
|
19
|
+
<DialogPortalContainer.Provider value={container}>
|
|
20
|
+
<DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
21
|
+
</DialogPortalContainer.Provider>
|
|
22
|
+
</div>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function DialogTrigger({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
28
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function DialogPortal({
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
34
|
+
const container = React.useContext(DialogPortalContainer)
|
|
35
|
+
if (!container) return null
|
|
36
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" container={container} {...props} />
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function DialogClose({
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
42
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const DialogOverlay = React.forwardRef<
|
|
46
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
47
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
48
|
+
>(function DialogOverlay({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}, ref) {
|
|
52
|
+
return (
|
|
53
|
+
<DialogPrimitive.Overlay
|
|
54
|
+
ref={ref}
|
|
55
|
+
data-slot="dialog-overlay"
|
|
56
|
+
className={cn(
|
|
57
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
function DialogContent({
|
|
66
|
+
className,
|
|
67
|
+
children,
|
|
68
|
+
showCloseButton = true,
|
|
69
|
+
...props
|
|
70
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
71
|
+
showCloseButton?: boolean
|
|
72
|
+
}) {
|
|
73
|
+
const t = useI18n()
|
|
74
|
+
return (
|
|
75
|
+
<DialogPortal data-slot="dialog-portal">
|
|
76
|
+
<DialogOverlay />
|
|
77
|
+
<DialogPrimitive.Content
|
|
78
|
+
data-slot="dialog-content"
|
|
79
|
+
className={cn(
|
|
80
|
+
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
|
81
|
+
className
|
|
82
|
+
)}
|
|
83
|
+
{...props}
|
|
84
|
+
>
|
|
85
|
+
{children}
|
|
86
|
+
{showCloseButton && (
|
|
87
|
+
<DialogPrimitive.Close
|
|
88
|
+
data-slot="dialog-close"
|
|
89
|
+
className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
90
|
+
>
|
|
91
|
+
<XIcon />
|
|
92
|
+
<span className="sr-only">{t("control.close")}</span>
|
|
93
|
+
</DialogPrimitive.Close>
|
|
94
|
+
)}
|
|
95
|
+
</DialogPrimitive.Content>
|
|
96
|
+
</DialogPortal>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
data-slot="dialog-header"
|
|
104
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function DialogFooter({
|
|
111
|
+
className,
|
|
112
|
+
showCloseButton = false,
|
|
113
|
+
children,
|
|
114
|
+
...props
|
|
115
|
+
}: React.ComponentProps<"div"> & {
|
|
116
|
+
showCloseButton?: boolean
|
|
117
|
+
}) {
|
|
118
|
+
const t = useI18n()
|
|
119
|
+
return (
|
|
120
|
+
<div
|
|
121
|
+
data-slot="dialog-footer"
|
|
122
|
+
className={cn(
|
|
123
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
128
|
+
{children}
|
|
129
|
+
{showCloseButton && (
|
|
130
|
+
<DialogPrimitive.Close asChild>
|
|
131
|
+
<Button variant="outline">{t("control.close")}</Button>
|
|
132
|
+
</DialogPrimitive.Close>
|
|
133
|
+
)}
|
|
134
|
+
</div>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function DialogTitle({
|
|
139
|
+
className,
|
|
140
|
+
...props
|
|
141
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
142
|
+
return (
|
|
143
|
+
<DialogPrimitive.Title
|
|
144
|
+
data-slot="dialog-title"
|
|
145
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
146
|
+
{...props}
|
|
147
|
+
/>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function DialogDescription({
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
155
|
+
return (
|
|
156
|
+
<DialogPrimitive.Description
|
|
157
|
+
data-slot="dialog-description"
|
|
158
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
Dialog,
|
|
166
|
+
DialogClose,
|
|
167
|
+
DialogContent,
|
|
168
|
+
DialogDescription,
|
|
169
|
+
DialogFooter,
|
|
170
|
+
DialogHeader,
|
|
171
|
+
DialogOverlay,
|
|
172
|
+
DialogPortal,
|
|
173
|
+
DialogTitle,
|
|
174
|
+
DialogTrigger,
|
|
175
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './alert';
|
|
2
|
+
export * from './button';
|
|
3
|
+
export * from './calendar';
|
|
4
|
+
export * from './card';
|
|
5
|
+
export * from './checkbox';
|
|
6
|
+
export * from './dialog';
|
|
7
|
+
export * from './input';
|
|
8
|
+
export * from './popover';
|
|
9
|
+
export * from './resizable';
|
|
10
|
+
export * from './select';
|
|
11
|
+
export * from './tabs';
|
|
12
|
+
export * from './utils';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "./utils"
|
|
3
|
+
|
|
4
|
+
const Input = React.forwardRef<HTMLInputElement, React.ComponentPropsWithoutRef<"input">>(
|
|
5
|
+
function Input({ className, type, ...props }, ref) {
|
|
6
|
+
return (
|
|
7
|
+
<input
|
|
8
|
+
ref={ref}
|
|
9
|
+
type={type}
|
|
10
|
+
data-slot="input"
|
|
11
|
+
className={cn(
|
|
12
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
13
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
14
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export { Input }
|