@wallarm-org/design-system 0.62.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Breadcrumbs/BreadcrumbsItem.js +1 -0
- package/dist/components/BulkBar/BulkBarSummary.d.ts +4 -14
- package/dist/components/BulkBar/BulkBarSummary.js +15 -46
- package/dist/components/BulkBar/BulkBarSummaryClear.d.ts +7 -0
- package/dist/components/BulkBar/BulkBarSummaryClear.js +25 -0
- package/dist/components/BulkBar/BulkBarSummaryCount.d.ts +13 -0
- package/dist/components/BulkBar/BulkBarSummaryCount.js +18 -0
- package/dist/components/BulkBar/BulkBarSummarySelectAll.d.ts +7 -0
- package/dist/components/BulkBar/BulkBarSummarySelectAll.js +25 -0
- package/dist/components/BulkBar/BulkBarSummarySeparator.d.ts +8 -0
- package/dist/components/BulkBar/BulkBarSummarySeparator.js +12 -0
- package/dist/components/BulkBar/index.d.ts +5 -0
- package/dist/components/BulkBar/index.js +6 -0
- package/dist/components/Calendar/CalendarPresetItem.d.ts +9 -3
- package/dist/components/Calendar/CalendarPresetItem.js +8 -5
- package/dist/components/Calendar/CalendarTrigger.d.ts +12 -3
- package/dist/components/Calendar/CalendarTrigger.js +3 -3
- package/dist/components/Calendar/index.d.ts +1 -1
- package/dist/components/Card/Card.js +2 -0
- package/dist/components/CodeSnippet/CodeSnippetCode.js +9 -2
- package/dist/components/CodeSnippet/CodeSnippetCopyButton.js +1 -1
- package/dist/components/CodeSnippet/CodeSnippetFullscreenButton.js +0 -1
- package/dist/components/CodeSnippet/CodeSnippetRoot.d.ts +8 -1
- package/dist/components/CodeSnippet/CodeSnippetRoot.js +5 -3
- package/dist/components/CodeSnippet/CodeSnippetShowMoreButton.d.ts +12 -0
- package/dist/components/CodeSnippet/{internal/ShowMoreButton.js → CodeSnippetShowMoreButton.js} +15 -9
- package/dist/components/CodeSnippet/CodeSnippetTab.d.ts +3 -6
- package/dist/components/CodeSnippet/CodeSnippetTab.js +5 -7
- package/dist/components/CodeSnippet/CodeSnippetWrapButton.js +0 -1
- package/dist/components/CodeSnippet/InlineCodeSnippet.d.ts +4 -2
- package/dist/components/CodeSnippet/InlineCodeSnippet.js +14 -7
- package/dist/components/CodeSnippet/index.d.ts +2 -1
- package/dist/components/CodeSnippet/index.js +2 -1
- package/dist/components/CodeSnippet/internal/FoldToggle.js +9 -2
- package/dist/components/CodeSnippet/lib/foldUtils.d.ts +6 -0
- package/dist/components/DateRangeInput/DateRangeEndValue.d.ts +9 -2
- package/dist/components/DateRangeInput/DateRangeEndValue.js +3 -2
- package/dist/components/DateRangeInput/DateRangeSegmentGroup.d.ts +12 -1
- package/dist/components/DateRangeInput/DateRangeSegmentGroup.js +24 -6
- package/dist/components/DateRangeInput/DateRangeStartValue.d.ts +11 -4
- package/dist/components/DateRangeInput/DateRangeStartValue.js +3 -2
- package/dist/components/DateRangeInput/index.d.ts +2 -2
- package/dist/components/Drawer/Drawer.d.ts +5 -0
- package/dist/components/Drawer/Drawer.js +3 -1
- package/dist/components/Drawer/DrawerClose.d.ts +3 -2
- package/dist/components/Drawer/DrawerClose.js +6 -3
- package/dist/components/Drawer/DrawerHeader.d.ts +1 -1
- package/dist/components/Drawer/DrawerHeader.js +4 -1
- package/dist/components/Drawer/DrawerResizeHandle.d.ts +7 -2
- package/dist/components/Drawer/DrawerResizeHandle.js +31 -6
- package/dist/components/Drawer/DrawerRoot.d.ts +3 -0
- package/dist/components/Drawer/DrawerRoot.js +3 -1
- package/dist/components/Drawer/DrawerTrigger.d.ts +3 -2
- package/dist/components/Drawer/DrawerTrigger.js +3 -2
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +2 -1
- package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenuContextTrigger.d.ts +3 -5
- package/dist/components/DropdownMenu/DropdownMenuContextTrigger.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenuItem.d.ts +2 -1
- package/dist/components/DropdownMenu/DropdownMenuItem.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenuRadioGroup.d.ts +2 -1
- package/dist/components/DropdownMenu/DropdownMenuRadioGroup.js +4 -4
- package/dist/components/DropdownMenu/DropdownMenuRadioItem.d.ts +2 -1
- package/dist/components/DropdownMenu/DropdownMenuRadioItem.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenuTrigger.d.ts +3 -5
- package/dist/components/DropdownMenu/DropdownMenuTrigger.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenuTriggerItem.d.ts +4 -4
- package/dist/components/DropdownMenu/DropdownMenuTriggerItem.js +4 -3
- package/dist/components/DropdownMenu/index.d.ts +4 -4
- package/dist/components/NavRail/NavRailItem.d.ts +2 -1
- package/dist/components/NavRail/NavRailItem.js +6 -4
- package/dist/components/Popover/PopoverContent.d.ts +3 -3
- package/dist/components/Popover/PopoverContent.js +4 -8
- package/dist/components/Popover/PopoverTrigger.d.ts +3 -5
- package/dist/components/Popover/PopoverTrigger.js +3 -7
- package/dist/components/Popover/index.d.ts +2 -2
- package/dist/components/SegmentedControl/SegmentedControlItem.d.ts +6 -4
- package/dist/components/SegmentedControl/SegmentedControlItem.js +5 -2
- package/dist/components/SegmentedTabs/SegmentedTabsTrigger.d.ts +5 -3
- package/dist/components/SegmentedTabs/SegmentedTabsTrigger.js +5 -3
- package/dist/components/SegmentedTabs/SegmentedTabsTriggerButton.js +2 -2
- package/dist/components/Select/SelectButton.js +2 -2
- package/dist/components/Select/SelectClearTrigger.d.ts +2 -1
- package/dist/components/Select/SelectClearTrigger.js +2 -2
- package/dist/components/Select/SelectInput/SelectInput.d.ts +4 -1
- package/dist/components/Select/SelectInput/SelectInput.js +3 -2
- package/dist/components/Select/SelectOption.d.ts +2 -1
- package/dist/components/Select/SelectOption.js +2 -2
- package/dist/components/Select/SelectSearchInput.d.ts +3 -2
- package/dist/components/Select/SelectSearchInput.js +3 -2
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBar.d.ts +1 -1
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBar.js +44 -5
- package/dist/components/Selection/index.d.ts +2 -0
- package/dist/components/Selection/index.js +2 -1
- package/dist/components/Table/Table.js +7 -0
- package/dist/components/Table/TableActionBar/TableActionBar.d.ts +7 -1
- package/dist/components/Table/TableActionBar/TableActionBar.js +6 -2
- package/dist/components/Table/TableActionBar/TableActionBarSelection.d.ts +16 -2
- package/dist/components/Table/TableActionBar/TableActionBarSelection.js +52 -10
- package/dist/components/Table/TableActionBar/index.d.ts +1 -0
- package/dist/components/Table/TableActionBar/index.js +2 -1
- package/dist/components/Table/TableColumnMenu/TableColumnMenu.d.ts +37 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenu.js +139 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuHideItem.d.ts +8 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuHideItem.js +27 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuMoveLeftItem.d.ts +8 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuMoveLeftItem.js +38 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuMoveRightItem.d.ts +8 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuMoveRightItem.js +39 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuPinItem.d.ts +10 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuPinItem.js +31 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuSortItem.d.ts +17 -0
- package/dist/components/Table/TableColumnMenu/TableColumnMenuSortItem.js +33 -0
- package/dist/components/Table/TableColumnMenu/index.d.ts +6 -0
- package/dist/components/Table/TableColumnMenu/index.js +7 -0
- package/dist/components/Table/TableHeadCell.js +17 -18
- package/dist/components/Table/TableInner/TableInner.d.ts +2 -0
- package/dist/components/Table/TableInner/TableInner.js +21 -12
- package/dist/components/Table/TableInner/TableInnerContainer.d.ts +1 -0
- package/dist/components/Table/TableInner/TableInnerContainer.js +5 -3
- package/dist/components/Table/TableInner/TableInnerWindow.d.ts +1 -0
- package/dist/components/Table/TableInner/TableInnerWindow.js +5 -3
- package/dist/components/Table/TableScrollHandler.d.ts +27 -4
- package/dist/components/Table/TableScrollHandler.js +99 -68
- package/dist/components/Table/TableScrollHandlerContext.d.ts +19 -0
- package/dist/components/Table/TableScrollHandlerContext.js +24 -0
- package/dist/components/Table/TableScrollHandlerSlot.d.ts +8 -0
- package/dist/components/Table/TableScrollHandlerSlot.js +18 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenu.d.ts +18 -2
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenu.js +105 -95
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuContentContext.d.ts +7 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuContentContext.js +9 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuContext.d.ts +15 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuContext.js +21 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuItem.d.ts +8 -6
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuItem.js +17 -11
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuReset.d.ts +5 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuReset.js +34 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuSearch.d.ts +5 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuSearch.js +17 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuSlot.d.ts +11 -0
- package/dist/components/Table/TableSettingsMenu/TableSettingsMenuSlot.js +16 -0
- package/dist/components/Table/TableSettingsMenu/index.d.ts +6 -1
- package/dist/components/Table/TableSettingsMenu/index.js +6 -1
- package/dist/components/Table/TableSortTrigger.d.ts +39 -0
- package/dist/components/Table/TableSortTrigger.js +86 -0
- package/dist/components/Table/index.d.ts +6 -2
- package/dist/components/Table/index.js +7 -3
- package/dist/components/Table/lib/collectDirectChildren.d.ts +8 -0
- package/dist/components/Table/lib/collectDirectChildren.js +13 -0
- package/dist/components/Table/lib/containsDirectChild.d.ts +12 -0
- package/dist/components/Table/lib/containsDirectChild.js +12 -0
- package/dist/components/Table/lib/index.d.ts +2 -0
- package/dist/components/Table/lib/index.js +3 -1
- package/dist/components/Tabs/TabsTrigger.d.ts +5 -4
- package/dist/components/Tabs/TabsTrigger.js +3 -2
- package/dist/components/Tag/Tag.js +2 -1
- package/dist/components/Tag/TagClose.d.ts +5 -3
- package/dist/components/Tag/TagClose.js +13 -9
- package/dist/components/Tag/index.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +4 -2
- package/dist/components/Tooltip/TooltipContent.d.ts +4 -4
- package/dist/components/Tooltip/TooltipContent.js +3 -3
- package/dist/components/Tooltip/TooltipTrigger.d.ts +4 -4
- package/dist/components/Tooltip/TooltipTrigger.js +2 -2
- package/dist/components/Tooltip/index.d.ts +2 -2
- package/dist/components/Tour/Tour.d.ts +7 -1
- package/dist/components/Tour/Tour.js +8 -2
- package/dist/components/Tour/TourClose.d.ts +6 -2
- package/dist/components/Tour/TourClose.js +6 -6
- package/dist/components/Tour/TourFooter.js +8 -3
- package/dist/components/Tour/TourInner.d.ts +7 -1
- package/dist/components/Tour/TourInner.js +2 -2
- package/dist/components/Tour/index.d.ts +1 -0
- package/dist/components/Tour/index.js +2 -1
- package/dist/components/Tour/types.d.ts +12 -1
- package/dist/hooks/useCopyTooltip.d.ts +1 -3
- package/dist/hooks/useCopyTooltip.js +1 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/metadata/components.json +30183 -16896
- package/dist/utils/testId.d.ts +4 -1
- package/dist/utils/testId.js +2 -1
- package/package.json +1 -1
- package/dist/components/CodeSnippet/internal/ShowMoreButton.d.ts +0 -2
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBarSummary.d.ts +0 -2
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBarSummary.js +0 -18
- package/dist/components/Table/TableHeadCellMenu.d.ts +0 -9
- package/dist/components/Table/TableHeadCellMenu.js +0 -174
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement, isValidElement } from "react";
|
|
2
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
4
|
import { cva } from "class-variance-authority";
|
|
4
5
|
import { useCopyTooltip } from "../../hooks/index.js";
|
|
@@ -19,25 +20,31 @@ const inlineCodeSnippetVariants = cva("inline-flex items-center code-snippet-bg
|
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
22
|
const InlineCodeSnippet = (props)=>{
|
|
22
|
-
const { code, size = 'inherit', asChild = false, copyable = true, className, onClick, ref, ...otherProps } = props;
|
|
23
|
+
const { code, size = 'inherit', asChild = false, copyable = true, className, onClick, ref, children, ...otherProps } = props;
|
|
23
24
|
const { copied, tooltipOpen, onTooltipOpenChange, handleCopy } = useCopyTooltip({
|
|
24
25
|
text: code,
|
|
25
26
|
enabled: copyable
|
|
26
27
|
});
|
|
27
|
-
const Comp = asChild ? Slot : 'code';
|
|
28
28
|
const handleClick = (event)=>{
|
|
29
|
-
handleCopy(
|
|
29
|
+
handleCopy();
|
|
30
30
|
onClick?.(event);
|
|
31
31
|
};
|
|
32
|
-
const
|
|
33
|
-
ref
|
|
34
|
-
|
|
32
|
+
const sharedProps = {
|
|
33
|
+
ref,
|
|
34
|
+
'data-slot': 'inline-code-snippet',
|
|
35
|
+
'data-ds-suppress-parent-click': copyable ? '' : void 0,
|
|
35
36
|
className: cn(inlineCodeSnippetVariants({
|
|
36
37
|
size,
|
|
37
38
|
copyable
|
|
38
39
|
}), className),
|
|
39
40
|
...otherProps,
|
|
40
|
-
onClick: handleClick
|
|
41
|
+
onClick: handleClick
|
|
42
|
+
};
|
|
43
|
+
const codeElement = asChild && /*#__PURE__*/ isValidElement(children) ? /*#__PURE__*/ jsx(Slot, {
|
|
44
|
+
...sharedProps,
|
|
45
|
+
children: /*#__PURE__*/ cloneElement(children, {}, code)
|
|
46
|
+
}) : /*#__PURE__*/ jsx("code", {
|
|
47
|
+
...sharedProps,
|
|
41
48
|
children: code
|
|
42
49
|
});
|
|
43
50
|
if (!copyable) return codeElement;
|
|
@@ -10,11 +10,12 @@ export { CodeSnippetFullscreenButton, type CodeSnippetFullscreenButtonProps, } f
|
|
|
10
10
|
export { CodeSnippetHeader, type CodeSnippetHeaderProps } from './CodeSnippetHeader';
|
|
11
11
|
export { CodeSnippetLineNumbers, type CodeSnippetLineNumbersProps } from './CodeSnippetLineNumbers';
|
|
12
12
|
export { CodeSnippetRoot, type CodeSnippetRootProps } from './CodeSnippetRoot';
|
|
13
|
+
export { CodeSnippetShowMoreButton, type CodeSnippetShowMoreButtonProps, } from './CodeSnippetShowMoreButton';
|
|
13
14
|
export { CodeSnippetTab, type CodeSnippetTabProps } from './CodeSnippetTab';
|
|
14
15
|
export { CodeSnippetTabs, type CodeSnippetTabsProps } from './CodeSnippetTabs';
|
|
15
16
|
export { CodeSnippetTitle, type CodeSnippetTitleProps } from './CodeSnippetTitle';
|
|
16
17
|
export { CodeSnippetWrapButton, type CodeSnippetWrapButtonProps } from './CodeSnippetWrapButton';
|
|
17
18
|
export { useAdapter, useCodeSnippet } from './hooks';
|
|
18
19
|
export { InlineCodeSnippet, type InlineCodeSnippetProps } from './InlineCodeSnippet';
|
|
19
|
-
export { type FoldRegion } from './lib/foldUtils';
|
|
20
|
+
export { type FoldButtonProps, type FoldRegion } from './lib/foldUtils';
|
|
20
21
|
export { getHttpFolds, HTTP_FOLD_ID, type HttpFoldOptions, type HttpFoldSectionOptions, } from './lib/httpFolds';
|
|
@@ -8,6 +8,7 @@ import { CodeSnippetFullscreenButton } from "./CodeSnippetFullscreenButton.js";
|
|
|
8
8
|
import { CodeSnippetHeader } from "./CodeSnippetHeader.js";
|
|
9
9
|
import { CodeSnippetLineNumbers } from "./CodeSnippetLineNumbers.js";
|
|
10
10
|
import { CodeSnippetRoot } from "./CodeSnippetRoot.js";
|
|
11
|
+
import { CodeSnippetShowMoreButton } from "./CodeSnippetShowMoreButton.js";
|
|
11
12
|
import { CodeSnippetTab } from "./CodeSnippetTab.js";
|
|
12
13
|
import { CodeSnippetTabs } from "./CodeSnippetTabs.js";
|
|
13
14
|
import { CodeSnippetTitle } from "./CodeSnippetTitle.js";
|
|
@@ -15,4 +16,4 @@ import { CodeSnippetWrapButton } from "./CodeSnippetWrapButton.js";
|
|
|
15
16
|
import { useAdapter, useCodeSnippet } from "./hooks/index.js";
|
|
16
17
|
import { InlineCodeSnippet } from "./InlineCodeSnippet.js";
|
|
17
18
|
import { HTTP_FOLD_ID, getHttpFolds } from "./lib/httpFolds.js";
|
|
18
|
-
export { CodeSnippetActions, CodeSnippetAdapterProvider, CodeSnippetCode, CodeSnippetContent, CodeSnippetCopyButton, CodeSnippetFullscreenButton, CodeSnippetHeader, CodeSnippetLineNumbers, CodeSnippetRoot, CodeSnippetTab, CodeSnippetTabs, CodeSnippetTitle, CodeSnippetWrapButton, HTTP_FOLD_ID, InlineCodeSnippet, getHttpFolds, loadHighlightJsAdapter, loadPrismAdapter, loadShikiAdapter, plainAdapter, useAdapter, useCodeSnippet };
|
|
19
|
+
export { CodeSnippetActions, CodeSnippetAdapterProvider, CodeSnippetCode, CodeSnippetContent, CodeSnippetCopyButton, CodeSnippetFullscreenButton, CodeSnippetHeader, CodeSnippetLineNumbers, CodeSnippetRoot, CodeSnippetShowMoreButton, CodeSnippetTab, CodeSnippetTabs, CodeSnippetTitle, CodeSnippetWrapButton, HTTP_FOLD_ID, InlineCodeSnippet, getHttpFolds, loadHighlightJsAdapter, loadPrismAdapter, loadShikiAdapter, plainAdapter, useAdapter, useCodeSnippet };
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronDown } from "../../../icons/ChevronDown.js";
|
|
3
3
|
import { ChevronRight } from "../../../icons/ChevronRight.js";
|
|
4
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
5
|
import { getFoldSummaryLabel } from "../lib/foldUtils.js";
|
|
5
6
|
const FoldToggle = ({ fold, isCollapsed, onToggle })=>{
|
|
6
7
|
const lineCount = fold.endLine - fold.startLine + 1;
|
|
7
8
|
const label = getFoldSummaryLabel(fold, lineCount);
|
|
8
9
|
const ariaLabel = isCollapsed ? `Expand ${label}` : `Collapse ${label}`;
|
|
10
|
+
const { className, onClick, ...toggleProps } = fold.toggleProps ?? {};
|
|
11
|
+
const handleClick = (event)=>{
|
|
12
|
+
onToggle();
|
|
13
|
+
onClick?.(event);
|
|
14
|
+
};
|
|
9
15
|
return /*#__PURE__*/ jsx("button", {
|
|
10
16
|
type: "button",
|
|
11
|
-
className:
|
|
17
|
+
className: cn('flex items-center justify-center w-16 h-16 rounded-2 text-text-secondary hover:text-text-primary hover:bg-bg-secondary-hover transition-colors cursor-pointer', className),
|
|
12
18
|
"aria-expanded": !isCollapsed,
|
|
13
19
|
"aria-label": ariaLabel,
|
|
14
|
-
|
|
20
|
+
...toggleProps,
|
|
21
|
+
onClick: handleClick,
|
|
15
22
|
children: isCollapsed ? /*#__PURE__*/ jsx(ChevronRight, {}) : /*#__PURE__*/ jsx(ChevronDown, {})
|
|
16
23
|
});
|
|
17
24
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export type FoldButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;
|
|
1
3
|
export type FoldRegion = {
|
|
2
4
|
/** Unique identifier for this fold region */
|
|
3
5
|
id: string;
|
|
@@ -9,6 +11,10 @@ export type FoldRegion = {
|
|
|
9
11
|
label?: string;
|
|
10
12
|
/** Whether the fold starts collapsed. Default: false */
|
|
11
13
|
defaultCollapsed?: boolean;
|
|
14
|
+
/** Props forwarded to the fold gutter toggle button. */
|
|
15
|
+
toggleProps?: FoldButtonProps;
|
|
16
|
+
/** Props forwarded to the collapsed fold summary button. */
|
|
17
|
+
summaryProps?: FoldButtonProps;
|
|
12
18
|
};
|
|
13
19
|
export type DisplayItem = {
|
|
14
20
|
type: 'line';
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
1
|
+
import type { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import type { TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface DateRangeEndValueProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'color'>, TestableProps {
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* Renders the end date/time input field for a date range.
|
|
4
7
|
* Must be used within `DateRangeProvider` — `useDateRangeContext` will throw
|
|
5
8
|
* if rendered outside.
|
|
9
|
+
*
|
|
10
|
+
* Arbitrary HTML attributes (`data-analytics-id`, `data-analytics-props`,
|
|
11
|
+
* `data-testid`, `aria-*`, `id`, event handlers) land on the field's
|
|
12
|
+
* wrapper `<div>`, giving consumers a per-field analytics seam.
|
|
6
13
|
*/
|
|
7
|
-
export declare const DateRangeEndValue: FC
|
|
14
|
+
export declare const DateRangeEndValue: FC<DateRangeEndValueProps>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useDateRangeContext } from "./DateRangeContext/index.js";
|
|
3
3
|
import { DateRangeSegmentGroup } from "./DateRangeSegmentGroup.js";
|
|
4
|
-
const DateRangeEndValue = ()=>{
|
|
4
|
+
const DateRangeEndValue = (props)=>{
|
|
5
5
|
const { endFieldProps, endRef } = useDateRangeContext();
|
|
6
6
|
return /*#__PURE__*/ jsx(DateRangeSegmentGroup, {
|
|
7
7
|
...endFieldProps,
|
|
8
8
|
ref: endRef,
|
|
9
|
-
type: "end"
|
|
9
|
+
type: "end",
|
|
10
|
+
wrapperHtmlProps: props
|
|
10
11
|
});
|
|
11
12
|
};
|
|
12
13
|
DateRangeEndValue.displayName = 'DateRangeEndValue';
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { type FC, type Ref } from 'react';
|
|
1
|
+
import { type FC, type HTMLAttributes, type Ref } from 'react';
|
|
2
2
|
import type { AriaDatePickerProps, DateValue } from '@react-types/datepicker';
|
|
3
3
|
export interface DateRangeSegmentGroupProps extends AriaDatePickerProps<DateValue> {
|
|
4
4
|
type: 'start' | 'end';
|
|
5
5
|
/** Called when partial value presence changes (any editable segment is filled). */
|
|
6
6
|
onHasPartialValueChange?: (hasPartialValue: boolean) => void;
|
|
7
7
|
ref?: Ref<HTMLDivElement>;
|
|
8
|
+
/**
|
|
9
|
+
* Consumer HTML attributes (e.g. `data-analytics-id`, `data-analytics-props`,
|
|
10
|
+
* `data-testid`, `aria-*`, `id`) that land on the field's wrapper `<div>`.
|
|
11
|
+
* Provides the per-field analytics seam used by `DateRangeStartValue` and
|
|
12
|
+
* `DateRangeEndValue` in the compound API.
|
|
13
|
+
*/
|
|
14
|
+
wrapperHtmlProps?: HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
'data-testid'?: string;
|
|
16
|
+
'data-analytics-id'?: string;
|
|
17
|
+
'data-analytics-props'?: string;
|
|
18
|
+
};
|
|
8
19
|
}
|
|
9
20
|
export declare const DateRangeSegmentGroup: FC<DateRangeSegmentGroupProps>;
|
|
@@ -8,7 +8,7 @@ import { useDateFieldState } from "@react-stately/datepicker";
|
|
|
8
8
|
import { cn } from "../../utils/cn.js";
|
|
9
9
|
import { TemporalSegmentGroup, TimeDropdown, useTimeDropdownKeyCapture } from "../TemporalCore/index.js";
|
|
10
10
|
import { useDateRangeContext } from "./DateRangeContext/index.js";
|
|
11
|
-
const DateRangeSegmentGroup = ({ type, onHasPartialValueChange, ref, ...props })=>{
|
|
11
|
+
const DateRangeSegmentGroup = ({ type, onHasPartialValueChange, ref, wrapperHtmlProps, ...props })=>{
|
|
12
12
|
const { state: rangeState, disabled = false, error = false, readOnly = false, showTimeDropdown, timeStep = 30, hourCycle, icon } = useDateRangeContext();
|
|
13
13
|
const { locale } = useLocale();
|
|
14
14
|
const dropdownRef = useRef(null);
|
|
@@ -62,12 +62,30 @@ const DateRangeSegmentGroup = ({ type, onHasPartialValueChange, ref, ...props })
|
|
|
62
62
|
});
|
|
63
63
|
const currentTimeValue = fieldState.value && hasTimeSegments ? fieldState.value : null;
|
|
64
64
|
const hasIcon = Boolean(icon);
|
|
65
|
+
const { className: consumerClassName, onClick: consumerOnClick, onFocus: consumerOnFocus, onBlur: consumerOnBlur, onKeyDownCapture: consumerOnKeyDownCapture, ...consumerWrapperRest } = wrapperHtmlProps ?? {};
|
|
66
|
+
const composedOnClick = (event)=>{
|
|
67
|
+
consumerOnClick?.(event);
|
|
68
|
+
if (!event.defaultPrevented) handleClick();
|
|
69
|
+
};
|
|
70
|
+
const composedOnFocus = (event)=>{
|
|
71
|
+
consumerOnFocus?.(event);
|
|
72
|
+
if (!event.defaultPrevented) handleContainerFocus();
|
|
73
|
+
};
|
|
74
|
+
const composedOnBlur = (event)=>{
|
|
75
|
+
consumerOnBlur?.(event);
|
|
76
|
+
if (!event.defaultPrevented) handleContainerBlur(event);
|
|
77
|
+
};
|
|
78
|
+
const composedOnKeyDownCapture = (event)=>{
|
|
79
|
+
consumerOnKeyDownCapture?.(event);
|
|
80
|
+
if (!event.defaultPrevented) handleKeyDownCapture(event);
|
|
81
|
+
};
|
|
65
82
|
return /*#__PURE__*/ jsxs("div", {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
...consumerWrapperRest,
|
|
84
|
+
className: cn('relative h-full', !hasIcon && 'start' === type && 'pl-12', consumerClassName),
|
|
85
|
+
onKeyDownCapture: composedOnKeyDownCapture,
|
|
86
|
+
onClick: composedOnClick,
|
|
87
|
+
onFocus: composedOnFocus,
|
|
88
|
+
onBlur: composedOnBlur,
|
|
71
89
|
children: [
|
|
72
90
|
/*#__PURE__*/ jsx(TemporalSegmentGroup, {
|
|
73
91
|
...fieldProps,
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
1
|
+
import type { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import type { TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface DateRangeStartValueProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'color'>, TestableProps {
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* Renders the start date/time input field for a date range.
|
|
4
7
|
* Must be used within `DateRangeProvider` — `useDateRangeContext` will throw
|
|
5
8
|
* if rendered outside.
|
|
6
9
|
*
|
|
10
|
+
* Arbitrary HTML attributes (`data-analytics-id`, `data-analytics-props`,
|
|
11
|
+
* `data-testid`, `aria-*`, `id`, event handlers) land on the field's
|
|
12
|
+
* wrapper `<div>`, giving consumers a per-field analytics seam.
|
|
13
|
+
*
|
|
7
14
|
* @example
|
|
8
15
|
* <DateRangeProvider value={range} onChange={setRange}>
|
|
9
|
-
* <DateRangeStartValue />
|
|
16
|
+
* <DateRangeStartValue data-analytics-id='RANGE_START' />
|
|
10
17
|
* <DateRangeSeparator />
|
|
11
|
-
* <DateRangeEndValue />
|
|
18
|
+
* <DateRangeEndValue data-analytics-id='RANGE_END' />
|
|
12
19
|
* </DateRangeProvider>
|
|
13
20
|
*/
|
|
14
|
-
export declare const DateRangeStartValue: FC
|
|
21
|
+
export declare const DateRangeStartValue: FC<DateRangeStartValueProps>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useDateRangeContext } from "./DateRangeContext/index.js";
|
|
3
3
|
import { DateRangeSegmentGroup } from "./DateRangeSegmentGroup.js";
|
|
4
|
-
const DateRangeStartValue = ()=>{
|
|
4
|
+
const DateRangeStartValue = (props)=>{
|
|
5
5
|
const { startFieldProps, startRef } = useDateRangeContext();
|
|
6
6
|
return /*#__PURE__*/ jsx(DateRangeSegmentGroup, {
|
|
7
7
|
...startFieldProps,
|
|
8
8
|
ref: startRef,
|
|
9
|
-
type: "start"
|
|
9
|
+
type: "start",
|
|
10
|
+
wrapperHtmlProps: props
|
|
10
11
|
});
|
|
11
12
|
};
|
|
12
13
|
DateRangeStartValue.displayName = 'DateRangeStartValue';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DateRangeProvider, useDateRangeContext } from './DateRangeContext';
|
|
2
|
-
export { DateRangeEndValue } from './DateRangeEndValue';
|
|
2
|
+
export { DateRangeEndValue, type DateRangeEndValueProps } from './DateRangeEndValue';
|
|
3
3
|
export { DateRangeInput } from './DateRangeInput';
|
|
4
4
|
export { DateRangeSeparator } from './DateRangeSeparator';
|
|
5
|
-
export { DateRangeStartValue } from './DateRangeStartValue';
|
|
5
|
+
export { DateRangeStartValue, type DateRangeStartValueProps } from './DateRangeStartValue';
|
|
6
6
|
export type { DateRangeInputProps } from './types';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { DialogInteractOutsideEvent as DrawerInteractOutsideEvent } from '@ark-ui/react/dialog';
|
|
2
3
|
import { type TestableProps } from '../../utils/testId';
|
|
3
4
|
export interface DrawerProps extends TestableProps {
|
|
4
5
|
children: ReactNode;
|
|
@@ -20,5 +21,9 @@ export interface DrawerProps extends TestableProps {
|
|
|
20
21
|
minWidth?: number;
|
|
21
22
|
/** Maximum width in pixels */
|
|
22
23
|
maxWidth?: number;
|
|
24
|
+
/** Fired when the user interacts outside the drawer (e.g. clicks the backdrop). */
|
|
25
|
+
onInteractOutside?: (event: DrawerInteractOutsideEvent) => void;
|
|
26
|
+
/** Fired when the user presses the Escape key while the drawer is open. */
|
|
27
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
23
28
|
}
|
|
24
29
|
export declare const Drawer: FC<DrawerProps>;
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { TestIdProvider } from "../../utils/testId.js";
|
|
3
3
|
import { DrawerProvider } from "./DrawerContext/index.js";
|
|
4
4
|
import { DrawerRoot } from "./DrawerRoot.js";
|
|
5
|
-
const Drawer = ({ children, open, onOpenChange, closeOnEscape = true, closeOnOutsideClick = true, overlay = true, modal = true, width, minWidth, maxWidth, 'data-testid': testId })=>/*#__PURE__*/ jsx(DrawerProvider, {
|
|
5
|
+
const Drawer = ({ children, open, onOpenChange, closeOnEscape = true, closeOnOutsideClick = true, overlay = true, modal = true, width, minWidth, maxWidth, onInteractOutside, onEscapeKeyDown, 'data-testid': testId })=>/*#__PURE__*/ jsx(DrawerProvider, {
|
|
6
6
|
open: open,
|
|
7
7
|
onOpenChange: onOpenChange,
|
|
8
8
|
closeOnEscape: closeOnEscape,
|
|
@@ -15,6 +15,8 @@ const Drawer = ({ children, open, onOpenChange, closeOnEscape = true, closeOnOut
|
|
|
15
15
|
closeOnEscape: closeOnEscape,
|
|
16
16
|
closeOnOutsideClick: closeOnOutsideClick,
|
|
17
17
|
modal: modal,
|
|
18
|
+
onInteractOutside: onInteractOutside,
|
|
19
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
18
20
|
children: /*#__PURE__*/ jsx(TestIdProvider, {
|
|
19
21
|
value: testId,
|
|
20
22
|
children: children
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { FC, ReactNode, Ref } from 'react';
|
|
2
|
-
|
|
1
|
+
import type { ButtonHTMLAttributes, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface DrawerCloseProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'>, TestableProps {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
/** Render as child component */
|
|
5
6
|
asChild?: boolean;
|
|
@@ -6,15 +6,17 @@ import { Button } from "../Button/index.js";
|
|
|
6
6
|
import { Kbd } from "../Kbd/index.js";
|
|
7
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip/index.js";
|
|
8
8
|
import { useDrawerContext } from "./DrawerContext/index.js";
|
|
9
|
-
const DrawerClose = ({ children, asChild = false, ref })=>{
|
|
10
|
-
const testId = useTestId('close');
|
|
9
|
+
const DrawerClose = ({ children, asChild = false, ref, 'data-testid': testIdProp, ...rest })=>{
|
|
10
|
+
const testId = useTestId('close', testIdProp);
|
|
11
11
|
const { closeOnEscape } = useDrawerContext();
|
|
12
12
|
const handleFocusCapture = (event)=>{
|
|
13
13
|
event.stopPropagation();
|
|
14
14
|
};
|
|
15
15
|
if (asChild) return /*#__PURE__*/ jsx(Dialog.CloseTrigger, {
|
|
16
|
+
...rest,
|
|
16
17
|
ref: ref,
|
|
17
18
|
asChild: true,
|
|
19
|
+
"data-testid": testIdProp,
|
|
18
20
|
children: children
|
|
19
21
|
});
|
|
20
22
|
return /*#__PURE__*/ jsxs(Tooltip, {
|
|
@@ -26,11 +28,12 @@ const DrawerClose = ({ children, asChild = false, ref })=>{
|
|
|
26
28
|
onFocusCapture: handleFocusCapture,
|
|
27
29
|
children: /*#__PURE__*/ jsx(Button, {
|
|
28
30
|
ref: ref,
|
|
29
|
-
"data-testid": testId,
|
|
30
31
|
variant: "ghost",
|
|
31
32
|
color: "neutral",
|
|
32
33
|
size: "small",
|
|
33
34
|
"aria-label": "Close drawer",
|
|
35
|
+
...rest,
|
|
36
|
+
"data-testid": testId,
|
|
34
37
|
children: children || /*#__PURE__*/ jsx(X, {})
|
|
35
38
|
})
|
|
36
39
|
})
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children, isValidElement } from "react";
|
|
2
3
|
import { cn } from "../../utils/cn.js";
|
|
3
4
|
import { useTestId } from "../../utils/testId.js";
|
|
4
5
|
import { DrawerClose } from "./DrawerClose.js";
|
|
6
|
+
const isDrawerClose = (child)=>/*#__PURE__*/ isValidElement(child) && child.type === DrawerClose;
|
|
5
7
|
const DrawerHeader = ({ children, ref })=>{
|
|
6
8
|
const testId = useTestId('header');
|
|
9
|
+
const hasExplicitClose = Children.toArray(children).some(isDrawerClose);
|
|
7
10
|
return /*#__PURE__*/ jsxs("div", {
|
|
8
11
|
ref: ref,
|
|
9
12
|
"data-testid": testId,
|
|
@@ -11,7 +14,7 @@ const DrawerHeader = ({ children, ref })=>{
|
|
|
11
14
|
className: cn('relative shrink-0 w-full', 'bg-bg-surface-2', 'flex items-start justify-between gap-12', 'pt-16 pb-12 pl-24 pr-16', 'rounded-t-12', 'outline-none'),
|
|
12
15
|
children: [
|
|
13
16
|
children,
|
|
14
|
-
/*#__PURE__*/ jsx(DrawerClose, {})
|
|
17
|
+
!hasExplicitClose && /*#__PURE__*/ jsx(DrawerClose, {})
|
|
15
18
|
]
|
|
16
19
|
});
|
|
17
20
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { type FC, type Ref } from 'react';
|
|
2
|
-
|
|
1
|
+
import { type ButtonHTMLAttributes, type FC, type Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface DrawerResizeHandleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'>, TestableProps {
|
|
3
4
|
ref?: Ref<HTMLButtonElement>;
|
|
5
|
+
/** Fired when the user starts dragging the resize handle. */
|
|
6
|
+
onResizeStart?: () => void;
|
|
7
|
+
/** Fired when the user releases the resize handle, with the final pixel width. */
|
|
8
|
+
onResizeEnd?: (width: number) => void;
|
|
4
9
|
}
|
|
5
10
|
export declare const DrawerResizeHandle: FC<DrawerResizeHandleProps>;
|
|
@@ -3,6 +3,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { throttle } from "lodash-es";
|
|
5
5
|
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { useTestId } from "../../utils/testId.js";
|
|
6
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip/index.js";
|
|
7
8
|
import { useDrawerContext } from "./DrawerContext/index.js";
|
|
8
9
|
const drawerResizeHandleVariants = cva(cn('absolute left-0 top-0 bottom-0 z-1', '-translate-x-1/2', 'w-12 py-12', 'outline-none cursor-col-resize', 'flex items-center justify-center', 'before:content-[""]', 'before:block', 'before:w-3 before:h-full', 'before:rounded-full', 'before:bg-bg-fill-brand', 'before:transition-opacity before:duration-150'), {
|
|
@@ -13,33 +14,54 @@ const drawerResizeHandleVariants = cva(cn('absolute left-0 top-0 bottom-0 z-1',
|
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
});
|
|
16
|
-
const DrawerResizeHandle = ({ ref })=>{
|
|
17
|
+
const DrawerResizeHandle = ({ ref, 'data-testid': testIdProp, onResizeStart, onResizeEnd, onMouseEnter, onMouseLeave, onMouseDown, className, ...rest })=>{
|
|
17
18
|
const { setWidth, setIsResizing, minWidth, maxWidth } = useDrawerContext();
|
|
19
|
+
const testId = useTestId('resize-handle', testIdProp);
|
|
18
20
|
const [isHovered, setIsHovered] = useState(false);
|
|
19
21
|
const [isDragging, setIsDragging] = useState(false);
|
|
20
22
|
const dragStateRef = useRef({
|
|
21
23
|
startX: 0,
|
|
22
|
-
startWidth: 0
|
|
24
|
+
startWidth: 0,
|
|
25
|
+
currentWidth: 0
|
|
23
26
|
});
|
|
24
|
-
const
|
|
25
|
-
|
|
27
|
+
const onResizeEndRef = useRef(onResizeEnd);
|
|
28
|
+
useEffect(()=>{
|
|
29
|
+
onResizeEndRef.current = onResizeEnd;
|
|
30
|
+
}, [
|
|
31
|
+
onResizeEnd
|
|
32
|
+
]);
|
|
33
|
+
const handleMouseEnter = (e)=>{
|
|
34
|
+
onMouseEnter?.(e);
|
|
35
|
+
if (e.defaultPrevented) return;
|
|
36
|
+
setIsHovered(true);
|
|
37
|
+
};
|
|
38
|
+
const handleMouseLeave = (e)=>{
|
|
39
|
+
onMouseLeave?.(e);
|
|
40
|
+
if (e.defaultPrevented) return;
|
|
41
|
+
setIsHovered(false);
|
|
42
|
+
};
|
|
26
43
|
const handleMouseDown = (e)=>{
|
|
44
|
+
onMouseDown?.(e);
|
|
45
|
+
if (e.defaultPrevented) return;
|
|
27
46
|
e.preventDefault();
|
|
28
47
|
const drawerContent = e.currentTarget.closest('[role="dialog"]');
|
|
29
48
|
if (!drawerContent) return;
|
|
30
49
|
const currentWidth = drawerContent.offsetWidth;
|
|
31
50
|
dragStateRef.current = {
|
|
32
51
|
startX: e.clientX,
|
|
33
|
-
startWidth: currentWidth
|
|
52
|
+
startWidth: currentWidth,
|
|
53
|
+
currentWidth
|
|
34
54
|
};
|
|
35
55
|
setIsDragging(true);
|
|
36
56
|
setIsResizing(true);
|
|
57
|
+
onResizeStart?.();
|
|
37
58
|
};
|
|
38
59
|
const handleMouseMove = useMemo(()=>throttle((e)=>{
|
|
39
60
|
const { startX, startWidth } = dragStateRef.current;
|
|
40
61
|
const delta = startX - e.clientX;
|
|
41
62
|
const newWidth = Math.min(Math.max(startWidth + delta, minWidth), maxWidth);
|
|
42
63
|
setWidth(newWidth);
|
|
64
|
+
dragStateRef.current.currentWidth = newWidth;
|
|
43
65
|
}, 16), [
|
|
44
66
|
minWidth,
|
|
45
67
|
maxWidth,
|
|
@@ -51,6 +73,7 @@ const DrawerResizeHandle = ({ ref })=>{
|
|
|
51
73
|
setIsDragging(false);
|
|
52
74
|
setIsResizing(false);
|
|
53
75
|
handleMouseMove.cancel();
|
|
76
|
+
onResizeEndRef.current?.(dragStateRef.current.currentWidth);
|
|
54
77
|
};
|
|
55
78
|
document.addEventListener('mousemove', handleMouseMove);
|
|
56
79
|
document.addEventListener('mouseup', handleMouseUp);
|
|
@@ -72,12 +95,14 @@ const DrawerResizeHandle = ({ ref })=>{
|
|
|
72
95
|
open: isHovered && !isDragging,
|
|
73
96
|
children: [
|
|
74
97
|
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
98
|
+
...rest,
|
|
75
99
|
ref: ref,
|
|
76
100
|
"data-slot": "resize-handle",
|
|
77
101
|
"data-resizing": isDragging || void 0,
|
|
102
|
+
"data-testid": testId,
|
|
78
103
|
className: cn(drawerResizeHandleVariants({
|
|
79
104
|
barIsVisible
|
|
80
|
-
})),
|
|
105
|
+
}), className),
|
|
81
106
|
onMouseEnter: handleMouseEnter,
|
|
82
107
|
onMouseLeave: handleMouseLeave,
|
|
83
108
|
onMouseDown: handleMouseDown
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import { type DialogInteractOutsideEvent as DrawerInteractOutsideEvent } from '@ark-ui/react/dialog';
|
|
2
3
|
interface DrawerRootProps {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
closeOnEscape: boolean;
|
|
5
6
|
closeOnOutsideClick: boolean;
|
|
6
7
|
modal: boolean;
|
|
8
|
+
onInteractOutside?: (event: DrawerInteractOutsideEvent) => void;
|
|
9
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
7
10
|
}
|
|
8
11
|
export declare const DrawerRoot: FC<DrawerRootProps>;
|
|
9
12
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Dialog } from "@ark-ui/react/dialog";
|
|
3
3
|
import { useDrawerContext } from "./DrawerContext/index.js";
|
|
4
|
-
const DrawerRoot = ({ children, closeOnEscape, closeOnOutsideClick, modal })=>{
|
|
4
|
+
const DrawerRoot = ({ children, closeOnEscape, closeOnOutsideClick, modal, onInteractOutside, onEscapeKeyDown })=>{
|
|
5
5
|
const { isOpen, onOpenChange } = useDrawerContext();
|
|
6
6
|
const handleOpenChange = ({ open })=>{
|
|
7
7
|
onOpenChange(open);
|
|
@@ -12,6 +12,8 @@ const DrawerRoot = ({ children, closeOnEscape, closeOnOutsideClick, modal })=>{
|
|
|
12
12
|
closeOnEscape: closeOnEscape,
|
|
13
13
|
closeOnInteractOutside: closeOnOutsideClick,
|
|
14
14
|
modal: modal,
|
|
15
|
+
onInteractOutside: onInteractOutside,
|
|
16
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
15
17
|
lazyMount: true,
|
|
16
18
|
unmountOnExit: true,
|
|
17
19
|
children: children
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { FC, ReactNode, Ref } from 'react';
|
|
2
|
-
|
|
1
|
+
import type { ButtonHTMLAttributes, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface DrawerTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'>, TestableProps {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
/** Render as child component */
|
|
5
6
|
asChild?: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Dialog } from "@ark-ui/react/dialog";
|
|
3
3
|
import { useTestId } from "../../utils/testId.js";
|
|
4
|
-
const DrawerTrigger = ({ children, asChild = false, ref })=>{
|
|
5
|
-
const testId = useTestId('trigger');
|
|
4
|
+
const DrawerTrigger = ({ children, asChild = false, ref, 'data-testid': testIdProp, ...rest })=>{
|
|
5
|
+
const testId = useTestId('trigger', testIdProp);
|
|
6
6
|
return /*#__PURE__*/ jsx(Dialog.Trigger, {
|
|
7
|
+
...rest,
|
|
7
8
|
ref: ref,
|
|
8
9
|
"data-testid": testId,
|
|
9
10
|
asChild: asChild,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { DialogInteractOutsideEvent as DrawerInteractOutsideEvent } from '@ark-ui/react/dialog';
|
|
1
2
|
export { drawerContentVariants, drawerPositionerVariants } from './classes';
|
|
2
3
|
export { Drawer, type DrawerProps } from './Drawer';
|
|
3
4
|
export { DrawerBody, type DrawerBodyProps } from './DrawerBody';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type FC, type HTMLAttributes, type Ref } from 'react';
|
|
2
2
|
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
4
|
import { dropdownMenuItemVariants } from './classes';
|
|
4
5
|
type DropdownMenuCheckboxItemVariantsProps = VariantProps<typeof dropdownMenuItemVariants>;
|
|
5
|
-
export interface DropdownMenuCheckboxItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'>, DropdownMenuCheckboxItemVariantsProps {
|
|
6
|
+
export interface DropdownMenuCheckboxItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'>, DropdownMenuCheckboxItemVariantsProps, TestableProps {
|
|
6
7
|
checked: boolean;
|
|
7
8
|
onCheckedChange?: (checked: boolean) => void;
|
|
8
9
|
/** Optional — auto-generated via useId() if omitted */
|
|
@@ -6,9 +6,9 @@ import { cn } from "../../utils/cn.js";
|
|
|
6
6
|
import { useTestId } from "../../utils/testId.js";
|
|
7
7
|
import { dropdownMenuItemVariants } from "./classes.js";
|
|
8
8
|
import { DropdownMenuItemIndicator } from "./DropdownMenuItemIndicator.js";
|
|
9
|
-
const DropdownMenuCheckboxItem = ({ children, checked, onCheckedChange, value, disabled, closeOnSelect, variant = 'default', className, ...props })=>{
|
|
9
|
+
const DropdownMenuCheckboxItem = ({ children, checked, onCheckedChange, value, disabled, closeOnSelect, variant = 'default', className, 'data-testid': testIdProp, ...props })=>{
|
|
10
10
|
const autoId = useId();
|
|
11
|
-
const testId = useTestId('checkbox-item');
|
|
11
|
+
const testId = useTestId('checkbox-item', testIdProp);
|
|
12
12
|
return /*#__PURE__*/ jsxs(Menu.CheckboxItem, {
|
|
13
13
|
...props,
|
|
14
14
|
value: value ?? autoId,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
interface DropdownMenuContextTriggerProps extends
|
|
1
|
+
import type { ButtonHTMLAttributes, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface DropdownMenuContextTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'>, TestableProps {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
asChild?: boolean;
|
|
6
|
-
inset?: boolean;
|
|
7
6
|
ref?: Ref<HTMLButtonElement>;
|
|
8
7
|
}
|
|
9
8
|
export declare const DropdownMenuContextTrigger: FC<DropdownMenuContextTriggerProps>;
|
|
10
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Menu } from "@ark-ui/react/menu";
|
|
3
3
|
import { useTestId } from "../../utils/testId.js";
|
|
4
|
-
const DropdownMenuContextTrigger = ({
|
|
5
|
-
const testId = useTestId('context-trigger');
|
|
4
|
+
const DropdownMenuContextTrigger = ({ children, 'data-testid': testIdProp, ...props })=>{
|
|
5
|
+
const testId = useTestId('context-trigger', testIdProp);
|
|
6
6
|
return /*#__PURE__*/ jsx(Menu.ContextTrigger, {
|
|
7
7
|
...props,
|
|
8
8
|
"data-testid": testId,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type FC, type HTMLAttributes, type Ref } from 'react';
|
|
2
2
|
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
4
|
import { dropdownMenuItemVariants } from './classes';
|
|
4
5
|
export type DropdownMenuItemVariantsProps = VariantProps<typeof dropdownMenuItemVariants>;
|
|
5
|
-
export interface DropdownMenuItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'>, DropdownMenuItemVariantsProps {
|
|
6
|
+
export interface DropdownMenuItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'>, DropdownMenuItemVariantsProps, TestableProps {
|
|
6
7
|
inset?: boolean;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
onSelect?: () => void;
|