@floegence/floe-webapp-core 0.86.76 → 0.87.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/components/index.d.ts +2 -0
- package/dist/components/ui/Accordion.d.ts +16 -0
- package/dist/components/ui/Accordion.js +59 -0
- package/dist/components/ui/Breadcrumb.d.ts +14 -0
- package/dist/components/ui/Breadcrumb.js +72 -0
- package/dist/components/ui/Calendar.d.ts +17 -0
- package/dist/components/ui/Calendar.js +151 -0
- package/dist/components/ui/Checkbox.js +137 -130
- package/dist/components/ui/DataTable.d.ts +33 -0
- package/dist/components/ui/DataTable.js +269 -0
- package/dist/components/ui/DatePicker.d.ts +35 -0
- package/dist/components/ui/DatePicker.js +198 -0
- package/dist/components/ui/Dropdown.d.ts +4 -20
- package/dist/components/ui/Dropdown.js +195 -231
- package/dist/components/ui/Form.d.ts +24 -5
- package/dist/components/ui/Form.js +179 -128
- package/dist/components/ui/Input.d.ts +6 -0
- package/dist/components/ui/Input.js +237 -189
- package/dist/components/ui/Pagination.js +211 -162
- package/dist/components/ui/Popover.d.ts +6 -1
- package/dist/components/ui/Popover.js +75 -56
- package/dist/components/ui/Select.d.ts +46 -0
- package/dist/components/ui/Select.js +414 -0
- package/dist/components/ui/Slider.d.ts +7 -0
- package/dist/components/ui/Slider.js +28 -0
- package/dist/components/ui/Switch.js +41 -32
- package/dist/components/ui/Table.d.ts +9 -0
- package/dist/components/ui/Table.js +97 -0
- package/dist/components/ui/calendarModel.d.ts +6 -0
- package/dist/components/ui/calendarModel.js +37 -0
- package/dist/components/ui/controllable.d.ts +7 -0
- package/dist/components/ui/controllable.js +10 -0
- package/dist/components/ui/dataTableModel.d.ts +18 -0
- package/dist/components/ui/dataTableModel.js +18 -0
- package/dist/components/ui/formFieldContext.d.ts +26 -0
- package/dist/components/ui/formFieldContext.js +40 -0
- package/dist/components/ui/index.d.ts +13 -1
- package/dist/components/ui/picker/PickerBase.js +106 -112
- package/dist/context/LocaleContext.d.ts +55 -0
- package/dist/context/LocaleContext.js +80 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/full.d.ts +2 -0
- package/dist/full.js +776 -737
- package/dist/index.js +111 -107
- package/dist/styles.css +1 -1
- package/dist/ui.js +223 -184
- package/package.json +1 -1
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
import { setAttribute as
|
|
2
|
-
import { createSignal as
|
|
1
|
+
import { setAttribute as g, insert as v, memo as S, createComponent as E, Portal as H, spread as T, mergeProps as z, effect as q, template as O, use as R, delegateEvents as j } from "solid-js/web";
|
|
2
|
+
import { createSignal as C, createMemo as N, createEffect as U, onCleanup as K, Show as W } from "solid-js";
|
|
3
3
|
import { cn as D } from "../../utils/cn.js";
|
|
4
4
|
import { calculateMenuPosition as G } from "./menuUtils.js";
|
|
5
5
|
import { LOCAL_INTERACTION_SURFACE_ATTR as J } from "./localInteractionSurface.js";
|
|
6
6
|
import { createFloatingPresence as Q } from "./floatingPresence.js";
|
|
7
7
|
import { useOverlayMask as V } from "../../hooks/useOverlayMask.js";
|
|
8
8
|
import { resolveSurfacePortalHost as X, projectSurfacePortalPosition as Y, isSurfacePortalMode as Z, resolveSurfacePortalMount as ee, resolveSurfacePortalBoundaryRect as te } from "./dialogSurfaceScope.js";
|
|
9
|
-
var oe = /* @__PURE__ */
|
|
9
|
+
var oe = /* @__PURE__ */ O("<div data-floe-popover-panel role=dialog aria-modal=false data-floe-surface=floating>"), ne = /* @__PURE__ */ O('<div class="relative inline-flex"><div class=inline-flex data-floe-popover-trigger>');
|
|
10
10
|
let re = 0;
|
|
11
|
-
function
|
|
12
|
-
const h = () =>
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
function ge(t) {
|
|
12
|
+
const h = () => t.open !== void 0, [_, k] = C(t.defaultOpen ?? !1), c = () => h() ? !!t.open : _(), i = (o) => {
|
|
13
|
+
const e = o !== c();
|
|
14
|
+
h() || k(o), e && t.onOpenChange?.(o);
|
|
15
|
+
}, r = Q({
|
|
15
16
|
open: c,
|
|
16
|
-
element: () =>
|
|
17
|
-
}), [w,
|
|
17
|
+
element: () => l
|
|
18
|
+
}), [w, m] = C({
|
|
18
19
|
x: -9999,
|
|
19
20
|
y: -9999
|
|
20
21
|
});
|
|
21
|
-
let
|
|
22
|
-
const p = `floe-popover-${re += 1}`, b = `${p}-panel`,
|
|
23
|
-
owner:
|
|
22
|
+
let a, l;
|
|
23
|
+
const p = `floe-popover-${re += 1}`, b = `${p}-panel`, u = N(() => r.mounted() ? X({
|
|
24
|
+
owner: a
|
|
24
25
|
}) : {
|
|
25
26
|
host: null,
|
|
26
27
|
boundaryHost: null,
|
|
27
28
|
mountHost: null,
|
|
28
29
|
mode: "global"
|
|
29
|
-
}), A = () => ee(
|
|
30
|
+
}), A = () => ee(u()), y = () => Z(u()), B = () => te(u()), x = (o) => Y(o, u()), $ = () => (t.placement ?? "bottom-start").startsWith("top") ? "top" : "bottom", F = () => (t.placement ?? "bottom-start").slice($() === "top" ? 5 : 7), I = () => i(!1), L = () => {
|
|
31
|
+
i(!1), a?.querySelector('button, input, [tabindex="0"]')?.focus({
|
|
32
|
+
preventScroll: !0
|
|
33
|
+
});
|
|
34
|
+
};
|
|
30
35
|
V({
|
|
31
|
-
open:
|
|
32
|
-
root: () =>
|
|
36
|
+
open: r.mounted,
|
|
37
|
+
root: () => l,
|
|
33
38
|
containsTarget: (o) => {
|
|
34
39
|
const e = o instanceof Element ? o : document.activeElement;
|
|
35
|
-
return
|
|
40
|
+
return l?.contains(e ?? null) || e?.closest(`[data-floe-popover="${p}"]`) ? !0 : !!a?.contains(e ?? null);
|
|
36
41
|
},
|
|
37
|
-
onClose:
|
|
42
|
+
onClose: L,
|
|
38
43
|
onInteractOutside: () => i(!1),
|
|
39
44
|
onEscapeOutside: () => i(!1),
|
|
40
45
|
lockBodyScroll: !1,
|
|
@@ -42,93 +47,107 @@ function me(n) {
|
|
|
42
47
|
autoFocus: !1,
|
|
43
48
|
restoreFocus: !1,
|
|
44
49
|
blockHotkeys: !1,
|
|
45
|
-
closeOnEscape: () =>
|
|
50
|
+
closeOnEscape: () => t.closeOnEscape === !1 ? !1 : "inside",
|
|
46
51
|
escapeKeyPhase: "bubble"
|
|
47
52
|
});
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
50
|
-
const o = G(
|
|
51
|
-
if (
|
|
52
|
-
const e =
|
|
53
|
-
|
|
53
|
+
const P = () => {
|
|
54
|
+
if (!a || !l) return;
|
|
55
|
+
const o = G(a.getBoundingClientRect(), l.getBoundingClientRect(), F(), B());
|
|
56
|
+
if ($() === "top") {
|
|
57
|
+
const e = a.getBoundingClientRect(), d = l.getBoundingClientRect();
|
|
58
|
+
m({
|
|
54
59
|
x: o.x,
|
|
55
|
-
y: e.top -
|
|
60
|
+
y: e.top - d.height - 6
|
|
56
61
|
});
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
|
-
|
|
64
|
+
m(o);
|
|
60
65
|
};
|
|
61
|
-
|
|
62
|
-
if (!
|
|
63
|
-
|
|
66
|
+
U(() => {
|
|
67
|
+
if (!r.mounted()) {
|
|
68
|
+
m({
|
|
64
69
|
x: -9999,
|
|
65
70
|
y: -9999
|
|
66
71
|
});
|
|
67
72
|
return;
|
|
68
73
|
}
|
|
69
|
-
const o = requestAnimationFrame(
|
|
74
|
+
const o = requestAnimationFrame(P), e = () => P();
|
|
70
75
|
window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), K(() => {
|
|
71
76
|
cancelAnimationFrame(o), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
72
77
|
});
|
|
73
|
-
})
|
|
78
|
+
});
|
|
79
|
+
const M = {
|
|
80
|
+
"aria-haspopup": "dialog",
|
|
81
|
+
get "aria-expanded"() {
|
|
82
|
+
return c();
|
|
83
|
+
},
|
|
84
|
+
get "aria-controls"() {
|
|
85
|
+
return r.mounted() ? b : void 0;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return (() => {
|
|
74
89
|
var o = ne(), e = o.firstChild;
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
g(o, "data-floe-popover", p), e.$$keydown = (n) => {
|
|
91
|
+
n.key === "Escape" && c() && (n.stopPropagation(), i(!1));
|
|
77
92
|
}, e.$$click = () => i(!c());
|
|
78
|
-
var
|
|
79
|
-
return typeof
|
|
93
|
+
var d = a;
|
|
94
|
+
return typeof d == "function" ? R(d, e) : a = e, v(e, (() => {
|
|
95
|
+
var n = S(() => typeof t.trigger == "function");
|
|
96
|
+
return () => n() ? t.trigger(M) : t.trigger;
|
|
97
|
+
})()), v(o, E(W, {
|
|
80
98
|
get when() {
|
|
81
|
-
return
|
|
99
|
+
return r.mounted();
|
|
82
100
|
},
|
|
83
101
|
get children() {
|
|
84
|
-
return
|
|
102
|
+
return E(H, {
|
|
85
103
|
get mount() {
|
|
86
104
|
return A();
|
|
87
105
|
},
|
|
88
106
|
get children() {
|
|
89
|
-
var
|
|
90
|
-
return typeof
|
|
107
|
+
var n = oe(), s = l;
|
|
108
|
+
return typeof s == "function" ? R(s, n) : l = n, g(n, "id", b), T(n, z({
|
|
91
109
|
get class() {
|
|
92
|
-
return D(y() ? "absolute z-20" : "fixed z-50", "bg-popover text-popover-foreground", "rounded-panel border border-[var(--floe-line)]", "shadow-[var(--floe-window-shadow)]", "floe-floating-presence floe-floating-menu",
|
|
110
|
+
return D(y() ? "absolute z-20" : "fixed z-50", "bg-popover text-popover-foreground", "rounded-panel border border-[var(--floe-line)]", "shadow-[var(--floe-window-shadow)]", "floe-floating-presence floe-floating-menu", t.class);
|
|
93
111
|
},
|
|
94
112
|
get "data-floating-presence"() {
|
|
95
|
-
return
|
|
113
|
+
return r.state();
|
|
96
114
|
},
|
|
97
115
|
get "aria-hidden"() {
|
|
98
|
-
return
|
|
116
|
+
return r.exiting() ? "true" : void 0;
|
|
117
|
+
},
|
|
118
|
+
get inert() {
|
|
119
|
+
return r.exiting();
|
|
99
120
|
},
|
|
100
121
|
get "aria-label"() {
|
|
101
|
-
return
|
|
122
|
+
return t.ariaLabel;
|
|
102
123
|
},
|
|
103
124
|
get style() {
|
|
104
125
|
return {
|
|
105
126
|
left: `${x(w()).x}px`,
|
|
106
127
|
top: `${x(w()).y}px`,
|
|
107
|
-
"min-width":
|
|
128
|
+
"min-width": t.width ? `${t.width}px` : void 0,
|
|
108
129
|
"max-width": "min(calc(100vw - 24px), 420px)"
|
|
109
130
|
};
|
|
110
131
|
}
|
|
111
132
|
}, () => ({
|
|
112
133
|
[J]: y() ? "true" : void 0
|
|
113
|
-
})), !1, !0),
|
|
114
|
-
var
|
|
115
|
-
return () =>
|
|
116
|
-
})()),
|
|
134
|
+
})), !1, !0), v(n, (() => {
|
|
135
|
+
var f = S(() => typeof t.children == "function");
|
|
136
|
+
return () => f() ? t.children(I) : t.children;
|
|
137
|
+
})()), n;
|
|
117
138
|
}
|
|
118
139
|
});
|
|
119
140
|
}
|
|
120
|
-
}), null),
|
|
121
|
-
var
|
|
122
|
-
return
|
|
141
|
+
}), null), q((n) => {
|
|
142
|
+
var s = t.triggerInputSurface ? "true" : void 0, f = t.triggerInputSurface ? "inset" : void 0;
|
|
143
|
+
return s !== n.e && g(e, "data-floe-input-surface", n.e = s), f !== n.t && g(e, "data-floe-surface", n.t = f), n;
|
|
123
144
|
}, {
|
|
124
145
|
e: void 0,
|
|
125
|
-
t: void 0
|
|
126
|
-
a: void 0,
|
|
127
|
-
o: void 0
|
|
146
|
+
t: void 0
|
|
128
147
|
}), o;
|
|
129
148
|
})();
|
|
130
149
|
}
|
|
131
|
-
|
|
150
|
+
j(["click", "keydown"]);
|
|
132
151
|
export {
|
|
133
|
-
|
|
152
|
+
ge as Popover
|
|
134
153
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
keywords?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface SelectBaseProps {
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
form?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
ariaLabelledBy?: string;
|
|
17
|
+
ariaDescribedBy?: string;
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
options: readonly SelectOption[];
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
onOpenChange?: (open: boolean) => void;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
error?: string;
|
|
27
|
+
onRetry?: () => void;
|
|
28
|
+
onQueryChange?: (query: string) => void;
|
|
29
|
+
/** Disable local filtering when the host supplies remote search results. */
|
|
30
|
+
filter?: boolean;
|
|
31
|
+
renderOption?: (option: SelectOption) => JSX.Element;
|
|
32
|
+
ref?: (control: HTMLButtonElement | HTMLInputElement) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface SelectProps extends SelectBaseProps {
|
|
35
|
+
value?: string;
|
|
36
|
+
defaultValue?: string;
|
|
37
|
+
onChange?: (value: string) => void;
|
|
38
|
+
}
|
|
39
|
+
export interface MultiSelectProps extends SelectBaseProps {
|
|
40
|
+
value?: string[];
|
|
41
|
+
defaultValue?: string[];
|
|
42
|
+
onChange?: (value: string[]) => void;
|
|
43
|
+
}
|
|
44
|
+
export declare function Select(props: SelectProps): JSX.Element;
|
|
45
|
+
export declare function Combobox(props: SelectProps): JSX.Element;
|
|
46
|
+
export declare function MultiSelect(props: MultiSelectProps): JSX.Element;
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { createComponent as c, mergeProps as A, insert as s, spread as Z, memo as S, effect as E, setAttribute as y, className as ie, template as h, use as oe, delegateEvents as ue } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as de, createSignal as T, createMemo as se, createEffect as K, untrack as ce, onCleanup as p, onMount as fe, Show as x, For as M } from "solid-js";
|
|
3
|
+
import { cn as ee } from "../../utils/cn.js";
|
|
4
|
+
import { useFloeLocale as ve } from "../../context/LocaleContext.js";
|
|
5
|
+
import { useOverlayMask as ge } from "../../hooks/useOverlayMask.js";
|
|
6
|
+
import { SurfaceFloatingLayer as me } from "./SurfaceFloatingLayer.js";
|
|
7
|
+
import { calculateMenuPosition as he } from "./menuUtils.js";
|
|
8
|
+
import { useFormControl as be, joinAriaIds as ye } from "./formFieldContext.js";
|
|
9
|
+
import { createControllableValue as F } from "./controllable.js";
|
|
10
|
+
import { ChevronDown as we, Check as Ce } from "../icons/index.js";
|
|
11
|
+
import { resolveSurfacePortalBoundaryRect as ke, resolveSurfacePortalHost as xe } from "./dialogSurfaceScope.js";
|
|
12
|
+
var Ve = /* @__PURE__ */ h("<input>"), Le = /* @__PURE__ */ h("<option value>"), $e = /* @__PURE__ */ h('<div role=status class="px-2 py-2 text-caption">'), Oe = /* @__PURE__ */ h("<button type=button>"), Ee = /* @__PURE__ */ h('<div role=alert class="p-2 text-error">'), De = /* @__PURE__ */ h('<div role=listbox class="max-h-64 overflow-y-auto"data-floe-local-interaction-surface=true>'), _e = /* @__PURE__ */ h('<div role=status class="p-2 text-caption">'), Pe = /* @__PURE__ */ h('<div class="relative min-w-0"><select tabindex=-1 aria-hidden=true class="sr-only pointer-events-none">'), qe = /* @__PURE__ */ h("<button><span class=truncate>"), Ae = /* @__PURE__ */ h("<option selected>"), Se = /* @__PURE__ */ h("<option>"), Te = /* @__PURE__ */ h('<div role=option><span class="h-3.5 w-3.5 shrink-0">');
|
|
13
|
+
function H(e) {
|
|
14
|
+
const u = ve(), f = be(), g = de(), j = () => e.id ?? f.id ?? "select-" + g, D = "options-" + g, _ = () => e.disabled ?? f.disabled, P = () => e.readOnly ?? f.readOnly, [v, te] = F({
|
|
15
|
+
value: () => e.open,
|
|
16
|
+
defaultValue: e.defaultOpen ?? !1,
|
|
17
|
+
onChange: (t) => e.onOpenChange?.(t)
|
|
18
|
+
}), [B, z] = T(""), [V, $] = T(-1), [le, ae] = T({
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0
|
|
21
|
+
}), [re, ne] = T(200);
|
|
22
|
+
let w, L, k, I = "", N = 0;
|
|
23
|
+
const b = se(() => {
|
|
24
|
+
if (!e.searchable || e.filter === !1 || !B()) return e.options;
|
|
25
|
+
const t = B().toLocaleLowerCase(u.locale);
|
|
26
|
+
return e.options.filter((r) => [r.label, ...r.keywords ?? []].some((n) => n.toLocaleLowerCase(u.locale).includes(t)));
|
|
27
|
+
}), Q = () => e.values.map((t) => e.options.find((r) => r.value === t)?.label ?? t).join(", "), m = (t) => {
|
|
28
|
+
t && (_() || P()) || (te(t), t || z(""));
|
|
29
|
+
}, R = (t) => {
|
|
30
|
+
_() || P() || t.disabled || (e.onValuesChange(e.multiple ? e.values.includes(t.value) ? e.values.filter((r) => r !== t.value) : [...e.values, t.value] : [t.value]), e.multiple || m(!1), w?.focus({
|
|
31
|
+
preventScroll: !0
|
|
32
|
+
}));
|
|
33
|
+
}, U = (t, r) => {
|
|
34
|
+
const n = b().map((o, i) => o.disabled ? -1 : i).filter((o) => o >= 0);
|
|
35
|
+
if (!n.length) {
|
|
36
|
+
$(-1);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const l = n.indexOf(V()), a = r === "first" ? 0 : r === "last" ? n.length - 1 : l < 0 ? t < 0 ? n.length - 1 : 0 : (l + t + n.length) % n.length;
|
|
40
|
+
$(n[a]), k?.querySelector('[id="' + D + "-" + n[a] + '"]')?.scrollIntoView({
|
|
41
|
+
block: "nearest"
|
|
42
|
+
});
|
|
43
|
+
}, O = () => {
|
|
44
|
+
if (!w || !k) return;
|
|
45
|
+
const t = w.getBoundingClientRect();
|
|
46
|
+
ne(t.width);
|
|
47
|
+
const r = ke(xe({
|
|
48
|
+
owner: w
|
|
49
|
+
}));
|
|
50
|
+
ae(he(t, k.getBoundingClientRect(), u.direction === "rtl" ? "end" : "start", r));
|
|
51
|
+
};
|
|
52
|
+
K(() => {
|
|
53
|
+
if (!v()) return;
|
|
54
|
+
const t = ce(V);
|
|
55
|
+
if (t < 0 || !b()[t] || b()[t].disabled) {
|
|
56
|
+
const r = b().findIndex((n) => !n.disabled && e.values.includes(n.value));
|
|
57
|
+
$(r >= 0 ? r : b().findIndex((n) => !n.disabled));
|
|
58
|
+
}
|
|
59
|
+
}), K(() => {
|
|
60
|
+
if (!v() || typeof window > "u") return;
|
|
61
|
+
const t = requestAnimationFrame(O), r = new ResizeObserver(O);
|
|
62
|
+
w && r.observe(w), k && r.observe(k), window.addEventListener("resize", O), window.addEventListener("scroll", O, !0), p(() => {
|
|
63
|
+
cancelAnimationFrame(t), r.disconnect(), window.removeEventListener("resize", O), window.removeEventListener("scroll", O, !0);
|
|
64
|
+
});
|
|
65
|
+
}), ge({
|
|
66
|
+
open: v,
|
|
67
|
+
root: () => k,
|
|
68
|
+
containsTarget: (t) => t instanceof Node && !!(k?.contains(t) || w?.contains(t)),
|
|
69
|
+
onClose: () => m(!1),
|
|
70
|
+
onInteractOutside: () => m(!1),
|
|
71
|
+
onEscapeOutside: () => m(!1),
|
|
72
|
+
lockBodyScroll: !1,
|
|
73
|
+
trapFocus: !1,
|
|
74
|
+
autoFocus: !1,
|
|
75
|
+
restoreFocus: !1,
|
|
76
|
+
blockHotkeys: !1,
|
|
77
|
+
closeOnEscape: "inside",
|
|
78
|
+
escapeKeyPhase: "bubble"
|
|
79
|
+
}), fe(() => {
|
|
80
|
+
const t = L?.form;
|
|
81
|
+
let r;
|
|
82
|
+
const n = (l) => {
|
|
83
|
+
clearTimeout(r), r = setTimeout(() => {
|
|
84
|
+
if (!l.defaultPrevented && (e.onValuesChange([...e.resetValues]), m(!1), L))
|
|
85
|
+
for (const a of L.options) a.selected = e.values.includes(a.value);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
t?.addEventListener("reset", n), p(() => {
|
|
89
|
+
clearTimeout(r), t?.removeEventListener("reset", n);
|
|
90
|
+
});
|
|
91
|
+
}), K(() => {
|
|
92
|
+
const t = e.values;
|
|
93
|
+
if (e.options, L) for (const r of L.options) r.selected = t.includes(r.value);
|
|
94
|
+
});
|
|
95
|
+
const W = {
|
|
96
|
+
get id() {
|
|
97
|
+
return j();
|
|
98
|
+
},
|
|
99
|
+
get disabled() {
|
|
100
|
+
return _();
|
|
101
|
+
},
|
|
102
|
+
get "aria-readonly"() {
|
|
103
|
+
return P();
|
|
104
|
+
},
|
|
105
|
+
role: "combobox",
|
|
106
|
+
"aria-haspopup": "listbox",
|
|
107
|
+
get "aria-expanded"() {
|
|
108
|
+
return v();
|
|
109
|
+
},
|
|
110
|
+
get "aria-controls"() {
|
|
111
|
+
return v() ? D : void 0;
|
|
112
|
+
},
|
|
113
|
+
get "aria-activedescendant"() {
|
|
114
|
+
return v() && b()[V()] ? D + "-" + V() : void 0;
|
|
115
|
+
},
|
|
116
|
+
get "aria-label"() {
|
|
117
|
+
return e.ariaLabel;
|
|
118
|
+
},
|
|
119
|
+
get "aria-labelledby"() {
|
|
120
|
+
return e.ariaLabelledBy;
|
|
121
|
+
},
|
|
122
|
+
get "aria-describedby"() {
|
|
123
|
+
return ye(f["aria-describedby"], e.ariaDescribedBy);
|
|
124
|
+
},
|
|
125
|
+
get "aria-invalid"() {
|
|
126
|
+
return e.invalid || f["aria-invalid"];
|
|
127
|
+
},
|
|
128
|
+
get "aria-required"() {
|
|
129
|
+
return e.required ?? f.required;
|
|
130
|
+
},
|
|
131
|
+
"data-floe-input-surface": "true",
|
|
132
|
+
"data-floe-control": "select",
|
|
133
|
+
"data-floe-dropdown-trigger": "",
|
|
134
|
+
"data-floe-surface": "inset",
|
|
135
|
+
get class() {
|
|
136
|
+
return ee("floe-field flex w-full min-w-0 items-center justify-between gap-2 h-[var(--floe-control-height-md)] px-2.5 text-[length:var(--floe-type-control)]", e.class);
|
|
137
|
+
},
|
|
138
|
+
onKeyDown: (t) => {
|
|
139
|
+
if (!(_() || P() || t.isComposing)) {
|
|
140
|
+
if (t.key === "Escape" && v()) {
|
|
141
|
+
t.preventDefault(), t.stopPropagation(), m(!1);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (t.key === "Tab") {
|
|
145
|
+
m(!1);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
149
|
+
t.preventDefault();
|
|
150
|
+
const r = v();
|
|
151
|
+
m(!0), r && U(t.key === "ArrowDown" ? 1 : -1);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (v() && (t.key === "Home" || t.key === "End") && !e.searchable) {
|
|
155
|
+
t.preventDefault(), U(0, t.key === "Home" ? "first" : "last");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (t.key === "Enter" || !e.searchable && t.key === " ") {
|
|
159
|
+
t.preventDefault(), v() && b()[V()] ? R(b()[V()]) : m(!0);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (!e.searchable && t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
163
|
+
const r = Date.now();
|
|
164
|
+
I = r - N > 700 ? t.key : I + t.key, N = r;
|
|
165
|
+
const n = e.options.find((l) => !l.disabled && l.label.toLocaleLowerCase(u.locale).startsWith(I.toLocaleLowerCase(u.locale)));
|
|
166
|
+
n && (t.preventDefault(), v() ? $(b().indexOf(n)) : R(n));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
ref: (t) => {
|
|
171
|
+
w = t, e.ref?.(t);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return (() => {
|
|
175
|
+
var t = Pe(), r = t.firstChild;
|
|
176
|
+
s(t, c(x, {
|
|
177
|
+
get when() {
|
|
178
|
+
return e.searchable;
|
|
179
|
+
},
|
|
180
|
+
get fallback() {
|
|
181
|
+
return (() => {
|
|
182
|
+
var l = qe(), a = l.firstChild;
|
|
183
|
+
return Z(l, A(W, {
|
|
184
|
+
type: "button",
|
|
185
|
+
onClick: () => m(!v())
|
|
186
|
+
}), !1, !0), s(a, () => Q() || e.placeholder || u.t("selectPlaceholder")), s(l, c(we, {
|
|
187
|
+
class: "h-3.5 w-3.5 shrink-0"
|
|
188
|
+
}), null), l;
|
|
189
|
+
})();
|
|
190
|
+
},
|
|
191
|
+
get children() {
|
|
192
|
+
var l = Ve();
|
|
193
|
+
return Z(l, A(W, {
|
|
194
|
+
type: "text",
|
|
195
|
+
autocomplete: "off",
|
|
196
|
+
get readOnly() {
|
|
197
|
+
return P();
|
|
198
|
+
},
|
|
199
|
+
"aria-autocomplete": "list",
|
|
200
|
+
get placeholder() {
|
|
201
|
+
return e.placeholder ?? u.t("searchPlaceholder");
|
|
202
|
+
},
|
|
203
|
+
get value() {
|
|
204
|
+
return S(() => !!v())() ? B() : Q();
|
|
205
|
+
},
|
|
206
|
+
onClick: () => m(!0),
|
|
207
|
+
onInput: (a) => {
|
|
208
|
+
z(a.currentTarget.value), $(-1), m(!0), e.onQueryChange?.(a.currentTarget.value);
|
|
209
|
+
}
|
|
210
|
+
}), !1, !1), l;
|
|
211
|
+
}
|
|
212
|
+
}), r), r.addEventListener("change", (l) => e.onValuesChange(Array.from(l.currentTarget.selectedOptions, (a) => a.value))), r.addEventListener("invalid", (l) => {
|
|
213
|
+
l.preventDefault(), w?.focus();
|
|
214
|
+
});
|
|
215
|
+
var n = L;
|
|
216
|
+
return typeof n == "function" ? oe(n, r) : L = r, s(r, c(x, {
|
|
217
|
+
get when() {
|
|
218
|
+
return S(() => !e.multiple)() && !e.options.some((l) => l.value === "");
|
|
219
|
+
},
|
|
220
|
+
get children() {
|
|
221
|
+
var l = Le();
|
|
222
|
+
return E(() => l.selected = !e.values.length || e.values[0] === ""), l;
|
|
223
|
+
}
|
|
224
|
+
}), null), s(r, c(M, {
|
|
225
|
+
get each() {
|
|
226
|
+
return e.values.filter((l) => l !== "" && !e.options.some((a) => a.value === l));
|
|
227
|
+
},
|
|
228
|
+
children: (l) => (() => {
|
|
229
|
+
var a = Ae();
|
|
230
|
+
return a.value = l, s(a, l), a;
|
|
231
|
+
})()
|
|
232
|
+
}), null), s(r, c(M, {
|
|
233
|
+
get each() {
|
|
234
|
+
return e.options;
|
|
235
|
+
},
|
|
236
|
+
children: (l) => (() => {
|
|
237
|
+
var a = Se();
|
|
238
|
+
return s(a, () => l.label), E((o) => {
|
|
239
|
+
var i = e.values.includes(l.value), C = l.disabled;
|
|
240
|
+
return i !== o.e && (a.selected = o.e = i), C !== o.t && (a.disabled = o.t = C), o;
|
|
241
|
+
}, {
|
|
242
|
+
e: void 0,
|
|
243
|
+
t: void 0
|
|
244
|
+
}), E(() => a.value = l.value), a;
|
|
245
|
+
})()
|
|
246
|
+
}), null), s(t, c(x, {
|
|
247
|
+
get when() {
|
|
248
|
+
return v();
|
|
249
|
+
},
|
|
250
|
+
get children() {
|
|
251
|
+
return c(me, {
|
|
252
|
+
owner: w,
|
|
253
|
+
get position() {
|
|
254
|
+
return le();
|
|
255
|
+
},
|
|
256
|
+
layerRef: (l) => {
|
|
257
|
+
k = l;
|
|
258
|
+
},
|
|
259
|
+
get dir() {
|
|
260
|
+
return u.direction;
|
|
261
|
+
},
|
|
262
|
+
class: "rounded-panel border border-[var(--floe-line)] bg-popover text-popover-foreground shadow-[var(--floe-elevation-float)] p-1",
|
|
263
|
+
get style() {
|
|
264
|
+
return {
|
|
265
|
+
width: re() + "px",
|
|
266
|
+
"max-width": "calc(100vw - 24px)"
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
"data-floe-surface": "floating",
|
|
270
|
+
get children() {
|
|
271
|
+
return [c(x, {
|
|
272
|
+
get when() {
|
|
273
|
+
return e.loading;
|
|
274
|
+
},
|
|
275
|
+
get children() {
|
|
276
|
+
var l = $e();
|
|
277
|
+
return s(l, () => u.t("loading")), l;
|
|
278
|
+
}
|
|
279
|
+
}), c(x, {
|
|
280
|
+
get when() {
|
|
281
|
+
return e.error;
|
|
282
|
+
},
|
|
283
|
+
get children() {
|
|
284
|
+
var l = Ee();
|
|
285
|
+
return s(l, () => e.error, null), s(l, c(x, {
|
|
286
|
+
get when() {
|
|
287
|
+
return e.onRetry;
|
|
288
|
+
},
|
|
289
|
+
get children() {
|
|
290
|
+
var a = Oe();
|
|
291
|
+
return a.$$click = () => e.onRetry?.(), s(a, () => u.t("retry")), a;
|
|
292
|
+
}
|
|
293
|
+
}), null), l;
|
|
294
|
+
}
|
|
295
|
+
}), (() => {
|
|
296
|
+
var l = De();
|
|
297
|
+
return y(l, "id", D), s(l, c(M, {
|
|
298
|
+
get each() {
|
|
299
|
+
return b();
|
|
300
|
+
},
|
|
301
|
+
children: (a, o) => (() => {
|
|
302
|
+
var i = Te(), C = i.firstChild;
|
|
303
|
+
return i.$$click = () => R(a), i.$$pointermove = () => !a.disabled && $(o()), i.$$pointerdown = (d) => d.preventDefault(), s(C, c(x, {
|
|
304
|
+
get when() {
|
|
305
|
+
return e.values.includes(a.value);
|
|
306
|
+
},
|
|
307
|
+
get children() {
|
|
308
|
+
return c(Ce, {
|
|
309
|
+
class: "h-3.5 w-3.5"
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
})), s(i, (() => {
|
|
313
|
+
var d = S(() => !!e.renderOption);
|
|
314
|
+
return () => d() ? e.renderOption(a) : a.label;
|
|
315
|
+
})(), null), E((d) => {
|
|
316
|
+
var q = D + "-" + o(), G = e.values.includes(a.value), J = a.disabled || void 0, X = e.values.includes(a.value) ? "true" : void 0, Y = ee("flex min-h-[var(--floe-row-height)] items-center gap-2 rounded-sm px-2 text-[length:var(--floe-type-control)]", V() === o() && "bg-accent text-accent-foreground", a.disabled ? "opacity-50" : "cursor-pointer");
|
|
317
|
+
return q !== d.e && y(i, "id", d.e = q), G !== d.t && y(i, "aria-selected", d.t = G), J !== d.a && y(i, "aria-disabled", d.a = J), X !== d.o && y(i, "data-floe-selected", d.o = X), Y !== d.i && ie(i, d.i = Y), d;
|
|
318
|
+
}, {
|
|
319
|
+
e: void 0,
|
|
320
|
+
t: void 0,
|
|
321
|
+
a: void 0,
|
|
322
|
+
o: void 0,
|
|
323
|
+
i: void 0
|
|
324
|
+
}), i;
|
|
325
|
+
})()
|
|
326
|
+
})), E((a) => {
|
|
327
|
+
var o = e.ariaLabel, i = e.ariaLabelledBy ?? (e.ariaLabel ? void 0 : j()), C = e.multiple || void 0;
|
|
328
|
+
return o !== a.e && y(l, "aria-label", a.e = o), i !== a.t && y(l, "aria-labelledby", a.t = i), C !== a.a && y(l, "aria-multiselectable", a.a = C), a;
|
|
329
|
+
}, {
|
|
330
|
+
e: void 0,
|
|
331
|
+
t: void 0,
|
|
332
|
+
a: void 0
|
|
333
|
+
}), l;
|
|
334
|
+
})(), c(x, {
|
|
335
|
+
get when() {
|
|
336
|
+
return S(() => !b().length && !e.loading)() && !e.error;
|
|
337
|
+
},
|
|
338
|
+
get children() {
|
|
339
|
+
var l = _e();
|
|
340
|
+
return s(l, () => u.t("noResults")), l;
|
|
341
|
+
}
|
|
342
|
+
})];
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}), null), E((l) => {
|
|
347
|
+
var a = u.direction, o = e.name ?? f.name, i = e.form, C = e.required ?? f.required, d = _(), q = e.multiple;
|
|
348
|
+
return a !== l.e && y(t, "dir", l.e = a), o !== l.t && y(r, "name", l.t = o), i !== l.a && y(r, "form", l.a = i), C !== l.o && (r.required = l.o = C), d !== l.i && (r.disabled = l.i = d), q !== l.n && (r.multiple = l.n = q), l;
|
|
349
|
+
}, {
|
|
350
|
+
e: void 0,
|
|
351
|
+
t: void 0,
|
|
352
|
+
a: void 0,
|
|
353
|
+
o: void 0,
|
|
354
|
+
i: void 0,
|
|
355
|
+
n: void 0
|
|
356
|
+
}), t;
|
|
357
|
+
})();
|
|
358
|
+
}
|
|
359
|
+
function We(e) {
|
|
360
|
+
const [u, f] = F({
|
|
361
|
+
value: () => e.value,
|
|
362
|
+
defaultValue: e.defaultValue ?? "",
|
|
363
|
+
onChange: (g) => e.onChange?.(g)
|
|
364
|
+
});
|
|
365
|
+
return c(H, A(e, {
|
|
366
|
+
get values() {
|
|
367
|
+
return [u()];
|
|
368
|
+
},
|
|
369
|
+
get resetValues() {
|
|
370
|
+
return [e.defaultValue ?? ""];
|
|
371
|
+
},
|
|
372
|
+
onValuesChange: (g) => f(g[0] ?? "")
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
function Ge(e) {
|
|
376
|
+
const [u, f] = F({
|
|
377
|
+
value: () => e.value,
|
|
378
|
+
defaultValue: e.defaultValue ?? "",
|
|
379
|
+
onChange: (g) => e.onChange?.(g)
|
|
380
|
+
});
|
|
381
|
+
return c(H, A(e, {
|
|
382
|
+
searchable: !0,
|
|
383
|
+
get values() {
|
|
384
|
+
return [u()];
|
|
385
|
+
},
|
|
386
|
+
get resetValues() {
|
|
387
|
+
return [e.defaultValue ?? ""];
|
|
388
|
+
},
|
|
389
|
+
onValuesChange: (g) => f(g[0] ?? "")
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
function Je(e) {
|
|
393
|
+
const [u, f] = F({
|
|
394
|
+
value: () => e.value,
|
|
395
|
+
defaultValue: e.defaultValue ?? [],
|
|
396
|
+
onChange: (g) => e.onChange?.(g)
|
|
397
|
+
});
|
|
398
|
+
return c(H, A(e, {
|
|
399
|
+
multiple: !0,
|
|
400
|
+
get values() {
|
|
401
|
+
return u();
|
|
402
|
+
},
|
|
403
|
+
get resetValues() {
|
|
404
|
+
return e.defaultValue ?? [];
|
|
405
|
+
},
|
|
406
|
+
onValuesChange: f
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
ue(["click", "pointerdown", "pointermove"]);
|
|
410
|
+
export {
|
|
411
|
+
Ge as Combobox,
|
|
412
|
+
Je as MultiSelect,
|
|
413
|
+
We as Select
|
|
414
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
export interface SliderProps extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'size'> {
|
|
3
|
+
onValueChange?: (value: number) => void;
|
|
4
|
+
valueText?: (value: number) => string;
|
|
5
|
+
}
|
|
6
|
+
/** Native range semantics retain keyboard, pointer, reset and form behavior. */
|
|
7
|
+
export declare function Slider(props: SliderProps): JSX.Element;
|