@harborclient/sdk 1.0.23 → 1.0.25
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/Autocomplete/SuggestionList.js +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/CodeEditor/config.d.ts +4 -0
- package/dist/components/CodeEditor/config.d.ts.map +1 -1
- package/dist/components/CodeEditor/config.js +3 -2
- package/dist/components/CodeEditor/editorChrome.d.ts +23 -0
- package/dist/components/CodeEditor/editorChrome.d.ts.map +1 -0
- package/dist/components/CodeEditor/editorChrome.js +136 -0
- package/dist/components/CodeEditor/index.d.ts +133 -1
- package/dist/components/CodeEditor/index.d.ts.map +1 -1
- package/dist/components/CodeEditor/index.js +387 -134
- package/dist/components/CodeEditor/renderHighlightedPlaceholder.d.ts +32 -0
- package/dist/components/CodeEditor/renderHighlightedPlaceholder.d.ts.map +1 -0
- package/dist/components/CodeEditor/renderHighlightedPlaceholder.js +105 -0
- package/dist/components/CodeEditor/slashCommandHighlighter.d.ts +17 -0
- package/dist/components/CodeEditor/slashCommandHighlighter.d.ts.map +1 -0
- package/dist/components/CodeEditor/slashCommandHighlighter.js +56 -0
- package/dist/components/CodeEditor/syntaxHighlightedPlaceholder.d.ts +15 -0
- package/dist/components/CodeEditor/syntaxHighlightedPlaceholder.d.ts.map +1 -0
- package/dist/components/CodeEditor/syntaxHighlightedPlaceholder.js +99 -0
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/FooterButton/index.js +2 -2
- package/dist/components/Resizable/useResizable.d.ts +5 -4
- package/dist/components/Resizable/useResizable.d.ts.map +1 -1
- package/dist/components/Resizable/useResizable.js +19 -10
- package/dist/components/SegmentedTabs/index.d.ts.map +1 -1
- package/dist/components/SegmentedTabs/index.js +1 -1
- package/dist/components/SegmentedTabs/types.d.ts +3 -1
- package/dist/components/SegmentedTabs/types.d.ts.map +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Toolbar/index.d.ts +75 -0
- package/dist/components/Toolbar/index.d.ts.map +1 -0
- package/dist/components/Toolbar/index.js +38 -0
- package/dist/components/VariableInput/index.js +1 -1
- package/dist/components/classes.js +2 -2
- package/dist/components/forms/classes.d.ts +4 -4
- package/dist/components/forms/classes.d.ts.map +1 -1
- package/dist/components/forms/classes.js +4 -4
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/styles.css +42 -0
- package/dist/ui/codeEditorSettings.d.ts +15 -0
- package/dist/ui/codeEditorSettings.d.ts.map +1 -1
- package/dist/ui/codeEditorSettings.js +40 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderHighlightedPlaceholder.d.ts","sourceRoot":"","sources":["../../../src/components/CodeEditor/renderHighlightedPlaceholder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAiC,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGpG;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,eAAe,CAAC;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACpC;AA8DD;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,mCAAmC,GAC3C,WAAW,CA4Cb"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { javascript } from '@codemirror/lang-javascript';
|
|
2
|
+
import { EditorState } from '@codemirror/state';
|
|
3
|
+
import { EditorView } from '@codemirror/view';
|
|
4
|
+
import { createBuiltInSyntaxHighlighting } from './editorChrome.js';
|
|
5
|
+
import { createSlashCommandHighlighter } from './slashCommandHighlighter.js';
|
|
6
|
+
import { getCodeEditorThemeExtension } from './themes.js';
|
|
7
|
+
const renderCache = new Map();
|
|
8
|
+
/**
|
|
9
|
+
* Builds a stable cache key for rendered placeholder DOM.
|
|
10
|
+
*
|
|
11
|
+
* @param text - Placeholder source text.
|
|
12
|
+
* @param options - Theme and highlighting options.
|
|
13
|
+
*/
|
|
14
|
+
function buildRenderCacheKey(text, options) {
|
|
15
|
+
const slashNames = options.slashCommands?.map((command) => command.name).join(',') ?? '';
|
|
16
|
+
return [text, options.fontSize, String(options.isDark), options.theme, slashNames].join('\0');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Builds CodeMirror extensions for the offscreen placeholder render pass.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Theme and highlighting options.
|
|
22
|
+
*/
|
|
23
|
+
function buildOffscreenPlaceholderExtensions(options) {
|
|
24
|
+
const extensions = [
|
|
25
|
+
javascript(),
|
|
26
|
+
EditorView.lineWrapping,
|
|
27
|
+
EditorView.editable.of(false),
|
|
28
|
+
EditorState.readOnly.of(true),
|
|
29
|
+
EditorView.theme({
|
|
30
|
+
'&': { backgroundColor: 'transparent' },
|
|
31
|
+
'.cm-scroller': { overflow: 'hidden' },
|
|
32
|
+
'.cm-content': {
|
|
33
|
+
padding: '0',
|
|
34
|
+
fontFamily: 'var(--font-mono)',
|
|
35
|
+
fontSize: options.fontSize
|
|
36
|
+
},
|
|
37
|
+
'.cm-line': { padding: '0' },
|
|
38
|
+
'.cm-activeLine': { backgroundColor: 'transparent' },
|
|
39
|
+
'.cm-slash-command': {
|
|
40
|
+
color: 'var(--mac-accent)'
|
|
41
|
+
},
|
|
42
|
+
'.cm-slash-command-args': {
|
|
43
|
+
color: 'var(--mac-muted)',
|
|
44
|
+
fontStyle: 'italic'
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
];
|
|
48
|
+
const themeExtension = getCodeEditorThemeExtension(options.theme);
|
|
49
|
+
if (themeExtension) {
|
|
50
|
+
extensions.push(themeExtension);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
extensions.push(createBuiltInSyntaxHighlighting(options.isDark));
|
|
54
|
+
}
|
|
55
|
+
if (options.slashCommands && options.slashCommands.length > 0) {
|
|
56
|
+
extensions.push(createSlashCommandHighlighter(options.slashCommands));
|
|
57
|
+
}
|
|
58
|
+
return extensions;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Renders highlighted placeholder markup via a hidden offscreen editor, then clones
|
|
62
|
+
* the resulting line nodes into a flat inline placeholder element.
|
|
63
|
+
*
|
|
64
|
+
* @param text - Placeholder source shown until the user focuses or types.
|
|
65
|
+
* @param options - Highlighting and theme options shared with the parent editor.
|
|
66
|
+
*/
|
|
67
|
+
export function renderHighlightedPlaceholderDom(text, options) {
|
|
68
|
+
const cacheKey = buildRenderCacheKey(text, options);
|
|
69
|
+
const cached = renderCache.get(cacheKey);
|
|
70
|
+
if (cached) {
|
|
71
|
+
return cached.cloneNode(true);
|
|
72
|
+
}
|
|
73
|
+
const host = document.createElement('div');
|
|
74
|
+
host.style.cssText = 'position:fixed;left:-10000px;top:0;visibility:hidden;pointer-events:none;';
|
|
75
|
+
document.body.appendChild(host);
|
|
76
|
+
const view = new EditorView({
|
|
77
|
+
state: EditorState.create({
|
|
78
|
+
doc: text,
|
|
79
|
+
extensions: buildOffscreenPlaceholderExtensions(options)
|
|
80
|
+
}),
|
|
81
|
+
parent: host
|
|
82
|
+
});
|
|
83
|
+
const wrap = document.createElement('span');
|
|
84
|
+
wrap.className = 'cm-placeholder cm-syntax-placeholder';
|
|
85
|
+
wrap.style.pointerEvents = 'none';
|
|
86
|
+
wrap.style.display = 'inline-block';
|
|
87
|
+
wrap.style.verticalAlign = 'top';
|
|
88
|
+
wrap.style.whiteSpace = 'pre-wrap';
|
|
89
|
+
wrap.style.opacity = '0.55';
|
|
90
|
+
wrap.style.fontFamily = 'var(--font-mono)';
|
|
91
|
+
wrap.style.fontSize = options.fontSize;
|
|
92
|
+
wrap.style.userSelect = 'none';
|
|
93
|
+
wrap.style.width = '100%';
|
|
94
|
+
wrap.setAttribute('aria-hidden', 'true');
|
|
95
|
+
const content = view.dom.querySelector('.cm-content');
|
|
96
|
+
if (content) {
|
|
97
|
+
for (const line of content.querySelectorAll('.cm-line')) {
|
|
98
|
+
wrap.appendChild(line.cloneNode(true));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
view.destroy();
|
|
102
|
+
host.remove();
|
|
103
|
+
renderCache.set(cacheKey, wrap.cloneNode(true));
|
|
104
|
+
return wrap;
|
|
105
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal slash-command shape required for line highlighting.
|
|
4
|
+
*/
|
|
5
|
+
export interface SlashCommandSpec {
|
|
6
|
+
/**
|
|
7
|
+
* Command name without the leading slash (for example `ask`).
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns a ViewPlugin extension that accents slash commands at the start of a line.
|
|
13
|
+
*
|
|
14
|
+
* @param commands - Registered slash commands to decorate.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createSlashCommandHighlighter(commands: SlashCommandSpec[]): Extension;
|
|
17
|
+
//# sourceMappingURL=slashCommandHighlighter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slashCommandHighlighter.d.ts","sourceRoot":"","sources":["../../../src/components/CodeEditor/slashCommandHighlighter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAeD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,SAAS,CA+CrF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Decoration, MatchDecorator, ViewPlugin } from '@codemirror/view';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a MatchDecorator regexp that highlights registered slash commands at line start.
|
|
4
|
+
*
|
|
5
|
+
* @param commands - Slash command names to highlight.
|
|
6
|
+
*/
|
|
7
|
+
function slashCommandHighlightPattern(commands) {
|
|
8
|
+
const names = commands.map((entry) => entry.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
|
9
|
+
if (names.length === 0) {
|
|
10
|
+
return /(?!)/g;
|
|
11
|
+
}
|
|
12
|
+
return new RegExp(`^(\\s*)(/(?:${names.join('|')}))([ \\t]+.*)?$`, 'gm');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns a ViewPlugin extension that accents slash commands at the start of a line.
|
|
16
|
+
*
|
|
17
|
+
* @param commands - Registered slash commands to decorate.
|
|
18
|
+
*/
|
|
19
|
+
export function createSlashCommandHighlighter(commands) {
|
|
20
|
+
const slashMatcher = new MatchDecorator({
|
|
21
|
+
regexp: slashCommandHighlightPattern(commands),
|
|
22
|
+
/**
|
|
23
|
+
* Applies accent styling to the command token and muted italic styling to args.
|
|
24
|
+
*/
|
|
25
|
+
decorate: (add, from, _to, match) => {
|
|
26
|
+
const leading = match[1] ?? '';
|
|
27
|
+
const command = match[2] ?? '';
|
|
28
|
+
const args = match[3];
|
|
29
|
+
const commandFrom = from + leading.length;
|
|
30
|
+
const commandTo = commandFrom + command.length;
|
|
31
|
+
add(commandFrom, commandTo, Decoration.mark({ class: 'cm-slash-command' }));
|
|
32
|
+
if (args) {
|
|
33
|
+
add(commandTo, commandTo + args.length, Decoration.mark({ class: 'cm-slash-command-args' }));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return ViewPlugin.fromClass(class {
|
|
38
|
+
decorations;
|
|
39
|
+
/**
|
|
40
|
+
* Builds the initial slash-command decoration set for the editor view.
|
|
41
|
+
*
|
|
42
|
+
* @param view - CodeMirror editor view instance.
|
|
43
|
+
*/
|
|
44
|
+
constructor(view) {
|
|
45
|
+
this.decorations = slashMatcher.createDeco(view);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Recomputes slash-command decorations when document content changes.
|
|
49
|
+
*
|
|
50
|
+
* @param update - View update describing what changed.
|
|
51
|
+
*/
|
|
52
|
+
update(update) {
|
|
53
|
+
this.decorations = slashMatcher.updateDeco(update, this.decorations);
|
|
54
|
+
}
|
|
55
|
+
}, { decorations: (v) => v.decorations });
|
|
56
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import { type RenderHighlightedPlaceholderOptions } from './renderHighlightedPlaceholder.js';
|
|
3
|
+
/**
|
|
4
|
+
* Options for building a muted syntax-highlighted placeholder layer.
|
|
5
|
+
*/
|
|
6
|
+
export type SyntaxHighlightedPlaceholderOptions = RenderHighlightedPlaceholderOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Returns CodeMirror extensions that show muted syntax-highlighted placeholder content
|
|
9
|
+
* when the editor document is empty and unfocused.
|
|
10
|
+
*
|
|
11
|
+
* @param text - Placeholder source shown until the user focuses or types.
|
|
12
|
+
* @param options - Highlighting and theme options shared with the parent editor.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createSyntaxHighlightedPlaceholder(text: string, options: SyntaxHighlightedPlaceholderOptions): Extension[];
|
|
15
|
+
//# sourceMappingURL=syntaxHighlightedPlaceholder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntaxHighlightedPlaceholder.d.ts","sourceRoot":"","sources":["../../../src/components/CodeEditor/syntaxHighlightedPlaceholder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AASnD,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,mCAAmC,CAAC;AA2DtF;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAChD,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,mCAAmC,GAC3C,SAAS,EAAE,CA+Cb"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Decoration, EditorView, ViewPlugin, WidgetType } from '@codemirror/view';
|
|
2
|
+
import { renderHighlightedPlaceholderDom } from './renderHighlightedPlaceholder.js';
|
|
3
|
+
/**
|
|
4
|
+
* Flat, pre-highlighted placeholder markup inserted when the parent editor is empty.
|
|
5
|
+
*/
|
|
6
|
+
class SyntaxHighlightedPlaceholderWidget extends WidgetType {
|
|
7
|
+
text;
|
|
8
|
+
options;
|
|
9
|
+
/**
|
|
10
|
+
* @param text - Placeholder document shown when the parent editor is empty.
|
|
11
|
+
* @param options - Highlighting and theme options shared with the parent editor.
|
|
12
|
+
*/
|
|
13
|
+
constructor(text, options) {
|
|
14
|
+
super();
|
|
15
|
+
this.text = text;
|
|
16
|
+
this.options = options;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns statically rendered placeholder DOM without nested editor chrome.
|
|
20
|
+
*/
|
|
21
|
+
toDOM() {
|
|
22
|
+
return renderHighlightedPlaceholderDom(this.text, this.options);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Prevents the placeholder layer from intercepting pointer events meant for the parent editor.
|
|
26
|
+
*/
|
|
27
|
+
ignoreEvent() {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns whether the syntax-highlighted placeholder should be visible.
|
|
33
|
+
*
|
|
34
|
+
* @param view - Parent CodeMirror editor view.
|
|
35
|
+
*/
|
|
36
|
+
function shouldShowSyntaxPlaceholder(view) {
|
|
37
|
+
return view.state.doc.length === 0 && !view.hasFocus;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Builds widget decorations for the muted placeholder layer.
|
|
41
|
+
*
|
|
42
|
+
* @param text - Placeholder source shown until focus or input.
|
|
43
|
+
* @param options - Highlighting and theme options.
|
|
44
|
+
*/
|
|
45
|
+
function buildSyntaxPlaceholderDecorations(text, options) {
|
|
46
|
+
return Decoration.set([
|
|
47
|
+
Decoration.widget({
|
|
48
|
+
widget: new SyntaxHighlightedPlaceholderWidget(text, options),
|
|
49
|
+
side: 1
|
|
50
|
+
}).range(0)
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns CodeMirror extensions that show muted syntax-highlighted placeholder content
|
|
55
|
+
* when the editor document is empty and unfocused.
|
|
56
|
+
*
|
|
57
|
+
* @param text - Placeholder source shown until the user focuses or types.
|
|
58
|
+
* @param options - Highlighting and theme options shared with the parent editor.
|
|
59
|
+
*/
|
|
60
|
+
export function createSyntaxHighlightedPlaceholder(text, options) {
|
|
61
|
+
const plugin = ViewPlugin.fromClass(class {
|
|
62
|
+
placeholder;
|
|
63
|
+
/**
|
|
64
|
+
* Initializes placeholder decorations for an empty, unfocused document.
|
|
65
|
+
*
|
|
66
|
+
* @param view - Parent CodeMirror editor view.
|
|
67
|
+
*/
|
|
68
|
+
constructor(view) {
|
|
69
|
+
this.placeholder = shouldShowSyntaxPlaceholder(view)
|
|
70
|
+
? buildSyntaxPlaceholderDecorations(text, options)
|
|
71
|
+
: Decoration.none;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Shows or hides the placeholder when the document, focus, or content changes.
|
|
75
|
+
*
|
|
76
|
+
* @param update - Parent view update.
|
|
77
|
+
*/
|
|
78
|
+
update(update) {
|
|
79
|
+
if (!update.docChanged && !update.focusChanged) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.placeholder = shouldShowSyntaxPlaceholder(update.view)
|
|
83
|
+
? buildSyntaxPlaceholderDecorations(text, options)
|
|
84
|
+
: Decoration.none;
|
|
85
|
+
}
|
|
86
|
+
get decorations() {
|
|
87
|
+
return this.placeholder;
|
|
88
|
+
}
|
|
89
|
+
}, { decorations: (v) => v.decorations });
|
|
90
|
+
return [
|
|
91
|
+
plugin,
|
|
92
|
+
EditorView.contentAttributes.of({ 'aria-placeholder': text }),
|
|
93
|
+
EditorView.theme({
|
|
94
|
+
'.cm-content:has(.cm-syntax-placeholder) .cm-activeLine': {
|
|
95
|
+
backgroundColor: 'transparent !important'
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
];
|
|
99
|
+
}
|
|
@@ -19,7 +19,7 @@ function variantClasses(variant) {
|
|
|
19
19
|
* @param className - Extra classes appended after the preset.
|
|
20
20
|
*/
|
|
21
21
|
export function EmptyState({ children, variant = 'inline', className }) {
|
|
22
|
-
const base = `hc-empty-state ${variantClasses(variant)}`;
|
|
22
|
+
const base = `hc-empty-state text-[16px] ${variantClasses(variant)}`;
|
|
23
23
|
const classes = className ? `${base} ${className}` : base;
|
|
24
24
|
return _jsx("div", { className: classes, children: children });
|
|
25
25
|
}
|
|
@@ -6,8 +6,8 @@ import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
function footerSegment(active) {
|
|
8
8
|
return active
|
|
9
|
-
? 'cursor-pointer rounded-
|
|
10
|
-
: 'cursor-pointer rounded-
|
|
9
|
+
? 'cursor-pointer rounded-md border-none bg-surface px-2 py-0.5 text-[14px] text-text shadow-sm app-no-drag'
|
|
10
|
+
: 'cursor-pointer rounded-md border-none bg-transparent px-2 py-0.5 text-[14px] text-muted hover:text-text app-no-drag';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Text segment toggle button for the window footer bar, used to open and close
|
|
@@ -25,6 +25,10 @@ export interface UseResizableOptions {
|
|
|
25
25
|
* When set, size is restored from and persisted to localStorage.
|
|
26
26
|
*/
|
|
27
27
|
storageKey?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Called when a resize is committed (mouseup after drag or keyboard nudge).
|
|
30
|
+
*/
|
|
31
|
+
onPersist?: (size: number) => void;
|
|
28
32
|
}
|
|
29
33
|
export interface UseResizableResult {
|
|
30
34
|
size: number;
|
|
@@ -34,9 +38,6 @@ export interface UseResizableResult {
|
|
|
34
38
|
onResizeStart: (event: ReactMouseEvent) => void;
|
|
35
39
|
onKeyboardResize: (event: ReactKeyboardEvent) => void;
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
* Tracks resizable panel size with pointer drag and optional persistence.
|
|
39
|
-
*/
|
|
40
|
-
export declare function useResizable({ axis, direction, defaultSize, minSize, getMaxSize, storageKey }: UseResizableOptions): UseResizableResult;
|
|
41
|
+
export declare function useResizable({ axis, direction, defaultSize, minSize, getMaxSize, storageKey, onPersist }: UseResizableOptions): UseResizableResult;
|
|
41
42
|
export {};
|
|
42
43
|
//# sourceMappingURL=useResizable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizable.d.ts","sourceRoot":"","sources":["../../../src/components/Resizable/useResizable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAEhG,KAAK,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAkDtB,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useResizable.d.ts","sourceRoot":"","sources":["../../../src/components/Resizable/useResizable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAEhG,KAAK,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAkDtB,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,aAAa,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAChD,gBAAgB,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACvD;AAyDD,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACV,EAAE,mBAAmB,GAAG,kBAAkB,CAgJ1C"}
|
|
@@ -80,7 +80,20 @@ function clampSize(size, minSize, getMaxSize) {
|
|
|
80
80
|
/**
|
|
81
81
|
* Tracks resizable panel size with pointer drag and optional persistence.
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Persists a committed resize size via localStorage and/or a caller callback.
|
|
85
|
+
*
|
|
86
|
+
* @param storageKey - Optional localStorage key.
|
|
87
|
+
* @param onPersist - Optional commit callback.
|
|
88
|
+
* @param size - Committed size in pixels.
|
|
89
|
+
*/
|
|
90
|
+
function commitSize(storageKey, onPersist, size) {
|
|
91
|
+
if (storageKey) {
|
|
92
|
+
persistSize(storageKey, size);
|
|
93
|
+
}
|
|
94
|
+
onPersist?.(size);
|
|
95
|
+
}
|
|
96
|
+
export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize, storageKey, onPersist }) {
|
|
84
97
|
const [size, setSizeState] = useState(() => {
|
|
85
98
|
const initial = storageKey ? loadStoredSize(storageKey, defaultSize) : defaultSize;
|
|
86
99
|
return clampSize(initial, minSize, getMaxSize);
|
|
@@ -153,10 +166,8 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
153
166
|
event.preventDefault();
|
|
154
167
|
const nextSize = clampSize(sizeRef.current + keyDelta * direction, minSize, getMaxSize);
|
|
155
168
|
setSizeState(nextSize);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
}, [axis, direction, getMaxSize, minSize, storageKey]);
|
|
169
|
+
commitSize(storageKey, onPersist, nextSize);
|
|
170
|
+
}, [axis, direction, getMaxSize, minSize, onPersist, storageKey]);
|
|
160
171
|
/**
|
|
161
172
|
* Applies pointer delta to panel size during drag and persists on mouse up.
|
|
162
173
|
*/
|
|
@@ -175,16 +186,14 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
175
186
|
setSizeState(nextSize);
|
|
176
187
|
};
|
|
177
188
|
/**
|
|
178
|
-
* Ends the resize drag and
|
|
189
|
+
* Ends the resize drag and commits the final size when configured.
|
|
179
190
|
*/
|
|
180
191
|
const handleMouseUp = () => {
|
|
181
192
|
if (!resizingRef.current)
|
|
182
193
|
return;
|
|
183
194
|
resizingRef.current = false;
|
|
184
195
|
clearResizingState();
|
|
185
|
-
|
|
186
|
-
persistSize(storageKey, sizeRef.current);
|
|
187
|
-
}
|
|
196
|
+
commitSize(storageKey, onPersist, sizeRef.current);
|
|
188
197
|
};
|
|
189
198
|
window.addEventListener('mousemove', handleMouseMove);
|
|
190
199
|
window.addEventListener('mouseup', handleMouseUp);
|
|
@@ -198,7 +207,7 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
198
207
|
window.removeEventListener('mousemove', handleMouseMove);
|
|
199
208
|
window.removeEventListener('mouseup', handleMouseUp);
|
|
200
209
|
};
|
|
201
|
-
}, [axis, direction, getMaxSize, minSize, storageKey]);
|
|
210
|
+
}, [axis, direction, getMaxSize, minSize, onPersist, storageKey]);
|
|
202
211
|
/**
|
|
203
212
|
* Clears the document resize marker when the hook unmounts mid-drag.
|
|
204
213
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedTabs/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAMhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAkD1C,UAAU,KAAK,CAAC,CAAC,SAAS,MAAM;IAC9B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IAEV;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC;IAEvB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC;IAE9B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAE3D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAEhC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,EAC9C,IAAI,EACJ,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,YAAY,EACtB,QAAe,EACf,gBAAgB,EAAE,oBAAoB,EACtC,uBAAuB,EACvB,wBAAwB,EACxB,SAAiB,EACjB,SAAS,EACT,OAAgB,EAChB,SAAS,EAAE,aAAa,EACzB,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedTabs/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAMhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAkD1C,UAAU,KAAK,CAAC,CAAC,SAAS,MAAM;IAC9B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IAEV;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC;IAEvB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC;IAE9B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAE3D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAEhC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,EAC9C,IAAI,EACJ,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,YAAY,EACtB,QAAe,EACf,gBAAgB,EAAE,oBAAoB,EACtC,uBAAuB,EACvB,wBAAwB,EACxB,SAAiB,EACjB,SAAS,EACT,OAAgB,EAChB,SAAS,EAAE,aAAa,EACzB,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAoQxB"}
|
|
@@ -224,6 +224,6 @@ export function SegmentedTabs({ tabs, value: valueProp, onChange: onChangeProp,
|
|
|
224
224
|
id: getTabId(tab.value),
|
|
225
225
|
'aria-selected': selected,
|
|
226
226
|
...(context ? { 'aria-controls': getPanelId(tab.value) } : {})
|
|
227
|
-
}), children: _jsxs("span", { className: "hc-segmented-tabs-tab-label inline-flex items-center gap-1.5", children: [
|
|
227
|
+
}), children: _jsxs("span", { className: "hc-segmented-tabs-tab-label inline-flex items-center gap-1.5", children: [_jsx("span", { className: "inline-flex shrink-0 items-center px-1.5", children: _jsx("span", { className: `hc-segmented-tabs-tab-indicator h-1.5 w-1.5 shrink-0 rounded-full ${tab.indicator ? 'bg-accent' : 'bg-transparent'}`, "aria-hidden": true }) }), tab.label, _jsx("span", { className: "hc-segmented-tabs-tab-indicator-spacer inline-flex shrink-0 items-center px-1.5", "aria-hidden": true, children: _jsx("span", { className: "h-1.5 w-1.5 shrink-0" }) })] }) }, tab.value));
|
|
228
228
|
}) }), editable && (_jsx(SegmentedTabsVisibilityMenu, { tabs: editableTabs, visibleTabValues: visibleTabValues, onToggle: handleVisibilityToggle }))] }));
|
|
229
229
|
}
|
|
@@ -17,7 +17,9 @@ export interface TabItem<T extends string> {
|
|
|
17
17
|
*/
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
/**
|
|
20
|
-
* When true,
|
|
20
|
+
* When true, shows an accent dot in the reserved indicator slot to the left
|
|
21
|
+
* of the label. The slot stays visible (transparent) when false so tab width
|
|
22
|
+
* stays stable across the group.
|
|
21
23
|
*/
|
|
22
24
|
indicator?: boolean;
|
|
23
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedTabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM;IACvC;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedTabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM;IACvC;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -48,7 +48,7 @@ export function Table({ children, variant = 'bordered', className }) {
|
|
|
48
48
|
const tableClasses = className ? `${tableBase} ${className}` : tableBase;
|
|
49
49
|
return createElement(TableVariantContext.Provider, { value: variant }, createElement('table', { className: tableClasses }, children));
|
|
50
50
|
}
|
|
51
|
-
const wrapperBase = 'hc-table overflow-hidden rounded-
|
|
51
|
+
const wrapperBase = 'hc-table overflow-hidden rounded-lg border border-separator';
|
|
52
52
|
const wrapperClasses = className ? `${wrapperBase} ${className}` : wrapperBase;
|
|
53
53
|
return createElement(TableVariantContext.Provider, { value: variant }, createElement('div', { className: wrapperClasses }, createElement('table', { className: 'hc-table-element w-full border-collapse' }, children)));
|
|
54
54
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import type { AriaAttributes, JSX, ReactNode, RefObject } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Declarative action rendered as an icon button in a sidebar toolbar.
|
|
5
|
+
*/
|
|
6
|
+
export interface ToolbarAction {
|
|
7
|
+
/**
|
|
8
|
+
* Stable React key for this action.
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Font Awesome icon shown inside the action button.
|
|
13
|
+
*/
|
|
14
|
+
icon: IconDefinition;
|
|
15
|
+
/**
|
|
16
|
+
* Accessible name for the control.
|
|
17
|
+
*/
|
|
18
|
+
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Native tooltip text; defaults to `label`.
|
|
21
|
+
*/
|
|
22
|
+
title?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Called when the user activates the action button.
|
|
25
|
+
*/
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* When true, the action button is inactive.
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Exposes toggle state for popup actions such as history menus.
|
|
33
|
+
*/
|
|
34
|
+
ariaExpanded?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Exposes pressed state for toggle actions such as visibility switches.
|
|
37
|
+
*/
|
|
38
|
+
ariaPressed?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Indicates the action opens a popup, for example `"menu"`.
|
|
41
|
+
*/
|
|
42
|
+
ariaHaspopup?: AriaAttributes['aria-haspopup'];
|
|
43
|
+
/**
|
|
44
|
+
* Optional popover content anchored below this action button.
|
|
45
|
+
*/
|
|
46
|
+
popover?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Ref attached to the action button for portaled popover positioning.
|
|
49
|
+
*/
|
|
50
|
+
buttonRef?: RefObject<HTMLButtonElement | null>;
|
|
51
|
+
}
|
|
52
|
+
interface Props {
|
|
53
|
+
/**
|
|
54
|
+
* Icon actions rendered in the toolbar.
|
|
55
|
+
*/
|
|
56
|
+
actions: ToolbarAction[];
|
|
57
|
+
/**
|
|
58
|
+
* Accessible name for the toolbar landmark.
|
|
59
|
+
*/
|
|
60
|
+
ariaLabel?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Extra classes merged onto the outer toolbar wrapper.
|
|
63
|
+
*/
|
|
64
|
+
className?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Top-of-sidebar toolbar with left-aligned icon actions.
|
|
68
|
+
*
|
|
69
|
+
* @param actions - Declarative icon actions rendered on the left.
|
|
70
|
+
* @param ariaLabel - Accessible name for the toolbar landmark.
|
|
71
|
+
* @param className - Extra classes merged onto the outer wrapper.
|
|
72
|
+
*/
|
|
73
|
+
export declare function Toolbar({ actions, ariaLabel, className }: Props): JSX.Element;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toolbar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,cAAc,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAE/C;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACjD;AAED,UAAU,KAAK;IACb;;OAEG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;IAEzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAyBD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,SAAqB,EAAE,SAAS,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAyCzF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { FaIcon } from '../FaIcon/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Tailwind classes for inactive toolbar icon action buttons.
|
|
5
|
+
*/
|
|
6
|
+
const TOOLBAR_ACTION_BUTTON_INACTIVE = 'hc-toolbar-action inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-[14px] text-muted hover:bg-selection hover:text-text focus-visible:bg-selection focus-visible:text-text disabled:cursor-not-allowed disabled:opacity-50 app-no-drag';
|
|
7
|
+
/**
|
|
8
|
+
* Tailwind classes for pressed toolbar toggles, matching footer layout icon buttons.
|
|
9
|
+
*/
|
|
10
|
+
const TOOLBAR_ACTION_BUTTON_ACTIVE = 'hc-toolbar-action inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-surface text-text shadow-sm focus-visible:bg-surface focus-visible:text-text disabled:cursor-not-allowed disabled:opacity-50 app-no-drag';
|
|
11
|
+
/**
|
|
12
|
+
* Resolves toolbar button classes for a declarative action.
|
|
13
|
+
*
|
|
14
|
+
* @param action - Toolbar action metadata.
|
|
15
|
+
*/
|
|
16
|
+
function toolbarActionButton(action) {
|
|
17
|
+
return action.ariaPressed === true
|
|
18
|
+
? TOOLBAR_ACTION_BUTTON_ACTIVE
|
|
19
|
+
: TOOLBAR_ACTION_BUTTON_INACTIVE;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Top-of-sidebar toolbar with left-aligned icon actions.
|
|
23
|
+
*
|
|
24
|
+
* @param actions - Declarative icon actions rendered on the left.
|
|
25
|
+
* @param ariaLabel - Accessible name for the toolbar landmark.
|
|
26
|
+
* @param className - Extra classes merged onto the outer wrapper.
|
|
27
|
+
*/
|
|
28
|
+
export function Toolbar({ actions, ariaLabel = 'Toolbar', className }) {
|
|
29
|
+
const wrapperClassName = className
|
|
30
|
+
? `hc-toolbar flex shrink-0 items-center border-b border-separator bg-sidebar-toolbar px-2 py-2 app-no-drag ${className}`
|
|
31
|
+
: 'hc-toolbar flex shrink-0 items-center border-b border-separator bg-sidebar-toolbar px-2 py-2 app-no-drag';
|
|
32
|
+
return (_jsx("div", { role: "toolbar", "aria-label": ariaLabel, className: wrapperClassName, children: _jsx("div", { className: "hc-toolbar-actions flex items-center gap-1", children: actions.map((action) => {
|
|
33
|
+
const title = action.title ?? action.label;
|
|
34
|
+
return (_jsxs("div", { className: "hc-toolbar-action-wrap relative", children: [_jsx("button", { type: "button", ref: action.buttonRef, className: toolbarActionButton(action), title: title, "aria-label": action.label, "aria-expanded": action.ariaExpanded, "aria-pressed": action.ariaPressed, "aria-haspopup": action.ariaHaspopup, disabled: action.disabled, onClick: action.onClick, children: _jsx(FaIcon, { icon: action.icon, className: action.ariaPressed === true
|
|
35
|
+
? 'hc-toolbar-action-icon h-4 w-4'
|
|
36
|
+
: 'hc-toolbar-action-icon h-3.5 w-3.5' }) }), action.popover] }, action.id));
|
|
37
|
+
}) }) }));
|
|
38
|
+
}
|
|
@@ -176,7 +176,7 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
176
176
|
}, onFocus: () => {
|
|
177
177
|
openAutocomplete();
|
|
178
178
|
updateTooltipFromCaret();
|
|
179
|
-
}, onBlur: closeAutocomplete, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onSelect: updateTooltipFromCaret, onClick: updateTooltipFromCaret, onScroll: syncScroll, onMouseMove: handleMouseMove, onMouseLeave: scheduleHide }), source && (_jsx(SuggestionList, { open: autocompleteOpen, items: autocompleteItems, activeIndex: autocompleteActiveIndex, anchorRef: inputRef, listboxId: listboxId, onSelect: selectItem, onActiveIndexChange: setActiveIndex, onClose: closeSuggestions })), tooltip && tooltipContent && (_jsxs("div", { id: tooltipId, role: "tooltip", className: "hc-variable-input-tooltip pointer-events-auto fixed z-50 flex max-w-sm -translate-x-1/2 -translate-y-full flex-col gap-2 rounded-
|
|
179
|
+
}, onBlur: closeAutocomplete, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onSelect: updateTooltipFromCaret, onClick: updateTooltipFromCaret, onScroll: syncScroll, onMouseMove: handleMouseMove, onMouseLeave: scheduleHide }), source && (_jsx(SuggestionList, { open: autocompleteOpen, items: autocompleteItems, activeIndex: autocompleteActiveIndex, anchorRef: inputRef, listboxId: listboxId, onSelect: selectItem, onActiveIndexChange: setActiveIndex, onClose: closeSuggestions })), tooltip && tooltipContent && (_jsxs("div", { id: tooltipId, role: "tooltip", className: "hc-variable-input-tooltip pointer-events-auto fixed z-50 flex max-w-sm -translate-x-1/2 -translate-y-full flex-col gap-2 rounded-lg border border-separator bg-surface px-4 py-3 text-[14px] text-text shadow-md after:pointer-events-auto after:absolute after:-bottom-2 after:left-0 after:right-0 after:h-2 after:content-['']", style: { top: tooltip.top - 4, left: tooltip.left }, onMouseEnter: cancelHide, onMouseLeave: scheduleHide, children: [_jsx("span", { className: tooltipContent.muted
|
|
180
180
|
? 'hc-variable-input-tooltip-text text-muted'
|
|
181
181
|
: 'hc-variable-input-tooltip-text', children: tooltipContent.text }), onEditVariable && (_jsx("button", { type: "button", className: "hc-variable-input-tooltip-edit -mx-1 self-start rounded px-1 py-0.5 text-[14px] text-accent hover:underline app-no-drag", "aria-label": `Edit value for ${tooltip.key}`, onClick: () => {
|
|
182
182
|
onEditVariable();
|
|
@@ -10,6 +10,6 @@ const segmentFocusVisible = 'focus-visible:outline focus-visible:outline-2 focus
|
|
|
10
10
|
*/
|
|
11
11
|
export function segment(active) {
|
|
12
12
|
return active
|
|
13
|
-
? `cursor-pointer rounded-
|
|
14
|
-
: `cursor-pointer rounded-
|
|
13
|
+
? `cursor-pointer rounded-md border-none bg-selection px-3 py-1 text-[15px] text-text app-no-drag ${segmentFocusVisible}`
|
|
14
|
+
: `cursor-pointer rounded-md border-none bg-transparent px-3 py-1 text-[15px] text-muted hover:text-text app-no-drag ${segmentFocusVisible}`;
|
|
15
15
|
}
|
|
@@ -8,15 +8,15 @@ export type FieldVariant = 'control' | 'surface' | 'plain';
|
|
|
8
8
|
/**
|
|
9
9
|
* Border and subtle tint shell for composite inputs (e.g. VariableInput wrappers).
|
|
10
10
|
*/
|
|
11
|
-
export declare const fieldFrame = "overflow-hidden rounded-
|
|
11
|
+
export declare const fieldFrame = "overflow-hidden rounded-lg border border-separator bg-field";
|
|
12
12
|
/** Inset control style for standard settings and editor fields. */
|
|
13
|
-
export declare const field = "rounded-
|
|
13
|
+
export declare const field = "rounded-lg border border-separator bg-field px-2.5 py-1.5 text-[16px] text-text app-no-drag";
|
|
14
14
|
/** Surface style for modal and Team Hub form fields. */
|
|
15
|
-
export declare const surfaceField = "w-full rounded-
|
|
15
|
+
export declare const surfaceField = "w-full rounded-lg border border-separator bg-field px-3 py-2.5 text-[15px] text-text";
|
|
16
16
|
/** Transparent overlay checkbox input sized to {@link checkboxBox}. */
|
|
17
17
|
export declare const checkboxInput = "peer absolute inset-0 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed";
|
|
18
18
|
/** Custom checkbox box styled via `peer-checked` / `peer-focus-visible` on {@link checkboxInput}. */
|
|
19
|
-
export declare const checkboxBox = "pointer-events-none flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded border border-separator bg-field text-white peer-checked:border-accent peer-checked:bg-accent peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-accent peer-disabled:cursor-not-allowed peer-disabled:opacity-50 [&>svg]:opacity-0 peer-checked:[&>svg]:opacity-100";
|
|
19
|
+
export declare const checkboxBox = "pointer-events-none flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-sm border border-separator bg-field text-white peer-checked:border-accent peer-checked:bg-accent peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-accent peer-disabled:cursor-not-allowed peer-disabled:opacity-50 [&>svg]:opacity-0 peer-checked:[&>svg]:opacity-100";
|
|
20
20
|
/** Transparent overlay radio input sized to {@link radioCircle}. */
|
|
21
21
|
export declare const radioInput = "peer absolute inset-0 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed";
|
|
22
22
|
/** Custom radio circle styled via `peer-checked` / `peer-focus-visible` on {@link radioInput}. */
|