@juspay/blend-design-system 0.0.37-beta.0 → 0.0.37-beta.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/BreadcrumbV2/BreadcrumbV2.d.ts +3 -0
- package/dist/components/BreadcrumbV2/BreadcrumbV2Icon.d.ts +6 -0
- package/dist/components/BreadcrumbV2/BreadcrumbV2Item.d.ts +6 -0
- package/dist/components/BreadcrumbV2/BreadcrumbV2List.d.ts +15 -0
- package/dist/components/BreadcrumbV2/BreadcrumbV2OverflowMenu.d.ts +11 -0
- package/dist/components/BreadcrumbV2/BreadcrumbV2Page.d.ts +9 -0
- package/dist/components/BreadcrumbV2/BreadcrumbV2Separator.d.ts +6 -0
- package/dist/components/BreadcrumbV2/breadcrumbV2.dark.tokens.d.ts +3 -0
- package/dist/components/BreadcrumbV2/breadcrumbV2.light.tokens.d.ts +3 -0
- package/dist/components/BreadcrumbV2/breadcrumbV2.tokens.d.ts +31 -0
- package/dist/components/BreadcrumbV2/breadcrumbV2.types.d.ts +46 -0
- package/dist/components/BreadcrumbV2/index.d.ts +3 -0
- package/dist/components/BreadcrumbV2/utils.d.ts +27 -0
- package/dist/components/CodeBlock/CodeBlockDiffView/CodeBlockDiffView.d.ts +6 -0
- package/dist/components/CodeBlock/CodeBlockDiffView/types.d.ts +16 -0
- package/dist/components/CodeBlock/CodeBlockDiffView/utils.d.ts +4 -0
- package/dist/components/CodeBlock/CodeBlockLineParts.d.ts +56 -0
- package/dist/components/CodeBlock/codeBlock.token.d.ts +18 -0
- package/dist/components/CodeBlock/types.d.ts +25 -0
- package/dist/components/CodeBlock/utils.d.ts +16 -1
- package/dist/components/CodeEditorV2/CodeEditorV2.d.ts +28 -0
- package/dist/components/CodeEditorV2/CodeEditorV2Header.d.ts +2 -0
- package/dist/components/CodeEditorV2/MonacoEditor/MonacoEditorWrapper.d.ts +2 -0
- package/dist/components/CodeEditorV2/MonacoEditor/monacoTheme.d.ts +3 -0
- package/dist/components/CodeEditorV2/codeEditorV2.dark.tokens.d.ts +3 -0
- package/dist/components/CodeEditorV2/codeEditorV2.light.token.d.ts +3 -0
- package/dist/components/CodeEditorV2/codeEditorV2.tokens.d.ts +94 -0
- package/dist/components/CodeEditorV2/codeEditorV2.types.d.ts +112 -0
- package/dist/components/CodeEditorV2/index.d.ts +3 -0
- package/dist/components/CodeEditorV2/utils.d.ts +78 -0
- package/dist/components/DataTable/TableBody/types.d.ts +2 -0
- package/dist/components/DataTable/TableHeader/FilterComponents.d.ts +7 -0
- package/dist/components/DataTable/TableHeader/types.d.ts +5 -0
- package/dist/components/DataTable/TableHeader/utils.d.ts +2 -0
- package/dist/components/DataTable/types.d.ts +6 -0
- package/dist/components/DrawerV2/index.d.ts +3 -0
- package/dist/components/DrawerV2/types.d.ts +26 -0
- package/dist/components/MenuV2/MenuV2.d.ts +4 -0
- package/dist/components/MenuV2/MenuV2Content.d.ts +29 -0
- package/dist/components/MenuV2/MenuV2Item.d.ts +9 -0
- package/dist/components/MenuV2/MenuV2SubMenu.d.ts +12 -0
- package/dist/components/MenuV2/index.d.ts +7 -0
- package/dist/components/MenuV2/menuV2.animations.d.ts +2 -0
- package/dist/components/MenuV2/menuV2.dark.tokens.d.ts +3 -0
- package/dist/components/MenuV2/menuV2.light.tokens.d.ts +3 -0
- package/dist/components/MenuV2/menuV2.tokens.d.ts +92 -0
- package/dist/components/MenuV2/menuV2.types.d.ts +86 -0
- package/dist/components/MenuV2/menuV2.utils.d.ts +26 -0
- package/dist/components/Modal/modal.tokens.d.ts +3 -0
- package/dist/components/ProgressBarV2/CircularProgressBarV2.d.ts +2 -0
- package/dist/components/ProgressBarV2/LinearProgressBarV2.d.ts +2 -0
- package/dist/components/ProgressBarV2/ProgressBarV2.d.ts +11 -0
- package/dist/components/ProgressBarV2/index.d.ts +3 -0
- package/dist/components/ProgressBarV2/progressBarV2.dark.tokens.d.ts +3 -0
- package/dist/components/ProgressBarV2/progressBarV2.light.tokens.d.ts +3 -0
- package/dist/components/ProgressBarV2/progressBarV2.tokens.d.ts +63 -0
- package/dist/components/ProgressBarV2/progressBarV2.types.d.ts +45 -0
- package/dist/components/StatCardV2/StatCardV2.chartConfig.d.ts +2 -0
- package/dist/components/StatCardV2/StatCardV2.d.ts +16 -0
- package/dist/components/StatCardV2/StatCardV2Change.d.ts +3 -0
- package/dist/components/StatCardV2/StatCardV2NoData.d.ts +10 -0
- package/dist/components/StatCardV2/StatCardV2Skeleton.d.ts +7 -0
- package/dist/components/StatCardV2/StatCardV2Subtitle.d.ts +3 -0
- package/dist/components/StatCardV2/StatCardV2Title.d.ts +3 -0
- package/dist/components/StatCardV2/StatCardV2Value.d.ts +11 -0
- package/dist/components/StatCardV2/index.d.ts +3 -0
- package/dist/components/StatCardV2/statcardV2.dark.tokens.d.ts +3 -0
- package/dist/components/StatCardV2/statcardV2.light.tokens.d.ts +3 -0
- package/dist/components/StatCardV2/statcardV2.tokens.d.ts +81 -0
- package/dist/components/StatCardV2/statcardV2.types.d.ts +78 -0
- package/dist/components/StatCardV2/utils.d.ts +7 -0
- package/dist/components/TabsV2/StyledTabsV2.d.ts +26 -0
- package/dist/components/TabsV2/TabsV2.d.ts +15 -0
- package/dist/components/TabsV2/TabsV2Content.d.ts +2 -0
- package/dist/components/TabsV2/TabsV2List.d.ts +14 -0
- package/dist/components/TabsV2/TabsV2Trigger.d.ts +19 -0
- package/dist/components/TabsV2/index.d.ts +8 -0
- package/dist/components/TabsV2/tabsV2.context.d.ts +21 -0
- package/dist/components/TabsV2/tabsV2.dark.tokens.d.ts +3 -0
- package/dist/components/TabsV2/tabsV2.light.tokens.d.ts +3 -0
- package/dist/components/TabsV2/tabsV2.tokens.d.ts +97 -0
- package/dist/components/TabsV2/tabsV2.types.d.ts +68 -0
- package/dist/components/TabsV2/tabsV2.utils.d.ts +18 -0
- package/dist/components/common/virtualViewport.d.ts +12 -0
- package/dist/context/ThemeContext.d.ts +12 -0
- package/dist/context/useComponentToken.d.ts +7 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +42228 -37087
- package/dist/tokens/font.tokens.d.ts +2 -0
- package/dist/tokens/zIndex.tokens.d.ts +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BreadcrumbCompoundItemProps } from './breadcrumbV2.types';
|
|
2
|
+
declare const BreadcrumbV2CompoundItem: {
|
|
3
|
+
({ href, onClick, isActive, children, }: BreadcrumbCompoundItemProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default BreadcrumbV2CompoundItem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BreadcrumbV2TokensType } from './breadcrumbV2.tokens';
|
|
2
|
+
import { IndexedBreadcrumbChild } from './utils';
|
|
3
|
+
export type BreadcrumbV2ListProps = {
|
|
4
|
+
breadcrumbTokens: BreadcrumbV2TokensType;
|
|
5
|
+
shouldShowMenu: boolean;
|
|
6
|
+
base: IndexedBreadcrumbChild | undefined;
|
|
7
|
+
rest: IndexedBreadcrumbChild[];
|
|
8
|
+
menuItems: IndexedBreadcrumbChild[];
|
|
9
|
+
totalItems: number;
|
|
10
|
+
};
|
|
11
|
+
declare const BreadcrumbV2List: {
|
|
12
|
+
({ breadcrumbTokens, shouldShowMenu, base, rest, menuItems, totalItems, }: BreadcrumbV2ListProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
export default BreadcrumbV2List;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BreadcrumbV2TokensType } from './breadcrumbV2.tokens';
|
|
2
|
+
import { IndexedBreadcrumbChild } from './utils';
|
|
3
|
+
export type BreadcrumbV2OverflowMenuProps = {
|
|
4
|
+
menuItems: IndexedBreadcrumbChild[];
|
|
5
|
+
breadcrumbTokens: BreadcrumbV2TokensType;
|
|
6
|
+
};
|
|
7
|
+
declare const BreadcrumbV2OverflowMenu: {
|
|
8
|
+
({ menuItems, breadcrumbTokens, }: BreadcrumbV2OverflowMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default BreadcrumbV2OverflowMenu;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type BreadcrumbV2PageProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BreadcrumbV2Page: {
|
|
6
|
+
({ children }: BreadcrumbV2PageProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export default BreadcrumbV2Page;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BreadcrumbCompoundSeparatorProps } from './breadcrumbV2.types';
|
|
2
|
+
declare const BreadcrumbV2Separator: {
|
|
3
|
+
({ children, }: BreadcrumbCompoundSeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default BreadcrumbV2Separator;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CSSObject } from 'styled-components';
|
|
2
|
+
import { BreakpointType } from '../../breakpoints/breakPoints';
|
|
3
|
+
import { FoundationTokenType } from '../../tokens/theme.token';
|
|
4
|
+
import { Theme } from '../../context/theme.enum';
|
|
5
|
+
export type BreadcrumbV2State = 'default' | 'hover' | 'active';
|
|
6
|
+
export type BreadcrumbV2TokensType = {
|
|
7
|
+
gap: CSSObject['gap'];
|
|
8
|
+
item: {
|
|
9
|
+
padding: CSSObject['padding'];
|
|
10
|
+
gap: CSSObject['gap'];
|
|
11
|
+
text: {
|
|
12
|
+
fontSize: CSSObject['fontSize'];
|
|
13
|
+
fontWeight: CSSObject['fontWeight'];
|
|
14
|
+
color: {
|
|
15
|
+
[key in BreadcrumbV2State]: CSSObject['color'];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
ellipsis: {
|
|
20
|
+
color: CSSObject['color'];
|
|
21
|
+
borderRadius: CSSObject['borderRadius'];
|
|
22
|
+
size: number;
|
|
23
|
+
};
|
|
24
|
+
separator: {
|
|
25
|
+
color: CSSObject['color'];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type ResponsiveBreadcrumbV2Tokens = {
|
|
29
|
+
[key in keyof BreakpointType]: BreadcrumbV2TokensType;
|
|
30
|
+
};
|
|
31
|
+
export declare const getBreadcrumbV2Tokens: (foundationToken: FoundationTokenType, theme?: Theme | string) => ResponsiveBreadcrumbV2Tokens;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { default as BreadcrumbV2CompoundItem } from './BreadcrumbV2Item';
|
|
2
|
+
import { default as BreadcrumbV2Icon } from './BreadcrumbV2Icon';
|
|
3
|
+
import { default as BreadcrumbV2Page } from './BreadcrumbV2Page';
|
|
4
|
+
import { default as BreadcrumbV2Separator } from './BreadcrumbV2Separator';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
export type BreadcrumbV2ItemType = {
|
|
7
|
+
/** Stable unique id for React list keys when `href` may repeat or collide (e.g. dynamic routes). */
|
|
8
|
+
id?: string | number;
|
|
9
|
+
leftSlot?: React.ReactNode;
|
|
10
|
+
rightSlot?: React.ReactNode;
|
|
11
|
+
label: string;
|
|
12
|
+
href: string;
|
|
13
|
+
/** With `href`, prevents default navigation and runs this handler (SPA / client routing). */
|
|
14
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
15
|
+
};
|
|
16
|
+
export type BreadcrumbCompoundIconProps = {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export type BreadcrumbCompoundSeparatorProps = {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
export type BreadcrumbCompoundItemProps = {
|
|
23
|
+
href?: string;
|
|
24
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
25
|
+
isActive?: boolean;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
};
|
|
28
|
+
export type BreadcrumbV2Props = {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
items?: BreadcrumbV2ItemType[];
|
|
31
|
+
/**
|
|
32
|
+
* When the number of `Item`s (or `items` entries) is **greater than** this value,
|
|
33
|
+
* the bar collapses to first crumb + ellipsis + trailing segment(s). At least one
|
|
34
|
+
* trailing segment stays visible when overflow is active (so the current page is not
|
|
35
|
+
* menu-only). Use a finite integer ≥ 1; values below 1 or non-finite values disable
|
|
36
|
+
* overflow (all crumbs inline).
|
|
37
|
+
*/
|
|
38
|
+
maxItems?: number;
|
|
39
|
+
};
|
|
40
|
+
export type BreadcrumbV2Component = ((props: BreadcrumbV2Props) => React.ReactElement | null) & {
|
|
41
|
+
displayName?: string;
|
|
42
|
+
Item: typeof BreadcrumbV2CompoundItem;
|
|
43
|
+
Icon: typeof BreadcrumbV2Icon;
|
|
44
|
+
Separator: typeof BreadcrumbV2Separator;
|
|
45
|
+
Page: typeof BreadcrumbV2Page;
|
|
46
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BreadcrumbCompoundItemProps } from './breadcrumbV2.types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/** Collects visible text from React nodes for accessible labels (e.g. Page text inside Item). */
|
|
4
|
+
export declare function getPlainTextFromReactNode(node: React.ReactNode): string;
|
|
5
|
+
export type IndexedBreadcrumbChild = {
|
|
6
|
+
el: React.ReactElement<BreadcrumbCompoundItemProps>;
|
|
7
|
+
idx: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function filterBreadcrumbItemChildren(children: React.ReactNode, ItemComponent: React.ComponentType<BreadcrumbCompoundItemProps>): React.ReactElement<BreadcrumbCompoundItemProps>[];
|
|
10
|
+
export declare function indexBreadcrumbChildren(items: React.ReactElement<BreadcrumbCompoundItemProps>[]): IndexedBreadcrumbChild[];
|
|
11
|
+
export declare function computeBreadcrumbOverflowLayout(indexed: IndexedBreadcrumbChild[], maxItems: number): {
|
|
12
|
+
shouldShowMenu: boolean;
|
|
13
|
+
base: IndexedBreadcrumbChild | undefined;
|
|
14
|
+
rest: IndexedBreadcrumbChild[];
|
|
15
|
+
menuItems: IndexedBreadcrumbChild[];
|
|
16
|
+
};
|
|
17
|
+
export declare function resolveBreadcrumbItemActive(idx: number, el: React.ReactElement<BreadcrumbCompoundItemProps>, totalItems: number): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Native event for {@link createStubAnchorClickEvent}. Uses real MouseEvent in DOM;
|
|
20
|
+
* minimal object elsewhere so SSR does not throw.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createStubNativeClickEvent(): MouseEvent;
|
|
23
|
+
/**
|
|
24
|
+
* Approximates a React click on an anchor for overflow menu items (no real DOM event).
|
|
25
|
+
* {@link BreadcrumbV2Item} calls preventDefault before onClick — callers here should do the same for parity.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createStubAnchorClickEvent(href: string): React.MouseEvent<HTMLAnchorElement>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CodeBlockDiffViewProps } from './types';
|
|
2
|
+
declare const CodeBlockDiffView: {
|
|
3
|
+
({ diffLines, diffViewSegments, codeContentId, tokens, rowCtx, diffExpandChunk, }: CodeBlockDiffViewProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default CodeBlockDiffView;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CodeBlockTokenType } from '../codeBlock.token';
|
|
2
|
+
import { DiffLine, DiffViewSegment } from '../types';
|
|
3
|
+
import { DiffRowRenderContext } from '../CodeBlockLineParts';
|
|
4
|
+
export type DiffGapExpansionState = {
|
|
5
|
+
revealedFromTop: number;
|
|
6
|
+
revealedFromBottom: number;
|
|
7
|
+
};
|
|
8
|
+
export interface CodeBlockDiffViewProps {
|
|
9
|
+
diffLines: DiffLine[];
|
|
10
|
+
diffViewSegments: DiffViewSegment[];
|
|
11
|
+
codeContentId: string;
|
|
12
|
+
tokens: CodeBlockTokenType;
|
|
13
|
+
rowCtx: DiffRowRenderContext;
|
|
14
|
+
/** Lines to reveal per click when expanding from the top or bottom of a gap */
|
|
15
|
+
diffExpandChunk: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DiffGapExpansionState } from './types';
|
|
2
|
+
export declare const getGapLineTotal: (start: number, end: number) => number;
|
|
3
|
+
export declare const getGapHiddenLineCount: (start: number, end: number, state: DiffGapExpansionState | undefined) => number;
|
|
4
|
+
export declare const isGapFullyExpanded: (start: number, end: number, state: DiffGapExpansionState | undefined) => boolean;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { CodeBlockTokenType } from './codeBlock.token';
|
|
3
|
+
import { DiffLineType, DiffLine } from './types';
|
|
4
|
+
import { SyntaxToken } from './utils';
|
|
5
|
+
export type LineCounter = {
|
|
6
|
+
left: number;
|
|
7
|
+
right: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const EmptyGutterCell: React.FC<{
|
|
10
|
+
width: string | number | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
type LineNumberGutterProps = {
|
|
13
|
+
lineIndex: number;
|
|
14
|
+
width: string | number | undefined;
|
|
15
|
+
color: string | undefined;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
};
|
|
18
|
+
export declare const LineNumberGutter: React.FC<LineNumberGutterProps>;
|
|
19
|
+
export type TokenizedCodeLineProps = {
|
|
20
|
+
tokens: SyntaxToken[];
|
|
21
|
+
getTokenColor: (type: string) => string;
|
|
22
|
+
paddingTop?: string | number;
|
|
23
|
+
paddingBottom?: string | number;
|
|
24
|
+
paddingLeft?: string | number;
|
|
25
|
+
paddingRight?: string | number;
|
|
26
|
+
whiteSpace?: 'pre-wrap' | 'pre';
|
|
27
|
+
};
|
|
28
|
+
export declare const TokenizedCodeLine: React.FC<TokenizedCodeLineProps>;
|
|
29
|
+
export type CodeLineWrapperProps = {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
lineIndex?: number;
|
|
33
|
+
};
|
|
34
|
+
export declare const CodeLineWrapper: React.FC<CodeLineWrapperProps>;
|
|
35
|
+
export type PreElementProps = {
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
fontFamily: string | undefined;
|
|
38
|
+
fontSize: string | number | undefined;
|
|
39
|
+
lineHeight: string | number | undefined;
|
|
40
|
+
id?: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const PreElement: React.FC<PreElementProps>;
|
|
43
|
+
export type DiffRowRenderContext = {
|
|
44
|
+
shouldShowLineNumbers: boolean;
|
|
45
|
+
tokens: CodeBlockTokenType;
|
|
46
|
+
tokenizeLine: (line: string) => SyntaxToken[];
|
|
47
|
+
getTokenColor: (type: string) => string;
|
|
48
|
+
getDiffGutterStyle: (lineType?: DiffLineType) => CSSProperties;
|
|
49
|
+
getDiffLineBackground: (lineType?: DiffLineType) => CSSProperties;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* One full-width row: left pane + right pane in a single flex row so both
|
|
53
|
+
* sides always share the same row height.
|
|
54
|
+
*/
|
|
55
|
+
export declare const renderDiffUnifiedRowPair: (leftLine: DiffLine | undefined, rightLine: DiffLine | undefined, rowKey: string, counters: LineCounter, ctx: DiffRowRenderContext, tokens: CodeBlockTokenType) => ReactNode;
|
|
56
|
+
export {};
|
|
@@ -82,6 +82,24 @@ export type CodeBlockTokenType = {
|
|
|
82
82
|
comment: CSSObject['color'];
|
|
83
83
|
text: CSSObject['color'];
|
|
84
84
|
};
|
|
85
|
+
expandContext: {
|
|
86
|
+
backgroundColor: CSSObject['backgroundColor'];
|
|
87
|
+
borderTop: CSSObject['borderTop'];
|
|
88
|
+
borderBottom: CSSObject['borderBottom'];
|
|
89
|
+
padding: CSSObject['padding'];
|
|
90
|
+
color: CSSObject['color'];
|
|
91
|
+
fontSize: CSSObject['fontSize'];
|
|
92
|
+
letterSpacing: CSSObject['letterSpacing'];
|
|
93
|
+
button: {
|
|
94
|
+
padding: CSSObject['padding'];
|
|
95
|
+
dotsPadding: CSSObject['padding'];
|
|
96
|
+
opacity: CSSObject['opacity'];
|
|
97
|
+
disabledOpacity: CSSObject['opacity'];
|
|
98
|
+
hoverBackgroundColor: CSSObject['backgroundColor'];
|
|
99
|
+
borderRadius: CSSObject['borderRadius'];
|
|
100
|
+
iconSize: number;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
85
103
|
};
|
|
86
104
|
};
|
|
87
105
|
export type ResponsiveCodeBlockTokens = {
|
|
@@ -14,6 +14,15 @@ export interface DiffLine {
|
|
|
14
14
|
type: DiffLineType;
|
|
15
15
|
}
|
|
16
16
|
export type SupportedLanguage = 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'json' | 'css' | 'html' | 'markdown' | 'yaml' | 'python' | 'rust' | 'haskell';
|
|
17
|
+
export type DiffViewSegment = {
|
|
18
|
+
type: 'lines';
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'collapsed';
|
|
23
|
+
start: number;
|
|
24
|
+
end: number;
|
|
25
|
+
};
|
|
17
26
|
export type CodeBlockProps = {
|
|
18
27
|
code: string;
|
|
19
28
|
variant?: CodeBlockVariant;
|
|
@@ -26,4 +35,20 @@ export type CodeBlockProps = {
|
|
|
26
35
|
showCopyButton?: boolean;
|
|
27
36
|
autoFormat?: boolean;
|
|
28
37
|
language?: SupportedLanguage;
|
|
38
|
+
/**
|
|
39
|
+
* When true (default), unchanged lines outside the context window around
|
|
40
|
+
* edits are hidden behind an expand control (GitHub-style). Only applies
|
|
41
|
+
* when variant is DIFF and diffLines is set.
|
|
42
|
+
*/
|
|
43
|
+
isDiffUnchangedCollapsed?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* How many unchanged lines to show above and below each change when
|
|
46
|
+
* isDiffUnchangedCollapsed is true. Defaults to 3.
|
|
47
|
+
*/
|
|
48
|
+
diffContextLines?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Lines revealed per click when expanding a collapsed gap from the start
|
|
51
|
+
* or end (GitHub-style). Defaults to 20.
|
|
52
|
+
*/
|
|
53
|
+
diffExpandChunk?: number;
|
|
29
54
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeBlockTokenType } from './codeBlock.token';
|
|
2
|
-
import { DiffLineType, DiffLine, SupportedLanguage } from './types';
|
|
2
|
+
import { DiffLineType, DiffLine, DiffViewSegment, SupportedLanguage } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Token interface for syntax highlighting
|
|
5
5
|
*/
|
|
@@ -41,3 +41,18 @@ export declare const createCopyToClipboard: (code: string, setIsCopied: (copied:
|
|
|
41
41
|
* Processes lines for diff or normal mode
|
|
42
42
|
*/
|
|
43
43
|
export declare const processLines: (isDiffMode: boolean, diffLines: DiffLine[] | undefined, code: string) => string[] | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Stable key for a collapsed line range in diff view (inclusive indices).
|
|
46
|
+
*/
|
|
47
|
+
export declare const getDiffCollapsedRangeKey: (start: number, end: number) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Merges per-change visibility intervals (change line ± context) into
|
|
50
|
+
* non-overlapping ranges of line indices that stay visible when collapsed.
|
|
51
|
+
*/
|
|
52
|
+
export declare const mergeDiffVisibleIntervals: (diffLines: DiffLine[], contextLines: number) => [number, number][];
|
|
53
|
+
/**
|
|
54
|
+
* Builds ordered segments: visible line ranges and collapsed gaps. Expanded
|
|
55
|
+
* gaps are still emitted as `collapsed`; the UI decides whether to show the
|
|
56
|
+
* expand affordance or the full line range.
|
|
57
|
+
*/
|
|
58
|
+
export declare const buildDiffViewSegments: (diffLines: DiffLine[], contextLines: number, isCollapsedMode: boolean) => DiffViewSegment[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CodeEditorV2Variant } from './codeEditorV2.types';
|
|
2
|
+
declare const CodeEditorV2: import('react').ForwardRefExoticComponent<{
|
|
3
|
+
value: string;
|
|
4
|
+
onChange?: (value: string) => void;
|
|
5
|
+
variant?: CodeEditorV2Variant;
|
|
6
|
+
showLineNumbers?: boolean;
|
|
7
|
+
header?: {
|
|
8
|
+
showHeader?: boolean;
|
|
9
|
+
title?: string;
|
|
10
|
+
leftSlot?: import('react').ReactNode;
|
|
11
|
+
rightSlot?: import('react').ReactNode;
|
|
12
|
+
showCopyButton?: boolean;
|
|
13
|
+
};
|
|
14
|
+
language?: import('./codeEditorV2.types').SupportedLanguage;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
onBlur?: () => void;
|
|
19
|
+
onFocus?: () => void;
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
diff?: boolean;
|
|
22
|
+
originalValue?: string;
|
|
23
|
+
renderSideBySide?: boolean;
|
|
24
|
+
isDiffUnchangedCollapsed?: boolean;
|
|
25
|
+
diffContextLines?: number;
|
|
26
|
+
diffExpandChunk?: number;
|
|
27
|
+
} & import('./codeEditorV2.types').CodeEditorV2Dimensions & Omit<import('react').HTMLAttributes<HTMLDivElement>, "style" | "className" | "children" | "onChange"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export default CodeEditorV2;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { MonacoEditorWrapperProps } from '../codeEditorV2.types';
|
|
2
|
+
export declare function MonacoEditorWrapper({ value, language, onChange, readOnly, disabled, placeholder, showLineNumbers, minHeight, maxHeight, height, tokens, onFocus, onBlur, autoFocus, diff, originalValue, renderSideBySide, isDiffUnchangedCollapsed, diffContextLines, diffExpandChunk, }: MonacoEditorWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CSSObject } from 'styled-components';
|
|
2
|
+
import { DiffLineType, MonacoTheme } from './codeEditorV2.types';
|
|
3
|
+
import { BreakpointType } from '../../breakpoints/breakPoints';
|
|
4
|
+
import { FoundationTokenType } from '../../tokens/theme.token';
|
|
5
|
+
import { Theme } from '../../context/theme.enum';
|
|
6
|
+
export type CodeEditorV2Tokens = {
|
|
7
|
+
backgroundColor: CSSObject['backgroundColor'];
|
|
8
|
+
border: CSSObject['border'];
|
|
9
|
+
borderRadius: CSSObject['borderRadius'];
|
|
10
|
+
boxShadow: CSSObject['boxShadow'];
|
|
11
|
+
theme: MonacoTheme;
|
|
12
|
+
header: {
|
|
13
|
+
backgroundColor: CSSObject['backgroundColor'];
|
|
14
|
+
borderBottom: CSSObject['borderBottom'];
|
|
15
|
+
paddingTop: CSSObject['paddingTop'];
|
|
16
|
+
paddingBottom: CSSObject['paddingBottom'];
|
|
17
|
+
paddingLeft: CSSObject['paddingLeft'];
|
|
18
|
+
paddingRight: CSSObject['paddingRight'];
|
|
19
|
+
gap: CSSObject['gap'];
|
|
20
|
+
icon: {
|
|
21
|
+
width: CSSObject['width'];
|
|
22
|
+
};
|
|
23
|
+
text: {
|
|
24
|
+
fontSize: CSSObject['fontSize'];
|
|
25
|
+
fontWeight: CSSObject['fontWeight'];
|
|
26
|
+
lineHeight: CSSObject['lineHeight'];
|
|
27
|
+
color: CSSObject['color'];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
body: {
|
|
31
|
+
paddingTop: CSSObject['paddingTop'];
|
|
32
|
+
paddingBottom: CSSObject['paddingBottom'];
|
|
33
|
+
paddingLeft: CSSObject['paddingLeft'];
|
|
34
|
+
paddingRight: CSSObject['paddingRight'];
|
|
35
|
+
backgroundColor: CSSObject['backgroundColor'];
|
|
36
|
+
gutter: {
|
|
37
|
+
width: CSSObject['width'];
|
|
38
|
+
color: CSSObject['color'];
|
|
39
|
+
backgroundColor: {
|
|
40
|
+
[key in DiffLineType]: CSSObject['backgroundColor'];
|
|
41
|
+
};
|
|
42
|
+
borderLeft: {
|
|
43
|
+
[key in DiffLineType]: CSSObject['borderLeft'];
|
|
44
|
+
};
|
|
45
|
+
borderColor: {
|
|
46
|
+
[key in DiffLineType]: CSSObject['color'];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
code: {
|
|
50
|
+
fontFamily: CSSObject['fontFamily'];
|
|
51
|
+
fontSize: CSSObject['fontSize'];
|
|
52
|
+
lineHeight: CSSObject['lineHeight'];
|
|
53
|
+
paddingTop: CSSObject['paddingTop'];
|
|
54
|
+
paddingBottom: CSSObject['paddingBottom'];
|
|
55
|
+
paddingLeft: CSSObject['paddingLeft'];
|
|
56
|
+
paddingRight: CSSObject['paddingRight'];
|
|
57
|
+
};
|
|
58
|
+
highlightedLine: {
|
|
59
|
+
backgroundColor: {
|
|
60
|
+
[key in DiffLineType]: CSSObject['backgroundColor'];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
syntax: {
|
|
64
|
+
keyword: {
|
|
65
|
+
color: CSSObject['color'];
|
|
66
|
+
};
|
|
67
|
+
function: {
|
|
68
|
+
color: CSSObject['color'];
|
|
69
|
+
};
|
|
70
|
+
string: {
|
|
71
|
+
color: CSSObject['color'];
|
|
72
|
+
};
|
|
73
|
+
number: {
|
|
74
|
+
color: CSSObject['color'];
|
|
75
|
+
};
|
|
76
|
+
operator: {
|
|
77
|
+
color: CSSObject['color'];
|
|
78
|
+
};
|
|
79
|
+
variable: {
|
|
80
|
+
color: CSSObject['color'];
|
|
81
|
+
};
|
|
82
|
+
comment: {
|
|
83
|
+
color: CSSObject['color'];
|
|
84
|
+
};
|
|
85
|
+
text: {
|
|
86
|
+
color: CSSObject['color'];
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export type ResponsiveCodeEditorV2Tokens = {
|
|
92
|
+
[key in keyof BreakpointType]: CodeEditorV2Tokens;
|
|
93
|
+
};
|
|
94
|
+
export declare const getCodeEditorV2Tokens: (foundationToken: FoundationTokenType, theme?: Theme | string) => ResponsiveCodeEditorV2Tokens;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CodeEditorV2Tokens } from './codeEditorV2.tokens';
|
|
3
|
+
import { CSSObject } from 'styled-components';
|
|
4
|
+
export declare enum CodeEditorV2Variant {
|
|
5
|
+
DEFAULT = "default",
|
|
6
|
+
NO_GUTTER = "no-gutter",
|
|
7
|
+
DIFF = "diff"
|
|
8
|
+
}
|
|
9
|
+
export declare enum MonacoTheme {
|
|
10
|
+
LIGHT = "light",
|
|
11
|
+
DARK = "dark"
|
|
12
|
+
}
|
|
13
|
+
export declare enum DiffLineType {
|
|
14
|
+
ADDED = "added",
|
|
15
|
+
REMOVED = "removed",
|
|
16
|
+
UNCHANGED = "unchanged"
|
|
17
|
+
}
|
|
18
|
+
export type DiffLine = {
|
|
19
|
+
content: string;
|
|
20
|
+
type: DiffLineType;
|
|
21
|
+
};
|
|
22
|
+
export type SupportedLanguage = 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'json' | 'css' | 'html' | 'markdown' | 'yaml' | 'python' | 'rust' | 'haskell';
|
|
23
|
+
export type CodeEditorV2Dimensions = {
|
|
24
|
+
width?: CSSObject['width'];
|
|
25
|
+
maxWidth?: CSSObject['maxWidth'];
|
|
26
|
+
minWidth?: CSSObject['minWidth'];
|
|
27
|
+
height?: CSSObject['height'];
|
|
28
|
+
maxHeight?: CSSObject['maxHeight'];
|
|
29
|
+
minHeight?: CSSObject['minHeight'];
|
|
30
|
+
};
|
|
31
|
+
export type CodeEditorV2Props = {
|
|
32
|
+
value: string;
|
|
33
|
+
onChange?: (value: string) => void;
|
|
34
|
+
/** Use `DIFF` to enable Monaco’s diff editor (same as `diff={true}`; either is enough). */
|
|
35
|
+
variant?: CodeEditorV2Variant;
|
|
36
|
+
showLineNumbers?: boolean;
|
|
37
|
+
header?: {
|
|
38
|
+
showHeader?: boolean;
|
|
39
|
+
title?: string;
|
|
40
|
+
leftSlot?: ReactNode;
|
|
41
|
+
rightSlot?: ReactNode;
|
|
42
|
+
showCopyButton?: boolean;
|
|
43
|
+
};
|
|
44
|
+
language?: SupportedLanguage;
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
readOnly?: boolean;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
onBlur?: () => void;
|
|
49
|
+
onFocus?: () => void;
|
|
50
|
+
autoFocus?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When true, renders Monaco’s diff view. Same as `variant={CodeEditorV2Variant.DIFF}`—use
|
|
53
|
+
* either (or both); diff mode is on if either is set.
|
|
54
|
+
*/
|
|
55
|
+
diff?: boolean;
|
|
56
|
+
/** The original (left-side) source for diff mode. */
|
|
57
|
+
originalValue?: string;
|
|
58
|
+
/** Render diffs inline (single column) instead of side-by-side. */
|
|
59
|
+
renderSideBySide?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* When true (default), Monaco hides unchanged regions in diff mode with a
|
|
62
|
+
* GitHub-like expand control.
|
|
63
|
+
*/
|
|
64
|
+
isDiffUnchangedCollapsed?: boolean;
|
|
65
|
+
/** Context lines shown around edits when unchanged regions are hidden. Defaults to 3. */
|
|
66
|
+
diffContextLines?: number;
|
|
67
|
+
/** Lines revealed per expand action when unchanged regions are hidden. Defaults to 20. */
|
|
68
|
+
diffExpandChunk?: number;
|
|
69
|
+
} & CodeEditorV2Dimensions & Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'className' | 'onChange' | 'children'>;
|
|
70
|
+
export type CodeEditorV2HeaderProps = {
|
|
71
|
+
title?: string;
|
|
72
|
+
leftSlot?: ReactNode;
|
|
73
|
+
rightSlot?: ReactNode;
|
|
74
|
+
showCopyButton: boolean;
|
|
75
|
+
isCopied: boolean;
|
|
76
|
+
onCopy: () => void;
|
|
77
|
+
tokens: CodeEditorV2Tokens;
|
|
78
|
+
};
|
|
79
|
+
export type MonacoEditorWrapperDimensions = {
|
|
80
|
+
minHeight: CSSObject['minHeight'];
|
|
81
|
+
maxHeight?: CSSObject['maxHeight'];
|
|
82
|
+
height?: CSSObject['height'];
|
|
83
|
+
width?: CSSObject['width'];
|
|
84
|
+
maxWidth?: CSSObject['maxWidth'];
|
|
85
|
+
minWidth?: CSSObject['minWidth'];
|
|
86
|
+
};
|
|
87
|
+
export type MonacoEditorWrapperProps = {
|
|
88
|
+
value: string;
|
|
89
|
+
language: string;
|
|
90
|
+
onChange?: (value: string) => void;
|
|
91
|
+
readOnly: boolean;
|
|
92
|
+
disabled: boolean;
|
|
93
|
+
placeholder?: string;
|
|
94
|
+
showLineNumbers: boolean;
|
|
95
|
+
tokens: CodeEditorV2Tokens;
|
|
96
|
+
onFocus?: () => void;
|
|
97
|
+
onBlur?: () => void;
|
|
98
|
+
/** When true, focuses the editor on mount. Defaults to false. */
|
|
99
|
+
autoFocus?: boolean;
|
|
100
|
+
/** When true, renders a side-by-side diff view instead of a single editor. */
|
|
101
|
+
diff?: boolean;
|
|
102
|
+
/** The original (left-side) source for diff mode. */
|
|
103
|
+
originalValue?: string;
|
|
104
|
+
/** Render diffs inline (single column) instead of side-by-side. */
|
|
105
|
+
renderSideBySide?: boolean;
|
|
106
|
+
/** Hide unchanged regions in diff mode (GitHub-style). */
|
|
107
|
+
isDiffUnchangedCollapsed?: boolean;
|
|
108
|
+
/** Context lines shown around edits when unchanged regions are hidden. */
|
|
109
|
+
diffContextLines?: number;
|
|
110
|
+
/** Lines revealed per expand action when unchanged regions are hidden. */
|
|
111
|
+
diffExpandChunk?: number;
|
|
112
|
+
} & MonacoEditorWrapperDimensions;
|