@homecode/ui 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +1 -0
- package/dist/esm/src/components/Autocomplete/Autocomplete.js +7 -3
- package/dist/esm/src/components/Gap/Gap.js +6 -0
- package/dist/esm/src/components/Gap/Gap.styl.js +7 -0
- package/dist/esm/src/components/InputFile/InputFile.js +5 -1
- package/dist/esm/src/components/Popup/Popup.helpers.js +8 -1
- package/dist/esm/src/components/Popup/Popup.js +12 -6
- package/dist/esm/src/components/PromptComposer/PromptComposer.js +5 -1
- package/dist/esm/src/components/PromptComposer/promptComposerInsert.js +2 -1
- package/dist/esm/src/components/PromptComposer/usePromptComposerEditor.js +99 -21
- package/dist/esm/src/components/Select/Select.helpers.js +28 -1
- package/dist/esm/src/components/Select/Select.hooks.js +131 -0
- package/dist/esm/src/components/Select/Select2.js +192 -235
- package/dist/esm/src/components/Tooltip/Tooltip.styl.js +1 -1
- package/dist/esm/src/components/Tooltip/TooltipOverTrigger.js +4 -3
- package/dist/esm/src/components/Tooltip/tooltipTextStyles.js +17 -2
- package/dist/esm/src/tiptap/slash-mention/createSlashMentionExtension.js +51 -31
- package/dist/esm/src/tools/dom.js +6 -8
- package/dist/esm/src/tools/resizeObserver.js +1 -1
- package/dist/esm/types/src/components/Gap/Gap.d.ts +1 -0
- package/dist/esm/types/src/components/Popup/Popup.d.ts +2 -1
- package/dist/esm/types/src/components/Popup/Popup.helpers.d.ts +1 -0
- package/dist/esm/types/src/components/Popup/Popup.types.d.ts +1 -0
- package/dist/esm/types/src/components/PromptComposer/PromptComposer.d.ts +4 -0
- package/dist/esm/types/src/components/PromptComposer/PromptComposer.types.d.ts +17 -3
- package/dist/esm/types/src/components/PromptComposer/index.d.ts +1 -1
- package/dist/esm/types/src/components/PromptComposer/usePromptComposerEditor.d.ts +6 -2
- package/dist/esm/types/src/components/Select/Select.helpers.d.ts +7 -1
- package/dist/esm/types/src/components/Select/Select.hooks.d.ts +55 -0
- package/dist/esm/types/src/components/Select/Select.types.d.ts +1 -1
- package/dist/esm/types/src/components/Select/Select2.test.d.ts +1 -0
- package/dist/esm/types/src/components/index.d.ts +1 -0
- package/dist/esm/types/src/tiptap/slash-mention/createSlashMentionExtension.d.ts +1 -1
- package/dist/esm/types/src/tiptap/slash-mention/index.d.ts +1 -1
- package/dist/esm/types/src/tiptap/slash-mention/types.d.ts +12 -1
- package/graphify-out/.graphify_labels.json +15 -34
- package/graphify-out/2026-07-19/.graphify_labels.json +31 -1
- package/graphify-out/2026-07-19/GRAPH_REPORT.md +232 -124
- package/graphify-out/2026-07-19/graph.json +3234 -2951
- package/graphify-out/2026-07-19/manifest.json +39 -14
- package/graphify-out/2026-07-26/.graphify_labels.json +216 -0
- package/graphify-out/2026-07-26/GRAPH_REPORT.md +1036 -0
- package/graphify-out/2026-07-26/cost.json +12 -0
- package/graphify-out/2026-07-26/graph.json +71426 -0
- package/graphify-out/2026-07-26/manifest.json +2372 -0
- package/graphify-out/2026-07-27/.graphify_labels.json +214 -0
- package/graphify-out/2026-07-27/GRAPH_REPORT.md +1014 -0
- package/graphify-out/2026-07-27/cost.json +12 -0
- package/graphify-out/2026-07-27/graph.json +71778 -0
- package/graphify-out/2026-07-27/manifest.json +2372 -0
- package/graphify-out/2026-07-30/.graphify_labels.json +197 -0
- package/graphify-out/2026-07-30/GRAPH_REPORT.md +929 -0
- package/graphify-out/2026-07-30/cost.json +12 -0
- package/graphify-out/2026-07-30/graph.json +71798 -0
- package/graphify-out/2026-07-30/manifest.json +2372 -0
- package/graphify-out/GRAPH_REPORT.md +207 -299
- package/graphify-out/cache/ast/2690b69f91795ec634393c1fb8d9fd21ec09ec6759eaf6711e3b86c2a8edb385.json +1 -0
- package/graphify-out/cache/ast/2ae06c5acabf11eea845c93c2a8486317fbb18dccc1843ecd88077848af2ab29.json +1 -0
- package/graphify-out/cache/ast/7a354bfbf84f7c6c1a691084465172e6fa0568de5146bdfeb7a01841379b5745.json +1 -0
- package/graphify-out/cache/ast/c170b3d6d17c8888011e6bf7a21ef8384f391c0bd05bafa31ce1a725d710cb5a.json +1 -0
- package/graphify-out/cache/ast/d92952ab88c90a81d8e5a05c9c559bcd0c4126def0bb26a097d3f003651ed3c6.json +1 -0
- package/graphify-out/cache/stat-index.json +1 -1
- package/graphify-out/graph.html +4 -4
- package/graphify-out/graph.json +4074 -3370
- package/graphify-out/manifest.json +64 -59
- package/package.json +1 -1
|
@@ -1,35 +1,43 @@
|
|
|
1
1
|
import { mergeAttributes } from '@tiptap/core';
|
|
2
2
|
import Mention from '@tiptap/extension-mention';
|
|
3
|
+
import { PluginKey } from '@tiptap/pm/state';
|
|
3
4
|
import { ReactRenderer } from '@tiptap/react';
|
|
4
5
|
import { SlashSuggestionList } from './SlashSuggestionList.js';
|
|
5
6
|
import S from './SlashSuggestionList.styl.js';
|
|
6
7
|
import { filterSlashItems } from './defaultChatSlashItems.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
/** Keep `/` as `mention` for backward-compatible KnowledgeSelector docs. */
|
|
10
|
+
function mentionExtensionName(slashChar) {
|
|
11
|
+
return slashChar === '/' ? 'mention' : `mention_${slashChar.charCodeAt(0)}`;
|
|
12
|
+
}
|
|
13
|
+
function createNamedSlashMention(slashChar) {
|
|
14
|
+
return Mention.extend({
|
|
15
|
+
name: mentionExtensionName(slashChar),
|
|
16
|
+
addAttributes() {
|
|
17
|
+
return {
|
|
18
|
+
...this.parent?.(),
|
|
19
|
+
className: {
|
|
20
|
+
default: null,
|
|
21
|
+
parseHTML: element => element.getAttribute('data-slash-class'),
|
|
22
|
+
renderHTML: attributes => {
|
|
23
|
+
if (!attributes.className)
|
|
24
|
+
return {};
|
|
25
|
+
return { 'data-slash-class': attributes.className };
|
|
26
|
+
},
|
|
19
27
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return {};
|
|
27
|
-
|
|
28
|
+
color: {
|
|
29
|
+
default: null,
|
|
30
|
+
parseHTML: element => element.getAttribute('data-slash-color'),
|
|
31
|
+
renderHTML: attributes => {
|
|
32
|
+
if (!attributes.color)
|
|
33
|
+
return {};
|
|
34
|
+
return { 'data-slash-color': attributes.color };
|
|
35
|
+
},
|
|
28
36
|
},
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
33
41
|
const SUGGESTION_GAP_PX = 4;
|
|
34
42
|
function placeSlashSuggestionPopup(popupElement, clientRect, placement, editorElement) {
|
|
35
43
|
if (!clientRect)
|
|
@@ -109,12 +117,13 @@ function insertDefaultMention(editor, range, item, slashChar) {
|
|
|
109
117
|
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
110
118
|
const extend = nodeAfter?.text?.startsWith(' ') ? 1 : 0;
|
|
111
119
|
const adjusted = extend ? { ...range, to: range.to + extend } : range;
|
|
120
|
+
const nodeType = mentionExtensionName(slashChar);
|
|
112
121
|
editor
|
|
113
122
|
.chain()
|
|
114
123
|
.focus()
|
|
115
124
|
.insertContentAt(adjusted, [
|
|
116
125
|
{
|
|
117
|
-
type:
|
|
126
|
+
type: nodeType,
|
|
118
127
|
attrs: {
|
|
119
128
|
id: item.id,
|
|
120
129
|
label: item.label,
|
|
@@ -132,8 +141,8 @@ function insertDefaultMention(editor, range, item, slashChar) {
|
|
|
132
141
|
?.collapseToEnd();
|
|
133
142
|
});
|
|
134
143
|
}
|
|
135
|
-
function allowSlashTrigger({ state, range, }) {
|
|
136
|
-
const type = state.schema.nodes[
|
|
144
|
+
function allowSlashTrigger({ state, range, slashChar, }) {
|
|
145
|
+
const type = state.schema.nodes[mentionExtensionName(slashChar)];
|
|
137
146
|
const $from = state.doc.resolve(range.from);
|
|
138
147
|
if (!type || !$from.parent.type.contentMatch.matchType(type))
|
|
139
148
|
return false;
|
|
@@ -142,13 +151,24 @@ function allowSlashTrigger({ state, range, }) {
|
|
|
142
151
|
const before = state.doc.textBetween(range.from - 1, range.from);
|
|
143
152
|
return /\s/.test(before);
|
|
144
153
|
}
|
|
145
|
-
function
|
|
154
|
+
async function resolveSuggestionItems(query, staticItems, getItems) {
|
|
155
|
+
if (getItems) {
|
|
156
|
+
return Promise.resolve(getItems(query));
|
|
157
|
+
}
|
|
158
|
+
return filterSlashItems(staticItems ?? [], query);
|
|
159
|
+
}
|
|
160
|
+
function createSlashMentionExtension({ items: resolvedItems, getItems, slashChar = '/', pluginKey, onItemCommand, suggestionPlacement = 'below', onSuggestionUiActiveChange, }) {
|
|
146
161
|
const uiRef = {
|
|
147
162
|
current: null,
|
|
148
163
|
};
|
|
164
|
+
const SlashMention = createNamedSlashMention(slashChar);
|
|
165
|
+
const resolvedPluginKey = pluginKey ?? new PluginKey(`slashMention${slashChar.charCodeAt(0)}`);
|
|
149
166
|
return SlashMention.configure({
|
|
150
167
|
renderText({ node }) {
|
|
151
|
-
|
|
168
|
+
const label = typeof node.attrs.label === 'string' && node.attrs.label.trim() !== ''
|
|
169
|
+
? node.attrs.label
|
|
170
|
+
: String(node.attrs.id ?? '');
|
|
171
|
+
return `${slashChar}${label}`;
|
|
152
172
|
},
|
|
153
173
|
renderHTML({ options, node }) {
|
|
154
174
|
const id = typeof node.attrs.id === 'string'
|
|
@@ -175,10 +195,10 @@ function createSlashMentionExtension({ items: resolvedItems, slashChar = '/', pl
|
|
|
175
195
|
},
|
|
176
196
|
suggestion: {
|
|
177
197
|
char: slashChar,
|
|
178
|
-
pluginKey,
|
|
198
|
+
pluginKey: resolvedPluginKey,
|
|
179
199
|
allowedPrefixes: [' ', '\n', '\t', '\r'],
|
|
180
|
-
allow: props => allowSlashTrigger(props),
|
|
181
|
-
items: ({ query }) =>
|
|
200
|
+
allow: props => allowSlashTrigger({ ...props, slashChar }),
|
|
201
|
+
items: ({ query }) => resolveSuggestionItems(query, resolvedItems, getItems),
|
|
182
202
|
command: ({ editor, range, props }) => {
|
|
183
203
|
const item = props;
|
|
184
204
|
if (onItemCommand?.({ editor, range, item }) === true) {
|
|
@@ -38,17 +38,15 @@ let interactionMode = INTERACTION_MODE.POINTER;
|
|
|
38
38
|
const getInteractionMode = () => interactionMode;
|
|
39
39
|
function watchControllerFlag() {
|
|
40
40
|
const classes = document.body.classList;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
classes.
|
|
41
|
+
const setMode = (mode, prevMode) => {
|
|
42
|
+
interactionMode = mode;
|
|
43
|
+
classes.remove(prevMode);
|
|
44
|
+
classes.add(mode);
|
|
44
45
|
};
|
|
45
46
|
['pointerdown', 'pointermove'].forEach(event => {
|
|
46
|
-
document.addEventListener(event,
|
|
47
|
-
});
|
|
48
|
-
document.addEventListener('keydown', () => {
|
|
49
|
-
classes.remove(INTERACTION_MODE.POINTER);
|
|
50
|
-
classes.add(INTERACTION_MODE.KEYBOARD);
|
|
47
|
+
document.addEventListener(event, () => setMode(INTERACTION_MODE.POINTER, INTERACTION_MODE.KEYBOARD), true);
|
|
51
48
|
});
|
|
49
|
+
document.addEventListener('keydown', () => setMode(INTERACTION_MODE.KEYBOARD, INTERACTION_MODE.POINTER));
|
|
52
50
|
classes.add(interactionMode);
|
|
53
51
|
}
|
|
54
52
|
const isTouch = () => isBrowser && 'ontouchstart' in window;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Gap: () => import("react").JSX.Element;
|
|
@@ -9,6 +9,7 @@ export declare class Popup extends Component<T.Props, T.State> {
|
|
|
9
9
|
containerElem: HTMLDivElement;
|
|
10
10
|
onContainerElemRef: (elem: any) => void;
|
|
11
11
|
focused: boolean;
|
|
12
|
+
isOpening: boolean;
|
|
12
13
|
pointerPressed: boolean;
|
|
13
14
|
subscribedHoverControl: boolean;
|
|
14
15
|
subscribedSizeChange: boolean;
|
|
@@ -61,7 +62,7 @@ export declare class Popup extends Component<T.Props, T.State> {
|
|
|
61
62
|
onBlur: (e: any) => void;
|
|
62
63
|
onTriggerResize: () => void;
|
|
63
64
|
onContainerResize: () => void;
|
|
64
|
-
open:
|
|
65
|
+
open: () => void;
|
|
65
66
|
close: () => void;
|
|
66
67
|
changeState(isOpen: boolean, callback: any): void;
|
|
67
68
|
afterOpen: () => void;
|
|
@@ -42,6 +42,7 @@ export declare function shiftMarginsIntoBounds(rect: DOMRectReadOnly, inner: Cli
|
|
|
42
42
|
marginTop: number;
|
|
43
43
|
};
|
|
44
44
|
export declare function fitRectToBoundary(rect: DOMRectReadOnly, boundary: ClientRectEdges, maxWidth: number | null): BoundaryFit;
|
|
45
|
+
export declare function isEditable(target: EventTarget | null): boolean;
|
|
45
46
|
export declare const childs: Record<Id, Id[]>;
|
|
46
47
|
export declare const getId: () => number;
|
|
47
48
|
export declare const getPopupId: (elem: any, attr?: string) => number;
|
|
@@ -3,6 +3,7 @@ import { DetailedHTMLProps, HTMLAttributes, ReactNode } from 'react';
|
|
|
3
3
|
import type { BoundaryFit } from './Popup.helpers';
|
|
4
4
|
export type TriggerPropsType = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
[dataAttribute: `data-${string}`]: unknown;
|
|
6
7
|
};
|
|
7
8
|
export type WrapperPropsType = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
8
9
|
className?: string;
|
|
@@ -6,6 +6,10 @@ export declare const PromptComposer: import("react").ForwardRefExoticComponent<O
|
|
|
6
6
|
slashCommandItems?: import(".").SlashCommandItem[];
|
|
7
7
|
slashSuggestionPlacement?: import(".").SlashSuggestionPlacement;
|
|
8
8
|
onSlashItemCommand?: import(".").SlashOnItemCommand;
|
|
9
|
+
mentionConfigs?: import(".").PromptMentionConfig[];
|
|
10
|
+
atMentionItems?: import(".").SlashCommandItem[];
|
|
11
|
+
atMentionGetItems?: import(".").SlashGetItems;
|
|
12
|
+
onAtItemCommand?: import(".").SlashOnItemCommand;
|
|
9
13
|
prefillMessage?: string;
|
|
10
14
|
attachmentsCount?: number;
|
|
11
15
|
allowEnterSubmit?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
2
|
import type { HTMLAttributes } from 'react';
|
|
3
|
-
import type { SlashCommandItem, SlashOnItemCommand, SlashSuggestionPlacement } from '../../tiptap/slash-mention';
|
|
3
|
+
import type { PromptMentionConfig, SlashCommandItem, SlashGetItems, SlashOnItemCommand, SlashSuggestionPlacement } from '../../tiptap/slash-mention';
|
|
4
4
|
import type { Props as ScrollProps } from '../Scroll/Scroll.types';
|
|
5
5
|
export type Props = Omit<HTMLAttributes<HTMLDivElement>, 'onSubmit' | 'onChange'> & {
|
|
6
6
|
disabled?: boolean;
|
|
@@ -9,12 +9,26 @@ export type Props = Omit<HTMLAttributes<HTMLDivElement>, 'onSubmit' | 'onChange'
|
|
|
9
9
|
/** Slash menu vertical placement; defaults to above chat input. */
|
|
10
10
|
slashSuggestionPlacement?: SlashSuggestionPlacement;
|
|
11
11
|
onSlashItemCommand?: SlashOnItemCommand;
|
|
12
|
+
/**
|
|
13
|
+
* Extra mention triggers (e.g. `@` files). `/` still comes from
|
|
14
|
+
* slashCommandItems when provided.
|
|
15
|
+
*/
|
|
16
|
+
mentionConfigs?: PromptMentionConfig[];
|
|
17
|
+
/** Convenience for `@` file mentions (merged into mentionConfigs). */
|
|
18
|
+
atMentionItems?: SlashCommandItem[];
|
|
19
|
+
atMentionGetItems?: SlashGetItems;
|
|
20
|
+
onAtItemCommand?: SlashOnItemCommand;
|
|
12
21
|
prefillMessage?: string | null;
|
|
13
22
|
/** Staged attachment count - Enter can submit even when text empty. */
|
|
14
23
|
attachmentsCount?: number;
|
|
15
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* When true (desktop default), Enter submits if content has no newlines yet;
|
|
26
|
+
* once newlines exist, Enter inserts another line and Cmd/Ctrl+Enter submits.
|
|
27
|
+
* Shift+Enter always inserts a newline. Mobile usually sets false so Enter
|
|
28
|
+
* always inserts a newline.
|
|
29
|
+
*/
|
|
16
30
|
allowEnterSubmit?: boolean;
|
|
17
|
-
/** Called when user presses Enter to submit. */
|
|
31
|
+
/** Called when user presses Enter (or Cmd/Ctrl+Enter when multiline) to submit. */
|
|
18
32
|
onSubmit?: (text: string, editor: Editor) => void;
|
|
19
33
|
/** Called on every transaction with plain text value. */
|
|
20
34
|
onChange?: (text: string, editor: Editor) => void;
|
|
@@ -4,4 +4,4 @@ export { usePromptComposerEditor } from './usePromptComposerEditor';
|
|
|
4
4
|
export type { UsePromptComposerEditorOptions } from './usePromptComposerEditor';
|
|
5
5
|
export { getPromptComposerTokenRangeBeforePos, createPromptComposerHandle, insertPromptComposerContentAtCaret, openPromptComposerSlashSuggestion, promptComposerChipHtml, promptComposerMentionNode, PROMPT_COMPOSER_COMMAND_CHIP_CLASS, } from './promptComposerInsert';
|
|
6
6
|
export type { PromptComposerHandle, PromptComposerInsertOptions, PromptComposerMentionNodeInput, } from './promptComposerInsert';
|
|
7
|
-
export type { SlashCommandItem, SlashItemCommandContext, SlashOnItemCommand, SlashSuggestionPlacement, } from '../../tiptap/slash-mention';
|
|
7
|
+
export type { SlashCommandItem, SlashItemCommandContext, SlashOnItemCommand, SlashSuggestionPlacement, SlashGetItems, PromptMentionConfig, } from '../../tiptap/slash-mention';
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type Editor } from '@tiptap/core';
|
|
2
|
-
import type { SlashCommandItem, SlashOnItemCommand, SlashSuggestionPlacement } from '../../tiptap/slash-mention';
|
|
2
|
+
import type { PromptMentionConfig, SlashCommandItem, SlashGetItems, SlashOnItemCommand, SlashSuggestionPlacement } from '../../tiptap/slash-mention';
|
|
3
3
|
export type UsePromptComposerEditorOptions = {
|
|
4
4
|
disabled: boolean;
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
slashCommandItems?: SlashCommandItem[];
|
|
7
7
|
slashSuggestionPlacement?: SlashSuggestionPlacement;
|
|
8
8
|
onSlashItemCommand?: SlashOnItemCommand;
|
|
9
|
+
mentionConfigs?: PromptMentionConfig[];
|
|
10
|
+
atMentionItems?: SlashCommandItem[];
|
|
11
|
+
atMentionGetItems?: SlashGetItems;
|
|
12
|
+
onAtItemCommand?: SlashOnItemCommand;
|
|
9
13
|
prefillMessage?: string | null;
|
|
10
14
|
attachmentsCount?: number;
|
|
11
15
|
allowEnterSubmit: boolean;
|
|
@@ -17,4 +21,4 @@ export type UsePromptComposerEditorResult = {
|
|
|
17
21
|
text: string;
|
|
18
22
|
trimmedText: string;
|
|
19
23
|
};
|
|
20
|
-
export declare function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, slashSuggestionPlacement, onSlashItemCommand, prefillMessage, attachmentsCount, allowEnterSubmit, onSubmit, onChange, }: UsePromptComposerEditorOptions): UsePromptComposerEditorResult;
|
|
24
|
+
export declare function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, slashSuggestionPlacement, onSlashItemCommand, mentionConfigs, atMentionItems, atMentionGetItems, onAtItemCommand, prefillMessage, attachmentsCount, allowEnterSubmit, onSubmit, onChange, }: UsePromptComposerEditorOptions): UsePromptComposerEditorResult;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import type { Option } from './Select.types';
|
|
1
|
+
import type { Id, Option, Value } from './Select.types';
|
|
2
2
|
export declare function isMultiple(value: any): boolean;
|
|
3
3
|
export declare function renderLabel({ label, render }: Option): string;
|
|
4
|
+
/** Selection is always kept as a list of ids, whatever the `value` shape is. */
|
|
5
|
+
export declare function toIds(value: Value | undefined): Id[];
|
|
6
|
+
/** Stable primitive for `useEffect` deps — `value` arrays are often recreated. */
|
|
7
|
+
export declare function idsKey(ids: Id[]): string;
|
|
8
|
+
export declare function matchesSearch(option: Option, query: string): boolean;
|
|
9
|
+
export declare function isSelectable(option: Option | undefined): boolean;
|
|
4
10
|
export declare function buildOptionsTree(options: Option[], idsMap: IdsMap): Option[];
|
|
5
11
|
type IdsMap = {
|
|
6
12
|
items: {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as T from './Select.types';
|
|
2
|
+
/**
|
|
3
|
+
* Open state contract:
|
|
4
|
+
* - `isOpen` prop is a boolean -> fully controlled, the consumer must react to
|
|
5
|
+
* `onOpen` / `onClose` to change it.
|
|
6
|
+
* - `isOpen` prop is `undefined` -> Select owns the state.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSelectOpenState({ isOpen: isOpenProp, onOpen, onClose, }: {
|
|
9
|
+
isOpen?: boolean;
|
|
10
|
+
onOpen?: () => void;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}): {
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
open: () => void;
|
|
15
|
+
close: () => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Selection contract mirrors the open state one: `value` present -> controlled,
|
|
19
|
+
* `value === undefined` -> Select owns the selection.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useSelectedIds(value: T.Value | undefined): {
|
|
22
|
+
selectedIds: T.Id[];
|
|
23
|
+
setSelectedIds: (ids: T.Id[]) => void;
|
|
24
|
+
};
|
|
25
|
+
/** Single source of truth for what the list shows and what can be navigated. */
|
|
26
|
+
export declare function useSelectOptions({ options, additionalOptions, searchQuery, }: {
|
|
27
|
+
options: T.Option[];
|
|
28
|
+
additionalOptions: T.Option[];
|
|
29
|
+
searchQuery: string;
|
|
30
|
+
}): {
|
|
31
|
+
allOptions: T.Option[];
|
|
32
|
+
visibleOptions: T.Option[];
|
|
33
|
+
navigableOptions: T.Option[];
|
|
34
|
+
optionsById: {
|
|
35
|
+
items: {
|
|
36
|
+
[key: string]: T.Option;
|
|
37
|
+
};
|
|
38
|
+
childIds: {
|
|
39
|
+
[key: string]: T.Id[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Keyboard cursor. It is stored as an option id and always resolved against the
|
|
45
|
+
* currently *visible* list, so filtering can never desync it from the rows.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useKeyboardNav({ isOpen, navigableOptions, selectedIds, onSelect, }: {
|
|
48
|
+
isOpen: boolean;
|
|
49
|
+
navigableOptions: T.Option[];
|
|
50
|
+
selectedIds: T.Id[];
|
|
51
|
+
onSelect: (id: T.Id) => void;
|
|
52
|
+
}): {
|
|
53
|
+
focusedId: T.Id;
|
|
54
|
+
setFocusedId: import("react").Dispatch<import("react").SetStateAction<T.Id>>;
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -16,6 +16,7 @@ export * from './DropZone/DropZone';
|
|
|
16
16
|
export * from './Expand/Expand';
|
|
17
17
|
export * from './Flex/Flex';
|
|
18
18
|
export * from './Form/Form';
|
|
19
|
+
export * from './Gap/Gap';
|
|
19
20
|
export * from './Gallery/Gallery';
|
|
20
21
|
export * from './GridLayout/GridLayout';
|
|
21
22
|
export * from './Heading/Heading';
|
|
@@ -18,4 +18,4 @@ export declare function slashMentionSuggestionRender(uiRef: MutableRefObject<Sla
|
|
|
18
18
|
export type CreateSlashMentionExtensionConfiguredOptions = CreateSlashMentionExtensionOptions & {
|
|
19
19
|
onSuggestionUiActiveChange?: (active: boolean) => void;
|
|
20
20
|
};
|
|
21
|
-
export declare function createSlashMentionExtension({ items: resolvedItems, slashChar, pluginKey, onItemCommand, suggestionPlacement, onSuggestionUiActiveChange, }: CreateSlashMentionExtensionConfiguredOptions): import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
|
|
21
|
+
export declare function createSlashMentionExtension({ items: resolvedItems, getItems, slashChar, pluginKey, onItemCommand, suggestionPlacement, onSuggestionUiActiveChange, }: CreateSlashMentionExtensionConfiguredOptions): import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { SlashCommandItem, SlashOnItemCommand, SlashItemCommandContext, SlashSuggestionPlacement, CreateSlashMentionExtensionOptions, } from './types';
|
|
1
|
+
export type { SlashCommandItem, SlashOnItemCommand, SlashItemCommandContext, SlashSuggestionPlacement, SlashGetItems, PromptMentionConfig, CreateSlashMentionExtensionOptions, } from './types';
|
|
2
2
|
export { DEFAULT_CHAT_SLASH_ITEMS, filterSlashItems, } from './defaultChatSlashItems';
|
|
3
3
|
export { createSlashMentionExtension, slashMentionSuggestionRender, } from './createSlashMentionExtension';
|
|
4
4
|
export type { CreateSlashMentionExtensionConfiguredOptions } from './createSlashMentionExtension';
|
|
@@ -19,8 +19,19 @@ export type SlashItemCommandContext = {
|
|
|
19
19
|
*/
|
|
20
20
|
export type SlashOnItemCommand = (ctx: SlashItemCommandContext) => boolean;
|
|
21
21
|
export type SlashSuggestionPlacement = 'below' | 'above' | 'auto';
|
|
22
|
+
export type SlashGetItems = (query: string) => SlashCommandItem[] | Promise<SlashCommandItem[]>;
|
|
23
|
+
export type PromptMentionConfig = {
|
|
24
|
+
slashChar: string;
|
|
25
|
+
/** Static items (client-filtered). Ignored when getItems is set. */
|
|
26
|
+
items?: SlashCommandItem[];
|
|
27
|
+
/** Async/dynamic items (e.g. server search for @files). */
|
|
28
|
+
getItems?: SlashGetItems;
|
|
29
|
+
onItemCommand?: SlashOnItemCommand;
|
|
30
|
+
pluginKey?: import('@tiptap/pm/state').PluginKey;
|
|
31
|
+
};
|
|
22
32
|
export type CreateSlashMentionExtensionOptions = {
|
|
23
|
-
items
|
|
33
|
+
items?: SlashCommandItem[];
|
|
34
|
+
getItems?: SlashGetItems;
|
|
24
35
|
slashChar?: string;
|
|
25
36
|
pluginKey?: import('@tiptap/pm/state').PluginKey;
|
|
26
37
|
onItemCommand?: SlashOnItemCommand;
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"99": "Render Months Label",
|
|
102
102
|
"100": "Render Month Label",
|
|
103
103
|
"101": "Render Weekday Label",
|
|
104
|
-
"102": "
|
|
105
|
-
"103": "
|
|
106
|
-
"104": "
|
|
107
|
-
"105": "
|
|
104
|
+
"102": "Community 102",
|
|
105
|
+
"103": "Community 103",
|
|
106
|
+
"104": "Community 104",
|
|
107
|
+
"105": "Community 105",
|
|
108
108
|
"106": "Icon Name Helpers",
|
|
109
109
|
"107": "Media Placeholder Icons",
|
|
110
110
|
"108": "Utility Icons",
|
|
@@ -118,20 +118,20 @@
|
|
|
118
118
|
"116": "Docs Scope",
|
|
119
119
|
"117": "Auto Scroll Props",
|
|
120
120
|
"118": "Content Props",
|
|
121
|
-
"119": "
|
|
121
|
+
"119": "Community 119",
|
|
122
122
|
"120": "Footer Props",
|
|
123
|
-
"121": "
|
|
124
|
-
"122": "
|
|
123
|
+
"121": "Community 121",
|
|
124
|
+
"122": "Community 122",
|
|
125
125
|
"123": "No Scroll Props",
|
|
126
|
-
"124": "
|
|
127
|
-
"125": "
|
|
126
|
+
"124": "Community 124",
|
|
127
|
+
"125": "Community 125",
|
|
128
128
|
"126": "Title Props",
|
|
129
|
-
"127": "
|
|
130
|
-
"128": "
|
|
129
|
+
"127": "Community 127",
|
|
130
|
+
"128": "Community 128",
|
|
131
131
|
"129": "Trigger ClassName",
|
|
132
|
-
"130": "
|
|
132
|
+
"130": "Community 130",
|
|
133
133
|
"131": "Community 131",
|
|
134
|
-
"132": "
|
|
134
|
+
"132": "Community 132",
|
|
135
135
|
"133": "Brand Avatar Icons",
|
|
136
136
|
"134": "Communication Action Icons",
|
|
137
137
|
"135": "Status Action Icons",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"142": "Community 142",
|
|
145
145
|
"143": "More Docs Examples",
|
|
146
146
|
"144": "Docs Scope Pages",
|
|
147
|
-
"145": "
|
|
147
|
+
"145": "Community 145",
|
|
148
148
|
"146": "Brand Logo Assets",
|
|
149
149
|
"147": "Test Utilities",
|
|
150
150
|
"148": "PostCSS Config",
|
|
@@ -195,34 +195,15 @@
|
|
|
195
195
|
"193": "Community 193",
|
|
196
196
|
"194": "Community 194",
|
|
197
197
|
"195": "Community 195",
|
|
198
|
-
"196": "Community 196",
|
|
199
198
|
"197": "Community 197",
|
|
200
|
-
"198": "Community 198",
|
|
201
|
-
"199": "Community 199",
|
|
202
199
|
"200": "Community 200",
|
|
203
200
|
"201": "Community 201",
|
|
204
|
-
"202": "Community 202",
|
|
205
|
-
"203": "Community 203",
|
|
206
|
-
"204": "Community 204",
|
|
207
201
|
"205": "Community 205",
|
|
208
|
-
"206": "Community 206",
|
|
209
|
-
"207": "Community 207",
|
|
210
|
-
"208": "Community 208",
|
|
211
|
-
"209": "Community 209",
|
|
212
202
|
"210": "Community 210",
|
|
213
|
-
"211": "Community 211",
|
|
214
|
-
"212": "Community 212",
|
|
215
203
|
"213": "Community 213",
|
|
216
|
-
"214": "Community 214",
|
|
217
|
-
"215": "Community 215",
|
|
218
204
|
"216": "Community 216",
|
|
219
|
-
"217": "Community 217",
|
|
220
205
|
"218": "Community 218",
|
|
221
|
-
"219": "Community 219",
|
|
222
206
|
"220": "Community 220",
|
|
223
|
-
"221": "Community 221",
|
|
224
207
|
"222": "Community 222",
|
|
225
|
-
"223": "Community 223"
|
|
226
|
-
"224": "Community 224",
|
|
227
|
-
"225": "Community 225"
|
|
208
|
+
"223": "Community 223"
|
|
228
209
|
}
|
|
@@ -175,24 +175,54 @@
|
|
|
175
175
|
"173": "Community 173",
|
|
176
176
|
"174": "Community 174",
|
|
177
177
|
"175": "Community 175",
|
|
178
|
+
"176": "Community 176",
|
|
178
179
|
"177": "Community 177",
|
|
180
|
+
"178": "Community 178",
|
|
181
|
+
"179": "Community 179",
|
|
179
182
|
"180": "Community 180",
|
|
183
|
+
"181": "Community 181",
|
|
180
184
|
"182": "Community 182",
|
|
181
185
|
"183": "Community 183",
|
|
182
186
|
"184": "Community 184",
|
|
187
|
+
"185": "Community 185",
|
|
188
|
+
"186": "Community 186",
|
|
189
|
+
"187": "Community 187",
|
|
183
190
|
"188": "Community 188",
|
|
184
191
|
"189": "Community 189",
|
|
192
|
+
"190": "Community 190",
|
|
193
|
+
"191": "Community 191",
|
|
185
194
|
"192": "Community 192",
|
|
195
|
+
"193": "Community 193",
|
|
186
196
|
"194": "Community 194",
|
|
187
197
|
"195": "Community 195",
|
|
198
|
+
"196": "Community 196",
|
|
188
199
|
"197": "Community 197",
|
|
200
|
+
"198": "Community 198",
|
|
201
|
+
"199": "Community 199",
|
|
189
202
|
"200": "Community 200",
|
|
190
203
|
"201": "Community 201",
|
|
204
|
+
"202": "Community 202",
|
|
205
|
+
"203": "Community 203",
|
|
206
|
+
"204": "Community 204",
|
|
191
207
|
"205": "Community 205",
|
|
208
|
+
"206": "Community 206",
|
|
209
|
+
"207": "Community 207",
|
|
210
|
+
"208": "Community 208",
|
|
211
|
+
"209": "Community 209",
|
|
192
212
|
"210": "Community 210",
|
|
193
213
|
"211": "Community 211",
|
|
194
214
|
"212": "Community 212",
|
|
195
215
|
"213": "Community 213",
|
|
216
|
+
"214": "Community 214",
|
|
196
217
|
"215": "Community 215",
|
|
197
|
-
"216": "Community 216"
|
|
218
|
+
"216": "Community 216",
|
|
219
|
+
"217": "Community 217",
|
|
220
|
+
"218": "Community 218",
|
|
221
|
+
"219": "Community 219",
|
|
222
|
+
"220": "Community 220",
|
|
223
|
+
"221": "Community 221",
|
|
224
|
+
"222": "Community 222",
|
|
225
|
+
"223": "Community 223",
|
|
226
|
+
"224": "Community 224",
|
|
227
|
+
"225": "Community 225"
|
|
198
228
|
}
|