react-os-shell 0.8.0 → 0.10.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,60 @@ 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
+ * Cards can be dragged **between** columns (to change which column they belong
1030
+ * to) and **within** a column (to reorder / prioritise). On drop, `onMove(id,
1031
+ * toColumn, toIndex)` fires — `toIndex` is the target position within `toColumn`
1032
+ * measured against that column's cards *excluding* the dragged one, so the
1033
+ * consumer can persist an order (e.g. midpoint between neighbours) that every
1034
+ * user then sees. Sort each column by that order via `sortInColumn`.
1035
+ *
1036
+ * Affordance: a blue **drop-line** shows exactly where the card will land
1037
+ * (between two cards, in either the source or a different column), and the
1038
+ * target column highlights. The dragged card dims. The insertion point tracks
1039
+ * `dragenter` (once per card crossed) so the line stays stable rather than
1040
+ * flickering.
1041
+ */
1042
+ interface KanbanColumn {
1043
+ /** Stable column key — what `columnOf` returns and `onMove` receives. */
1044
+ value: string;
1045
+ label: string;
1046
+ /** Tailwind text + bg classes for the column header. */
1047
+ accent?: string;
1048
+ /** Tailwind bg class for the header dot. */
1049
+ dot?: string;
1050
+ }
1051
+ interface KanbanProps<T> {
1052
+ items: T[];
1053
+ columns: KanbanColumn[];
1054
+ columnOf: (item: T) => string;
1055
+ getId: (item: T) => string;
1056
+ /**
1057
+ * Fired on drop. `toColumn` is the destination column's `value`; `toIndex` is
1058
+ * the target position within that column measured against its cards
1059
+ * **excluding** the dragged card (0 = top). A same-column drop that wouldn't
1060
+ * change the order is not reported.
1061
+ */
1062
+ onMove: (id: string, toColumn: string, toIndex: number) => void;
1063
+ /** Inner card content — the card chrome (border, padding, hover) is provided. */
1064
+ renderCard: (item: T) => ReactNode;
1065
+ onCardClick?: (item: T) => void;
1066
+ /** Comparator for ordering within a column — sort by the persisted order field. */
1067
+ sortInColumn?: (a: T, b: T) => number;
1068
+ isLoading?: boolean;
1069
+ loadingText?: string;
1070
+ /** Shown when there are no items at all. */
1071
+ emptyState?: ReactNode;
1072
+ /** Placeholder text inside an empty column. */
1073
+ columnEmptyText?: string;
1074
+ }
1075
+ declare function Kanban<T>({ items, columns, columnOf, getId, onMove, renderCard, onCardClick, sortInColumn, isLoading, loadingText, emptyState, columnEmptyText, }: KanbanProps<T>): react_jsx_runtime.JSX.Element;
1076
+
1023
1077
  interface PaginatedResponse<T> {
1024
1078
  count: number;
1025
1079
  next: string | null;
@@ -1336,4 +1390,4 @@ declare function useNewHotkey(callback: () => void): void;
1336
1390
  */
1337
1391
  declare function useEditHotkey(callback: (() => void) | null): void;
1338
1392
 
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 };
1393
+ 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
@@ -19,7 +19,7 @@ import { useAuth, useShellAuth } from './chunk-ADJ3CERD.js';
19
19
  export { ShellAuthProvider, setShellAuthBridge, useShellAuth } from './chunk-ADJ3CERD.js';
20
20
  import { glassStyle, startMenuCategories, navSections, isSection, GLASS_INPUT_BG, navIcons, sectionIcons } from './chunk-ZF6AYO4G.js';
21
21
  export { GLASS_DIVIDER, GLASS_INPUT_BG, glassStyle, setShellNavIcons } from './chunk-ZF6AYO4G.js';
22
- import { createContext, lazy, useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect, useContext, Suspense, isValidElement, cloneElement, useSyncExternalStore } from 'react';
22
+ import { createContext, lazy, useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect, useContext, Suspense, isValidElement, cloneElement, Fragment as Fragment$1, useSyncExternalStore } from 'react';
23
23
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
24
24
  import { Dialog, DialogBackdrop, DialogPanel, DialogTitle } from '@headlessui/react';
25
25
  import { createPortal } from 'react-dom';
@@ -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.10.0" ;
1404
1404
  var APP_VERSION = VERSION;
1405
1405
 
1406
1406
  // src/changelog.ts
