@harborclient/sdk 1.1.6 → 1.1.9
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/Resizable/ResizeHandle.d.ts +7 -2
- package/dist/components/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/components/Resizable/ResizeHandle.js +6 -2
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +6 -1
- package/dist/components/SidebarItem/SidebarColorDot.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarColorDot.js +1 -1
- package/dist/components/SidebarItem/SidebarCommitItem.d.ts +7 -1
- package/dist/components/SidebarItem/SidebarCommitItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarCommitItem.js +4 -2
- package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts +12 -18
- package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarEnvironmentItem.js +17 -6
- package/dist/components/SidebarItem/SidebarFolderItem.d.ts +30 -4
- package/dist/components/SidebarItem/SidebarFolderItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarFolderItem.js +26 -5
- package/dist/components/SidebarItem/SidebarHistoryItem.d.ts +9 -5
- package/dist/components/SidebarItem/SidebarHistoryItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarHistoryItem.js +13 -4
- package/dist/components/SidebarItem/SidebarItem.d.ts +83 -3
- package/dist/components/SidebarItem/SidebarItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarItem.js +54 -4
- package/dist/components/SidebarItem/SidebarList.d.ts +30 -0
- package/dist/components/SidebarItem/SidebarList.d.ts.map +1 -0
- package/dist/components/SidebarItem/SidebarList.js +17 -0
- package/dist/components/SidebarItem/SidebarListbox.d.ts +35 -0
- package/dist/components/SidebarItem/SidebarListbox.d.ts.map +1 -0
- package/dist/components/SidebarItem/SidebarListbox.js +18 -0
- package/dist/components/SidebarItem/SidebarMethodBadge.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarMethodBadge.js +1 -1
- package/dist/components/SidebarItem/SidebarRequestItem.d.ts +16 -30
- package/dist/components/SidebarItem/SidebarRequestItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarRequestItem.js +21 -4
- package/dist/components/SidebarItem/SidebarRunItem.d.ts +11 -8
- package/dist/components/SidebarItem/SidebarRunItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarRunItem.js +12 -4
- package/dist/components/SidebarItem/SidebarStatusMarker.js +1 -1
- package/dist/components/SidebarItem/SidebarTabGroupItem.d.ts +7 -3
- package/dist/components/SidebarItem/SidebarTabGroupItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarTabGroupItem.js +8 -3
- package/dist/components/SidebarItem/SidebarTree.d.ts +55 -0
- package/dist/components/SidebarItem/SidebarTree.d.ts.map +1 -0
- package/dist/components/SidebarItem/SidebarTree.js +30 -0
- package/dist/components/SidebarItem/SortableSidebarItem.d.ts +24 -5
- package/dist/components/SidebarItem/SortableSidebarItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SortableSidebarItem.js +27 -13
- package/dist/components/SidebarItem/index.d.ts +5 -1
- package/dist/components/SidebarItem/index.d.ts.map +1 -1
- package/dist/components/SidebarItem/index.js +4 -0
- package/dist/components/SidebarItem/sidebarItemClasses.d.ts +4 -0
- package/dist/components/SidebarItem/sidebarItemClasses.d.ts.map +1 -1
- package/dist/components/SidebarItem/sidebarItemClasses.js +4 -0
- package/dist/components/SidebarItem/sidebarListOption.d.ts +6 -0
- package/dist/components/SidebarItem/sidebarListOption.d.ts.map +1 -0
- package/dist/components/SidebarItem/sidebarListOption.js +10 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/package.json +1 -1
|
@@ -2,16 +2,66 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@harborclient
|
|
|
2
2
|
import { cn } from '../utils.js';
|
|
3
3
|
import { SortableSidebarItem } from './SortableSidebarItem.js';
|
|
4
4
|
import { sourceRow } from './sidebarItemClasses.js';
|
|
5
|
+
import { handleSidebarOptionKeyDown } from './sidebarListOption.js';
|
|
5
6
|
import { stopSortableDragPointerDown } from './stopSortableDragPointerDown.js';
|
|
6
7
|
/**
|
|
7
8
|
* Base shell for sidebar list rows. Applies shared row chrome, optional sortable
|
|
8
|
-
* drag behavior, and a trailing actions slot suitable
|
|
9
|
+
* drag behavior via a leading grip handle, and a trailing actions slot suitable
|
|
10
|
+
* for future Sidebar layout reuse.
|
|
9
11
|
*/
|
|
10
|
-
export function SidebarItem({ selected = false, compact = true, sortable, onContextMenu, actions, actionsStopDrag = true, as: Container = 'div', className, children }) {
|
|
12
|
+
export function SidebarItem({ selected = false, compact = true, sortable, listboxOption, treeItem, onContextMenu, actions, actionsStopDrag = true, as: Container = 'div', className, children }) {
|
|
11
13
|
const rowClassName = cn('hc-sidebar-item', sourceRow(selected, compact), className);
|
|
12
14
|
const rowContent = (_jsxs(_Fragment, { children: [children, actions != null ? (_jsx("div", { className: "shrink-0", ...(actionsStopDrag ? { onPointerDown: stopSortableDragPointerDown } : {}), children: actions })) : null] }));
|
|
15
|
+
const listboxOptionProps = listboxOption != null
|
|
16
|
+
? {
|
|
17
|
+
role: 'option',
|
|
18
|
+
'aria-selected': selected ? 'true' : 'false',
|
|
19
|
+
...(listboxOption.ariaLabel != null ? { 'aria-label': listboxOption.ariaLabel } : {}),
|
|
20
|
+
tabIndex: listboxOption.tabIndex ?? (selected ? 0 : -1),
|
|
21
|
+
...(listboxOption.onClick != null ? { onClick: listboxOption.onClick } : {}),
|
|
22
|
+
...(listboxOption.onDoubleClick != null
|
|
23
|
+
? { onDoubleClick: listboxOption.onDoubleClick }
|
|
24
|
+
: {}),
|
|
25
|
+
onKeyDown: (event) => {
|
|
26
|
+
listboxOption.onKeyDown?.(event);
|
|
27
|
+
if (event.defaultPrevented) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
handleSidebarOptionKeyDown(event, () => {
|
|
31
|
+
listboxOption.onClick?.(event);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
: {};
|
|
36
|
+
const treeItemProps = treeItem != null
|
|
37
|
+
? {
|
|
38
|
+
role: 'treeitem',
|
|
39
|
+
'aria-selected': selected ? 'true' : 'false',
|
|
40
|
+
...(treeItem.ariaLabel != null ? { 'aria-label': treeItem.ariaLabel } : {}),
|
|
41
|
+
...(treeItem.expanded != null
|
|
42
|
+
? { 'aria-expanded': treeItem.expanded ? 'true' : 'false' }
|
|
43
|
+
: {}),
|
|
44
|
+
...(treeItem.controlsId != null ? { 'aria-controls': treeItem.controlsId } : {}),
|
|
45
|
+
...(treeItem.level != null ? { 'aria-level': treeItem.level } : {}),
|
|
46
|
+
...(treeItem.setSize != null ? { 'aria-setsize': treeItem.setSize } : {}),
|
|
47
|
+
...(treeItem.posInSet != null ? { 'aria-posinset': treeItem.posInSet } : {}),
|
|
48
|
+
tabIndex: treeItem.tabIndex ?? (selected ? 0 : -1),
|
|
49
|
+
...(treeItem.onClick != null ? { onClick: treeItem.onClick } : {}),
|
|
50
|
+
...(treeItem.onDoubleClick != null ? { onDoubleClick: treeItem.onDoubleClick } : {}),
|
|
51
|
+
onKeyDown: (event) => {
|
|
52
|
+
treeItem.onKeyDown?.(event);
|
|
53
|
+
if (event.defaultPrevented) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
handleSidebarOptionKeyDown(event, () => {
|
|
57
|
+
treeItem.onClick?.(event);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
: {};
|
|
62
|
+
const interactiveProps = listboxOption != null ? listboxOptionProps : treeItemProps;
|
|
13
63
|
if (sortable != null) {
|
|
14
|
-
return (_jsx(SortableSidebarItem, { id: sortable.id, className: rowClassName, dragHandleLabel: sortable.dragHandleLabel, disabled: sortable.disabled, onRowContextMenu: onContextMenu, children: rowContent }));
|
|
64
|
+
return (_jsx(SortableSidebarItem, { id: sortable.id, as: Container, className: rowClassName, dragHandleLabel: sortable.dragHandleLabel, disabled: sortable.disabled, onRowContextMenu: onContextMenu, ...interactiveProps, children: rowContent }));
|
|
15
65
|
}
|
|
16
|
-
return (_jsx(Container, { className: rowClassName, onContextMenu: onContextMenu, children: rowContent }));
|
|
66
|
+
return (_jsx(Container, { className: rowClassName, onContextMenu: onContextMenu, ...interactiveProps, children: rowContent }));
|
|
17
67
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* List rows. Each child should render as an `<li>` (e.g. {@link SidebarCommitItem} `as="li"`).
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Accessible name for the list when the section title is not sufficient.
|
|
9
|
+
*/
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Additional classes merged onto the list element.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Accessible list container for non-selectable sidebar rows.
|
|
18
|
+
*
|
|
19
|
+
* Wrap rows rendered with `as="li"` so each child is a `role="listitem"`.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <SidebarList aria-label="Commits">
|
|
24
|
+
* <SidebarCommitItem as="li" message="Fix auth" author="Alex" timestampLabel="2h ago" icon={faCodeBranch} />
|
|
25
|
+
* </SidebarList>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function SidebarList({ children, 'aria-label': ariaLabel, className }: Props): JSX.Element;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=SidebarList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarList.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,UAAU,KAAK;IACb;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAMhG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Accessible list container for non-selectable sidebar rows.
|
|
5
|
+
*
|
|
6
|
+
* Wrap rows rendered with `as="li"` so each child is a `role="listitem"`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <SidebarList aria-label="Commits">
|
|
11
|
+
* <SidebarCommitItem as="li" message="Fix auth" author="Alex" timestampLabel="2h ago" icon={faCodeBranch} />
|
|
12
|
+
* </SidebarList>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function SidebarList({ children, 'aria-label': ariaLabel, className }) {
|
|
16
|
+
return (_jsx("ul", { role: "list", "aria-label": ariaLabel, className: cn('m-0 list-none p-0', className), children: children }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* Listbox option rows. Each child should be a {@link SidebarItem} with `as="li"`.
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* When true, multiple options may be selected at once.
|
|
9
|
+
*/
|
|
10
|
+
multiselectable?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Accessible name for the listbox when the section title is not sufficient.
|
|
13
|
+
*/
|
|
14
|
+
'aria-label'?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Additional classes merged onto the listbox element.
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Accessible listbox container for flat sidebar item lists.
|
|
22
|
+
*
|
|
23
|
+
* Wrap rows rendered with {@link SidebarItem} `as="li"` and `listboxOption` so
|
|
24
|
+
* each row exposes `role="option"` and `aria-selected` correctly.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <SidebarListbox aria-label="Collections">
|
|
29
|
+
* <SidebarRequestItem as="li" name="List users" method="GET" />
|
|
30
|
+
* </SidebarListbox>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function SidebarListbox({ children, multiselectable, 'aria-label': ariaLabel, className }: Props): JSX.Element;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=SidebarListbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarListbox.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarListbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,UAAU,KAAK;IACb;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,eAAuB,EACvB,YAAY,EAAE,SAAS,EACvB,SAAS,EACV,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAWrB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Accessible listbox container for flat sidebar item lists.
|
|
5
|
+
*
|
|
6
|
+
* Wrap rows rendered with {@link SidebarItem} `as="li"` and `listboxOption` so
|
|
7
|
+
* each row exposes `role="option"` and `aria-selected` correctly.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <SidebarListbox aria-label="Collections">
|
|
12
|
+
* <SidebarRequestItem as="li" name="List users" method="GET" />
|
|
13
|
+
* </SidebarListbox>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export function SidebarListbox({ children, multiselectable = false, 'aria-label': ariaLabel, className }) {
|
|
17
|
+
return (_jsx("ul", { role: "listbox", "aria-multiselectable": multiselectable ? true : undefined, "aria-label": ariaLabel, className: cn('m-0 list-none p-0', className), children: children }));
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarMethodBadge.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarMethodBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,SAAiB,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"SidebarMethodBadge.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarMethodBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,SAAiB,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CASpF"}
|
|
@@ -7,5 +7,5 @@ import { METHOD_CLASSES } from './sidebarItemClasses.js';
|
|
|
7
7
|
export function SidebarMethodBadge({ method, uppercase = false }) {
|
|
8
8
|
const methodKey = method.toLowerCase();
|
|
9
9
|
const colorClass = METHOD_CLASSES[methodKey] ?? 'text-info';
|
|
10
|
-
return (_jsx("span", { className: cn('shrink-0 px-1 py-px', uppercase && 'font-medium uppercase', colorClass),
|
|
10
|
+
return (_jsx("span", { className: cn('shrink-0 px-1 py-px', uppercase && 'font-medium uppercase', colorClass), children: method }));
|
|
11
11
|
}
|
|
@@ -43,35 +43,27 @@ interface Props {
|
|
|
43
43
|
*/
|
|
44
44
|
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
45
45
|
/**
|
|
46
|
-
* Called when the primary label
|
|
46
|
+
* Called when the primary label area is activated.
|
|
47
47
|
*/
|
|
48
|
-
onClick?: (event: MouseEvent<
|
|
49
|
-
/**
|
|
50
|
-
* Accessible label for the primary button.
|
|
51
|
-
*/
|
|
52
|
-
ariaLabel?: string;
|
|
53
|
-
/**
|
|
54
|
-
* When true, sets aria-current="true" on the primary button.
|
|
55
|
-
*/
|
|
56
|
-
ariaCurrent?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* When true, sets aria-selected="true" on the primary button.
|
|
59
|
-
*/
|
|
60
|
-
ariaSelected?: boolean;
|
|
48
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
61
49
|
/**
|
|
62
50
|
* Trailing actions slot, typically a row actions menu.
|
|
63
51
|
*/
|
|
64
52
|
actions?: ReactNode;
|
|
65
53
|
/**
|
|
66
|
-
* HTML element for the row container
|
|
54
|
+
* HTML element for the row container. Use `li` inside {@link SidebarListbox}.
|
|
67
55
|
*/
|
|
68
56
|
as?: 'div' | 'li';
|
|
69
57
|
}
|
|
70
58
|
/**
|
|
71
59
|
* Renders a saved-request sidebar row with method badge, optional color dot or git
|
|
72
60
|
* status marker, and shared row chrome. Used in both Collections and Git sidebars.
|
|
61
|
+
*
|
|
62
|
+
* The accessible name is derived from visible row content (method, name, markers).
|
|
63
|
+
*
|
|
64
|
+
* Wrap lists in {@link SidebarListbox} and pass `as="li"` for valid listbox semantics.
|
|
73
65
|
*/
|
|
74
|
-
export declare function SidebarRequestItem({ method, name, nameClassName, colorDot, statusMarker, selected, sortable, onContextMenu, onClick,
|
|
66
|
+
export declare function SidebarRequestItem({ method, name, nameClassName, colorDot, statusMarker, selected, sortable, onContextMenu, onClick, actions, as }: Props): JSX.Element;
|
|
75
67
|
interface DocumentProps {
|
|
76
68
|
/**
|
|
77
69
|
* Icon shown before the document name. Defaults to a file-lines icon when omitted.
|
|
@@ -110,34 +102,28 @@ interface DocumentProps {
|
|
|
110
102
|
*/
|
|
111
103
|
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
112
104
|
/**
|
|
113
|
-
* Called when the primary label
|
|
114
|
-
*/
|
|
115
|
-
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
116
|
-
/**
|
|
117
|
-
* Called when the primary label button is double-clicked.
|
|
118
|
-
*/
|
|
119
|
-
onDoubleClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
120
|
-
/**
|
|
121
|
-
* Accessible label for the primary button.
|
|
105
|
+
* Called when the primary label area is activated.
|
|
122
106
|
*/
|
|
123
|
-
|
|
107
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
124
108
|
/**
|
|
125
|
-
*
|
|
109
|
+
* Called when the primary label area is double-clicked.
|
|
126
110
|
*/
|
|
127
|
-
|
|
111
|
+
onDoubleClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
128
112
|
/**
|
|
129
113
|
* Trailing actions slot, typically a row actions menu.
|
|
130
114
|
*/
|
|
131
115
|
actions?: ReactNode;
|
|
132
116
|
/**
|
|
133
|
-
* HTML element for the row container.
|
|
117
|
+
* HTML element for the row container. Use `li` inside {@link SidebarListbox}.
|
|
134
118
|
*/
|
|
135
119
|
as?: 'div' | 'li';
|
|
136
120
|
}
|
|
137
121
|
/**
|
|
138
122
|
* Renders a markdown document sidebar row with file icon, optional color dot or git
|
|
139
123
|
* status marker, and shared row chrome. Used in both Collections and Git sidebars.
|
|
124
|
+
*
|
|
125
|
+
* The accessible name is derived from visible row content (name, markers).
|
|
140
126
|
*/
|
|
141
|
-
export declare function SidebarDocumentItem({ icon, name, nameClassName, colorDot, statusMarker, selected, onContextMenu, onClick, onDoubleClick,
|
|
127
|
+
export declare function SidebarDocumentItem({ icon, name, nameClassName, colorDot, statusMarker, selected, onContextMenu, onClick, onDoubleClick, actions, as }: DocumentProps): JSX.Element;
|
|
142
128
|
export {};
|
|
143
129
|
//# sourceMappingURL=SidebarRequestItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarRequestItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarRequestItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAK/E,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;QACjC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF;;OAEG;IACH,YAAY,CAAC,EAAE;QACb,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAErC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAEzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"SidebarRequestItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarRequestItem.tsx"],"names":[],"mappings":"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"}
|
|
@@ -9,14 +9,31 @@ import { SIDEBAR_ITEM_BUTTON_CLASS } from './sidebarItemClasses.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* Renders a saved-request sidebar row with method badge, optional color dot or git
|
|
11
11
|
* status marker, and shared row chrome. Used in both Collections and Git sidebars.
|
|
12
|
+
*
|
|
13
|
+
* The accessible name is derived from visible row content (method, name, markers).
|
|
14
|
+
*
|
|
15
|
+
* Wrap lists in {@link SidebarListbox} and pass `as="li"` for valid listbox semantics.
|
|
12
16
|
*/
|
|
13
|
-
export function SidebarRequestItem({ method, name, nameClassName, colorDot, statusMarker, selected = false, sortable, onContextMenu, onClick,
|
|
14
|
-
|
|
17
|
+
export function SidebarRequestItem({ method, name, nameClassName, colorDot, statusMarker, selected = false, sortable, onContextMenu, onClick, actions, as = 'li' }) {
|
|
18
|
+
const useListboxOption = as === 'li';
|
|
19
|
+
return (_jsx(SidebarItem, { selected: selected, sortable: sortable, onContextMenu: onContextMenu, actions: actions, as: as, listboxOption: useListboxOption
|
|
20
|
+
? {
|
|
21
|
+
onClick
|
|
22
|
+
}
|
|
23
|
+
: undefined, children: _jsxs("span", { className: SIDEBAR_ITEM_BUTTON_CLASS, children: [_jsx(SidebarMethodBadge, { method: method }), colorDot != null ? (_jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: `min-w-0 truncate ${nameClassName ?? ''}`, children: name }), _jsx(SidebarColorDot, { color: colorDot.color, visible: colorDot.visible, label: colorDot.label })] })) : (_jsx("span", { className: `min-w-0 truncate ${nameClassName ?? ''}`, children: name })), statusMarker != null ? (_jsx(SidebarStatusMarker, { marker: statusMarker.marker, className: statusMarker.className, label: statusMarker.label })) : null] }) }));
|
|
15
24
|
}
|
|
16
25
|
/**
|
|
17
26
|
* Renders a markdown document sidebar row with file icon, optional color dot or git
|
|
18
27
|
* status marker, and shared row chrome. Used in both Collections and Git sidebars.
|
|
28
|
+
*
|
|
29
|
+
* The accessible name is derived from visible row content (name, markers).
|
|
19
30
|
*/
|
|
20
|
-
export function SidebarDocumentItem({ icon = faFileLines, name, nameClassName, colorDot, statusMarker, selected = false, onContextMenu, onClick, onDoubleClick,
|
|
21
|
-
|
|
31
|
+
export function SidebarDocumentItem({ icon = faFileLines, name, nameClassName, colorDot, statusMarker, selected = false, onContextMenu, onClick, onDoubleClick, actions, as = 'li' }) {
|
|
32
|
+
const useListboxOption = as === 'li';
|
|
33
|
+
return (_jsx(SidebarItem, { selected: selected, onContextMenu: onContextMenu, actions: actions, as: as, listboxOption: useListboxOption
|
|
34
|
+
? {
|
|
35
|
+
onClick,
|
|
36
|
+
onDoubleClick
|
|
37
|
+
}
|
|
38
|
+
: undefined, children: _jsxs("span", { className: SIDEBAR_ITEM_BUTTON_CLASS, children: [_jsx(FaIcon, { icon: icon, className: "h-3.5 w-3.5 shrink-0 text-muted", "aria-hidden": true }), colorDot != null ? (_jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: `min-w-0 truncate ${nameClassName ?? ''}`, children: name }), _jsx(SidebarColorDot, { color: colorDot.color, visible: colorDot.visible, label: colorDot.label })] })) : (_jsx("span", { className: `min-w-0 truncate ${nameClassName ?? ''}`, children: name })), statusMarker != null ? (_jsx(SidebarStatusMarker, { marker: statusMarker.marker, className: statusMarker.className, label: statusMarker.label })) : null] }) }));
|
|
22
39
|
}
|
|
@@ -25,21 +25,17 @@ interface Props {
|
|
|
25
25
|
*/
|
|
26
26
|
selected?: boolean;
|
|
27
27
|
/**
|
|
28
|
-
* Tooltip title for the primary
|
|
28
|
+
* Tooltip title for the primary label area.
|
|
29
29
|
*/
|
|
30
30
|
title?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Accessible label for the primary button.
|
|
33
|
-
*/
|
|
34
|
-
ariaLabel: string;
|
|
35
31
|
/**
|
|
36
32
|
* Called when the user right-clicks the row container.
|
|
37
33
|
*/
|
|
38
34
|
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
39
35
|
/**
|
|
40
|
-
* Called when the primary row
|
|
36
|
+
* Called when the primary row area is activated.
|
|
41
37
|
*/
|
|
42
|
-
onClick?: (event: MouseEvent<
|
|
38
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
43
39
|
/**
|
|
44
40
|
* Trailing actions slot, typically a row actions menu.
|
|
45
41
|
*/
|
|
@@ -48,10 +44,17 @@ interface Props {
|
|
|
48
44
|
* Optional data attribute value for keyboard navigation focus targets.
|
|
49
45
|
*/
|
|
50
46
|
dataSidebarRunResultId?: string | number;
|
|
47
|
+
/**
|
|
48
|
+
* HTML element for the row container. Use `li` inside {@link SidebarListbox}.
|
|
49
|
+
*/
|
|
50
|
+
as?: 'div' | 'li';
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Renders a saved run result row in the Collections sidebar Runs section.
|
|
54
|
+
*
|
|
55
|
+
* The accessible name is derived from visible row content (method, label, connection badge,
|
|
56
|
+
* status summary).
|
|
54
57
|
*/
|
|
55
|
-
export declare function SidebarRunItem({ method, label, connectionBadge, statusDotClassName, statusSummary, selected, title,
|
|
58
|
+
export declare function SidebarRunItem({ method, label, connectionBadge, statusDotClassName, statusSummary, selected, title, onContextMenu, onClick, actions, dataSidebarRunResultId, as }: Props): JSX.Element;
|
|
56
59
|
export {};
|
|
57
60
|
//# sourceMappingURL=SidebarRunItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarRunItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarRunItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMxD,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"SidebarRunItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarRunItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMxD,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAEzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAEnD;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzC;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,QAAgB,EAChB,KAAK,EACL,aAAa,EACb,OAAO,EACP,OAAO,EACP,sBAAsB,EACtB,EAAS,EACV,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAwCrB"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
-
import { Button } from '../Button/index.js';
|
|
3
2
|
import { SidebarItem } from './SidebarItem.js';
|
|
4
3
|
import { SidebarMethodBadge } from './SidebarMethodBadge.js';
|
|
5
4
|
import { SidebarStatusDot } from './SidebarStatusDot.js';
|
|
5
|
+
import { SIDEBAR_ITEM_BUTTON_CLASS } from './sidebarItemClasses.js';
|
|
6
6
|
/**
|
|
7
7
|
* Renders a saved run result row in the Collections sidebar Runs section.
|
|
8
|
+
*
|
|
9
|
+
* The accessible name is derived from visible row content (method, label, connection badge,
|
|
10
|
+
* status summary).
|
|
8
11
|
*/
|
|
9
|
-
export function SidebarRunItem({ method, label, connectionBadge, statusDotClassName, statusSummary, selected = false, title,
|
|
10
|
-
|
|
12
|
+
export function SidebarRunItem({ method, label, connectionBadge, statusDotClassName, statusSummary, selected = false, title, onContextMenu, onClick, actions, dataSidebarRunResultId, as = 'li' }) {
|
|
13
|
+
const useListboxOption = as === 'li';
|
|
14
|
+
return (_jsx(SidebarItem, { selected: selected, onContextMenu: onContextMenu, actions: actions, as: as, listboxOption: useListboxOption
|
|
15
|
+
? {
|
|
16
|
+
onClick
|
|
17
|
+
}
|
|
18
|
+
: undefined, children: _jsxs("span", { className: `${SIDEBAR_ITEM_BUTTON_CLASS} py-0.5`, title: title, ...(dataSidebarRunResultId != null
|
|
11
19
|
? { 'data-sidebar-run-result-id': String(dataSidebarRunResultId) }
|
|
12
|
-
: {}),
|
|
20
|
+
: {}), children: [method != null && method !== '' ? _jsx(SidebarMethodBadge, { method: method, uppercase: true }) : null, _jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-1.5", children: [_jsx("span", { className: "min-w-0 truncate text-text", children: label }), connectionBadge != null ? (_jsx("span", { className: "shrink-0 rounded bg-info/15 px-1.5 py-0.5 text-[14px] font-medium text-info", title: `Stored in ${connectionBadge}`, children: connectionBadge })) : null] }), _jsx(SidebarStatusDot, { className: statusDotClassName, srOnlyLabel: statusSummary })] }) }));
|
|
13
21
|
}
|
|
@@ -4,5 +4,5 @@ import { cn } from '../utils.js';
|
|
|
4
4
|
* Renders a git change status marker in square brackets after a file name.
|
|
5
5
|
*/
|
|
6
6
|
export function SidebarStatusMarker({ marker, className, label }) {
|
|
7
|
-
return (_jsxs("span", { className: cn('shrink-0', className), title: label, "aria-label": label, children: ["[", marker, "]"] }));
|
|
7
|
+
return (_jsxs("span", { className: cn('shrink-0', className), role: "img", title: label, "aria-label": label, children: ["[", marker, "]"] }));
|
|
8
8
|
}
|
|
@@ -35,17 +35,21 @@ interface Props {
|
|
|
35
35
|
*/
|
|
36
36
|
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
37
37
|
/**
|
|
38
|
-
* Called when the primary row
|
|
38
|
+
* Called when the primary row area is activated.
|
|
39
39
|
*/
|
|
40
|
-
onClick?: (event: MouseEvent<
|
|
40
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
41
41
|
/**
|
|
42
42
|
* Trailing actions slot, typically a row actions menu.
|
|
43
43
|
*/
|
|
44
44
|
actions?: ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* HTML element for the row container. Use `li` inside {@link SidebarListbox}.
|
|
47
|
+
*/
|
|
48
|
+
as?: 'div' | 'li';
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
47
51
|
* Renders a tab group row in the Collections sidebar Tab Groups section.
|
|
48
52
|
*/
|
|
49
|
-
export declare function SidebarTabGroupItem({ name, summary, icon, colorDot, selected, sortable, onContextMenu, onClick, actions }: Props): JSX.Element;
|
|
53
|
+
export declare function SidebarTabGroupItem({ name, summary, icon, colorDot, selected, sortable, onContextMenu, onClick, actions, as }: Props): JSX.Element;
|
|
50
54
|
export {};
|
|
51
55
|
//# sourceMappingURL=SidebarTabGroupItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarTabGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarTabGroupItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SidebarTabGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarTabGroupItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG/E,UAAU,KAAK;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,EAAE,cAAc,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;QACjC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAErC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAEzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAEnD;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,QAAgB,EAChB,QAAQ,EACR,aAAa,EACb,OAAO,EACP,OAAO,EACP,EAAS,EACV,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAkCrB"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
-
import { Button } from '../Button/index.js';
|
|
3
2
|
import { FaIcon } from '../FaIcon/index.js';
|
|
4
3
|
import { SidebarColorDot } from './SidebarColorDot.js';
|
|
5
4
|
import { SidebarItem } from './SidebarItem.js';
|
|
5
|
+
import { SIDEBAR_ITEM_BUTTON_CLASS } from './sidebarItemClasses.js';
|
|
6
6
|
/**
|
|
7
7
|
* Renders a tab group row in the Collections sidebar Tab Groups section.
|
|
8
8
|
*/
|
|
9
|
-
export function SidebarTabGroupItem({ name, summary, icon, colorDot, selected = false, sortable, onContextMenu, onClick, actions }) {
|
|
10
|
-
|
|
9
|
+
export function SidebarTabGroupItem({ name, summary, icon, colorDot, selected = false, sortable, onContextMenu, onClick, actions, as = 'li' }) {
|
|
10
|
+
const useListboxOption = as === 'li';
|
|
11
|
+
return (_jsx(SidebarItem, { selected: selected, sortable: sortable, onContextMenu: onContextMenu, actions: actions, as: as, listboxOption: useListboxOption
|
|
12
|
+
? {
|
|
13
|
+
onClick
|
|
14
|
+
}
|
|
15
|
+
: undefined, children: _jsxs("span", { className: `${SIDEBAR_ITEM_BUTTON_CLASS} gap-2 rounded-md px-2 py-1`, children: [_jsx(FaIcon, { icon: icon, className: "h-3.5 w-3.5 shrink-0 text-muted", "aria-hidden": true }), _jsxs("span", { className: "inline-flex min-w-0 flex-1 items-center gap-1.5", children: [_jsx("span", { className: "min-w-0 truncate", children: name }), colorDot != null ? (_jsx(SidebarColorDot, { color: colorDot.color, visible: colorDot.visible, label: colorDot.label })) : null] }), _jsx("span", { className: "shrink-0 text-muted", children: summary })] }) }));
|
|
11
16
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
interface TreeProps {
|
|
3
|
+
/**
|
|
4
|
+
* Tree rows. Each child should be a {@link SidebarFolderItem} with `as="li"`.
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Accessible name for the tree when the section title is not sufficient.
|
|
9
|
+
*/
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Additional classes merged onto the tree element.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Accessible tree container for nested sidebar folder hierarchies.
|
|
18
|
+
*
|
|
19
|
+
* Wrap folder rows rendered with {@link SidebarFolderItem} `as="li"` and
|
|
20
|
+
* `treeItem` so each row exposes `role="treeitem"` with expand/collapse state.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <SidebarTree aria-label="Collections">
|
|
25
|
+
* <SidebarFolderItem as="li" name="Auth" expanded childrenId="auth-children" />
|
|
26
|
+
* <SidebarTreeGroup id="auth-children">
|
|
27
|
+
* <SidebarRequestItem as="li" name="Login" method="POST" />
|
|
28
|
+
* </SidebarTreeGroup>
|
|
29
|
+
* </SidebarTree>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function SidebarTree({ children, 'aria-label': ariaLabel, className }: TreeProps): JSX.Element;
|
|
33
|
+
interface TreeGroupProps {
|
|
34
|
+
/**
|
|
35
|
+
* Child tree rows or nested groups.
|
|
36
|
+
*/
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Stable id referenced by the parent treeitem's `aria-controls`.
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
/**
|
|
43
|
+
* Additional classes merged onto the group element.
|
|
44
|
+
*/
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Child region for an expanded folder treeitem.
|
|
49
|
+
*
|
|
50
|
+
* Renders `role="group"` and must use the same `id` passed to the parent
|
|
51
|
+
* folder's `childrenId` / `aria-controls`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function SidebarTreeGroup({ children, id, className }: TreeGroupProps): JSX.Element;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=SidebarTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarTree.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,UAAU,SAAS;IACjB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,SAAS,EACV,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAMzB;AAED,UAAU,cAAc;IACtB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAMzF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Accessible tree container for nested sidebar folder hierarchies.
|
|
5
|
+
*
|
|
6
|
+
* Wrap folder rows rendered with {@link SidebarFolderItem} `as="li"` and
|
|
7
|
+
* `treeItem` so each row exposes `role="treeitem"` with expand/collapse state.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <SidebarTree aria-label="Collections">
|
|
12
|
+
* <SidebarFolderItem as="li" name="Auth" expanded childrenId="auth-children" />
|
|
13
|
+
* <SidebarTreeGroup id="auth-children">
|
|
14
|
+
* <SidebarRequestItem as="li" name="Login" method="POST" />
|
|
15
|
+
* </SidebarTreeGroup>
|
|
16
|
+
* </SidebarTree>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function SidebarTree({ children, 'aria-label': ariaLabel, className }) {
|
|
20
|
+
return (_jsx("ul", { role: "tree", "aria-label": ariaLabel, className: cn('m-0 list-none p-0', className), children: children }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Child region for an expanded folder treeitem.
|
|
24
|
+
*
|
|
25
|
+
* Renders `role="group"` and must use the same `id` passed to the parent
|
|
26
|
+
* folder's `childrenId` / `aria-controls`.
|
|
27
|
+
*/
|
|
28
|
+
export function SidebarTreeGroup({ children, id, className }) {
|
|
29
|
+
return (_jsx("ul", { role: "group", id: id, className: cn('m-0 list-none p-0', className), children: children }));
|
|
30
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { JSX, MouseEvent, ReactNode } from 'react';
|
|
1
|
+
import type { JSX, KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
interface Props {
|
|
3
3
|
/**
|
|
4
4
|
* Stable dnd-kit sortable id for this row.
|
|
5
5
|
*/
|
|
6
6
|
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Row container element.
|
|
9
|
+
*/
|
|
10
|
+
as?: 'div' | 'li';
|
|
7
11
|
/**
|
|
8
12
|
* Row container class names.
|
|
9
13
|
*/
|
|
@@ -24,12 +28,27 @@ interface Props {
|
|
|
24
28
|
* Called when the user right-clicks the row container.
|
|
25
29
|
*/
|
|
26
30
|
onRowContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Optional listbox option or treeitem attributes forwarded from {@link SidebarItem}.
|
|
33
|
+
*/
|
|
34
|
+
role?: 'option' | 'treeitem';
|
|
35
|
+
'aria-selected'?: 'true' | 'false';
|
|
36
|
+
'aria-label'?: string;
|
|
37
|
+
'aria-expanded'?: 'true' | 'false';
|
|
38
|
+
'aria-controls'?: string;
|
|
39
|
+
'aria-level'?: number;
|
|
40
|
+
'aria-setsize'?: number;
|
|
41
|
+
'aria-posinset'?: number;
|
|
42
|
+
tabIndex?: number;
|
|
43
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
44
|
+
onDoubleClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
45
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
27
46
|
}
|
|
28
47
|
/**
|
|
29
|
-
* Wraps a sidebar row with dnd-kit sortable drag behavior.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
48
|
+
* Wraps a sidebar row with dnd-kit sortable drag behavior. Reordering is activated
|
|
49
|
+
* from a dedicated grip handle so keyboard users can focus it and use the keyboard
|
|
50
|
+
* sensor; listbox option interaction and nested row controls stay on the row container.
|
|
32
51
|
*/
|
|
33
|
-
export declare function SortableSidebarItem({ id, className, dragHandleLabel, children, disabled, onRowContextMenu }: Props): JSX.Element;
|
|
52
|
+
export declare function SortableSidebarItem({ id, as: Container, className, dragHandleLabel, children, disabled, onRowContextMenu, role, 'aria-selected': ariaSelected, 'aria-label': ariaLabel, 'aria-expanded': ariaExpanded, 'aria-controls': ariaControls, 'aria-level': ariaLevel, 'aria-setsize': ariaSetSize, 'aria-posinset': ariaPosInSet, tabIndex, onClick, onDoubleClick, onKeyDown }: Props): JSX.Element;
|
|
34
53
|
export {};
|
|
35
54
|
//# sourceMappingURL=SortableSidebarItem.d.ts.map
|