@alexgorbatchev/shadcn 0.0.205 → 0.0.207
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/dist/{chunk-z5qnt4nx.js → chunk-gf6fsbrz.js} +17 -2
- package/dist/{chunk-zpqfte56.js → chunk-w474hday.js} +142 -25
- package/dist/components/AppShell.d.ts +7 -1
- package/dist/components/Kanban.d.ts +8 -2
- package/dist/components/gantt/index.js +1 -1
- package/dist/components/json-render/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/prototype.js +1 -1
- package/llms/components/layout/AppShell.md +29 -1
- package/llms/components/planning/Kanban.md +26 -0
- package/package.json +1 -1
|
@@ -3905,6 +3905,7 @@ function AppShell2({
|
|
|
3905
3905
|
defaultSidebarOpen = true,
|
|
3906
3906
|
label = "Application",
|
|
3907
3907
|
content = "scroll",
|
|
3908
|
+
topBar = true,
|
|
3908
3909
|
density
|
|
3909
3910
|
}) {
|
|
3910
3911
|
return /* @__PURE__ */ jsxs25(SidebarProvider2, {
|
|
@@ -3948,8 +3949,22 @@ function AppShell2({
|
|
|
3948
3949
|
})
|
|
3949
3950
|
})
|
|
3950
3951
|
}),
|
|
3951
|
-
sidebarFooter && /* @__PURE__ */ jsx39(SidebarFooter2, {
|
|
3952
|
+
topBar ? sidebarFooter && /* @__PURE__ */ jsx39(SidebarFooter2, {
|
|
3952
3953
|
children: sidebarFooter
|
|
3954
|
+
}) : /* @__PURE__ */ jsx39(SidebarFooter2, {
|
|
3955
|
+
children: /* @__PURE__ */ jsxs25("div", {
|
|
3956
|
+
"data-slot": "app-shell-sidebar-footer",
|
|
3957
|
+
className: "flex min-w-0 items-center gap-control-gap group-data-[collapsible=icon]:flex-col group-data-[collapsible=icon]:items-stretch",
|
|
3958
|
+
children: [
|
|
3959
|
+
sidebarFooter && /* @__PURE__ */ jsx39("div", {
|
|
3960
|
+
className: "min-w-0",
|
|
3961
|
+
children: sidebarFooter
|
|
3962
|
+
}),
|
|
3963
|
+
/* @__PURE__ */ jsx39(SidebarTrigger2, {
|
|
3964
|
+
className: "ms-auto group-data-[collapsible=icon]:ms-0 max-md:hidden"
|
|
3965
|
+
})
|
|
3966
|
+
]
|
|
3967
|
+
})
|
|
3953
3968
|
})
|
|
3954
3969
|
]
|
|
3955
3970
|
}),
|
|
@@ -3960,7 +3975,7 @@ function AppShell2({
|
|
|
3960
3975
|
children: [
|
|
3961
3976
|
/* @__PURE__ */ jsxs25("header", {
|
|
3962
3977
|
"data-scroll": "none",
|
|
3963
|
-
className: "flex shrink-0 items-center gap-control-gap border-b border-border p-panel",
|
|
3978
|
+
className: cn2("flex shrink-0 items-center gap-control-gap border-b border-border p-panel", !topBar && "md:hidden"),
|
|
3964
3979
|
children: [
|
|
3965
3980
|
/* @__PURE__ */ jsx39(SidebarTrigger2, {}),
|
|
3966
3981
|
header
|
|
@@ -303,20 +303,148 @@ function DropTarget2({
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
// src/components/Kanban.tsx
|
|
306
|
-
import { useId as useId3 } from "react";
|
|
306
|
+
import { useId as useId3, useState as useState3 } from "react";
|
|
307
307
|
import { ArrowDownIcon, ArrowUpIcon } from "lucide-react";
|
|
308
308
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
309
|
-
|
|
309
|
+
var boardClassName = "@container overflow-x-auto";
|
|
310
|
+
var gridClassName = "grid gap-4 @3xl:auto-cols-[minmax(14rem,1fr)] @3xl:grid-flow-col";
|
|
311
|
+
var columnClassName = "flex min-w-0 flex-col gap-3 @3xl:min-h-48 rounded-sm border border-border bg-muted/30 p-3 data-over:border-primary";
|
|
312
|
+
var cardClassName = "grid gap-3 rounded-sm border border-border bg-card p-3 text-sm";
|
|
313
|
+
var readOnlyCardClassName = `${cardClassName} outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring`;
|
|
314
|
+
function ColumnHeader({ label, count }) {
|
|
315
|
+
return /* @__PURE__ */ jsxs3("header", {
|
|
316
|
+
className: "flex items-center justify-between gap-2",
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsx4("h2", {
|
|
319
|
+
className: "text-sm font-semibold",
|
|
320
|
+
children: label
|
|
321
|
+
}),
|
|
322
|
+
/* @__PURE__ */ jsx4(Badge2, {
|
|
323
|
+
variant: "secondary",
|
|
324
|
+
"aria-label": `${label} count`,
|
|
325
|
+
children: count
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
function EmptyColumn({ children }) {
|
|
331
|
+
return /* @__PURE__ */ jsx4("p", {
|
|
332
|
+
className: "py-6 text-center text-sm text-muted-foreground",
|
|
333
|
+
children
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
function getNextCard(cards, current, key) {
|
|
337
|
+
const column = cards.findIndex((list) => list.includes(current));
|
|
338
|
+
const index = cards[column].indexOf(current);
|
|
339
|
+
if (key === "ArrowDown")
|
|
340
|
+
return cards[column][index + 1];
|
|
341
|
+
if (key === "ArrowUp")
|
|
342
|
+
return cards[column][index - 1];
|
|
343
|
+
if (key === "Home")
|
|
344
|
+
return cards[column][0];
|
|
345
|
+
if (key === "End")
|
|
346
|
+
return cards[column].at(-1);
|
|
347
|
+
const step = key === "ArrowRight" ? 1 : key === "ArrowLeft" ? -1 : 0;
|
|
348
|
+
if (!step)
|
|
349
|
+
return;
|
|
350
|
+
for (let next = column + step;next >= 0 && next < cards.length; next += step) {
|
|
351
|
+
const list = cards[next];
|
|
352
|
+
if (list.length)
|
|
353
|
+
return list[Math.min(index, list.length - 1)];
|
|
354
|
+
}
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
function ReadOnlyKanban({
|
|
310
358
|
label,
|
|
311
359
|
columns,
|
|
312
360
|
items,
|
|
313
|
-
onItemsChange,
|
|
314
361
|
renderItem,
|
|
315
|
-
|
|
316
|
-
disabled,
|
|
362
|
+
emptyLabel,
|
|
317
363
|
density
|
|
318
364
|
}) {
|
|
365
|
+
const cards = columns.map((column) => items.filter((item) => item.columnId === column.id));
|
|
366
|
+
const [currentId, setCurrentId] = useState3();
|
|
367
|
+
const tabStopId = items.some((item) => item.id === currentId) ? currentId : cards.flat()[0]?.id;
|
|
368
|
+
const onKeyDown = (event, item) => {
|
|
369
|
+
if (event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
370
|
+
return;
|
|
371
|
+
if (event.key === "Enter") {
|
|
372
|
+
event.preventDefault();
|
|
373
|
+
event.currentTarget.querySelector("a[href], button:not(:disabled)")?.click();
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const next = getNextCard(cards, item, event.key);
|
|
377
|
+
if (!next)
|
|
378
|
+
return;
|
|
379
|
+
event.preventDefault();
|
|
380
|
+
const board = event.currentTarget.closest("[data-kanban-board]");
|
|
381
|
+
board?.querySelector(`[data-kanban-card="${CSS.escape(next.id)}"]`)?.focus();
|
|
382
|
+
};
|
|
383
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
384
|
+
role: "region",
|
|
385
|
+
"aria-label": label,
|
|
386
|
+
"data-density": density,
|
|
387
|
+
"data-kanban-board": "",
|
|
388
|
+
className: boardClassName,
|
|
389
|
+
children: /* @__PURE__ */ jsx4("div", {
|
|
390
|
+
className: gridClassName,
|
|
391
|
+
children: columns.map((column, columnIndex) => {
|
|
392
|
+
const list = cards[columnIndex];
|
|
393
|
+
return /* @__PURE__ */ jsxs3("section", {
|
|
394
|
+
"aria-label": column.label,
|
|
395
|
+
"data-scroll": "none",
|
|
396
|
+
className: columnClassName,
|
|
397
|
+
children: [
|
|
398
|
+
/* @__PURE__ */ jsx4(ColumnHeader, {
|
|
399
|
+
label: column.label,
|
|
400
|
+
count: list.length
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ jsx4("ol", {
|
|
403
|
+
className: "grid gap-2",
|
|
404
|
+
children: list.map((item) => /* @__PURE__ */ jsx4("li", {
|
|
405
|
+
children: /* @__PURE__ */ jsx4("div", {
|
|
406
|
+
role: "group",
|
|
407
|
+
"aria-label": item.title,
|
|
408
|
+
tabIndex: item.id === tabStopId ? 0 : -1,
|
|
409
|
+
"data-kanban-card": item.id,
|
|
410
|
+
"data-scroll": "none",
|
|
411
|
+
className: readOnlyCardClassName,
|
|
412
|
+
onFocus: () => setCurrentId(item.id),
|
|
413
|
+
onKeyDown: (event) => onKeyDown(event, item),
|
|
414
|
+
children: renderItem ? renderItem(item) : /* @__PURE__ */ jsx4("h3", {
|
|
415
|
+
className: "font-medium",
|
|
416
|
+
children: item.title
|
|
417
|
+
})
|
|
418
|
+
})
|
|
419
|
+
}, item.id))
|
|
420
|
+
}),
|
|
421
|
+
!list.length && /* @__PURE__ */ jsx4(EmptyColumn, {
|
|
422
|
+
children: emptyLabel
|
|
423
|
+
})
|
|
424
|
+
]
|
|
425
|
+
}, column.id);
|
|
426
|
+
})
|
|
427
|
+
})
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
function Kanban2(props) {
|
|
431
|
+
const {
|
|
432
|
+
label,
|
|
433
|
+
columns,
|
|
434
|
+
items,
|
|
435
|
+
onItemsChange,
|
|
436
|
+
renderItem,
|
|
437
|
+
canMove,
|
|
438
|
+
disabled,
|
|
439
|
+
emptyLabel = "No items",
|
|
440
|
+
density
|
|
441
|
+
} = props;
|
|
319
442
|
const boardId = useId3();
|
|
443
|
+
if (!onItemsChange)
|
|
444
|
+
return /* @__PURE__ */ jsx4(ReadOnlyKanban, {
|
|
445
|
+
...props,
|
|
446
|
+
emptyLabel
|
|
447
|
+
});
|
|
320
448
|
const type = `application/x-kanban-${boardId.replaceAll(":", "").toLowerCase()}`;
|
|
321
449
|
const canDropInto = (data, columnId) => typeof data === "string" && !disabled && items.some((item) => item.id === data && (!canMove || canMove(item, columnId)));
|
|
322
450
|
const move = (id, columnId, beforeId) => {
|
|
@@ -333,9 +461,9 @@ function Kanban2({
|
|
|
333
461
|
role: "region",
|
|
334
462
|
"aria-label": label,
|
|
335
463
|
"data-density": density,
|
|
336
|
-
className:
|
|
464
|
+
className: boardClassName,
|
|
337
465
|
children: /* @__PURE__ */ jsx4("div", {
|
|
338
|
-
className:
|
|
466
|
+
className: gridClassName,
|
|
339
467
|
children: columns.map((column) => {
|
|
340
468
|
const cards = items.filter((item) => item.columnId === column.id);
|
|
341
469
|
return /* @__PURE__ */ jsxs3(DropTarget2, {
|
|
@@ -349,21 +477,11 @@ function Kanban2({
|
|
|
349
477
|
"aria-label": column.label,
|
|
350
478
|
"data-scroll": "none"
|
|
351
479
|
}),
|
|
352
|
-
className:
|
|
480
|
+
className: columnClassName,
|
|
353
481
|
children: [
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
/* @__PURE__ */ jsx4("h2", {
|
|
358
|
-
className: "text-sm font-semibold",
|
|
359
|
-
children: column.label
|
|
360
|
-
}),
|
|
361
|
-
/* @__PURE__ */ jsx4(Badge2, {
|
|
362
|
-
variant: "secondary",
|
|
363
|
-
"aria-label": `${column.label} count`,
|
|
364
|
-
children: cards.length
|
|
365
|
-
})
|
|
366
|
-
]
|
|
482
|
+
/* @__PURE__ */ jsx4(ColumnHeader, {
|
|
483
|
+
label: column.label,
|
|
484
|
+
count: cards.length
|
|
367
485
|
}),
|
|
368
486
|
/* @__PURE__ */ jsx4("ol", {
|
|
369
487
|
className: "grid gap-2",
|
|
@@ -380,7 +498,7 @@ function Kanban2({
|
|
|
380
498
|
data: item.id,
|
|
381
499
|
labels: [item.title],
|
|
382
500
|
disabled,
|
|
383
|
-
className:
|
|
501
|
+
className: `${cardClassName} data-dragging:opacity-50`,
|
|
384
502
|
role: "group",
|
|
385
503
|
"aria-label": item.title,
|
|
386
504
|
"data-scroll": "none",
|
|
@@ -431,9 +549,8 @@ function Kanban2({
|
|
|
431
549
|
})
|
|
432
550
|
}, item.id))
|
|
433
551
|
}),
|
|
434
|
-
!cards.length && /* @__PURE__ */ jsx4(
|
|
435
|
-
|
|
436
|
-
children: "No items"
|
|
552
|
+
!cards.length && /* @__PURE__ */ jsx4(EmptyColumn, {
|
|
553
|
+
children: emptyLabel
|
|
437
554
|
})
|
|
438
555
|
]
|
|
439
556
|
}, column.id);
|
|
@@ -29,7 +29,13 @@ type AppShellProps = IDensityProps & {
|
|
|
29
29
|
defaultSidebarOpen?: boolean;
|
|
30
30
|
label?: string;
|
|
31
31
|
content?: AppShellContent;
|
|
32
|
+
/**
|
|
33
|
+
* Show the top bar with the sidebar toggle and `header` on every screen size (the default). With `false`, wide
|
|
34
|
+
* screens drop the top bar and show the sidebar toggle at the end of the sidebar footer, after `sidebarFooter`;
|
|
35
|
+
* narrow screens keep the top bar, because its toggle is the only way to open the navigation sheet there.
|
|
36
|
+
*/
|
|
37
|
+
topBar?: boolean;
|
|
32
38
|
};
|
|
33
|
-
declare function AppShell({ navigation, brand, children, header, sidebarFooter, footer, height, defaultSidebarOpen, label, content, density, }: AppShellProps): ReactElement;
|
|
39
|
+
declare function AppShell({ navigation, brand, children, header, sidebarFooter, footer, height, defaultSidebarOpen, label, content, topBar, density, }: AppShellProps): ReactElement;
|
|
34
40
|
export { AppShell };
|
|
35
41
|
export type { AppShellContent, AppShellNavigationItem, AppShellProps };
|
|
@@ -13,11 +13,17 @@ type KanbanProps<T extends KanbanItem> = IDensityProps & {
|
|
|
13
13
|
label: string;
|
|
14
14
|
columns: readonly KanbanColumn[];
|
|
15
15
|
items: readonly T[];
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Receives the reordered items after a move. Omit it for a read-only board: cards cannot be dragged and show no move
|
|
18
|
+
* controls, the board is one Tab stop, arrow keys move between cards and Enter activates the card's first link or button.
|
|
19
|
+
*/
|
|
20
|
+
onItemsChange?: (items: T[]) => void;
|
|
17
21
|
renderItem?: (item: T) => ReactNode;
|
|
18
22
|
canMove?: (item: T, columnId: string) => boolean;
|
|
19
23
|
disabled?: boolean;
|
|
24
|
+
/** Shown in a column without cards. */
|
|
25
|
+
emptyLabel?: ReactNode;
|
|
20
26
|
};
|
|
21
|
-
declare function Kanban<T extends KanbanItem>(
|
|
27
|
+
declare function Kanban<T extends KanbanItem>(props: KanbanProps<T>): ReactElement;
|
|
22
28
|
export { Kanban };
|
|
23
29
|
export type { KanbanProps, KanbanColumn, KanbanItem };
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-gf6fsbrz.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
TabsList2,
|
|
101
101
|
TabsTrigger2,
|
|
102
102
|
TabsContent2
|
|
103
|
-
} from "../../chunk-
|
|
103
|
+
} from "../../chunk-w474hday.js";
|
|
104
104
|
import"../../chunk-4e96tpw0.js";
|
|
105
105
|
import {
|
|
106
106
|
Checkbox2
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,7 @@ import {
|
|
|
188
188
|
DashboardLayout2,
|
|
189
189
|
BillingUsage2,
|
|
190
190
|
SelectionAction2
|
|
191
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-gf6fsbrz.js";
|
|
192
192
|
import {
|
|
193
193
|
statusDotVariants2,
|
|
194
194
|
StatusDot2
|
|
@@ -225,7 +225,7 @@ import {
|
|
|
225
225
|
useDropTarget2,
|
|
226
226
|
DropTarget2,
|
|
227
227
|
Kanban2
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-w474hday.js";
|
|
229
229
|
import {
|
|
230
230
|
NumberField2,
|
|
231
231
|
NumberFieldGroup2,
|
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.207",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -9,7 +9,13 @@ Source: src/components/stories/layout/AppShell.stories.tsx
|
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
11
|
import { AnalyticsProvider } from "@alexgorbatchev/shadcn/analytics";
|
|
12
|
-
import { AppShell, PageHeader, Stack, StatCard, Text } from "@alexgorbatchev/shadcn";
|
|
12
|
+
import { AppShell, Button, PageHeader, Stack, StatCard, Text } from "@alexgorbatchev/shadcn";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Supporting imports
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { UserIcon } from "lucide-react";
|
|
13
19
|
```
|
|
14
20
|
|
|
15
21
|
## Default component
|
|
@@ -95,3 +101,25 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
103
|
```
|
|
104
|
+
|
|
105
|
+
### WithoutTopBar
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
{
|
|
109
|
+
args: {
|
|
110
|
+
topBar: false,
|
|
111
|
+
header: undefined,
|
|
112
|
+
sidebarFooter: (<Button variant="ghost" size="icon-sm" aria-label="Account">
|
|
113
|
+
<UserIcon />
|
|
114
|
+
</Button>),
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### WithoutTopBarOnPhone
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
{
|
|
123
|
+
args: { topBar: false, header: undefined }
|
|
124
|
+
}
|
|
125
|
+
```
|
|
@@ -48,3 +48,29 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
48
48
|
render: () => <Example restricted/>
|
|
49
49
|
}
|
|
50
50
|
```
|
|
51
|
+
|
|
52
|
+
### ReadOnly
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
{
|
|
56
|
+
render: () => <ReadOnlyExample />
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### ReadOnlyNarrow
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
{
|
|
64
|
+
render: () => <ReadOnlyExample width={320}/>
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Wide
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
{
|
|
72
|
+
render: () => (<div style={{ width: 1000 }}>
|
|
73
|
+
<Example />
|
|
74
|
+
</div>)
|
|
75
|
+
}
|
|
76
|
+
```
|