@floegence/floe-webapp-core 0.59.0 → 0.60.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.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type BasePickerProps } from './picker/PickerBase';
|
|
2
2
|
export interface DirectoryPickerProps extends BasePickerProps {
|
|
3
|
+
/** Ordered absolute navigation suggestions. They never grant filesystem access or auto-confirm. */
|
|
4
|
+
suggestedPaths?: readonly string[];
|
|
5
|
+
/** Localized heading for host-provided suggestions. */
|
|
6
|
+
suggestedPathsLabel?: string;
|
|
3
7
|
/** Receives the validated absolute directory path. */
|
|
4
8
|
onSelect: (path: string) => void;
|
|
5
9
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { createComponent as a, insert as i, setAttribute as o, effect as u, mergeProps as C, template as d, delegateEvents as w } from "solid-js/web";
|
|
2
|
+
import { createMemo as $, Show as _, For as S } from "solid-js";
|
|
3
|
+
import { cn as y } from "../../utils/cn.js";
|
|
4
|
+
import { FolderOpen as p } from "../icons/index.js";
|
|
5
|
+
import { Button as v } from "./Button.js";
|
|
6
|
+
import { Dialog as O } from "./Dialog.js";
|
|
7
|
+
import { usePickerNavigation as B, pickerCopy as b, PickerPanel as D } from "./picker/PickerBase.js";
|
|
8
|
+
import { parsePickerPath as z } from "./picker/PickerNavigation.js";
|
|
9
|
+
var F = /* @__PURE__ */ d('<section data-picker-suggestions class="mb-3 min-w-0"><p class="mb-1 px-2 text-[11px] font-medium text-muted-foreground">'), L = /* @__PURE__ */ d('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">'), T = /* @__PURE__ */ d('<button type=button class="flex min-h-10 w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="flex min-w-0 flex-1 flex-col"><span class="truncate text-xs font-medium"></span><span class="truncate text-[11px] text-muted-foreground">');
|
|
10
|
+
function I(e) {
|
|
11
|
+
const r = B(e, () => e.open), g = $(() => [...new Set((e.suggestedPaths ?? []).map((t) => z(t)).filter(Boolean))]), P = () => {
|
|
12
|
+
if (!r.valid()) return;
|
|
13
|
+
const t = r.currentPath();
|
|
14
|
+
e.onSelect(t), e.onOpenChange(!1);
|
|
12
15
|
};
|
|
13
|
-
return
|
|
16
|
+
return a(O, {
|
|
14
17
|
get open() {
|
|
15
18
|
return e.open;
|
|
16
19
|
},
|
|
@@ -21,38 +24,65 @@ function w(e) {
|
|
|
21
24
|
return e.title ?? "Select Directory";
|
|
22
25
|
},
|
|
23
26
|
get class() {
|
|
24
|
-
return
|
|
27
|
+
return y("max-w-lg", e.class);
|
|
25
28
|
},
|
|
26
29
|
get footer() {
|
|
27
30
|
return (() => {
|
|
28
|
-
var
|
|
29
|
-
return i(
|
|
31
|
+
var t = L(), s = t.firstChild;
|
|
32
|
+
return i(s, () => r.currentPath()), i(t, a(v, {
|
|
30
33
|
variant: "ghost",
|
|
31
34
|
size: "sm",
|
|
32
35
|
onClick: () => e.onOpenChange(!1),
|
|
33
36
|
get children() {
|
|
34
|
-
return e.cancelText ??
|
|
37
|
+
return e.cancelText ?? b(e).cancel;
|
|
35
38
|
}
|
|
36
|
-
}), null), i(
|
|
39
|
+
}), null), i(t, a(v, {
|
|
37
40
|
variant: "primary",
|
|
38
41
|
size: "sm",
|
|
39
|
-
onClick:
|
|
42
|
+
onClick: P,
|
|
40
43
|
get disabled() {
|
|
41
|
-
return !
|
|
44
|
+
return !r.valid();
|
|
42
45
|
},
|
|
43
46
|
get children() {
|
|
44
47
|
return e.confirmText ?? "Select";
|
|
45
48
|
}
|
|
46
|
-
}), null), u(() =>
|
|
49
|
+
}), null), u(() => o(s, "title", r.currentPath())), t;
|
|
47
50
|
})();
|
|
48
51
|
},
|
|
49
52
|
get children() {
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
return [a(_, {
|
|
54
|
+
get when() {
|
|
55
|
+
return g().length > 0;
|
|
56
|
+
},
|
|
57
|
+
get children() {
|
|
58
|
+
var t = F(), s = t.firstChild;
|
|
59
|
+
return i(s, () => e.suggestedPathsLabel ?? "Suggested directories"), i(t, a(S, {
|
|
60
|
+
get each() {
|
|
61
|
+
return g();
|
|
62
|
+
},
|
|
63
|
+
children: (l) => (() => {
|
|
64
|
+
var n = T(), m = n.firstChild, f = m.firstChild, k = f.nextSibling;
|
|
65
|
+
return n.$$click = () => {
|
|
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;
|
|
78
|
+
}
|
|
79
|
+
}), a(D, C(e, {
|
|
80
|
+
source: r
|
|
81
|
+
}))];
|
|
53
82
|
}
|
|
54
83
|
});
|
|
55
84
|
}
|
|
85
|
+
w(["click"]);
|
|
56
86
|
export {
|
|
57
|
-
|
|
87
|
+
I as DirectoryPicker
|
|
58
88
|
};
|