react-os-shell 0.8.0 → 0.9.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/dist/index.d.ts CHANGED
@@ -1020,6 +1020,51 @@ interface EntityListProps<T> {
1020
1020
  */
1021
1021
  declare function EntityList<T>(props: EntityListProps<T>): react_jsx_runtime.JSX.Element;
1022
1022
 
1023
+ /**
1024
+ * Generic, drag-and-drop Kanban board. Self-contained (native HTML5 DnD, no
1025
+ * library) and styled with the same Tailwind utilities + `grid-scroll` class the
1026
+ * shell already ships, so consumers get it for free.
1027
+ *
1028
+ * Group items into columns with `columnOf`, render each card with `renderCard`,
1029
+ * and handle moves with `onMove(id, toColumn)`. Drops only change a card's
1030
+ * column; within-column order is presentational (optionally via `sortInColumn`).
1031
+ *
1032
+ * Drag affordance: as a card is dragged over a *different* column, the cards at
1033
+ * and below the hovered position slide down (CSS transform transition) to open a
1034
+ * gap the size of the dragged card, and the column highlights. The dragged card
1035
+ * is dimmed. Insertion index tracks `dragenter` (once per card crossed) rather
1036
+ * than `dragover` (every few ms) so the gap stays stable instead of oscillating.
1037
+ */
1038
+ interface KanbanColumn {
1039
+ /** Stable column key — what `columnOf` returns and `onMove` receives. */
1040
+ value: string;
1041
+ label: string;
1042
+ /** Tailwind text + bg classes for the column header. */
1043
+ accent?: string;
1044
+ /** Tailwind bg class for the header dot. */
1045
+ dot?: string;
1046
+ }
1047
+ interface KanbanProps<T> {
1048
+ items: T[];
1049
+ columns: KanbanColumn[];
1050
+ columnOf: (item: T) => string;
1051
+ getId: (item: T) => string;
1052
+ /** Called when a card is dropped on a column (its own `value`). */
1053
+ onMove: (id: string, toColumn: string) => void;
1054
+ /** Inner card content — the card chrome (border, padding, hover) is provided. */
1055
+ renderCard: (item: T) => ReactNode;
1056
+ onCardClick?: (item: T) => void;
1057
+ /** Optional comparator for ordering within a column. */
1058
+ sortInColumn?: (a: T, b: T) => number;
1059
+ isLoading?: boolean;
1060
+ loadingText?: string;
1061
+ /** Shown when there are no items at all. */
1062
+ emptyState?: ReactNode;
1063
+ /** Placeholder text inside an empty column. */
1064
+ columnEmptyText?: string;
1065
+ }
1066
+ declare function Kanban<T>({ items, columns, columnOf, getId, onMove, renderCard, onCardClick, sortInColumn, isLoading, loadingText, emptyState, columnEmptyText, }: KanbanProps<T>): react_jsx_runtime.JSX.Element;
1067
+
1023
1068
  interface PaginatedResponse<T> {
1024
1069
  count: number;
1025
1070
  next: string | null;
@@ -1336,4 +1381,4 @@ declare function useNewHotkey(callback: () => void): void;
1336
1381
  */
1337
1382
  declare function useEditHotkey(callback: (() => void) | null): void;
1338
1383
 
1339
- export { ALT, ALT_SHIFT_D, ALT_SHIFT_E, ALT_SHIFT_N, BehaviorPanel, type BugReport, type BugReportConfig, BugReportConfigProvider, BugReportDetail, type BugReportExtraField, type BugReportExtraSelectField, BugReportProvider, type BugReportSubmission, type BugReportSubmitPayload, CMD_A, CMD_DOT, CMD_ENTER, CMD_K, CMD_S, CancelButton, type CellStyle, type ChangelogEntry, type ColumnDef, ConfirmProvider, CopyButton, Customization, type CustomizationOmitSection, type CustomizationProps, DEV_BANNER_TEXT, Desktop, type DesktopHostConfig, DesktopHostProvider, DevIndicator, DocFavStar, ENTER, EditableGrid, type EditableGridProps, type EntityFetcher, EntityList, type EntityListColumn, type EntityListProps, GLASS_DIVIDER, GLASS_INPUT_BG, GlobalSearch, type GridColumn, HelpCenter, type HelpCenterDoc, type HelpCenterProps, Layout, type LayoutProps, ListFooter, MOD, Markdown, type MarkdownProps, Modal, ModalActions, NotificationBell, type NotificationsConfig, type PaginatedResponse, PopupMenu, PopupMenuDivider, PopupMenuItem, PopupMenuLabel, type ReportType, ResizableTable, SHIFT, type SearchConfig, type SearchProvider, type SearchResult, type SemanticGroup, type ShellAuth, ShellAuthProvider, ShellEntityFetcherProvider, type ShellNotification, type ShellPrefsAdapter, ShellPrefsProvider, ShortcutHelp, type SortState, SoundsPanel, StartMenu, StatusBadge, StatusBadgeProvider, type StickyEntityRef, type StickyResolver, SystemPreferences, type SystemPreferencesProps, type SystemPreferencesSection, type TodoProvider, type TodoTask, VERSION, WidgetManager, WindowManagerProvider, WindowRegistry, WindowTitle, applyDevTitle, commitExposeHighlight, confirm, confirmDestructive, createWindowRegistry, exitExposeMode, formatDate, getActiveWindowRoute, getExposeHighlight, getWindowPosition, glassStyle, isDevEnv, isMac, openBugReportDialog, prompt, reportBug, setExposeHighlight, setShellApiClient, setShellAuthBridge, setShellNavIcons, setShellTodoProvider, setWindowDefaultPosition, setWindowPosition, subscribeExposeHighlight, toast, toggleExposeMode, useBugReport, useClickOutside, useColumnConfig, useDesktopHost, useEditHotkey, useInfiniteScroll, useLocalStoragePrefs, useModalActive, useNewHotkey, useShellAuth, useShellEntityFetcher, useShellPrefs, useSort, useTableNav, useWidgetSettings, useWindowManager, useWindowMenuItem, useWindowTitle };
1384
+ export { ALT, ALT_SHIFT_D, ALT_SHIFT_E, ALT_SHIFT_N, BehaviorPanel, type BugReport, type BugReportConfig, BugReportConfigProvider, BugReportDetail, type BugReportExtraField, type BugReportExtraSelectField, BugReportProvider, type BugReportSubmission, type BugReportSubmitPayload, CMD_A, CMD_DOT, CMD_ENTER, CMD_K, CMD_S, CancelButton, type CellStyle, type ChangelogEntry, type ColumnDef, ConfirmProvider, CopyButton, Customization, type CustomizationOmitSection, type CustomizationProps, DEV_BANNER_TEXT, Desktop, type DesktopHostConfig, DesktopHostProvider, DevIndicator, DocFavStar, ENTER, EditableGrid, type EditableGridProps, type EntityFetcher, EntityList, type EntityListColumn, type EntityListProps, GLASS_DIVIDER, GLASS_INPUT_BG, GlobalSearch, type GridColumn, HelpCenter, type HelpCenterDoc, type HelpCenterProps, Kanban, type KanbanColumn, type KanbanProps, Layout, type LayoutProps, ListFooter, MOD, Markdown, type MarkdownProps, Modal, ModalActions, NotificationBell, type NotificationsConfig, type PaginatedResponse, PopupMenu, PopupMenuDivider, PopupMenuItem, PopupMenuLabel, type ReportType, ResizableTable, SHIFT, type SearchConfig, type SearchProvider, type SearchResult, type SemanticGroup, type ShellAuth, ShellAuthProvider, ShellEntityFetcherProvider, type ShellNotification, type ShellPrefsAdapter, ShellPrefsProvider, ShortcutHelp, type SortState, SoundsPanel, StartMenu, StatusBadge, StatusBadgeProvider, type StickyEntityRef, type StickyResolver, SystemPreferences, type SystemPreferencesProps, type SystemPreferencesSection, type TodoProvider, type TodoTask, VERSION, WidgetManager, WindowManagerProvider, WindowRegistry, WindowTitle, applyDevTitle, commitExposeHighlight, confirm, confirmDestructive, createWindowRegistry, exitExposeMode, formatDate, getActiveWindowRoute, getExposeHighlight, getWindowPosition, glassStyle, isDevEnv, isMac, openBugReportDialog, prompt, reportBug, setExposeHighlight, setShellApiClient, setShellAuthBridge, setShellNavIcons, setShellTodoProvider, setWindowDefaultPosition, setWindowPosition, subscribeExposeHighlight, toast, toggleExposeMode, useBugReport, useClickOutside, useColumnConfig, useDesktopHost, useEditHotkey, useInfiniteScroll, useLocalStoragePrefs, useModalActive, useNewHotkey, useShellAuth, useShellEntityFetcher, useShellPrefs, useSort, useTableNav, useWidgetSettings, useWindowManager, useWindowMenuItem, useWindowTitle };
package/dist/index.js CHANGED
@@ -1400,7 +1400,7 @@ function WidgetManager({ open, onClose }) {
1400
1400
  }
1401
1401
 
1402
1402
  // src/version.ts
1403
- var VERSION = "0.8.0" ;
1403
+ var VERSION = "0.9.0" ;
1404
1404
  var APP_VERSION = VERSION;
1405
1405
 
1406
1406
  // src/changelog.ts
@@ -6258,6 +6258,126 @@ function EntityList(props) {
6258
6258
  }
6259
6259
  ) }) });
