@homecode/ui 5.3.2 → 5.3.4
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/esm/index.js +1 -1
- package/dist/esm/src/components/Gallery/Gallery.js +37 -9
- package/dist/esm/src/components/Gallery/Gallery.styl.js +2 -2
- package/dist/esm/src/components/PromptComposer/PromptComposer.helpers.js +4 -6
- package/dist/esm/src/components/PromptComposer/PromptComposer.js +3 -2
- package/dist/esm/src/components/PromptComposer/PromptComposer.styl.js +2 -2
- package/dist/esm/types/src/components/Gallery/Gallery.d.ts +8 -2
- package/dist/esm/types/src/components/Gallery/Gallery.types.d.ts +7 -3
- package/dist/esm/types/src/components/PromptComposer/PromptComposer.d.ts +1 -0
- package/dist/esm/types/src/components/PromptComposer/PromptComposer.helpers.d.ts +1 -1
- package/dist/esm/types/src/components/PromptComposer/PromptComposer.types.d.ts +2 -0
- package/package.json +4 -2
package/dist/esm/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { DropZone } from './src/components/DropZone/DropZone.js';
|
|
|
16
16
|
export { Expand } from './src/components/Expand/Expand.js';
|
|
17
17
|
export { Flex } from './src/components/Flex/Flex.js';
|
|
18
18
|
export { Form } from './src/components/Form/Form.js';
|
|
19
|
-
export { Gallery } from './src/components/Gallery/Gallery.js';
|
|
19
|
+
export { Gallery, normalizeGalleryItem } from './src/components/Gallery/Gallery.js';
|
|
20
20
|
export { Heading } from './src/components/Heading/Heading.js';
|
|
21
21
|
export { Icon } from './src/components/Icon/Icon.js';
|
|
22
22
|
export { Input } from './src/components/Input/Input.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Component, createRef, useState, useRef, useLayoutEffect } from 'react';
|
|
2
|
+
import { Component, createRef, useState, useRef, useLayoutEffect, useEffect } from 'react';
|
|
3
3
|
import { createStore } from 'justorm/react';
|
|
4
4
|
import Time from 'timen';
|
|
5
5
|
import compare from 'compareq';
|
|
@@ -13,6 +13,11 @@ import { circularSlice } from '../../tools/array.js';
|
|
|
13
13
|
import S from './Gallery.styl.js';
|
|
14
14
|
import { Lazy } from '../Lazy/Lazy.js';
|
|
15
15
|
|
|
16
|
+
function normalizeGalleryItem(item) {
|
|
17
|
+
if (typeof item === 'string')
|
|
18
|
+
return { src: item, kind: 'image' };
|
|
19
|
+
return { src: item.src, kind: item.kind ?? 'image' };
|
|
20
|
+
}
|
|
16
21
|
const THRESHOLD = 50;
|
|
17
22
|
const DURATION = 200;
|
|
18
23
|
const DIR_NAME = {
|
|
@@ -32,12 +37,25 @@ function getInitialState(items, startIndex) {
|
|
|
32
37
|
function Arr({ className, size, icon, ...rest }) {
|
|
33
38
|
return (jsx(Button, { className: cn(S.arr, className), size: size, variant: "clear", ...rest, children: jsx(Icon, { type: icon, size: size }) }));
|
|
34
39
|
}
|
|
35
|
-
function
|
|
40
|
+
function VideoItem({ src, size, isActive, }) {
|
|
41
|
+
const [loaded, setLoaded] = useState(false);
|
|
42
|
+
const videoRef = useRef(null);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const video = videoRef.current;
|
|
45
|
+
if (!video || isActive)
|
|
46
|
+
return;
|
|
47
|
+
video.pause();
|
|
48
|
+
}, [isActive, src]);
|
|
49
|
+
return (jsxs("div", { className: cn(S.item, S.videoItem), children: [jsx("video", { ref: videoRef, src: src, controls: true, playsInline: true, className: S.video, onLoadedData: () => setLoaded(true) }), !loaded && jsx(Spinner, { size: size })] }));
|
|
50
|
+
}
|
|
51
|
+
function Item({ src, kind, size, isActive, }) {
|
|
36
52
|
const [loaded, setLoaded] = useState(false);
|
|
37
53
|
const [isError, setIsError] = useState(false);
|
|
38
54
|
const style = {};
|
|
39
55
|
const imgRef = useRef(null);
|
|
40
56
|
useLayoutEffect(() => {
|
|
57
|
+
if (kind === 'video')
|
|
58
|
+
return;
|
|
41
59
|
const img = imgRef.current;
|
|
42
60
|
if (!img || isError)
|
|
43
61
|
return;
|
|
@@ -54,7 +72,10 @@ function Item({ src, size }) {
|
|
|
54
72
|
};
|
|
55
73
|
}
|
|
56
74
|
if (typeof img.decode === 'function') {
|
|
57
|
-
img
|
|
75
|
+
img
|
|
76
|
+
.decode()
|
|
77
|
+
.then(notify)
|
|
78
|
+
.catch(() => { });
|
|
58
79
|
return () => {
|
|
59
80
|
cancelled = true;
|
|
60
81
|
};
|
|
@@ -68,7 +89,10 @@ function Item({ src, size }) {
|
|
|
68
89
|
return () => {
|
|
69
90
|
cancelled = true;
|
|
70
91
|
};
|
|
71
|
-
}, [src, isError]);
|
|
92
|
+
}, [src, isError, kind]);
|
|
93
|
+
if (kind === 'video') {
|
|
94
|
+
return jsx(VideoItem, { src: src, size: size, isActive: isActive });
|
|
95
|
+
}
|
|
72
96
|
if (loaded)
|
|
73
97
|
style.backgroundImage = `url(${src})`;
|
|
74
98
|
return (jsx("div", { className: S.item, style: style, children: !loaded &&
|
|
@@ -114,13 +138,16 @@ class Gallery extends Component {
|
|
|
114
138
|
this.setState({});
|
|
115
139
|
}
|
|
116
140
|
}
|
|
141
|
+
get normalizedItems() {
|
|
142
|
+
return this.props.items.map(normalizeGalleryItem);
|
|
143
|
+
}
|
|
117
144
|
getStateItems() {
|
|
118
145
|
return this.isSingle()
|
|
119
|
-
? [this.
|
|
146
|
+
? [this.normalizedItems[0]]
|
|
120
147
|
: getInitialState(this.items, this.index);
|
|
121
148
|
}
|
|
122
149
|
recenter() {
|
|
123
|
-
const [...items] = this.
|
|
150
|
+
const [...items] = this.normalizedItems;
|
|
124
151
|
this.items = [items.pop(), ...items];
|
|
125
152
|
}
|
|
126
153
|
init() {
|
|
@@ -195,7 +222,8 @@ class Gallery extends Component {
|
|
|
195
222
|
this.removeTransformDelta();
|
|
196
223
|
this.setState({});
|
|
197
224
|
const { onChange } = this.props;
|
|
198
|
-
|
|
225
|
+
const active = this.items[this.index];
|
|
226
|
+
onChange?.(this.index, active.src);
|
|
199
227
|
}
|
|
200
228
|
render() {
|
|
201
229
|
const { className, size, showArrows, showDots, initialBounce, cover, ...rest } = this.props;
|
|
@@ -213,10 +241,10 @@ class Gallery extends Component {
|
|
|
213
241
|
props.onPointerLeave = this.onPointerUp;
|
|
214
242
|
}
|
|
215
243
|
}
|
|
216
|
-
return (jsxs("div", { className: classes, ...props, children: [jsx("div", { className: innerClasses, ref: this.innerRef, children: items.map((
|
|
244
|
+
return (jsxs("div", { className: classes, ...props, children: [jsx("div", { className: innerClasses, ref: this.innerRef, children: items.map((item, i) => (jsx(Item, { src: item.src, kind: item.kind, size: size, isActive: isSingle ? i === 0 : i === 1 }, `${i}_${item.src}_${item.kind}`))) }), !isSingle && showArrows && !isDragging && (jsxs(Fragment, { children: [jsx(Arr, { className: S.left, size: size, icon: "chevronLeft", onClick: () => this.move(1) }), jsx(Arr, { className: S.right, size: size, icon: "chevronRight", onClick: () => this.move(-1) })] })), showDots && (jsx(Lazy, { hideSpinner: true, loader: () => import('./Dots/Dots.js'),
|
|
217
245
|
// @ts-ignore
|
|
218
246
|
index: this.index % items.length, count: items.length }))] }));
|
|
219
247
|
}
|
|
220
248
|
}
|
|
221
249
|
|
|
222
|
-
export { Gallery };
|
|
250
|
+
export { Gallery, normalizeGalleryItem };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Gallery_item__P4qTJ,.Gallery_root__-Crit{height:100%;width:100%}.Gallery_root__-Crit{overflow:hidden;position:relative}.Gallery_inner__4FAPt{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:flex;height:100%;position:absolute;touch-action:none;transform:translate3d(-33.33333%,0,0);width:calc(300% + 1px)}.Gallery_single__Wfd9h .Gallery_inner__4FAPt{transform:none;width:100%}.Gallery_single__Wfd9h .Gallery_item__P4qTJ{width:100%}.Gallery_inner__4FAPt.Gallery_left__zrrmv,.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transition:transform 0s ease-out;transition-duration:.2s}.Gallery_inner__4FAPt.Gallery_left__zrrmv{transform:translateZ(0)!important}.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transform:translate3d(-66.66667%,0,0)!important}.Gallery_inner__4FAPt.Gallery_initialBounce__nZnKd{animation:Gallery_bounce__buqva 1s ease-out}.Gallery_item__P4qTJ{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:contain;display:flex;justify-content:center;width:33.33333%}.Gallery_cover__ZGx5X .Gallery_item__P4qTJ{background-size:cover}.Gallery_item__P4qTJ>img{opacity:0;pointer-events:none;position:absolute}.Gallery_brokenImage__Bj3O-{height:50%;opacity:.2;width:50%}.Gallery_arr__knicI{background:transparent!important;height:100%;min-height:100%;opacity:0;padding:10%;position:absolute;top:0;transition:opacity .1s ease-out;z-index:1}.Gallery_arr__knicI.Gallery_left__zrrmv{justify-content:flex-start;left:0}.Gallery_arr__knicI.Gallery_right__dpZ-m{justify-content:flex-end;right:0;width:77%}.Gallery_arr__knicI:hover{opacity:1}@keyframes Gallery_bounce__buqva{0%{left:0}50%{left:-20%}80%{left:10%}to{left:0}}";
|
|
4
|
-
var S = {"root":"Gallery_root__-Crit","item":"Gallery_item__P4qTJ","inner":"Gallery_inner__4FAPt","single":"Gallery_single__Wfd9h","left":"Gallery_left__zrrmv","right":"Gallery_right__dpZ-m","initialBounce":"Gallery_initialBounce__nZnKd","bounce":"Gallery_bounce__buqva","cover":"Gallery_cover__ZGx5X","brokenImage":"Gallery_brokenImage__Bj3O-","arr":"Gallery_arr__knicI"};
|
|
3
|
+
var css_248z = ".Gallery_item__P4qTJ,.Gallery_root__-Crit{height:100%;width:100%}.Gallery_root__-Crit{overflow:hidden;position:relative}.Gallery_inner__4FAPt{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:flex;height:100%;position:absolute;touch-action:none;transform:translate3d(-33.33333%,0,0);width:calc(300% + 1px)}.Gallery_single__Wfd9h .Gallery_inner__4FAPt{transform:none;width:100%}.Gallery_single__Wfd9h .Gallery_item__P4qTJ{width:100%}.Gallery_inner__4FAPt.Gallery_left__zrrmv,.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transition:transform 0s ease-out;transition-duration:.2s}.Gallery_inner__4FAPt.Gallery_left__zrrmv{transform:translateZ(0)!important}.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transform:translate3d(-66.66667%,0,0)!important}.Gallery_inner__4FAPt.Gallery_initialBounce__nZnKd{animation:Gallery_bounce__buqva 1s ease-out}.Gallery_item__P4qTJ{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:contain;display:flex;justify-content:center;width:33.33333%}.Gallery_cover__ZGx5X .Gallery_item__P4qTJ{background-size:cover}.Gallery_item__P4qTJ>img{opacity:0;pointer-events:none;position:absolute}.Gallery_brokenImage__Bj3O-{height:50%;opacity:.2;width:50%}.Gallery_videoItem__06r39 .Gallery_video__vKK23{max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain}.Gallery_arr__knicI{background:transparent!important;height:100%;min-height:100%;opacity:0;padding:10%;position:absolute;top:0;transition:opacity .1s ease-out;z-index:1}.Gallery_arr__knicI.Gallery_left__zrrmv{justify-content:flex-start;left:0}.Gallery_arr__knicI.Gallery_right__dpZ-m{justify-content:flex-end;right:0;width:77%}.Gallery_arr__knicI:hover{opacity:1}@keyframes Gallery_bounce__buqva{0%{left:0}50%{left:-20%}80%{left:10%}to{left:0}}";
|
|
4
|
+
var S = {"root":"Gallery_root__-Crit","item":"Gallery_item__P4qTJ","inner":"Gallery_inner__4FAPt","single":"Gallery_single__Wfd9h","left":"Gallery_left__zrrmv","right":"Gallery_right__dpZ-m","initialBounce":"Gallery_initialBounce__nZnKd","bounce":"Gallery_bounce__buqva","cover":"Gallery_cover__ZGx5X","brokenImage":"Gallery_brokenImage__Bj3O-","videoItem":"Gallery_videoItem__06r39","video":"Gallery_video__vKK23","arr":"Gallery_arr__knicI"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** Keep in sync with `PromptComposer.styl` max/min heights. */
|
|
2
|
-
const PROMPT_COMPOSER_MAX_HEIGHT_PX = 200;
|
|
3
2
|
const PROMPT_COMPOSER_MIN_HEIGHT_PX = 40;
|
|
4
3
|
function safePromptComposerEditorText(editor) {
|
|
5
4
|
if (!editor || editor.isDestroyed)
|
|
@@ -32,7 +31,7 @@ function promptComposerFloorPx(cs) {
|
|
|
32
31
|
: Number.parseFloat(cs.lineHeight) || fs * 1.25;
|
|
33
32
|
return Math.max(PROMPT_COMPOSER_MIN_HEIGHT_PX, Math.ceil(linePx + padY));
|
|
34
33
|
}
|
|
35
|
-
/** Autosize `.ProseMirror` root: empty -> floor, text -> measured height
|
|
34
|
+
/** Autosize `.ProseMirror` root: empty -> floor, text -> measured content height. */
|
|
36
35
|
function syncPromptComposerHeight(el, text) {
|
|
37
36
|
const floor = promptComposerFloorPx(getComputedStyle(el));
|
|
38
37
|
el.style.overflowY = 'hidden';
|
|
@@ -45,10 +44,9 @@ function syncPromptComposerHeight(el, text) {
|
|
|
45
44
|
el.style.height = '0';
|
|
46
45
|
contentHeight = el.scrollHeight;
|
|
47
46
|
}
|
|
48
|
-
const h = Math.
|
|
47
|
+
const h = Math.max(contentHeight, floor);
|
|
49
48
|
el.style.height = `${h}px`;
|
|
50
|
-
el.style.overflowY =
|
|
51
|
-
contentHeight > PROMPT_COMPOSER_MAX_HEIGHT_PX ? 'auto' : 'hidden';
|
|
49
|
+
el.style.overflowY = 'hidden';
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
export {
|
|
52
|
+
export { PROMPT_COMPOSER_MIN_HEIGHT_PX, promptComposerSafeEditorDom, safePromptComposerEditorText, syncPromptComposerHeight };
|
|
@@ -2,11 +2,12 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { forwardRef, useMemo, useImperativeHandle } from 'react';
|
|
4
4
|
import { EditorContent } from '@tiptap/react';
|
|
5
|
+
import { Scroll } from '../Scroll/Scroll.js';
|
|
5
6
|
import S from './PromptComposer.styl.js';
|
|
6
7
|
import { createPromptComposerHandle } from './promptComposerInsert.js';
|
|
7
8
|
import { usePromptComposerEditor } from './usePromptComposerEditor.js';
|
|
8
9
|
|
|
9
|
-
const PromptComposer = forwardRef(function PromptComposer({ disabled = false, placeholder, className, slashCommandItems, onSlashItemCommand, prefillMessage, attachmentsCount = 0, allowEnterSubmit = true, onSubmit, onChange, }, ref) {
|
|
10
|
+
const PromptComposer = forwardRef(function PromptComposer({ disabled = false, placeholder, className, slashCommandItems, onSlashItemCommand, prefillMessage, attachmentsCount = 0, allowEnterSubmit = true, onSubmit, onChange, scrollProps = {}, }, ref) {
|
|
10
11
|
const { editor } = usePromptComposerEditor({
|
|
11
12
|
disabled,
|
|
12
13
|
placeholder,
|
|
@@ -29,7 +30,7 @@ const PromptComposer = forwardRef(function PromptComposer({ disabled = false, pl
|
|
|
29
30
|
},
|
|
30
31
|
}), []);
|
|
31
32
|
useImperativeHandle(ref, () => (editor ? createPromptComposerHandle(editor) : unavailableHandle), [editor, unavailableHandle]);
|
|
32
|
-
return (jsx("div", { className: cn(S.root, className), "data-disabled": disabled ? 'true' : 'false', children: jsx(EditorContent, { editor: editor, className: S.editorMount }) }));
|
|
33
|
+
return (jsx("div", { className: cn(S.root, className), "data-disabled": disabled ? 'true' : 'false', children: jsx(Scroll, { y: true, fadeSize: "s", ...scrollProps, className: S.scroller, children: jsx(EditorContent, { editor: editor, className: S.editorMount }) }) }));
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
export { PromptComposer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".PromptComposer_root__gfdXN{width:100%}.PromptComposer_editorMount__B9G-o{background:transparent;border:none;border-radius:0!important;box-shadow:none!important;display:flex;flex:1;flex-direction:column;
|
|
4
|
-
var S = {"root":"PromptComposer_root__gfdXN","editorMount":"PromptComposer_editorMount__B9G-o"};
|
|
3
|
+
var css_248z = ".PromptComposer_root__gfdXN{width:100%}.PromptComposer_scroller__Sueif{flex:1;max-height:200px;min-height:40px;width:100%}.PromptComposer_editorMount__B9G-o{background:transparent;border:none;border-radius:0!important;box-shadow:none!important;display:flex;flex:1;flex-direction:column;min-height:40px;min-width:0;padding:0!important}.PromptComposer_editorMount__B9G-o:focus-within{box-shadow:none!important}.PromptComposer_editorMount__B9G-o .promptComposerEditor{border:none!important;box-shadow:none!important;flex:1;margin:0;min-height:40px!important;outline:none!important;overflow:hidden!important;padding:var(--p-2) 0 0!important;resize:none!important;white-space:pre-wrap;word-break:break-word}.PromptComposer_editorMount__B9G-o .promptComposerEmptyEditor .promptComposerEmptyNode:before{color:var(--muted-foreground);content:attr(data-placeholder);float:left;height:0;pointer-events:none}";
|
|
4
|
+
var S = {"root":"PromptComposer_root__gfdXN","scroller":"PromptComposer_scroller__Sueif","editorMount":"PromptComposer_editorMount__B9G-o"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import * as T from './Gallery.types';
|
|
3
|
+
export type { GalleryItem } from './Gallery.types';
|
|
4
|
+
export declare function normalizeGalleryItem(item: T.GalleryItem): {
|
|
5
|
+
src: string;
|
|
6
|
+
kind: 'image' | 'video';
|
|
7
|
+
};
|
|
8
|
+
type NormalizedItem = ReturnType<typeof normalizeGalleryItem>;
|
|
3
9
|
type Direction = -1 | 1;
|
|
4
10
|
export declare class Gallery extends Component<T.Props> {
|
|
5
11
|
store: any;
|
|
6
|
-
items:
|
|
12
|
+
items: NormalizedItem[];
|
|
7
13
|
index: number;
|
|
8
14
|
timers: any;
|
|
9
15
|
startX: any;
|
|
@@ -17,6 +23,7 @@ export declare class Gallery extends Component<T.Props> {
|
|
|
17
23
|
componentDidMount(): void;
|
|
18
24
|
componentWillUnmount(): void;
|
|
19
25
|
componentDidUpdate(prevProps: any): void;
|
|
26
|
+
get normalizedItems(): NormalizedItem[];
|
|
20
27
|
getStateItems(): any[];
|
|
21
28
|
recenter(): void;
|
|
22
29
|
init(): void;
|
|
@@ -33,4 +40,3 @@ export declare class Gallery extends Component<T.Props> {
|
|
|
33
40
|
switch(direction: Direction): void;
|
|
34
41
|
render(): JSX.Element;
|
|
35
42
|
}
|
|
36
|
-
export {};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { ComponentType, Size } from 'uilib/types';
|
|
2
|
+
export type GalleryItem = string | {
|
|
3
|
+
src: string;
|
|
4
|
+
kind?: 'image' | 'video';
|
|
5
|
+
};
|
|
2
6
|
export type Props = ComponentType & {
|
|
3
|
-
items:
|
|
7
|
+
items: GalleryItem[];
|
|
4
8
|
size?: Size;
|
|
5
9
|
animation?: boolean;
|
|
6
10
|
startIndex?: number;
|
|
7
11
|
showArrows?: boolean;
|
|
8
12
|
showDots?: boolean;
|
|
9
13
|
initialBounce?: boolean;
|
|
10
|
-
cover
|
|
11
|
-
onChange?: (index: number,
|
|
14
|
+
cover?: boolean;
|
|
15
|
+
onChange?: (index: number, src: string) => void;
|
|
12
16
|
};
|
|
@@ -10,4 +10,5 @@ export declare const PromptComposer: import("react").ForwardRefExoticComponent<i
|
|
|
10
10
|
allowEnterSubmit?: boolean;
|
|
11
11
|
onSubmit?: (text: string, editor: import("@tiptap/core").Editor) => void;
|
|
12
12
|
onChange?: (text: string, editor: import("@tiptap/core").Editor) => void;
|
|
13
|
+
scrollProps?: Partial<import("../Scroll/Scroll.types").Props>;
|
|
13
14
|
} & import("react").RefAttributes<PromptComposerHandle>>;
|
|
@@ -8,5 +8,5 @@ export declare function safePromptComposerEditorText(editor: {
|
|
|
8
8
|
export declare function promptComposerSafeEditorDom(editor: {
|
|
9
9
|
readonly isDestroyed?: boolean;
|
|
10
10
|
} | null | undefined): HTMLElement | null;
|
|
11
|
-
/** Autosize `.ProseMirror` root: empty -> floor, text -> measured height
|
|
11
|
+
/** Autosize `.ProseMirror` root: empty -> floor, text -> measured content height. */
|
|
12
12
|
export declare function syncPromptComposerHeight(el: HTMLElement, text: string): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
2
|
import type { HTMLAttributes } from 'react';
|
|
3
3
|
import type { SlashCommandItem, SlashOnItemCommand } from '../../tiptap/slash-mention';
|
|
4
|
+
import type { Props as ScrollProps } from '../Scroll/Scroll.types';
|
|
4
5
|
export type Props = HTMLAttributes<HTMLDivElement> & {
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
placeholder?: string;
|
|
@@ -15,5 +16,6 @@ export type Props = HTMLAttributes<HTMLDivElement> & {
|
|
|
15
16
|
onSubmit?: (text: string, editor: Editor) => void;
|
|
16
17
|
/** Called on every transaction with plain text value. */
|
|
17
18
|
onChange?: (text: string, editor: Editor) => void;
|
|
19
|
+
scrollProps?: Partial<ScrollProps>;
|
|
18
20
|
};
|
|
19
21
|
export type PromptComposerProps = Props;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homecode/ui",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.4",
|
|
4
4
|
"description": "React UI components library",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"tests": "jest",
|
|
@@ -36,13 +36,15 @@
|
|
|
36
36
|
"type": "git",
|
|
37
37
|
"url": "git+https://github.com/foreverido/uilib.git"
|
|
38
38
|
},
|
|
39
|
-
"main": "dist/
|
|
39
|
+
"main": "./dist/esm/index.js",
|
|
40
40
|
"module": "dist/esm",
|
|
41
41
|
"types": "dist/esm/types/index.d.ts",
|
|
42
42
|
"type": "module",
|
|
43
43
|
"exports": {
|
|
44
44
|
".": {
|
|
45
45
|
"import": "./dist/esm/index.js",
|
|
46
|
+
"require": "./dist/esm/index.js",
|
|
47
|
+
"default": "./dist/esm/index.js",
|
|
46
48
|
"types": "./dist/esm/types/index.d.ts"
|
|
47
49
|
},
|
|
48
50
|
"./icons": {
|