@floegence/floe-webapp-core 0.91.3 → 0.91.5
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/ui/PromptCard.js +105 -100
- package/dist/components/ui/SegmentedControl.js +38 -38
- package/dist/components/ui/Select.d.ts +2 -0
- package/dist/components/ui/Select.js +41 -41
- package/dist/floe.css +2 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createComponent as c, mergeProps as I, insert as o, spread as te, memo as z, effect as P, use as le, setAttribute as m, className as ve, template as w, delegateEvents as ge } from "solid-js/web";
|
|
2
2
|
import { createUniqueId as me, createSignal as B, createMemo as he, createEffect as N, untrack as be, onCleanup as ae, onMount as ye, Show as V, For as Q } from "solid-js";
|
|
3
|
-
import { cn as
|
|
3
|
+
import { cn as ne } from "../../utils/cn.js";
|
|
4
4
|
import { useFloeLocale as we } from "../../context/LocaleContext.js";
|
|
5
5
|
import { useOverlayMask as Ce } from "../../hooks/useOverlayMask.js";
|
|
6
6
|
import { SurfaceFloatingLayer as xe } from "./SurfaceFloatingLayer.js";
|
|
@@ -12,7 +12,7 @@ import { ChevronDown as $e, Check as Ee } from "../icons/index.js";
|
|
|
12
12
|
import { resolveSurfacePortalBoundaryRect as De, resolveSurfacePortalHost as Pe } from "./dialogSurfaceScope.js";
|
|
13
13
|
var Se = /* @__PURE__ */ w("<input>"), _e = /* @__PURE__ */ w("<option value>"), qe = /* @__PURE__ */ w('<div role=status class="px-2 py-2 text-caption">'), Ae = /* @__PURE__ */ w("<button type=button>"), Fe = /* @__PURE__ */ w('<div role=alert class="p-2 text-error">'), Te = /* @__PURE__ */ w('<div role=status class="p-2 text-caption">'), Be = /* @__PURE__ */ w('<div class="floe-floating-presence floe-floating-menu rounded-panel border border-[var(--floe-line)] bg-popover text-popover-foreground shadow-[var(--floe-elevation-float)] p-1"data-floe-surface=floating><div role=listbox class="max-h-64 overflow-y-auto"data-floe-local-interaction-surface=true>'), Ie = /* @__PURE__ */ w('<div class="relative min-w-0"><select tabindex=-1 aria-hidden=true class="sr-only pointer-events-none">'), Re = /* @__PURE__ */ w("<button><span class=truncate>"), ze = /* @__PURE__ */ w("<option selected>"), Ke = /* @__PURE__ */ w("<option>"), Me = /* @__PURE__ */ w('<div role=option><span class="h-3.5 w-3.5 shrink-0">');
|
|
14
14
|
function U(e) {
|
|
15
|
-
const u = we(), g = Le(), b = me(), W = () => e.id ?? g.id ?? "select-" + b, S = "options-" + b, _ = () => e.disabled ?? g.disabled, q = () => e.readOnly ?? g.readOnly, [h,
|
|
15
|
+
const u = we(), g = Le(), b = me(), W = () => e.id ?? g.id ?? "select-" + b, S = "options-" + b, _ = () => e.disabled ?? g.disabled, q = () => e.readOnly ?? g.readOnly, [h, re] = K({
|
|
16
16
|
value: () => e.open,
|
|
17
17
|
defaultValue: e.defaultOpen ?? !1,
|
|
18
18
|
onChange: (t) => e.onOpenChange?.(t)
|
|
@@ -31,19 +31,19 @@ function U(e) {
|
|
|
31
31
|
const t = M().toLocaleLowerCase(u.locale);
|
|
32
32
|
return e.options.filter((a) => [a.label, ...a.keywords ?? []].some((i) => i.toLocaleLowerCase(u.locale).includes(t)));
|
|
33
33
|
}), X = () => e.values.map((t) => e.options.find((a) => a.value === t)?.label ?? t).join(", "), y = (t) => {
|
|
34
|
-
t && (_() || q()) || (
|
|
34
|
+
t && (_() || q()) || (re(t), t || G(""));
|
|
35
35
|
}, j = (t) => {
|
|
36
36
|
_() || q() || t.disabled || (e.onValuesChange(e.multiple ? e.values.includes(t.value) ? e.values.filter((a) => a !== t.value) : [...e.values, t.value] : [t.value]), e.multiple || y(!1), x?.focus({
|
|
37
37
|
preventScroll: !0
|
|
38
|
-
}));
|
|
38
|
+
}), e.onOptionSelect?.(t));
|
|
39
39
|
}, Y = (t, a) => {
|
|
40
|
-
const i = C().map((v,
|
|
40
|
+
const i = C().map((v, n) => v.disabled ? -1 : n).filter((v) => v >= 0);
|
|
41
41
|
if (!i.length) {
|
|
42
42
|
E(-1);
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const l = i.indexOf(L()),
|
|
46
|
-
E(i[
|
|
45
|
+
const l = i.indexOf(L()), r = a === "first" ? 0 : a === "last" ? i.length - 1 : l < 0 ? t < 0 ? i.length - 1 : 0 : (l + t + i.length) % i.length;
|
|
46
|
+
E(i[r]), k?.querySelector('[id="' + S + "-" + i[r] + '"]')?.scrollIntoView({
|
|
47
47
|
block: "nearest"
|
|
48
48
|
});
|
|
49
49
|
}, fe = () => {
|
|
@@ -101,7 +101,7 @@ function U(e) {
|
|
|
101
101
|
const i = (l) => {
|
|
102
102
|
clearTimeout(a), a = setTimeout(() => {
|
|
103
103
|
if (!l.defaultPrevented && (e.onValuesChange([...e.resetValues]), y(!1), O))
|
|
104
|
-
for (const
|
|
104
|
+
for (const r of O.options) r.selected = e.values.includes(r.value);
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
t?.addEventListener("reset", i), ae(() => {
|
|
@@ -152,7 +152,7 @@ function U(e) {
|
|
|
152
152
|
"data-floe-dropdown-trigger": "",
|
|
153
153
|
"data-floe-surface": "inset",
|
|
154
154
|
get class() {
|
|
155
|
-
return
|
|
155
|
+
return ne("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);
|
|
156
156
|
},
|
|
157
157
|
onKeyDown: (t) => {
|
|
158
158
|
if (!(_() || q() || t.isComposing)) {
|
|
@@ -198,11 +198,11 @@ function U(e) {
|
|
|
198
198
|
},
|
|
199
199
|
get fallback() {
|
|
200
200
|
return (() => {
|
|
201
|
-
var l = Re(),
|
|
201
|
+
var l = Re(), r = l.firstChild;
|
|
202
202
|
return te(l, I(Z, {
|
|
203
203
|
type: "button",
|
|
204
204
|
onClick: () => y(!h())
|
|
205
|
-
}), !1, !0), o(
|
|
205
|
+
}), !1, !0), o(r, () => X() || e.placeholder || u.t("selectPlaceholder")), o(l, c($e, {
|
|
206
206
|
class: "h-3.5 w-3.5 shrink-0"
|
|
207
207
|
}), null), l;
|
|
208
208
|
})();
|
|
@@ -223,12 +223,12 @@ function U(e) {
|
|
|
223
223
|
return z(() => !!h())() ? M() : X();
|
|
224
224
|
},
|
|
225
225
|
onClick: () => y(!0),
|
|
226
|
-
onInput: (
|
|
227
|
-
G(
|
|
226
|
+
onInput: (r) => {
|
|
227
|
+
G(r.currentTarget.value), E(-1), y(!0), e.onQueryChange?.(r.currentTarget.value);
|
|
228
228
|
}
|
|
229
229
|
}), !1, !1), l;
|
|
230
230
|
}
|
|
231
|
-
}), a), a.addEventListener("change", (l) => e.onValuesChange(Array.from(l.currentTarget.selectedOptions, (
|
|
231
|
+
}), a), a.addEventListener("change", (l) => e.onValuesChange(Array.from(l.currentTarget.selectedOptions, (r) => r.value))), a.addEventListener("invalid", (l) => {
|
|
232
232
|
l.preventDefault(), x?.focus();
|
|
233
233
|
});
|
|
234
234
|
var i = O;
|
|
@@ -242,25 +242,25 @@ function U(e) {
|
|
|
242
242
|
}
|
|
243
243
|
}), null), o(a, c(Q, {
|
|
244
244
|
get each() {
|
|
245
|
-
return e.values.filter((l) => l !== "" && !e.options.some((
|
|
245
|
+
return e.values.filter((l) => l !== "" && !e.options.some((r) => r.value === l));
|
|
246
246
|
},
|
|
247
247
|
children: (l) => (() => {
|
|
248
|
-
var
|
|
249
|
-
return
|
|
248
|
+
var r = ze();
|
|
249
|
+
return r.value = l, o(r, l), r;
|
|
250
250
|
})()
|
|
251
251
|
}), null), o(a, c(Q, {
|
|
252
252
|
get each() {
|
|
253
253
|
return e.options;
|
|
254
254
|
},
|
|
255
255
|
children: (l) => (() => {
|
|
256
|
-
var
|
|
257
|
-
return o(
|
|
258
|
-
var
|
|
259
|
-
return
|
|
256
|
+
var r = Ke();
|
|
257
|
+
return o(r, () => l.label), P((v) => {
|
|
258
|
+
var n = e.values.includes(l.value), f = l.disabled;
|
|
259
|
+
return n !== v.e && (r.selected = v.e = n), f !== v.t && (r.disabled = v.t = f), v;
|
|
260
260
|
}, {
|
|
261
261
|
e: void 0,
|
|
262
262
|
t: void 0
|
|
263
|
-
}), P(() =>
|
|
263
|
+
}), P(() => r.value = l.value), r;
|
|
264
264
|
})()
|
|
265
265
|
}), null), o(t, c(V, {
|
|
266
266
|
get when() {
|
|
@@ -287,22 +287,22 @@ function U(e) {
|
|
|
287
287
|
};
|
|
288
288
|
},
|
|
289
289
|
get children() {
|
|
290
|
-
var l = Be(),
|
|
290
|
+
var l = Be(), r = l.firstChild, v = k;
|
|
291
291
|
return typeof v == "function" ? le(v, l) : k = l, o(l, c(V, {
|
|
292
292
|
get when() {
|
|
293
293
|
return e.loading;
|
|
294
294
|
},
|
|
295
295
|
get children() {
|
|
296
|
-
var
|
|
297
|
-
return o(
|
|
296
|
+
var n = qe();
|
|
297
|
+
return o(n, () => u.t("loading")), n;
|
|
298
298
|
}
|
|
299
|
-
}),
|
|
299
|
+
}), r), o(l, c(V, {
|
|
300
300
|
get when() {
|
|
301
301
|
return e.error;
|
|
302
302
|
},
|
|
303
303
|
get children() {
|
|
304
|
-
var
|
|
305
|
-
return o(
|
|
304
|
+
var n = Fe();
|
|
305
|
+
return o(n, () => e.error, null), o(n, c(V, {
|
|
306
306
|
get when() {
|
|
307
307
|
return e.onRetry;
|
|
308
308
|
},
|
|
@@ -310,17 +310,17 @@ function U(e) {
|
|
|
310
310
|
var f = Ae();
|
|
311
311
|
return f.$$click = () => e.onRetry?.(), o(f, () => u.t("retry")), f;
|
|
312
312
|
}
|
|
313
|
-
}), null),
|
|
313
|
+
}), null), n;
|
|
314
314
|
}
|
|
315
|
-
}),
|
|
315
|
+
}), r), m(r, "id", S), o(r, c(Q, {
|
|
316
316
|
get each() {
|
|
317
317
|
return C();
|
|
318
318
|
},
|
|
319
|
-
children: (
|
|
319
|
+
children: (n, f) => (() => {
|
|
320
320
|
var s = Me(), $ = s.firstChild;
|
|
321
|
-
return s.$$click = () => j(
|
|
321
|
+
return s.$$click = () => j(n), s.$$pointermove = () => !n.disabled && E(f()), s.$$pointerdown = (d) => d.preventDefault(), o($, c(V, {
|
|
322
322
|
get when() {
|
|
323
|
-
return e.values.includes(
|
|
323
|
+
return e.values.includes(n.value);
|
|
324
324
|
},
|
|
325
325
|
get children() {
|
|
326
326
|
return c(Ee, {
|
|
@@ -329,9 +329,9 @@ function U(e) {
|
|
|
329
329
|
}
|
|
330
330
|
})), o(s, (() => {
|
|
331
331
|
var d = z(() => !!e.renderOption);
|
|
332
|
-
return () => d() ? e.renderOption(
|
|
332
|
+
return () => d() ? e.renderOption(n) : n.label;
|
|
333
333
|
})(), null), P((d) => {
|
|
334
|
-
var A = S + "-" + f(), F = e.values.includes(
|
|
334
|
+
var A = S + "-" + f(), F = e.values.includes(n.value), T = n.disabled || void 0, p = e.values.includes(n.value) ? "true" : void 0, ee = ne("flex min-h-[var(--floe-row-height)] items-center gap-2 rounded-sm px-2 text-[length:var(--floe-type-control)]", L() === f() && "bg-accent text-accent-foreground", n.disabled ? "opacity-50" : "cursor-pointer");
|
|
335
335
|
return A !== d.e && m(s, "id", d.e = A), F !== d.t && m(s, "aria-selected", d.t = F), T !== d.a && m(s, "aria-disabled", d.a = T), p !== d.o && m(s, "data-floe-selected", d.o = p), ee !== d.i && ve(s, d.i = ee), d;
|
|
336
336
|
}, {
|
|
337
337
|
e: void 0,
|
|
@@ -346,12 +346,12 @@ function U(e) {
|
|
|
346
346
|
return z(() => !C().length && !e.loading)() && !e.error;
|
|
347
347
|
},
|
|
348
348
|
get children() {
|
|
349
|
-
var
|
|
350
|
-
return o(
|
|
349
|
+
var n = Te();
|
|
350
|
+
return o(n, () => u.t("noResults")), n;
|
|
351
351
|
}
|
|
352
|
-
}), null), P((
|
|
352
|
+
}), null), P((n) => {
|
|
353
353
|
var f = D.state(), s = se(), $ = D.exiting(), d = D.exiting() ? "true" : void 0, A = e.ariaLabel, F = e.ariaLabelledBy ?? (e.ariaLabel ? void 0 : W()), T = e.multiple || void 0;
|
|
354
|
-
return f !==
|
|
354
|
+
return f !== n.e && m(l, "data-floating-presence", n.e = f), s !== n.t && m(l, "data-floating-side", n.t = s), $ !== n.a && (l.inert = n.a = $), d !== n.o && m(l, "aria-hidden", n.o = d), A !== n.i && m(r, "aria-label", n.i = A), F !== n.n && m(r, "aria-labelledby", n.n = F), T !== n.s && m(r, "aria-multiselectable", n.s = T), n;
|
|
355
355
|
}, {
|
|
356
356
|
e: void 0,
|
|
357
357
|
t: void 0,
|
|
@@ -365,8 +365,8 @@ function U(e) {
|
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
}), null), P((l) => {
|
|
368
|
-
var
|
|
369
|
-
return
|
|
368
|
+
var r = u.direction, v = e.name ?? g.name, n = e.form, f = e.required ?? g.required, s = _(), $ = e.multiple;
|
|
369
|
+
return r !== l.e && m(t, "dir", l.e = r), v !== l.t && m(a, "name", l.t = v), n !== l.a && m(a, "form", l.a = n), f !== l.o && (a.required = l.o = f), s !== l.i && (a.disabled = l.i = s), $ !== l.n && (a.multiple = l.n = $), l;
|
|
370
370
|
}, {
|
|
371
371
|
e: void 0,
|
|
372
372
|
t: void 0,
|
package/dist/floe.css
CHANGED
|
@@ -1055,7 +1055,8 @@
|
|
|
1055
1055
|
.floe-prompt-card-input {
|
|
1056
1056
|
display: block; width: 100%; min-height: 2.5rem; max-height: min(10rem, 30dvh);
|
|
1057
1057
|
padding: var(--floe-pad-tight) 0; border: 0; border-radius: 0;
|
|
1058
|
-
background: transparent;
|
|
1058
|
+
background: transparent; color: var(--floe-ink); caret-color: var(--floe-ink);
|
|
1059
|
+
font: inherit; line-height: 1.5;
|
|
1059
1060
|
field-sizing: content; resize: none;
|
|
1060
1061
|
}
|
|
1061
1062
|
.floe-prompt-card-input::placeholder { color: var(--floe-field-placeholder); }
|