@harborclient/sdk 1.0.29 → 1.0.30
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/build/index.d.ts.map +1 -1
- package/dist/build/index.js +1 -1
- package/dist/components/AsyncListState/ErrorRetry.d.ts +21 -0
- package/dist/components/AsyncListState/ErrorRetry.d.ts.map +1 -0
- package/dist/components/AsyncListState/ErrorRetry.js +10 -0
- package/dist/components/AsyncListState/LoadingMessage.d.ts +13 -0
- package/dist/components/AsyncListState/LoadingMessage.d.ts.map +1 -0
- package/dist/components/AsyncListState/LoadingMessage.js +8 -0
- package/dist/components/AsyncListState/index.d.ts +4 -50
- package/dist/components/AsyncListState/index.d.ts.map +1 -1
- package/dist/components/AsyncListState/index.js +5 -31
- package/dist/components/Autocomplete/AutocompleteInput.d.ts +2 -4
- package/dist/components/Autocomplete/AutocompleteInput.d.ts.map +1 -1
- package/dist/components/Autocomplete/AutocompleteInput.js +2 -1
- package/dist/components/Autocomplete/SuggestionList.d.ts +3 -7
- package/dist/components/Autocomplete/SuggestionList.d.ts.map +1 -1
- package/dist/components/Autocomplete/SuggestionList.js +3 -4
- package/dist/components/BackButton/index.d.ts +3 -16
- package/dist/components/BackButton/index.d.ts.map +1 -1
- package/dist/components/BackButton/index.js +4 -10
- package/dist/components/Badge/index.d.ts +3 -11
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +3 -9
- package/dist/components/BusyIndicator/index.js +1 -1
- package/dist/components/Button/index.d.ts +2 -6
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +9 -15
- package/dist/components/Card/Body.d.ts +12 -0
- package/dist/components/Card/Body.d.ts.map +1 -0
- package/dist/components/Card/Body.js +8 -0
- package/dist/components/Card/Image.d.ts +8 -0
- package/dist/components/Card/Image.d.ts.map +1 -0
- package/dist/components/Card/Image.js +8 -0
- package/dist/components/Card/index.d.ts +16 -0
- package/dist/components/Card/index.d.ts.map +1 -0
- package/dist/components/Card/index.js +13 -0
- package/dist/components/CodeEditor/index.d.ts +3 -7
- package/dist/components/CodeEditor/index.d.ts.map +1 -1
- package/dist/components/CodeEditor/index.js +5 -50
- package/dist/components/CodeEditor/renderHighlightedPlaceholder.d.ts.map +1 -1
- package/dist/components/CodeEditor/slashCommandHighlighter.d.ts.map +1 -1
- package/dist/components/CodeEditor/syntaxHighlightedPlaceholder.d.ts.map +1 -1
- package/dist/components/EmptyState/index.d.ts +3 -11
- package/dist/components/EmptyState/index.d.ts.map +1 -1
- package/dist/components/EmptyState/index.js +3 -9
- package/dist/components/FaIcon/index.d.ts +3 -10
- package/dist/components/FaIcon/index.d.ts.map +1 -1
- package/dist/components/FaIcon/index.js +5 -4
- package/dist/components/FieldError/index.d.ts +3 -17
- package/dist/components/FieldError/index.d.ts.map +1 -1
- package/dist/components/FieldError/index.js +3 -11
- package/dist/components/FooterButton/index.d.ts +3 -11
- package/dist/components/FooterButton/index.d.ts.map +1 -1
- package/dist/components/FooterButton/index.js +3 -7
- package/dist/components/FooterIcon/index.d.ts +3 -11
- package/dist/components/FooterIcon/index.d.ts.map +1 -1
- package/dist/components/FooterIcon/index.js +3 -7
- package/dist/components/FormDataEditor/index.d.ts +0 -2
- package/dist/components/FormDataEditor/index.d.ts.map +1 -1
- package/dist/components/FormDataEditor/index.js +2 -12
- package/dist/components/FormGroup/index.d.ts +3 -16
- package/dist/components/FormGroup/index.d.ts.map +1 -1
- package/dist/components/FormGroup/index.js +4 -20
- package/dist/components/KeyValueEditor/index.d.ts +0 -2
- package/dist/components/KeyValueEditor/index.d.ts.map +1 -1
- package/dist/components/KeyValueEditor/index.js +1 -8
- package/dist/components/MethodSelect/index.d.ts +3 -5
- package/dist/components/MethodSelect/index.d.ts.map +1 -1
- package/dist/components/MethodSelect/index.js +3 -2
- package/dist/components/Modal/ModalFooter.d.ts +3 -11
- package/dist/components/Modal/ModalFooter.d.ts.map +1 -1
- package/dist/components/Modal/ModalFooter.js +3 -10
- package/dist/components/Modal/ModalFormLayout.d.ts +0 -5
- package/dist/components/Modal/ModalFormLayout.d.ts.map +1 -1
- package/dist/components/Modal/ModalFormLayout.js +0 -5
- package/dist/components/Modal/ModalHeader.d.ts +3 -3
- package/dist/components/Modal/ModalHeader.d.ts.map +1 -1
- package/dist/components/Modal/ModalHeader.js +3 -2
- package/dist/components/Modal/index.d.ts +3 -3
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +6 -7
- package/dist/components/OverlayCloseButton/index.d.ts +3 -11
- package/dist/components/OverlayCloseButton/index.d.ts.map +1 -1
- package/dist/components/OverlayCloseButton/index.js +3 -9
- package/dist/components/Page/index.d.ts +3 -3
- package/dist/components/Page/index.d.ts.map +1 -1
- package/dist/components/Page/index.js +4 -7
- package/dist/components/PageHeader/index.d.ts +3 -7
- package/dist/components/PageHeader/index.d.ts.map +1 -1
- package/dist/components/PageHeader/index.js +3 -5
- package/dist/components/PageSidebar/index.d.ts +3 -5
- package/dist/components/PageSidebar/index.d.ts.map +1 -1
- package/dist/components/PageSidebar/index.js +4 -5
- package/dist/components/PanelCloseButton/index.d.ts +5 -14
- package/dist/components/PanelCloseButton/index.d.ts.map +1 -1
- package/dist/components/PanelCloseButton/index.js +4 -12
- package/dist/components/Resizable/Resizable.d.ts +3 -3
- package/dist/components/Resizable/Resizable.d.ts.map +1 -1
- package/dist/components/Resizable/Resizable.js +6 -5
- package/dist/components/Resizable/ResizeHandle.d.ts +3 -7
- package/dist/components/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/components/Resizable/ResizeHandle.js +4 -10
- package/dist/components/ResourceList/ResourceListEmptyItem.d.ts +13 -0
- package/dist/components/ResourceList/ResourceListEmptyItem.d.ts.map +1 -0
- package/dist/components/ResourceList/ResourceListEmptyItem.js +8 -0
- package/dist/components/ResourceList/ResourceListPrimary.d.ts +13 -0
- package/dist/components/ResourceList/ResourceListPrimary.d.ts.map +1 -0
- package/dist/components/ResourceList/ResourceListPrimary.js +8 -0
- package/dist/components/ResourceList/ResourceListRow.d.ts +29 -0
- package/dist/components/ResourceList/ResourceListRow.d.ts.map +1 -0
- package/dist/components/ResourceList/ResourceListRow.js +8 -0
- package/dist/components/ResourceList/index.d.ts +6 -74
- package/dist/components/ResourceList/index.d.ts.map +1 -1
- package/dist/components/ResourceList/index.js +7 -42
- package/dist/components/RowActionsMenu/index.d.ts +3 -5
- package/dist/components/RowActionsMenu/index.d.ts.map +1 -1
- package/dist/components/RowActionsMenu/index.js +6 -16
- package/dist/components/SegmentedTabs/SegmentedTabPanel.d.ts +3 -7
- package/dist/components/SegmentedTabs/SegmentedTabPanel.d.ts.map +1 -1
- package/dist/components/SegmentedTabs/SegmentedTabPanel.js +3 -4
- package/dist/components/SegmentedTabs/SegmentedTabsGroup.d.ts +0 -2
- package/dist/components/SegmentedTabs/SegmentedTabsGroup.d.ts.map +1 -1
- package/dist/components/SegmentedTabs/SegmentedTabsVisibilityMenu.d.ts +0 -2
- package/dist/components/SegmentedTabs/SegmentedTabsVisibilityMenu.d.ts.map +1 -1
- package/dist/components/SegmentedTabs/SegmentedTabsVisibilityMenu.js +5 -13
- package/dist/components/SegmentedTabs/index.d.ts +3 -7
- package/dist/components/SegmentedTabs/index.d.ts.map +1 -1
- package/dist/components/SegmentedTabs/index.js +7 -28
- package/dist/components/SidebarLayout/index.d.ts +3 -7
- package/dist/components/SidebarLayout/index.d.ts.map +1 -1
- package/dist/components/SidebarLayout/index.js +3 -5
- package/dist/components/Spinner/index.d.ts +3 -11
- package/dist/components/Spinner/index.d.ts.map +1 -1
- package/dist/components/Spinner/index.js +3 -9
- package/dist/components/StatusMessage/index.d.ts +3 -15
- package/dist/components/StatusMessage/index.d.ts.map +1 -1
- package/dist/components/StatusMessage/index.js +3 -8
- package/dist/components/TabCloseButton/index.d.ts +4 -14
- package/dist/components/TabCloseButton/index.d.ts.map +1 -1
- package/dist/components/TabCloseButton/index.js +3 -7
- package/dist/components/Table/TableBody.d.ts +13 -0
- package/dist/components/Table/TableBody.d.ts.map +1 -0
- package/dist/components/Table/TableBody.js +11 -0
- package/dist/components/Table/TableCell.d.ts +8 -0
- package/dist/components/Table/TableCell.d.ts.map +1 -0
- package/dist/components/Table/TableCell.js +11 -0
- package/dist/components/Table/TableContext.d.ts +22 -0
- package/dist/components/Table/TableContext.d.ts.map +1 -0
- package/dist/components/Table/TableContext.js +18 -0
- package/dist/components/Table/TableHead.d.ts +8 -0
- package/dist/components/Table/TableHead.d.ts.map +1 -0
- package/dist/components/Table/TableHead.js +11 -0
- package/dist/components/Table/TableHeader.d.ts +13 -0
- package/dist/components/Table/TableHeader.d.ts.map +1 -0
- package/dist/components/Table/TableHeader.js +8 -0
- package/dist/components/Table/index.d.ts +10 -86
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +17 -94
- package/dist/components/Toolbar/index.d.ts +3 -11
- package/dist/components/Toolbar/index.d.ts.map +1 -1
- package/dist/components/Toolbar/index.js +3 -11
- package/dist/components/VariableInput/index.d.ts +3 -5
- package/dist/components/VariableInput/index.d.ts.map +1 -1
- package/dist/components/VariableInput/index.js +6 -17
- package/dist/components/VariableTable/index.d.ts +3 -3
- package/dist/components/VariableTable/index.d.ts.map +1 -1
- package/dist/components/VariableTable/index.js +5 -9
- package/dist/components/forms/Checkbox.d.ts +2 -2
- package/dist/components/forms/Checkbox.d.ts.map +1 -1
- package/dist/components/forms/Checkbox.js +2 -4
- package/dist/components/forms/Input.d.ts +2 -2
- package/dist/components/forms/Input.d.ts.map +1 -1
- package/dist/components/forms/Radio.d.ts +2 -2
- package/dist/components/forms/Radio.d.ts.map +1 -1
- package/dist/components/forms/Radio.js +2 -4
- package/dist/components/forms/Select.d.ts +2 -2
- package/dist/components/forms/Select.d.ts.map +1 -1
- package/dist/components/forms/Textarea.d.ts +2 -2
- package/dist/components/forms/Textarea.d.ts.map +1 -1
- package/dist/components/forms/classes.d.ts +0 -3
- package/dist/components/forms/classes.d.ts.map +1 -1
- package/dist/components/forms/classes.js +3 -9
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/utils.d.ts +8 -0
- package/dist/components/utils.d.ts.map +1 -1
- package/dist/components/utils.js +11 -0
- package/dist/runtime/createBridgedPluginContext.js +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/react.d.ts +2 -2
- package/dist/runtime/view-host/index.js +1 -1
- package/dist/runtime/viewHost.js +1 -1
- package/dist/signing/inventory.js +1 -1
- package/package.json +7 -3
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
2
|
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import { FaIcon } from '../FaIcon/index.js';
|
|
4
|
+
import { cn } from '../utils.js';
|
|
4
5
|
/**
|
|
5
6
|
* Close control for document-style tabs in the request editor and AI chat.
|
|
6
|
-
*
|
|
7
|
-
* @param ariaLabel - Accessible name describing which tab closes.
|
|
8
|
-
* @param onClick - Click handler; callers should stop propagation when needed.
|
|
9
|
-
* @param title - Optional native tooltip text.
|
|
10
|
-
* @param tabIndex - Tab order index; use with roving tabindex on the tab label.
|
|
11
7
|
*/
|
|
12
|
-
export function TabCloseButton({ ariaLabel, onClick, title = 'Close tab', tabIndex }) {
|
|
13
|
-
return (_jsx("button", { type: "button", className:
|
|
8
|
+
export function TabCloseButton({ ariaLabel, onClick, title = 'Close tab', tabIndex, className, ...props }) {
|
|
9
|
+
return (_jsx("button", { ...props, type: "button", className: cn('hc-tab-close-button app-no-drag inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center self-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', className), title: title, "aria-label": ariaLabel, tabIndex: tabIndex, onClick: onClick, children: _jsx(FaIcon, { icon: faXmark, className: "hc-tab-close-button-icon h-3.5 w-3.5" }) }));
|
|
14
10
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, JSX, ReactNode } from 'react';
|
|
2
|
+
interface Props extends ComponentPropsWithoutRef<'tbody'> {
|
|
3
|
+
/**
|
|
4
|
+
* Header or body row content.
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Table body section wrapper.
|
|
10
|
+
*/
|
|
11
|
+
export declare function TableBody({ children, className, ...props }: Props): JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=TableBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../../src/components/Table/TableBody.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItE,UAAU,KAAM,SAAQ,wBAAwB,CAAC,OAAO,CAAC;IACvD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAc/E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { useContext } from '@harborclient/sdk/react';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
import { TableVariantContext } from './TableContext.js';
|
|
5
|
+
/**
|
|
6
|
+
* Table body section wrapper.
|
|
7
|
+
*/
|
|
8
|
+
export function TableBody({ children, className, ...props }) {
|
|
9
|
+
const variant = useContext(TableVariantContext);
|
|
10
|
+
return (_jsx("tbody", { ...props, className: cn(variant === 'bordered' ? 'hc-table-body [&_tr:last-child_td]:border-b-0' : 'hc-table-body', className), children: children }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, JSX } from 'react';
|
|
2
|
+
type Props = ComponentPropsWithoutRef<'td'>;
|
|
3
|
+
/**
|
|
4
|
+
* Body cell with table styling for the active variant.
|
|
5
|
+
*/
|
|
6
|
+
export declare function TableCell({ children, className, ...props }: Props): JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=TableCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../../src/components/Table/TableCell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAI3D,KAAK,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;AAE5C;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAe/E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { useContext } from '@harborclient/sdk/react';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
import { TableVariantContext, tableCellClass, tableCellClassLoose } from './TableContext.js';
|
|
5
|
+
/**
|
|
6
|
+
* Body cell with table styling for the active variant.
|
|
7
|
+
*/
|
|
8
|
+
export function TableCell({ children, className, ...props }) {
|
|
9
|
+
const variant = useContext(TableVariantContext);
|
|
10
|
+
return (_jsx("td", { ...props, className: cn('hc-table-cell', variant === 'loose' ? tableCellClassLoose : tableCellClass, className), children: children }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout preset for {@link Table} and its subcomponents.
|
|
3
|
+
*/
|
|
4
|
+
export type TableVariant = 'bordered' | 'loose';
|
|
5
|
+
/**
|
|
6
|
+
* Default header cell classes for bordered editor tables.
|
|
7
|
+
*/
|
|
8
|
+
export declare const tableHeadClass = "border-r border-b border-separator p-3 text-left text-[14px] font-medium uppercase tracking-wide text-muted last:border-r-0";
|
|
9
|
+
/**
|
|
10
|
+
* Default body cell classes for bordered editor tables.
|
|
11
|
+
*/
|
|
12
|
+
export declare const tableCellClass = "border-r border-b border-separator p-3 last:border-r-0";
|
|
13
|
+
/**
|
|
14
|
+
* Header cell classes for loose tables with separate cell spacing.
|
|
15
|
+
*/
|
|
16
|
+
export declare const tableHeadClassLoose = "pb-1 text-left text-[14px] font-medium uppercase tracking-wide text-muted";
|
|
17
|
+
/**
|
|
18
|
+
* Body cell classes for loose tables with separate cell spacing.
|
|
19
|
+
*/
|
|
20
|
+
export declare const tableCellClassLoose = "";
|
|
21
|
+
export declare const TableVariantContext: import("react").Context<TableVariant>;
|
|
22
|
+
//# sourceMappingURL=TableContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableContext.d.ts","sourceRoot":"","sources":["../../../src/components/Table/TableContext.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,cAAc,gIACoG,CAAC;AAEhI;;GAEG;AACH,eAAO,MAAM,cAAc,2DAA2D,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,mBAAmB,8EAC6C,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,eAAO,MAAM,mBAAmB,uCAA0C,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext } from '@harborclient/sdk/react';
|
|
2
|
+
/**
|
|
3
|
+
* Default header cell classes for bordered editor tables.
|
|
4
|
+
*/
|
|
5
|
+
export const tableHeadClass = 'border-r border-b border-separator p-3 text-left text-[14px] font-medium uppercase tracking-wide text-muted last:border-r-0';
|
|
6
|
+
/**
|
|
7
|
+
* Default body cell classes for bordered editor tables.
|
|
8
|
+
*/
|
|
9
|
+
export const tableCellClass = 'border-r border-b border-separator p-3 last:border-r-0';
|
|
10
|
+
/**
|
|
11
|
+
* Header cell classes for loose tables with separate cell spacing.
|
|
12
|
+
*/
|
|
13
|
+
export const tableHeadClassLoose = 'pb-1 text-left text-[14px] font-medium uppercase tracking-wide text-muted';
|
|
14
|
+
/**
|
|
15
|
+
* Body cell classes for loose tables with separate cell spacing.
|
|
16
|
+
*/
|
|
17
|
+
export const tableCellClassLoose = '';
|
|
18
|
+
export const TableVariantContext = createContext('bordered');
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, JSX } from 'react';
|
|
2
|
+
type Props = ComponentPropsWithoutRef<'th'>;
|
|
3
|
+
/**
|
|
4
|
+
* Header cell with table styling for the active variant.
|
|
5
|
+
*/
|
|
6
|
+
export declare function TableHead({ children, className, scope, ...props }: Props): JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=TableHead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../../src/components/Table/TableHead.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAI3D,KAAK,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;AAE5C;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAa,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAgB9F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { useContext } from '@harborclient/sdk/react';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
import { TableVariantContext, tableHeadClass, tableHeadClassLoose } from './TableContext.js';
|
|
5
|
+
/**
|
|
6
|
+
* Header cell with table styling for the active variant.
|
|
7
|
+
*/
|
|
8
|
+
export function TableHead({ children, className, scope = 'col', ...props }) {
|
|
9
|
+
const variant = useContext(TableVariantContext);
|
|
10
|
+
return (_jsx("th", { ...props, scope: scope, className: cn('hc-table-head', variant === 'loose' ? tableHeadClassLoose : tableHeadClass, className), children: children }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, JSX, ReactNode } from 'react';
|
|
2
|
+
interface Props extends ComponentPropsWithoutRef<'thead'> {
|
|
3
|
+
/**
|
|
4
|
+
* Header or body row content.
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Table header section wrapper.
|
|
10
|
+
*/
|
|
11
|
+
export declare function TableHeader({ children, className, ...props }: Props): JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=TableHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Table/TableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtE,UAAU,KAAM,SAAQ,wBAAwB,CAAC,OAAO,CAAC;IACvD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAMjF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Table header section wrapper.
|
|
5
|
+
*/
|
|
6
|
+
export function TableHeader({ children, className, ...props }) {
|
|
7
|
+
return (_jsx("thead", { ...props, className: cn('hc-table-header', className), children: children }));
|
|
8
|
+
}
|
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Default body cell classes for bordered editor tables.
|
|
12
|
-
*/
|
|
13
|
-
export declare const tableCellClass = "border-r border-b border-separator p-3 last:border-r-0";
|
|
14
|
-
/**
|
|
15
|
-
* Header cell classes for loose tables with separate cell spacing.
|
|
16
|
-
*/
|
|
17
|
-
export declare const tableHeadClassLoose = "pb-1 text-left text-[14px] font-medium uppercase tracking-wide text-muted";
|
|
18
|
-
/**
|
|
19
|
-
* Body cell classes for loose tables with separate cell spacing.
|
|
20
|
-
*/
|
|
21
|
-
export declare const tableCellClassLoose = "";
|
|
22
|
-
interface TableProps {
|
|
1
|
+
import type { ComponentPropsWithoutRef, JSX, ReactNode } from 'react';
|
|
2
|
+
import { type TableVariant } from './TableContext.js';
|
|
3
|
+
export type { TableVariant } from './TableContext.js';
|
|
4
|
+
export { tableCellClass, tableCellClassLoose, tableHeadClass, tableHeadClassLoose } from './TableContext.js';
|
|
5
|
+
export { TableBody } from './TableBody.js';
|
|
6
|
+
export { TableCell } from './TableCell.js';
|
|
7
|
+
export { TableHead } from './TableHead.js';
|
|
8
|
+
export { TableHeader } from './TableHeader.js';
|
|
9
|
+
interface Props extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className'> {
|
|
23
10
|
/**
|
|
24
11
|
* Table header and body sections.
|
|
25
12
|
*/
|
|
@@ -35,69 +22,6 @@ interface TableProps {
|
|
|
35
22
|
}
|
|
36
23
|
/**
|
|
37
24
|
* Table shell for editable row layouts.
|
|
38
|
-
*
|
|
39
|
-
* @param children - {@link TableHeader} and {@link TableBody} sections.
|
|
40
|
-
* @param variant - Bordered collapsed layout or loose separate-cell spacing.
|
|
41
|
-
* @param className - Extra classes on the wrapper (bordered) or table element (loose).
|
|
42
|
-
*/
|
|
43
|
-
export declare function Table({ children, variant, className }: TableProps): JSX.Element;
|
|
44
|
-
interface TableSectionProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
45
|
-
/**
|
|
46
|
-
* Header or body row content.
|
|
47
|
-
*/
|
|
48
|
-
children: ReactNode;
|
|
49
|
-
/**
|
|
50
|
-
* Additional Tailwind classes merged onto the section element.
|
|
51
|
-
*/
|
|
52
|
-
className?: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Table header section wrapper.
|
|
56
|
-
*
|
|
57
|
-
* @param children - Header row elements, typically native `tr` nodes.
|
|
58
|
-
* @param className - Extra classes appended after any section preset.
|
|
59
|
-
*/
|
|
60
|
-
export declare function TableHeader({ children, className, ...rest }: TableSectionProps): JSX.Element;
|
|
61
|
-
/**
|
|
62
|
-
* Table body section wrapper.
|
|
63
|
-
*
|
|
64
|
-
* @param children - Body row elements, typically native `tr` nodes.
|
|
65
|
-
* @param className - Extra classes appended after the layout preset.
|
|
66
|
-
*/
|
|
67
|
-
export declare function TableBody({ children, className, ...rest }: TableSectionProps): JSX.Element;
|
|
68
|
-
interface TableHeadProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
69
|
-
/**
|
|
70
|
-
* Header cell content.
|
|
71
|
-
*/
|
|
72
|
-
children?: ReactNode;
|
|
73
|
-
/**
|
|
74
|
-
* Additional Tailwind classes merged after the header cell preset.
|
|
75
|
-
*/
|
|
76
|
-
className?: string;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Header cell with table styling for the active variant.
|
|
80
|
-
*
|
|
81
|
-
* @param children - Header label content.
|
|
82
|
-
* @param className - Extra classes appended after the layout preset.
|
|
83
|
-
*/
|
|
84
|
-
export declare function TableHead({ children, className, scope, ...rest }: TableHeadProps): JSX.Element;
|
|
85
|
-
interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
86
|
-
/**
|
|
87
|
-
* Body cell content.
|
|
88
|
-
*/
|
|
89
|
-
children?: ReactNode;
|
|
90
|
-
/**
|
|
91
|
-
* Additional Tailwind classes merged after the body cell preset.
|
|
92
|
-
*/
|
|
93
|
-
className?: string;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Body cell with table styling for the active variant.
|
|
97
|
-
*
|
|
98
|
-
* @param children - Cell content.
|
|
99
|
-
* @param className - Extra classes appended after the layout preset.
|
|
100
25
|
*/
|
|
101
|
-
export declare function
|
|
102
|
-
export {};
|
|
26
|
+
export declare function Table({ children, variant, className, ...props }: Props): JSX.Element;
|
|
103
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Table/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Table/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAE3E,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,UAAU,KAAM,SAAQ,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACrF;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAoB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CA+BjG"}
|
|
@@ -1,100 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
export const tableCellClass = 'border-r border-b border-separator p-3 last:border-r-0';
|
|
11
|
-
/**
|
|
12
|
-
* Header cell classes for loose tables with separate cell spacing.
|
|
13
|
-
*/
|
|
14
|
-
export const tableHeadClassLoose = 'pb-1 text-left text-[14px] font-medium uppercase tracking-wide text-muted';
|
|
15
|
-
/**
|
|
16
|
-
* Body cell classes for loose tables with separate cell spacing.
|
|
17
|
-
*/
|
|
18
|
-
export const tableCellClassLoose = '';
|
|
19
|
-
const TableVariantContext = createContext('bordered');
|
|
20
|
-
/**
|
|
21
|
-
* Returns preset classes merged with optional overrides.
|
|
22
|
-
*
|
|
23
|
-
* @param base - Variant preset classes.
|
|
24
|
-
* @param className - Additional classes appended after the preset.
|
|
25
|
-
*/
|
|
26
|
-
function mergeClasses(base, className) {
|
|
27
|
-
if (base && className) {
|
|
28
|
-
return `${base} ${className}`;
|
|
29
|
-
}
|
|
30
|
-
if (base) {
|
|
31
|
-
return base;
|
|
32
|
-
}
|
|
33
|
-
if (className) {
|
|
34
|
-
return className;
|
|
35
|
-
}
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
1
|
+
import { createElement } from '@harborclient/sdk/react';
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
import { TableVariantContext } from './TableContext.js';
|
|
4
|
+
export { tableCellClass, tableCellClassLoose, tableHeadClass, tableHeadClassLoose } from './TableContext.js';
|
|
5
|
+
export { TableBody } from './TableBody.js';
|
|
6
|
+
export { TableCell } from './TableCell.js';
|
|
7
|
+
export { TableHead } from './TableHead.js';
|
|
8
|
+
export { TableHeader } from './TableHeader.js';
|
|
38
9
|
/**
|
|
39
10
|
* Table shell for editable row layouts.
|
|
40
|
-
*
|
|
41
|
-
* @param children - {@link TableHeader} and {@link TableBody} sections.
|
|
42
|
-
* @param variant - Bordered collapsed layout or loose separate-cell spacing.
|
|
43
|
-
* @param className - Extra classes on the wrapper (bordered) or table element (loose).
|
|
44
11
|
*/
|
|
45
|
-
export function Table({ children, variant = 'bordered', className }) {
|
|
12
|
+
export function Table({ children, variant = 'bordered', className, ...props }) {
|
|
46
13
|
if (variant === 'loose') {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
14
|
+
return createElement(TableVariantContext.Provider, { value: variant }, createElement('table', {
|
|
15
|
+
...props,
|
|
16
|
+
className: cn('hc-table w-full border-separate border-spacing-x-1.5 border-spacing-y-1.5', className)
|
|
17
|
+
}, children));
|
|
50
18
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Table header section wrapper.
|
|
57
|
-
*
|
|
58
|
-
* @param children - Header row elements, typically native `tr` nodes.
|
|
59
|
-
* @param className - Extra classes appended after any section preset.
|
|
60
|
-
*/
|
|
61
|
-
export function TableHeader({ children, className, ...rest }) {
|
|
62
|
-
const classes = mergeClasses('hc-table-header', className);
|
|
63
|
-
return (_jsx("thead", { className: classes, ...rest, children: children }));
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Table body section wrapper.
|
|
67
|
-
*
|
|
68
|
-
* @param children - Body row elements, typically native `tr` nodes.
|
|
69
|
-
* @param className - Extra classes appended after the layout preset.
|
|
70
|
-
*/
|
|
71
|
-
export function TableBody({ children, className, ...rest }) {
|
|
72
|
-
const variant = useContext(TableVariantContext);
|
|
73
|
-
const base = variant === 'bordered' ? 'hc-table-body [&_tr:last-child_td]:border-b-0' : 'hc-table-body';
|
|
74
|
-
const classes = mergeClasses(base, className);
|
|
75
|
-
return (_jsx("tbody", { className: classes, ...rest, children: children }));
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Header cell with table styling for the active variant.
|
|
79
|
-
*
|
|
80
|
-
* @param children - Header label content.
|
|
81
|
-
* @param className - Extra classes appended after the layout preset.
|
|
82
|
-
*/
|
|
83
|
-
export function TableHead({ children, className, scope = 'col', ...rest }) {
|
|
84
|
-
const variant = useContext(TableVariantContext);
|
|
85
|
-
const base = variant === 'loose' ? tableHeadClassLoose : tableHeadClass;
|
|
86
|
-
const classes = mergeClasses(`hc-table-head ${base}`, className);
|
|
87
|
-
return (_jsx("th", { scope: scope, className: classes, ...rest, children: children }));
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Body cell with table styling for the active variant.
|
|
91
|
-
*
|
|
92
|
-
* @param children - Cell content.
|
|
93
|
-
* @param className - Extra classes appended after the layout preset.
|
|
94
|
-
*/
|
|
95
|
-
export function TableCell({ children, className, ...rest }) {
|
|
96
|
-
const variant = useContext(TableVariantContext);
|
|
97
|
-
const base = variant === 'loose' ? tableCellClassLoose : tableCellClass;
|
|
98
|
-
const classes = mergeClasses(`hc-table-cell ${base}`, className);
|
|
99
|
-
return (_jsx("td", { className: classes, ...rest, children: children }));
|
|
19
|
+
return createElement(TableVariantContext.Provider, { value: variant }, createElement('div', {
|
|
20
|
+
...props,
|
|
21
|
+
className: cn('hc-table overflow-hidden rounded-lg border border-separator', className)
|
|
22
|
+
}, createElement('table', { className: 'hc-table-element w-full border-collapse' }, children)));
|
|
100
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
-
import type { AriaAttributes, JSX, ReactNode, RefObject } from 'react';
|
|
2
|
+
import type { AriaAttributes, ComponentPropsWithoutRef, JSX, ReactNode, RefObject } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Declarative action rendered as an icon button in a sidebar toolbar.
|
|
5
5
|
*/
|
|
@@ -49,7 +49,7 @@ export interface ToolbarAction {
|
|
|
49
49
|
*/
|
|
50
50
|
buttonRef?: RefObject<HTMLButtonElement | null>;
|
|
51
51
|
}
|
|
52
|
-
interface Props {
|
|
52
|
+
interface Props extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'aria-label'> {
|
|
53
53
|
/**
|
|
54
54
|
* Icon actions rendered in the toolbar.
|
|
55
55
|
*/
|
|
@@ -58,18 +58,10 @@ interface Props {
|
|
|
58
58
|
* Accessible name for the toolbar landmark.
|
|
59
59
|
*/
|
|
60
60
|
ariaLabel?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Extra classes merged onto the outer toolbar wrapper.
|
|
63
|
-
*/
|
|
64
|
-
className?: string;
|
|
65
61
|
}
|
|
66
62
|
/**
|
|
67
63
|
* 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
64
|
*/
|
|
73
|
-
export declare function Toolbar({ actions, ariaLabel, className }: Props): JSX.Element;
|
|
65
|
+
export declare function Toolbar({ actions, ariaLabel, className, ...props }: Props): JSX.Element;
|
|
74
66
|
export {};
|
|
75
67
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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;
|
|
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,wBAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjG;;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,KAAM,SAAQ,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtF;;OAEG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;IAEzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuBD;;GAEG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,SAAqB,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CA6CrB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@harborclient/sdk/jsx-runtime";
|
|
2
2
|
import { FaIcon } from '../FaIcon/index.js';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
3
4
|
/**
|
|
4
5
|
* Tailwind classes for inactive toolbar icon action buttons.
|
|
5
6
|
*/
|
|
@@ -10,8 +11,6 @@ const TOOLBAR_ACTION_BUTTON_INACTIVE = 'hc-toolbar-action inline-flex h-7 w-7 sh
|
|
|
10
11
|
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-selection text-text shadow-sm focus-visible:bg-surface focus-visible:text-text disabled:cursor-not-allowed disabled:opacity-50 app-no-drag';
|
|
11
12
|
/**
|
|
12
13
|
* Resolves toolbar button classes for a declarative action.
|
|
13
|
-
*
|
|
14
|
-
* @param action - Toolbar action metadata.
|
|
15
14
|
*/
|
|
16
15
|
function toolbarActionButton(action) {
|
|
17
16
|
return action.ariaPressed === true
|
|
@@ -20,16 +19,9 @@ function toolbarActionButton(action) {
|
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* 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
22
|
*/
|
|
28
|
-
export function Toolbar({ actions, ariaLabel = 'Toolbar', className }) {
|
|
29
|
-
|
|
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) => {
|
|
23
|
+
export function Toolbar({ actions, ariaLabel = 'Toolbar', className, ...props }) {
|
|
24
|
+
return (_jsx("div", { ...props, role: "toolbar", "aria-label": ariaLabel, className: cn('hc-toolbar app-no-drag flex shrink-0 items-center border-b border-separator bg-sidebar-toolbar px-2 py-2', className), children: _jsx("div", { className: "hc-toolbar-actions flex items-center gap-1", children: actions.map((action) => {
|
|
33
25
|
const title = action.title ?? action.label;
|
|
34
26
|
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
27
|
? 'hc-toolbar-action-icon h-5! w-5!'
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { JSX, KeyboardEvent } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, JSX, KeyboardEvent } from 'react';
|
|
2
2
|
import type { Variable } from '../../types.js';
|
|
3
3
|
import type { AutocompleteSource } from '../Autocomplete/types.js';
|
|
4
|
-
export interface Props {
|
|
4
|
+
export interface Props extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className' | 'id' | 'aria-label' | 'aria-labelledby' | 'onKeyDown' | 'onChange'> {
|
|
5
5
|
/**
|
|
6
6
|
* Current input value.
|
|
7
7
|
*/
|
|
8
8
|
value: string;
|
|
9
9
|
/**
|
|
10
10
|
* Called when the value changes.
|
|
11
|
-
*
|
|
12
|
-
* @param value - Updated input value.
|
|
13
11
|
*/
|
|
14
12
|
onChange: (value: string) => void;
|
|
15
13
|
/**
|
|
@@ -59,5 +57,5 @@ export interface Props {
|
|
|
59
57
|
* Token highlight color (`text-[#32D2E2]`) and the tooltip `app-no-drag` class rely on
|
|
60
58
|
* host styling in HarborClient `styles.css`.
|
|
61
59
|
*/
|
|
62
|
-
export declare function VariableInput({ value, onChange, variables, placeholder, onKeyDown, className, wrapperClassName, onEditVariable, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, source }: Props): JSX.Element;
|
|
60
|
+
export declare function VariableInput({ value, onChange, variables, placeholder, onKeyDown, className, wrapperClassName, onEditVariable, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, source, ...props }: Props): JSX.Element;
|
|
63
61
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/VariableInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/VariableInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AACtF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAS/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAanE,MAAM,WAAW,KAAM,SAAQ,IAAI,CACjC,wBAAwB,CAAC,KAAK,CAAC,EAC/B,UAAU,GAAG,WAAW,GAAG,IAAI,GAAG,YAAY,GAAG,iBAAiB,GAAG,WAAW,GAAG,UAAU,CAC9F;IACC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;OAEG;IACH,SAAS,EAAE,QAAQ,EAAE,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAEzD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAc,EACd,gBAAgB,EAChB,cAAc,EACd,EAAE,EACF,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,MAAM,EACN,GAAG,KAAK,EACT,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CA2SrB"}
|
|
@@ -4,13 +4,14 @@ import { getDynamicVariableDescription, getVariableTokenAtOffset, getVariableToo
|
|
|
4
4
|
import { SuggestionList } from '../Autocomplete/SuggestionList.js';
|
|
5
5
|
import { useAutocomplete } from '../Autocomplete/useAutocomplete.js';
|
|
6
6
|
import { Input } from '../forms/index.js';
|
|
7
|
+
import { cn } from '../utils.js';
|
|
7
8
|
/**
|
|
8
9
|
* Text input that highlights {{variable}} tokens and shows resolved values on hover.
|
|
9
10
|
*
|
|
10
11
|
* Token highlight color (`text-[#32D2E2]`) and the tooltip `app-no-drag` class rely on
|
|
11
12
|
* host styling in HarborClient `styles.css`.
|
|
12
13
|
*/
|
|
13
|
-
export function VariableInput({ value, onChange, variables, placeholder, onKeyDown, className = '', wrapperClassName, onEditVariable, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, source }) {
|
|
14
|
+
export function VariableInput({ value, onChange, variables, placeholder, onKeyDown, className = '', wrapperClassName, onEditVariable, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, source, ...props }) {
|
|
14
15
|
const safeValue = value ?? '';
|
|
15
16
|
const inputRef = useRef(null);
|
|
16
17
|
const backdropRef = useRef(null);
|
|
@@ -60,10 +61,6 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
60
61
|
};
|
|
61
62
|
/**
|
|
62
63
|
* Shows a tooltip for a variable token at the given screen position.
|
|
63
|
-
*
|
|
64
|
-
* @param key - Variable name from the token.
|
|
65
|
-
* @param top - Top coordinate for tooltip placement.
|
|
66
|
-
* @param left - Horizontal center coordinate for tooltip placement.
|
|
67
64
|
*/
|
|
68
65
|
const showTooltipForKey = (key, top, left) => {
|
|
69
66
|
setTooltip({
|
|
@@ -107,8 +104,6 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
107
104
|
};
|
|
108
105
|
/**
|
|
109
106
|
* Shows a tooltip when the pointer is over a variable token span.
|
|
110
|
-
*
|
|
111
|
-
* @param e - Mouse move event from the input.
|
|
112
107
|
*/
|
|
113
108
|
const handleMouseMove = (e) => {
|
|
114
109
|
cancelHide();
|
|
@@ -131,8 +126,6 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
131
126
|
};
|
|
132
127
|
/**
|
|
133
128
|
* Handles keyboard events on the input, including tooltip dismissal.
|
|
134
|
-
*
|
|
135
|
-
* @param event - Keyboard event from the input.
|
|
136
129
|
*/
|
|
137
130
|
const handleKeyDown = (event) => {
|
|
138
131
|
if (onInputKeyDown(event)) {
|
|
@@ -147,8 +140,6 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
147
140
|
};
|
|
148
141
|
/**
|
|
149
142
|
* Updates the tooltip after keyboard navigation moves the caret.
|
|
150
|
-
*
|
|
151
|
-
* @param event - Keyboard event from the input.
|
|
152
143
|
*/
|
|
153
144
|
const handleKeyUp = (event) => {
|
|
154
145
|
if (event.key === 'ArrowLeft' ||
|
|
@@ -161,24 +152,22 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
161
152
|
}
|
|
162
153
|
};
|
|
163
154
|
const tooltipContent = tooltip ? getVariableTooltipContent(tooltip.key, variables) : null;
|
|
164
|
-
return (_jsxs("div", { className: wrapperClassName
|
|
165
|
-
? `hc-variable-input relative min-w-0 ${wrapperClassName}`
|
|
166
|
-
: 'hc-variable-input relative min-w-0 flex-1', children: [_jsx("div", { ref: backdropRef, "aria-hidden": true, className: "hc-variable-input-backdrop pointer-events-none absolute inset-0 overflow-hidden whitespace-nowrap px-2.5 py-1.5 text-[16px] text-inherit", children: safeValue ? (tokens.map((token, index) => token.key ? (_jsx("span", { ref: (el) => {
|
|
155
|
+
return (_jsxs("div", { ...props, className: cn('hc-variable-input relative min-w-0', wrapperClassName ?? 'flex-1'), children: [_jsx("div", { ref: backdropRef, "aria-hidden": true, className: "hc-variable-input-backdrop pointer-events-none absolute inset-0 overflow-hidden px-2.5 py-1.5 text-[16px] whitespace-nowrap text-inherit", children: safeValue ? (tokens.map((token, index) => token.key ? (_jsx("span", { ref: (el) => {
|
|
167
156
|
if (el)
|
|
168
157
|
spanRefs.current.set(index, el);
|
|
169
158
|
else
|
|
170
159
|
spanRefs.current.delete(index);
|
|
171
160
|
}, className: "hc-variable-input-token hc-variable-input-token-variable text-[#32D2E2]", children: token.text }, index)) : (_jsx("span", { className: "hc-variable-input-token", children: token.text }, index)))) : (_jsx("span", { className: "hc-variable-input-placeholder text-muted", children: placeholder })) }), _jsx(Input, { ref: inputRef, id: id, variant: "plain", role: source ? 'combobox' : undefined, "aria-autocomplete": source ? 'list' : undefined, "aria-expanded": source ? autocompleteOpen : undefined, "aria-controls": source && autocompleteOpen ? listboxId : undefined, "aria-activedescendant": source && autocompleteOpen && autocompleteActiveIndex >= 0
|
|
172
161
|
? `${listboxId}-option-${autocompleteActiveIndex}`
|
|
173
|
-
: undefined, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": tooltip ? tooltipId : undefined, className:
|
|
162
|
+
: undefined, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": tooltip ? tooltipId : undefined, className: cn('hc-variable-input-field relative w-full min-w-0 border-none bg-transparent px-2.5 py-1.5 text-[16px] text-transparent caret-text focus-visible:shadow-none', className), type: "text", placeholder: placeholder, value: safeValue, onChange: (e) => {
|
|
174
163
|
onChange(e.target.value);
|
|
175
164
|
queueMicrotask(updateTooltipFromCaret);
|
|
176
165
|
}, onFocus: () => {
|
|
177
166
|
openAutocomplete();
|
|
178
167
|
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-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:
|
|
168
|
+
}, 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:right-0 after:-bottom-2 after:left-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
169
|
? 'hc-variable-input-tooltip-text text-muted'
|
|
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
|
|
170
|
+
: 'hc-variable-input-tooltip-text', children: tooltipContent.text }), onEditVariable && (_jsx("button", { type: "button", className: "hc-variable-input-tooltip-edit app-no-drag -mx-1 self-start rounded px-1 py-0.5 text-[14px] text-accent hover:underline", "aria-label": `Edit value for ${tooltip.key}`, onClick: () => {
|
|
182
171
|
onEditVariable();
|
|
183
172
|
setTooltip(null);
|
|
184
173
|
}, children: "Edit value" }))] }))] }));
|