@namroodinc/liquid-editorial 0.14.0 → 0.16.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/README.md +283 -12
- package/UPGRADING.md +106 -0
- package/dist/chunks/{Avatar-Dw7EWd_-.cjs → Avatar-BZGFSE6C.cjs} +2 -2
- package/dist/chunks/{Avatar-Dw7EWd_-.cjs.map → Avatar-BZGFSE6C.cjs.map} +1 -1
- package/dist/chunks/{Avatar-BToMaTdL.js → Avatar-C4W-g8nU.js} +2 -2
- package/dist/chunks/{Avatar-BToMaTdL.js.map → Avatar-C4W-g8nU.js.map} +1 -1
- package/dist/chunks/{Board-XeDG9nWP.js → Board-Cbi5FMW-.js} +2 -2
- package/dist/chunks/{Board-XeDG9nWP.js.map → Board-Cbi5FMW-.js.map} +1 -1
- package/dist/chunks/{Board-DeXtaWNO.cjs → Board-_agEjTy8.cjs} +2 -2
- package/dist/chunks/{Board-DeXtaWNO.cjs.map → Board-_agEjTy8.cjs.map} +1 -1
- package/dist/chunks/{CollectionView-Dbg4d_tA.cjs → CollectionView-BfX2Lxre.cjs} +2 -2
- package/dist/chunks/{CollectionView-Dbg4d_tA.cjs.map → CollectionView-BfX2Lxre.cjs.map} +1 -1
- package/dist/chunks/{CollectionView-C0_bTO2v.js → CollectionView-DPJGtSP5.js} +2 -2
- package/dist/chunks/{CollectionView-C0_bTO2v.js.map → CollectionView-DPJGtSP5.js.map} +1 -1
- package/dist/chunks/{ColourField-DAFzOIOq.cjs → ColourField-BVGnW8Wh.cjs} +2 -2
- package/dist/chunks/{ColourField-DAFzOIOq.cjs.map → ColourField-BVGnW8Wh.cjs.map} +1 -1
- package/dist/chunks/{ColourField-Bb8H87fg.js → ColourField-BcuARZY4.js} +6 -6
- package/dist/chunks/{ColourField-Bb8H87fg.js.map → ColourField-BcuARZY4.js.map} +1 -1
- package/dist/chunks/{DatePicker-COm1giw8.js → DatePicker-VQUsbYdo.js} +3 -3
- package/dist/chunks/{DatePicker-COm1giw8.js.map → DatePicker-VQUsbYdo.js.map} +1 -1
- package/dist/chunks/{DatePicker-DOg3iQYy.cjs → DatePicker-zA0bWVBp.cjs} +2 -2
- package/dist/chunks/{DatePicker-DOg3iQYy.cjs.map → DatePicker-zA0bWVBp.cjs.map} +1 -1
- package/dist/chunks/{Drawer-nUTJtwX_.js → Drawer-2cf0SaG4.js} +3 -3
- package/dist/chunks/{Drawer-nUTJtwX_.js.map → Drawer-2cf0SaG4.js.map} +1 -1
- package/dist/chunks/{Drawer-B2dcTh5l.cjs → Drawer-BzvSfkCL.cjs} +2 -2
- package/dist/chunks/{Drawer-B2dcTh5l.cjs.map → Drawer-BzvSfkCL.cjs.map} +1 -1
- package/dist/chunks/EntryPicker-C7EBfpaw.cjs +2 -0
- package/dist/chunks/EntryPicker-C7EBfpaw.cjs.map +1 -0
- package/dist/chunks/{EntryPicker-Ie9T47hA.js → EntryPicker-DBnDsgzi.js} +397 -397
- package/dist/chunks/EntryPicker-DBnDsgzi.js.map +1 -0
- package/dist/chunks/FormEditor-BG8bOXI8.js +35 -0
- package/dist/chunks/FormEditor-BG8bOXI8.js.map +1 -0
- package/dist/chunks/FormEditor-BJN0QuLI.cjs +2 -0
- package/dist/chunks/FormEditor-BJN0QuLI.cjs.map +1 -0
- package/dist/chunks/Icon-QLZH31JA.cjs +2 -0
- package/dist/chunks/Icon-QLZH31JA.cjs.map +1 -0
- package/dist/chunks/Icon-kLLQC54Z.js +107 -0
- package/dist/chunks/Icon-kLLQC54Z.js.map +1 -0
- package/dist/chunks/{Message-VJTPhId7.js → Message-DM6pTq7N.js} +2 -2
- package/dist/chunks/{Message-VJTPhId7.js.map → Message-DM6pTq7N.js.map} +1 -1
- package/dist/chunks/{Message-B0A5bz8V.cjs → Message-yZJDVzb8.cjs} +2 -2
- package/dist/chunks/{Message-B0A5bz8V.cjs.map → Message-yZJDVzb8.cjs.map} +1 -1
- package/dist/chunks/{NumberField-C90eJGny.js → NumberField-CVsK4l9P.js} +13 -13
- package/dist/chunks/{NumberField-C90eJGny.js.map → NumberField-CVsK4l9P.js.map} +1 -1
- package/dist/chunks/{NumberField-BrWFmPkW.cjs → NumberField-Ccjpa_1d.cjs} +2 -2
- package/dist/chunks/{NumberField-BrWFmPkW.cjs.map → NumberField-Ccjpa_1d.cjs.map} +1 -1
- package/dist/chunks/RichTextEditor-D4rNww9d.cjs +2 -0
- package/dist/chunks/RichTextEditor-D4rNww9d.cjs.map +1 -0
- package/dist/chunks/RichTextEditor-DSxiMLVd.js +2832 -0
- package/dist/chunks/RichTextEditor-DSxiMLVd.js.map +1 -0
- package/dist/chunks/dialogLabel-Dx-WEEzI.cjs +2 -0
- package/dist/chunks/dialogLabel-Dx-WEEzI.cjs.map +1 -0
- package/dist/chunks/dialogLabel-nB1gwKz0.js +157 -0
- package/dist/chunks/dialogLabel-nB1gwKz0.js.map +1 -0
- package/dist/chunks/overlayLayer-CPd3zj_u.cjs +2 -0
- package/dist/chunks/overlayLayer-CPd3zj_u.cjs.map +1 -0
- package/dist/chunks/overlayLayer-Dv1vmfaI.js +199 -0
- package/dist/chunks/overlayLayer-Dv1vmfaI.js.map +1 -0
- package/dist/chunks/{useTooltip-Du8PutGX.js → useTooltip-COyAcujL.js} +2 -2
- package/dist/chunks/{useTooltip-Du8PutGX.js.map → useTooltip-COyAcujL.js.map} +1 -1
- package/dist/chunks/{useTooltip-ekdwMJFz.cjs → useTooltip-nEDN0ObI.cjs} +2 -2
- package/dist/chunks/{useTooltip-ekdwMJFz.cjs.map → useTooltip-nEDN0ObI.cjs.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.js +5 -5
- package/dist/components/CollectionView/index.cjs +1 -1
- package/dist/components/CollectionView/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.js +6 -7
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/style.css +1 -1
- package/dist/components/FormEditor/README.md +205 -178
- package/dist/components/FormEditor/control.d.cts +4 -4
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +4 -4
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/form.d.cts +3 -3
- package/dist/components/FormEditor/form.d.cts.map +1 -1
- package/dist/components/FormEditor/form.d.ts +3 -3
- package/dist/components/FormEditor/form.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +2 -2
- package/dist/components/FormEditor/model.d.cts +2 -0
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +2 -0
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/FormEditor/rich-text-control.d.cts +1 -2
- package/dist/components/FormEditor/rich-text-control.d.cts.map +1 -1
- package/dist/components/FormEditor/rich-text-control.d.ts +1 -2
- package/dist/components/FormEditor/rich-text-control.d.ts.map +1 -1
- package/dist/components/Icon/icons.d.cts +5 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +5 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.js +6 -6
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.js +9 -9
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +67 -64
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/RichTextEditor/block-plugins.d.cts +62 -0
- package/dist/components/RichTextEditor/block-plugins.d.cts.map +1 -0
- package/dist/components/RichTextEditor/block-plugins.d.ts +62 -0
- package/dist/components/RichTextEditor/block-plugins.d.ts.map +1 -0
- package/dist/components/RichTextEditor/content-block-frame.d.cts +32 -0
- package/dist/components/RichTextEditor/content-block-frame.d.cts.map +1 -0
- package/dist/components/RichTextEditor/content-block-frame.d.ts +32 -0
- package/dist/components/RichTextEditor/content-block-frame.d.ts.map +1 -0
- package/dist/components/RichTextEditor/content-block-view.d.cts +3 -0
- package/dist/components/RichTextEditor/content-block-view.d.cts.map +1 -0
- package/dist/components/RichTextEditor/content-block-view.d.ts +3 -0
- package/dist/components/RichTextEditor/content-block-view.d.ts.map +1 -0
- package/dist/components/RichTextEditor/content-block.d.cts +10 -0
- package/dist/components/RichTextEditor/content-block.d.cts.map +1 -0
- package/dist/components/RichTextEditor/content-block.d.ts +10 -0
- package/dist/components/RichTextEditor/content-block.d.ts.map +1 -0
- package/dist/components/RichTextEditor/document.d.cts +24 -8
- package/dist/components/RichTextEditor/document.d.cts.map +1 -1
- package/dist/components/RichTextEditor/document.d.ts +24 -8
- package/dist/components/RichTextEditor/document.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts +6 -4
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts +6 -4
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RichTextEditor/picker-block.d.cts +25 -0
- package/dist/components/RichTextEditor/picker-block.d.cts.map +1 -0
- package/dist/components/RichTextEditor/picker-block.d.ts +25 -0
- package/dist/components/RichTextEditor/picker-block.d.ts.map +1 -0
- package/dist/components/RichTextEditor/style.css +126 -49
- package/dist/components/RichTextEditor/table-actions.d.cts +11 -0
- package/dist/components/RichTextEditor/table-actions.d.cts.map +1 -0
- package/dist/components/RichTextEditor/table-actions.d.ts +11 -0
- package/dist/components/RichTextEditor/table-actions.d.ts.map +1 -0
- package/dist/components/RichTextEditor/table-bands.d.cts +19 -0
- package/dist/components/RichTextEditor/table-bands.d.cts.map +1 -0
- package/dist/components/RichTextEditor/table-bands.d.ts +19 -0
- package/dist/components/RichTextEditor/table-bands.d.ts.map +1 -0
- package/dist/components/RichTextEditor/table-view.d.cts +4 -0
- package/dist/components/RichTextEditor/table-view.d.cts.map +1 -0
- package/dist/components/RichTextEditor/table-view.d.ts +4 -0
- package/dist/components/RichTextEditor/table-view.d.ts.map +1 -0
- package/dist/components/RichTextEditor/tables.d.cts.map +1 -1
- package/dist/components/RichTextEditor/tables.d.ts.map +1 -1
- package/dist/components/RichTextEditor/use-blocks.d.cts +19 -0
- package/dist/components/RichTextEditor/use-blocks.d.cts.map +1 -0
- package/dist/components/RichTextEditor/use-blocks.d.ts +19 -0
- package/dist/components/RichTextEditor/use-blocks.d.ts.map +1 -0
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +2 -2
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.js +4 -4
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Switch/style.css +2 -6
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -49
- package/dist/internal/useStableValue.d.cts +8 -0
- package/dist/internal/useStableValue.d.cts.map +1 -0
- package/dist/internal/useStableValue.d.ts +8 -0
- package/dist/internal/useStableValue.d.ts.map +1 -0
- package/dist/rich-text-blocks.cjs +2 -0
- package/dist/rich-text-blocks.cjs.map +1 -0
- package/dist/rich-text-blocks.d.cts +20 -0
- package/dist/rich-text-blocks.d.cts.map +1 -0
- package/dist/rich-text-blocks.d.ts +20 -0
- package/dist/rich-text-blocks.d.ts.map +1 -0
- package/dist/rich-text-blocks.js +36 -0
- package/dist/rich-text-blocks.js.map +1 -0
- package/package.json +14 -1
- package/dist/chunks/EntryPicker-BwEYRtQl.cjs +0 -2
- package/dist/chunks/EntryPicker-BwEYRtQl.cjs.map +0 -1
- package/dist/chunks/EntryPicker-Ie9T47hA.js.map +0 -1
- package/dist/chunks/FormEditor-D1HUnjMI.cjs +0 -2
- package/dist/chunks/FormEditor-D1HUnjMI.cjs.map +0 -1
- package/dist/chunks/FormEditor-DgDV5aeR.js +0 -30
- package/dist/chunks/FormEditor-DgDV5aeR.js.map +0 -1
- package/dist/chunks/Icon-Bxvp1-td.js +0 -102
- package/dist/chunks/Icon-Bxvp1-td.js.map +0 -1
- package/dist/chunks/Icon-CnnTrtNb.cjs +0 -2
- package/dist/chunks/Icon-CnnTrtNb.cjs.map +0 -1
- package/dist/chunks/RichTextEditor-DPhEkDxi.js +0 -2108
- package/dist/chunks/RichTextEditor-DPhEkDxi.js.map +0 -1
- package/dist/chunks/RichTextEditor-DV7NZp_k.cjs +0 -2
- package/dist/chunks/RichTextEditor-DV7NZp_k.cjs.map +0 -1
- package/dist/chunks/dialogLabel-C153NosD.js +0 -176
- package/dist/chunks/dialogLabel-C153NosD.js.map +0 -1
- package/dist/chunks/dialogLabel-CNNQbtob.cjs +0 -2
- package/dist/chunks/dialogLabel-CNNQbtob.cjs.map +0 -1
- package/dist/chunks/overlayLayer-CtOTt1xB.cjs +0 -2
- package/dist/chunks/overlayLayer-CtOTt1xB.cjs.map +0 -1
- package/dist/chunks/overlayLayer-Og07sIyl.js +0 -180
- package/dist/chunks/overlayLayer-Og07sIyl.js.map +0 -1
- package/dist/components/RichTextEditor/embed-context.d.cts +0 -41
- package/dist/components/RichTextEditor/embed-context.d.cts.map +0 -1
- package/dist/components/RichTextEditor/embed-context.d.ts +0 -41
- package/dist/components/RichTextEditor/embed-context.d.ts.map +0 -1
- package/dist/components/RichTextEditor/embed-types.d.cts +0 -29
- package/dist/components/RichTextEditor/embed-types.d.cts.map +0 -1
- package/dist/components/RichTextEditor/embed-types.d.ts +0 -29
- package/dist/components/RichTextEditor/embed-types.d.ts.map +0 -1
- package/dist/components/RichTextEditor/storyblock-view.d.cts +0 -3
- package/dist/components/RichTextEditor/storyblock-view.d.cts.map +0 -1
- package/dist/components/RichTextEditor/storyblock-view.d.ts +0 -3
- package/dist/components/RichTextEditor/storyblock-view.d.ts.map +0 -1
- package/dist/components/RichTextEditor/storyblock.d.cts +0 -19
- package/dist/components/RichTextEditor/storyblock.d.cts.map +0 -1
- package/dist/components/RichTextEditor/storyblock.d.ts +0 -19
- package/dist/components/RichTextEditor/storyblock.d.ts.map +0 -1
- package/dist/components/RichTextEditor/use-embeds.d.cts +0 -31
- package/dist/components/RichTextEditor/use-embeds.d.cts.map +0 -1
- package/dist/components/RichTextEditor/use-embeds.d.ts +0 -31
- package/dist/components/RichTextEditor/use-embeds.d.ts.map +0 -1
|
@@ -1,30 +1,101 @@
|
|
|
1
|
-
import { t as e } from "./Icon-
|
|
1
|
+
import { t as e } from "./Icon-kLLQC54Z.js";
|
|
2
2
|
import { Button as t } from "../components/Button/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { b as n, h as r, u as i } from "./overlayLayer-Dv1vmfaI.js";
|
|
4
4
|
import { Badge as a } from "../components/Badge/index.js";
|
|
5
5
|
import { r as o } from "./limit-s9zfxIMC.js";
|
|
6
6
|
import { LimitReading as s } from "../components/LimitReading/index.js";
|
|
7
7
|
import { Modal as c } from "../components/Modal/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import { Stack as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { t as l } from "./style-7Z_xRlQx.js";
|
|
9
|
+
import { Stack as u } from "../components/Grid/index.js";
|
|
10
|
+
import { n as d, r as f, t as p } from "./LoadState-B056EPu7.js";
|
|
11
|
+
import { SearchField as m } from "../components/SearchField/index.js";
|
|
12
12
|
import { Checkbox as h } from "../components/Choice/index.js";
|
|
13
13
|
import { SortableList as g, SortableListItem as _ } from "../components/SortableList/index.js";
|
|
14
14
|
import { useEffect as v, useId as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
15
15
|
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
16
|
+
//#region src/components/EntryPicker/feedback.tsx
|
|
17
|
+
function E(e, t, n, r) {
|
|
18
|
+
let i = d(t, n, r);
|
|
19
|
+
return t !== "error" && i.state !== "pending" ? null : /* @__PURE__ */ w(f, {
|
|
20
|
+
title: e,
|
|
21
|
+
error: i.error,
|
|
22
|
+
onRetry: i.retry,
|
|
23
|
+
retryState: i.state
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function D({ query: e, itemLabel: t, itemsLabel: n, canCreate: r }) {
|
|
27
|
+
let i = e.trim();
|
|
28
|
+
return /* @__PURE__ */ T("div", {
|
|
29
|
+
className: "ds-entry-picker__no-results",
|
|
30
|
+
children: [/* @__PURE__ */ w("p", { children: i ? `No ${n} match “${i}”` : `No ${n} yet` }), i && /* @__PURE__ */ T("p", { children: ["Try a different search.", r ? ` Or create the ${t} you need.` : ""] })]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function O(e, t) {
|
|
34
|
+
let r = e.closest(".ds-entry-picker__scroll") ?? e.parentElement, i = Array.from(r?.querySelectorAll(".ds-entry-picker__result") ?? []);
|
|
35
|
+
for (let e of [...i.slice(t), ...i.slice(0, t).reverse()]) {
|
|
36
|
+
let t = n(e)[0];
|
|
37
|
+
if (t) return t;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function k(e) {
|
|
41
|
+
let t = x(null), i = x(null), { more: a, offset: o } = e;
|
|
42
|
+
return v(() => {
|
|
43
|
+
let e = i.current, o = t.current;
|
|
44
|
+
e !== null && a.status !== "loading" && (i.current = null, o && r(document.activeElement) && (a.status === "error" ? n(o)[0] : O(o, e))?.focus());
|
|
45
|
+
}, [a.status, o]), {
|
|
46
|
+
pagingRef: t,
|
|
47
|
+
load: () => {
|
|
48
|
+
i.current = t.current?.contains(document.activeElement) ? o : null, a.load();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function A(e, t) {
|
|
53
|
+
let i = x(t);
|
|
54
|
+
v(() => {
|
|
55
|
+
if (i.current === t) return;
|
|
56
|
+
i.current = t;
|
|
57
|
+
let a = e.current;
|
|
58
|
+
a && r(document.activeElement) && (n(a)[0] ?? O(a, Infinity))?.focus();
|
|
59
|
+
}, [e, t]);
|
|
60
|
+
}
|
|
61
|
+
function j({ count: e, total: n, isRemote: r, pageSize: i, remote: a, itemsLabel: o }) {
|
|
62
|
+
let { more: s } = a, { pagingRef: c, load: l } = k(a), u = E(`Couldn't load more ${o}`, s.status, s.error, l);
|
|
63
|
+
return A(c, u ? "failure" : r && a.hasMore ? "more" : "none"), n === 0 ? null : /* @__PURE__ */ T("div", {
|
|
64
|
+
ref: c,
|
|
65
|
+
className: "ds-entry-picker__paging",
|
|
66
|
+
children: [u ?? (r && a.hasMore && /* @__PURE__ */ T(t, {
|
|
67
|
+
isPending: s.status === "loading",
|
|
68
|
+
isFocusableWhenDisabled: !0,
|
|
69
|
+
isDisabled: !s.isAvailable,
|
|
70
|
+
onClick: l,
|
|
71
|
+
children: [
|
|
72
|
+
"Load ",
|
|
73
|
+
Math.min(i, n - a.offset),
|
|
74
|
+
" more"
|
|
75
|
+
]
|
|
76
|
+
})), /* @__PURE__ */ w("span", { children: e < n ? `Showing ${e} of ${n}` : `All ${e} shown` })]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/components/EntryPicker/blocked.ts
|
|
81
|
+
function M(e, t, { isDisabled: n, searching: r, atMax: i }) {
|
|
82
|
+
if (n || r) return "inactive";
|
|
83
|
+
if (e.isDisabled) return "restricted";
|
|
84
|
+
if (!t && i) return "full";
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
16
87
|
//#region src/components/EntryPicker/item.tsx
|
|
17
|
-
function
|
|
88
|
+
function N(e) {
|
|
18
89
|
return e.isDisabled ? e.disabledReason : void 0;
|
|
19
90
|
}
|
|
20
|
-
function
|
|
91
|
+
function P(e) {
|
|
21
92
|
return e.tone === "removed";
|
|
22
93
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
94
|
+
function F(e) {
|
|
95
|
+
return P(e) ? void 0 : N(e);
|
|
25
96
|
}
|
|
26
|
-
function
|
|
27
|
-
let r =
|
|
97
|
+
function I({ item: t, reasonId: n }) {
|
|
98
|
+
let r = N(t);
|
|
28
99
|
return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("span", {
|
|
29
100
|
className: "ds-entry__thumb",
|
|
30
101
|
children: t.imageUrl ? /* @__PURE__ */ w("img", {
|
|
@@ -63,26 +134,26 @@ function k({ item: t, reasonId: n }) {
|
|
|
63
134
|
]
|
|
64
135
|
})] });
|
|
65
136
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
137
|
+
function L({ item: e, reasonId: t }) {
|
|
138
|
+
return P(e) ? /* @__PURE__ */ T("span", {
|
|
68
139
|
className: "ds-entry__removed",
|
|
69
140
|
children: [
|
|
70
141
|
/* @__PURE__ */ w("strong", { children: e.title }),
|
|
71
142
|
" ",
|
|
72
143
|
e.metadata ?? /* @__PURE__ */ w("code", { children: e.id })
|
|
73
144
|
]
|
|
74
|
-
}) : /* @__PURE__ */ w(
|
|
145
|
+
}) : /* @__PURE__ */ w(I, {
|
|
75
146
|
item: e,
|
|
76
147
|
reasonId: t
|
|
77
148
|
});
|
|
78
149
|
}
|
|
79
|
-
function
|
|
80
|
-
return
|
|
150
|
+
function R({ item: e }) {
|
|
151
|
+
return P(e) ? /* @__PURE__ */ w(a, {
|
|
81
152
|
shape: "tag",
|
|
82
153
|
children: e.removedLabel ?? "Removed on save"
|
|
83
154
|
}) : null;
|
|
84
155
|
}
|
|
85
|
-
function
|
|
156
|
+
function z({ item: e, onEdit: n, isDisabled: r }) {
|
|
86
157
|
return !n || e.isUnavailable || e.isDisabled ? null : /* @__PURE__ */ w(t, {
|
|
87
158
|
variant: "simple",
|
|
88
159
|
size: "sm",
|
|
@@ -94,216 +165,8 @@ function M({ item: e, onEdit: n, isDisabled: r }) {
|
|
|
94
165
|
});
|
|
95
166
|
}
|
|
96
167
|
//#endregion
|
|
97
|
-
//#region src/components/EntryPicker/chosen.ts
|
|
98
|
-
function N(e, t, n) {
|
|
99
|
-
return {
|
|
100
|
-
id: e,
|
|
101
|
-
title: t,
|
|
102
|
-
metadata: n,
|
|
103
|
-
isUnavailable: !0
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function P({ selected: e, items: t, pageItems: n, known: r, failures: i, hasResolver: a, itemLabel: o }) {
|
|
107
|
-
let s = new Map(t.map((e) => [e.id, e])), c = new Map(n.map((e) => [e.id, e]));
|
|
108
|
-
return e.map((e) => (s.get(e) ?? (r.has(e) ? r.get(e) : c.get(e))) || (r.has(e) ? N(e, `${`${o.charAt(0).toUpperCase()}${o.slice(1)}`} no longer available`, "Replace or clear this selection.") : a ? N(e, i.has(e) ? `Couldn't load ${o}` : "Loading…") : {
|
|
109
|
-
id: e,
|
|
110
|
-
title: e
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/components/EntryPicker/use-selected-items.ts
|
|
115
|
-
function F(e) {
|
|
116
|
-
return e instanceof Error ? e : null;
|
|
117
|
-
}
|
|
118
|
-
function I(e, t) {
|
|
119
|
-
if (!t.some((t) => e.has(t))) return e;
|
|
120
|
-
let n = new Map(e);
|
|
121
|
-
for (let e of t) n.delete(e);
|
|
122
|
-
return n;
|
|
123
|
-
}
|
|
124
|
-
function L(e, t, n) {
|
|
125
|
-
let r = n ? t.flatMap((t) => {
|
|
126
|
-
let r = n(t);
|
|
127
|
-
return r?.item.id === t && e.seeds.get(t) !== r ? [r] : [];
|
|
128
|
-
}) : [];
|
|
129
|
-
if (r.length === 0) return e;
|
|
130
|
-
let i = r.filter((t) => Object.is(t.revision, e.refreshKey)), a = r.filter((t) => !Object.is(t.revision, e.refreshKey) && !e.known.has(t.item.id) && !e.stale.has(t.item.id)), o = (e) => e.map((e) => [e.item.id, e.item]);
|
|
131
|
-
return {
|
|
132
|
-
...e,
|
|
133
|
-
seeds: new Map([...e.seeds, ...r.map((e) => [e.item.id, e])]),
|
|
134
|
-
known: i.length ? new Map([...e.known, ...o(i)]) : e.known,
|
|
135
|
-
stale: a.length ? new Map([...e.stale, ...o(a)]) : e.stale,
|
|
136
|
-
failures: I(e.failures, i.map((e) => e.item.id))
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function R(e, t) {
|
|
140
|
-
return e !== t && (e.length !== t.length || t.some((t) => !e.includes(t)));
|
|
141
|
-
}
|
|
142
|
-
function z(e, t, n, r) {
|
|
143
|
-
let i = e;
|
|
144
|
-
if (Object.is(i.refreshKey, n) || (i = {
|
|
145
|
-
...i,
|
|
146
|
-
refreshKey: n,
|
|
147
|
-
known: /* @__PURE__ */ new Map(),
|
|
148
|
-
stale: new Map([...i.stale, ...i.known]),
|
|
149
|
-
failures: /* @__PURE__ */ new Map()
|
|
150
|
-
}), R(i.selected, t)) {
|
|
151
|
-
let e = i.selected.filter((e) => !t.includes(e));
|
|
152
|
-
i = {
|
|
153
|
-
...i,
|
|
154
|
-
selected: t,
|
|
155
|
-
known: I(i.known, e),
|
|
156
|
-
stale: I(i.stale, e),
|
|
157
|
-
failures: I(i.failures, e),
|
|
158
|
-
seeds: I(i.seeds, e)
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
return L(i, t, r);
|
|
162
|
-
}
|
|
163
|
-
function B(e, t, n, r, a) {
|
|
164
|
-
let o = i(n), s = i(e), [c, l] = S(() => L({
|
|
165
|
-
refreshKey: r,
|
|
166
|
-
selected: e,
|
|
167
|
-
known: /* @__PURE__ */ new Map(),
|
|
168
|
-
stale: /* @__PURE__ */ new Map(),
|
|
169
|
-
failures: /* @__PURE__ */ new Map(),
|
|
170
|
-
seeds: /* @__PURE__ */ new Map()
|
|
171
|
-
}, e, a)), u = z(c, e, r, a);
|
|
172
|
-
u !== c && l(u);
|
|
173
|
-
let { known: d, stale: f, failures: p } = u, m = b(() => f.size === 0 ? d : new Map([...f, ...d]), [f, d]), h = (e, t, n = s.current) => {
|
|
174
|
-
let r = e.filter((e) => e !== void 0 && n.includes(e.id)).map((e) => [e.id, e]);
|
|
175
|
-
r.length !== 0 && l((e) => {
|
|
176
|
-
if (Object.is(e.refreshKey, t)) return {
|
|
177
|
-
...e,
|
|
178
|
-
known: new Map([...e.known, ...r])
|
|
179
|
-
};
|
|
180
|
-
let n = r.filter(([t]) => !e.known.has(t) && !e.stale.has(t));
|
|
181
|
-
return n.length === 0 ? e : {
|
|
182
|
-
...e,
|
|
183
|
-
stale: new Map([...e.stale, ...n])
|
|
184
|
-
};
|
|
185
|
-
});
|
|
186
|
-
}, g = new Set(t.map((e) => e.id)), _ = n ? e.filter((e) => !g.has(e) && !d.has(e) && !p.has(e)) : [], y = JSON.stringify(_), C = x({
|
|
187
|
-
refreshKey: r,
|
|
188
|
-
tokens: /* @__PURE__ */ new Map()
|
|
189
|
-
});
|
|
190
|
-
v(() => {
|
|
191
|
-
let e = o.current;
|
|
192
|
-
if (!e) return;
|
|
193
|
-
let t = JSON.parse(y);
|
|
194
|
-
Object.is(C.current.refreshKey, r) || (C.current = {
|
|
195
|
-
refreshKey: r,
|
|
196
|
-
tokens: /* @__PURE__ */ new Map()
|
|
197
|
-
});
|
|
198
|
-
let { tokens: n } = C.current;
|
|
199
|
-
for (let e of n.keys()) t.includes(e) || n.delete(e);
|
|
200
|
-
for (let i of t.filter((e) => !n.has(e))) {
|
|
201
|
-
let t = Symbol(i);
|
|
202
|
-
n.set(i, t);
|
|
203
|
-
let a = (e) => {
|
|
204
|
-
C.current.tokens.get(i) === t && (C.current.tokens.delete(i), l((t) => Object.is(t.refreshKey, r) && t.selected.includes(i) ? e(t) : t));
|
|
205
|
-
};
|
|
206
|
-
Promise.resolve().then(() => e(i)).then((e) => a((t) => t.known.has(i) ? t : {
|
|
207
|
-
...t,
|
|
208
|
-
known: new Map(t.known).set(i, e ?? null)
|
|
209
|
-
}), (e) => a((t) => ({
|
|
210
|
-
...t,
|
|
211
|
-
failures: new Map(t.failures).set(i, F(e))
|
|
212
|
-
})));
|
|
213
|
-
}
|
|
214
|
-
}, [
|
|
215
|
-
y,
|
|
216
|
-
r,
|
|
217
|
-
o
|
|
218
|
-
]);
|
|
219
|
-
let w = e.filter((e) => p.has(e) && !d.has(e));
|
|
220
|
-
return {
|
|
221
|
-
known: m,
|
|
222
|
-
current: d,
|
|
223
|
-
failures: p,
|
|
224
|
-
remember: h,
|
|
225
|
-
status: _.length > 0 ? "loading" : w.length > 0 ? "error" : "ready",
|
|
226
|
-
error: w.length > 0 ? p.get(w[0]) ?? null : null,
|
|
227
|
-
retry: () => l((e) => ({
|
|
228
|
-
...e,
|
|
229
|
-
failures: I(e.failures, w)
|
|
230
|
-
}))
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region src/components/EntryPicker/feedback.tsx
|
|
235
|
-
function V(e, t, n, r) {
|
|
236
|
-
let i = l(t, n, r);
|
|
237
|
-
return t !== "error" && i.state !== "pending" ? null : /* @__PURE__ */ w(u, {
|
|
238
|
-
title: e,
|
|
239
|
-
error: i.error,
|
|
240
|
-
onRetry: i.retry,
|
|
241
|
-
retryState: i.state
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
function H({ query: e, itemLabel: t, itemsLabel: n, canCreate: r }) {
|
|
245
|
-
let i = e.trim();
|
|
246
|
-
return /* @__PURE__ */ T("div", {
|
|
247
|
-
className: "ds-entry-picker__no-results",
|
|
248
|
-
children: [/* @__PURE__ */ w("p", { children: i ? `No ${n} match “${i}”` : `No ${n} yet` }), i && /* @__PURE__ */ T("p", { children: ["Try a different search.", r ? ` Or create the ${t} you need.` : ""] })]
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
function U(e, t) {
|
|
252
|
-
let n = e.closest(".ds-entry-picker__scroll") ?? e.parentElement, i = Array.from(n?.querySelectorAll(".ds-entry-picker__result") ?? []);
|
|
253
|
-
for (let e of [...i.slice(t), ...i.slice(0, t).reverse()]) {
|
|
254
|
-
let t = r(e)[0];
|
|
255
|
-
if (t) return t;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
function W(e) {
|
|
259
|
-
let t = x(null), i = x(null), { more: a, offset: o } = e;
|
|
260
|
-
return v(() => {
|
|
261
|
-
let e = i.current, o = t.current;
|
|
262
|
-
e !== null && a.status !== "loading" && (i.current = null, o && n(document.activeElement) && (a.status === "error" ? r(o)[0] : U(o, e))?.focus());
|
|
263
|
-
}, [a.status, o]), {
|
|
264
|
-
pagingRef: t,
|
|
265
|
-
load: () => {
|
|
266
|
-
i.current = t.current?.contains(document.activeElement) ? o : null, a.load();
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
function G(e, t) {
|
|
271
|
-
let i = x(t);
|
|
272
|
-
v(() => {
|
|
273
|
-
if (i.current === t) return;
|
|
274
|
-
i.current = t;
|
|
275
|
-
let a = e.current;
|
|
276
|
-
a && n(document.activeElement) && (r(a)[0] ?? U(a, Infinity))?.focus();
|
|
277
|
-
}, [e, t]);
|
|
278
|
-
}
|
|
279
|
-
function K({ count: e, total: n, isRemote: r, pageSize: i, remote: a, itemsLabel: o }) {
|
|
280
|
-
let { more: s } = a, { pagingRef: c, load: l } = W(a), u = V(`Couldn't load more ${o}`, s.status, s.error, l);
|
|
281
|
-
return G(c, u ? "failure" : r && a.hasMore ? "more" : "none"), n === 0 ? null : /* @__PURE__ */ T("div", {
|
|
282
|
-
ref: c,
|
|
283
|
-
className: "ds-entry-picker__paging",
|
|
284
|
-
children: [u ?? (r && a.hasMore && /* @__PURE__ */ T(t, {
|
|
285
|
-
isPending: s.status === "loading",
|
|
286
|
-
isFocusableWhenDisabled: !0,
|
|
287
|
-
isDisabled: !s.isAvailable,
|
|
288
|
-
onClick: l,
|
|
289
|
-
children: [
|
|
290
|
-
"Load ",
|
|
291
|
-
Math.min(i, n - a.offset),
|
|
292
|
-
" more"
|
|
293
|
-
]
|
|
294
|
-
})), /* @__PURE__ */ w("span", { children: e < n ? `Showing ${e} of ${n}` : `All ${e} shown` })]
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region src/components/EntryPicker/blocked.ts
|
|
299
|
-
function q(e, t, { isDisabled: n, searching: r, atMax: i }) {
|
|
300
|
-
if (n || r) return "inactive";
|
|
301
|
-
if (e.isDisabled) return "restricted";
|
|
302
|
-
if (!t && i) return "full";
|
|
303
|
-
}
|
|
304
|
-
//#endregion
|
|
305
168
|
//#region src/components/EntryPicker/results.tsx
|
|
306
|
-
function
|
|
169
|
+
function ee({ items: e, selected: t, block: n, onToggle: r, onEdit: i }) {
|
|
307
170
|
let a = y(), o = `${a}-full`;
|
|
308
171
|
return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("span", {
|
|
309
172
|
id: o,
|
|
@@ -313,7 +176,7 @@ function J({ items: e, selected: t, block: n, onToggle: r, onEdit: i }) {
|
|
|
313
176
|
className: "ds-entry-picker__results",
|
|
314
177
|
"data-searching": n.searching || void 0,
|
|
315
178
|
children: e.map((e, s) => {
|
|
316
|
-
let c = t.includes(e.id), l =
|
|
179
|
+
let c = t.includes(e.id), l = M(e, c, n), u = N(e) ? `${a}-reason-${s}` : void 0;
|
|
317
180
|
return /* @__PURE__ */ T("li", {
|
|
318
181
|
className: "ds-entry-picker__result ds-field-surface",
|
|
319
182
|
"data-selected": c || void 0,
|
|
@@ -334,12 +197,12 @@ function J({ items: e, selected: t, block: n, onToggle: r, onEdit: i }) {
|
|
|
334
197
|
}),
|
|
335
198
|
/* @__PURE__ */ w("span", {
|
|
336
199
|
className: "ds-entry",
|
|
337
|
-
children: /* @__PURE__ */ w(
|
|
200
|
+
children: /* @__PURE__ */ w(I, {
|
|
338
201
|
item: e,
|
|
339
202
|
reasonId: u
|
|
340
203
|
})
|
|
341
204
|
}),
|
|
342
|
-
/* @__PURE__ */ w(
|
|
205
|
+
/* @__PURE__ */ w(z, {
|
|
343
206
|
item: e,
|
|
344
207
|
onEdit: i,
|
|
345
208
|
isDisabled: l === "inactive"
|
|
@@ -351,7 +214,7 @@ function J({ items: e, selected: t, block: n, onToggle: r, onEdit: i }) {
|
|
|
351
214
|
}
|
|
352
215
|
//#endregion
|
|
353
216
|
//#region src/components/EntryPicker/use-picker-scroll.ts
|
|
354
|
-
function
|
|
217
|
+
function te() {
|
|
355
218
|
let e = x(null), [t, n] = S(!1);
|
|
356
219
|
return {
|
|
357
220
|
ref: e,
|
|
@@ -366,20 +229,20 @@ function Y() {
|
|
|
366
229
|
}
|
|
367
230
|
//#endregion
|
|
368
231
|
//#region src/components/EntryPicker/dialog.tsx
|
|
369
|
-
function
|
|
370
|
-
return e && t ? /* @__PURE__ */ T(
|
|
232
|
+
function B(e, t) {
|
|
233
|
+
return e && t ? /* @__PURE__ */ T(u, {
|
|
371
234
|
gap: "sm",
|
|
372
235
|
children: [e, t]
|
|
373
236
|
}) : e || t;
|
|
374
237
|
}
|
|
375
|
-
function
|
|
376
|
-
let
|
|
238
|
+
function V({ isOpen: e, onClose: n, query: r, onQuery: i, selected: a, results: o, cap: l, block: u, isRemote: d, pageSize: f, remote: m, onToggle: h, onEdit: g, confirm: _, selectionNotice: v, selectionFailure: y, isCreateDisabled: b, itemLabel: x, itemsLabel: S, addLabel: O, onCreate: k, isCreating: A, dialogTitle: M, dialogDescription: N, isDialogHidden: P }) {
|
|
239
|
+
let F = E(`Couldn't refresh ${S}`, m.refresh.status, m.refresh.error, m.refresh.retry);
|
|
377
240
|
return /* @__PURE__ */ w(c, {
|
|
378
241
|
isOpen: e,
|
|
379
|
-
isHidden:
|
|
242
|
+
isHidden: P,
|
|
380
243
|
onClose: n,
|
|
381
|
-
title:
|
|
382
|
-
description:
|
|
244
|
+
title: M ?? O,
|
|
245
|
+
description: N ?? l.description,
|
|
383
246
|
className: "ds-entry-picker__dialog",
|
|
384
247
|
footer: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("span", {
|
|
385
248
|
className: "ds-entry-picker__selection",
|
|
@@ -394,46 +257,46 @@ function Z({ isOpen: e, onClose: n, query: r, onQuery: i, selected: a, results:
|
|
|
394
257
|
onClick: _?.onClick ?? n,
|
|
395
258
|
children: _?.label ?? "Done"
|
|
396
259
|
})] }),
|
|
397
|
-
children: /* @__PURE__ */ w(
|
|
260
|
+
children: /* @__PURE__ */ w(H, {
|
|
398
261
|
query: r,
|
|
399
262
|
onQuery: i,
|
|
400
263
|
itemsLabel: S,
|
|
401
264
|
isSearching: m.loading,
|
|
402
|
-
action:
|
|
265
|
+
action: k && /* @__PURE__ */ w(t, {
|
|
403
266
|
variant: "primary",
|
|
404
|
-
isPending:
|
|
267
|
+
isPending: A,
|
|
405
268
|
isFocusableWhenDisabled: !0,
|
|
406
269
|
iconStart: "plus",
|
|
407
270
|
isDisabled: u.isDisabled || l.atMax || b,
|
|
408
|
-
onClick:
|
|
271
|
+
onClick: k,
|
|
409
272
|
children: `New ${x}`
|
|
410
273
|
}),
|
|
411
|
-
banner:
|
|
274
|
+
banner: B(F, y),
|
|
412
275
|
isBusy: m.loading || m.more.status === "loading" || m.refresh.status === "loading",
|
|
413
|
-
children: /* @__PURE__ */ T(
|
|
276
|
+
children: /* @__PURE__ */ T(p, {
|
|
414
277
|
status: m.status,
|
|
415
278
|
errorTitle: `Couldn't load ${S}`,
|
|
416
279
|
error: m.error,
|
|
417
280
|
onRetry: m.retry,
|
|
418
281
|
children: [
|
|
419
|
-
/* @__PURE__ */ w(
|
|
282
|
+
/* @__PURE__ */ w(ee, {
|
|
420
283
|
items: o,
|
|
421
284
|
selected: a,
|
|
422
285
|
block: u,
|
|
423
286
|
onToggle: h,
|
|
424
287
|
onEdit: g
|
|
425
288
|
}),
|
|
426
|
-
!m.searching && o.length === 0 && /* @__PURE__ */ w(
|
|
289
|
+
!m.searching && o.length === 0 && /* @__PURE__ */ w(D, {
|
|
427
290
|
query: r,
|
|
428
291
|
itemLabel: x,
|
|
429
292
|
itemsLabel: S,
|
|
430
|
-
canCreate: !!
|
|
293
|
+
canCreate: !!k
|
|
431
294
|
}),
|
|
432
|
-
/* @__PURE__ */ w(
|
|
295
|
+
/* @__PURE__ */ w(j, {
|
|
433
296
|
count: o.length,
|
|
434
|
-
total:
|
|
435
|
-
isRemote:
|
|
436
|
-
pageSize:
|
|
297
|
+
total: d ? m.total : o.length,
|
|
298
|
+
isRemote: d,
|
|
299
|
+
pageSize: f,
|
|
437
300
|
remote: m,
|
|
438
301
|
itemsLabel: S
|
|
439
302
|
})
|
|
@@ -442,15 +305,15 @@ function Z({ isOpen: e, onClose: n, query: r, onQuery: i, selected: a, results:
|
|
|
442
305
|
})
|
|
443
306
|
});
|
|
444
307
|
}
|
|
445
|
-
function
|
|
446
|
-
let { ref: c, scrolled: l, onScroll: u, toTop: d } =
|
|
308
|
+
function H({ query: e, onQuery: t, itemsLabel: n, isSearching: r, action: i, banner: a, isBusy: o, children: s }) {
|
|
309
|
+
let { ref: c, scrolled: l, onScroll: u, toTop: d } = te(), f = (e) => {
|
|
447
310
|
d(), t(e);
|
|
448
311
|
};
|
|
449
312
|
return /* @__PURE__ */ T(C, { children: [
|
|
450
313
|
/* @__PURE__ */ T("div", {
|
|
451
314
|
className: "ds-entry-picker__search ds-field-surface",
|
|
452
315
|
"data-scrolled": l || void 0,
|
|
453
|
-
children: [/* @__PURE__ */ w(
|
|
316
|
+
children: [/* @__PURE__ */ w(m, {
|
|
454
317
|
"aria-label": `Search ${n}`,
|
|
455
318
|
value: e,
|
|
456
319
|
isBusy: r,
|
|
@@ -473,12 +336,89 @@ function ee({ query: e, onQuery: t, itemsLabel: n, isSearching: r, action: i, ba
|
|
|
473
336
|
] });
|
|
474
337
|
}
|
|
475
338
|
//#endregion
|
|
339
|
+
//#region src/components/EntryPicker/selected-items.tsx
|
|
340
|
+
function ne({ items: e, selected: n, onChange: r, onEdit: i, isDisabled: a, canReorder: o, emptyLabel: s }) {
|
|
341
|
+
let c = y(), l = (e, t) => F(e) ? `${c}-reason-${t}` : void 0, u = (e, o) => /* @__PURE__ */ T("span", {
|
|
342
|
+
className: "ds-entry-picker__item-actions",
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ w(R, { item: e }),
|
|
345
|
+
/* @__PURE__ */ w(z, {
|
|
346
|
+
item: e,
|
|
347
|
+
onEdit: e.tone === "removed" ? void 0 : i,
|
|
348
|
+
isDisabled: a
|
|
349
|
+
}),
|
|
350
|
+
/* @__PURE__ */ w(t, {
|
|
351
|
+
variant: "simple",
|
|
352
|
+
size: "sm",
|
|
353
|
+
isIconOnly: !0,
|
|
354
|
+
iconStart: "x",
|
|
355
|
+
"aria-label": `Remove ${e.title}`,
|
|
356
|
+
"aria-describedby": o,
|
|
357
|
+
isDisabled: a,
|
|
358
|
+
onClick: () => r(n.filter((t) => t !== e.id))
|
|
359
|
+
})
|
|
360
|
+
]
|
|
361
|
+
});
|
|
362
|
+
return e.length === 0 ? /* @__PURE__ */ w("p", {
|
|
363
|
+
className: "ds-entry-picker__empty",
|
|
364
|
+
children: s
|
|
365
|
+
}) : o ? /* @__PURE__ */ w(g, {
|
|
366
|
+
items: n,
|
|
367
|
+
onReorder: r,
|
|
368
|
+
isDisabled: a,
|
|
369
|
+
children: e.map((e, t) => /* @__PURE__ */ w(_, {
|
|
370
|
+
id: e.id,
|
|
371
|
+
label: e.title,
|
|
372
|
+
"data-tone": e.tone,
|
|
373
|
+
handleDescribedBy: l(e, t),
|
|
374
|
+
action: u(e, l(e, t)),
|
|
375
|
+
children: /* @__PURE__ */ w("div", {
|
|
376
|
+
className: "ds-entry",
|
|
377
|
+
children: /* @__PURE__ */ w(L, {
|
|
378
|
+
item: e,
|
|
379
|
+
reasonId: l(e, t)
|
|
380
|
+
})
|
|
381
|
+
})
|
|
382
|
+
}, e.id))
|
|
383
|
+
}) : /* @__PURE__ */ w("ul", {
|
|
384
|
+
className: "ds-entry-picker__list",
|
|
385
|
+
children: e.map((e, t) => /* @__PURE__ */ T("li", {
|
|
386
|
+
className: "ds-entry-picker__row ds-field-surface",
|
|
387
|
+
"data-tone": e.tone,
|
|
388
|
+
children: [/* @__PURE__ */ w("div", {
|
|
389
|
+
className: "ds-entry",
|
|
390
|
+
children: /* @__PURE__ */ w(L, {
|
|
391
|
+
item: e,
|
|
392
|
+
reasonId: l(e, t)
|
|
393
|
+
})
|
|
394
|
+
}), u(e, l(e, t))]
|
|
395
|
+
}, e.id))
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/components/EntryPicker/chosen.ts
|
|
400
|
+
function U(e, t, n) {
|
|
401
|
+
return {
|
|
402
|
+
id: e,
|
|
403
|
+
title: t,
|
|
404
|
+
metadata: n,
|
|
405
|
+
isUnavailable: !0
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function W({ selected: e, items: t, pageItems: n, known: r, failures: i, hasResolver: a, itemLabel: o }) {
|
|
409
|
+
let s = new Map(t.map((e) => [e.id, e])), c = new Map(n.map((e) => [e.id, e]));
|
|
410
|
+
return e.map((e) => (s.get(e) ?? (r.has(e) ? r.get(e) : c.get(e))) || (r.has(e) ? U(e, `${`${o.charAt(0).toUpperCase()}${o.slice(1)}`} no longer available`, "Replace or clear this selection.") : a ? U(e, i.has(e) ? `Couldn't load ${o}` : "Loading…") : {
|
|
411
|
+
id: e,
|
|
412
|
+
title: e
|
|
413
|
+
}));
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
476
416
|
//#region src/components/EntryPicker/limit.ts
|
|
477
|
-
function
|
|
417
|
+
function G(e, t) {
|
|
478
418
|
return e === "single" || t === 1;
|
|
479
419
|
}
|
|
480
|
-
function
|
|
481
|
-
return
|
|
420
|
+
function K(e, t, n) {
|
|
421
|
+
return G(e, n) ? {
|
|
482
422
|
count: t,
|
|
483
423
|
max: 1,
|
|
484
424
|
tone: "neutral"
|
|
@@ -487,11 +427,11 @@ function ne(e, t, n) {
|
|
|
487
427
|
max: n
|
|
488
428
|
} : void 0;
|
|
489
429
|
}
|
|
490
|
-
function
|
|
491
|
-
return
|
|
430
|
+
function q(e, t, n) {
|
|
431
|
+
return G(e, n) ? void 0 : t;
|
|
492
432
|
}
|
|
493
|
-
function
|
|
494
|
-
let a =
|
|
433
|
+
function J(e, t, n, { itemLabel: r, itemsLabel: i }) {
|
|
434
|
+
let a = K(e, t, n), s = e === "multiple" && a && Number.isFinite(a.max) ? a.max : void 0, c = `Choose as many ${i} as you need.`;
|
|
495
435
|
return e === "single" || s === 1 ? c = `Choose one ${r}.` : s !== void 0 && (c = `Choose up to ${s} ${i}.`), {
|
|
496
436
|
limit: a,
|
|
497
437
|
atMax: s !== void 0 && t >= s,
|
|
@@ -500,23 +440,143 @@ function ie(e, t, n, { itemLabel: r, itemsLabel: i }) {
|
|
|
500
440
|
};
|
|
501
441
|
}
|
|
502
442
|
//#endregion
|
|
443
|
+
//#region src/components/EntryPicker/use-selected-items.ts
|
|
444
|
+
function Y(e) {
|
|
445
|
+
return e instanceof Error ? e : null;
|
|
446
|
+
}
|
|
447
|
+
function X(e, t) {
|
|
448
|
+
if (!t.some((t) => e.has(t))) return e;
|
|
449
|
+
let n = new Map(e);
|
|
450
|
+
for (let e of t) n.delete(e);
|
|
451
|
+
return n;
|
|
452
|
+
}
|
|
453
|
+
function Z(e, t, n) {
|
|
454
|
+
let r = n ? t.flatMap((t) => {
|
|
455
|
+
let r = n(t);
|
|
456
|
+
return r?.item.id === t && e.seeds.get(t) !== r ? [r] : [];
|
|
457
|
+
}) : [];
|
|
458
|
+
if (r.length === 0) return e;
|
|
459
|
+
let i = r.filter((t) => Object.is(t.revision, e.refreshKey)), a = r.filter((t) => !Object.is(t.revision, e.refreshKey) && !e.known.has(t.item.id) && !e.stale.has(t.item.id)), o = (e) => e.map((e) => [e.item.id, e.item]);
|
|
460
|
+
return {
|
|
461
|
+
...e,
|
|
462
|
+
seeds: new Map([...e.seeds, ...r.map((e) => [e.item.id, e])]),
|
|
463
|
+
known: i.length ? new Map([...e.known, ...o(i)]) : e.known,
|
|
464
|
+
stale: a.length ? new Map([...e.stale, ...o(a)]) : e.stale,
|
|
465
|
+
failures: X(e.failures, i.map((e) => e.item.id))
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function re(e, t) {
|
|
469
|
+
return e !== t && (e.length !== t.length || t.some((t) => !e.includes(t)));
|
|
470
|
+
}
|
|
471
|
+
function ie(e, t, n, r) {
|
|
472
|
+
let i = e;
|
|
473
|
+
if (Object.is(i.refreshKey, n) || (i = {
|
|
474
|
+
...i,
|
|
475
|
+
refreshKey: n,
|
|
476
|
+
known: /* @__PURE__ */ new Map(),
|
|
477
|
+
stale: new Map([...i.stale, ...i.known]),
|
|
478
|
+
failures: /* @__PURE__ */ new Map()
|
|
479
|
+
}), re(i.selected, t)) {
|
|
480
|
+
let e = i.selected.filter((e) => !t.includes(e));
|
|
481
|
+
i = {
|
|
482
|
+
...i,
|
|
483
|
+
selected: t,
|
|
484
|
+
known: X(i.known, e),
|
|
485
|
+
stale: X(i.stale, e),
|
|
486
|
+
failures: X(i.failures, e),
|
|
487
|
+
seeds: X(i.seeds, e)
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
return Z(i, t, r);
|
|
491
|
+
}
|
|
492
|
+
function ae(e, t, n, r, a) {
|
|
493
|
+
let o = i(n), s = i(e), [c, l] = S(() => Z({
|
|
494
|
+
refreshKey: r,
|
|
495
|
+
selected: e,
|
|
496
|
+
known: /* @__PURE__ */ new Map(),
|
|
497
|
+
stale: /* @__PURE__ */ new Map(),
|
|
498
|
+
failures: /* @__PURE__ */ new Map(),
|
|
499
|
+
seeds: /* @__PURE__ */ new Map()
|
|
500
|
+
}, e, a)), u = ie(c, e, r, a);
|
|
501
|
+
u !== c && l(u);
|
|
502
|
+
let { known: d, stale: f, failures: p } = u, m = b(() => f.size === 0 ? d : new Map([...f, ...d]), [f, d]), h = (e, t, n = s.current) => {
|
|
503
|
+
let r = e.filter((e) => e !== void 0 && n.includes(e.id)).map((e) => [e.id, e]);
|
|
504
|
+
r.length !== 0 && l((e) => {
|
|
505
|
+
if (Object.is(e.refreshKey, t)) return {
|
|
506
|
+
...e,
|
|
507
|
+
known: new Map([...e.known, ...r])
|
|
508
|
+
};
|
|
509
|
+
let n = r.filter(([t]) => !e.known.has(t) && !e.stale.has(t));
|
|
510
|
+
return n.length === 0 ? e : {
|
|
511
|
+
...e,
|
|
512
|
+
stale: new Map([...e.stale, ...n])
|
|
513
|
+
};
|
|
514
|
+
});
|
|
515
|
+
}, g = new Set(t.map((e) => e.id)), _ = n ? e.filter((e) => !g.has(e) && !d.has(e) && !p.has(e)) : [], y = JSON.stringify(_), C = x({
|
|
516
|
+
refreshKey: r,
|
|
517
|
+
tokens: /* @__PURE__ */ new Map()
|
|
518
|
+
});
|
|
519
|
+
v(() => {
|
|
520
|
+
let e = o.current;
|
|
521
|
+
if (!e) return;
|
|
522
|
+
let t = JSON.parse(y);
|
|
523
|
+
Object.is(C.current.refreshKey, r) || (C.current = {
|
|
524
|
+
refreshKey: r,
|
|
525
|
+
tokens: /* @__PURE__ */ new Map()
|
|
526
|
+
});
|
|
527
|
+
let { tokens: n } = C.current;
|
|
528
|
+
for (let e of n.keys()) t.includes(e) || n.delete(e);
|
|
529
|
+
for (let i of t.filter((e) => !n.has(e))) {
|
|
530
|
+
let t = Symbol(i);
|
|
531
|
+
n.set(i, t);
|
|
532
|
+
let a = (e) => {
|
|
533
|
+
C.current.tokens.get(i) === t && (C.current.tokens.delete(i), l((t) => Object.is(t.refreshKey, r) && t.selected.includes(i) ? e(t) : t));
|
|
534
|
+
};
|
|
535
|
+
Promise.resolve().then(() => e(i)).then((e) => a((t) => t.known.has(i) ? t : {
|
|
536
|
+
...t,
|
|
537
|
+
known: new Map(t.known).set(i, e ?? null)
|
|
538
|
+
}), (e) => a((t) => ({
|
|
539
|
+
...t,
|
|
540
|
+
failures: new Map(t.failures).set(i, Y(e))
|
|
541
|
+
})));
|
|
542
|
+
}
|
|
543
|
+
}, [
|
|
544
|
+
y,
|
|
545
|
+
r,
|
|
546
|
+
o
|
|
547
|
+
]);
|
|
548
|
+
let w = e.filter((e) => p.has(e) && !d.has(e));
|
|
549
|
+
return {
|
|
550
|
+
known: m,
|
|
551
|
+
current: d,
|
|
552
|
+
failures: p,
|
|
553
|
+
remember: h,
|
|
554
|
+
status: _.length > 0 ? "loading" : w.length > 0 ? "error" : "ready",
|
|
555
|
+
error: w.length > 0 ? p.get(w[0]) ?? null : null,
|
|
556
|
+
retry: () => l((e) => ({
|
|
557
|
+
...e,
|
|
558
|
+
failures: X(e.failures, w)
|
|
559
|
+
}))
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
//#endregion
|
|
503
563
|
//#region src/components/EntryPicker/use-picker-data.ts
|
|
504
|
-
var
|
|
505
|
-
function
|
|
564
|
+
var oe = 250;
|
|
565
|
+
function se(e) {
|
|
506
566
|
return Array.from(new Map(e.map((e) => [e.id, e])).values());
|
|
507
567
|
}
|
|
508
|
-
var
|
|
568
|
+
var ce = {
|
|
509
569
|
items: [],
|
|
510
570
|
offset: 0,
|
|
511
571
|
total: 0
|
|
512
572
|
}, Q = {
|
|
513
|
-
...
|
|
573
|
+
...ce,
|
|
514
574
|
key: null,
|
|
515
575
|
revision: void 0,
|
|
516
576
|
status: "ready",
|
|
517
577
|
error: null
|
|
518
578
|
};
|
|
519
|
-
function
|
|
579
|
+
function le(e, t) {
|
|
520
580
|
let n = e?.status === "error" && t;
|
|
521
581
|
return {
|
|
522
582
|
status: e?.status === "loading" ? "loading" : n ? "error" : "ready",
|
|
@@ -526,22 +586,22 @@ function ce(e, t) {
|
|
|
526
586
|
}
|
|
527
587
|
function $(e, t) {
|
|
528
588
|
return {
|
|
529
|
-
items:
|
|
589
|
+
items: se([...e.items, ...t.items]),
|
|
530
590
|
offset: e.offset + t.items.length,
|
|
531
591
|
total: t.items.length === 0 ? Math.min(t.total, e.offset) : t.total
|
|
532
592
|
};
|
|
533
593
|
}
|
|
534
|
-
function
|
|
594
|
+
function ue(e, t, n, r) {
|
|
535
595
|
return e.key !== t || e.offset !== n ? e : {
|
|
536
596
|
...e,
|
|
537
597
|
...$(e, r)
|
|
538
598
|
};
|
|
539
599
|
}
|
|
540
|
-
async function
|
|
600
|
+
async function de(e, t, n, r, i) {
|
|
541
601
|
let a = Math.max(1, Math.ceil(r / n)), o = await Promise.all(Array.from({ length: a }, (r, i) => e({
|
|
542
602
|
offset: i * n,
|
|
543
603
|
limit: n
|
|
544
|
-
}, { query: t }))), s =
|
|
604
|
+
}, { query: t }))), s = ce;
|
|
545
605
|
for (let [e, t] of o.entries()) {
|
|
546
606
|
if (s.offset !== e * n) break;
|
|
547
607
|
s = $(s, t);
|
|
@@ -552,7 +612,7 @@ async function ue(e, t, n, r, i) {
|
|
|
552
612
|
}, { query: t }));
|
|
553
613
|
return s;
|
|
554
614
|
}
|
|
555
|
-
function
|
|
615
|
+
function fe(e, t, n, r) {
|
|
556
616
|
let i = e !== null && t.key === e, a = i && Object.is(t.revision, n), o = e !== null && !a && (!i || t.status === "error"), s = o && t.key !== null && t.status === "ready", c = o && !s ? "loading" : t.status === "error" ? "error" : "ready", l = t.status === "ready" && t.offset < t.total, u = i && !a && t.status === "ready", d = u && r?.key === e && Object.is(r.revision, n);
|
|
557
617
|
return {
|
|
558
618
|
loading: o,
|
|
@@ -563,21 +623,21 @@ function de(e, t, n, r) {
|
|
|
563
623
|
refreshFailed: d
|
|
564
624
|
};
|
|
565
625
|
}
|
|
566
|
-
function
|
|
626
|
+
function pe(e, t, n, r, a, o) {
|
|
567
627
|
let s = i(e), c = i(a), l = i(o), [u, d] = S(0), [f, p] = S(Q), [m, h] = S(null), [g, _] = S(null), [y, b] = S(r);
|
|
568
628
|
y !== r && (b(r), r || (p(Q), h(null), _(null), d((e) => e + 1)));
|
|
569
629
|
let C = n.trim(), w = e && r ? JSON.stringify([
|
|
570
630
|
C,
|
|
571
631
|
t,
|
|
572
632
|
u
|
|
573
|
-
]) : null, T = i(f), E = x(null), D = x(C), { loading: O, searching: k, status: A, hasMore: j, refresh: M, refreshFailed: N } =
|
|
633
|
+
]) : null, T = i(f), E = x(null), D = x(C), { loading: O, searching: k, status: A, hasMore: j, refresh: M, refreshFailed: N } = fe(w, f, o, g), P = !O && M === "ready", F = O ? "load" : M === "loading" ? "refresh" : null;
|
|
574
634
|
v(() => {
|
|
575
635
|
if (w === null) return;
|
|
576
|
-
let e =
|
|
577
|
-
if (D.current = C,
|
|
578
|
-
let n =
|
|
636
|
+
let e = F === "load" && C !== D.current ? oe : 0;
|
|
637
|
+
if (D.current = C, F === null) return;
|
|
638
|
+
let n = F === "refresh" ? T.current.offset + (E.current ? t : 0) : 0, r = !0, i = window.setTimeout(() => {
|
|
579
639
|
let e = s.current;
|
|
580
|
-
e &&
|
|
640
|
+
e && de(e, C, t, n, () => r).then((e) => {
|
|
581
641
|
r && (E.current = null, p({
|
|
582
642
|
...e,
|
|
583
643
|
key: w,
|
|
@@ -586,16 +646,16 @@ function fe(e, t, n, r, a, o) {
|
|
|
586
646
|
error: null
|
|
587
647
|
}), h(null), _(null), c.current?.(e.items, o));
|
|
588
648
|
}, (e) => {
|
|
589
|
-
r && (
|
|
649
|
+
r && (F === "refresh" ? _({
|
|
590
650
|
key: w,
|
|
591
651
|
revision: o,
|
|
592
|
-
error:
|
|
652
|
+
error: Y(e)
|
|
593
653
|
}) : (E.current = null, p({
|
|
594
654
|
...Q,
|
|
595
655
|
key: w,
|
|
596
656
|
revision: o,
|
|
597
657
|
status: "error",
|
|
598
|
-
error:
|
|
658
|
+
error: Y(e)
|
|
599
659
|
}), h(null)));
|
|
600
660
|
});
|
|
601
661
|
}, e);
|
|
@@ -604,7 +664,7 @@ function fe(e, t, n, r, a, o) {
|
|
|
604
664
|
};
|
|
605
665
|
}, [
|
|
606
666
|
w,
|
|
607
|
-
|
|
667
|
+
F,
|
|
608
668
|
o,
|
|
609
669
|
C,
|
|
610
670
|
t,
|
|
@@ -612,7 +672,7 @@ function fe(e, t, n, r, a, o) {
|
|
|
612
672
|
c,
|
|
613
673
|
T
|
|
614
674
|
]);
|
|
615
|
-
let
|
|
675
|
+
let I = () => {
|
|
616
676
|
let e = s.current, n = f.key, { offset: r } = f;
|
|
617
677
|
if (!e || n === null || !P || !j || E.current) return;
|
|
618
678
|
let i = Symbol("load more"), a = o;
|
|
@@ -628,11 +688,11 @@ function fe(e, t, n, r, a, o) {
|
|
|
628
688
|
offset: r,
|
|
629
689
|
limit: t
|
|
630
690
|
}, { query: C })).then((e) => {
|
|
631
|
-
u() && (p((t) =>
|
|
691
|
+
u() && (p((t) => ue(t, n, r, e)), c.current?.(e.items, a)), d(null);
|
|
632
692
|
}, (e) => d(u() ? {
|
|
633
693
|
token: i,
|
|
634
694
|
status: "error",
|
|
635
|
-
error:
|
|
695
|
+
error: Y(e)
|
|
636
696
|
} : null));
|
|
637
697
|
};
|
|
638
698
|
return {
|
|
@@ -647,8 +707,8 @@ function fe(e, t, n, r, a, o) {
|
|
|
647
707
|
error: f.error,
|
|
648
708
|
retry: () => d((e) => e + 1),
|
|
649
709
|
more: {
|
|
650
|
-
...
|
|
651
|
-
load:
|
|
710
|
+
...le(m, P),
|
|
711
|
+
load: I
|
|
652
712
|
},
|
|
653
713
|
refresh: {
|
|
654
714
|
status: M,
|
|
@@ -659,11 +719,11 @@ function fe(e, t, n, r, a, o) {
|
|
|
659
719
|
}
|
|
660
720
|
//#endregion
|
|
661
721
|
//#region src/components/EntryPicker/use-picker-session.ts
|
|
662
|
-
var
|
|
663
|
-
function
|
|
722
|
+
var me = [];
|
|
723
|
+
function he(e, t) {
|
|
664
724
|
return !!(e.isDisabled || t?.(e));
|
|
665
725
|
}
|
|
666
|
-
function
|
|
726
|
+
function ge(e, t) {
|
|
667
727
|
return t ? e.map((e) => {
|
|
668
728
|
let n = e.isDisabled ? void 0 : t(e);
|
|
669
729
|
return n ? {
|
|
@@ -673,15 +733,15 @@ function he(e, t) {
|
|
|
673
733
|
} : e;
|
|
674
734
|
}) : e;
|
|
675
735
|
}
|
|
676
|
-
function
|
|
677
|
-
let [u, d] = S(""), { resolveItem: f, refreshKey: p, loadPage: m, pageSize: h = 10, mode: g = "multiple", max: _, onEditItem: v } = n, y = !!m, x = c && y && !!f, C =
|
|
736
|
+
function _e(e, t, n, { isOpen: r, isDisabled: i, itemLabel: a, itemsLabel: o, close: s, recheckSelection: c, restrict: l }) {
|
|
737
|
+
let [u, d] = S(""), { resolveItem: f, refreshKey: p, loadPage: m, pageSize: h = 10, mode: g = "multiple", max: _, onEditItem: v } = n, y = !!m, x = c && y && !!f, C = ae(e, x ? me : t, f, p), w = pe(m, h, u, r, x ? (e, t) => C.remember(e.filter((e) => he(e, l)), t) : C.remember, p), T = b(() => {
|
|
678
738
|
let e = u.trim().toLowerCase();
|
|
679
|
-
return y ?
|
|
739
|
+
return y ? me : t.filter((t) => !e || [t.title, ...t.keywords ?? []].join(" ").toLowerCase().includes(e));
|
|
680
740
|
}, [
|
|
681
741
|
y,
|
|
682
742
|
t,
|
|
683
743
|
u
|
|
684
|
-
]), E = y ? w.items : T, D = b(() =>
|
|
744
|
+
]), E = y ? w.items : T, D = b(() => ge(E, l), [E, l]), O = J(g, e.length, _, {
|
|
685
745
|
itemLabel: a,
|
|
686
746
|
itemsLabel: o
|
|
687
747
|
}), k = {
|
|
@@ -702,7 +762,7 @@ function ge(e, t, n, { isOpen: r, isDisabled: i, itemLabel: a, itemsLabel: o, cl
|
|
|
702
762
|
revision: y ? w.pageRevision : p,
|
|
703
763
|
choice: (t) => {
|
|
704
764
|
let n = D.find((e) => e.id === t);
|
|
705
|
-
return n && !
|
|
765
|
+
return n && !M(n, e.includes(t), k) ? n : void 0;
|
|
706
766
|
},
|
|
707
767
|
dialog: {
|
|
708
768
|
query: u,
|
|
@@ -721,70 +781,10 @@ function ge(e, t, n, { isOpen: r, isDisabled: i, itemLabel: a, itemsLabel: o, cl
|
|
|
721
781
|
};
|
|
722
782
|
}
|
|
723
783
|
//#endregion
|
|
724
|
-
//#region src/components/EntryPicker/selected-items.tsx
|
|
725
|
-
function _e({ items: e, selected: n, onChange: r, onEdit: i, isDisabled: a, canReorder: o, emptyLabel: s }) {
|
|
726
|
-
let c = y(), l = (e, t) => O(e) ? `${c}-reason-${t}` : void 0, u = (e, o) => /* @__PURE__ */ T("span", {
|
|
727
|
-
className: "ds-entry-picker__item-actions",
|
|
728
|
-
children: [
|
|
729
|
-
/* @__PURE__ */ w(j, { item: e }),
|
|
730
|
-
/* @__PURE__ */ w(M, {
|
|
731
|
-
item: e,
|
|
732
|
-
onEdit: e.tone === "removed" ? void 0 : i,
|
|
733
|
-
isDisabled: a
|
|
734
|
-
}),
|
|
735
|
-
/* @__PURE__ */ w(t, {
|
|
736
|
-
variant: "simple",
|
|
737
|
-
size: "sm",
|
|
738
|
-
isIconOnly: !0,
|
|
739
|
-
iconStart: "x",
|
|
740
|
-
"aria-label": `Remove ${e.title}`,
|
|
741
|
-
"aria-describedby": o,
|
|
742
|
-
isDisabled: a,
|
|
743
|
-
onClick: () => r(n.filter((t) => t !== e.id))
|
|
744
|
-
})
|
|
745
|
-
]
|
|
746
|
-
});
|
|
747
|
-
return e.length === 0 ? /* @__PURE__ */ w("p", {
|
|
748
|
-
className: "ds-entry-picker__empty",
|
|
749
|
-
children: s
|
|
750
|
-
}) : o ? /* @__PURE__ */ w(g, {
|
|
751
|
-
items: n,
|
|
752
|
-
onReorder: r,
|
|
753
|
-
isDisabled: a,
|
|
754
|
-
children: e.map((e, t) => /* @__PURE__ */ w(_, {
|
|
755
|
-
id: e.id,
|
|
756
|
-
label: e.title,
|
|
757
|
-
"data-tone": e.tone,
|
|
758
|
-
handleDescribedBy: l(e, t),
|
|
759
|
-
action: u(e, l(e, t)),
|
|
760
|
-
children: /* @__PURE__ */ w("div", {
|
|
761
|
-
className: "ds-entry",
|
|
762
|
-
children: /* @__PURE__ */ w(A, {
|
|
763
|
-
item: e,
|
|
764
|
-
reasonId: l(e, t)
|
|
765
|
-
})
|
|
766
|
-
})
|
|
767
|
-
}, e.id))
|
|
768
|
-
}) : /* @__PURE__ */ w("ul", {
|
|
769
|
-
className: "ds-entry-picker__list",
|
|
770
|
-
children: e.map((e, t) => /* @__PURE__ */ T("li", {
|
|
771
|
-
className: "ds-entry-picker__row ds-field-surface",
|
|
772
|
-
"data-tone": e.tone,
|
|
773
|
-
children: [/* @__PURE__ */ w("div", {
|
|
774
|
-
className: "ds-entry",
|
|
775
|
-
children: /* @__PURE__ */ w(A, {
|
|
776
|
-
item: e,
|
|
777
|
-
reasonId: l(e, t)
|
|
778
|
-
})
|
|
779
|
-
}), u(e, l(e, t))]
|
|
780
|
-
}, e.id))
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
//#endregion
|
|
784
784
|
//#region src/components/EntryPicker/index.tsx
|
|
785
785
|
var ve = [];
|
|
786
|
-
function ye({ items: e = ve, value: n, defaultValue: r = [], onValueChange: i, mode: a = "multiple", max: o, label: s = "Entries", emptyLabel: c = "Nothing selected yet.", addLabel:
|
|
787
|
-
let [
|
|
786
|
+
function ye({ items: e = ve, value: n, defaultValue: r = [], onValueChange: i, mode: a = "multiple", max: o, label: s = "Entries", emptyLabel: c = "Nothing selected yet.", addLabel: u = "Choose entries", itemLabel: d = "entry", itemsLabel: f = "entries", isReorderable: p = !0, isDisabled: m = !1, loadPage: h, pageSize: g = 10, resolveItem: _, onEditItem: v, onCreate: y, isCreating: x = !1, refreshKey: C, dialogTitle: D, dialogDescription: O, isDialogHidden: k = !1, className: A, ...j }) {
|
|
787
|
+
let [M, N] = S(r), P = n ?? M, [F, I] = S(!1), L = _e(P, e, {
|
|
788
788
|
resolveItem: _,
|
|
789
789
|
refreshKey: C,
|
|
790
790
|
loadPage: h,
|
|
@@ -794,84 +794,84 @@ function ye({ items: e = ve, value: n, defaultValue: r = [], onValueChange: i, m
|
|
|
794
794
|
onEditItem: v
|
|
795
795
|
}, {
|
|
796
796
|
isOpen: F,
|
|
797
|
-
isDisabled:
|
|
798
|
-
itemLabel:
|
|
799
|
-
itemsLabel:
|
|
797
|
+
isDisabled: m,
|
|
798
|
+
itemLabel: d,
|
|
799
|
+
itemsLabel: f,
|
|
800
800
|
close: () => I(!1)
|
|
801
|
-
}), { selection: R, remote: z, cap:
|
|
802
|
-
|
|
803
|
-
},
|
|
804
|
-
R.remember([t], L.revision, e),
|
|
805
|
-
},
|
|
801
|
+
}), { selection: R, remote: z, cap: ee, editItem: te } = L, B = E(`Couldn't load selected ${f}`, R.status, R.error, R.retry), H = (e) => {
|
|
802
|
+
m || (n === void 0 && N(e), i?.(e));
|
|
803
|
+
}, U = (e, t) => {
|
|
804
|
+
R.remember([t], L.revision, e), H(e);
|
|
805
|
+
}, G = (e) => {
|
|
806
806
|
let t = L.choice(e);
|
|
807
|
-
t && (a === "single" ? (
|
|
808
|
-
}, { known:
|
|
809
|
-
selected:
|
|
807
|
+
t && (a === "single" ? (U(P[0] === e ? [] : [e], t), I(!1)) : P.includes(e) ? H(P.filter((t) => t !== e)) : U([...P, e], t));
|
|
808
|
+
}, { known: K, failures: J } = R, Y = !!_, X = b(() => W({
|
|
809
|
+
selected: P,
|
|
810
810
|
items: e,
|
|
811
811
|
pageItems: z.items,
|
|
812
|
-
known:
|
|
812
|
+
known: K,
|
|
813
813
|
failures: J,
|
|
814
814
|
hasResolver: Y,
|
|
815
|
-
itemLabel:
|
|
815
|
+
itemLabel: d
|
|
816
816
|
}), [
|
|
817
|
-
|
|
817
|
+
P,
|
|
818
818
|
e,
|
|
819
819
|
z.items,
|
|
820
|
-
|
|
820
|
+
K,
|
|
821
821
|
J,
|
|
822
822
|
Y,
|
|
823
|
-
|
|
823
|
+
d
|
|
824
824
|
]);
|
|
825
|
-
return /* @__PURE__ */ T(
|
|
826
|
-
...
|
|
827
|
-
className: ["ds-entry-picker",
|
|
825
|
+
return /* @__PURE__ */ T(l, {
|
|
826
|
+
...j,
|
|
827
|
+
className: ["ds-entry-picker", A].filter(Boolean).join(" "),
|
|
828
828
|
label: s,
|
|
829
|
-
count:
|
|
830
|
-
limit:
|
|
829
|
+
count: q(a, P.length, o),
|
|
830
|
+
limit: j.limit === void 0 ? ee.limit : j.limit,
|
|
831
831
|
children: [
|
|
832
|
-
/* @__PURE__ */ w(
|
|
832
|
+
/* @__PURE__ */ w(ne, {
|
|
833
833
|
items: X,
|
|
834
|
-
selected:
|
|
835
|
-
onChange:
|
|
836
|
-
onEdit:
|
|
837
|
-
isDisabled:
|
|
838
|
-
canReorder:
|
|
834
|
+
selected: P,
|
|
835
|
+
onChange: H,
|
|
836
|
+
onEdit: te,
|
|
837
|
+
isDisabled: m,
|
|
838
|
+
canReorder: p && a === "multiple" && X.length > 1,
|
|
839
839
|
emptyLabel: c
|
|
840
840
|
}),
|
|
841
|
-
|
|
841
|
+
B,
|
|
842
842
|
/* @__PURE__ */ T("div", {
|
|
843
843
|
className: "ds-entry-picker__actions",
|
|
844
844
|
children: [/* @__PURE__ */ w(t, {
|
|
845
845
|
variant: "neutral",
|
|
846
846
|
size: "sm",
|
|
847
847
|
iconStart: "plus",
|
|
848
|
-
isDisabled:
|
|
848
|
+
isDisabled: m,
|
|
849
849
|
onClick: () => I(!0),
|
|
850
|
-
children:
|
|
851
|
-
}),
|
|
850
|
+
children: u
|
|
851
|
+
}), P.length > 0 && /* @__PURE__ */ w(t, {
|
|
852
852
|
variant: "simple",
|
|
853
853
|
size: "sm",
|
|
854
|
-
isDisabled:
|
|
855
|
-
onClick: () =>
|
|
854
|
+
isDisabled: m,
|
|
855
|
+
onClick: () => H([]),
|
|
856
856
|
children: "Clear"
|
|
857
857
|
})]
|
|
858
858
|
}),
|
|
859
|
-
/* @__PURE__ */ w(
|
|
859
|
+
/* @__PURE__ */ w(V, {
|
|
860
860
|
...L.dialog,
|
|
861
861
|
isOpen: F,
|
|
862
862
|
onClose: () => I(!1),
|
|
863
|
-
onToggle:
|
|
864
|
-
addLabel:
|
|
863
|
+
onToggle: G,
|
|
864
|
+
addLabel: u,
|
|
865
865
|
onCreate: y,
|
|
866
866
|
isCreating: x,
|
|
867
|
-
dialogTitle:
|
|
868
|
-
dialogDescription:
|
|
869
|
-
isDialogHidden:
|
|
867
|
+
dialogTitle: D,
|
|
868
|
+
dialogDescription: O,
|
|
869
|
+
isDialogHidden: k
|
|
870
870
|
})
|
|
871
871
|
]
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
874
|
//#endregion
|
|
875
|
-
export {
|
|
875
|
+
export { K as a, I as c, q as i, E as l, _e as n, W as o, ae as r, V as s, ye as t };
|
|
876
876
|
|
|
877
|
-
//# sourceMappingURL=EntryPicker-
|
|
877
|
+
//# sourceMappingURL=EntryPicker-DBnDsgzi.js.map
|