6260
6260
  }
6261
+ function Kanban({
6262
+ items,
6263
+ columns,
6264
+ columnOf,
6265
+ getId,
6266
+ onMove,
6267
+ renderCard,
6268
+ onCardClick,
6269
+ sortInColumn,
6270
+ isLoading = false,
6271
+ loadingText = "Loading\u2026",
6272
+ emptyState,
6273
+ columnEmptyText = "Drop here"
6274
+ }) {
6275
+ const [dragId, setDragId] = useState(null);
6276
+ const [fromCol, setFromCol] = useState(null);
6277
+ const [gap, setGap] = useState(0);
6278
+ const [over, setOver] = useState(null);
6279
+ const grouped = useMemo(() => {
6280
+ const map = {};
6281
+ for (const c of columns) map[c.value] = [];
6282
+ for (const it of items) (map[columnOf(it)] ??= []).push(it);
6283
+ if (sortInColumn) for (const k of Object.keys(map)) map[k].sort(sortInColumn);
6284
+ return map;
6285
+ }, [items, columns, columnOf, sortInColumn]);
6286
+ const reset = () => {
6287
+ setDragId(null);
6288
+ setFromCol(null);
6289
+ setOver(null);
6290
+ };
6291
+ const isActive = (col) => over !== null && over.col === col && fromCol !== col;
6292
+ if (isLoading) return /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 p-4", children: loadingText });
6293
+ if (items.length === 0) {
6294
+ return /* @__PURE__ */ jsx(Fragment, { children: emptyState ?? /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 p-4", children: "No items." }) });
6295
+ }
6296
+ return /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-x-auto grid-scroll", children: /* @__PURE__ */ jsx("div", { className: "flex gap-3 h-full min-w-max pb-2", children: columns.map((col) => {
6297
+ const colItems = grouped[col.value] ?? [];
6298
+ const active = isActive(col.value);
6299
+ return /* @__PURE__ */ jsxs(
6300
+ "div",
6301
+ {
6302
+ className: `flex flex-col w-72 shrink-0 rounded-xl bg-gray-50 border transition-colors ${active ? "border-blue-400 ring-2 ring-blue-300/60" : "border-gray-200"}`,
6303
+ onDragOver: (e) => e.preventDefault(),
6304
+ onDragEnter: () => setOver((prev) => prev && prev.col === col.value ? prev : { col: col.value, index: colItems.length }),
6305
+ onDrop: () => {
6306
+ if (dragId) onMove(dragId, col.value);
6307
+ reset();
6308
+ },
6309
+ children: [
6310
+ /* @__PURE__ */ jsxs(
6311
+ "div",
6312
+ {
6313
+ className: `flex items-center justify-between px-3 py-2 rounded-t-xl text-sm font-medium ${col.accent ?? "text-gray-700 bg-gray-100"}`,
6314
+ children: [
6315
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
6316
+ /* @__PURE__ */ jsx("span", { className: `h-2 w-2 rounded-full ${col.dot ?? "bg-gray-400"}` }),
6317
+ col.label
6318
+ ] }),
6319
+ /* @__PURE__ */ jsx("span", { className: "text-xs opacity-70", children: colItems.length })
6320
+ ]
6321
+ }
6322
+ ),
6323
+ /* @__PURE__ */ jsxs(
6324
+ "div",
6325
+ {
6326
+ className: "flex-1 overflow-y-auto p-2 space-y-2 min-h-[120px]",
6327
+ style: { paddingBottom: active ? gap + 8 : 8, transition: "padding-bottom 160ms ease" },
6328
+ children: [
6329
+ colItems.map((item, index) => {
6330
+ const id = getId(item);
6331
+ const shift = active && over !== null && index >= over.index ? gap : 0;
6332
+ const style = dragId === null ? {} : {
6333
+ transform: `translateY(${shift}px)`,
6334
+ transition: "transform 160ms cubic-bezier(0.2, 0, 0, 1), opacity 120ms ease",
6335
+ opacity: id === dragId ? 0.4 : 1
6336
+ };
6337
+ return /* @__PURE__ */ jsx(
6338
+ "div",
6339
+ {
6340
+ draggable: true,
6341
+ onDragStart: (e) => {
6342
+ setDragId(id);
6343
+ setFromCol(col.value);
6344
+ setGap(Math.round(e.currentTarget.getBoundingClientRect().height) + 8);
6345
+ try {
6346
+ e.dataTransfer.effectAllowed = "move";
6347
+ } catch {
6348
+ }
6349
+ },
6350
+ onDragEnter: (e) => {
6351
+ e.stopPropagation();
6352
+ setOver(
6353
+ (prev) => prev && prev.col === col.value && prev.index === index ? prev : { col: col.value, index }
6354
+ );
6355
+ },
6356
+ onDragEnd: reset,
6357
+ onClick: onCardClick ? () => onCardClick(item) : void 0,
6358
+ style,
6359
+ className: `rounded-lg bg-white border border-gray-200 p-3 shadow-sm hover:border-blue-400 hover:shadow transition ${onCardClick ? "cursor-pointer" : ""}`,
6360
+ children: renderCard(item)
6361
+ },
6362
+ id
6363
+ );
6364
+ }),
6365
+ colItems.length === 0 && /* @__PURE__ */ jsx(
6366
+ "div",
6367
+ {
6368
+ className: `text-[11px] text-center rounded-lg transition-all duration-150 ${active ? "border-2 border-dashed border-blue-300 bg-blue-50/50 text-blue-400 py-8" : "text-gray-400 py-6"}`,
6369
+ children: columnEmptyText
6370
+ }
6371
+ )
6372
+ ]
6373
+ }
6374
+ )
6375
+ ]
6376
+ },
6377
+ col.value
6378
+ );
6379
+ }) }) });
6380
+ }
6261
6381
  function useInfiniteScroll({
6262
6382
  queryKey,
6263
6383
  fetchFn,
@@ -6374,6 +6494,6 @@ function useEditHotkey(callback) {
6374
6494
  }, [callback, isActive]);
6375
6495
  }
