@middag-io/react 0.27.0 → 0.28.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-lib/{FormPanelBlock-B7Rc-PLS.js → FormPanelBlock-Cd_uiDze.js} +2 -1
- package/dist-lib/{FormSection-C7bOS9Wy.js → FormSection-B6Tcbwrf.js} +43 -39
- package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
- package/dist-lib/base/form/FormField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/EntityPickerField.d.ts +3 -1
- package/dist-lib/base/form/fields/EntityPickerField.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
- package/dist-lib/base/shell/BasicShell.d.ts.map +1 -1
- package/dist-lib/middag-react.css +1 -1
- package/dist-lib/middag-react.js +683 -629
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./utils-Yj2czlvU.js";
|
|
2
|
-
import { B as t, C as n, E as r, F as i, H as a, O as o, P as s, R as c, S as l, T as u, U as d, V as f, _ as p, a as m, at as h, c as g, ct as _, d as v, f as y, ft as b, g as x, gt as S, h as C, ht as ee, i as w, l as T, lt as E, m as D, mt as O, n as k, o as A, ot as te, p as ne, r as re, s as j, st as ie, t as ae, u as oe, ut as se, v as ce, w as le, z as ue } from "./FormSection-
|
|
2
|
+
import { B as t, C as n, E as r, F as i, H as a, O as o, P as s, R as c, S as l, T as u, U as d, V as f, _ as p, a as m, at as h, c as g, ct as _, d as v, f as y, ft as b, g as x, gt as S, h as C, ht as ee, i as w, l as T, lt as E, m as D, mt as O, n as k, o as A, ot as te, p as ne, r as re, s as j, st as ie, t as ae, u as oe, ut as se, v as ce, w as le, z as ue } from "./FormSection-B6Tcbwrf.js";
|
|
3
3
|
import { t as M } from "./button-Ba1PcsOx.js";
|
|
4
4
|
import { n as de } from "./i18n-D5Nt1tut.js";
|
|
5
5
|
import { t as fe } from "./skeleton-HpnbVVji.js";
|
|
@@ -1495,6 +1495,7 @@ function en(e, t, r, i, a, o, s, c, u) {
|
|
|
1495
1495
|
options: a.options,
|
|
1496
1496
|
autocompleteHref: a.autocompleteHref,
|
|
1497
1497
|
autocompleteMinChars: a.autocompleteMinChars,
|
|
1498
|
+
initialOption: a.initialOption,
|
|
1498
1499
|
entityAvatarField: a.entityAvatarField,
|
|
1499
1500
|
entitySubtitleField: a.entitySubtitleField,
|
|
1500
1501
|
placeholder: a.placeholder
|
|
@@ -6529,73 +6529,77 @@ process.env.NODE_ENV !== "production" && (Jm.displayName = "NumberFieldInput");
|
|
|
6529
6529
|
function Ym(e) {
|
|
6530
6530
|
return e.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("");
|
|
6531
6531
|
}
|
|
6532
|
-
function Xm({ id: e, value: t, onChange: n, options: r,
|
|
6533
|
-
let { t:
|
|
6532
|
+
function Xm({ id: e, value: t, onChange: n, options: r, initialOption: i, autocompleteHref: a, autocompleteMinChars: o = 2, entityAvatarField: s, entitySubtitleField: c, placeholder: l, disabled: u, required: d, error: f, helpTextId: p, errorId: m }) {
|
|
6533
|
+
let { t: h } = De(), [g, _] = gt(i && t && i.value === t ? i.label : ""), [v, y] = gt([]), [b, x] = gt(!1), S = ht(void 0), C = !!a, w = [f ? m : void 0, p].filter(Boolean).join(" ") || void 0, T = mt(() => [], []), E = mt(() => r ?? T, [r, T]);
|
|
6534
6534
|
ft(() => {
|
|
6535
|
-
if (
|
|
6536
|
-
|
|
6537
|
-
}) : (
|
|
6538
|
-
|
|
6535
|
+
if (C) return S.current && clearTimeout(S.current), g.length < o ? (S.current = setTimeout(() => y([]), 0), () => {
|
|
6536
|
+
S.current && clearTimeout(S.current);
|
|
6537
|
+
}) : (S.current = setTimeout(async () => {
|
|
6538
|
+
x(!0);
|
|
6539
6539
|
try {
|
|
6540
|
-
let e = new URL(
|
|
6541
|
-
e.searchParams.set("q",
|
|
6540
|
+
let e = new URL(a, window.location.origin);
|
|
6541
|
+
e.searchParams.set("q", g);
|
|
6542
6542
|
let t = await fetch(e.toString());
|
|
6543
6543
|
if (t.ok) {
|
|
6544
6544
|
let e = await t.json();
|
|
6545
|
-
|
|
6545
|
+
y((e.items ?? e.data ?? e).map((e) => ({
|
|
6546
6546
|
value: String(e.value ?? e.id),
|
|
6547
6547
|
label: String(e.label ?? e.name ?? e.title ?? ""),
|
|
6548
|
-
subtitle:
|
|
6549
|
-
avatarUrl:
|
|
6548
|
+
subtitle: c ? String(e[c] ?? "") : void 0,
|
|
6549
|
+
avatarUrl: s ? String(e[s] ?? "") : void 0
|
|
6550
6550
|
})));
|
|
6551
6551
|
}
|
|
6552
6552
|
} catch {} finally {
|
|
6553
|
-
|
|
6553
|
+
x(!1);
|
|
6554
6554
|
}
|
|
6555
6555
|
}, 300), () => {
|
|
6556
|
-
|
|
6556
|
+
S.current && clearTimeout(S.current);
|
|
6557
6557
|
});
|
|
6558
6558
|
}, [
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
i,
|
|
6559
|
+
g,
|
|
6560
|
+
C,
|
|
6562
6561
|
a,
|
|
6563
|
-
|
|
6564
|
-
|
|
6562
|
+
o,
|
|
6563
|
+
c,
|
|
6564
|
+
s
|
|
6565
6565
|
]);
|
|
6566
|
-
let
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6566
|
+
let D = C ? v : E, O = mt(() => i && t && i.value === t && !D.some((e) => e.value === t) ? [i, ...D] : D, [
|
|
6567
|
+
D,
|
|
6568
|
+
i,
|
|
6569
|
+
t
|
|
6570
|
+
]), k = mt(() => {
|
|
6571
|
+
if (C || !g) return O;
|
|
6572
|
+
let e = g.toLowerCase();
|
|
6573
|
+
return O.filter((t) => t.label.toLowerCase().includes(e) || t.subtitle?.toLowerCase().includes(e));
|
|
6570
6574
|
}, [
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
]),
|
|
6575
|
+
O,
|
|
6576
|
+
g,
|
|
6577
|
+
C
|
|
6578
|
+
]), A = B((e) => {
|
|
6575
6579
|
n(e ?? "");
|
|
6576
|
-
}, [n]),
|
|
6580
|
+
}, [n]), j = b ? h("middag.ui.form.entity_loading") : g.length < o && C ? h("middag.ui.form.entity_min_chars").replace("{min}", String(o)) : h("middag.ui.form.entity_no_results"), ee = !!s || O.some((e) => e.avatarUrl);
|
|
6577
6581
|
return /* @__PURE__ */ H(be, {
|
|
6578
|
-
items:
|
|
6582
|
+
items: k,
|
|
6579
6583
|
value: t || null,
|
|
6580
|
-
onValueChange:
|
|
6584
|
+
onValueChange: A,
|
|
6581
6585
|
children: [/* @__PURE__ */ V(de, {
|
|
6582
6586
|
id: e,
|
|
6583
|
-
placeholder:
|
|
6584
|
-
disabled:
|
|
6585
|
-
"aria-invalid":
|
|
6586
|
-
"aria-required":
|
|
6587
|
-
"aria-describedby":
|
|
6587
|
+
placeholder: l ?? h("middag.ui.form.entity_search"),
|
|
6588
|
+
disabled: u,
|
|
6589
|
+
"aria-invalid": f ? !0 : void 0,
|
|
6590
|
+
"aria-required": d || void 0,
|
|
6591
|
+
"aria-describedby": w,
|
|
6588
6592
|
showClear: !!t,
|
|
6589
6593
|
showTrigger: !0,
|
|
6590
|
-
value:
|
|
6591
|
-
onChange: (e) =>
|
|
6594
|
+
value: g,
|
|
6595
|
+
onChange: (e) => _(e.target.value)
|
|
6592
6596
|
}), /* @__PURE__ */ H(he, { children: [/* @__PURE__ */ V(ye, {
|
|
6593
6597
|
className: "px-4 py-3 text-sm",
|
|
6594
|
-
children:
|
|
6595
|
-
}), /* @__PURE__ */ V(ge, { children:
|
|
6598
|
+
children: j
|
|
6599
|
+
}), /* @__PURE__ */ V(ge, { children: k.map((e) => /* @__PURE__ */ H(ae, {
|
|
6596
6600
|
value: e.value,
|
|
6597
6601
|
className: "flex items-center gap-2.5 px-3 py-2",
|
|
6598
|
-
children: [
|
|
6602
|
+
children: [ee && /* @__PURE__ */ H(jp, {
|
|
6599
6603
|
className: "h-7 w-7 shrink-0",
|
|
6600
6604
|
children: [e.avatarUrl && /* @__PURE__ */ V(Mp, {
|
|
6601
6605
|
src: e.avatarUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DenseTableBlock.d.ts","sourceRoot":"","sources":["../../../src/base/blocks/DenseTableBlock.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA4C,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAIpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQnD,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAItF,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,CAAC,mBAAmB,CAAC,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"DenseTableBlock.d.ts","sourceRoot":"","sources":["../../../src/base/blocks/DenseTableBlock.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA4C,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAIpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQnD,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAItF,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,CAAC,mBAAmB,CAAC,GAAG,YAAY,CAsSxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/base/form/FormField.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAyB,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAC;AAmDjF,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,wBAAwB,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/base/form/FormField.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAyB,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAC;AAmDjF,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,wBAAwB,EAAE,aAAa,CAAC;AA0C7E,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAoBD,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,cAAc,GAAG,YAAY,CA8DzF"}
|
|
@@ -19,6 +19,8 @@ export interface EntityPickerFieldProps {
|
|
|
19
19
|
value: string;
|
|
20
20
|
onChange: (value: string) => void;
|
|
21
21
|
options?: EntityOption[];
|
|
22
|
+
/** Pre-selected option so the current value renders before async search loads (edit mode). */
|
|
23
|
+
initialOption?: EntityOption;
|
|
22
24
|
autocompleteHref?: string;
|
|
23
25
|
autocompleteMinChars?: number;
|
|
24
26
|
entityAvatarField?: string;
|
|
@@ -30,5 +32,5 @@ export interface EntityPickerFieldProps {
|
|
|
30
32
|
helpTextId?: string;
|
|
31
33
|
errorId?: string;
|
|
32
34
|
}
|
|
33
|
-
export declare function EntityPickerField({ id, value, onChange, options: staticOptions, autocompleteHref, autocompleteMinChars, entityAvatarField, entitySubtitleField, placeholder, disabled, required, error, helpTextId, errorId, }: EntityPickerFieldProps): ReactElement;
|
|
35
|
+
export declare function EntityPickerField({ id, value, onChange, options: staticOptions, initialOption, autocompleteHref, autocompleteMinChars, entityAvatarField, entitySubtitleField, placeholder, disabled, required, error, helpTextId, errorId, }: EntityPickerFieldProps): ReactElement;
|
|
34
36
|
//# sourceMappingURL=EntityPickerField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPickerField.d.ts","sourceRoot":"","sources":["../../../../src/base/form/fields/EntityPickerField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAqD,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAa7F,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD,wBAAgB,iBAAiB,CAAC,EAChC,EAAE,EACF,KAAK,EACL,QAAQ,EACR,OAAO,EAAE,aAAa,EACtB,gBAAgB,EAChB,oBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,UAAU,EACV,OAAO,GACR,EAAE,sBAAsB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"EntityPickerField.d.ts","sourceRoot":"","sources":["../../../../src/base/form/fields/EntityPickerField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAqD,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAa7F,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,8FAA8F;IAC9F,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD,wBAAgB,iBAAiB,CAAC,EAChC,EAAE,EACF,KAAK,EACL,QAAQ,EACR,OAAO,EAAE,aAAa,EACtB,aAAa,EACb,gBAAgB,EAChB,oBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,UAAU,EACV,OAAO,GACR,EAAE,sBAAsB,GAAG,YAAY,CAkKvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/base/partials/DataTable/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAML,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;AAqCf,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,SAAS,CAAC;AAqXjB,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,EAAE,EAC9C,OAAO,EACP,IAAI,EACJ,MAAM,EAAE,UAAU,EAClB,UAAU,EACV,IAAI,EACJ,OAAO,EACP,cAAmB,EACnB,UAAU,EACV,oBAA4B,EAC5B,WAAW,EACX,SAAiB,EACjB,iBAAiB,EAAE,kBAAkB,EACrC,WAAW,EAAE,gBAAqB,EAClC,cAAc,EACd,eAAe,EAAE,gBAAgB,EACjC,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,QAAgB,EAChB,WAAW,EACX,UAAkB,GACnB,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/base/partials/DataTable/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAML,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;AAqCf,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,SAAS,CAAC;AAqXjB,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,EAAE,EAC9C,OAAO,EACP,IAAI,EACJ,MAAM,EAAE,UAAU,EAClB,UAAU,EACV,IAAI,EACJ,OAAO,EACP,cAAmB,EACnB,UAAU,EACV,oBAA4B,EAC5B,WAAW,EACX,SAAiB,EACjB,iBAAiB,EAAE,kBAAkB,EACrC,WAAW,EAAE,gBAAqB,EAClC,cAAc,EACd,eAAe,EAAE,gBAAgB,EACjC,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,QAAgB,EAChB,WAAW,EACX,UAAkB,GACnB,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,YAAY,CAysBjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicShell.d.ts","sourceRoot":"","sources":["../../../src/base/shell/BasicShell.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BasicShell.d.ts","sourceRoot":"","sources":["../../../src/base/shell/BasicShell.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4HnD,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,UAAU,GAAG,YAAY,CAwIjE"}
|