@foundrykit/components 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/.turbo/turbo-build.log +18 -0
- package/.turbo/turbo-type-check.log +5 -0
- package/README.md +183 -0
- package/components.json +20 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +636 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.js +4 -0
- package/package.json +53 -0
- package/src/components/calendar/config.ts +50 -0
- package/src/components/calendar/index.tsx +213 -0
- package/src/components/command/config.ts +764 -0
- package/src/components/command/index.tsx +184 -0
- package/src/components/date-picker/config.ts +54 -0
- package/src/components/date-picker/index.tsx +139 -0
- package/src/components/pagination/config.ts +192 -0
- package/src/components/pagination/index.tsx +127 -0
- package/src/components/search-bar/config.ts +57 -0
- package/src/components/search-bar/index.tsx +64 -0
- package/src/index.ts +19 -0
- package/tsconfig.json +11 -0
- package/tsconfig.lint.json +8 -0
- package/tsup.config.ts +11 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
// src/components/search-bar/index.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Search } from "lucide-react";
|
|
4
|
+
import { Input } from "@foundrykit/primitives";
|
|
5
|
+
import { cn } from "@foundrykit/utils";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var SearchBar = React.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
className,
|
|
10
|
+
onSearch,
|
|
11
|
+
placeholder = "Search...",
|
|
12
|
+
value: externalValue,
|
|
13
|
+
onChange: externalOnChange,
|
|
14
|
+
...props
|
|
15
|
+
}, ref) => {
|
|
16
|
+
const [internalQuery, setInternalQuery] = React.useState("");
|
|
17
|
+
const query = externalValue !== void 0 ? externalValue : internalQuery;
|
|
18
|
+
const isControlled = externalValue !== void 0;
|
|
19
|
+
const handleChange = (e) => {
|
|
20
|
+
const value = e.target.value;
|
|
21
|
+
if (!isControlled) {
|
|
22
|
+
setInternalQuery(value);
|
|
23
|
+
}
|
|
24
|
+
onSearch?.(value);
|
|
25
|
+
externalOnChange?.(e);
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
28
|
+
/* @__PURE__ */ jsx(Search, { className: "text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2" }),
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
Input,
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
type: "search",
|
|
34
|
+
placeholder,
|
|
35
|
+
value: query,
|
|
36
|
+
onChange: handleChange,
|
|
37
|
+
className: "pl-10",
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
SearchBar.displayName = "SearchBar";
|
|
45
|
+
|
|
46
|
+
// src/components/date-picker/index.tsx
|
|
47
|
+
import * as React2 from "react";
|
|
48
|
+
import { Calendar as CalendarIcon } from "lucide-react";
|
|
49
|
+
import { format } from "date-fns";
|
|
50
|
+
import { Button } from "@foundrykit/primitives";
|
|
51
|
+
import { Input as Input2 } from "@foundrykit/primitives";
|
|
52
|
+
import { cn as cn2 } from "@foundrykit/utils";
|
|
53
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
54
|
+
var DatePicker = React2.forwardRef(
|
|
55
|
+
({ value, onValueChange, placeholder = "Pick a date", className, disabled }, ref) => {
|
|
56
|
+
const [open, setOpen] = React2.useState(false);
|
|
57
|
+
const [selectedDate, setSelectedDate] = React2.useState(
|
|
58
|
+
value
|
|
59
|
+
);
|
|
60
|
+
const handleDateSelect = (date) => {
|
|
61
|
+
setSelectedDate(date);
|
|
62
|
+
onValueChange?.(date);
|
|
63
|
+
setOpen(false);
|
|
64
|
+
};
|
|
65
|
+
const handleInputChange = (e) => {
|
|
66
|
+
const inputValue = e.target.value;
|
|
67
|
+
if (inputValue) {
|
|
68
|
+
const date = new Date(inputValue);
|
|
69
|
+
if (!isNaN(date.getTime())) {
|
|
70
|
+
setSelectedDate(date);
|
|
71
|
+
onValueChange?.(date);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
setSelectedDate(void 0);
|
|
75
|
+
onValueChange?.(void 0);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const generateCalendarDays = () => {
|
|
79
|
+
const today = /* @__PURE__ */ new Date();
|
|
80
|
+
const currentMonth = selectedDate ? selectedDate.getMonth() : today.getMonth();
|
|
81
|
+
const currentYear = selectedDate ? selectedDate.getFullYear() : today.getFullYear();
|
|
82
|
+
const firstDay = new Date(currentYear, currentMonth, 1);
|
|
83
|
+
const lastDay = new Date(currentYear, currentMonth + 1, 0);
|
|
84
|
+
const daysInMonth = lastDay.getDate();
|
|
85
|
+
const startingDayOfWeek = firstDay.getDay();
|
|
86
|
+
const days = [];
|
|
87
|
+
for (let i = 0; i < startingDayOfWeek; i++) {
|
|
88
|
+
days.push(null);
|
|
89
|
+
}
|
|
90
|
+
for (let day = 1; day <= daysInMonth; day++) {
|
|
91
|
+
days.push(new Date(currentYear, currentMonth, day));
|
|
92
|
+
}
|
|
93
|
+
return days;
|
|
94
|
+
};
|
|
95
|
+
const calendarDays = generateCalendarDays();
|
|
96
|
+
const weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
97
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn2("relative", className), ref, children: [
|
|
98
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
|
|
99
|
+
/* @__PURE__ */ jsx2(
|
|
100
|
+
Input2,
|
|
101
|
+
{
|
|
102
|
+
type: "date",
|
|
103
|
+
value: selectedDate ? format(selectedDate, "yyyy-MM-dd") : "",
|
|
104
|
+
onChange: handleInputChange,
|
|
105
|
+
placeholder,
|
|
106
|
+
disabled,
|
|
107
|
+
className: "flex-1"
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsx2(
|
|
111
|
+
Button,
|
|
112
|
+
{
|
|
113
|
+
variant: "outline",
|
|
114
|
+
onClick: () => setOpen(!open),
|
|
115
|
+
disabled,
|
|
116
|
+
className: "px-3",
|
|
117
|
+
children: /* @__PURE__ */ jsx2(CalendarIcon, { className: "h-4 w-4" })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] }),
|
|
121
|
+
open && /* @__PURE__ */ jsxs2("div", { className: "bg-popover absolute top-full z-50 mt-1 w-80 rounded-md border p-3 shadow-md", children: [
|
|
122
|
+
/* @__PURE__ */ jsx2("div", { className: "mb-2 grid grid-cols-7 gap-1 text-center text-sm font-medium", children: weekDays.map((day) => /* @__PURE__ */ jsx2("div", { className: "p-1", children: day }, day)) }),
|
|
123
|
+
/* @__PURE__ */ jsx2("div", { className: "grid grid-cols-7 gap-1", children: calendarDays.map((day, index) => /* @__PURE__ */ jsx2(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
className: cn2(
|
|
127
|
+
"hover:bg-accent hover:text-accent-foreground rounded p-2 text-sm",
|
|
128
|
+
day && selectedDate && day.toDateString() === selectedDate.toDateString() ? "bg-primary text-primary-foreground" : day && day.toDateString() === (/* @__PURE__ */ new Date()).toDateString() ? "bg-muted" : "text-muted-foreground"
|
|
129
|
+
),
|
|
130
|
+
onClick: () => day && handleDateSelect(day),
|
|
131
|
+
disabled: !day,
|
|
132
|
+
children: day ? day.getDate() : ""
|
|
133
|
+
},
|
|
134
|
+
index
|
|
135
|
+
)) })
|
|
136
|
+
] })
|
|
137
|
+
] });
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
DatePicker.displayName = "DatePicker";
|
|
141
|
+
|
|
142
|
+
// src/components/calendar/index.tsx
|
|
143
|
+
import * as React3 from "react";
|
|
144
|
+
import {
|
|
145
|
+
ChevronDownIcon,
|
|
146
|
+
ChevronLeftIcon,
|
|
147
|
+
ChevronRightIcon
|
|
148
|
+
} from "lucide-react";
|
|
149
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
150
|
+
import { Button as Button2, buttonVariants } from "@foundrykit/primitives";
|
|
151
|
+
import { cn as cn3 } from "@foundrykit/utils";
|
|
152
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
153
|
+
function Calendar({
|
|
154
|
+
className,
|
|
155
|
+
classNames,
|
|
156
|
+
showOutsideDays = true,
|
|
157
|
+
captionLayout = "label",
|
|
158
|
+
buttonVariant = "ghost",
|
|
159
|
+
formatters,
|
|
160
|
+
components,
|
|
161
|
+
...props
|
|
162
|
+
}) {
|
|
163
|
+
const defaultClassNames = getDefaultClassNames();
|
|
164
|
+
return /* @__PURE__ */ jsx3(
|
|
165
|
+
DayPicker,
|
|
166
|
+
{
|
|
167
|
+
showOutsideDays,
|
|
168
|
+
className: cn3(
|
|
169
|
+
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
170
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
171
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
172
|
+
className
|
|
173
|
+
),
|
|
174
|
+
captionLayout,
|
|
175
|
+
formatters: {
|
|
176
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
177
|
+
...formatters
|
|
178
|
+
},
|
|
179
|
+
classNames: {
|
|
180
|
+
root: cn3("w-fit", defaultClassNames.root),
|
|
181
|
+
months: cn3(
|
|
182
|
+
"flex gap-4 flex-col md:flex-row relative",
|
|
183
|
+
defaultClassNames.months
|
|
184
|
+
),
|
|
185
|
+
month: cn3("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
186
|
+
nav: cn3(
|
|
187
|
+
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
188
|
+
defaultClassNames.nav
|
|
189
|
+
),
|
|
190
|
+
button_previous: cn3(
|
|
191
|
+
buttonVariants({ variant: buttonVariant }),
|
|
192
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
193
|
+
defaultClassNames.button_previous
|
|
194
|
+
),
|
|
195
|
+
button_next: cn3(
|
|
196
|
+
buttonVariants({ variant: buttonVariant }),
|
|
197
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
198
|
+
defaultClassNames.button_next
|
|
199
|
+
),
|
|
200
|
+
month_caption: cn3(
|
|
201
|
+
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
202
|
+
defaultClassNames.month_caption
|
|
203
|
+
),
|
|
204
|
+
dropdowns: cn3(
|
|
205
|
+
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
206
|
+
defaultClassNames.dropdowns
|
|
207
|
+
),
|
|
208
|
+
dropdown_root: cn3(
|
|
209
|
+
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
210
|
+
defaultClassNames.dropdown_root
|
|
211
|
+
),
|
|
212
|
+
dropdown: cn3(
|
|
213
|
+
"absolute bg-popover inset-0 opacity-0",
|
|
214
|
+
defaultClassNames.dropdown
|
|
215
|
+
),
|
|
216
|
+
caption_label: cn3(
|
|
217
|
+
"select-none font-medium",
|
|
218
|
+
captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
219
|
+
defaultClassNames.caption_label
|
|
220
|
+
),
|
|
221
|
+
table: "w-full border-collapse",
|
|
222
|
+
weekdays: cn3("flex", defaultClassNames.weekdays),
|
|
223
|
+
weekday: cn3(
|
|
224
|
+
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
225
|
+
defaultClassNames.weekday
|
|
226
|
+
),
|
|
227
|
+
week: cn3("flex w-full mt-2", defaultClassNames.week),
|
|
228
|
+
week_number_header: cn3(
|
|
229
|
+
"select-none w-(--cell-size)",
|
|
230
|
+
defaultClassNames.week_number_header
|
|
231
|
+
),
|
|
232
|
+
week_number: cn3(
|
|
233
|
+
"text-[0.8rem] select-none text-muted-foreground",
|
|
234
|
+
defaultClassNames.week_number
|
|
235
|
+
),
|
|
236
|
+
day: cn3(
|
|
237
|
+
"relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
238
|
+
defaultClassNames.day
|
|
239
|
+
),
|
|
240
|
+
range_start: cn3(
|
|
241
|
+
"rounded-l-md bg-accent",
|
|
242
|
+
defaultClassNames.range_start
|
|
243
|
+
),
|
|
244
|
+
range_middle: cn3("rounded-none", defaultClassNames.range_middle),
|
|
245
|
+
range_end: cn3("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
246
|
+
today: cn3(
|
|
247
|
+
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
248
|
+
defaultClassNames.today
|
|
249
|
+
),
|
|
250
|
+
outside: cn3(
|
|
251
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
252
|
+
defaultClassNames.outside
|
|
253
|
+
),
|
|
254
|
+
disabled: cn3(
|
|
255
|
+
"text-muted-foreground opacity-50",
|
|
256
|
+
defaultClassNames.disabled
|
|
257
|
+
),
|
|
258
|
+
hidden: cn3("invisible", defaultClassNames.hidden),
|
|
259
|
+
...classNames
|
|
260
|
+
},
|
|
261
|
+
components: {
|
|
262
|
+
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
263
|
+
return /* @__PURE__ */ jsx3(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
"data-slot": "calendar",
|
|
267
|
+
ref: rootRef,
|
|
268
|
+
className: cn3(className2),
|
|
269
|
+
...props2
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
},
|
|
273
|
+
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
274
|
+
if (orientation === "left") {
|
|
275
|
+
return /* @__PURE__ */ jsx3(ChevronLeftIcon, { className: cn3("size-4", className2), ...props2 });
|
|
276
|
+
}
|
|
277
|
+
if (orientation === "right") {
|
|
278
|
+
return /* @__PURE__ */ jsx3(
|
|
279
|
+
ChevronRightIcon,
|
|
280
|
+
{
|
|
281
|
+
className: cn3("size-4", className2),
|
|
282
|
+
...props2
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ jsx3(ChevronDownIcon, { className: cn3("size-4", className2), ...props2 });
|
|
287
|
+
},
|
|
288
|
+
DayButton: CalendarDayButton,
|
|
289
|
+
WeekNumber: ({ children, ...props2 }) => {
|
|
290
|
+
return /* @__PURE__ */ jsx3("td", { ...props2, children: /* @__PURE__ */ jsx3("div", { className: "size-(--cell-size) flex items-center justify-center text-center", children }) });
|
|
291
|
+
},
|
|
292
|
+
...components
|
|
293
|
+
},
|
|
294
|
+
...props
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
function CalendarDayButton({
|
|
299
|
+
className,
|
|
300
|
+
day,
|
|
301
|
+
modifiers,
|
|
302
|
+
...props
|
|
303
|
+
}) {
|
|
304
|
+
const defaultClassNames = getDefaultClassNames();
|
|
305
|
+
const ref = React3.useRef(null);
|
|
306
|
+
React3.useEffect(() => {
|
|
307
|
+
if (modifiers.focused) ref.current?.focus();
|
|
308
|
+
}, [modifiers.focused]);
|
|
309
|
+
return /* @__PURE__ */ jsx3(
|
|
310
|
+
Button2,
|
|
311
|
+
{
|
|
312
|
+
ref,
|
|
313
|
+
variant: "ghost",
|
|
314
|
+
size: "icon",
|
|
315
|
+
"data-day": day.date.toLocaleDateString(),
|
|
316
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
317
|
+
"data-range-start": modifiers.range_start,
|
|
318
|
+
"data-range-end": modifiers.range_end,
|
|
319
|
+
"data-range-middle": modifiers.range_middle,
|
|
320
|
+
className: cn3(
|
|
321
|
+
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground min-w-(--cell-size) flex aspect-square size-auto w-full flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-start=true]:rounded-l-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",
|
|
322
|
+
defaultClassNames.day,
|
|
323
|
+
className
|
|
324
|
+
),
|
|
325
|
+
...props
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// src/components/pagination/index.tsx
|
|
331
|
+
import {
|
|
332
|
+
ChevronLeftIcon as ChevronLeftIcon2,
|
|
333
|
+
ChevronRightIcon as ChevronRightIcon2,
|
|
334
|
+
MoreHorizontalIcon
|
|
335
|
+
} from "lucide-react";
|
|
336
|
+
import { cn as cn4 } from "@foundrykit/utils";
|
|
337
|
+
import { buttonVariants as buttonVariants2 } from "@foundrykit/primitives";
|
|
338
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
339
|
+
function Pagination({ className, ...props }) {
|
|
340
|
+
return /* @__PURE__ */ jsx4(
|
|
341
|
+
"nav",
|
|
342
|
+
{
|
|
343
|
+
role: "navigation",
|
|
344
|
+
"aria-label": "pagination",
|
|
345
|
+
"data-slot": "pagination",
|
|
346
|
+
className: cn4("mx-auto flex w-full justify-center", className),
|
|
347
|
+
...props
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
function PaginationContent({
|
|
352
|
+
className,
|
|
353
|
+
...props
|
|
354
|
+
}) {
|
|
355
|
+
return /* @__PURE__ */ jsx4(
|
|
356
|
+
"ul",
|
|
357
|
+
{
|
|
358
|
+
"data-slot": "pagination-content",
|
|
359
|
+
className: cn4("flex flex-row items-center gap-1", className),
|
|
360
|
+
...props
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
function PaginationItem({ ...props }) {
|
|
365
|
+
return /* @__PURE__ */ jsx4("li", { "data-slot": "pagination-item", ...props });
|
|
366
|
+
}
|
|
367
|
+
function PaginationLink({
|
|
368
|
+
className,
|
|
369
|
+
isActive,
|
|
370
|
+
size = "icon",
|
|
371
|
+
...props
|
|
372
|
+
}) {
|
|
373
|
+
return /* @__PURE__ */ jsx4(
|
|
374
|
+
"a",
|
|
375
|
+
{
|
|
376
|
+
"aria-current": isActive ? "page" : void 0,
|
|
377
|
+
"data-slot": "pagination-link",
|
|
378
|
+
"data-active": isActive,
|
|
379
|
+
className: cn4(
|
|
380
|
+
buttonVariants2({
|
|
381
|
+
variant: isActive ? "outline" : "ghost",
|
|
382
|
+
size
|
|
383
|
+
}),
|
|
384
|
+
className
|
|
385
|
+
),
|
|
386
|
+
...props
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
function PaginationPrevious({
|
|
391
|
+
className,
|
|
392
|
+
...props
|
|
393
|
+
}) {
|
|
394
|
+
return /* @__PURE__ */ jsxs3(
|
|
395
|
+
PaginationLink,
|
|
396
|
+
{
|
|
397
|
+
"aria-label": "Go to previous page",
|
|
398
|
+
size: "default",
|
|
399
|
+
className: cn4("gap-1 px-2.5 sm:pl-2.5", className),
|
|
400
|
+
...props,
|
|
401
|
+
children: [
|
|
402
|
+
/* @__PURE__ */ jsx4(ChevronLeftIcon2, {}),
|
|
403
|
+
/* @__PURE__ */ jsx4("span", { className: "hidden sm:block", children: "Previous" })
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
function PaginationNext({
|
|
409
|
+
className,
|
|
410
|
+
...props
|
|
411
|
+
}) {
|
|
412
|
+
return /* @__PURE__ */ jsxs3(
|
|
413
|
+
PaginationLink,
|
|
414
|
+
{
|
|
415
|
+
"aria-label": "Go to next page",
|
|
416
|
+
size: "default",
|
|
417
|
+
className: cn4("gap-1 px-2.5 sm:pr-2.5", className),
|
|
418
|
+
...props,
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ jsx4("span", { className: "hidden sm:block", children: "Next" }),
|
|
421
|
+
/* @__PURE__ */ jsx4(ChevronRightIcon2, {})
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
function PaginationEllipsis({
|
|
427
|
+
className,
|
|
428
|
+
...props
|
|
429
|
+
}) {
|
|
430
|
+
return /* @__PURE__ */ jsxs3(
|
|
431
|
+
"span",
|
|
432
|
+
{
|
|
433
|
+
"aria-hidden": true,
|
|
434
|
+
"data-slot": "pagination-ellipsis",
|
|
435
|
+
className: cn4("flex size-9 items-center justify-center", className),
|
|
436
|
+
...props,
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ jsx4(MoreHorizontalIcon, { className: "size-4" }),
|
|
439
|
+
/* @__PURE__ */ jsx4("span", { className: "sr-only", children: "More pages" })
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// src/components/command/index.tsx
|
|
446
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
447
|
+
import { SearchIcon } from "lucide-react";
|
|
448
|
+
import { cn as cn5 } from "@foundrykit/utils";
|
|
449
|
+
import {
|
|
450
|
+
Dialog,
|
|
451
|
+
DialogContent,
|
|
452
|
+
DialogDescription,
|
|
453
|
+
DialogHeader,
|
|
454
|
+
DialogTitle
|
|
455
|
+
} from "@foundrykit/primitives";
|
|
456
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
457
|
+
function Command({
|
|
458
|
+
className,
|
|
459
|
+
...props
|
|
460
|
+
}) {
|
|
461
|
+
return /* @__PURE__ */ jsx5(
|
|
462
|
+
CommandPrimitive,
|
|
463
|
+
{
|
|
464
|
+
"data-slot": "command",
|
|
465
|
+
className: cn5(
|
|
466
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
467
|
+
className
|
|
468
|
+
),
|
|
469
|
+
...props
|
|
470
|
+
}
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
function CommandDialog({
|
|
474
|
+
title = "Command Palette",
|
|
475
|
+
description = "Search for a command to run...",
|
|
476
|
+
children,
|
|
477
|
+
className,
|
|
478
|
+
showCloseButton = true,
|
|
479
|
+
...props
|
|
480
|
+
}) {
|
|
481
|
+
return /* @__PURE__ */ jsxs4(Dialog, { ...props, children: [
|
|
482
|
+
/* @__PURE__ */ jsxs4(DialogHeader, { className: "sr-only", children: [
|
|
483
|
+
/* @__PURE__ */ jsx5(DialogTitle, { children: title }),
|
|
484
|
+
/* @__PURE__ */ jsx5(DialogDescription, { children: description })
|
|
485
|
+
] }),
|
|
486
|
+
/* @__PURE__ */ jsx5(
|
|
487
|
+
DialogContent,
|
|
488
|
+
{
|
|
489
|
+
className: cn5("overflow-hidden p-0", className),
|
|
490
|
+
showCloseButton,
|
|
491
|
+
children: /* @__PURE__ */ jsx5(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", children })
|
|
492
|
+
}
|
|
493
|
+
)
|
|
494
|
+
] });
|
|
495
|
+
}
|
|
496
|
+
function CommandInput({
|
|
497
|
+
className,
|
|
498
|
+
...props
|
|
499
|
+
}) {
|
|
500
|
+
return /* @__PURE__ */ jsxs4(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
"data-slot": "command-input-wrapper",
|
|
504
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ jsx5(SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
|
|
507
|
+
/* @__PURE__ */ jsx5(
|
|
508
|
+
CommandPrimitive.Input,
|
|
509
|
+
{
|
|
510
|
+
"data-slot": "command-input",
|
|
511
|
+
className: cn5(
|
|
512
|
+
"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",
|
|
513
|
+
className
|
|
514
|
+
),
|
|
515
|
+
...props
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
]
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
function CommandList({
|
|
523
|
+
className,
|
|
524
|
+
...props
|
|
525
|
+
}) {
|
|
526
|
+
return /* @__PURE__ */ jsx5(
|
|
527
|
+
CommandPrimitive.List,
|
|
528
|
+
{
|
|
529
|
+
"data-slot": "command-list",
|
|
530
|
+
className: cn5(
|
|
531
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
532
|
+
className
|
|
533
|
+
),
|
|
534
|
+
...props
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
function CommandEmpty({
|
|
539
|
+
...props
|
|
540
|
+
}) {
|
|
541
|
+
return /* @__PURE__ */ jsx5(
|
|
542
|
+
CommandPrimitive.Empty,
|
|
543
|
+
{
|
|
544
|
+
"data-slot": "command-empty",
|
|
545
|
+
className: "py-6 text-center text-sm",
|
|
546
|
+
...props
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
function CommandGroup({
|
|
551
|
+
className,
|
|
552
|
+
...props
|
|
553
|
+
}) {
|
|
554
|
+
return /* @__PURE__ */ jsx5(
|
|
555
|
+
CommandPrimitive.Group,
|
|
556
|
+
{
|
|
557
|
+
"data-slot": "command-group",
|
|
558
|
+
className: cn5(
|
|
559
|
+
"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",
|
|
560
|
+
className
|
|
561
|
+
),
|
|
562
|
+
...props
|
|
563
|
+
}
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
function CommandSeparator({
|
|
567
|
+
className,
|
|
568
|
+
...props
|
|
569
|
+
}) {
|
|
570
|
+
return /* @__PURE__ */ jsx5(
|
|
571
|
+
CommandPrimitive.Separator,
|
|
572
|
+
{
|
|
573
|
+
"data-slot": "command-separator",
|
|
574
|
+
className: cn5("bg-border -mx-1 h-px", className),
|
|
575
|
+
...props
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
function CommandItem({
|
|
580
|
+
className,
|
|
581
|
+
...props
|
|
582
|
+
}) {
|
|
583
|
+
return /* @__PURE__ */ jsx5(
|
|
584
|
+
CommandPrimitive.Item,
|
|
585
|
+
{
|
|
586
|
+
"data-slot": "command-item",
|
|
587
|
+
className: cn5(
|
|
588
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
589
|
+
className
|
|
590
|
+
),
|
|
591
|
+
...props
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
function CommandShortcut({
|
|
596
|
+
className,
|
|
597
|
+
...props
|
|
598
|
+
}) {
|
|
599
|
+
return /* @__PURE__ */ jsx5(
|
|
600
|
+
"span",
|
|
601
|
+
{
|
|
602
|
+
"data-slot": "command-shortcut",
|
|
603
|
+
className: cn5(
|
|
604
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
605
|
+
className
|
|
606
|
+
),
|
|
607
|
+
...props
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// src/index.ts
|
|
613
|
+
import { cn as cn6 } from "@foundrykit/utils";
|
|
614
|
+
export {
|
|
615
|
+
Calendar,
|
|
616
|
+
Command,
|
|
617
|
+
CommandDialog,
|
|
618
|
+
CommandEmpty,
|
|
619
|
+
CommandGroup,
|
|
620
|
+
CommandInput,
|
|
621
|
+
CommandItem,
|
|
622
|
+
CommandList,
|
|
623
|
+
CommandSeparator,
|
|
624
|
+
CommandShortcut,
|
|
625
|
+
DatePicker,
|
|
626
|
+
Pagination,
|
|
627
|
+
PaginationContent,
|
|
628
|
+
PaginationEllipsis,
|
|
629
|
+
PaginationItem,
|
|
630
|
+
PaginationLink,
|
|
631
|
+
PaginationNext,
|
|
632
|
+
PaginationPrevious,
|
|
633
|
+
SearchBar,
|
|
634
|
+
cn6 as cn
|
|
635
|
+
};
|
|
636
|
+
//# sourceMappingURL=index.js.map
|