react-os-shell 2.0.0 → 2.1.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/README.md +1 -1
- package/dist/Browser-AGOIAPRE.js +7 -0
- package/dist/{Browser-WXHEE7GC.js.map → Browser-AGOIAPRE.js.map} +1 -1
- package/dist/{Calculator-X26IEHCN.js → Calculator-JJZMCBIN.js} +4 -4
- package/dist/{Calculator-X26IEHCN.js.map → Calculator-JJZMCBIN.js.map} +1 -1
- package/dist/{CurrencyConverter-5UHIRF2P.js → CurrencyConverter-VCZGTULI.js} +4 -4
- package/dist/{CurrencyConverter-5UHIRF2P.js.map → CurrencyConverter-VCZGTULI.js.map} +1 -1
- package/dist/{Documents-DRKELHI6.js → Documents-OXJFXHNU.js} +4 -4
- package/dist/{Documents-DRKELHI6.js.map → Documents-OXJFXHNU.js.map} +1 -1
- package/dist/Files-3LLMFTQW.js +13 -0
- package/dist/{Files-TJTUA2LV.js.map → Files-3LLMFTQW.js.map} +1 -1
- package/dist/{Notepad-H6LI3MUZ.js → Notepad-WBQ2PFX2.js} +4 -4
- package/dist/{Notepad-H6LI3MUZ.js.map → Notepad-WBQ2PFX2.js.map} +1 -1
- package/dist/{PomodoroTimer-PG4J5NNI.js → PomodoroTimer-TEZJH7E6.js} +4 -4
- package/dist/{PomodoroTimer-PG4J5NNI.js.map → PomodoroTimer-TEZJH7E6.js.map} +1 -1
- package/dist/Preview-YS4B3LP4.js +9 -0
- package/dist/{Preview-J63FQ336.js.map → Preview-YS4B3LP4.js.map} +1 -1
- package/dist/Spreadsheet-6QZBQKAW.js +7 -0
- package/dist/{Spreadsheet-Q5VPXFJK.js.map → Spreadsheet-6QZBQKAW.js.map} +1 -1
- package/dist/{Stock-TIJVSHPV.js → Stock-QVTMAGIU.js} +4 -4
- package/dist/{Stock-TIJVSHPV.js.map → Stock-QVTMAGIU.js.map} +1 -1
- package/dist/{Weather-WVDLOH74.js → Weather-PXUZW22T.js} +4 -4
- package/dist/{Weather-WVDLOH74.js.map → Weather-PXUZW22T.js.map} +1 -1
- package/dist/{WorldClock-OV4GU5J3.js → WorldClock-CRESQVKE.js} +4 -4
- package/dist/{WorldClock-OV4GU5J3.js.map → WorldClock-CRESQVKE.js.map} +1 -1
- package/dist/apps/index.js +19 -19
- package/dist/{chunk-OMY5HWY2.js → chunk-2KV2YWMA.js} +4 -4
- package/dist/{chunk-OMY5HWY2.js.map → chunk-2KV2YWMA.js.map} +1 -1
- package/dist/{chunk-GWVVILYQ.js → chunk-5FEW4QE5.js} +3 -3
- package/dist/{chunk-GWVVILYQ.js.map → chunk-5FEW4QE5.js.map} +1 -1
- package/dist/{chunk-HMYEAOUF.js → chunk-AAYCPPVK.js} +4 -4
- package/dist/{chunk-HMYEAOUF.js.map → chunk-AAYCPPVK.js.map} +1 -1
- package/dist/{chunk-ISNP6BHR.js → chunk-AYTCQLZ4.js} +3 -3
- package/dist/{chunk-ISNP6BHR.js.map → chunk-AYTCQLZ4.js.map} +1 -1
- package/dist/{chunk-2N4EEBHF.js → chunk-DRX353B4.js} +4 -4
- package/dist/{chunk-2N4EEBHF.js.map → chunk-DRX353B4.js.map} +1 -1
- package/dist/{chunk-DOSYYJSP.js → chunk-GLIN3PDZ.js} +5 -5
- package/dist/{chunk-DOSYYJSP.js.map → chunk-GLIN3PDZ.js.map} +1 -1
- package/dist/{chunk-ROSSX5DN.js → chunk-JBVKJJEM.js} +4 -4
- package/dist/{chunk-ROSSX5DN.js.map → chunk-JBVKJJEM.js.map} +1 -1
- package/dist/{chunk-7FNPV6CE.js → chunk-P4YWAKEC.js} +4 -4
- package/dist/{chunk-7FNPV6CE.js.map → chunk-P4YWAKEC.js.map} +1 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.js +185 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/Browser-WXHEE7GC.js +0 -7
- package/dist/Files-TJTUA2LV.js +0 -13
- package/dist/Preview-J63FQ336.js +0 -9
- package/dist/Spreadsheet-Q5VPXFJK.js +0 -7
package/dist/index.d.ts
CHANGED
|
@@ -497,6 +497,48 @@ interface SidebarLayoutProps {
|
|
|
497
497
|
}
|
|
498
498
|
declare function SidebarLayout({ sidebar, children, side, storageKey, defaultWidth, minWidth, maxWidth, className, sidebarClassName, contentClassName, }: SidebarLayoutProps): react_jsx_runtime.JSX.Element;
|
|
499
499
|
|
|
500
|
+
interface SearchableOption {
|
|
501
|
+
value: string;
|
|
502
|
+
label: string;
|
|
503
|
+
/** Optional secondary text rendered greyed-out on the right of the
|
|
504
|
+
* option (e.g. an order date next to a proforma number). */
|
|
505
|
+
sublabel?: string;
|
|
506
|
+
}
|
|
507
|
+
interface SearchableSelectProps {
|
|
508
|
+
value: string;
|
|
509
|
+
onChange: (value: string) => void;
|
|
510
|
+
options: SearchableOption[];
|
|
511
|
+
/** Placeholder shown when no value is selected and the field is empty. */
|
|
512
|
+
placeholder?: string;
|
|
513
|
+
/** Fallback placeholder text when no `placeholder` is provided and
|
|
514
|
+
* nothing is selected. Clearing the selection is done via the hover
|
|
515
|
+
* "×" on the input itself. */
|
|
516
|
+
emptyOptionLabel?: string;
|
|
517
|
+
/** Extra Tailwind classes appended to the input (error rings, custom
|
|
518
|
+
* widths…). The base form-input styling is built in. */
|
|
519
|
+
className?: string;
|
|
520
|
+
disabled?: boolean;
|
|
521
|
+
/** Optional id for label-for wiring. */
|
|
522
|
+
id?: string;
|
|
523
|
+
/** When true, the user can submit a value that isn't in `options` —
|
|
524
|
+
* pressing Enter or clicking outside with non-empty search text
|
|
525
|
+
* fires `onChange` with the typed string. The trigger then displays
|
|
526
|
+
* that free-text value as-is. Default false: only listed options
|
|
527
|
+
* can be picked, typing only filters. */
|
|
528
|
+
allowFreeText?: boolean;
|
|
529
|
+
/** Optional notifier fired whenever the user-typed search text changes
|
|
530
|
+
* (including resets to ''). Lets a parent debounce the value and feed
|
|
531
|
+
* a server-side query, so this component can still front a list that
|
|
532
|
+
* is too large to load up-front. */
|
|
533
|
+
onSearchChange?: (text: string) => void;
|
|
534
|
+
/** Optional content rendered inside the trigger's right edge — to the
|
|
535
|
+
* left of the clear button — when the dropdown is closed. Use for
|
|
536
|
+
* compact status pills that should read alongside the selected label.
|
|
537
|
+
* Hidden while the user is typing so the search text stays legible. */
|
|
538
|
+
rightAdornment?: ReactNode;
|
|
539
|
+
}
|
|
540
|
+
declare function SearchableSelect({ value, onChange, options, placeholder, emptyOptionLabel, className, disabled, id, allowFreeText, onSearchChange, rightAdornment, }: SearchableSelectProps): react_jsx_runtime.JSX.Element;
|
|
541
|
+
|
|
500
542
|
/**
|
|
501
543
|
* Generic top navigation bar. A horizontal row of tab-style links with an
|
|
502
544
|
* optional brand on the left and free-form actions on the right. Self-contained
|
|
@@ -1532,4 +1574,4 @@ declare function useNewHotkey(callback: () => void): void;
|
|
|
1532
1574
|
*/
|
|
1533
1575
|
declare function useEditHotkey(callback: (() => void) | null): void;
|
|
1534
1576
|
|
|
1535
|
-
export { ALT, ALT_SHIFT_D, ALT_SHIFT_E, ALT_SHIFT_N, BehaviorPanel, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, 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 ClockCalendarConfig, type ColumnDef, ConfirmProvider, CopyButton, Customization, type CustomizationOmitSection, type CustomizationProps, type CustomizationSection, DEV_BANNER_TEXT, Desktop, type DesktopContextMenuItem, 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, SidebarLayout, type SidebarLayoutProps, type SortState, SoundsPanel, StartMenu, StatusBadge, StatusBadgeProvider, type StickyEntityRef, type StickyResolver, SystemPreferences, type SystemPreferencesProps, type SystemPreferencesSection, type TodoProvider, type TodoTask, TopNav, type TopNavItem, type TopNavProps, 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 };
|
|
1577
|
+
export { ALT, ALT_SHIFT_D, ALT_SHIFT_E, ALT_SHIFT_N, BehaviorPanel, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, 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 ClockCalendarConfig, type ColumnDef, ConfirmProvider, CopyButton, Customization, type CustomizationOmitSection, type CustomizationProps, type CustomizationSection, DEV_BANNER_TEXT, Desktop, type DesktopContextMenuItem, 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 SearchableOption, SearchableSelect, type SearchableSelectProps, type SemanticGroup, type ShellAuth, ShellAuthProvider, ShellEntityFetcherProvider, type ShellNotification, type ShellPrefsAdapter, ShellPrefsProvider, ShortcutHelp, SidebarLayout, type SidebarLayoutProps, type SortState, SoundsPanel, StartMenu, StatusBadge, StatusBadgeProvider, type StickyEntityRef, type StickyResolver, SystemPreferences, type SystemPreferencesProps, type SystemPreferencesSection, type TodoProvider, type TodoTask, TopNav, type TopNavItem, type TopNavProps, 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
|
@@ -2,20 +2,20 @@ import { subscribePomo, getPomoSnapshot } from './chunk-5X5LQNOX.js';
|
|
|
2
2
|
export { setShellTodoProvider } from './chunk-5X5LQNOX.js';
|
|
3
3
|
import { useShellPrefs } from './chunk-36VM54SC.js';
|
|
4
4
|
export { ShellPrefsProvider, useLocalStoragePrefs, useShellPrefs } from './chunk-36VM54SC.js';
|
|
5
|
-
import { PREVIEW_OPENED_EVENT, publishDesktopFolders, requestFilesTrashView, FolderGlyph, openPreviewFile, requestFilesDesktopFolderView, FileIconTile, hashGradient } from './chunk-
|
|
6
|
-
export { Breadcrumbs } from './chunk-
|
|
5
|
+
import { PREVIEW_OPENED_EVENT, publishDesktopFolders, requestFilesTrashView, FolderGlyph, openPreviewFile, requestFilesDesktopFolderView, FileIconTile, hashGradient } from './chunk-2KV2YWMA.js';
|
|
6
|
+
export { Breadcrumbs } from './chunk-2KV2YWMA.js';
|
|
7
7
|
import { SidebarLayout } from './chunk-VGTEM5RZ.js';
|
|
8
8
|
export { SidebarLayout } from './chunk-VGTEM5RZ.js';
|
|
9
9
|
import { playNotification, playStartup, soundsEnabled, getSoundConfig, SOUND_PACK_KEYS, SOUND_PACKS, SOUND_TYPES, SOUND_TYPE_LABELS, setSoundForType, previewSound, setAllSounds, playLogout } from './chunk-D7PYW2QS.js';
|
|
10
|
-
import { setPdfPreview } from './chunk-
|
|
10
|
+
import { setPdfPreview } from './chunk-P4YWAKEC.js';
|
|
11
11
|
import './chunk-KUIPWCTJ.js';
|
|
12
12
|
import { toast_default } from './chunk-WIJ45SYD.js';
|
|
13
13
|
export { toast_default as toast } from './chunk-WIJ45SYD.js';
|
|
14
|
-
export { EditableGrid } from './chunk-
|
|
15
|
-
import { APP_VERSION } from './chunk-
|
|
16
|
-
export { VERSION } from './chunk-
|
|
17
|
-
import { useWindowManager, PopupMenu, PopupMenuLabel, PopupMenuDivider, PopupMenuItem, Modal, WINDOW_REGISTRY, isPageEntry, useIsMobile, ModalActions, useModalActive, client_default, LoadingSpinner, setWindowPosition, ThumbCard, activateModal } from './chunk-
|
|
18
|
-
export { CancelButton, CopyButton, DocFavStar, Modal, ModalActions, PopupMenu, PopupMenuDivider, PopupMenuItem, PopupMenuLabel, WindowManagerProvider, WindowTitle, commitExposeHighlight, exitExposeMode, getActiveWindowRoute, getExposeHighlight, getWindowPosition, isEntityEntry, isPageEntry, setExposeHighlight, setShellApiClient, setShellWindowRegistry, setWindowDefaultPosition, setWindowPosition, subscribeExposeHighlight, toggleExposeMode, useModalActive, useWidgetSettings, useWindowManager, useWindowMenuItem, useWindowTitle } from './chunk-
|
|
14
|
+
export { EditableGrid } from './chunk-JBVKJJEM.js';
|
|
15
|
+
import { APP_VERSION } from './chunk-DRX353B4.js';
|
|
16
|
+
export { VERSION } from './chunk-DRX353B4.js';
|
|
17
|
+
import { useWindowManager, PopupMenu, PopupMenuLabel, PopupMenuDivider, PopupMenuItem, Modal, WINDOW_REGISTRY, isPageEntry, useIsMobile, ModalActions, useModalActive, client_default, LoadingSpinner, setWindowPosition, ThumbCard, activateModal } from './chunk-5FEW4QE5.js';
|
|
18
|
+
export { CancelButton, CopyButton, DocFavStar, Modal, ModalActions, PopupMenu, PopupMenuDivider, PopupMenuItem, PopupMenuLabel, WindowManagerProvider, WindowTitle, commitExposeHighlight, exitExposeMode, getActiveWindowRoute, getExposeHighlight, getWindowPosition, isEntityEntry, isPageEntry, setExposeHighlight, setShellApiClient, setShellWindowRegistry, setWindowDefaultPosition, setWindowPosition, subscribeExposeHighlight, toggleExposeMode, useModalActive, useWidgetSettings, useWindowManager, useWindowMenuItem, useWindowTitle } from './chunk-5FEW4QE5.js';
|
|
19
19
|
import { confirm } from './chunk-UBN4IUDE.js';
|
|
20
20
|
export { ConfirmProvider, confirm, confirmDestructive, prompt } from './chunk-UBN4IUDE.js';
|
|
21
21
|
import { useAuth, useShellAuth } from './chunk-ADJ3CERD.js';
|
|
@@ -563,6 +563,182 @@ function HelpCenter({
|
|
|
563
563
|
] }) : /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center px-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: loading ? "Loading\u2026" : "Pick a help article from the left." }) }) })
|
|
564
564
|
] });
|
|
565
565
|
}
|
|
566
|
+
function useClickOutside(ref, onClose) {
|
|
567
|
+
useEffect(() => {
|
|
568
|
+
const handler = (e) => {
|
|
569
|
+
if (ref.current && !ref.current.contains(e.target)) onClose();
|
|
570
|
+
};
|
|
571
|
+
document.addEventListener("mousedown", handler);
|
|
572
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
573
|
+
}, [ref, onClose]);
|
|
574
|
+
}
|
|
575
|
+
function useDropdownAlignment(triggerRef, open, maxWidth) {
|
|
576
|
+
const [alignRight, setAlignRight] = useState(false);
|
|
577
|
+
useLayoutEffect(() => {
|
|
578
|
+
if (!open) return;
|
|
579
|
+
const rect = triggerRef.current?.getBoundingClientRect();
|
|
580
|
+
if (!rect) return;
|
|
581
|
+
setAlignRight(window.innerWidth - rect.left < maxWidth);
|
|
582
|
+
}, [open, maxWidth, triggerRef]);
|
|
583
|
+
return alignRight;
|
|
584
|
+
}
|
|
585
|
+
function ClearButton({ onClear, ariaLabel = "Clear selection" }) {
|
|
586
|
+
return /* @__PURE__ */ jsx(
|
|
587
|
+
"button",
|
|
588
|
+
{
|
|
589
|
+
type: "button",
|
|
590
|
+
"aria-label": ariaLabel,
|
|
591
|
+
onMouseDown: (e) => {
|
|
592
|
+
e.preventDefault();
|
|
593
|
+
e.stopPropagation();
|
|
594
|
+
onClear();
|
|
595
|
+
},
|
|
596
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity text-base leading-none",
|
|
597
|
+
children: "\xD7"
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
var INPUT_BASE = "block w-full rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-800 placeholder:text-gray-400 shadow-sm focus:border-blue-400 focus:outline-none focus:ring-2 focus:ring-blue-400/30";
|
|
602
|
+
function SearchableSelect({
|
|
603
|
+
value,
|
|
604
|
+
onChange,
|
|
605
|
+
options,
|
|
606
|
+
placeholder,
|
|
607
|
+
emptyOptionLabel = "\u2014 None \u2014",
|
|
608
|
+
className = "",
|
|
609
|
+
disabled,
|
|
610
|
+
id,
|
|
611
|
+
allowFreeText = false,
|
|
612
|
+
onSearchChange,
|
|
613
|
+
rightAdornment
|
|
614
|
+
}) {
|
|
615
|
+
const [open, setOpen] = useState(false);
|
|
616
|
+
const [search, setSearchState] = useState("");
|
|
617
|
+
const setSearch = (next) => {
|
|
618
|
+
setSearchState(next);
|
|
619
|
+
onSearchChange?.(next);
|
|
620
|
+
};
|
|
621
|
+
const wrapRef = useRef(null);
|
|
622
|
+
const triggerRef = useRef(null);
|
|
623
|
+
const adornRef = useRef(null);
|
|
624
|
+
const [adornPad, setAdornPad] = useState(null);
|
|
625
|
+
useLayoutEffect(() => {
|
|
626
|
+
if (!rightAdornment || open) {
|
|
627
|
+
setAdornPad(null);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
const w = adornRef.current?.offsetWidth ?? 0;
|
|
631
|
+
setAdornPad(w ? w + (value && !disabled ? 32 : 8) + 6 : null);
|
|
632
|
+
});
|
|
633
|
+
const POPUP_MAX_WIDTH = 448;
|
|
634
|
+
const alignRight = useDropdownAlignment(triggerRef, open, POPUP_MAX_WIDTH);
|
|
635
|
+
const selectedLabel = useMemo(() => {
|
|
636
|
+
const match = options.find((o) => o.value === value);
|
|
637
|
+
if (match) return match.label;
|
|
638
|
+
return allowFreeText ? value : "";
|
|
639
|
+
}, [options, value, allowFreeText]);
|
|
640
|
+
useClickOutside(wrapRef, () => {
|
|
641
|
+
if (allowFreeText && search.trim() && search.trim() !== value) {
|
|
642
|
+
onChange(search.trim());
|
|
643
|
+
}
|
|
644
|
+
setOpen(false);
|
|
645
|
+
setSearch("");
|
|
646
|
+
});
|
|
647
|
+
const dedupedOptions = useMemo(() => {
|
|
648
|
+
const seen = /* @__PURE__ */ new Set();
|
|
649
|
+
const out = [];
|
|
650
|
+
for (const o of options) {
|
|
651
|
+
if (seen.has(o.value)) continue;
|
|
652
|
+
seen.add(o.value);
|
|
653
|
+
out.push(o);
|
|
654
|
+
}
|
|
655
|
+
return out;
|
|
656
|
+
}, [options]);
|
|
657
|
+
const filtered = useMemo(() => {
|
|
658
|
+
const q = search.trim().toLowerCase();
|
|
659
|
+
if (!q) return dedupedOptions;
|
|
660
|
+
return dedupedOptions.filter(
|
|
661
|
+
(o) => o.label.toLowerCase().includes(q) || (o.sublabel?.toLowerCase().includes(q) ?? false)
|
|
662
|
+
);
|
|
663
|
+
}, [dedupedOptions, search]);
|
|
664
|
+
return /* @__PURE__ */ jsxs("div", { ref: wrapRef, className: "relative group", children: [
|
|
665
|
+
/* @__PURE__ */ jsx(
|
|
666
|
+
"input",
|
|
667
|
+
{
|
|
668
|
+
id,
|
|
669
|
+
ref: triggerRef,
|
|
670
|
+
type: "text",
|
|
671
|
+
autoComplete: "off",
|
|
672
|
+
role: "combobox",
|
|
673
|
+
"aria-expanded": open,
|
|
674
|
+
value: open ? search : selectedLabel,
|
|
675
|
+
onChange: (e) => {
|
|
676
|
+
setSearch(e.target.value);
|
|
677
|
+
setOpen(true);
|
|
678
|
+
},
|
|
679
|
+
onFocus: () => {
|
|
680
|
+
if (!disabled) {
|
|
681
|
+
setSearch("");
|
|
682
|
+
setOpen(true);
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
onKeyDown: (e) => {
|
|
686
|
+
if (e.key === "Enter") {
|
|
687
|
+
e.preventDefault();
|
|
688
|
+
if (filtered.length === 1) {
|
|
689
|
+
onChange(filtered[0].value);
|
|
690
|
+
setOpen(false);
|
|
691
|
+
setSearch("");
|
|
692
|
+
} else if (allowFreeText && search.trim()) {
|
|
693
|
+
onChange(search.trim());
|
|
694
|
+
setOpen(false);
|
|
695
|
+
setSearch("");
|
|
696
|
+
triggerRef.current?.blur();
|
|
697
|
+
}
|
|
698
|
+
} else if (e.key === "Escape") {
|
|
699
|
+
setOpen(false);
|
|
700
|
+
setSearch("");
|
|
701
|
+
triggerRef.current?.blur();
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
placeholder: placeholder || (emptyOptionLabel || "Select\u2026"),
|
|
705
|
+
className: `${INPUT_BASE} ${className} ${value ? "pr-8" : ""} ${disabled ? "bg-gray-50 text-gray-400 cursor-not-allowed" : ""} truncate`,
|
|
706
|
+
style: adornPad ? { paddingRight: adornPad } : void 0,
|
|
707
|
+
disabled
|
|
708
|
+
}
|
|
709
|
+
),
|
|
710
|
+
value && !disabled && /* @__PURE__ */ jsx(ClearButton, { onClear: () => {
|
|
711
|
+
onChange("");
|
|
712
|
+
setOpen(false);
|
|
713
|
+
setSearch("");
|
|
714
|
+
} }),
|
|
715
|
+
rightAdornment && !open && /* @__PURE__ */ jsx("div", { ref: adornRef, className: `absolute top-1/2 -translate-y-1/2 ${value && !disabled ? "right-8" : "right-2"} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`, children: rightAdornment }),
|
|
716
|
+
open && /* @__PURE__ */ jsx(
|
|
717
|
+
"div",
|
|
718
|
+
{
|
|
719
|
+
className: `absolute z-[200] mt-1 rounded-2xl overflow-hidden ${alignRight ? "right-0" : "left-0"} min-w-full max-w-[28rem] w-max`,
|
|
720
|
+
style: glassStyle(),
|
|
721
|
+
children: /* @__PURE__ */ jsx("div", { className: "max-h-60 overflow-y-auto", children: filtered.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-3 py-3 text-sm text-gray-400 text-center", children: "No matches" }) : filtered.map((o) => /* @__PURE__ */ jsxs(
|
|
722
|
+
"button",
|
|
723
|
+
{
|
|
724
|
+
type: "button",
|
|
725
|
+
onMouseDown: () => {
|
|
726
|
+
onChange(o.value);
|
|
727
|
+
setOpen(false);
|
|
728
|
+
setSearch("");
|
|
729
|
+
},
|
|
730
|
+
className: `w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 flex items-center justify-between gap-2 whitespace-nowrap ${value === o.value ? "text-blue-600 font-medium bg-blue-50/50" : "text-gray-700"}`,
|
|
731
|
+
children: [
|
|
732
|
+
/* @__PURE__ */ jsx("span", { children: o.label }),
|
|
733
|
+
o.sublabel && /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400 shrink-0", children: o.sublabel })
|
|
734
|
+
]
|
|
735
|
+
},
|
|
736
|
+
o.value
|
|
737
|
+
)) })
|
|
738
|
+
}
|
|
739
|
+
)
|
|
740
|
+
] });
|
|
741
|
+
}
|
|
566
742
|
function TopNav({ items, activeKey, onSelect, brand, actions, className }) {
|
|
567
743
|
return /* @__PURE__ */ jsxs(
|
|
568
744
|
"div",
|
|
@@ -2742,15 +2918,6 @@ function useTheme() {
|
|
|
2742
2918
|
}, [accentColor, customBgColor, customTitleColor, customWindowColor, customButtonColor]);
|
|
2743
2919
|
return { theme: saved, resolved };
|
|
2744
2920
|
}
|
|
2745
|
-
function useClickOutside(ref, onClose) {
|
|
2746
|
-
useEffect(() => {
|
|
2747
|
-
const handler = (e) => {
|
|
2748
|
-
if (ref.current && !ref.current.contains(e.target)) onClose();
|
|
2749
|
-
};
|
|
2750
|
-
document.addEventListener("mousedown", handler);
|
|
2751
|
-
return () => document.removeEventListener("mousedown", handler);
|
|
2752
|
-
}, [ref, onClose]);
|
|
2753
|
-
}
|
|
2754
2921
|
function StartupAnimation({ onComplete, ready = false, productName = "react-os-shell", subtitle }) {
|
|
2755
2922
|
const [phase, setPhase] = useState("logo");
|
|
2756
2923
|
const [minTimePassed, setMinTimePassed] = useState(false);
|
|
@@ -6307,6 +6474,6 @@ function useEditHotkey(callback) {
|
|
|
6307
6474
|
}, [callback, isActive]);
|
|
6308
6475
|
}
|
|
6309
6476
|
|
|
6310
|
-
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, TopNav, WidgetManager, applyDevTitle, createWindowRegistry, formatDate, isDevEnv, isMac, openBugReportDialog, reportBug, useBugReport, useClickOutside, useColumnConfig, useDesktopHost, useEditHotkey, useInfiniteScroll, useNewHotkey, useShellEntityFetcher, useSort, useTableNav };
|
|
6477
|
+
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, SearchableSelect, ShellEntityFetcherProvider, ShortcutHelp, SoundsPanel, StartMenu, StatusBadge, StatusBadgeProvider, SystemPreferences, TopNav, WidgetManager, applyDevTitle, createWindowRegistry, formatDate, isDevEnv, isMac, openBugReportDialog, reportBug, useBugReport, useClickOutside, useColumnConfig, useDesktopHost, useEditHotkey, useInfiniteScroll, useNewHotkey, useShellEntityFetcher, useSort, useTableNav };
|
|
6311
6478
|
//# sourceMappingURL=index.js.map
|
|
6312
6479
|
//# sourceMappingURL=index.js.map
|