@@ -6258,6 +6258,131 @@ 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 [over, setOver] = useState(null);
6277
+ const grouped = useMemo(() => {
6278
+ const map = {};
6279
+ for (const c of columns) map[c.value] = [];
6280
+ for (const it of items) (map[columnOf(it)] ??= []).push(it);
6281
+ if (sortInColumn) for (const k of Object.keys(map)) map[k].sort(sortInColumn);
6282
+ return map;
6283
+ }, [items, columns, columnOf, sortInColumn]);
6284
+ const reset = () => {
6285
+ setDragId(null);
6286
+ setOver(null);
6287
+ };
6288
+ const commitMove = (col) => {
6289
+ if (dragId && over && over.col === col) {
6290
+ const colItems = grouped[col] ?? [];
6291
+ const dp = colItems.findIndex((it) => getId(it) === dragId);
6292
+ const sameCol = dp !== -1;
6293
+ const noop = sameCol && (over.index === dp || over.index === dp + 1);
6294
+ if (!noop) {
6295
+ const toIndex = sameCol && over.index > dp ? over.index - 1 : over.index;
6296
+ onMove(dragId, col, toIndex);
6297
+ }
6298
+ }
6299
+ reset();
6300
+ };
6301
+ if (isLoading) return /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 p-4", children: loadingText });
6302
+ if (items.length === 0) {
6303
+ return /* @__PURE__ */ jsx(Fragment, { children: emptyState ?? /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 p-4", children: "No items." }) });
6304
+ }
6305
+ 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) => {
6306
+ const colItems = grouped[col.value] ?? [];
6307
+ const isOver = over !== null && over.col === col.value;
6308
+ const dp = dragId !== null ? colItems.findIndex((it) => getId(it) === dragId) : -1;
6309
+ const lineAt = isOver && !(dp !== -1 && (over.index === dp || over.index === dp + 1)) ? over.index : -1;
6310
+ return /* @__PURE__ */ jsxs(
6311
+ "div",
6312
+ {
6313
+ className: `flex flex-col w-72 shrink-0 rounded-xl bg-gray-50 border transition-colors ${isOver ? "border-blue-400 ring-2 ring-blue-300/60" : "border-gray-200"}`,
6314
+ onDragOver: (e) => e.preventDefault(),
6315
+ onDrop: () => commitMove(col.value),
6316
+ children: [
6317
+ /* @__PURE__ */ jsxs(
6318
+ "div",
6319
+ {
6320
+ 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"}`,
6321
+ children: [
6322
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
6323
+ /* @__PURE__ */ jsx("span", { className: `h-2 w-2 rounded-full ${col.dot ?? "bg-gray-400"}` }),
6324
+ col.label
6325
+ ] }),
6326
+ /* @__PURE__ */ jsx("span", { className: "text-xs opacity-70", children: colItems.length })
6327
+ ]
6328
+ }
6329
+ ),
6330
+ /* @__PURE__ */ jsxs(
6331
+ "div",
6332
+ {
6333
+ className: "flex-1 overflow-y-auto p-2 space-y-2 min-h-[120px]",
6334
+ onDragEnter: () => setOver(
6335
+ (prev) => prev && prev.col === col.value && prev.index === colItems.length ? prev : { col: col.value, index: colItems.length }
6336
+ ),
6337
+ children: [
6338
+ colItems.map((item, index) => {
6339
+ const id = getId(item);
6340
+ const isDragged = id === dragId;
6341
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
6342
+ lineAt === index && /* @__PURE__ */ jsx("div", { className: "h-0.5 rounded-full bg-blue-500", "aria-hidden": true }),
6343
+ /* @__PURE__ */ jsx(
6344
+ "div",
6345
+ {
6346
+ draggable: true,
6347
+ onDragStart: (e) => {
6348
+ setDragId(id);
6349
+ try {
6350
+ e.dataTransfer.effectAllowed = "move";
6351
+ } catch {
6352
+ }
6353
+ },
6354
+ onDragEnter: (e) => {
6355
+ e.stopPropagation();
6356
+ setOver(
6357
+ (prev) => prev && prev.col === col.value && prev.index === index ? prev : { col: col.value, index }
6358
+ );
6359
+ },
6360
+ onDragEnd: reset,
6361
+ onClick: onCardClick ? () => onCardClick(item) : void 0,
6362
+ style: dragId === null ? void 0 : { opacity: isDragged ? 0.4 : 1, transition: "opacity 120ms ease" },
6363
+ className: `rounded-lg bg-white border border-gray-200 p-3 shadow-sm hover:border-blue-400 hover:shadow transition ${onCardClick ? "cursor-pointer" : ""}`,
6364
+ children: renderCard(item)
6365
+ }
6366
+ )
6367
+ ] }, id);
6368
+ }),
6369
+ colItems.length > 0 && lineAt === colItems.length && /* @__PURE__ */ jsx("div", { className: "h-0.5 rounded-full bg-blue-500", "aria-hidden": true }),
6370
+ colItems.length === 0 && /* @__PURE__ */ jsx(
6371
+ "div",
6372
+ {
6373
+ className: `text-[11px] text-center rounded-lg transition-all duration-150 ${isOver ? "border-2 border-dashed border-blue-300 bg-blue-50/50 text-blue-400 py-8" : "text-gray-400 py-6"}`,
6374
+ children: columnEmptyText
6375
+ }
6376
+ )
6377
+ ]
6378
+ }
6379
+ )
6380
+ ]
6381
+ },
6382
+ col.value
6383
+ );
6384
+ }) }) });
6385
+ }
6261
6386
  function useInfiniteScroll({
6262
6387
  queryKey,
6263
6388
  fetchFn,
@@ -6374,6 +6499,6 @@ function useEditHotkey(callback) {
6374
6499
  }, [callback, isActive]);
6375
6500
  }
6376
6501
 
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 };
6502
+ 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
6503
  //# sourceMappingURL=index.js.map
6379
6504
  //# sourceMappingURL=index.js.map