@floegence/floe-webapp-core 0.60.0 → 0.60.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.
|
@@ -2,7 +2,7 @@ import { type BasePickerProps } from './picker/PickerBase';
|
|
|
2
2
|
export interface DirectoryPickerProps extends BasePickerProps {
|
|
3
3
|
/** Ordered absolute navigation suggestions. They never grant filesystem access or auto-confirm. */
|
|
4
4
|
suggestedPaths?: readonly string[];
|
|
5
|
-
/** Localized
|
|
5
|
+
/** Localized tab label for host-provided suggestions. */
|
|
6
6
|
suggestedPathsLabel?: string;
|
|
7
7
|
/** Receives the validated absolute directory path. */
|
|
8
8
|
onSelect: (path: string) => void;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const t = r.currentPath();
|
|
1
|
+
import { createComponent as r, mergeProps as m, insert as a, effect as f, setAttribute as d, template as h } from "solid-js/web";
|
|
2
|
+
import { createMemo as P, createSignal as b } from "solid-js";
|
|
3
|
+
import { cn as v } from "../../utils/cn.js";
|
|
4
|
+
import { Button as o } from "./Button.js";
|
|
5
|
+
import { Dialog as C } from "./Dialog.js";
|
|
6
|
+
import { usePickerNavigation as x, PickerPanel as S, pickerCopy as k } from "./picker/PickerBase.js";
|
|
7
|
+
import { parsePickerPath as w } from "./picker/PickerNavigation.js";
|
|
8
|
+
var y = /* @__PURE__ */ h('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">');
|
|
9
|
+
function T(e) {
|
|
10
|
+
const l = P(() => [...new Set((e.suggestedPaths ?? []).map((t) => w(t)).filter(Boolean))]), [g, s] = b(!0), i = () => l().length > 0 && g(), n = x(e, () => e.open, void 0, () => s(!0)), u = () => {
|
|
11
|
+
if (e.disabled || i() || !n.valid()) return;
|
|
12
|
+
const t = n.currentPath();
|
|
14
13
|
e.onSelect(t), e.onOpenChange(!1);
|
|
15
14
|
};
|
|
16
|
-
return
|
|
15
|
+
return r(C, {
|
|
17
16
|
get open() {
|
|
18
17
|
return e.open;
|
|
19
18
|
},
|
|
@@ -24,65 +23,50 @@ function I(e) {
|
|
|
24
23
|
return e.title ?? "Select Directory";
|
|
25
24
|
},
|
|
26
25
|
get class() {
|
|
27
|
-
return
|
|
26
|
+
return v("max-w-lg", e.class);
|
|
28
27
|
},
|
|
29
28
|
get footer() {
|
|
30
29
|
return (() => {
|
|
31
|
-
var t =
|
|
32
|
-
return
|
|
30
|
+
var t = y(), c = t.firstChild;
|
|
31
|
+
return a(c, () => n.currentPath()), a(t, r(o, {
|
|
33
32
|
variant: "ghost",
|
|
34
33
|
size: "sm",
|
|
35
34
|
onClick: () => e.onOpenChange(!1),
|
|
36
35
|
get children() {
|
|
37
|
-
return e.cancelText ??
|
|
36
|
+
return e.cancelText ?? k(e).cancel;
|
|
38
37
|
}
|
|
39
|
-
}), null),
|
|
38
|
+
}), null), a(t, r(o, {
|
|
40
39
|
variant: "primary",
|
|
41
40
|
size: "sm",
|
|
42
|
-
onClick:
|
|
41
|
+
onClick: u,
|
|
43
42
|
get disabled() {
|
|
44
|
-
return !
|
|
43
|
+
return e.disabled || i() || !n.valid();
|
|
45
44
|
},
|
|
46
45
|
get children() {
|
|
47
46
|
return e.confirmText ?? "Select";
|
|
48
47
|
}
|
|
49
|
-
}), null),
|
|
48
|
+
}), null), f(() => d(c, "title", n.currentPath())), t;
|
|
50
49
|
})();
|
|
51
50
|
},
|
|
52
51
|
get children() {
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
r.navigate(l);
|
|
67
|
-
}, o(n, "data-picker-suggested-path", l), o(n, "title", l), o(n, "aria-label", l), i(n, a(p, {
|
|
68
|
-
class: "h-4 w-4 shrink-0 text-muted-foreground"
|
|
69
|
-
}), m), i(f, () => l.split("/").filter(Boolean).at(-1) ?? b(e).root), i(k, l), u((c) => {
|
|
70
|
-
var h = r.currentPath() === l ? "location" : void 0, x = e.disabled || !r.context();
|
|
71
|
-
return h !== c.e && o(n, "aria-current", c.e = h), x !== c.t && (n.disabled = c.t = x), c;
|
|
72
|
-
}, {
|
|
73
|
-
e: void 0,
|
|
74
|
-
t: void 0
|
|
75
|
-
}), n;
|
|
76
|
-
})()
|
|
77
|
-
}), null), u(() => o(t, "aria-label", e.suggestedPathsLabel ?? "Suggested directories")), t;
|
|
52
|
+
return r(S, m(e, {
|
|
53
|
+
source: n,
|
|
54
|
+
suggestions: {
|
|
55
|
+
get paths() {
|
|
56
|
+
return l();
|
|
57
|
+
},
|
|
58
|
+
get label() {
|
|
59
|
+
return e.suggestedPathsLabel ?? "Suggested directories";
|
|
60
|
+
},
|
|
61
|
+
get visible() {
|
|
62
|
+
return i();
|
|
63
|
+
},
|
|
64
|
+
onVisibilityChange: s
|
|
78
65
|
}
|
|
79
|
-
})
|
|
80
|
-
source: r
|
|
81
|
-
}))];
|
|
66
|
+
}));
|
|
82
67
|
}
|
|
83
68
|
});
|
|
84
69
|
}
|
|
85
|
-
w(["click"]);
|
|
86
70
|
export {
|
|
87
|
-
|
|
71
|
+
T as DirectoryPicker
|
|
88
72
|
};
|
|
@@ -62,6 +62,12 @@ export declare function usePickerNavigation(props: PickerDataProps, open: Access
|
|
|
62
62
|
/** Absolute directory navigation shared by all picker presentations. */
|
|
63
63
|
export declare function PickerPanel(props: PickerPanelProps & {
|
|
64
64
|
source: FilesystemPickerDataSource;
|
|
65
|
+
suggestions?: {
|
|
66
|
+
paths: readonly string[];
|
|
67
|
+
label: string;
|
|
68
|
+
visible: boolean;
|
|
69
|
+
onVisibilityChange: (visible: boolean) => void;
|
|
70
|
+
};
|
|
65
71
|
}): JSX.Element;
|
|
66
72
|
export declare const normalizePath: typeof parsePickerPath;
|
|
67
73
|
export { pickerParentPath as getParentPath } from './PickerNavigation';
|