@openviking/react 0.1.6 → 0.1.7
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/README.md +2 -0
- package/dist/2~0.js +6 -5
- package/dist/3c~0.js +10 -4
- package/dist/3~0.js +18 -8
- package/dist/ae~0.js +8 -1
- package/dist/ark-message-list-view~0.js +9 -4
- package/dist/a~0.js +12 -6
- package/dist/c7r~0.js +50 -0
- package/dist/ck~0.js +3 -0
- package/dist/client/paths.d.ts +6 -0
- package/dist/client/provider.d.ts +6 -1
- package/dist/components/agent-connect/style.css +222 -35
- package/dist/components/directory-tour/style.css +221 -21
- package/dist/components/directory-tour.js +1 -1
- package/dist/components/experience-dashboard/style.css +227 -12
- package/dist/components/experience-dashboard.js +1 -1
- package/dist/components/file-browser-entries/style.css +325 -80
- package/dist/components/file-preview/style.css +221 -76
- package/dist/components/file-tree/file-tree-toolbar.d.ts +3 -3
- package/dist/components/file-tree/locales/en-US.d.ts +3 -0
- package/dist/components/file-tree/locales/zh-CN.d.ts +3 -0
- package/dist/components/file-tree/style.css +311 -86
- package/dist/components/file-tree/types.d.ts +13 -4
- package/dist/components/scope-switcher/style.css +366 -37
- package/dist/components/scope-switcher.js +1 -1
- package/dist/components/style.css +3329 -640
- package/dist/components/tui/style.css +267 -35
- package/dist/components/viking-bot/interaction/style.css +143 -22
- package/dist/components/viking-bot/style.css +945 -295
- package/dist/components/wiki-dashboard/style.css +227 -12
- package/dist/c~0.js +16 -8
- package/dist/ep~0.js +345 -0
- package/dist/e~0.js +33 -328
- package/dist/fj~0.js +8 -4
- package/dist/fl~0.js +709 -0
- package/dist/f~0.js +302 -663
- package/dist/index.js +3 -3
- package/dist/lk~0.js +6 -3
- package/dist/l~0.js +1874 -437
- package/dist/modules/console/style.css +1471 -351
- package/dist/modules/file-browser/acl/acl-add-principal.d.ts +12 -0
- package/dist/modules/file-browser/acl/acl-candidate.d.ts +8 -0
- package/dist/modules/file-browser/acl/acl-client.d.ts +13 -0
- package/dist/modules/file-browser/acl/acl-confirmation.d.ts +6 -0
- package/dist/modules/file-browser/acl/acl-entry.d.ts +13 -0
- package/dist/modules/file-browser/acl/acl-labels.d.ts +47 -0
- package/dist/modules/file-browser/acl/acl-menu.d.ts +10 -0
- package/dist/modules/file-browser/acl/acl-modal.d.ts +17 -0
- package/dist/modules/file-browser/acl/acl-model.d.ts +17 -0
- package/dist/modules/file-browser/acl/acl-principal-tabs.d.ts +6 -0
- package/dist/modules/file-browser/acl/acl-tag.d.ts +7 -0
- package/dist/modules/file-browser/acl/locales/en-US.d.ts +44 -0
- package/dist/modules/file-browser/acl/locales/zh-CN.d.ts +44 -0
- package/dist/modules/file-browser/acl/use-acl-principals.d.ts +17 -0
- package/dist/modules/file-browser/acl/use-acl-report.d.ts +27 -0
- package/dist/modules/file-browser/acl-types.d.ts +86 -0
- package/dist/modules/file-browser/dashboard-model.d.ts +3 -0
- package/dist/modules/file-browser/file-browser-detail.d.ts +4 -1
- package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
- package/dist/modules/file-browser/file-browser-search.d.ts +20 -0
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +3 -10
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +2 -6
- package/dist/modules/file-browser/file-browser.d.ts +1 -1
- package/dist/modules/file-browser/fs-directories.d.ts +1 -0
- package/dist/modules/file-browser/fs-model.d.ts +3 -1
- package/dist/modules/file-browser/index.d.ts +1 -0
- package/dist/modules/file-browser/locales/en-US.d.ts +5 -0
- package/dist/modules/file-browser/locales/zh-CN.d.ts +5 -0
- package/dist/modules/file-browser/style.css +2409 -603
- package/dist/modules/file-browser/types.d.ts +20 -20
- package/dist/modules/file-browser/use-file-browser-acl.d.ts +15 -0
- package/dist/modules/file-browser/use-file-browser.d.ts +5 -7
- package/dist/modules/file-browser/use-fs-tree.d.ts +1 -0
- package/dist/modules/scope-cascade/style.css +535 -37
- package/dist/modules/style.css +12227 -8757
- package/dist/n~0.js +60 -36
- package/dist/rt~0.js +107 -4
- package/dist/r~0.js +1 -1
- package/dist/shared/components/button/button.d.ts +20 -0
- package/dist/shared/components/input/input.d.ts +17 -0
- package/dist/shared/components/modal/locales/en-US.d.ts +4 -0
- package/dist/shared/components/modal/locales/zh-CN.d.ts +4 -0
- package/dist/shared/components/modal/modal.d.ts +2 -0
- package/dist/shared/components/modal/types.d.ts +18 -0
- package/dist/shared/components/overlay/lock-body-scroll.d.ts +1 -0
- package/dist/style.css +7776 -1571
- package/dist/s~0.js +16 -0
- package/dist/u~0.js +15 -6
- package/dist/viking-bot-composer~0.js +29 -11
- package/dist/viking-bot-interaction~0.js +2 -1
- package/package.json +3 -2
- package/dist/fi~0.js +0 -354
- package/dist/modules/file-browser/fs-selection.d.ts +0 -4
- package/dist/o~0.js +0 -106
package/dist/n~0.js
CHANGED
|
@@ -3,10 +3,15 @@ import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
|
3
3
|
import { resolveLocale, mergeLabels } from "./nx~0.js";
|
|
4
4
|
import { FolderOpenIcon, FolderIcon, ChevronRightIcon, DocumentIcon } from "./k~0.js";
|
|
5
5
|
import { Popover } from "./r~0.js";
|
|
6
|
+
import { button_Button } from "./e~0.js";
|
|
6
7
|
import { searchreact } from "./p~0.js";
|
|
8
|
+
import { Tooltip } from "./rt~0.js";
|
|
7
9
|
import { useLocale } from "./28~0.js";
|
|
8
10
|
const messages = {
|
|
9
|
-
|
|
11
|
+
readOnly: 'Read-only',
|
|
12
|
+
noAccess: 'No access',
|
|
13
|
+
traverseOnly: 'Traverse only',
|
|
14
|
+
search: 'Search files ⌘+K...',
|
|
10
15
|
refresh: 'Refresh file tree',
|
|
11
16
|
empty: 'No files yet',
|
|
12
17
|
error: 'Failed to load',
|
|
@@ -75,7 +80,10 @@ const messages = {
|
|
|
75
80
|
};
|
|
76
81
|
const en_US = messages;
|
|
77
82
|
const zh_CN_messages = {
|
|
78
|
-
|
|
83
|
+
readOnly: '只读',
|
|
84
|
+
noAccess: '无权限',
|
|
85
|
+
traverseOnly: '仅可遍历',
|
|
86
|
+
search: '搜索文件 ⌘+K...',
|
|
79
87
|
refresh: '刷新文件树',
|
|
80
88
|
empty: '暂无文件',
|
|
81
89
|
error: '加载失败',
|
|
@@ -396,7 +404,7 @@ function FileTreeRowView({ row, ctx }) {
|
|
|
396
404
|
const description = row.description ?? (infoKey && showsInlineDescription(infoKey) ? resolveInfoCopy(infoKey, ctx.infoLabels).description : void 0);
|
|
397
405
|
const handleClick = (event)=>{
|
|
398
406
|
if (event.target.closest('[data-role="toggle"]')) return;
|
|
399
|
-
if (row.disabled) return;
|
|
407
|
+
if (row.disabled || false === row.selectable) return;
|
|
400
408
|
onSelect?.(row);
|
|
401
409
|
};
|
|
402
410
|
const handleToggle = (event)=>{
|
|
@@ -407,7 +415,7 @@ function FileTreeRowView({ row, ctx }) {
|
|
|
407
415
|
role: "treeitem",
|
|
408
416
|
tabIndex: 0,
|
|
409
417
|
"aria-level": row.depth + 1,
|
|
410
|
-
"aria-selected": isSelected,
|
|
418
|
+
"aria-selected": false === row.selectable ? void 0 : isSelected,
|
|
411
419
|
"aria-expanded": canExpand ? isExpanded : void 0,
|
|
412
420
|
"aria-disabled": row.disabled || void 0,
|
|
413
421
|
...extraAttributes,
|
|
@@ -486,6 +494,10 @@ function FileTreeRowView({ row, ctx }) {
|
|
|
486
494
|
className: "ov-file-tree__level",
|
|
487
495
|
children: row.levelLabel
|
|
488
496
|
}) : null,
|
|
497
|
+
row.access ? /*#__PURE__*/ jsx("span", {
|
|
498
|
+
className: "ov-file-tree__level",
|
|
499
|
+
children: 'read-only' === row.access ? text.readOnly : 'denied' === row.access ? text.noAccess : text.traverseOnly
|
|
500
|
+
}) : null,
|
|
489
501
|
dashboard ? /*#__PURE__*/ jsx("span", {
|
|
490
502
|
className: "ov-file-tree__dashboard",
|
|
491
503
|
children: dashboard
|
|
@@ -566,8 +578,10 @@ function FileTreeStateRow({ row, ctx }) {
|
|
|
566
578
|
className: "ov-file-tree__toggle-spacer"
|
|
567
579
|
}),
|
|
568
580
|
row.loading ? spinner : null,
|
|
569
|
-
/*#__PURE__*/ jsx(
|
|
570
|
-
|
|
581
|
+
/*#__PURE__*/ jsx(button_Button, {
|
|
582
|
+
size: "mini",
|
|
583
|
+
type: "text",
|
|
584
|
+
htmlType: "button",
|
|
571
585
|
className: "ov-file-tree__action",
|
|
572
586
|
disabled: row.loading || !onLoadMore,
|
|
573
587
|
onClick: ()=>onLoadMore?.(row),
|
|
@@ -585,8 +599,10 @@ function FileTreeStateRow({ row, ctx }) {
|
|
|
585
599
|
className: "ov-file-tree__muted",
|
|
586
600
|
children: row.message ?? text.error
|
|
587
601
|
}),
|
|
588
|
-
/*#__PURE__*/ jsx(
|
|
589
|
-
|
|
602
|
+
/*#__PURE__*/ jsx(button_Button, {
|
|
603
|
+
size: "mini",
|
|
604
|
+
type: "text",
|
|
605
|
+
htmlType: "button",
|
|
590
606
|
className: "ov-file-tree__action",
|
|
591
607
|
disabled: !onRetry,
|
|
592
608
|
onClick: ()=>onRetry?.(row),
|
|
@@ -686,22 +702,27 @@ function handleRowKeyDown(event, { root, row, onSelect, onToggleExpand }) {
|
|
|
686
702
|
case 'Enter':
|
|
687
703
|
case ' ':
|
|
688
704
|
event.preventDefault();
|
|
689
|
-
if (!row.disabled) onSelect?.(row);
|
|
705
|
+
if (!row.disabled && false !== row.selectable) onSelect?.(row);
|
|
690
706
|
return;
|
|
691
707
|
default:
|
|
692
708
|
return;
|
|
693
709
|
}
|
|
694
710
|
}
|
|
695
|
-
function FileTreeToolbar({ search, refresh, text, refreshing, onSearch, onRefresh }) {
|
|
711
|
+
function FileTreeToolbar({ search, refresh, loading, text, refreshing, onSearch, onRefresh, className }) {
|
|
696
712
|
if (!search && !refresh) return null;
|
|
697
713
|
const searchDisabled = !onSearch || 'object' == typeof search && search.disabled;
|
|
698
714
|
const refreshDisabled = !onRefresh || 'object' == typeof refresh && refresh.disabled;
|
|
699
|
-
const busy = refreshing || 'object' == typeof refresh && refresh.loading;
|
|
715
|
+
const busy = loading || refreshing || 'object' == typeof refresh && refresh.loading;
|
|
700
716
|
return /*#__PURE__*/ jsxs("div", {
|
|
701
|
-
className:
|
|
717
|
+
className: [
|
|
718
|
+
'ov-file-tree__controls',
|
|
719
|
+
className
|
|
720
|
+
].filter(Boolean).join(' '),
|
|
702
721
|
children: [
|
|
703
|
-
search ? /*#__PURE__*/ jsxs(
|
|
704
|
-
|
|
722
|
+
search ? /*#__PURE__*/ jsxs(button_Button, {
|
|
723
|
+
size: "default",
|
|
724
|
+
type: "default",
|
|
725
|
+
htmlType: "button",
|
|
705
726
|
className: "ov-file-tree__search",
|
|
706
727
|
disabled: Boolean(searchDisabled),
|
|
707
728
|
onClick: onSearch,
|
|
@@ -718,27 +739,29 @@ function FileTreeToolbar({ search, refresh, text, refreshing, onSearch, onRefres
|
|
|
718
739
|
})
|
|
719
740
|
]
|
|
720
741
|
}) : null,
|
|
721
|
-
refresh ? /*#__PURE__*/ jsx(
|
|
722
|
-
|
|
723
|
-
className: "ov-file-tree__refresh",
|
|
724
|
-
"aria-label": text.refresh,
|
|
725
|
-
title: text.refresh,
|
|
726
|
-
"aria-busy": Boolean(busy),
|
|
742
|
+
refresh ? /*#__PURE__*/ jsx(Tooltip, {
|
|
743
|
+
content: text.refresh,
|
|
727
744
|
disabled: Boolean(refreshDisabled || busy),
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
"aria-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
745
|
+
children: /*#__PURE__*/ jsx(button_Button, {
|
|
746
|
+
className: "ov-file-tree__refresh",
|
|
747
|
+
"aria-label": text.refresh,
|
|
748
|
+
"aria-busy": Boolean(busy),
|
|
749
|
+
loading: Boolean(busy),
|
|
750
|
+
disabled: Boolean(refreshDisabled),
|
|
751
|
+
onClick: onRefresh,
|
|
752
|
+
icon: /*#__PURE__*/ jsx("svg", {
|
|
753
|
+
"aria-hidden": "true",
|
|
754
|
+
width: 14,
|
|
755
|
+
height: 14,
|
|
756
|
+
viewBox: "0 0 16 16",
|
|
757
|
+
fill: "none",
|
|
758
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
759
|
+
d: "M13 6a5.2 5.2 0 1 0 .15 3.5M13 2.5V6H9.5",
|
|
760
|
+
stroke: "currentColor",
|
|
761
|
+
strokeWidth: "1.5",
|
|
762
|
+
strokeLinecap: "round",
|
|
763
|
+
strokeLinejoin: "round"
|
|
764
|
+
})
|
|
742
765
|
})
|
|
743
766
|
})
|
|
744
767
|
}) : null
|
|
@@ -789,7 +812,7 @@ function FileTreeSpinner({ className, ...rest }) {
|
|
|
789
812
|
function findRow(root, id) {
|
|
790
813
|
return root?.querySelector(`[${FILE_TREE_ROW_ATTRIBUTE}="${CSS.escape(id)}"]`) ?? null;
|
|
791
814
|
}
|
|
792
|
-
const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, locale: localeProp, operations, selectedId, search, refresh, isReady = true, loadingFallback, errorFallback, emptyFallback, slots, labels, getRowAttributes, renderDashboard, renderRowTooltip, renderRowIcon, onSelect, onToggleExpand, onLoadMore, onRetry, onOpenRetentionSettings, onSearch, onRefresh, className, ...rest }, ref) {
|
|
815
|
+
const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, locale: localeProp, operations, selectedId, search = true, refresh = true, loading = false, isReady = true, loadingFallback, errorFallback, emptyFallback, slots, labels, getRowAttributes, renderDashboard, renderRowTooltip, renderRowIcon, onSelect, onToggleExpand, onLoadMore, onRetry, onOpenRetentionSettings, onSearch, onRefresh, className, ...rest }, ref) {
|
|
793
816
|
const locale = useLocale(localeProp);
|
|
794
817
|
const rootRef = useRef(null);
|
|
795
818
|
const text = resolveFileTreeLabels(locale, labels);
|
|
@@ -847,6 +870,7 @@ const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, locale: loc
|
|
|
847
870
|
/*#__PURE__*/ jsx(FileTreeToolbar, {
|
|
848
871
|
search: search,
|
|
849
872
|
refresh: refresh,
|
|
873
|
+
loading: loading,
|
|
850
874
|
text: text,
|
|
851
875
|
refreshing: actions.refreshing,
|
|
852
876
|
onSearch: actions.onSearch,
|
|
@@ -869,4 +893,4 @@ const file_tree_FileTree = /*#__PURE__*/ forwardRef(function({ rows, locale: loc
|
|
|
869
893
|
]
|
|
870
894
|
});
|
|
871
895
|
});
|
|
872
|
-
export { DEFAULT_INFO_LABELS, FILE_TREE_ROW_ATTRIBUTE, FileTreeSpinner, file_tree_FileTree as FileTree, resolveFileTreeInfoKey, resolveInfoCopy, showsInlineDescription, splitVikingUri };
|
|
896
|
+
export { DEFAULT_INFO_LABELS, FILE_TREE_ROW_ATTRIBUTE, FileTreeSpinner, FileTreeToolbar, file_tree_FileTree as FileTree, resolveFileTreeInfoKey, resolveInfoCopy, showsInlineDescription, splitVikingUri };
|
package/dist/rt~0.js
CHANGED
|
@@ -1,7 +1,110 @@
|
|
|
1
|
+
import { cloneElement, useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
1
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement, useCallback, useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
|
|
4
|
+
const usePositionEffect = "u" < typeof window ? useEffect : useLayoutEffect;
|
|
5
|
+
const OVERLAY_OFFSET = 6;
|
|
6
|
+
const VIEWPORT_MARGIN = 8;
|
|
7
|
+
const OPPOSITE = {
|
|
8
|
+
top: 'bottom',
|
|
9
|
+
bottom: 'top',
|
|
10
|
+
left: 'right',
|
|
11
|
+
right: 'left'
|
|
12
|
+
};
|
|
13
|
+
function resolvePosition(trigger, surface, placement, alignment = 'center') {
|
|
14
|
+
const viewportWidth = window.innerWidth;
|
|
15
|
+
const viewportHeight = window.innerHeight;
|
|
16
|
+
const fits = (side)=>{
|
|
17
|
+
if ('top' === side) return trigger.top - surface.height - OVERLAY_OFFSET >= VIEWPORT_MARGIN;
|
|
18
|
+
if ('bottom' === side) return trigger.bottom + surface.height + OVERLAY_OFFSET <= viewportHeight - VIEWPORT_MARGIN;
|
|
19
|
+
if ('left' === side) return trigger.left - surface.width - OVERLAY_OFFSET >= VIEWPORT_MARGIN;
|
|
20
|
+
return trigger.right + surface.width + OVERLAY_OFFSET <= viewportWidth - VIEWPORT_MARGIN;
|
|
21
|
+
};
|
|
22
|
+
const side = fits(placement) || !fits(OPPOSITE[placement]) ? placement : OPPOSITE[placement];
|
|
23
|
+
const clamp = (value, size, limit)=>Math.min(Math.max(value, VIEWPORT_MARGIN), limit - size - VIEWPORT_MARGIN);
|
|
24
|
+
if ('top' === side || 'bottom' === side) {
|
|
25
|
+
const top = 'top' === side ? trigger.top - surface.height - OVERLAY_OFFSET : trigger.bottom + OVERLAY_OFFSET;
|
|
26
|
+
const left = 'end' === alignment ? trigger.right - surface.width : trigger.left + trigger.width / 2 - surface.width / 2;
|
|
27
|
+
return {
|
|
28
|
+
top: clamp(top, surface.height, viewportHeight),
|
|
29
|
+
left: clamp(left, surface.width, viewportWidth),
|
|
30
|
+
placement: side
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const left = 'left' === side ? trigger.left - surface.width - OVERLAY_OFFSET : trigger.right + OVERLAY_OFFSET;
|
|
34
|
+
const top = trigger.top + trigger.height / 2 - surface.height / 2;
|
|
35
|
+
return {
|
|
36
|
+
top: clamp(top, surface.height, viewportHeight),
|
|
37
|
+
left: clamp(left, surface.width, viewportWidth),
|
|
38
|
+
placement: side
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function useOverlayPosition(open, triggerRef, surface, placement, alignment = 'center') {
|
|
42
|
+
const [position, setPosition] = useState({
|
|
43
|
+
top: 0,
|
|
44
|
+
left: 0,
|
|
45
|
+
placement
|
|
46
|
+
});
|
|
47
|
+
usePositionEffect(()=>{
|
|
48
|
+
if (!open) return;
|
|
49
|
+
const trigger = triggerRef.current;
|
|
50
|
+
if (!trigger || !surface) return;
|
|
51
|
+
const written = new Set();
|
|
52
|
+
const syncTheme = ()=>{
|
|
53
|
+
const triggerStyle = window.getComputedStyle(trigger);
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
for (const name of Array.from(triggerStyle)){
|
|
56
|
+
if (!name.startsWith('--ov-ui-color-')) continue;
|
|
57
|
+
const value = triggerStyle.getPropertyValue(name).trim();
|
|
58
|
+
if (value) {
|
|
59
|
+
seen.add(name);
|
|
60
|
+
surface.style.setProperty(name, value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const name of written)if (!seen.has(name)) surface.style.removeProperty(name);
|
|
64
|
+
written.clear();
|
|
65
|
+
seen.forEach((name)=>written.add(name));
|
|
66
|
+
};
|
|
67
|
+
syncTheme();
|
|
68
|
+
const themeObserver = new MutationObserver(syncTheme);
|
|
69
|
+
const observerOptions = {
|
|
70
|
+
attributes: true,
|
|
71
|
+
attributeFilter: [
|
|
72
|
+
'class',
|
|
73
|
+
'style',
|
|
74
|
+
'data-theme'
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
for(let node = trigger; node; node = node.parentElement)themeObserver.observe(node, observerOptions);
|
|
78
|
+
const update = ()=>{
|
|
79
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
80
|
+
const surfaceRect = surface.getBoundingClientRect();
|
|
81
|
+
const next = resolvePosition(triggerRect, {
|
|
82
|
+
width: surfaceRect.width,
|
|
83
|
+
height: surfaceRect.height
|
|
84
|
+
}, placement, alignment);
|
|
85
|
+
setPosition((previous)=>previous.top === next.top && previous.left === next.left && previous.placement === next.placement ? previous : next);
|
|
86
|
+
};
|
|
87
|
+
update();
|
|
88
|
+
const observer = new ResizeObserver(update);
|
|
89
|
+
observer.observe(surface);
|
|
90
|
+
window.addEventListener('scroll', update, true);
|
|
91
|
+
window.addEventListener('resize', update);
|
|
92
|
+
return ()=>{
|
|
93
|
+
observer.disconnect();
|
|
94
|
+
themeObserver.disconnect();
|
|
95
|
+
written.forEach((name)=>surface.style.removeProperty(name));
|
|
96
|
+
window.removeEventListener('scroll', update, true);
|
|
97
|
+
window.removeEventListener('resize', update);
|
|
98
|
+
};
|
|
99
|
+
}, [
|
|
100
|
+
open,
|
|
101
|
+
placement,
|
|
102
|
+
surface,
|
|
103
|
+
triggerRef,
|
|
104
|
+
alignment
|
|
105
|
+
]);
|
|
106
|
+
return position;
|
|
107
|
+
}
|
|
5
108
|
const DEFAULT_LABELS = {
|
|
6
109
|
close: 'Close'
|
|
7
110
|
};
|
|
@@ -100,7 +203,7 @@ function Tooltip({ children, content, placement = 'top', trigger = 'hover', dela
|
|
|
100
203
|
const mergedRef = useMergedRef(childRef, triggerRef);
|
|
101
204
|
const triggerElement = /*#__PURE__*/ cloneElement(child, {
|
|
102
205
|
ref: mergedRef,
|
|
103
|
-
'aria-describedby': open && 'hover' === trigger ? id : void 0,
|
|
206
|
+
'aria-describedby': childProps['aria-describedby'] ?? (open && 'hover' === trigger && content !== childProps['aria-label'] ? id : void 0),
|
|
104
207
|
'aria-expanded': 'click' === trigger ? open : childProps['aria-expanded'],
|
|
105
208
|
onMouseEnter: (event)=>{
|
|
106
209
|
childProps.onMouseEnter?.(event);
|
|
@@ -149,4 +252,4 @@ function Tooltip({ children, content, placement = 'top', trigger = 'hover', dela
|
|
|
149
252
|
]
|
|
150
253
|
});
|
|
151
254
|
}
|
|
152
|
-
export { Tooltip };
|
|
255
|
+
export { Tooltip, useOverlayPosition };
|
package/dist/r~0.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, useCallback, useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
import { useOverlayPosition } from "./
|
|
4
|
+
import { useOverlayPosition } from "./rt~0.js";
|
|
5
5
|
function useMergedRef(ref, target) {
|
|
6
6
|
return useCallback((node)=>{
|
|
7
7
|
target.current = node;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from Arco Design Button (MIT), commit 4e087a0fe7d5ae2f222fbce4a9518ba047b01772.
|
|
3
|
+
* https://github.com/arco-design/arco-design/tree/4e087a0fe7d5ae2f222fbce4a9518ba047b01772/components/Button
|
|
4
|
+
* Copyright (c) 2021 Bytedance, Inc. and its affiliates. See LICENSE.arco-design.
|
|
5
|
+
* Keeps native events/ref, variants, sizes, icons and loading; omits links,
|
|
6
|
+
* groups, status palettes, Chinese-character spacing and ConfigProvider coupling.
|
|
7
|
+
* Visual rules come from the console's theme-ve-o-aml-design@0.0.36 skin.
|
|
8
|
+
*/
|
|
9
|
+
import { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
10
|
+
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
11
|
+
type?: 'default' | 'primary' | 'secondary' | 'outline' | 'text';
|
|
12
|
+
htmlType?: 'button' | 'submit' | 'reset';
|
|
13
|
+
size?: 'mini' | 'small' | 'default' | 'large';
|
|
14
|
+
shape?: 'square' | 'circle';
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
iconOnly?: boolean;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
long?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from Arco Design Input (MIT), commit 4e087a0fe7d5ae2f222fbce4a9518ba047b01772.
|
|
3
|
+
* https://github.com/arco-design/arco-design/tree/4e087a0fe7d5ae2f222fbce4a9518ba047b01772/components/Input
|
|
4
|
+
* Copyright (c) 2021 Bytedance, Inc. and its affiliates. See LICENSE.arco-design.
|
|
5
|
+
* Native value/events/ref and affixes only. No password toggles, groups, clear buttons,
|
|
6
|
+
* word counters, auto-width/auto-size, value truncation or ConfigProvider.
|
|
7
|
+
* Visual rules come from the console's theme-ve-o-aml-design@0.0.36 skin.
|
|
8
|
+
*/
|
|
9
|
+
import { type InputHTMLAttributes, type ReactNode, type TextareaHTMLAttributes } from 'react';
|
|
10
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
11
|
+
type?: 'text' | 'search' | 'email' | 'url' | 'tel' | 'password' | 'number';
|
|
12
|
+
size?: 'mini' | 'small' | 'default' | 'large';
|
|
13
|
+
prefix?: ReactNode;
|
|
14
|
+
suffix?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
17
|
+
export declare const TextArea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode, RefObject } from 'react';
|
|
2
|
+
import type { Locale } from '../../locale.js';
|
|
3
|
+
/** A controlled modal with the same overlay capabilities as the internal Drawer. */
|
|
4
|
+
export interface ModalProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Accessible name; render a visible heading inside children. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Theme anchor; focus returns to the element active when the modal opened. */
|
|
10
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
11
|
+
id?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
locale?: Locale;
|
|
14
|
+
/** Overrides the localized close button name, including an explicit empty string. */
|
|
15
|
+
closeLabel?: string;
|
|
16
|
+
/** Close intent from the mask, close button or Escape. The host controls open. */
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lockBodyScroll(body: HTMLElement): () => void;
|