@wallarm-org/design-system 0.62.0 → 0.64.0-rc-feature-WDS-73-empty.1
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/AnimatedBackground/AnimatedBackground.js +1 -1
- 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/EmptyState/EmptyState.d.ts +10 -0
- package/dist/components/EmptyState/EmptyState.js +20 -0
- package/dist/components/EmptyState/EmptyStateActions.d.ts +6 -0
- package/dist/components/EmptyState/EmptyStateActions.js +16 -0
- package/dist/components/EmptyState/EmptyStateDescription.d.ts +6 -0
- package/dist/components/EmptyState/EmptyStateDescription.js +18 -0
- package/dist/components/EmptyState/EmptyStateIllustration.d.ts +6 -0
- package/dist/components/EmptyState/EmptyStateIllustration.js +16 -0
- package/dist/components/EmptyState/EmptyStateLink.d.ts +4 -0
- package/dist/components/EmptyState/EmptyStateLink.js +14 -0
- package/dist/components/EmptyState/EmptyStateMessage.d.ts +6 -0
- package/dist/components/EmptyState/EmptyStateMessage.js +16 -0
- package/dist/components/EmptyState/EmptyStateTitle.d.ts +6 -0
- package/dist/components/EmptyState/EmptyStateTitle.js +16 -0
- package/dist/components/EmptyState/classes.d.ts +4 -0
- package/dist/components/EmptyState/classes.js +13 -0
- package/dist/components/EmptyState/index.d.ts +8 -0
- package/dist/components/EmptyState/index.js +8 -0
- 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/SelectEmptyState.js +7 -8
- 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/SelectPositioner.js +1 -1
- 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 +3 -2
- package/dist/index.js +4 -3
- package/dist/metadata/components.json +32205 -16896
- package/dist/theme/fonts/GeistPixel-Square.woff2 +0 -0
- package/dist/theme/fonts/geist-pixel.css +7 -0
- package/dist/theme/index.css +1 -0
- package/dist/theme/typography.css +1 -0
- 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
|
@@ -99,7 +99,7 @@ const AnimatedBackground = (props)=>{
|
|
|
99
99
|
"data-slot": "animated-background",
|
|
100
100
|
...rest,
|
|
101
101
|
ref: ref,
|
|
102
|
-
className: cn('relative', className),
|
|
102
|
+
className: cn('relative h-full w-full', className),
|
|
103
103
|
children: [
|
|
104
104
|
/*#__PURE__*/ jsx("canvas", {
|
|
105
105
|
ref: canvasRef,
|
|
@@ -34,6 +34,7 @@ const BreadcrumbsItem = ({ className, isCurrent = false, href, children, onClick
|
|
|
34
34
|
return /*#__PURE__*/ jsx("li", {
|
|
35
35
|
children: isLink ? /*#__PURE__*/ jsx("a", {
|
|
36
36
|
href: href,
|
|
37
|
+
onClick: onClick,
|
|
37
38
|
className: commonClasses,
|
|
38
39
|
"aria-label": ariaLabel,
|
|
39
40
|
"data-testid": testId,
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import type { FC, Ref } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
onSelectAll: () => void;
|
|
6
|
-
onClear: () => void;
|
|
7
|
-
/**
|
|
8
|
-
* When true, prevent the summary from wrapping or being truncated by the
|
|
9
|
-
* container: truncate the "X selected" text and keep the Select-all link on
|
|
10
|
-
* a single line. Use when the bar can shrink (e.g. inside a Drawer).
|
|
11
|
-
* Defaults to `false` — actions then rely on the parent for layout.
|
|
12
|
-
*/
|
|
13
|
-
nowrap?: boolean;
|
|
14
|
-
'data-testid'?: string;
|
|
1
|
+
import type { ComponentPropsWithoutRef, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface BulkBarSummaryProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'>, TestableProps {
|
|
4
|
+
children: ReactNode;
|
|
15
5
|
ref?: Ref<HTMLDivElement>;
|
|
16
6
|
}
|
|
17
7
|
export declare const BulkBarSummary: FC<BulkBarSummaryProps>;
|
|
@@ -1,50 +1,19 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
truncate: nowrap,
|
|
17
|
-
children: [
|
|
18
|
-
count,
|
|
19
|
-
" selected"
|
|
20
|
-
]
|
|
21
|
-
}),
|
|
22
|
-
/*#__PURE__*/ jsxs(HStack, {
|
|
23
|
-
gap: 6,
|
|
24
|
-
children: [
|
|
25
|
-
/*#__PURE__*/ jsx(Link, {
|
|
26
|
-
type: isAllSelected ? 'muted' : 'alt',
|
|
27
|
-
size: "md",
|
|
28
|
-
onClick: onSelectAll,
|
|
29
|
-
disabled: isAllSelected,
|
|
30
|
-
className: cn(nowrap && 'whitespace-nowrap'),
|
|
31
|
-
children: "Select all"
|
|
32
|
-
}),
|
|
33
|
-
/*#__PURE__*/ jsx(Text, {
|
|
34
|
-
size: "sm",
|
|
35
|
-
color: "tertiary-alt",
|
|
36
|
-
weight: "medium",
|
|
37
|
-
children: "\xb7"
|
|
38
|
-
}),
|
|
39
|
-
/*#__PURE__*/ jsx(Link, {
|
|
40
|
-
type: "alt",
|
|
41
|
-
size: "md",
|
|
42
|
-
onClick: onClear,
|
|
43
|
-
children: "Clear"
|
|
44
|
-
})
|
|
45
|
-
]
|
|
46
|
-
})
|
|
47
|
-
]
|
|
3
|
+
import { TestIdProvider, useTestId } from "../../utils/testId.js";
|
|
4
|
+
const BulkBarSummary = ({ children, className, ref, 'data-testid': testIdProp, ...rest })=>{
|
|
5
|
+
const testId = useTestId('bulk-bar-summary', testIdProp);
|
|
6
|
+
return /*#__PURE__*/ jsx(TestIdProvider, {
|
|
7
|
+
value: testId,
|
|
8
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
9
|
+
...rest,
|
|
10
|
+
ref: ref,
|
|
11
|
+
"data-slot": "bulk-bar-summary",
|
|
12
|
+
"data-testid": testId,
|
|
13
|
+
className: cn('flex items-center gap-16 p-8', className),
|
|
14
|
+
children: children
|
|
15
|
+
})
|
|
48
16
|
});
|
|
17
|
+
};
|
|
49
18
|
BulkBarSummary.displayName = 'BulkBarSummary';
|
|
50
19
|
export { BulkBarSummary };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface BulkBarSummaryClearProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color' | 'type'>, TestableProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
ref?: Ref<HTMLButtonElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare const BulkBarSummaryClear: FC<BulkBarSummaryClearProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { useTestId } from "../../utils/testId.js";
|
|
4
|
+
import { linkVariants } from "../Link/index.js";
|
|
5
|
+
const DEFAULT_LABEL = 'Clear';
|
|
6
|
+
const BulkBarSummaryClear = ({ children, disabled = false, className, 'data-testid': testIdProp, ref, ...rest })=>{
|
|
7
|
+
const testId = useTestId('clear', testIdProp);
|
|
8
|
+
return /*#__PURE__*/ jsx("button", {
|
|
9
|
+
...rest,
|
|
10
|
+
type: "button",
|
|
11
|
+
ref: ref,
|
|
12
|
+
disabled: disabled,
|
|
13
|
+
"data-slot": "bulk-bar-summary-clear",
|
|
14
|
+
"data-testid": testId,
|
|
15
|
+
className: cn(linkVariants({
|
|
16
|
+
type: 'alt',
|
|
17
|
+
size: 'md',
|
|
18
|
+
weight: 'regular',
|
|
19
|
+
disabled
|
|
20
|
+
}), 'whitespace-nowrap', className),
|
|
21
|
+
children: children ?? DEFAULT_LABEL
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
BulkBarSummaryClear.displayName = 'BulkBarSummaryClear';
|
|
25
|
+
export { BulkBarSummaryClear };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
import { Text } from '../Text';
|
|
4
|
+
type TextOwnProps = Pick<ComponentPropsWithoutRef<typeof Text>, 'size' | 'color' | 'weight'>;
|
|
5
|
+
export interface BulkBarSummaryCountProps extends Omit<ComponentPropsWithoutRef<'p'>, 'children' | 'color'>, TextOwnProps, TestableProps {
|
|
6
|
+
/** Renders the default "{count} selected" label. */
|
|
7
|
+
count?: number;
|
|
8
|
+
/** Override the entire content (e.g. "5 hosts" instead of "5 selected"). */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
11
|
+
}
|
|
12
|
+
export declare const BulkBarSummaryCount: FC<BulkBarSummaryCountProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTestId } from "../../utils/testId.js";
|
|
3
|
+
import { Text } from "../Text/index.js";
|
|
4
|
+
const BulkBarSummaryCount = ({ count, children, size = 'sm', color = 'primary-alt', weight = 'medium', 'data-testid': testIdProp, ...rest })=>{
|
|
5
|
+
const testId = useTestId('count', testIdProp);
|
|
6
|
+
return /*#__PURE__*/ jsx(Text, {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-slot": "bulk-bar-summary-count",
|
|
9
|
+
"data-testid": testId,
|
|
10
|
+
size: size,
|
|
11
|
+
color: color,
|
|
12
|
+
weight: weight,
|
|
13
|
+
truncate: true,
|
|
14
|
+
children: children ?? `${count ?? 0} selected`
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
BulkBarSummaryCount.displayName = 'BulkBarSummaryCount';
|
|
18
|
+
export { BulkBarSummaryCount };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface BulkBarSummarySelectAllProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color' | 'type'>, TestableProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
ref?: Ref<HTMLButtonElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare const BulkBarSummarySelectAll: FC<BulkBarSummarySelectAllProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { useTestId } from "../../utils/testId.js";
|
|
4
|
+
import { linkVariants } from "../Link/index.js";
|
|
5
|
+
const DEFAULT_LABEL = 'Select all';
|
|
6
|
+
const BulkBarSummarySelectAll = ({ children, disabled = false, className, 'data-testid': testIdProp, ref, ...rest })=>{
|
|
7
|
+
const testId = useTestId('select-all', testIdProp);
|
|
8
|
+
return /*#__PURE__*/ jsx("button", {
|
|
9
|
+
...rest,
|
|
10
|
+
type: "button",
|
|
11
|
+
ref: ref,
|
|
12
|
+
disabled: disabled,
|
|
13
|
+
"data-slot": "bulk-bar-summary-select-all",
|
|
14
|
+
"data-testid": testId,
|
|
15
|
+
className: cn(linkVariants({
|
|
16
|
+
type: disabled ? 'muted' : 'alt',
|
|
17
|
+
size: 'md',
|
|
18
|
+
weight: 'regular',
|
|
19
|
+
disabled
|
|
20
|
+
}), 'whitespace-nowrap', className),
|
|
21
|
+
children: children ?? DEFAULT_LABEL
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
BulkBarSummarySelectAll.displayName = 'BulkBarSummarySelectAll';
|
|
25
|
+
export { BulkBarSummarySelectAll };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Decorative middot between summary actions. No interactive role and no
|
|
4
|
+
* accessible content — screen readers should skip it. Place it inside an
|
|
5
|
+
* `<HStack gap={6}>` together with the surrounding action links to keep
|
|
6
|
+
* "Select all · Clear" reading as a single grouped phrase.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BulkBarSummarySeparator: FC;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "../Text/index.js";
|
|
3
|
+
const BulkBarSummarySeparator = ()=>/*#__PURE__*/ jsx(Text, {
|
|
4
|
+
size: "sm",
|
|
5
|
+
color: "tertiary-alt",
|
|
6
|
+
weight: "medium",
|
|
7
|
+
"aria-hidden": "true",
|
|
8
|
+
"data-slot": "bulk-bar-summary-separator",
|
|
9
|
+
children: "\xb7"
|
|
10
|
+
});
|
|
11
|
+
BulkBarSummarySeparator.displayName = 'BulkBarSummarySeparator';
|
|
12
|
+
export { BulkBarSummarySeparator };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { BulkBarSummary, type BulkBarSummaryProps } from './BulkBarSummary';
|
|
2
|
+
export { BulkBarSummaryClear, type BulkBarSummaryClearProps } from './BulkBarSummaryClear';
|
|
3
|
+
export { BulkBarSummaryCount, type BulkBarSummaryCountProps } from './BulkBarSummaryCount';
|
|
4
|
+
export { BulkBarSummarySelectAll, type BulkBarSummarySelectAllProps, } from './BulkBarSummarySelectAll';
|
|
5
|
+
export { BulkBarSummarySeparator } from './BulkBarSummarySeparator';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BulkBarSummary } from "./BulkBarSummary.js";
|
|
2
|
+
import { BulkBarSummaryClear } from "./BulkBarSummaryClear.js";
|
|
3
|
+
import { BulkBarSummaryCount } from "./BulkBarSummaryCount.js";
|
|
4
|
+
import { BulkBarSummarySelectAll } from "./BulkBarSummarySelectAll.js";
|
|
5
|
+
import { BulkBarSummarySeparator } from "./BulkBarSummarySeparator.js";
|
|
6
|
+
export { BulkBarSummary, BulkBarSummaryClear, BulkBarSummaryCount, BulkBarSummarySelectAll, BulkBarSummarySeparator };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
1
|
+
import type { ButtonHTMLAttributes, FC } from 'react';
|
|
2
|
+
import type { TestableProps } from '../../utils/testId';
|
|
2
3
|
import type { PresetValue } from './types';
|
|
3
|
-
interface CalendarPresetItemProps {
|
|
4
|
+
export interface CalendarPresetItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color' | 'type' | 'value'>, TestableProps {
|
|
4
5
|
/** Display label for the preset */
|
|
5
6
|
label: string;
|
|
6
7
|
/** Preset value - dates array or named preset string */
|
|
@@ -13,6 +14,11 @@ interface CalendarPresetItemProps {
|
|
|
13
14
|
/**
|
|
14
15
|
* Individual preset item in the presets sidebar.
|
|
15
16
|
* Triggers date selection when clicked without closing the calendar.
|
|
17
|
+
*
|
|
18
|
+
* Arbitrary HTML attributes (`data-analytics-id`, `data-analytics-props`,
|
|
19
|
+
* `data-testid`, `aria-*`, `id`, `onClick`) land on the rendered `<button>`.
|
|
20
|
+
* Consumer's `onClick` runs after the internal preset-selection logic
|
|
21
|
+
* (it cannot cancel the selection because the preset semantics are owned
|
|
22
|
+
* by the DS — consumers track *that* the preset was clicked).
|
|
16
23
|
*/
|
|
17
24
|
export declare const CalendarPresetItem: FC<CalendarPresetItemProps>;
|
|
18
|
-
export {};
|
|
@@ -2,20 +2,23 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { DatePicker } from "@ark-ui/react";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { useCalendarContext } from "./CalendarContext.js";
|
|
5
|
-
const CalendarPresetItem = ({ label, value, shortcut, showShortcut = true })=>{
|
|
5
|
+
const CalendarPresetItem = ({ label, value, shortcut, showShortcut = true, onClick: consumerOnClick, className, disabled: consumerDisabled, ...rest })=>{
|
|
6
6
|
const { readonly } = useCalendarContext();
|
|
7
|
+
const isDisabled = readonly || consumerDisabled;
|
|
7
8
|
return /*#__PURE__*/ jsx(DatePicker.Context, {
|
|
8
9
|
children: (api)=>/*#__PURE__*/ jsxs("button", {
|
|
10
|
+
...rest,
|
|
9
11
|
type: "button",
|
|
10
|
-
disabled:
|
|
11
|
-
onClick: ()=>{
|
|
12
|
-
if (
|
|
12
|
+
disabled: isDisabled,
|
|
13
|
+
onClick: (event)=>{
|
|
14
|
+
if (isDisabled) return;
|
|
13
15
|
if ('string' == typeof value) {
|
|
14
16
|
const rangeValue = api.getRangePresetValue(value);
|
|
15
17
|
api.setValue(rangeValue);
|
|
16
18
|
} else api.setValue(value);
|
|
19
|
+
consumerOnClick?.(event);
|
|
17
20
|
},
|
|
18
|
-
className: cn('flex items-center justify-between', 'w-full px-8 py-6 rounded-6', 'font-sans font-normal text-sm leading-sm text-text-primary', 'select-none', 'transition-colors', 'outline-none focus-visible:ring-3 focus-visible:ring-focus-primary',
|
|
21
|
+
className: cn('flex items-center justify-between', 'w-full px-8 py-6 rounded-6', 'font-sans font-normal text-sm leading-sm text-text-primary', 'select-none', 'transition-colors', 'outline-none focus-visible:ring-3 focus-visible:ring-focus-primary', isDisabled ? 'cursor-default opacity-50' : 'cursor-pointer hover:bg-states-primary-hover active:bg-states-primary-pressed', className),
|
|
19
22
|
children: [
|
|
20
23
|
/*#__PURE__*/ jsx("span", {
|
|
21
24
|
children: label
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { TestableProps } from '../../utils/testId';
|
|
3
|
+
export interface CalendarTriggerProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'children' | 'color'>, TestableProps {
|
|
3
4
|
/** Trigger element that opens the calendar popover */
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
/** Additional props passed to the trigger wrapper */
|
|
6
7
|
asChild?: boolean;
|
|
8
|
+
ref?: Ref<HTMLButtonElement>;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* Trigger element that opens the calendar popover.
|
|
10
12
|
* Wraps children with Ark UI DatePicker.Trigger.
|
|
13
|
+
*
|
|
14
|
+
* Arbitrary HTML attributes (`data-analytics-id`, `data-analytics-props`,
|
|
15
|
+
* `data-testid`, `aria-*`, `id`) are forwarded to Ark's Trigger and reach
|
|
16
|
+
* the final rendered child via `asChild` slot merge.
|
|
11
17
|
*/
|
|
12
|
-
export declare const CalendarTrigger:
|
|
18
|
+
export declare const CalendarTrigger: {
|
|
19
|
+
({ children, asChild, ref, ...rest }: CalendarTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { DatePicker } from "@ark-ui/react";
|
|
4
|
-
const CalendarTrigger =
|
|
3
|
+
const CalendarTrigger = ({ children, asChild = true, ref, ...rest })=>/*#__PURE__*/ jsx(DatePicker.Control, {
|
|
5
4
|
children: /*#__PURE__*/ jsx(DatePicker.Trigger, {
|
|
5
|
+
...rest,
|
|
6
6
|
ref: ref,
|
|
7
7
|
asChild: asChild,
|
|
8
8
|
children: children
|
|
9
9
|
})
|
|
10
|
-
})
|
|
10
|
+
});
|
|
11
11
|
CalendarTrigger.displayName = 'CalendarTrigger';
|
|
12
12
|
export { CalendarTrigger };
|
|
@@ -11,7 +11,7 @@ export { CalendarGrids, type CalendarGridsProps } from './CalendarGrids';
|
|
|
11
11
|
export { CalendarHeader } from './CalendarHeader';
|
|
12
12
|
export { CalendarInputHeader, type CalendarInputHeaderProps } from './CalendarInputHeader';
|
|
13
13
|
export { CalendarKeyboardHints, type CalendarKeyboardHintsProps } from './CalendarKeyboardHints';
|
|
14
|
-
export { CalendarPresetItem } from './CalendarPresetItem';
|
|
14
|
+
export { CalendarPresetItem, type CalendarPresetItemProps } from './CalendarPresetItem';
|
|
15
15
|
export { CalendarPresets, type CalendarPresetsProps } from './CalendarPresets';
|
|
16
16
|
export { CalendarResetButton, type CalendarResetButtonProps } from './CalendarResetButton';
|
|
17
17
|
export { CalendarTrigger, type CalendarTriggerProps } from './CalendarTrigger';
|
|
@@ -11,6 +11,8 @@ const Card = ({ ref, color = 'primary', asChild = false, disabled = false, class
|
|
|
11
11
|
if (!props.onClick) return;
|
|
12
12
|
const target = e.target;
|
|
13
13
|
const card = e.currentTarget;
|
|
14
|
+
const suppressor = target.closest('[data-ds-suppress-parent-click]');
|
|
15
|
+
if (suppressor && card.contains(suppressor)) return;
|
|
14
16
|
if (target !== card && target.closest(INTERACTIVE_SELECTORS) !== card) return;
|
|
15
17
|
props.onClick(e);
|
|
16
18
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { useTestId } from "../../utils/testId.js";
|
|
3
4
|
import { useCodeSnippet } from "./hooks/index.js";
|
|
4
5
|
import { CodeContent, CodeLine, TokenizedCodeLine } from "./internal/index.js";
|
|
@@ -22,6 +23,11 @@ const CodeSnippetCode = ({ className, ...props })=>{
|
|
|
22
23
|
};
|
|
23
24
|
const renderFoldSummary = (item)=>{
|
|
24
25
|
const label = getFoldSummaryLabel(item.fold, item.lineCount);
|
|
26
|
+
const { className: summaryClassName, onClick: consumerOnClick, ...summaryProps } = item.fold.summaryProps ?? {};
|
|
27
|
+
const handleSummaryClick = (event)=>{
|
|
28
|
+
toggleFold(item.fold.id);
|
|
29
|
+
consumerOnClick?.(event);
|
|
30
|
+
};
|
|
25
31
|
return /*#__PURE__*/ jsx(CodeLine, {
|
|
26
32
|
lineConfig: void 0,
|
|
27
33
|
lineHeightClass: lineHeightClass,
|
|
@@ -33,10 +39,11 @@ const CodeSnippetCode = ({ className, ...props })=>{
|
|
|
33
39
|
hasFolds: inlineGutter && hasFolds,
|
|
34
40
|
children: /*#__PURE__*/ jsx("button", {
|
|
35
41
|
type: "button",
|
|
36
|
-
className:
|
|
42
|
+
className: cn('inline-flex items-center cursor-pointer select-none', summaryClassName),
|
|
37
43
|
"aria-expanded": false,
|
|
38
44
|
"aria-label": `Collapsed region: ${label}, ${item.lineCount} lines`,
|
|
39
|
-
|
|
45
|
+
...summaryProps,
|
|
46
|
+
onClick: handleSummaryClick,
|
|
40
47
|
children: /*#__PURE__*/ jsx("span", {
|
|
41
48
|
className: "inline-flex items-center italic text-text-secondary hover:text-text-primary transition-colors",
|
|
42
49
|
children: label
|
|
@@ -10,7 +10,6 @@ const CodeSnippetFullscreenButton = ({ onClick, ref, ...props })=>{
|
|
|
10
10
|
const testId = useTestId('fullscreen-button');
|
|
11
11
|
const { isFullscreen, setIsFullscreen } = useCodeSnippet();
|
|
12
12
|
const handleClick = (event)=>{
|
|
13
|
-
event.stopPropagation();
|
|
14
13
|
setIsFullscreen(!isFullscreen);
|
|
15
14
|
onClick?.(event);
|
|
16
15
|
};
|
|
@@ -20,7 +20,11 @@ export type CodeSnippetRootProps<TLanguage extends string = string> = CodeSnippe
|
|
|
20
20
|
startingLineNumber?: number;
|
|
21
21
|
/** Enable line wrapping */
|
|
22
22
|
wrapLines?: boolean;
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Max lines before collapsing.
|
|
25
|
+
* Root auto-renders the default show-more button unless a direct
|
|
26
|
+
* `CodeSnippetShowMoreButton` child is provided for button-level props.
|
|
27
|
+
*/
|
|
24
28
|
maxLines?: number;
|
|
25
29
|
/** Foldable regions that can be collapsed/expanded */
|
|
26
30
|
folds?: FoldRegion[];
|
|
@@ -29,6 +33,9 @@ export type CodeSnippetRootProps<TLanguage extends string = string> = CodeSnippe
|
|
|
29
33
|
/** Child components */
|
|
30
34
|
children?: ReactNode;
|
|
31
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Code block with syntax highlighting, actions, line numbers, folding, and maxLines collapse.
|
|
38
|
+
*/
|
|
32
39
|
export declare const CodeSnippetRoot: {
|
|
33
40
|
<TLanguage extends string = string>({ code, language, size, lines, startingLineNumber, wrapLines: initialWrapLines, maxLines, folds: foldsProp, onCopy, className, children, "data-testid": testId, ...props }: CodeSnippetRootProps<TLanguage>): import("react/jsx-runtime").JSX.Element;
|
|
34
41
|
displayName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { Children, isValidElement, useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { cn } from "../../utils/cn.js";
|
|
@@ -7,8 +7,8 @@ import { copyText } from "../../utils/copyText.js";
|
|
|
7
7
|
import { TestIdProvider } from "../../utils/testId.js";
|
|
8
8
|
import { plainAdapter } from "./adapters/plain.js";
|
|
9
9
|
import { CodeSnippetContext, MIN_HIDDEN_LINES_THRESHOLD } from "./CodeSnippetContext.js";
|
|
10
|
+
import { CodeSnippetShowMoreButton } from "./CodeSnippetShowMoreButton.js";
|
|
10
11
|
import { useAdapter } from "./hooks/index.js";
|
|
11
|
-
import { ShowMoreButton } from "./internal/ShowMoreButton.js";
|
|
12
12
|
import { buildDisplayItems, validateFolds } from "./lib/foldUtils.js";
|
|
13
13
|
const codeSnippetRootVariants = cva("relative code-snippet-bg rounded-6 font-mono text-syntax-no-syntax overflow-hidden flex flex-col [&::selection]:bg-[var(--color-syntax-highlight-selected-highlight)] [&::selection]:text-[var(--color-syntax-highlight-selected-code)] [&_*::selection]:bg-[var(--color-syntax-highlight-selected-highlight)] [&_*::selection]:text-[var(--color-syntax-highlight-selected-code)] [&>[data-slot=code-snippet-actions]]:absolute [&>[data-slot=code-snippet-actions]]:right-0 [&>[data-slot=code-snippet-actions]]:top-0 [&>[data-slot=code-snippet-actions]]:z-30 [&>[data-slot=code-snippet-actions]]:p-6 [&>[data-slot=code-snippet-actions]]:rounded-br-6 [&>[data-slot=code-snippet-actions]]:rounded-tl-6", {
|
|
14
14
|
variants: {
|
|
@@ -23,6 +23,7 @@ const codeSnippetRootVariants = cva("relative code-snippet-bg rounded-6 font-mon
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const EMPTY_LINES = {};
|
|
26
|
+
const isCodeSnippetShowMoreButton = (child)=>/*#__PURE__*/ isValidElement(child) && child.type?.displayName === CodeSnippetShowMoreButton.displayName;
|
|
26
27
|
const CodeSnippetRoot = ({ code, language = 'text', size = 'sm', lines = EMPTY_LINES, startingLineNumber = 1, wrapLines: initialWrapLines = false, maxLines = 0, folds: foldsProp, onCopy, className, children, 'data-testid': testId, ...props })=>{
|
|
27
28
|
const adapterContext = useAdapter();
|
|
28
29
|
const [wrapLines, setWrapLines] = useState(initialWrapLines);
|
|
@@ -118,6 +119,7 @@ const CodeSnippetRoot = ({ code, language = 'text', size = 'sm', lines = EMPTY_L
|
|
|
118
119
|
collapsedFolds,
|
|
119
120
|
startingLineNumber
|
|
120
121
|
]);
|
|
122
|
+
const hasExplicitShowMoreButton = Children.toArray(children).some(isCodeSnippetShowMoreButton);
|
|
121
123
|
const visibleDisplayItems = useMemo(()=>{
|
|
122
124
|
const hiddenRows = displayItems.length - maxLines;
|
|
123
125
|
const shouldClip = maxLines > 0 && !isExpanded && hiddenRows >= MIN_HIDDEN_LINES_THRESHOLD;
|
|
@@ -187,7 +189,7 @@ const CodeSnippetRoot = ({ code, language = 'text', size = 'sm', lines = EMPTY_L
|
|
|
187
189
|
...!isFullscreen ? props : {},
|
|
188
190
|
children: [
|
|
189
191
|
children,
|
|
190
|
-
maxLines > 0 && /*#__PURE__*/ jsx(
|
|
192
|
+
maxLines > 0 && !hasExplicitShowMoreButton && /*#__PURE__*/ jsx(CodeSnippetShowMoreButton, {})
|
|
191
193
|
]
|
|
192
194
|
});
|
|
193
195
|
return /*#__PURE__*/ jsx(TestIdProvider, {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC, Ref } from 'react';
|
|
2
|
+
import { type ButtonProps } from '../Button';
|
|
3
|
+
export type CodeSnippetShowMoreButtonProps = Omit<ButtonProps, 'children'> & {
|
|
4
|
+
ref?: Ref<HTMLButtonElement>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Optional explicit show-more control for snippets with `maxLines`.
|
|
8
|
+
* Do not render this for ordinary collapsed snippets; `CodeSnippetRoot`
|
|
9
|
+
* auto-renders the default control. Render it as a direct child only when
|
|
10
|
+
* consumer props must reach the real button.
|
|
11
|
+
*/
|
|
12
|
+
export declare const CodeSnippetShowMoreButton: FC<CodeSnippetShowMoreButtonProps>;
|
package/dist/components/CodeSnippet/{internal/ShowMoreButton.js → CodeSnippetShowMoreButton.js}
RENAMED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronDown } from "
|
|
3
|
-
import { ChevronUp } from "
|
|
4
|
-
import { Button } from "
|
|
5
|
-
import { MIN_HIDDEN_LINES_THRESHOLD } from "
|
|
6
|
-
import { useCodeSnippet } from "
|
|
7
|
-
const
|
|
2
|
+
import { ChevronDown } from "../../icons/ChevronDown.js";
|
|
3
|
+
import { ChevronUp } from "../../icons/ChevronUp.js";
|
|
4
|
+
import { Button } from "../Button/index.js";
|
|
5
|
+
import { MIN_HIDDEN_LINES_THRESHOLD } from "./CodeSnippetContext.js";
|
|
6
|
+
import { useCodeSnippet } from "./hooks/index.js";
|
|
7
|
+
const CodeSnippetShowMoreButton = ({ onClick, ref, ...props })=>{
|
|
8
8
|
const { displayItems, maxLines, isExpanded, setIsExpanded } = useCodeSnippet();
|
|
9
9
|
const hiddenLines = displayItems.length - maxLines;
|
|
10
10
|
if (maxLines <= 0 || hiddenLines < MIN_HIDDEN_LINES_THRESHOLD) return null;
|
|
11
|
+
const handleClick = (event)=>{
|
|
12
|
+
setIsExpanded(!isExpanded);
|
|
13
|
+
onClick?.(event);
|
|
14
|
+
};
|
|
11
15
|
return /*#__PURE__*/ jsx("div", {
|
|
12
16
|
"data-slot": "code-snippet-show-more",
|
|
13
17
|
className: "flex h-36 items-center justify-center px-6",
|
|
14
18
|
children: /*#__PURE__*/ jsx(Button, {
|
|
19
|
+
ref: ref,
|
|
15
20
|
variant: "ghost",
|
|
16
21
|
color: "neutral",
|
|
17
22
|
size: "small",
|
|
18
23
|
fullWidth: true,
|
|
19
|
-
|
|
24
|
+
...props,
|
|
25
|
+
onClick: handleClick,
|
|
20
26
|
children: isExpanded ? /*#__PURE__*/ jsxs(Fragment, {
|
|
21
27
|
children: [
|
|
22
28
|
"Show less",
|
|
@@ -33,5 +39,5 @@ const ShowMoreButton = ()=>{
|
|
|
33
39
|
})
|
|
34
40
|
});
|
|
35
41
|
};
|
|
36
|
-
|
|
37
|
-
export {
|
|
42
|
+
CodeSnippetShowMoreButton.displayName = 'CodeSnippetShowMoreButton';
|
|
43
|
+
export { CodeSnippetShowMoreButton };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { FC
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { type TabsTriggerProps } from '../Tabs/TabsTrigger';
|
|
3
|
+
export type CodeSnippetTabProps = TabsTriggerProps;
|
|
7
4
|
export declare const CodeSnippetTab: FC<CodeSnippetTabProps>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTestId } from "../../utils/testId.js";
|
|
3
|
-
import { TabsTrigger } from "../Tabs/
|
|
4
|
-
const CodeSnippetTab = ({
|
|
5
|
-
const testId = useTestId('tab');
|
|
3
|
+
import { TabsTrigger } from "../Tabs/TabsTrigger.js";
|
|
4
|
+
const CodeSnippetTab = ({ 'data-testid': testIdProp, ...rest })=>{
|
|
5
|
+
const testId = useTestId('tab', testIdProp);
|
|
6
6
|
return /*#__PURE__*/ jsx(TabsTrigger, {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"data-testid": testId,
|
|
10
|
-
children: children
|
|
7
|
+
...rest,
|
|
8
|
+
"data-testid": testId
|
|
11
9
|
});
|
|
12
10
|
};
|
|
13
11
|
CodeSnippetTab.displayName = 'CodeSnippetTab';
|
|
@@ -8,7 +8,6 @@ const CodeSnippetWrapButton = ({ onToggle, ref, ...props })=>{
|
|
|
8
8
|
const testId = useTestId('wrap-button');
|
|
9
9
|
const { wrapLines, setWrapLines } = useCodeSnippet();
|
|
10
10
|
const handleToggle = (active, event)=>{
|
|
11
|
-
event.stopPropagation();
|
|
12
11
|
setWrapLines(active);
|
|
13
12
|
onToggle?.(active, event);
|
|
14
13
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef, FC } from 'react';
|
|
1
|
+
import type { ComponentPropsWithRef, FC, ReactElement } from 'react';
|
|
2
2
|
export interface InlineCodeSnippetProps extends Omit<ComponentPropsWithRef<'code'>, 'children'> {
|
|
3
3
|
/** The code content to display */
|
|
4
4
|
code: string;
|
|
5
5
|
/** Size variant */
|
|
6
6
|
size?: 'sm' | 'md' | 'lg' | 'inherit';
|
|
7
|
-
/** Render as
|
|
7
|
+
/** Render as the React element passed via `children` instead of the default `<code>`. The `code` prop becomes the cloned element's content. */
|
|
8
8
|
asChild?: boolean;
|
|
9
9
|
/** Enable click to copy functionality (default: true) */
|
|
10
10
|
copyable?: boolean;
|
|
11
|
+
/** Used only when `asChild` is true. Must be a single React element; the `code` prop is rendered as its children. */
|
|
12
|
+
children?: ReactElement;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* InlineCodeSnippet - A simple inline code display component with optional copy functionality.
|