6376
6496
 
6377
- export { ALT, ALT_SHIFT_D, ALT_SHIFT_E, ALT_SHIFT_N, BehaviorPanel, BugReportConfigProvider, BugReportDetail, BugReportProvider, CMD_A, CMD_DOT, CMD_ENTER, CMD_K, CMD_S, Customization, DEV_BANNER_TEXT, Desktop, DesktopHostProvider, DevIndicator, ENTER, EntityList, GlobalSearch, HelpCenter, Layout, ListFooter, MOD, Markdown, NotificationBell, ResizableTable, SHIFT, ShellEntityFetcherProvider, ShortcutHelp, SoundsPanel, StartMenu, StatusBadge, StatusBadgeProvider, SystemPreferences, VERSION, WidgetManager, applyDevTitle, createWindowRegistry, isDevEnv, isMac, openBugReportDialog, reportBug, useBugReport, useClickOutside, useColumnConfig, useDesktopHost, useEditHotkey, useInfiniteScroll, useNewHotkey, useShellEntityFetcher, useSort, useTableNav };
6497
+ export { ALT, ALT_SHIFT_D, ALT_SHIFT_E, ALT_SHIFT_N, BehaviorPanel, BugReportConfigProvider, BugReportDetail, BugReportProvider, CMD_A, CMD_DOT, CMD_ENTER, CMD_K, CMD_S, Customization, DEV_BANNER_TEXT, Desktop, DesktopHostProvider, DevIndicator, ENTER, EntityList, GlobalSearch, HelpCenter, Kanban, Layout, ListFooter, MOD, Markdown, NotificationBell, ResizableTable, SHIFT, ShellEntityFetcherProvider, ShortcutHelp, SoundsPanel, StartMenu, StatusBadge, StatusBadgeProvider, SystemPreferences, VERSION, WidgetManager, applyDevTitle, createWindowRegistry, isDevEnv, isMac, openBugReportDialog, reportBug, useBugReport, useClickOutside, useColumnConfig, useDesktopHost, useEditHotkey, useInfiniteScroll, useNewHotkey, useShellEntityFetcher, useSort, useTableNav };
6378
6498
  //# sourceMappingURL=index.js.map
6379
6499
  //# sourceMappingURL=index.js.map