@recanica/ui 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 +9 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.js +65 -0
- package/dist/components/alert-dialog.d.ts +18 -0
- package/dist/components/alert-dialog.js +178 -0
- package/dist/components/alert.d.ts +9 -0
- package/dist/components/alert.js +66 -0
- package/dist/components/app-shell.d.ts +15 -0
- package/dist/components/app-shell.js +27 -0
- package/dist/components/aspect-ratio.d.ts +3 -0
- package/dist/components/aspect-ratio.js +11 -0
- package/dist/components/attachment.d.ts +24 -0
- package/dist/components/attachment.js +192 -0
- package/dist/components/avatar.d.ts +11 -0
- package/dist/components/avatar.js +104 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +63 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.js +103 -0
- package/dist/components/bubble.d.ts +17 -0
- package/dist/components/bubble.js +110 -0
- package/dist/components/button-group.d.ts +11 -0
- package/dist/components/button-group.js +76 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +59 -0
- package/dist/components/calendar.d.ts +8 -0
- package/dist/components/calendar.js +195 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.js +90 -0
- package/dist/components/carousel.d.ts +19 -0
- package/dist/components/carousel.js +199 -0
- package/dist/components/chart.d.ts +44 -0
- package/dist/components/chart.js +253 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +33 -0
- package/dist/components/choice-card.d.ts +18 -0
- package/dist/components/choice-card.js +43 -0
- package/dist/components/collapsible.d.ts +5 -0
- package/dist/components/collapsible.js +35 -0
- package/dist/components/combobox.d.ts +24 -0
- package/dist/components/combobox.js +297 -0
- package/dist/components/command.d.ts +18 -0
- package/dist/components/command.js +177 -0
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.js +224 -0
- package/dist/components/dialog.d.ts +17 -0
- package/dist/components/dialog.js +147 -0
- package/dist/components/direction.d.ts +7 -0
- package/dist/components/direction.js +15 -0
- package/dist/components/drawer.d.ts +13 -0
- package/dist/components/drawer.js +129 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdown-menu.js +232 -0
- package/dist/components/empty.d.ts +11 -0
- package/dist/components/empty.js +102 -0
- package/dist/components/field.d.ts +52 -0
- package/dist/components/field.js +261 -0
- package/dist/components/form.d.ts +24 -0
- package/dist/components/form.js +126 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/hover-card.js +39 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +160 -0
- package/dist/components/input-otp.d.ts +11 -0
- package/dist/components/input-otp.js +67 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +25 -0
- package/dist/components/item.d.ts +23 -0
- package/dist/components/item.js +187 -0
- package/dist/components/kbd.d.ts +3 -0
- package/dist/components/kbd.js +31 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +23 -0
- package/dist/components/layout.d.ts +34 -0
- package/dist/components/layout.js +46 -0
- package/dist/components/loader.d.ts +38 -0
- package/dist/components/loader.js +90 -0
- package/dist/components/marker.d.ts +11 -0
- package/dist/components/marker.js +66 -0
- package/dist/components/menubar.d.ts +26 -0
- package/dist/components/menubar.js +252 -0
- package/dist/components/message-scroller.d.ts +10 -0
- package/dist/components/message-scroller.js +118 -0
- package/dist/components/message.d.ts +10 -0
- package/dist/components/message.js +90 -0
- package/dist/components/native-select.d.ts +7 -0
- package/dist/components/native-select.js +71 -0
- package/dist/components/nav-item.d.ts +17 -0
- package/dist/components/nav-item.js +36 -0
- package/dist/components/navigation-menu.d.ts +14 -0
- package/dist/components/navigation-menu.js +170 -0
- package/dist/components/page.d.ts +80 -0
- package/dist/components/page.js +84 -0
- package/dist/components/pagination.d.ts +13 -0
- package/dist/components/pagination.js +122 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +81 -0
- package/dist/components/progress.d.ts +4 -0
- package/dist/components/progress.js +32 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.js +46 -0
- package/dist/components/resizable.d.ts +7 -0
- package/dist/components/resizable.js +47 -0
- package/dist/components/scroll-area.d.ts +5 -0
- package/dist/components/scroll-area.js +61 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +179 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.js +27 -0
- package/dist/components/sheet.d.ts +14 -0
- package/dist/components/sheet.js +128 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/sidebar.js +650 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +15 -0
- package/dist/components/slider.d.ts +4 -0
- package/dist/components/slider.js +64 -0
- package/dist/components/sonner.d.ts +3 -0
- package/dist/components/sonner.js +38 -0
- package/dist/components/spinner.d.ts +2 -0
- package/dist/components/spinner.js +17 -0
- package/dist/components/stat.d.ts +47 -0
- package/dist/components/stat.js +120 -0
- package/dist/components/surface.d.ts +28 -0
- package/dist/components/surface.js +39 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +34 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +115 -0
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +92 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +22 -0
- package/dist/components/toggle-group.d.ts +9 -0
- package/dist/components/toggle-group.js +69 -0
- package/dist/components/toggle.d.ts +9 -0
- package/dist/components/toggle.js +44 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/web-section.d.ts +40 -0
- package/dist/components/web-section.js +72 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +8 -0
- package/package.json +79 -3
- package/README.md +0 -3
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
5
|
+
import * as RechartsPrimitive from "recharts";
|
|
6
|
+
const THEMES = { light: "", dark: ".dark" };
|
|
7
|
+
const INITIAL_DIMENSION = { width: 320, height: 200 };
|
|
8
|
+
const ChartContext = React.createContext(null);
|
|
9
|
+
function useChart() {
|
|
10
|
+
const context = React.useContext(ChartContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
function ChartContainer({
|
|
17
|
+
id,
|
|
18
|
+
className,
|
|
19
|
+
children,
|
|
20
|
+
config,
|
|
21
|
+
initialDimension = INITIAL_DIMENSION,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
const uniqueId = React.useId();
|
|
25
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
26
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "chart",
|
|
30
|
+
"data-chart": chartId,
|
|
31
|
+
className: cn(
|
|
32
|
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
33
|
+
// recanica-ignore: targets recharts default stroke
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx(ChartStyle, { id: chartId, config }),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
RechartsPrimitive.ResponsiveContainer,
|
|
41
|
+
{
|
|
42
|
+
initialDimension,
|
|
43
|
+
children
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
) });
|
|
49
|
+
}
|
|
50
|
+
const ChartStyle = ({ id, config }) => {
|
|
51
|
+
const colorConfig = Object.entries(config).filter(
|
|
52
|
+
([, config2]) => config2.theme ?? config2.color
|
|
53
|
+
);
|
|
54
|
+
if (!colorConfig.length) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"style",
|
|
59
|
+
{
|
|
60
|
+
dangerouslySetInnerHTML: {
|
|
61
|
+
__html: Object.entries(THEMES).map(
|
|
62
|
+
([theme, prefix]) => `
|
|
63
|
+
${prefix} [data-chart=${id}] {
|
|
64
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
65
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
66
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
67
|
+
}).join("\n")}
|
|
68
|
+
}
|
|
69
|
+
`
|
|
70
|
+
).join("\n")
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
76
|
+
function ChartTooltipContent({
|
|
77
|
+
active,
|
|
78
|
+
payload,
|
|
79
|
+
className,
|
|
80
|
+
indicator = "dot",
|
|
81
|
+
hideLabel = false,
|
|
82
|
+
hideIndicator = false,
|
|
83
|
+
label,
|
|
84
|
+
labelFormatter,
|
|
85
|
+
labelClassName,
|
|
86
|
+
formatter,
|
|
87
|
+
color,
|
|
88
|
+
nameKey,
|
|
89
|
+
labelKey
|
|
90
|
+
}) {
|
|
91
|
+
const { config } = useChart();
|
|
92
|
+
const tooltipLabel = React.useMemo(() => {
|
|
93
|
+
if (hideLabel || !payload?.length) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const [item] = payload;
|
|
97
|
+
const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
|
|
98
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
99
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
|
|
100
|
+
if (labelFormatter) {
|
|
101
|
+
return /* @__PURE__ */ jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
|
|
102
|
+
}
|
|
103
|
+
if (!value) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return /* @__PURE__ */ jsx("div", { className: cn("font-medium", labelClassName), children: value });
|
|
107
|
+
}, [
|
|
108
|
+
label,
|
|
109
|
+
labelFormatter,
|
|
110
|
+
payload,
|
|
111
|
+
hideLabel,
|
|
112
|
+
labelClassName,
|
|
113
|
+
config,
|
|
114
|
+
labelKey
|
|
115
|
+
]);
|
|
116
|
+
if (!active || !payload?.length) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
120
|
+
return /* @__PURE__ */ jsxs(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
className: cn(
|
|
124
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
children: [
|
|
128
|
+
!nestLabel ? tooltipLabel : null,
|
|
129
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
130
|
+
const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
|
|
131
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
132
|
+
const indicatorColor = color ?? item.payload?.fill ?? item.color;
|
|
133
|
+
return /* @__PURE__ */ jsx(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: cn(
|
|
137
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
138
|
+
indicator === "dot" && "items-center"
|
|
139
|
+
),
|
|
140
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
141
|
+
itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
className: cn(
|
|
145
|
+
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
146
|
+
/* recanica-ignore: chart legend swatch is a tiny square */
|
|
147
|
+
{
|
|
148
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
149
|
+
"w-1": indicator === "line",
|
|
150
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
151
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
style: {
|
|
155
|
+
"--color-bg": indicatorColor,
|
|
156
|
+
"--color-border": indicatorColor
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ jsxs(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
className: cn(
|
|
164
|
+
"flex flex-1 justify-between leading-none",
|
|
165
|
+
nestLabel ? "items-end" : "items-center"
|
|
166
|
+
),
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
169
|
+
nestLabel ? tooltipLabel : null,
|
|
170
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })
|
|
171
|
+
] }),
|
|
172
|
+
item.value != null && /* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-foreground tabular-nums", children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value) })
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
] })
|
|
177
|
+
},
|
|
178
|
+
index
|
|
179
|
+
);
|
|
180
|
+
}) })
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
186
|
+
function ChartLegendContent({
|
|
187
|
+
className,
|
|
188
|
+
hideIcon = false,
|
|
189
|
+
payload,
|
|
190
|
+
verticalAlign = "bottom",
|
|
191
|
+
nameKey
|
|
192
|
+
}) {
|
|
193
|
+
const { config } = useChart();
|
|
194
|
+
if (!payload?.length) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return /* @__PURE__ */ jsx(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: cn(
|
|
201
|
+
"flex items-center justify-center gap-4",
|
|
202
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
203
|
+
className
|
|
204
|
+
),
|
|
205
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
206
|
+
const key = `${nameKey ?? item.dataKey ?? "value"}`;
|
|
207
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
208
|
+
return /* @__PURE__ */ jsxs(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
className: cn(
|
|
212
|
+
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
|
213
|
+
),
|
|
214
|
+
children: [
|
|
215
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
219
|
+
style: {
|
|
220
|
+
backgroundColor: item.color
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
itemConfig?.label
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
index
|
|
228
|
+
);
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
234
|
+
if (typeof payload !== "object" || payload === null) {
|
|
235
|
+
return void 0;
|
|
236
|
+
}
|
|
237
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
238
|
+
let configLabelKey = key;
|
|
239
|
+
if (key in payload && typeof payload[key] === "string") {
|
|
240
|
+
configLabelKey = payload[key];
|
|
241
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
242
|
+
configLabelKey = payloadPayload[key];
|
|
243
|
+
}
|
|
244
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
245
|
+
}
|
|
246
|
+
export {
|
|
247
|
+
ChartContainer,
|
|
248
|
+
ChartLegend,
|
|
249
|
+
ChartLegendContent,
|
|
250
|
+
ChartStyle,
|
|
251
|
+
ChartTooltip,
|
|
252
|
+
ChartTooltipContent
|
|
253
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
import { CheckIcon } from "lucide-react";
|
|
5
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
|
6
|
+
function Checkbox({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
CheckboxPrimitive.Root,
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "checkbox",
|
|
14
|
+
className: cn(
|
|
15
|
+
"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",
|
|
16
|
+
/* recanica-ignore: a 16px checkbox needs a small corner */
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props,
|
|
20
|
+
children: /* @__PURE__ */ jsx(
|
|
21
|
+
CheckboxPrimitive.Indicator,
|
|
22
|
+
{
|
|
23
|
+
"data-slot": "checkbox-indicator",
|
|
24
|
+
className: "grid place-content-center text-current transition-none",
|
|
25
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
Checkbox
|
|
33
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
/**
|
|
4
|
+
* ChoiceCard — one option among several, picked by clicking the whole card (radio semantics).
|
|
5
|
+
* Wrap a set in an element with role="radiogroup" and an aria-label. `variant="media"` is an image thumbnail.
|
|
6
|
+
*/
|
|
7
|
+
declare const choiceCardVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "media" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
declare function ChoiceCard({ checked, onSelect, variant, className, ...props }: Omit<React.ComponentProps<"button">, "onSelect"> & VariantProps<typeof choiceCardVariants> & {
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
onSelect?: () => void;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
/** The small radio dot shown at the end of a default ChoiceCard. */
|
|
15
|
+
declare function ChoiceIndicator({ checked }: {
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
export { ChoiceCard, ChoiceIndicator, choiceCardVariants };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
const choiceCardVariants = cva(
|
|
5
|
+
"text-left text-sm transition-colors outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "flex items-center gap-3 rounded-xl border p-(--spacing-inset-sm) hover:bg-accent aria-checked:border-foreground/40 aria-checked:bg-accent",
|
|
10
|
+
media: "rounded-xl border bg-muted aria-checked:ring-2 aria-checked:ring-foreground aria-checked:ring-offset-2 aria-checked:ring-offset-background"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { variant: "default" }
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
function ChoiceCard({
|
|
17
|
+
checked,
|
|
18
|
+
onSelect,
|
|
19
|
+
variant,
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"button",
|
|
25
|
+
{
|
|
26
|
+
type: "button",
|
|
27
|
+
role: "radio",
|
|
28
|
+
"aria-checked": !!checked,
|
|
29
|
+
"data-slot": "choice-card",
|
|
30
|
+
onClick: onSelect,
|
|
31
|
+
className: cn(choiceCardVariants({ variant }), className),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function ChoiceIndicator({ checked }) {
|
|
37
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("size-4 shrink-0 rounded-full border", checked && "border-[5px] border-foreground") });
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
ChoiceCard,
|
|
41
|
+
ChoiceIndicator,
|
|
42
|
+
choiceCardVariants
|
|
43
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Collapsible as CollapsiblePrimitive } from "radix-ui";
|
|
2
|
+
declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react").JSX.Element;
|
|
3
|
+
declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react").JSX.Element;
|
|
4
|
+
declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react").JSX.Element;
|
|
5
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible as CollapsiblePrimitive } from "radix-ui";
|
|
4
|
+
function Collapsible({
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
8
|
+
}
|
|
9
|
+
function CollapsibleTrigger({
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
CollapsiblePrimitive.CollapsibleTrigger,
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "collapsible-trigger",
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function CollapsibleContent({
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
CollapsiblePrimitive.CollapsibleContent,
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "collapsible-content",
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
Collapsible,
|
|
33
|
+
CollapsibleContent,
|
|
34
|
+
CollapsibleTrigger
|
|
35
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
3
|
+
declare const Combobox: typeof ComboboxPrimitive.Root;
|
|
4
|
+
declare function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props): React.JSX.Element;
|
|
5
|
+
declare function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props): React.JSX.Element;
|
|
6
|
+
declare function ComboboxInput({ className, children, disabled, showTrigger, showClear, ...props }: ComboboxPrimitive.Input.Props & {
|
|
7
|
+
showTrigger?: boolean;
|
|
8
|
+
showClear?: boolean;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, ...props }: ComboboxPrimitive.Popup.Props & Pick<ComboboxPrimitive.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "anchor">): React.JSX.Element;
|
|
11
|
+
declare function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props): React.JSX.Element;
|
|
12
|
+
declare function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props): React.JSX.Element;
|
|
13
|
+
declare function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props): React.JSX.Element;
|
|
14
|
+
declare function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props): React.JSX.Element;
|
|
15
|
+
declare function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props): React.JSX.Element;
|
|
16
|
+
declare function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props): React.JSX.Element;
|
|
17
|
+
declare function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props): React.JSX.Element;
|
|
18
|
+
declare function ComboboxChips({ className, ...props }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props): React.JSX.Element;
|
|
19
|
+
declare function ComboboxChip({ className, children, showRemove, ...props }: ComboboxPrimitive.Chip.Props & {
|
|
20
|
+
showRemove?: boolean;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
declare function ComboboxChipsInput({ className, children, ...props }: ComboboxPrimitive.Input.Props): React.JSX.Element;
|
|
23
|
+
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, useComboboxAnchor, };
|