@inf-monkeys-tech/monkeys-design 2.0.353 → 2.0.355
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/capabilities/index.js +6 -6
- package/dist/components/capabilities/index.js.map +1 -1
- package/dist/components/capabilities/index.mjs +6 -6
- package/dist/components/capabilities/index.mjs.map +1 -1
- package/dist/sources/{8eca3c638e118be99590702982463379843864bec2644fde4ba292e72c1e8756.tsx → 764d9fca43867695ad465240ff269071217ea7046d12f537b44e09a29672d0f8.tsx} +5 -3
- package/dist/sources/{621d66771e3dd60266b209e82fd5ddbcad025b0264876f74e92ddf2f182bc0d9.tsx → c236e4538d94e91f41f996dcbd3b3cee3bdae0101b4a1ab7e307189904a02aa1.tsx} +4 -3
- package/dist/sources/{264f5e3a39e73145b415df5f8d694b0bb5245d4fd39ffaf72f0104623200a97b.tsx → d3e5c2b68efc11dd03e897836f865cec285d8ac234032060bfd3d87f7e20efb5.tsx} +5 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ export interface RecordEditorStringSelectionProps {
|
|
|
7
7
|
field: JsonObject;
|
|
8
8
|
value: string[];
|
|
9
9
|
disabled: boolean;
|
|
10
|
+
/** Let the list shrink inside a height-constrained popover; other controls stay fixed. */
|
|
11
|
+
constrainHeight?: boolean;
|
|
10
12
|
id: string;
|
|
11
13
|
domId: string;
|
|
12
14
|
translate: CapabilityTranslate;
|
|
@@ -22,7 +24,7 @@ const object = (value: unknown): value is JsonObject => Boolean(value) && typeof
|
|
|
22
24
|
const validId = (value: unknown): value is string => typeof value === 'string' && value.trim().length > 0 && value.length <= 256 && !/[\u0000-\u001f\u007f-\u009f]/.test(value);
|
|
23
25
|
|
|
24
26
|
/** Local string selection; candidate discovery and draft ownership remain outside this control. */
|
|
25
|
-
export function RecordEditorStringSelection({ field, value, disabled, id, domId, translate, resolveLabel, onChange }: RecordEditorStringSelectionProps) {
|
|
27
|
+
export function RecordEditorStringSelection({ field, value, disabled, constrainHeight = false, id, domId, translate, resolveLabel, onChange }: RecordEditorStringSelectionProps) {
|
|
26
28
|
const [search, setSearch] = useState('');
|
|
27
29
|
const [manual, setManual] = useState('');
|
|
28
30
|
const [scrollTop, setScrollTop] = useState(0);
|
|
@@ -75,7 +77,7 @@ export function RecordEditorStringSelection({ field, value, disabled, id, domId,
|
|
|
75
77
|
if (!selected.has(candidate)) change([...value, candidate]);
|
|
76
78
|
setManual('');
|
|
77
79
|
};
|
|
78
|
-
return <div data-editor-string-selection={id}>
|
|
80
|
+
return <div data-editor-string-selection={id} style={constrainHeight ? { display: 'flex', flexDirection: 'column', minHeight: 0, overflow: 'hidden' } : undefined}>
|
|
79
81
|
{field.searchable === true ? <BaseInput type="search" aria-label={translate('monkeys.design.capability.orderedSelection.search')} value={search} disabled={disabled} onChange={event => { setSearch(event.currentTarget.value); setScrollTop(0); if (viewport.current) viewport.current.scrollTop = 0; }} /> : null}
|
|
80
82
|
{field.allowCustomValues === true ? <div className="flex items-center gap-2"><BaseInput aria-label={translate('monkeys.design.capability.orderedSelection.ids')} placeholder={customValuePlaceholder} value={manual} disabled={disabled} onChange={event => setManual(event.currentTarget.value)} onKeyDown={event => { if (event.key === 'Enter' && !event.nativeEvent.isComposing) { event.preventDefault(); add(); } }} /><BaseButton disabled={disabled || !manual.trim()} label={translate('monkeys.design.capability.orderedSelection.add')} onClick={add} /></div> : null}
|
|
81
83
|
{selectAll ? <div className="grid gap-1 border-b border-border pb-2">
|
|
@@ -103,7 +105,7 @@ export function RecordEditorStringSelection({ field, value, disabled, id, domId,
|
|
|
103
105
|
}) : null}
|
|
104
106
|
</div> : null}
|
|
105
107
|
{error ? <p role="alert">{translate(`monkeys.design.capability.orderedSelection.errors.${error === 'ORDERED_SELECTION_BYTES_EXCEEDED' ? 'bytes' : 'limit'}`)}</p> : null}
|
|
106
|
-
<div ref={viewport} data-string-selection-viewport style={{ maxHeight: VIEWPORT_HEIGHT, height: Math.min(totalHeight, VIEWPORT_HEIGHT), overflowY: 'auto' }} onScroll={event => setScrollTop(event.currentTarget.scrollTop)}>
|
|
108
|
+
<div ref={viewport} data-string-selection-viewport style={{ maxHeight: VIEWPORT_HEIGHT, height: Math.min(totalHeight, VIEWPORT_HEIGHT), minHeight: constrainHeight ? 0 : undefined, flexShrink: constrainHeight ? 1 : undefined, overflowY: 'auto', overscrollBehaviorY: constrainHeight ? 'contain' : undefined }} onScroll={event => setScrollTop(event.currentTarget.scrollTop)}>
|
|
107
109
|
<div style={{ height: totalHeight, position: 'relative' }}>{runs.map((run, runIndex) => {
|
|
108
110
|
if (run.top + run.height < start - OPTION_HEIGHT * 2 || run.top > start + VIEWPORT_HEIGHT + OPTION_HEIGHT * 2) return null;
|
|
109
111
|
const header = run.group ? HEADER_HEIGHT : 0;
|
|
@@ -8,6 +8,7 @@ export interface RecordEditorNullToggleProps {
|
|
|
8
8
|
checkedWhen?: 'null' | 'non-null';
|
|
9
9
|
retainSelectionOnNull?: boolean;
|
|
10
10
|
disabled: boolean;
|
|
11
|
+
constrainHeight?: boolean;
|
|
11
12
|
resetKey: string;
|
|
12
13
|
onChange(value: JsonValue): void;
|
|
13
14
|
children: ReactNode;
|
|
@@ -15,7 +16,7 @@ export interface RecordEditorNullToggleProps {
|
|
|
15
16
|
const stringIds = (value: JsonValue): value is string[] => Array.isArray(value) && value.every(id => typeof id === 'string');
|
|
16
17
|
|
|
17
18
|
/** Local selection memory belongs only to this field's current draft scope. */
|
|
18
|
-
export function RecordEditorNullToggle({ value, label, checkedWhen = 'null', retainSelectionOnNull = false, disabled, resetKey, onChange, children }: RecordEditorNullToggleProps) {
|
|
19
|
+
export function RecordEditorNullToggle({ value, label, checkedWhen = 'null', retainSelectionOnNull = false, disabled, constrainHeight = false, resetKey, onChange, children }: RecordEditorNullToggleProps) {
|
|
19
20
|
const active = useRef(true);
|
|
20
21
|
useEffect(() => { active.current = true; return () => { active.current = false; }; }, []);
|
|
21
22
|
const memory = useRef<{ key: string; ids?: string[] }>({ key: resetKey });
|
|
@@ -24,8 +25,8 @@ export function RecordEditorNullToggle({ value, label, checkedWhen = 'null', ret
|
|
|
24
25
|
if (memory.current.key !== resetKey) memory.current = { key: resetKey };
|
|
25
26
|
if (!retainSelectionOnNull) memory.current.ids = undefined;
|
|
26
27
|
else if (stringIds(value)) memory.current.ids = [...value];
|
|
27
|
-
return <div>
|
|
28
|
-
<label className="flex items-center gap-2">
|
|
28
|
+
return <div style={constrainHeight ? { display: 'flex', flexDirection: 'column', minHeight: 0, overflow: 'hidden' } : undefined}>
|
|
29
|
+
<label className="flex items-center gap-2" style={constrainHeight ? { flexShrink: 0 } : undefined}>
|
|
29
30
|
<BaseCheckbox checked={checkedWhen === 'null' ? value === null : value !== null} disabled={disabled} onChange={event => {
|
|
30
31
|
if (!active.current || current.current.resetKey !== resetKey || current.current.disabled) return;
|
|
31
32
|
const nextNull = checkedWhen === 'null' ? event.currentTarget.checked : !event.currentTarget.checked;
|
|
@@ -6966,6 +6966,7 @@ const RecordEditor = ({
|
|
|
6966
6966
|
retainSelectionOnNull={toggle.retainSelectionOnNull === true}
|
|
6967
6967
|
disabled={disabled}
|
|
6968
6968
|
resetKey={fieldIdentity}
|
|
6969
|
+
constrainHeight={field.kind === 'multi-select' && (model.presentation === 'toolbar' || model.presentation === 'sidebar')}
|
|
6969
6970
|
onChange={(value) => emitIntent('capability.record-editor.change', { fieldId: id, value })}
|
|
6970
6971
|
>
|
|
6971
6972
|
{children}
|
|
@@ -7358,6 +7359,7 @@ const RecordEditor = ({
|
|
|
7358
7359
|
enhanced ? (
|
|
7359
7360
|
<RecordEditorStringSelection
|
|
7360
7361
|
key={fieldIdentity}
|
|
7362
|
+
constrainHeight={model.presentation === 'toolbar' || model.presentation === 'sidebar'}
|
|
7361
7363
|
field={field}
|
|
7362
7364
|
value={selected}
|
|
7363
7365
|
disabled={disabled}
|
|
@@ -7435,7 +7437,9 @@ const RecordEditor = ({
|
|
|
7435
7437
|
<PopoverContent
|
|
7436
7438
|
aria-label={typeof label === 'string' ? label : id}
|
|
7437
7439
|
align="start"
|
|
7438
|
-
className=
|
|
7440
|
+
className={enhanced
|
|
7441
|
+
? 'flex max-h-[min(20rem,var(--radix-popover-content-available-height,20rem))] flex-col overflow-hidden'
|
|
7442
|
+
: 'max-h-80 overflow-auto'}
|
|
7439
7443
|
>
|
|
7440
7444
|
{choices}
|
|
7441
7445
|
</PopoverContent>
|