@mks2508/mks-ui 0.7.0 → 0.8.1
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/react-ui/blocks/Terminal/TerminalDisplay.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/components/LogLineBadges/LogLineBadges.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge/TerminalLogBadge.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge/TerminalLogBadge.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalActionBar/TerminalActionBar.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalActionBar/TerminalActionBar.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalConnectionStatus/TerminalConnectionStatus.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalConnectionStatus/TerminalConnectionStatus.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalFontControls/TerminalFontControls.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalFontControls/TerminalFontControls.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalSplitButton/TerminalSplitButton.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalSplitButton/TerminalSplitButton.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalStatusBar/TerminalStatusBar.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalStatusBar/TerminalStatusBar.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel/TerminalDebugPanel.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel/TerminalDebugPanel.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown/TerminalFilterDropdown.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown/TerminalFilterDropdown.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs/TerminalFilterTabs.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs/TerminalFilterTabs.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelWterm.d.ts +0 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelWterm.d.ts.map +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelWterm.js +56 -18
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel/TerminalLogsPanel.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel/TerminalLogsPanel.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter/TerminalPanelFooter.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter/TerminalPanelFooter.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader/TerminalPanelHeader.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader/TerminalPanelHeader.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar/TerminalPanelToolbar.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar/TerminalPanelToolbar.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl/TerminalSessionControl.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl/TerminalSessionControl.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs/TerminalSessionTabs.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs/TerminalSessionTabs.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover/TerminalSettingsPopover.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover/TerminalSettingsPopover.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector/TerminalThemeSelector.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector/TerminalThemeSelector.types.d.ts +1 -1
- package/dist/react-ui/components/MorphingPopover/MorphingPopover.types.d.ts +8 -3
- package/dist/react-ui/components/MorphingPopover/MorphingPopover.types.d.ts.map +1 -1
- package/dist/react-ui/index.js +24 -1
- package/dist/react-ui/primitives/AutoHeight/index.d.ts +1 -1
- package/dist/react-ui/primitives/CountingNumber/index.d.ts +1 -1
- package/dist/react-ui/primitives/DotMatrix/DotMatrix.types.d.ts +109 -0
- package/dist/react-ui/primitives/DotMatrix/DotMatrix.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/DotMatrix/dot-matrix-B8DHjPGb.css +364 -0
- package/dist/react-ui/primitives/DotMatrix/dot-matrix.js +0 -0
- package/dist/react-ui/primitives/DotMatrix/index.d.ts +7 -0
- package/dist/react-ui/primitives/DotMatrix/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/DotMatrix/index.js +185 -0
- package/dist/react-ui/primitives/DotMatrix/patterns.d.ts +32 -0
- package/dist/react-ui/primitives/DotMatrix/patterns.d.ts.map +1 -0
- package/dist/react-ui/primitives/DotMatrix/patterns.js +175 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/GooeyMorphingSurface.types.d.ts +100 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/GooeyMorphingSurface.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/GooeyMorphingSurface.types.js +20 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/gooey-morphing-surface-DfdjAg5U.css +112 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/gooey-morphing-surface.js +0 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/index.d.ts +36 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/index.js +141 -0
- package/dist/react-ui/primitives/index.d.ts +2 -0
- package/dist/react-ui/primitives/index.d.ts.map +1 -1
- package/dist/react-ui/primitives/index.js +4 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts +1 -1
- package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts +1 -1
- package/dist/react-ui/ui/Accordion/Accordion.styles.d.ts +1 -1
- package/dist/react-ui/ui/Accordion/Accordion.types.d.ts +1 -1
- package/dist/react-ui/ui/AlertDialog/AlertDialog.styles.d.ts +1 -1
- package/dist/react-ui/ui/AlertDialog/AlertDialog.types.d.ts +1 -1
- package/dist/react-ui/ui/Badge/Badge.styles.d.ts +2 -2
- package/dist/react-ui/ui/Badge/Badge.types.d.ts +1 -1
- package/dist/react-ui/ui/Button/Button.styles.d.ts +2 -2
- package/dist/react-ui/ui/Button/Button.types.d.ts +1 -1
- package/dist/react-ui/ui/Card/Card.styles.d.ts +1 -1
- package/dist/react-ui/ui/Card/Card.types.d.ts +1 -1
- package/dist/react-ui/ui/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/react-ui/ui/Checkbox/Checkbox.types.d.ts +1 -1
- package/dist/react-ui/ui/Combobox/Combobox.styles.d.ts +1 -1
- package/dist/react-ui/ui/Combobox/Combobox.types.d.ts +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.d.ts +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.types.d.ts +1 -1
- package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts +2 -2
- package/dist/react-ui/ui/DataCard/DataCard.types.d.ts +1 -1
- package/dist/react-ui/ui/DataCard/index.d.ts +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.styles.d.ts +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.types.d.ts +1 -1
- package/dist/react-ui/ui/DropdownMenu/DropdownMenu.styles.d.ts +1 -1
- package/dist/react-ui/ui/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +1 -1
- package/dist/react-ui/ui/Field/Field.styles.d.ts +1 -1
- package/dist/react-ui/ui/Field/Field.types.d.ts +1 -1
- package/dist/react-ui/ui/FileIcon/FileIcon.styles.d.ts +25 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.styles.js +31 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.types.d.ts +89 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FileIcon/index.d.ts +46 -0
- package/dist/react-ui/ui/FileIcon/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FileIcon/index.js +138 -0
- package/dist/react-ui/ui/FileItem/FileItem.styles.d.ts +47 -0
- package/dist/react-ui/ui/FileItem/FileItem.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FileItem/FileItem.styles.js +60 -0
- package/dist/react-ui/ui/FileItem/FileItem.types.d.ts +84 -0
- package/dist/react-ui/ui/FileItem/FileItem.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FileItem/index.d.ts +48 -0
- package/dist/react-ui/ui/FileItem/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FileItem/index.js +124 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.styles.d.ts +34 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.styles.js +57 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.types.d.ts +55 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FilePanel/index.d.ts +55 -0
- package/dist/react-ui/ui/FilePanel/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FilePanel/index.js +107 -0
- package/dist/react-ui/ui/FileTree/FileTree.styles.d.ts +31 -0
- package/dist/react-ui/ui/FileTree/FileTree.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FileTree/FileTree.styles.js +45 -0
- package/dist/react-ui/ui/FileTree/FileTree.types.d.ts +95 -0
- package/dist/react-ui/ui/FileTree/FileTree.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FileTree/index.d.ts +60 -0
- package/dist/react-ui/ui/FileTree/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FileTree/index.js +226 -0
- package/dist/react-ui/ui/GooeyButton/GooeyButton.types.d.ts +35 -0
- package/dist/react-ui/ui/GooeyButton/GooeyButton.types.d.ts.map +1 -0
- package/dist/react-ui/ui/GooeyButton/gooey-button-8rHWiw0w.css +47 -0
- package/dist/react-ui/ui/GooeyButton/gooey-button.js +0 -0
- package/dist/react-ui/ui/GooeyButton/index.d.ts +26 -0
- package/dist/react-ui/ui/GooeyButton/index.d.ts.map +1 -0
- package/dist/react-ui/ui/GooeyButton/index.js +118 -0
- package/dist/react-ui/ui/Input/Input.styles.d.ts +1 -1
- package/dist/react-ui/ui/Input/Input.types.d.ts +1 -1
- package/dist/react-ui/ui/InputGroup/InputGroup.styles.d.ts +1 -1
- package/dist/react-ui/ui/InputGroup/InputGroup.types.d.ts +1 -1
- package/dist/react-ui/ui/Label/Label.styles.d.ts +1 -1
- package/dist/react-ui/ui/Label/Label.types.d.ts +1 -1
- package/dist/react-ui/ui/Menu/Menu.styles.d.ts +1 -1
- package/dist/react-ui/ui/Menu/Menu.types.d.ts +2 -2
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.d.ts +23 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.js +32 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.types.d.ts +43 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.types.d.ts.map +1 -0
- package/dist/react-ui/ui/MiddleTruncatePath/index.d.ts +33 -0
- package/dist/react-ui/ui/MiddleTruncatePath/index.d.ts.map +1 -0
- package/dist/react-ui/ui/MiddleTruncatePath/index.js +60 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.context.d.ts +17 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.context.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.context.js +27 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.styles.d.ts +19 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.styles.js +39 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.types.d.ts +188 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.types.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/index.d.ts +45 -0
- package/dist/react-ui/ui/OperationCard/index.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/index.js +118 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardActions.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardActions.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardActions.js +86 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardHeader.d.ts +14 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardHeader.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardHeader.js +62 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardProgress.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardProgress.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardProgress.js +37 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardStats.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardStats.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardStats.js +42 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardVisualizer.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardVisualizer.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardVisualizer.js +53 -0
- package/dist/react-ui/ui/Popover/Popover.styles.d.ts +1 -1
- package/dist/react-ui/ui/Popover/Popover.types.d.ts +1 -1
- package/dist/react-ui/ui/Progress/Progress.styles.d.ts +1 -1
- package/dist/react-ui/ui/Progress/Progress.types.d.ts +2 -2
- package/dist/react-ui/ui/Select/Select.styles.d.ts +1 -1
- package/dist/react-ui/ui/Select/Select.types.d.ts +1 -1
- package/dist/react-ui/ui/Separator/Separator.styles.d.ts +1 -1
- package/dist/react-ui/ui/Separator/Separator.types.d.ts +1 -1
- package/dist/react-ui/ui/Switch/Switch.styles.d.ts +1 -1
- package/dist/react-ui/ui/Switch/Switch.types.d.ts +1 -1
- package/dist/react-ui/ui/Tabs/Tabs.styles.d.ts +4 -4
- package/dist/react-ui/ui/Tabs/Tabs.types.d.ts +3 -3
- package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts +1 -1
- package/dist/react-ui/ui/Textarea/Textarea.styles.d.ts +1 -1
- package/dist/react-ui/ui/Textarea/Textarea.types.d.ts +1 -1
- package/dist/react-ui/ui/Tooltip/Tooltip.styles.d.ts +1 -1
- package/dist/react-ui/ui/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/react-ui/ui/index.d.ts +7 -0
- package/dist/react-ui/ui/index.d.ts.map +1 -1
- package/dist/react-ui/ui/index.js +19 -0
- package/package.json +2 -2
- package/dist/index.css +0 -1059
- package/dist/react-ui/blocks/Sidebar/animations/tooltip.css +0 -330
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown/terminal-filter-dropdown.module.css +0 -60
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs/terminal-session-tabs.module.css +0 -60
- package/dist/react-ui/components/MorphingPopover/morphing-popover.module.css +0 -154
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.module.css +0 -20
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +0 -369
- package/dist/react-ui/ui/Tabs/Tabs.css +0 -38
- /package/dist/{css/blocks-Sidebar-animations-tooltip.css → react-ui/blocks/Sidebar/animations/tooltip-keyframes-DRT9W6Xj.css} +0 -0
- /package/dist/{css/blocks-Terminal-panel-TerminalFilterDropdown-terminal-filter-dropdown.module.css → react-ui/blocks/Terminal/panel/TerminalFilterDropdown/terminal-filter-dropdown.module-G5zpw08N.css} +0 -0
- /package/dist/{css/blocks-Terminal-panel-TerminalSessionTabs-terminal-session-tabs.module.css → react-ui/blocks/Terminal/panel/TerminalSessionTabs/terminal-session-tabs.module-BAOuAeiX.css} +0 -0
- /package/dist/{css/components-MorphingPopover-morphing-popover.module.css → react-ui/components/MorphingPopover/morphing-popover.module-T3s-wJN-.css} +0 -0
- /package/dist/{css/primitives-waapi-Morph-techniques-useViewTransitions.module.css → react-ui/primitives/waapi/Morph/techniques/useViewTransitions.module-DNDWYN8q.css} +0 -0
- /package/dist/{css/ui-DynamicToggle-DynamicToggle.css → react-ui/ui/DynamicToggle/DynamicToggle-DY2Hle7P.css} +0 -0
- /package/dist/{css/ui-Tabs-Tabs.css → react-ui/ui/Tabs/Tabs-DqzZRGB3.css} +0 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { FileItem } from "../FileItem/index.js";
|
|
5
|
+
import { FileTreeStyles, fileTreeVariants } from "./FileTree.styles.js";
|
|
6
|
+
import { memo, useCallback, useMemo, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/react-ui/ui/FileTree/index.tsx
|
|
10
|
+
/**
|
|
11
|
+
* FileTree — collapsible tree renderer over `FileItem` rows.
|
|
12
|
+
*
|
|
13
|
+
* Lightweight tree over the `FileItem` primitive. Directories render a
|
|
14
|
+
* chevron that toggles expansion; files act as leaves. Supports either
|
|
15
|
+
* uncontrolled expansion (internal state) or controlled via `expandedIds`
|
|
16
|
+
* + `onToggle` (useful for lazy-loading children).
|
|
17
|
+
*
|
|
18
|
+
* Keyboard: rows are reachable via Tab (inherited from `FileItem`). Enter/
|
|
19
|
+
* Space on a file fires `onSelect`; Enter/Space on a dir toggles expansion.
|
|
20
|
+
* ArrowRight expands a dir, ArrowLeft collapses it.
|
|
21
|
+
*
|
|
22
|
+
* @module @mks2508/mks-ui/react/ui/FileTree
|
|
23
|
+
*/
|
|
24
|
+
/** Default pixel width per indent level. */
|
|
25
|
+
const DEFAULT_INDENT_PX = 12;
|
|
26
|
+
/** Normalise the `expandedIds` prop into a stable `Set<string>`. */
|
|
27
|
+
function toSet(ids) {
|
|
28
|
+
if (!ids) return null;
|
|
29
|
+
if (ids instanceof Set) return new Set(ids);
|
|
30
|
+
return new Set(ids);
|
|
31
|
+
}
|
|
32
|
+
/** Single row (FileItem + chevron + indent) with recursive children rendering. */
|
|
33
|
+
const NodeRow = memo(function NodeRow({ node, depth, expanded, selectedId, indentPx, density, iconBasePath, iconResolve, slots, onToggle, onSelect }) {
|
|
34
|
+
const isDir = node.kind === "dir";
|
|
35
|
+
const isExpanded = isDir && expanded.has(node.id);
|
|
36
|
+
const isSelected = selectedId === node.id;
|
|
37
|
+
const handleRowSelect = useCallback(() => {
|
|
38
|
+
if (isDir) onToggle(node, !isExpanded);
|
|
39
|
+
else onSelect(node);
|
|
40
|
+
}, [
|
|
41
|
+
isDir,
|
|
42
|
+
isExpanded,
|
|
43
|
+
node,
|
|
44
|
+
onSelect,
|
|
45
|
+
onToggle
|
|
46
|
+
]);
|
|
47
|
+
const handleChevronClick = useCallback((e) => {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
onToggle(node, !isExpanded);
|
|
50
|
+
}, [
|
|
51
|
+
isExpanded,
|
|
52
|
+
node,
|
|
53
|
+
onToggle
|
|
54
|
+
]);
|
|
55
|
+
const handleKeyDown = useCallback((e) => {
|
|
56
|
+
if (!isDir) return;
|
|
57
|
+
if (e.key === "ArrowRight" && !isExpanded) {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
onToggle(node, true);
|
|
60
|
+
} else if (e.key === "ArrowLeft" && isExpanded) {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
onToggle(node, false);
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
isDir,
|
|
66
|
+
isExpanded,
|
|
67
|
+
node,
|
|
68
|
+
onToggle
|
|
69
|
+
]);
|
|
70
|
+
const children = isExpanded ? node.children ?? [] : [];
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: cn(FileTreeStyles.node, slots?.node),
|
|
73
|
+
role: "none",
|
|
74
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
75
|
+
className: cn(FileTreeStyles.row, slots?.row),
|
|
76
|
+
onKeyDown: handleKeyDown,
|
|
77
|
+
children: [
|
|
78
|
+
depth > 0 && /* @__PURE__ */ jsx("span", {
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
className: cn(FileTreeStyles.indent, slots?.indent),
|
|
81
|
+
style: { width: depth * indentPx }
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx("button", {
|
|
84
|
+
type: "button",
|
|
85
|
+
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
86
|
+
"aria-expanded": isDir ? isExpanded : void 0,
|
|
87
|
+
tabIndex: -1,
|
|
88
|
+
onClick: handleChevronClick,
|
|
89
|
+
className: cn(FileTreeStyles.chevron, !isDir && "invisible", isExpanded && "rotate-90", slots?.chevron),
|
|
90
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
91
|
+
viewBox: "0 0 12 12",
|
|
92
|
+
width: "10",
|
|
93
|
+
height: "10",
|
|
94
|
+
fill: "none",
|
|
95
|
+
stroke: "currentColor",
|
|
96
|
+
strokeWidth: "1.5",
|
|
97
|
+
strokeLinecap: "round",
|
|
98
|
+
strokeLinejoin: "round",
|
|
99
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4.5 3 L8 6 L4.5 9" })
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ jsx("div", {
|
|
103
|
+
className: "flex-1 min-w-0",
|
|
104
|
+
children: /* @__PURE__ */ jsx(FileItem, {
|
|
105
|
+
path: node.path,
|
|
106
|
+
kind: node.kind,
|
|
107
|
+
modifiedAt: node.modifiedAt,
|
|
108
|
+
isBoosted: node.isBoosted,
|
|
109
|
+
changeStatus: node.changeStatus,
|
|
110
|
+
selected: isSelected,
|
|
111
|
+
onSelect: handleRowSelect,
|
|
112
|
+
density,
|
|
113
|
+
iconBasePath,
|
|
114
|
+
iconResolve
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
}), isExpanded && children.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
119
|
+
role: "group",
|
|
120
|
+
className: cn(FileTreeStyles.list, slots?.list),
|
|
121
|
+
children: children.map((child) => /* @__PURE__ */ jsx(NodeRow, {
|
|
122
|
+
node: child,
|
|
123
|
+
depth: depth + 1,
|
|
124
|
+
expanded,
|
|
125
|
+
selectedId,
|
|
126
|
+
indentPx,
|
|
127
|
+
density,
|
|
128
|
+
iconBasePath,
|
|
129
|
+
iconResolve,
|
|
130
|
+
slots,
|
|
131
|
+
onToggle,
|
|
132
|
+
onSelect
|
|
133
|
+
}, child.id))
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
/**
|
|
138
|
+
* FileTree — tree of `FileItem` rows with expand/collapse.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* <FileTree
|
|
143
|
+
* nodes={[
|
|
144
|
+
* {
|
|
145
|
+
* id: 'src',
|
|
146
|
+
* name: 'src',
|
|
147
|
+
* path: 'src',
|
|
148
|
+
* kind: 'dir',
|
|
149
|
+
* children: [
|
|
150
|
+
* { id: 'src/App.tsx', name: 'App.tsx', path: 'src/App.tsx', kind: 'file' },
|
|
151
|
+
* ],
|
|
152
|
+
* },
|
|
153
|
+
* ]}
|
|
154
|
+
* onSelect={(n) => console.log('selected', n.path)}
|
|
155
|
+
* onToggle={(n, exp) => console.log('toggled', n.path, exp)}
|
|
156
|
+
* />
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```tsx
|
|
161
|
+
* // Controlled expansion for lazy loading
|
|
162
|
+
* const [expanded, setExpanded] = useState<Set<string>>(new Set());
|
|
163
|
+
* <FileTree
|
|
164
|
+
* nodes={nodes}
|
|
165
|
+
* expandedIds={expanded}
|
|
166
|
+
* onToggle={(n, exp) => {
|
|
167
|
+
* setExpanded((prev) => {
|
|
168
|
+
* const next = new Set(prev);
|
|
169
|
+
* if (exp) next.add(n.id); else next.delete(n.id);
|
|
170
|
+
* return next;
|
|
171
|
+
* });
|
|
172
|
+
* if (exp && !n.children) loadChildren(n);
|
|
173
|
+
* }}
|
|
174
|
+
* />
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
const FileTree = memo(function FileTree({ nodes, onSelect, onToggle, expandedIds, selectedId, density = "compact", iconBasePath, iconResolve, indentPx = DEFAULT_INDENT_PX, emptyLabel = "No files", className, slots }) {
|
|
178
|
+
const controlled = expandedIds !== void 0;
|
|
179
|
+
const controlledSet = useMemo(() => toSet(expandedIds), [expandedIds]);
|
|
180
|
+
const [internal, setInternal] = useState(() => /* @__PURE__ */ new Set());
|
|
181
|
+
const expanded = controlled ? controlledSet : internal;
|
|
182
|
+
const handleToggle = useCallback((node, next) => {
|
|
183
|
+
if (!controlled) setInternal((prev) => {
|
|
184
|
+
const nextSet = new Set(prev);
|
|
185
|
+
if (next) nextSet.add(node.id);
|
|
186
|
+
else nextSet.delete(node.id);
|
|
187
|
+
return nextSet;
|
|
188
|
+
});
|
|
189
|
+
onToggle?.(node, next);
|
|
190
|
+
}, [controlled, onToggle]);
|
|
191
|
+
const handleSelect = useCallback((node) => {
|
|
192
|
+
onSelect?.(node);
|
|
193
|
+
}, [onSelect]);
|
|
194
|
+
if (!nodes || nodes.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
195
|
+
role: "tree",
|
|
196
|
+
className: cn(fileTreeVariants({ density }), slots?.root, className),
|
|
197
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
198
|
+
className: cn(FileTreeStyles.empty, slots?.empty),
|
|
199
|
+
children: emptyLabel
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
return /* @__PURE__ */ jsx("div", {
|
|
203
|
+
role: "tree",
|
|
204
|
+
className: cn(fileTreeVariants({ density }), slots?.root, className),
|
|
205
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
206
|
+
role: "group",
|
|
207
|
+
className: cn(FileTreeStyles.list, slots?.list),
|
|
208
|
+
children: nodes.map((node) => /* @__PURE__ */ jsx(NodeRow, {
|
|
209
|
+
node,
|
|
210
|
+
depth: 0,
|
|
211
|
+
expanded,
|
|
212
|
+
selectedId,
|
|
213
|
+
indentPx,
|
|
214
|
+
density,
|
|
215
|
+
iconBasePath,
|
|
216
|
+
iconResolve,
|
|
217
|
+
slots,
|
|
218
|
+
onToggle: handleToggle,
|
|
219
|
+
onSelect: handleSelect
|
|
220
|
+
}, node.id))
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
export { FileTree };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the GooeyButton component — a clickable pill that reveals a
|
|
3
|
+
* card via a gooey SVG-filter morph.
|
|
4
|
+
*
|
|
5
|
+
* @module @mks2508/mks-ui/react/ui/GooeyButton
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
import type { IGooeyMorphConfig, IGooeyMorphSlots } from '@/react-ui/primitives/GooeyMorphingSurface';
|
|
9
|
+
export interface IGooeyButtonProps {
|
|
10
|
+
/** Controlled open state. */
|
|
11
|
+
open?: boolean;
|
|
12
|
+
/** Default open state for uncontrolled usage. */
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
/** Change callback for the open state. */
|
|
15
|
+
onOpenChange?: (open: boolean) => void;
|
|
16
|
+
/** Content rendered inside the pill. */
|
|
17
|
+
pill: ReactNode;
|
|
18
|
+
/** Content rendered inside the card body (revealed when open). */
|
|
19
|
+
card: ReactNode;
|
|
20
|
+
/** Partial override of the morph config. */
|
|
21
|
+
config?: Partial<IGooeyMorphConfig>;
|
|
22
|
+
/** Close when Escape is pressed. Default: true. */
|
|
23
|
+
closeOnEscape?: boolean;
|
|
24
|
+
/** Close when clicking outside the host element. Default: true. */
|
|
25
|
+
closeOnOutside?: boolean;
|
|
26
|
+
/** Disable the trigger. */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Extra className for the host. */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Per-slot className overrides (forwarded to primitive). */
|
|
31
|
+
slots?: IGooeyMorphSlots;
|
|
32
|
+
/** aria-label for the trigger button (defaults to "Toggle"). */
|
|
33
|
+
'aria-label'?: string;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=GooeyButton.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GooeyButton.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/GooeyButton/GooeyButton.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IACjC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,wCAAwC;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,kEAAkE;IAClE,IAAI,EAAE,SAAS,CAAC;IAChB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,mDAAmD;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mEAAmE;IACnE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* =============================================================================
|
|
2
|
+
* GooeyButton — transparent hit area over the pill region.
|
|
3
|
+
*
|
|
4
|
+
* The visual pill is drawn by the <GooeyMorphingSurface> primitive; this
|
|
5
|
+
* layer is a single button that captures clicks in both open and closed
|
|
6
|
+
* states without painting anything. All layout math comes from the
|
|
7
|
+
* primitive's CSS custom props (--gms-pill-w, --gms-pill-h).
|
|
8
|
+
* ============================================================================= */
|
|
9
|
+
|
|
10
|
+
.gbtn-host {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.gbtn-trigger {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 0;
|
|
18
|
+
/* Follow the pill's computed X (which honours `pillOffsetX`) instead of
|
|
19
|
+
* centring the hit-area in the host. Centring worked only while
|
|
20
|
+
* `pillOffsetX === 0`; any non-zero offset drifted the visual pill away
|
|
21
|
+
* from the invisible trigger. See `GooeyButton/index.tsx` — the host
|
|
22
|
+
* exposes `--gms-pill-x` identical to the primitive's internal value. */
|
|
23
|
+
left: var(--gms-pill-x);
|
|
24
|
+
z-index: 3;
|
|
25
|
+
width: var(--gms-pill-w);
|
|
26
|
+
height: var(--gms-pill-h);
|
|
27
|
+
padding: 0;
|
|
28
|
+
margin: 0;
|
|
29
|
+
border: 0;
|
|
30
|
+
background: transparent;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
font: inherit;
|
|
33
|
+
color: inherit;
|
|
34
|
+
/* Pill-shaped focus ring. */
|
|
35
|
+
border-radius: 9999px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.gbtn-trigger:focus-visible {
|
|
39
|
+
outline: 2px solid var(--ring, currentColor);
|
|
40
|
+
outline-offset: 2px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.gbtn-trigger:disabled {
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GooeyButton — clickable pill that reveals a card via a gooey SVG-filter morph.
|
|
3
|
+
*
|
|
4
|
+
* Thin ergonomic wrapper over `<GooeyMorphingSurface>`: owns open/close
|
|
5
|
+
* state (controlled or uncontrolled), toggles on click, and optionally
|
|
6
|
+
* closes on Escape / outside click.
|
|
7
|
+
*
|
|
8
|
+
* @module @mks2508/mks-ui/react/ui/GooeyButton
|
|
9
|
+
*/
|
|
10
|
+
import './gooey-button.css';
|
|
11
|
+
import type { IGooeyButtonProps } from './GooeyButton.types';
|
|
12
|
+
export * from './GooeyButton.types';
|
|
13
|
+
/**
|
|
14
|
+
* A pill-shaped button that morphs into a card when opened.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <GooeyButton
|
|
19
|
+
* pill={<><DownIcon /> <span>Pull origin</span></>}
|
|
20
|
+
* card={<ProgressCard transfer={transfer} />}
|
|
21
|
+
* onOpenChange={(open) => open && startPull()}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function GooeyButton({ open: controlledOpen, defaultOpen, onOpenChange, pill, card, config, closeOnEscape, closeOnOutside, disabled, className, slots, 'aria-label': ariaLabel, }: IGooeyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/GooeyButton/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,cAAc,qBAAqB,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EAAE,cAAc,EACpB,WAAmB,EACnB,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,aAAoB,EACpB,cAAqB,EACrB,QAAgB,EAChB,SAAS,EACT,KAAK,EACL,YAAY,EAAE,SAAoB,GAClC,EAAE,iBAAiB,2CAyFnB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { DEFAULT_GOOEY_CONFIG } from "../../primitives/GooeyMorphingSurface/GooeyMorphingSurface.types.js";
|
|
3
|
+
import { GooeyMorphingSurface } from "../../primitives/GooeyMorphingSurface/index.js";
|
|
4
|
+
import { useControlledState } from "../../hooks/State/UseControlledState.js";
|
|
5
|
+
import "./gooey-button.js";
|
|
6
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/react-ui/ui/GooeyButton/index.tsx
|
|
10
|
+
/**
|
|
11
|
+
* GooeyButton — clickable pill that reveals a card via a gooey SVG-filter morph.
|
|
12
|
+
*
|
|
13
|
+
* Thin ergonomic wrapper over `<GooeyMorphingSurface>`: owns open/close
|
|
14
|
+
* state (controlled or uncontrolled), toggles on click, and optionally
|
|
15
|
+
* closes on Escape / outside click.
|
|
16
|
+
*
|
|
17
|
+
* @module @mks2508/mks-ui/react/ui/GooeyButton
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* A pill-shaped button that morphs into a card when opened.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <GooeyButton
|
|
25
|
+
* pill={<><DownIcon /> <span>Pull origin</span></>}
|
|
26
|
+
* card={<ProgressCard transfer={transfer} />}
|
|
27
|
+
* onOpenChange={(open) => open && startPull()}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function GooeyButton({ open: controlledOpen, defaultOpen = false, onOpenChange, pill, card, config, closeOnEscape = true, closeOnOutside = true, disabled = false, className, slots, "aria-label": ariaLabel = "Toggle" }) {
|
|
32
|
+
const [open, setOpen] = useControlledState({
|
|
33
|
+
value: controlledOpen,
|
|
34
|
+
defaultValue: defaultOpen,
|
|
35
|
+
onChange: onOpenChange
|
|
36
|
+
});
|
|
37
|
+
const hostRef = useRef(null);
|
|
38
|
+
const hostStyle = useMemo(() => {
|
|
39
|
+
const pillWidth = config?.pillWidth ?? DEFAULT_GOOEY_CONFIG.pillWidth;
|
|
40
|
+
const pillHeight = config?.pillHeight ?? DEFAULT_GOOEY_CONFIG.pillHeight;
|
|
41
|
+
const cardWidth = config?.cardWidth ?? DEFAULT_GOOEY_CONFIG.cardWidth;
|
|
42
|
+
const pillOffsetX = config?.pillOffsetX ?? DEFAULT_GOOEY_CONFIG.pillOffsetX;
|
|
43
|
+
const pillX = (cardWidth - pillWidth) / 2 + pillOffsetX;
|
|
44
|
+
return {
|
|
45
|
+
"--gms-pill-w": `${pillWidth}px`,
|
|
46
|
+
"--gms-pill-h": `${pillHeight}px`,
|
|
47
|
+
"--gms-pill-x": `${pillX}px`
|
|
48
|
+
};
|
|
49
|
+
}, [
|
|
50
|
+
config?.pillWidth,
|
|
51
|
+
config?.pillHeight,
|
|
52
|
+
config?.cardWidth,
|
|
53
|
+
config?.pillOffsetX
|
|
54
|
+
]);
|
|
55
|
+
const toggle = useCallback(() => {
|
|
56
|
+
if (disabled) return;
|
|
57
|
+
setOpen(!open);
|
|
58
|
+
}, [
|
|
59
|
+
disabled,
|
|
60
|
+
open,
|
|
61
|
+
setOpen
|
|
62
|
+
]);
|
|
63
|
+
const close = useCallback(() => setOpen(false), [setOpen]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!open || !closeOnEscape) return;
|
|
66
|
+
const onKeyDown = (e) => {
|
|
67
|
+
if (e.key === "Escape") close();
|
|
68
|
+
};
|
|
69
|
+
window.addEventListener("keydown", onKeyDown);
|
|
70
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
71
|
+
}, [
|
|
72
|
+
open,
|
|
73
|
+
closeOnEscape,
|
|
74
|
+
close
|
|
75
|
+
]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!open || !closeOnOutside) return;
|
|
78
|
+
const onPointerDown = (e) => {
|
|
79
|
+
const host = hostRef.current;
|
|
80
|
+
if (!host) return;
|
|
81
|
+
if (e.target instanceof Node && host.contains(e.target)) return;
|
|
82
|
+
close();
|
|
83
|
+
};
|
|
84
|
+
const raf = requestAnimationFrame(() => {
|
|
85
|
+
window.addEventListener("pointerdown", onPointerDown);
|
|
86
|
+
});
|
|
87
|
+
return () => {
|
|
88
|
+
cancelAnimationFrame(raf);
|
|
89
|
+
window.removeEventListener("pointerdown", onPointerDown);
|
|
90
|
+
};
|
|
91
|
+
}, [
|
|
92
|
+
open,
|
|
93
|
+
closeOnOutside,
|
|
94
|
+
close
|
|
95
|
+
]);
|
|
96
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
97
|
+
ref: hostRef,
|
|
98
|
+
className: cn("gbtn-host", className),
|
|
99
|
+
style: hostStyle,
|
|
100
|
+
children: [/* @__PURE__ */ jsx(GooeyMorphingSurface, {
|
|
101
|
+
open,
|
|
102
|
+
pill,
|
|
103
|
+
card,
|
|
104
|
+
config,
|
|
105
|
+
slots
|
|
106
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
107
|
+
type: "button",
|
|
108
|
+
onClick: toggle,
|
|
109
|
+
disabled,
|
|
110
|
+
"aria-expanded": open,
|
|
111
|
+
"aria-label": ariaLabel,
|
|
112
|
+
className: "gbtn-trigger"
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { GooeyButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StyleSlots } from '
|
|
1
|
+
import type { StyleSlots } from '@/core/types';
|
|
2
2
|
/** Visual regions for the InputGroup component family. */
|
|
3
3
|
type InputGroupSlot = 'root' | 'addon' | 'button' | 'text' | 'input' | 'textarea';
|
|
4
4
|
declare const inputGroupStyles: StyleSlots<InputGroupSlot>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import type { SlotOverrides } from '
|
|
2
|
+
import type { SlotOverrides } from '@/core/types';
|
|
3
3
|
import type { inputGroupAddonVariants, inputGroupButtonVariants, InputGroupSlot } from './InputGroup.styles';
|
|
4
4
|
/** Props for the InputGroup container. */
|
|
5
5
|
interface IInputGroupProps extends React.ComponentProps<'div'> {
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
import type * as React from 'react';
|
|
11
11
|
import type { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
12
12
|
import type { HTMLMotionProps, Transition } from 'motion/react';
|
|
13
|
-
import type { IBaseConfig, SlotOverrides } from '
|
|
14
|
-
import type { IHighlightProps, IHighlightItemProps } from '
|
|
13
|
+
import type { IBaseConfig, SlotOverrides } from '@/core/types';
|
|
14
|
+
import type { IHighlightProps, IHighlightItemProps } from '@/react-ui/primitives/Highlight';
|
|
15
15
|
import type { MenuSlot } from './Menu.styles';
|
|
16
16
|
/**
|
|
17
17
|
* Configuration interface for Menu behavior and animation.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for MiddleTruncatePath.
|
|
3
|
+
*
|
|
4
|
+
* @module @mks2508/mks-ui/react/ui/MiddleTruncatePath
|
|
5
|
+
*/
|
|
6
|
+
import type { StyleSlots } from '@/core/types';
|
|
7
|
+
/** Visual regions of the MiddleTruncatePath component. */
|
|
8
|
+
export type MiddleTruncatePathSlot = 'root' | 'start' | 'end';
|
|
9
|
+
/**
|
|
10
|
+
* Default Tailwind classes for each MiddleTruncatePath slot.
|
|
11
|
+
*
|
|
12
|
+
* | Slot | Region |
|
|
13
|
+
* |------|--------|
|
|
14
|
+
* | `root` | Container `<span>` wrapping start + end segments |
|
|
15
|
+
* | `start` | Truncatable start segments (ellipsised when narrow) |
|
|
16
|
+
* | `end` | Fixed trailing segments (always visible) |
|
|
17
|
+
*/
|
|
18
|
+
export declare const MiddleTruncatePathStyles: StyleSlots<MiddleTruncatePathSlot>;
|
|
19
|
+
/** CVA variants for the MiddleTruncatePath root. */
|
|
20
|
+
export declare const middleTruncatePathVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
|
+
/** Tailwind classes used when the path is short enough to skip splitting. */
|
|
22
|
+
export declare const MiddleTruncatePathShortRootStyles: "truncate";
|
|
23
|
+
//# sourceMappingURL=MiddleTruncatePath.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MiddleTruncatePath.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,0DAA0D;AAC1D,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE9D;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,EAAE,UAAU,CAAC,sBAAsB,CAI9D,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,0BAA0B,2FAGrC,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,iCAAiC,EAAG,UAAmB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
//#region src/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.ts
|
|
4
|
+
/**
|
|
5
|
+
* Styles for MiddleTruncatePath.
|
|
6
|
+
*
|
|
7
|
+
* @module @mks2508/mks-ui/react/ui/MiddleTruncatePath
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default Tailwind classes for each MiddleTruncatePath slot.
|
|
11
|
+
*
|
|
12
|
+
* | Slot | Region |
|
|
13
|
+
* |------|--------|
|
|
14
|
+
* | `root` | Container `<span>` wrapping start + end segments |
|
|
15
|
+
* | `start` | Truncatable start segments (ellipsised when narrow) |
|
|
16
|
+
* | `end` | Fixed trailing segments (always visible) |
|
|
17
|
+
*/
|
|
18
|
+
const MiddleTruncatePathStyles = {
|
|
19
|
+
root: "flex min-w-0 overflow-hidden",
|
|
20
|
+
start: "shrink min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
21
|
+
end: "shrink-0 whitespace-nowrap"
|
|
22
|
+
};
|
|
23
|
+
/** CVA variants for the MiddleTruncatePath root. */
|
|
24
|
+
const middleTruncatePathVariants = cva(MiddleTruncatePathStyles.root, {
|
|
25
|
+
variants: {},
|
|
26
|
+
defaultVariants: {}
|
|
27
|
+
});
|
|
28
|
+
/** Tailwind classes used when the path is short enough to skip splitting. */
|
|
29
|
+
const MiddleTruncatePathShortRootStyles = "truncate";
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { MiddleTruncatePathShortRootStyles, MiddleTruncatePathStyles, middleTruncatePathVariants };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for MiddleTruncatePath.
|
|
3
|
+
*
|
|
4
|
+
* @module @mks2508/mks-ui/react/ui/MiddleTruncatePath
|
|
5
|
+
*/
|
|
6
|
+
import type { SlotOverrides } from '@/core/types';
|
|
7
|
+
import type { MiddleTruncatePathSlot } from './MiddleTruncatePath.styles';
|
|
8
|
+
/**
|
|
9
|
+
* Props for MiddleTruncatePath.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link MiddleTruncatePathSlot} for available slot names
|
|
12
|
+
*/
|
|
13
|
+
export interface IMiddleTruncatePathProps {
|
|
14
|
+
/** Full file path (e.g. `"src/components/shell/AppShell.tsx"`). */
|
|
15
|
+
path: string;
|
|
16
|
+
/** How many trailing segments to always show (parent + filename). Default 2. */
|
|
17
|
+
keepEnd?: number;
|
|
18
|
+
/** Optional CSS class merged onto the root (container). */
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional CSS class for the start (truncatable) segment.
|
|
22
|
+
* @deprecated Prefer `slots.start` for new code.
|
|
23
|
+
*/
|
|
24
|
+
startClassName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional CSS class for the end (fixed) segment.
|
|
27
|
+
* @deprecated Prefer `slots.end` for new code.
|
|
28
|
+
*/
|
|
29
|
+
endClassName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Override default Tailwind classes per visual slot.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <MiddleTruncatePath
|
|
36
|
+
* path="src/index.ts"
|
|
37
|
+
* slots={{ start: 'text-muted-foreground/60', end: 'font-semibold' }}
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
slots?: SlotOverrides<MiddleTruncatePathSlot>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=MiddleTruncatePath.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MiddleTruncatePath.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAC/C"}
|