@alexgorbatchev/shadcn 0.0.208 → 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-42tcze5n.js → chunk-g81e61m8.js} +113 -78
- package/dist/components/Kanban.d.ts +5 -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 +16 -0
- package/package.json +1 -1
|
@@ -311,7 +311,24 @@ var gridClassName = "grid gap-4 @3xl:auto-cols-[minmax(14rem,1fr)] @3xl:grid-flo
|
|
|
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
312
|
var readOnlyGridClassName = "grid gap-6 @3xl:auto-cols-[minmax(14rem,1fr)] @3xl:grid-flow-col @3xl:gap-4";
|
|
313
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-
|
|
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
|
+
}
|
|
315
332
|
var readOnlyCardClassName = `${cardClassName} outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring`;
|
|
316
333
|
function ColumnHeader({ label, count }) {
|
|
317
334
|
return /* @__PURE__ */ jsxs3("header", {
|
|
@@ -362,9 +379,11 @@ function ReadOnlyKanban({
|
|
|
362
379
|
items,
|
|
363
380
|
renderItem,
|
|
364
381
|
emptyLabel,
|
|
365
|
-
density
|
|
382
|
+
density,
|
|
383
|
+
describeItem
|
|
366
384
|
}) {
|
|
367
385
|
const cards = columns.map((column) => items.filter((item) => item.columnId === column.id));
|
|
386
|
+
const getDescription = useCardDescriptions(describeItem);
|
|
368
387
|
const [currentId, setCurrentId] = useState3();
|
|
369
388
|
const tabStopId = items.some((item) => item.id === currentId) ? currentId : cards.flat()[0]?.id;
|
|
370
389
|
const onKeyDown = (event, item) => {
|
|
@@ -403,22 +422,29 @@ function ReadOnlyKanban({
|
|
|
403
422
|
}),
|
|
404
423
|
/* @__PURE__ */ jsx4("ol", {
|
|
405
424
|
className: "grid gap-2",
|
|
406
|
-
children: list.map((item) =>
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
+
})
|
|
422
448
|
}),
|
|
423
449
|
!list.length && /* @__PURE__ */ jsx4(EmptyColumn, {
|
|
424
450
|
children: emptyLabel
|
|
@@ -439,9 +465,11 @@ function Kanban2(props) {
|
|
|
439
465
|
canMove,
|
|
440
466
|
disabled,
|
|
441
467
|
emptyLabel = "No items",
|
|
442
|
-
density
|
|
468
|
+
density,
|
|
469
|
+
describeItem
|
|
443
470
|
} = props;
|
|
444
471
|
const boardId = useId3();
|
|
472
|
+
const getDescription = useCardDescriptions(describeItem);
|
|
445
473
|
if (!onItemsChange)
|
|
446
474
|
return /* @__PURE__ */ jsx4(ReadOnlyKanban, {
|
|
447
475
|
...props,
|
|
@@ -466,7 +494,7 @@ function Kanban2(props) {
|
|
|
466
494
|
className: boardClassName,
|
|
467
495
|
children: /* @__PURE__ */ jsx4("div", {
|
|
468
496
|
className: gridClassName,
|
|
469
|
-
children: columns.map((column) => {
|
|
497
|
+
children: columns.map((column, columnIndex) => {
|
|
470
498
|
const cards = items.filter((item) => item.columnId === column.id);
|
|
471
499
|
return /* @__PURE__ */ jsxs3(DropTarget2, {
|
|
472
500
|
accept: [type],
|
|
@@ -487,69 +515,76 @@ function Kanban2(props) {
|
|
|
487
515
|
}),
|
|
488
516
|
/* @__PURE__ */ jsx4("ol", {
|
|
489
517
|
className: "grid gap-2",
|
|
490
|
-
children: cards.map((item, index) =>
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
children: item.title
|
|
512
|
-
})
|
|
513
|
-
}),
|
|
514
|
-
/* @__PURE__ */ jsxs3("div", {
|
|
515
|
-
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",
|
|
516
539
|
children: [
|
|
517
|
-
/* @__PURE__ */ jsx4(
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
onValueChange: (next) => move(item.id, next),
|
|
523
|
-
options: columns.map((target) => ({
|
|
524
|
-
value: target.id,
|
|
525
|
-
label: target.label,
|
|
526
|
-
disabled: Boolean(canMove && !canMove(item, target.id))
|
|
527
|
-
}))
|
|
528
|
-
}),
|
|
529
|
-
/* @__PURE__ */ jsx4(Button2, {
|
|
530
|
-
type: "button",
|
|
531
|
-
variant: "ghost",
|
|
532
|
-
size: "icon-sm",
|
|
533
|
-
"aria-label": `Move ${item.title} up`,
|
|
534
|
-
disabled: disabled || index === 0,
|
|
535
|
-
onClick: () => move(item.id, column.id, cards[index - 1]?.id),
|
|
536
|
-
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
|
+
})
|
|
537
545
|
}),
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
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
|
+
]
|
|
546
580
|
})
|
|
547
581
|
]
|
|
548
582
|
})
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
583
|
+
}),
|
|
584
|
+
description.element
|
|
585
|
+
]
|
|
586
|
+
}, item.id);
|
|
587
|
+
})
|
|
553
588
|
}),
|
|
554
589
|
!cards.length && /* @__PURE__ */ jsx4(EmptyColumn, {
|
|
555
590
|
children: emptyLabel
|
|
@@ -24,6 +24,11 @@ type KanbanProps<T extends KanbanItem> = IDensityProps & {
|
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
/** Shown in a column without cards. */
|
|
26
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;
|
|
27
32
|
};
|
|
28
33
|
declare function Kanban<T extends KanbanItem>(props: KanbanProps<T>): ReactElement;
|
|
29
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
|
|
@@ -73,6 +81,14 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
73
81
|
}
|
|
74
82
|
```
|
|
75
83
|
|
|
84
|
+
### ReadOnlyDescribed
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
{
|
|
88
|
+
render: () => <ReadOnlyExample isDescribed/>
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
76
92
|
### Wide
|
|
77
93
|
|
|
78
94
|
```tsx
|