@alexgorbatchev/shadcn 0.0.207 → 0.0.209
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-w474hday.js → chunk-g81e61m8.js} +117 -80
- package/dist/components/Kanban.d.ts +6 -0
- package/dist/components/gantt/index.js +1 -1
- package/dist/components/json-render/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/llms/components/planning/Kanban.md +24 -0
- package/package.json +1 -1
|
@@ -309,7 +309,26 @@ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
|
309
309
|
var boardClassName = "@container overflow-x-auto";
|
|
310
310
|
var gridClassName = "grid gap-4 @3xl:auto-cols-[minmax(14rem,1fr)] @3xl:grid-flow-col";
|
|
311
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
|
|
312
|
+
var readOnlyGridClassName = "grid gap-6 @3xl:auto-cols-[minmax(14rem,1fr)] @3xl:grid-flow-col @3xl:gap-4";
|
|
313
|
+
var readOnlyColumnClassName = "flex min-w-0 flex-col gap-3 @3xl:self-start @3xl:rounded-sm @3xl:border @3xl:border-border @3xl:bg-muted/30 @3xl:p-3";
|
|
314
|
+
var cardClassName = "grid gap-3 rounded-sm border border-input bg-card p-3 text-sm";
|
|
315
|
+
function useCardDescriptions(describeItem) {
|
|
316
|
+
const prefix = useId3();
|
|
317
|
+
return (item, key) => {
|
|
318
|
+
const description = describeItem?.(item);
|
|
319
|
+
if (description === undefined || description === null || description === false || description === "")
|
|
320
|
+
return {};
|
|
321
|
+
const id = `${prefix}-${key}`;
|
|
322
|
+
return {
|
|
323
|
+
describedBy: id,
|
|
324
|
+
element: /* @__PURE__ */ jsx4("span", {
|
|
325
|
+
id,
|
|
326
|
+
className: "sr-only",
|
|
327
|
+
children: description
|
|
328
|
+
})
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
}
|
|
313
332
|
var readOnlyCardClassName = `${cardClassName} outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring`;
|
|
314
333
|
function ColumnHeader({ label, count }) {
|
|
315
334
|
return /* @__PURE__ */ jsxs3("header", {
|
|
@@ -360,9 +379,11 @@ function ReadOnlyKanban({
|
|
|
360
379
|
items,
|
|
361
380
|
renderItem,
|
|
362
381
|
emptyLabel,
|
|
363
|
-
density
|
|
382
|
+
density,
|
|
383
|
+
describeItem
|
|
364
384
|
}) {
|
|
365
385
|
const cards = columns.map((column) => items.filter((item) => item.columnId === column.id));
|
|
386
|
+
const getDescription = useCardDescriptions(describeItem);
|
|
366
387
|
const [currentId, setCurrentId] = useState3();
|
|
367
388
|
const tabStopId = items.some((item) => item.id === currentId) ? currentId : cards.flat()[0]?.id;
|
|
368
389
|
const onKeyDown = (event, item) => {
|
|
@@ -387,13 +408,13 @@ function ReadOnlyKanban({
|
|
|
387
408
|
"data-kanban-board": "",
|
|
388
409
|
className: boardClassName,
|
|
389
410
|
children: /* @__PURE__ */ jsx4("div", {
|
|
390
|
-
className:
|
|
411
|
+
className: readOnlyGridClassName,
|
|
391
412
|
children: columns.map((column, columnIndex) => {
|
|
392
413
|
const list = cards[columnIndex];
|
|
393
414
|
return /* @__PURE__ */ jsxs3("section", {
|
|
394
415
|
"aria-label": column.label,
|
|
395
416
|
"data-scroll": "none",
|
|
396
|
-
className:
|
|
417
|
+
className: readOnlyColumnClassName,
|
|
397
418
|
children: [
|
|
398
419
|
/* @__PURE__ */ jsx4(ColumnHeader, {
|
|
399
420
|
label: column.label,
|
|
@@ -401,22 +422,29 @@ function ReadOnlyKanban({
|
|
|
401
422
|
}),
|
|
402
423
|
/* @__PURE__ */ jsx4("ol", {
|
|
403
424
|
className: "grid gap-2",
|
|
404
|
-
children: list.map((item) =>
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
425
|
+
children: list.map((item, index) => {
|
|
426
|
+
const description = getDescription(item, `${columnIndex}-${index}`);
|
|
427
|
+
return /* @__PURE__ */ jsxs3("li", {
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ jsx4("div", {
|
|
430
|
+
role: "group",
|
|
431
|
+
"aria-label": item.title,
|
|
432
|
+
"aria-describedby": description.describedBy,
|
|
433
|
+
tabIndex: item.id === tabStopId ? 0 : -1,
|
|
434
|
+
"data-kanban-card": item.id,
|
|
435
|
+
"data-scroll": "none",
|
|
436
|
+
className: readOnlyCardClassName,
|
|
437
|
+
onFocus: () => setCurrentId(item.id),
|
|
438
|
+
onKeyDown: (event) => onKeyDown(event, item),
|
|
439
|
+
children: renderItem ? renderItem(item) : /* @__PURE__ */ jsx4("h3", {
|
|
440
|
+
className: "font-medium",
|
|
441
|
+
children: item.title
|
|
442
|
+
})
|
|
443
|
+
}),
|
|
444
|
+
description.element
|
|
445
|
+
]
|
|
446
|
+
}, item.id);
|
|
447
|
+
})
|
|
420
448
|
}),
|
|
421
449
|
!list.length && /* @__PURE__ */ jsx4(EmptyColumn, {
|
|
422
450
|
children: emptyLabel
|
|
@@ -437,9 +465,11 @@ function Kanban2(props) {
|
|
|
437
465
|
canMove,
|
|
438
466
|
disabled,
|
|
439
467
|
emptyLabel = "No items",
|
|
440
|
-
density
|
|
468
|
+
density,
|
|
469
|
+
describeItem
|
|
441
470
|
} = props;
|
|
442
471
|
const boardId = useId3();
|
|
472
|
+
const getDescription = useCardDescriptions(describeItem);
|
|
443
473
|
if (!onItemsChange)
|
|
444
474
|
return /* @__PURE__ */ jsx4(ReadOnlyKanban, {
|
|
445
475
|
...props,
|
|
@@ -464,7 +494,7 @@ function Kanban2(props) {
|
|
|
464
494
|
className: boardClassName,
|
|
465
495
|
children: /* @__PURE__ */ jsx4("div", {
|
|
466
496
|
className: gridClassName,
|
|
467
|
-
children: columns.map((column) => {
|
|
497
|
+
children: columns.map((column, columnIndex) => {
|
|
468
498
|
const cards = items.filter((item) => item.columnId === column.id);
|
|
469
499
|
return /* @__PURE__ */ jsxs3(DropTarget2, {
|
|
470
500
|
accept: [type],
|
|
@@ -485,69 +515,76 @@ function Kanban2(props) {
|
|
|
485
515
|
}),
|
|
486
516
|
/* @__PURE__ */ jsx4("ol", {
|
|
487
517
|
className: "grid gap-2",
|
|
488
|
-
children: cards.map((item, index) =>
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
children: item.title
|
|
510
|
-
})
|
|
511
|
-
}),
|
|
512
|
-
/* @__PURE__ */ jsxs3("div", {
|
|
513
|
-
className: "flex items-center gap-1",
|
|
518
|
+
children: cards.map((item, index) => {
|
|
519
|
+
const description = getDescription(item, `${columnIndex}-${index}`);
|
|
520
|
+
return /* @__PURE__ */ jsxs3("li", {
|
|
521
|
+
children: [
|
|
522
|
+
/* @__PURE__ */ jsx4(DropTarget2, {
|
|
523
|
+
accept: [type],
|
|
524
|
+
canDrop: (drag) => canDropInto(drag.data, column.id),
|
|
525
|
+
onDrop: (drag) => {
|
|
526
|
+
if (typeof drag.data === "string")
|
|
527
|
+
move(drag.data, column.id, item.id);
|
|
528
|
+
},
|
|
529
|
+
children: /* @__PURE__ */ jsxs3(DragSource2, {
|
|
530
|
+
type,
|
|
531
|
+
data: item.id,
|
|
532
|
+
labels: [item.title],
|
|
533
|
+
disabled,
|
|
534
|
+
className: `${cardClassName} data-dragging:opacity-50`,
|
|
535
|
+
role: "group",
|
|
536
|
+
"aria-label": item.title,
|
|
537
|
+
"aria-describedby": description.describedBy,
|
|
538
|
+
"data-scroll": "none",
|
|
514
539
|
children: [
|
|
515
|
-
/* @__PURE__ */ jsx4(
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
onValueChange: (next) => move(item.id, next),
|
|
521
|
-
options: columns.map((target) => ({
|
|
522
|
-
value: target.id,
|
|
523
|
-
label: target.label,
|
|
524
|
-
disabled: Boolean(canMove && !canMove(item, target.id))
|
|
525
|
-
}))
|
|
526
|
-
}),
|
|
527
|
-
/* @__PURE__ */ jsx4(Button2, {
|
|
528
|
-
type: "button",
|
|
529
|
-
variant: "ghost",
|
|
530
|
-
size: "icon-sm",
|
|
531
|
-
"aria-label": `Move ${item.title} up`,
|
|
532
|
-
disabled: disabled || index === 0,
|
|
533
|
-
onClick: () => move(item.id, column.id, cards[index - 1]?.id),
|
|
534
|
-
children: /* @__PURE__ */ jsx4(ArrowUpIcon, {})
|
|
540
|
+
/* @__PURE__ */ jsx4("div", {
|
|
541
|
+
children: renderItem ? renderItem(item) : /* @__PURE__ */ jsx4("h3", {
|
|
542
|
+
className: "font-medium",
|
|
543
|
+
children: item.title
|
|
544
|
+
})
|
|
535
545
|
}),
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
546
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
547
|
+
className: "flex items-center gap-1",
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ jsx4(OptionSelect2, {
|
|
550
|
+
"aria-label": `Move ${item.title} to`,
|
|
551
|
+
size: "sm",
|
|
552
|
+
value: column.id,
|
|
553
|
+
disabled,
|
|
554
|
+
onValueChange: (next) => move(item.id, next),
|
|
555
|
+
options: columns.map((target) => ({
|
|
556
|
+
value: target.id,
|
|
557
|
+
label: target.label,
|
|
558
|
+
disabled: Boolean(canMove && !canMove(item, target.id))
|
|
559
|
+
}))
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ jsx4(Button2, {
|
|
562
|
+
type: "button",
|
|
563
|
+
variant: "ghost",
|
|
564
|
+
size: "icon-sm",
|
|
565
|
+
"aria-label": `Move ${item.title} up`,
|
|
566
|
+
disabled: disabled || index === 0,
|
|
567
|
+
onClick: () => move(item.id, column.id, cards[index - 1]?.id),
|
|
568
|
+
children: /* @__PURE__ */ jsx4(ArrowUpIcon, {})
|
|
569
|
+
}),
|
|
570
|
+
/* @__PURE__ */ jsx4(Button2, {
|
|
571
|
+
type: "button",
|
|
572
|
+
variant: "ghost",
|
|
573
|
+
size: "icon-sm",
|
|
574
|
+
"aria-label": `Move ${item.title} down`,
|
|
575
|
+
disabled: disabled || index === cards.length - 1,
|
|
576
|
+
onClick: () => move(cards[index + 1].id, column.id, item.id),
|
|
577
|
+
children: /* @__PURE__ */ jsx4(ArrowDownIcon, {})
|
|
578
|
+
})
|
|
579
|
+
]
|
|
544
580
|
})
|
|
545
581
|
]
|
|
546
582
|
})
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
583
|
+
}),
|
|
584
|
+
description.element
|
|
585
|
+
]
|
|
586
|
+
}, item.id);
|
|
587
|
+
})
|
|
551
588
|
}),
|
|
552
589
|
!cards.length && /* @__PURE__ */ jsx4(EmptyColumn, {
|
|
553
590
|
children: emptyLabel
|
|
@@ -16,6 +16,7 @@ type KanbanProps<T extends KanbanItem> = IDensityProps & {
|
|
|
16
16
|
/**
|
|
17
17
|
* Receives the reordered items after a move. Omit it for a read-only board: cards cannot be dragged and show no move
|
|
18
18
|
* controls, the board is one Tab stop, arrow keys move between cards and Enter activates the card's first link or button.
|
|
19
|
+
* Its columns end after their last card, and stacked columns show their heading over their cards without a panel.
|
|
19
20
|
*/
|
|
20
21
|
onItemsChange?: (items: T[]) => void;
|
|
21
22
|
renderItem?: (item: T) => ReactNode;
|
|
@@ -23,6 +24,11 @@ type KanbanProps<T extends KanbanItem> = IDensityProps & {
|
|
|
23
24
|
disabled?: boolean;
|
|
24
25
|
/** Shown in a column without cards. */
|
|
25
26
|
emptyLabel?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Extra words for a card's accessible description, such as the exact times behind the ages it shows. Return nothing
|
|
29
|
+
* for a card that needs none.
|
|
30
|
+
*/
|
|
31
|
+
describeItem?: (item: T) => ReactNode;
|
|
26
32
|
};
|
|
27
33
|
declare function Kanban<T extends KanbanItem>(props: KanbanProps<T>): ReactElement;
|
|
28
34
|
export { Kanban };
|
package/dist/index.js
CHANGED
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.209",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -41,6 +41,14 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
41
41
|
}
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
### Described
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
{
|
|
48
|
+
render: () => <Example isDescribed/>
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
44
52
|
### Restricted
|
|
45
53
|
|
|
46
54
|
```tsx
|
|
@@ -65,6 +73,22 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
65
73
|
}
|
|
66
74
|
```
|
|
67
75
|
|
|
76
|
+
### ReadOnlyWide
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
{
|
|
80
|
+
render: () => <ReadOnlyExample width={1000}/>
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### ReadOnlyDescribed
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
{
|
|
88
|
+
render: () => <ReadOnlyExample isDescribed/>
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
68
92
|
### Wide
|
|
69
93
|
|
|
70
94
|
```tsx
|