@arkitektio/bsx 6.5.0 → 6.6.1
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/ports/forms/ListSearchField.d.ts.map +1 -1
- package/dist/ports/forms/ListSearchField.js +4 -2
- package/dist/ports/forms/ListSearchField.js.map +1 -1
- package/dist/ports/forms/SearchField.d.ts.map +1 -1
- package/dist/ports/forms/SearchField.js +4 -2
- package/dist/ports/forms/SearchField.js.map +1 -1
- package/dist/ports/forms/StructurePickerControl.d.ts +16 -1
- package/dist/ports/forms/StructurePickerControl.d.ts.map +1 -1
- package/dist/ports/forms/StructurePickerControl.js +26 -3
- package/dist/ports/forms/StructurePickerControl.js.map +1 -1
- package/dist/ports/rekuest.d.ts +11 -6
- package/dist/ports/rekuest.d.ts.map +1 -1
- package/dist/ports/structure/Structure.d.ts.map +1 -1
- package/dist/ports/structure/Structure.js +7 -4
- package/dist/ports/structure/Structure.js.map +1 -1
- package/dist/ports/widgets/custom/ListSearchWidget.d.ts.map +1 -1
- package/dist/ports/widgets/custom/ListSearchWidget.js +3 -2
- package/dist/ports/widgets/custom/ListSearchWidget.js.map +1 -1
- package/dist/ports/widgets/custom/SearchWidget.d.ts.map +1 -1
- package/dist/ports/widgets/custom/SearchWidget.js +3 -2
- package/dist/ports/widgets/custom/SearchWidget.js.map +1 -1
- package/dist/ports/widgets/fallbacks/EnumWidget.d.ts.map +1 -1
- package/dist/ports/widgets/fallbacks/EnumWidget.js +5 -1
- package/dist/ports/widgets/fallbacks/EnumWidget.js.map +1 -1
- package/dist/renderer/bloks/scene/Model.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/Model.js +16 -2
- package/dist/renderer/bloks/scene/Model.js.map +1 -1
- package/dist/vendor/core/ui/AsyncBoundary.d.ts.map +1 -1
- package/dist/vendor/core/ui/AsyncBoundary.js +1 -1
- package/dist/vendor/core/ui/AsyncBoundary.js.map +1 -1
- package/dist/vendor/core/ui/button.d.ts +1 -1
- package/dist/vendor/core/ui/button.d.ts.map +1 -1
- package/dist/vendor/core/ui/button.js +10 -2
- package/dist/vendor/core/ui/button.js.map +1 -1
- package/dist/vendor/core/ui/markdown.d.ts.map +1 -1
- package/dist/vendor/core/ui/markdown.js +1 -1
- package/dist/vendor/core/ui/markdown.js.map +1 -1
- package/dist/vendor/core/ui/name.d.ts +30 -0
- package/dist/vendor/core/ui/name.d.ts.map +1 -0
- package/dist/vendor/core/ui/name.js +40 -0
- package/dist/vendor/core/ui/name.js.map +1 -0
- package/dist/vendor/core/ui/overflow-tooltip.d.ts +20 -0
- package/dist/vendor/core/ui/overflow-tooltip.d.ts.map +1 -0
- package/dist/vendor/core/ui/overflow-tooltip.js +27 -0
- package/dist/vendor/core/ui/overflow-tooltip.js.map +1 -0
- package/dist/vendor/core/ui/select.js +3 -3
- package/dist/vendor/core/ui/select.js.map +1 -1
- package/dist/vendor/core/ui/tooltip.d.ts +1 -1
- package/dist/vendor/core/ui/tooltip.d.ts.map +1 -1
- package/dist/vendor/core/ui/tooltip.js +5 -2
- package/dist/vendor/core/ui/tooltip.js.map +1 -1
- package/package.json +1 -1
- package/src/ports/forms/ListSearchField.tsx +12 -9
- package/src/ports/forms/SearchField.tsx +9 -3
- package/src/ports/forms/StructurePickerControl.test.tsx +29 -1
- package/src/ports/forms/StructurePickerControl.tsx +38 -4
- package/src/ports/rekuest.ts +7 -7
- package/src/ports/structure/Structure.tsx +14 -5
- package/src/ports/widgets/custom/ListSearchWidget.tsx +3 -2
- package/src/ports/widgets/custom/SearchWidget.tsx +3 -2
- package/src/ports/widgets/fallbacks/EnumWidget.test.tsx +89 -0
- package/src/ports/widgets/fallbacks/EnumWidget.tsx +38 -13
- package/src/renderer/bloks/buttonsInForms.test.tsx +70 -0
- package/src/renderer/bloks/scene/Model.tsx +15 -2
- package/src/vendor/core/ui/AsyncBoundary.tsx +1 -0
- package/src/vendor/core/ui/button.tsx +5 -0
- package/src/vendor/core/ui/markdown.tsx +1 -0
- package/src/vendor/core/ui/name.tsx +69 -0
- package/src/vendor/core/ui/overflow-tooltip.tsx +59 -0
- package/src/vendor/core/ui/select.tsx +3 -3
- package/src/vendor/core/ui/tooltip.tsx +5 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../util/utils.js";
|
|
4
|
+
/** `.tiff`, `.ome.tiff`, `.tar.gz`: up to two short alphanumeric suffixes. */
|
|
5
|
+
const EXTENSION = /(?:\.[A-Za-z0-9]{1,5}){1,2}$/;
|
|
6
|
+
/**
|
|
7
|
+
* Where a long name is cut so both ends stay readable: the tail is the last
|
|
8
|
+
* `keep` characters before the extension plus the extension, the head is the
|
|
9
|
+
* rest. A name too short to be worth cutting comes back whole, as the head.
|
|
10
|
+
*/
|
|
11
|
+
export const splitName = (name, keep = 8) => {
|
|
12
|
+
const match = EXTENSION.exec(name);
|
|
13
|
+
// A dotfile (`.gitignore`) is all name, no extension.
|
|
14
|
+
const extension = match && match.index > 0 ? match[0] : "";
|
|
15
|
+
// By code point, so a surrogate pair is never cut in half.
|
|
16
|
+
const stem = Array.from(name.slice(0, name.length - extension.length));
|
|
17
|
+
if (keep <= 0 || stem.length <= keep * 2)
|
|
18
|
+
return { head: name, tail: "" };
|
|
19
|
+
return {
|
|
20
|
+
head: stem.slice(0, stem.length - keep).join(""),
|
|
21
|
+
tail: stem.slice(stem.length - keep).join("") + extension,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A name that keeps its start AND its end when it does not fit: the head
|
|
26
|
+
* gives way with an ellipsis, the tail (the last characters and the
|
|
27
|
+
* extension) never shrinks. Plain CSS, nothing is measured. When the name
|
|
28
|
+
* fits it reads as ordinary text; copying copies it whole.
|
|
29
|
+
*
|
|
30
|
+
* The head carries `data-overflow-text`, so inside an `OverflowTooltip` the
|
|
31
|
+
* tooltip opens exactly when the name is cut; elsewhere pass `title`.
|
|
32
|
+
* Like `truncate`, it needs `min-w-0` on every flex ancestor up to the one
|
|
33
|
+
* with a real width.
|
|
34
|
+
*/
|
|
35
|
+
function Name({ children, keep, inline = false, className, ...props }) {
|
|
36
|
+
const { head, tail } = splitName(children, keep);
|
|
37
|
+
return (_jsxs("span", { "data-slot": "name", className: cn(inline ? "inline-flex align-bottom" : "flex", "min-w-0 max-w-full overflow-hidden", className), ...props, children: [_jsx("span", { "data-overflow-text": "", className: "min-w-0 truncate whitespace-pre", children: head }), tail && _jsx("span", { className: "shrink-0 whitespace-pre", children: tail })] }));
|
|
38
|
+
}
|
|
39
|
+
export { Name };
|
|
40
|
+
//# sourceMappingURL=name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/name.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAElC,8EAA8E;AAC9E,MAAM,SAAS,GAAG,8BAA8B,CAAA;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,IAAI,GAAG,CAAC,EAAkC,EAAE;IAClF,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClC,sDAAsD;IACtD,MAAM,SAAS,GAAG,KAAK,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1D,2DAA2D;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;IACtE,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,GAAG,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;IACzE,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,SAAS;KAC1D,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;GAUG;AACH,SAAS,IAAI,CAAC,EACZ,QAAQ,EACR,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,SAAS,EACT,GAAG,KAAK,EAOT;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IAChD,OAAO,CACL,6BACY,MAAM,EAChB,SAAS,EAAE,EAAE,CACX,MAAM,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,MAAM,EAC5C,oCAAoC,EACpC,SAAS,CACV,KACG,KAAK,aAET,qCAAyB,EAAE,EAAC,SAAS,EAAC,iCAAiC,YACpE,IAAI,GACA,EACN,IAAI,IAAI,eAAM,SAAS,EAAC,yBAAyB,YAAE,IAAI,GAAQ,IAC3D,CACR,CAAA;AACH,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TooltipContent } from "./tooltip";
|
|
3
|
+
/** Mark the text an `OverflowTooltip` watches: it opens when this is cut off. */
|
|
4
|
+
export declare const OVERFLOW_TEXT: {
|
|
5
|
+
readonly "data-overflow-text": "";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A tooltip for text that may not fit: it opens only when an element marked
|
|
9
|
+
* with `OVERFLOW_TEXT` inside the trigger is cut off, or always when `always`
|
|
10
|
+
* (say, a description the trigger has no room for). The trigger is the child.
|
|
11
|
+
*/
|
|
12
|
+
declare function OverflowTooltip({ content, always, side, className, children, }: {
|
|
13
|
+
content: React.ReactNode;
|
|
14
|
+
always?: boolean;
|
|
15
|
+
side?: React.ComponentProps<typeof TooltipContent>["side"];
|
|
16
|
+
className?: string;
|
|
17
|
+
children: React.ReactElement;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
export { OverflowTooltip };
|
|
20
|
+
//# sourceMappingURL=overflow-tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overflow-tooltip.d.ts","sourceRoot":"","sources":["../../../../src/vendor/core/ui/overflow-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAW,cAAc,EAAkB,MAAM,WAAW,CAAA;AAEnE,iFAAiF;AACjF,eAAO,MAAM,aAAa;;CAAwC,CAAA;AAWlE;;;;GAIG;AACH,iBAAS,eAAe,CAAC,EACvB,OAAO,EACP,MAAc,EACd,IAAI,EACJ,SAAS,EACT,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAA;CAC7B,qBAsBA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../util/utils.js";
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
5
|
+
/** Mark the text an `OverflowTooltip` watches: it opens when this is cut off. */
|
|
6
|
+
export const OVERFLOW_TEXT = { "data-overflow-text": "" };
|
|
7
|
+
const isCutOff = (el) => el.scrollWidth > el.clientWidth + 1 || el.scrollHeight > el.clientHeight + 1;
|
|
8
|
+
const hasOverflow = (root) => {
|
|
9
|
+
if (!root)
|
|
10
|
+
return false;
|
|
11
|
+
if (root.matches("[data-overflow-text]") && isCutOff(root))
|
|
12
|
+
return true;
|
|
13
|
+
return Array.from(root.querySelectorAll("[data-overflow-text]")).some(isCutOff);
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A tooltip for text that may not fit: it opens only when an element marked
|
|
17
|
+
* with `OVERFLOW_TEXT` inside the trigger is cut off, or always when `always`
|
|
18
|
+
* (say, a description the trigger has no room for). The trigger is the child.
|
|
19
|
+
*/
|
|
20
|
+
function OverflowTooltip({ content, always = false, side, className, children, }) {
|
|
21
|
+
const triggerRef = React.useRef(null);
|
|
22
|
+
const [open, setOpen] = React.useState(false);
|
|
23
|
+
const onOpenChange = React.useCallback((next) => setOpen(next && (always || hasOverflow(triggerRef.current))), [always]);
|
|
24
|
+
return (_jsxs(Tooltip, { open: open, onOpenChange: onOpenChange, children: [_jsx(TooltipTrigger, { asChild: true, ref: triggerRef, children: children }), _jsx(TooltipContent, { side: side, className: cn("whitespace-normal break-words", className), children: content })] }));
|
|
25
|
+
}
|
|
26
|
+
export { OverflowTooltip };
|
|
27
|
+
//# sourceMappingURL=overflow-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overflow-tooltip.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/overflow-tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EA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E,UAAU,YACpC,QAAQ,GACM,EACjB,KAAC,cAAc,IACb,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,YAExD,OAAO,GACO,IACT,CACX,CAAA;AACH,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -14,17 +14,17 @@ function SelectValue({ ...props }) {
|
|
|
14
14
|
return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
15
15
|
}
|
|
16
16
|
function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
17
|
-
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:
|
|
17
|
+
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:overflow-hidden *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDownIcon, { className: "text-muted-foreground size-3.5 pointer-events-none" }) })] }));
|
|
18
18
|
}
|
|
19
19
|
function SelectContent({ className, children, position = "popper", align = "center", ...props }) {
|
|
20
20
|
const chromeZoom = useChromeZoomClass();
|
|
21
|
-
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn(chromeZoom, "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { "data-position": position, className: cn("data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]", position === "popper" && ""), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
21
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn(chromeZoom, "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 max-w-(--radix-select-content-available-width) rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { "data-position": position, className: cn("data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]", position === "popper" && ""), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
22
22
|
}
|
|
23
23
|
function SelectLabel({ className, ...props }) {
|
|
24
24
|
return (_jsx(SelectPrimitive.Label, { "data-slot": "select-label", className: cn("text-muted-foreground px-2 py-1.5 text-xs", className), ...props }));
|
|
25
25
|
}
|
|
26
26
|
function SelectItem({ className, children, ...props }) {
|
|
27
|
-
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md
|
|
27
|
+
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1 pl-2 pr-8 break-words text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props, children: [_jsx("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "pointer-events-none" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
28
28
|
}
|
|
29
29
|
function SelectSeparator({ className, ...props }) {
|
|
30
30
|
return (_jsx(SelectPrimitive.Separator, { "data-slot": "select-separator", className: cn("bg-border/50 -mx-1 my-1 h-px pointer-events-none", className), ...props }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAExE,SAAS,MAAM,CAAC,EACd,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C;IACnD,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,KACvC,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EAC2C;IACnD,OAAO,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAA;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,EACrB,SAAS,EACT,IAAI,GAAG,SAAS,EAChB,QAAQ,EACR,GAAG,KAAK,EAGT;IACC,OAAO,CACL,MAAC,eAAe,CAAC,OAAO,iBACZ,gBAAgB,eACf,IAAI,EACf,SAAS,EAAE,EAAE,CACX,
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAExE,SAAS,MAAM,CAAC,EACd,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C;IACnD,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,KACvC,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EAC2C;IACnD,OAAO,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAA;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,EACrB,SAAS,EACT,IAAI,GAAG,SAAS,EAChB,QAAQ,EACR,GAAG,KAAK,EAGT;IACC,OAAO,CACL,MAAC,eAAe,CAAC,OAAO,iBACZ,gBAAgB,eACf,IAAI,EACf,SAAS,EAAE,EAAE,CACX,u3BAAu3B,EACv3B,SAAS,CACV,KACG,KAAK,aAER,QAAQ,EACT,KAAC,eAAe,CAAC,IAAI,IAAC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AAS,IAAC,SAAS,EAAC,qBAAqB,GAAG,GACf,GAC3B,EACP,KAAC,eAAe,CAAC,QAAQ,cAAE,QAAQ,GAA4B,IAC1C,CACxB,CAAA;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EAC+C;IACvD,OAAO,CACL,KAAC,eAAe,CAAC,SAAS,iBACd,kBAAkB,EAC5B,SAAS,EAAE,EAAE,CAAC,kDAAkD,EAAE,SAAS,CAAC,KACxE,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACoD;IAC5D,OAAO,CACL,KAAC,eAAe,CAAC,cAAc,iBACnB,yBAAyB,EACnC,SAAS,EAAE,EAAE,CAAC,6GAA6G,EAAE,SAAS,CAAC,KACnI,KAAK,YAET,KAAC,aAAa,KACZ,GAC6B,CAClC,CAAA;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACsD;IAC9D,OAAO,CACL,KAAC,eAAe,CAAC,gBAAgB,iBACrB,2BAA2B,EACrC,SAAS,EAAE,EAAE,CAAC,6GAA6G,EAAE,SAAS,CAAC,KACnI,KAAK,YAET,KAAC,eAAe,KACd,GAC+B,CACpC,CAAA;AACH,CAAC;AAED,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,WAAW,EACZ,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
|
|
4
4
|
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
|
|
5
|
-
declare function TooltipTrigger({ asChild, ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function TooltipTrigger({ asChild, type, ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
|
|
6
6
|
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element;
|
|
7
7
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
8
8
|
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/vendor/core/ui/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,iBAAS,eAAe,CAAC,EACvB,aAAiB,EACjB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,qBAQxD;AAED,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,qBAMpD;AAED,iBAAS,cAAc,CAAC,EACtB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/vendor/core/ui/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,iBAAS,eAAe,CAAC,EACvB,aAAiB,EACjB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,qBAQxD;AAED,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,qBAMpD;AAED,iBAAS,cAAc,CAAC,EACtB,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,qBAKvD;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,UAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,qBAmBvD;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -10,8 +10,11 @@ function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
|
10
10
|
function Tooltip({ ...props }) {
|
|
11
11
|
return (_jsx(TooltipProvider, { children: _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) }));
|
|
12
12
|
}
|
|
13
|
-
function TooltipTrigger({ asChild, ...props }) {
|
|
14
|
-
|
|
13
|
+
function TooltipTrigger({ asChild, type, ...props }) {
|
|
14
|
+
const merged = resolveTriggerAsChild(asChild, props.children);
|
|
15
|
+
// Radix draws the trigger as a bare <button>, a form's submit by default: inside a form,
|
|
16
|
+
// hovering is all it is for. On a child it is merged onto, the child says what it is.
|
|
17
|
+
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", asChild: merged, type: merged ? type : (type ?? "button"), ...props });
|
|
15
18
|
}
|
|
16
19
|
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
17
20
|
const chromeZoom = useChromeZoomClass();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE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../vendor/core/ui/name";
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
Command,
|
|
@@ -19,6 +20,7 @@ import { cn, notEmpty } from "../../vendor/core/util/utils";
|
|
|
19
20
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
20
21
|
import { useFormContext } from "react-hook-form";
|
|
21
22
|
import { Badge } from "../../vendor/core/ui/badge";
|
|
23
|
+
import { OverflowTooltip } from "../../vendor/core/ui/overflow-tooltip";
|
|
22
24
|
import { type FieldProps } from "./types";
|
|
23
25
|
|
|
24
26
|
export type Option = {
|
|
@@ -59,15 +61,16 @@ export const ListButtonLabel = (props: {
|
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
return (
|
|
62
|
-
<div className="
|
|
64
|
+
<div className="flex min-w-0 flex-row flex-wrap gap-2 p-1">
|
|
63
65
|
{options.map((l, index) => (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
<OverflowTooltip key={index} content={l.label}>
|
|
67
|
+
<Badge
|
|
68
|
+
onClick={() => remove(l.value)}
|
|
69
|
+
className="cursor-pointer px-1 py-1 bg-muted my-2 max-w-full"
|
|
70
|
+
>
|
|
71
|
+
<Name>{l.label}</Name>
|
|
72
|
+
</Badge>
|
|
73
|
+
</OverflowTooltip>
|
|
71
74
|
))}
|
|
72
75
|
{error}
|
|
73
76
|
</div>
|
|
@@ -253,7 +256,7 @@ export const ListSearchField = ({
|
|
|
253
256
|
setInputValue("");
|
|
254
257
|
}}
|
|
255
258
|
>
|
|
256
|
-
{option.label}
|
|
259
|
+
<Name title={option.label}>{option.label}</Name>
|
|
257
260
|
<CheckIcon
|
|
258
261
|
className={cn(
|
|
259
262
|
"ml-auto h-4 w-4",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CheckIcon } from "lucide-react";
|
|
2
|
+
import { Name } from "../../vendor/core/ui/name";
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
Command,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
PopoverAnchor,
|
|
21
22
|
PopoverContent,
|
|
22
23
|
} from "../../vendor/core/ui/popover";
|
|
24
|
+
import { OverflowTooltip } from "../../vendor/core/ui/overflow-tooltip";
|
|
23
25
|
import { useLatestRef } from "../../vendor/core/util/hooks/useLatestRef";
|
|
24
26
|
import { cn, notEmpty } from "../../vendor/core/util/utils";
|
|
25
27
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
@@ -64,8 +66,12 @@ export const ButtonLabel = (props: {
|
|
|
64
66
|
}, [props.value, props.searchKey]);
|
|
65
67
|
|
|
66
68
|
return (
|
|
67
|
-
<div className="flex flex-row items-center">
|
|
68
|
-
{option?.label &&
|
|
69
|
+
<div className="flex min-w-0 flex-row items-center">
|
|
70
|
+
{option?.label && (
|
|
71
|
+
<OverflowTooltip content={option.label}>
|
|
72
|
+
<Name className="text-foreground">{option.label}</Name>
|
|
73
|
+
</OverflowTooltip>
|
|
74
|
+
)}
|
|
69
75
|
{error}
|
|
70
76
|
</div>
|
|
71
77
|
);
|
|
@@ -287,7 +293,7 @@ export const SearchField = ({
|
|
|
287
293
|
setOpen(false);
|
|
288
294
|
}}
|
|
289
295
|
>
|
|
290
|
-
{option.label}
|
|
296
|
+
<Name title={option.label}>{option.label}</Name>
|
|
291
297
|
<CheckIcon
|
|
292
298
|
className={cn(
|
|
293
299
|
"ml-auto h-4 w-4",
|
|
@@ -27,7 +27,7 @@ vi.mock("../../vendor/core/ui/command", () => ({
|
|
|
27
27
|
),
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
|
-
import { PICKER_PAGE_SIZE, StructurePickerControl, type PickerRequest, type PickerScope } from "./StructurePickerControl";
|
|
30
|
+
import { PICKER_PAGE_SIZE, StructurePickerControl, groupItems, type PickerRequest, type PickerScope } from "./StructurePickerControl";
|
|
31
31
|
|
|
32
32
|
afterEach(cleanup);
|
|
33
33
|
|
|
@@ -109,3 +109,31 @@ describe("the structure picker control", () => {
|
|
|
109
109
|
expect(load).toHaveBeenCalledTimes(1);
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
|
+
|
|
113
|
+
describe("groupItems", () => {
|
|
114
|
+
type Lens = { id: string; group?: string };
|
|
115
|
+
const groupOf = (lens: Lens) => lens.group;
|
|
116
|
+
const ids = (buckets: { group: string | undefined; items: Lens[] }[]) =>
|
|
117
|
+
buckets.map((bucket) => [bucket.group, bucket.items.map((lens) => lens.id)]);
|
|
118
|
+
|
|
119
|
+
it("is one headless bucket when nothing is grouped", () => {
|
|
120
|
+
expect(ids(groupItems([{ id: "1" }, { id: "2" }], groupOf))).toEqual([[undefined, ["1", "2"]]]);
|
|
121
|
+
expect(ids(groupItems([{ id: "1", group: "a" }]))).toEqual([[undefined, ["1"]]]);
|
|
122
|
+
expect(groupItems([], groupOf)).toEqual([]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("opens a group where it first appears and adds a later page to it", () => {
|
|
126
|
+
const page1 = [{ id: "1", group: "Series001" }, { id: "2", group: "Series002" }];
|
|
127
|
+
const page2 = [{ id: "3", group: "Series001" }, { id: "4", group: "Series003" }];
|
|
128
|
+
expect(ids(groupItems([...page1, ...page2], groupOf))).toEqual([
|
|
129
|
+
["Series001", ["1", "3"]],
|
|
130
|
+
["Series002", ["2"]],
|
|
131
|
+
["Series003", ["4"]],
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("lists the ungrouped first, and a blank group is no group", () => {
|
|
136
|
+
const items = [{ id: "1", group: "a" }, { id: "2" }, { id: "3", group: " " }];
|
|
137
|
+
expect(ids(groupItems(items, groupOf))).toEqual([[undefined, ["2", "3"]], ["a", ["1"]]]);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CommandItem,
|
|
9
9
|
CommandList,
|
|
10
10
|
} from "../../vendor/core/ui/command";
|
|
11
|
+
import { Name } from "../../vendor/core/ui/name";
|
|
11
12
|
import { Popover, PopoverContent, PopoverTrigger } from "../../vendor/core/ui/popover";
|
|
12
13
|
import { useDebouncedCallback } from "../../vendor/core/util/hooks/useDebouncedCallback";
|
|
13
14
|
import { useLatestRef } from "../../vendor/core/util/hooks/useLatestRef";
|
|
@@ -45,6 +46,12 @@ export type StructurePickerControlProps<T> = {
|
|
|
45
46
|
renderRow: (item: T) => ReactNode;
|
|
46
47
|
/** The chosen one, in the closed field: one line. */
|
|
47
48
|
renderValue: (item: T) => ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* What a candidate belongs to (a lens' dataset), said once as a heading over
|
|
51
|
+
* every candidate sharing it rather than on each row. Candidates without one
|
|
52
|
+
* are listed first, under no heading.
|
|
53
|
+
*/
|
|
54
|
+
groupOf?: (item: T) => string | undefined;
|
|
48
55
|
/** What the list is fixed to, shown so an empty list explains itself. */
|
|
49
56
|
requires?: readonly DescriptorConstraint[];
|
|
50
57
|
scope?: PickerScope;
|
|
@@ -55,6 +62,29 @@ export type StructurePickerControlProps<T> = {
|
|
|
55
62
|
className?: string;
|
|
56
63
|
};
|
|
57
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Candidates by what they belong to, in the order each group first appears:
|
|
67
|
+
* a group a later page returns to is added to, never opened a second time.
|
|
68
|
+
* The ungrouped come first, whenever they arrive.
|
|
69
|
+
*/
|
|
70
|
+
export const groupItems = <T,>(
|
|
71
|
+
items: readonly T[],
|
|
72
|
+
groupOf?: (item: T) => string | undefined,
|
|
73
|
+
): { group: string | undefined; items: T[] }[] => {
|
|
74
|
+
const ungrouped: T[] = [];
|
|
75
|
+
const groups = new Map<string, T[]>();
|
|
76
|
+
for (const item of items) {
|
|
77
|
+
const group = groupOf?.(item)?.trim();
|
|
78
|
+
if (!group) ungrouped.push(item);
|
|
79
|
+
else if (groups.has(group)) groups.get(group)!.push(item);
|
|
80
|
+
else groups.set(group, [item]);
|
|
81
|
+
}
|
|
82
|
+
return [
|
|
83
|
+
...(ungrouped.length > 0 ? [{ group: undefined, items: ungrouped }] : []),
|
|
84
|
+
...Array.from(groups, ([group, members]) => ({ group, items: members })),
|
|
85
|
+
];
|
|
86
|
+
};
|
|
87
|
+
|
|
58
88
|
/** The chosen object in the closed field, resolved by id. Mounted per id (`key`), so it starts out loading. */
|
|
59
89
|
const Chosen = <T,>({
|
|
60
90
|
id,
|
|
@@ -101,6 +131,7 @@ export const StructurePickerControl = <T,>({
|
|
|
101
131
|
keyOf,
|
|
102
132
|
renderRow,
|
|
103
133
|
renderValue,
|
|
134
|
+
groupOf,
|
|
104
135
|
requires,
|
|
105
136
|
scope,
|
|
106
137
|
paged = true,
|
|
@@ -270,9 +301,12 @@ export const StructurePickerControl = <T,>({
|
|
|
270
301
|
)}
|
|
271
302
|
</div>
|
|
272
303
|
)}
|
|
273
|
-
{items.
|
|
274
|
-
<CommandGroup
|
|
275
|
-
{
|
|
304
|
+
{groupItems(items, groupOf).map((bucket) => (
|
|
305
|
+
<CommandGroup
|
|
306
|
+
key={bucket.group ?? ""}
|
|
307
|
+
heading={bucket.group ? <Name title={bucket.group}>{bucket.group}</Name> : undefined}
|
|
308
|
+
>
|
|
309
|
+
{bucket.items.map((item) => {
|
|
276
310
|
const id = keyOf(item);
|
|
277
311
|
return (
|
|
278
312
|
<CommandItem
|
|
@@ -291,7 +325,7 @@ export const StructurePickerControl = <T,>({
|
|
|
291
325
|
);
|
|
292
326
|
})}
|
|
293
327
|
</CommandGroup>
|
|
294
|
-
)}
|
|
328
|
+
))}
|
|
295
329
|
{hasMore && (
|
|
296
330
|
<div ref={sentinelRef} className="flex items-center justify-center py-2 text-xs text-muted-foreground">
|
|
297
331
|
{loadingMore ? "Loading more…" : ""}
|
package/src/ports/rekuest.ts
CHANGED
|
@@ -72,7 +72,7 @@ export const ReturnWidgetKind = {
|
|
|
72
72
|
} as const;
|
|
73
73
|
export type ReturnWidgetKind = (typeof ReturnWidgetKind)[keyof typeof ReturnWidgetKind];
|
|
74
74
|
|
|
75
|
-
export type ArgChildPortDeepFragment = { __typename: 'ArgPort', kind: PortKind, key: string, label?: string | null, identifier?: any | null, referenceUnit?: string | null, proposedUnits?: Array<string> | null, dimension?: string | null, description?: string | null, nullable: boolean, default?: any | null, requires?: Array<{ __typename?: 'Requires', key: string, operator: DescriptorOperator, value?: any | null }> | null, choices?: Array<{ __typename?: 'Choice', value: any, label: string, description?: string | null }> | null, widget?: (
|
|
75
|
+
export type ArgChildPortDeepFragment = { __typename: 'ArgPort', kind: PortKind, key: string, label?: string | null, identifier?: any | null, referenceUnit?: string | null, proposedUnits?: Array<string> | null, dimension?: string | null, description?: string | null, nullable: boolean, default?: any | null, requires?: Array<{ __typename?: 'Requires', key: string, operator: DescriptorOperator, value?: any | null }> | null, choices?: Array<{ __typename?: 'Choice', value: any, label: string, description?: string | null }> | null, widget?: BlokAssignWidgetFragment | (
|
|
76
76
|
{ __typename?: 'ChoiceAssignWidget' }
|
|
77
77
|
& AssignWidget_ChoiceAssignWidget_Fragment
|
|
78
78
|
) | (
|
|
@@ -93,7 +93,7 @@ export type ArgChildPortDeepFragment = { __typename: 'ArgPort', kind: PortKind,
|
|
|
93
93
|
) | (
|
|
94
94
|
{ __typename?: 'StringAssignWidget' }
|
|
95
95
|
& AssignWidget_StringAssignWidget_Fragment
|
|
96
|
-
) | null, children?: Array<{ __typename: 'ArgPort', kind: PortKind, key: string, identifier?: any | null, nullable: boolean, requires?: Array<{ __typename?: 'Requires', key: string, operator: DescriptorOperator, value?: any | null }> | null, widget?: (
|
|
96
|
+
) | null, children?: Array<{ __typename: 'ArgPort', kind: PortKind, key: string, identifier?: any | null, nullable: boolean, requires?: Array<{ __typename?: 'Requires', key: string, operator: DescriptorOperator, value?: any | null }> | null, widget?: BlokAssignWidgetFragment | (
|
|
97
97
|
{ __typename?: 'ChoiceAssignWidget' }
|
|
98
98
|
& AssignWidget_ChoiceAssignWidget_Fragment
|
|
99
99
|
) | (
|
|
@@ -119,7 +119,7 @@ export type ArgChildPortDeepFragment = { __typename: 'ArgPort', kind: PortKind,
|
|
|
119
119
|
export type ArgChildPortFragment = { __typename: 'ArgPort', kind: PortKind, key: string, label?: string | null, identifier?: any | null, referenceUnit?: string | null, proposedUnits?: Array<string> | null, dimension?: string | null, nullable: boolean, description?: string | null, default?: any | null, requires?: Array<{ __typename?: 'Requires', key: string, operator: DescriptorOperator, value?: any | null }> | null, children?: Array<(
|
|
120
120
|
{ __typename?: 'ArgPort' }
|
|
121
121
|
& ArgChildPortNestedFragment
|
|
122
|
-
)> | null, widget?: (
|
|
122
|
+
)> | null, widget?: BlokAssignWidgetFragment | (
|
|
123
123
|
{ __typename?: 'ChoiceAssignWidget' }
|
|
124
124
|
& AssignWidget_ChoiceAssignWidget_Fragment
|
|
125
125
|
) | (
|
|
@@ -157,7 +157,7 @@ export type ArgChildPortFragment = { __typename: 'ArgPort', kind: PortKind, key:
|
|
|
157
157
|
export type ArgChildPortNestedFragment = { __typename: 'ArgPort', kind: PortKind, key: string, label?: string | null, identifier?: any | null, referenceUnit?: string | null, proposedUnits?: Array<string> | null, dimension?: string | null, description?: string | null, nullable: boolean, default?: any | null, requires?: Array<{ __typename?: 'Requires', key: string, operator: DescriptorOperator, value?: any | null }> | null, children?: Array<(
|
|
158
158
|
{ __typename?: 'ArgPort' }
|
|
159
159
|
& ArgChildPortDeepFragment
|
|
160
|
-
)> | null, choices?: Array<{ __typename?: 'Choice', value: any, label: string, description?: string | null }> | null, widget?: (
|
|
160
|
+
)> | null, choices?: Array<{ __typename?: 'Choice', value: any, label: string, description?: string | null }> | null, widget?: BlokAssignWidgetFragment | (
|
|
161
161
|
{ __typename?: 'ChoiceAssignWidget' }
|
|
162
162
|
& AssignWidget_ChoiceAssignWidget_Fragment
|
|
163
163
|
) | (
|
|
@@ -201,7 +201,7 @@ export type ArgPortFragment = { __typename: 'ArgPort', key: string, label?: stri
|
|
|
201
201
|
) | (
|
|
202
202
|
{ __typename?: 'MessageEffect' }
|
|
203
203
|
& PortEffect_MessageEffect_Fragment
|
|
204
|
-
)> | null, widget?: (
|
|
204
|
+
)> | null, widget?: BlokAssignWidgetFragment | (
|
|
205
205
|
{ __typename?: 'ChoiceAssignWidget' }
|
|
206
206
|
& AssignWidget_ChoiceAssignWidget_Fragment
|
|
207
207
|
) | (
|
|
@@ -332,7 +332,7 @@ export type ChoiceReturnWidgetFragment = { __typename: 'ChoiceReturnWidget', kin
|
|
|
332
332
|
export type CustomAssignWidgetFragment = { __typename: 'CustomAssignWidget', kind: AssignWidgetKind, followValue?: string | null, component: string, children?: any | null, dependencies?: Array<string> | null, props?: Array<(
|
|
333
333
|
{ __typename?: 'ComponentProp' }
|
|
334
334
|
& BlokComponentPropFragment
|
|
335
|
-
)> | null, fallback?: (
|
|
335
|
+
)> | null, fallback?: { __typename: 'BlokAssignWidget', kind: AssignWidgetKind } | (
|
|
336
336
|
{ __typename: 'ChoiceAssignWidget', kind: AssignWidgetKind }
|
|
337
337
|
& ChoiceAssignWidgetFragment
|
|
338
338
|
) | { __typename: 'CustomAssignWidget', kind: AssignWidgetKind } | (
|
|
@@ -362,7 +362,7 @@ export type CustomReturnWidgetFragment = { __typename: 'CustomReturnWidget', kin
|
|
|
362
362
|
& BlokComponentPropFragment
|
|
363
363
|
)> | null };
|
|
364
364
|
|
|
365
|
-
export type FilterPortFragment = { __typename: 'ArgPort', kind: PortKind, key: string, identifier?: any | null, description?: string | null, nullable: boolean, widget?: { __typename?: 'ChoiceAssignWidget' } | { __typename?: 'CustomAssignWidget' } | { __typename?: 'ProxyWidget' } | { __typename?: 'SearchAssignWidget', query: string } | { __typename?: 'SliderAssignWidget' } | { __typename?: 'StateChoiceAssignWidget' } | { __typename?: 'StringAssignWidget' } | null };
|
|
365
|
+
export type FilterPortFragment = { __typename: 'ArgPort', kind: PortKind, key: string, identifier?: any | null, description?: string | null, nullable: boolean, widget?: { __typename?: 'BlokAssignWidget' } | { __typename?: 'ChoiceAssignWidget' } | { __typename?: 'CustomAssignWidget' } | { __typename?: 'ProxyWidget' } | { __typename?: 'SearchAssignWidget', query: string } | { __typename?: 'SliderAssignWidget' } | { __typename?: 'StateChoiceAssignWidget' } | { __typename?: 'StringAssignWidget' } | null };
|
|
366
366
|
|
|
367
367
|
export type HideEffectFragment = (
|
|
368
368
|
{ __typename: 'HideEffect', fade: boolean }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import {Name} from '../../vendor/core/ui/name';
|
|
2
3
|
import {structureCatalog} from '../../catalogs';
|
|
3
4
|
import {StructurePickerControl, type PickerRequest} from '../forms/StructurePickerControl';
|
|
4
5
|
import {portHost} from '../host';
|
|
@@ -36,20 +37,26 @@ const Notice = ({children, className}: {children: React.ReactNode; className?: s
|
|
|
36
37
|
);
|
|
37
38
|
|
|
38
39
|
/** One candidate, as a search answers it. */
|
|
39
|
-
type Option = {value: string; label: string; description?: string};
|
|
40
|
+
type Option = {value: string; label: string; description?: string; group?: string};
|
|
40
41
|
|
|
41
42
|
const keyOf = (option: Option) => option.value;
|
|
42
43
|
|
|
43
44
|
const renderOption = (option: Option) => (
|
|
44
45
|
<div className="flex min-w-0 flex-col">
|
|
45
|
-
<
|
|
46
|
+
<Name title={option.label}>{option.label}</Name>
|
|
46
47
|
{option.description && (
|
|
47
|
-
<
|
|
48
|
+
<Name title={option.description} className="text-xs text-muted-foreground">
|
|
49
|
+
{option.description}
|
|
50
|
+
</Name>
|
|
48
51
|
)}
|
|
49
52
|
</div>
|
|
50
53
|
);
|
|
51
54
|
|
|
52
|
-
const
|
|
55
|
+
const groupOf = (option: Option) => option.group;
|
|
56
|
+
|
|
57
|
+
const renderChosen = (option: Option) => (
|
|
58
|
+
<Name title={option.group ? `${option.label} (${option.group})` : option.label}>{option.label}</Name>
|
|
59
|
+
);
|
|
53
60
|
|
|
54
61
|
/**
|
|
55
62
|
* The variables a picker's query is handed by the picker itself: what the
|
|
@@ -71,13 +78,14 @@ const asVariable = (raw: unknown): unknown => {
|
|
|
71
78
|
const asOptions = (raw: unknown): Option[] =>
|
|
72
79
|
(Array.isArray(raw) ? raw : []).flatMap(entry => {
|
|
73
80
|
if (!entry || typeof entry !== 'object') return [];
|
|
74
|
-
const {value, label, description} = entry as Record<string, unknown>;
|
|
81
|
+
const {value, label, description, group} = entry as Record<string, unknown>;
|
|
75
82
|
if (value == null) return [];
|
|
76
83
|
return [
|
|
77
84
|
{
|
|
78
85
|
value: String(value),
|
|
79
86
|
label: typeof label === 'string' && label ? label : String(value),
|
|
80
87
|
description: typeof description === 'string' && description ? description : undefined,
|
|
88
|
+
group: typeof group === 'string' && group ? group : undefined,
|
|
81
89
|
},
|
|
82
90
|
];
|
|
83
91
|
});
|
|
@@ -200,6 +208,7 @@ const StructurePickerRender: BlokRender<(typeof structureCatalog.components)['St
|
|
|
200
208
|
keyOf={keyOf}
|
|
201
209
|
renderRow={renderOption}
|
|
202
210
|
renderValue={renderChosen}
|
|
211
|
+
groupOf={groupOf}
|
|
203
212
|
requires={
|
|
204
213
|
(queried ? declared.includes('requires') : sourceHonoursRequires) ? port?.requires : undefined
|
|
205
214
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { portDescription, portLabel } from "../../engine/portPresentation";
|
|
2
|
+
import { Name } from "../../../vendor/core/ui/name";
|
|
2
3
|
import {
|
|
3
4
|
PAGE_SIZE,
|
|
4
5
|
queryDeclaresPagination,
|
|
@@ -96,7 +97,7 @@ export const ListButtonLabel = (props: {
|
|
|
96
97
|
title="Remove"
|
|
97
98
|
className="group/chip cursor-pointer pr-1.5"
|
|
98
99
|
>
|
|
99
|
-
<
|
|
100
|
+
<Name className="max-w-40" title={`Remove ${l.label}`}>{l.label}</Name>
|
|
100
101
|
<X className="text-muted-foreground transition-colors group-hover/chip:text-foreground" />
|
|
101
102
|
</Badge>
|
|
102
103
|
))}
|
|
@@ -414,7 +415,7 @@ export const ListSearchWidget = (
|
|
|
414
415
|
}
|
|
415
416
|
}}
|
|
416
417
|
>
|
|
417
|
-
{option.label}
|
|
418
|
+
<Name title={option.label}>{option.label}</Name>
|
|
418
419
|
<CheckIcon
|
|
419
420
|
className={cn(
|
|
420
421
|
"ml-auto h-4 w-4",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { portDescription, portLabel } from "../../engine/portPresentation";
|
|
2
|
+
import { Name } from "../../../vendor/core/ui/name";
|
|
2
3
|
import { Badge } from "../../../vendor/core/ui/badge";
|
|
3
4
|
import { type SearchAssignWidgetFragment } from "../../rekuest";
|
|
4
5
|
import useWidgetDependencies from "../../engine/useWidgetDependencies";
|
|
@@ -88,7 +89,7 @@ export const ButtonLabel = (props: {
|
|
|
88
89
|
{loading && !option && !error && (
|
|
89
90
|
<span className="h-3 w-24 animate-pulse rounded-full bg-muted-foreground/20" />
|
|
90
91
|
)}
|
|
91
|
-
{option?.label && <
|
|
92
|
+
{option?.label && <Name title={option.label}>{option.label}</Name>}
|
|
92
93
|
{error && (
|
|
93
94
|
<span className="flex items-center gap-1 text-xs text-destructive shrink-0">
|
|
94
95
|
<AlertCircle className="h-3 w-3 shrink-0" />
|
|
@@ -395,7 +396,7 @@ export const SearchWidget = (
|
|
|
395
396
|
setOpen(false);
|
|
396
397
|
}}
|
|
397
398
|
>
|
|
398
|
-
{option.label}
|
|
399
|
+
<Name title={option.label}>{option.label}</Name>
|
|
399
400
|
<CheckIcon
|
|
400
401
|
className={cn(
|
|
401
402
|
"ml-auto h-4 w-4",
|