@juspay/blend-design-system 0.0.20 → 0.0.21-beta

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.
@@ -6,8 +6,6 @@ declare const Button: import('react').ForwardRefExoticComponent<{
6
6
  text?: string;
7
7
  leadingIcon?: React.ReactNode;
8
8
  trailingIcon?: React.ReactNode;
9
- isLoading?: boolean;
10
- isDisabled?: boolean;
11
9
  disabled?: boolean;
12
10
  onClick?: () => void;
13
11
  loading?: boolean;
@@ -18,7 +18,7 @@ export declare enum ButtonSubType {
18
18
  }
19
19
  export declare enum ButtonState {
20
20
  DEFAULT = "default",
21
- HOBVER = "hover",
21
+ HOVER = "hover",
22
22
  ACTIVE = "active",
23
23
  DISABLED = "disabled"
24
24
  }
@@ -29,8 +29,6 @@ export type ButtonProps = {
29
29
  text?: string;
30
30
  leadingIcon?: React.ReactNode;
31
31
  trailingIcon?: React.ReactNode;
32
- isLoading?: boolean;
33
- isDisabled?: boolean;
34
32
  disabled?: boolean;
35
33
  onClick?: () => void;
36
34
  loading?: boolean;
@@ -0,0 +1,3 @@
1
+ import { CodeBlockProps } from './types';
2
+ declare const CodeBlock: import('react').ForwardRefExoticComponent<CodeBlockProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ export default CodeBlock;
@@ -0,0 +1,90 @@
1
+ import { CSSObject } from 'styled-components';
2
+ import { FoundationTokenType } from '../../tokens/theme.token';
3
+ import { BreakpointType } from '../../breakpoints/breakPoints';
4
+ import { DiffLineType } from './types';
5
+ /**
6
+ * CodeBlock Tokens following the pattern: [target].CSSProp.[variant].[state]
7
+ *
8
+ * Structure:
9
+ * - target: container | header | gutter | code | syntax (defines what element the token applies to)
10
+ * - CSSProp: backgroundColor | border | borderRadius | padding | color | fontSize | fontFamily | lineHeight
11
+ * - variant: default | removed | added (for diff-specific styles)
12
+ * - state: default | hover | active (for interactive elements)
13
+ * Need to check for this — Rust, Haskel, resript, python
14
+ * Size-independent properties: all properties are size-independent for CodeBlock
15
+ */
16
+ export type CodeBlockTokenType = {
17
+ backgroundColor: CSSObject['backgroundColor'];
18
+ border: CSSObject['border'];
19
+ borderRadius: CSSObject['borderRadius'];
20
+ boxShadow: CSSObject['boxShadow'];
21
+ header: {
22
+ backgroundColor: CSSObject['backgroundColor'];
23
+ borderBottom: CSSObject['borderBottom'];
24
+ padding: {
25
+ x: CSSObject['padding'];
26
+ y: CSSObject['padding'];
27
+ };
28
+ gap: CSSObject['gap'];
29
+ icon: {
30
+ width: CSSObject['width'];
31
+ };
32
+ text: {
33
+ fontSize: CSSObject['fontSize'];
34
+ fontWeight: CSSObject['fontWeight'];
35
+ lineHeight: CSSObject['lineHeight'];
36
+ color: CSSObject['color'];
37
+ };
38
+ };
39
+ body: {
40
+ padding: {
41
+ x: CSSObject['padding'];
42
+ y: CSSObject['padding'];
43
+ };
44
+ backgroundColor: CSSObject['backgroundColor'];
45
+ gutter: {
46
+ width: CSSObject['width'];
47
+ color: CSSObject['color'];
48
+ backgroundColor: {
49
+ [key in DiffLineType]: CSSObject['backgroundColor'];
50
+ };
51
+ borderLeft: {
52
+ [key in DiffLineType]: CSSObject['borderLeft'];
53
+ };
54
+ borderColor: {
55
+ [key in DiffLineType]: CSSObject['color'];
56
+ };
57
+ };
58
+ code: {
59
+ fontFamily: CSSObject['fontFamily'];
60
+ fontSize: CSSObject['fontSize'];
61
+ lineHeight: CSSObject['lineHeight'];
62
+ padding: {
63
+ x: {
64
+ left: CSSObject['paddingLeft'];
65
+ right: CSSObject['paddingRight'];
66
+ };
67
+ y: CSSObject['padding'];
68
+ };
69
+ };
70
+ highlightedLine: {
71
+ backgroundColor: {
72
+ [key in DiffLineType]: CSSObject['backgroundColor'];
73
+ };
74
+ };
75
+ syntax: {
76
+ keyword: CSSObject['color'];
77
+ function: CSSObject['color'];
78
+ string: CSSObject['color'];
79
+ number: CSSObject['color'];
80
+ operator: CSSObject['color'];
81
+ variable: CSSObject['color'];
82
+ comment: CSSObject['color'];
83
+ text: CSSObject['color'];
84
+ };
85
+ };
86
+ };
87
+ export type ResponsiveCodeBlockTokens = {
88
+ [key in keyof BreakpointType]: CodeBlockTokenType;
89
+ };
90
+ export declare const getCodeBlockTokens: (foundationToken: FoundationTokenType) => ResponsiveCodeBlockTokens;
@@ -0,0 +1,2 @@
1
+ export { default as CodeBlock } from './CodeBlock';
2
+ export * from './types';
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ export declare enum CodeBlockVariant {
3
+ DEFAULT = "default",
4
+ NO_GUTTER = "no-gutter",
5
+ DIFF = "diff"
6
+ }
7
+ export declare enum DiffLineType {
8
+ ADDED = "added",
9
+ REMOVED = "removed",
10
+ UNCHANGED = "unchanged"
11
+ }
12
+ export interface DiffLine {
13
+ content: string;
14
+ type: DiffLineType;
15
+ }
16
+ export type CodeBlockProps = {
17
+ code: string;
18
+ variant?: CodeBlockVariant;
19
+ showLineNumbers?: boolean;
20
+ showHeader?: boolean;
21
+ header?: string;
22
+ headerLeftSlot?: ReactNode;
23
+ headerRightSlot?: ReactNode;
24
+ diffLines?: DiffLine[];
25
+ };
@@ -0,0 +1,38 @@
1
+ import { CodeBlockTokenType } from './codeBlock.token';
2
+ import { DiffLineType, DiffLine } from './types';
3
+ /**
4
+ * Token interface for syntax highlighting
5
+ */
6
+ export interface SyntaxToken {
7
+ type: string;
8
+ value: string;
9
+ }
10
+ /**
11
+ * Tokenizes a line of code for syntax highlighting
12
+ * Supports multiple languages: JavaScript/TypeScript, Python, Rust, Haskell
13
+ */
14
+ export declare const tokenizeLine: (line: string) => SyntaxToken[];
15
+ /**
16
+ * Gets the color for a token type based on syntax highlighting rules
17
+ */
18
+ export declare const getTokenColor: (type: string, syntaxTokens: CodeBlockTokenType["body"]["syntax"]) => string;
19
+ /**
20
+ * Gets the gutter (line number) styling for diff mode
21
+ */
22
+ export declare const getDiffGutterStyle: (lineType: DiffLineType | undefined, isDiffMode: boolean, gutterTokens: CodeBlockTokenType["body"]["gutter"]) => React.CSSProperties;
23
+ /**
24
+ * Gets the highlighted line background styling for diff mode
25
+ */
26
+ export declare const getDiffLineBackground: (lineType: DiffLineType | undefined, isDiffMode: boolean, highlightedLineTokens: CodeBlockTokenType["body"]["highlightedLine"]) => React.CSSProperties;
27
+ /**
28
+ * Determines if line numbers should be shown based on variant and explicit prop
29
+ */
30
+ export declare const shouldShowLineNumbers: (showLineNumbers: boolean | undefined, variant: string) => boolean;
31
+ /**
32
+ * Creates a copy to clipboard function with state management
33
+ */
34
+ export declare const createCopyToClipboard: (code: string, setIsCopied: (copied: boolean) => void) => () => void;
35
+ /**
36
+ * Processes lines for diff or normal mode
37
+ */
38
+ export declare const processLines: (isDiffMode: boolean, diffLines: DiffLine[] | undefined, code: string) => string[] | undefined;
@@ -2,6 +2,7 @@ import { ColumnDefinition, SearchConfig, AdvancedFilterProps } from '../types';
2
2
  export type DataTableHeaderProps<T extends Record<string, unknown>> = {
3
3
  title?: string;
4
4
  description?: string;
5
+ showHeader?: boolean;
5
6
  showToolbar?: boolean;
6
7
  enableSearch?: boolean;
7
8
  searchPlaceholder?: string;
@@ -254,6 +254,7 @@ export type DataTableProps<T extends Record<string, unknown>> = {
254
254
  onPageChange?: (page: number) => void;
255
255
  onPageSizeChange?: (pageSize: number) => void;
256
256
  isLoading?: boolean;
257
+ showHeader?: boolean;
257
258
  showToolbar?: boolean;
258
259
  showSettings?: boolean;
259
260
  headerSlot1?: ReactNode;
@@ -16,6 +16,7 @@ export type NavbarItem = {
16
16
  rightSlot?: ReactNode;
17
17
  onClick?: () => void;
18
18
  href?: string;
19
+ isSelected?: boolean;
19
20
  };
20
21
  export type SectionProps = {
21
22
  section: DirectoryData;
@@ -1,3 +1,3 @@
1
1
  import { OTPProps } from './types';
2
- declare const OTPInput: ({ label, sublabel, disabled, helpIconHintText, name, required, error, errorMessage, hintText, value, length, autoFocus, onChange, form, ...rest }: OTPProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const OTPInput: ({ label, placeholder, sublabel, disabled, helpIconHintText, name, required, error, errorMessage, hintText, value, length, autoFocus, onChange, form, ...rest }: OTPProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default OTPInput;
@@ -10,4 +10,5 @@ export type OTPProps = {
10
10
  autoFocus?: boolean;
11
11
  onChange?: (value: string) => void;
12
12
  form?: string;
13
+ placeholder?: string;
13
14
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'style' | 'className' | 'onChange'>;
@@ -26,7 +26,6 @@ export type SnackbarTokens = Readonly<{
26
26
  backgroundColor: CSSObject['backgroundColor'];
27
27
  borderRadius: CSSObject['borderRadius'];
28
28
  padding: CSSObject['padding'];
29
- minWidth: CSSObject['minWidth'];
30
29
  maxWidth: CSSObject['maxWidth'];
31
30
  boxShadow: CSSObject['boxShadow'];
32
31
  gap: CSSObject['gap'];
@@ -34,6 +34,7 @@ import { ResponsiveTopbarTokens } from '../components/Topbar/topbar.tokens';
34
34
  import { ResponsiveAvatarTokens } from '../components/Avatar/avatar.tokens';
35
35
  import { ResponsiveAvatarGroupTokens } from '../components/AvatarGroup/avatarGroup.tokens';
36
36
  import { ResponsiveSidebarTokens } from '../components/Sidebar/sidebar.tokens';
37
+ import { ResponsiveCodeBlockTokens } from '../components/CodeBlock/codeBlock.token';
37
38
  import { ThemeType } from '../tokens';
38
39
  import { BREAKPOINTS } from '../breakpoints/breakPoints';
39
40
  import { ResponsiveSkeletonTokens } from '../components/Skeleton/skeleton.tokens';
@@ -75,6 +76,7 @@ export type ComponentTokenType = {
75
76
  AVATAR?: ResponsiveAvatarTokens;
76
77
  AVATAR_GROUP?: ResponsiveAvatarGroupTokens;
77
78
  SIDEBAR?: ResponsiveSidebarTokens;
79
+ CODE_BLOCK?: ResponsiveCodeBlockTokens;
78
80
  };
79
81
  type ThemeContextType = {
80
82
  foundationTokens: ThemeType;
@@ -36,4 +36,5 @@ import { ResponsiveAvatarTokens } from '../components/Avatar/avatar.tokens';
36
36
  import { ResponsiveAvatarGroupTokens } from '../components/AvatarGroup/avatarGroup.tokens';
37
37
  import { ResponsiveStatCardTokens } from '../components/StatCard/statcard.tokens';
38
38
  import { ResponsiveSidebarTokens } from '../components/Sidebar/sidebar.tokens';
39
- export declare const useComponentToken: (component: keyof ComponentTokenType) => ResponsiveSearchInputTokens | ResponsiveTagTokens | ResponsiveTextAreaTokens | ResponsiveTextInputTokens | ResponsiveNumberInputTokens | ResponsiveAlertTokens | ResponsiveRadioTokens | ResponsiveOTPInputTokens | ResponsiveUnitInputTokens | ResponsiveMultiValueInputTokens | ResponsiveSwitchTokens | ResponsiveCheckboxTokens | ResponsiveTabsTokens | ResponsiveTooltipTokens | ResponsiveDropdownInputTokens | ResponsiveButtonTokens | ResponsiveModalTokens | ResponsiveBreadcrumbTokens | ResponsivePopoverTokens | ResponsiveMenuTokensType | ResponsiveMultiSelectTokens | ResponsiveSingleSelectTokens | ResponsiveTableTokens | ResponsiveCalendarTokens | ResponsiveAccordionTokens | ResponsiveStatCardTokens | ResponsiveProgressBarTokens | ResponsiveDrawerTokens | ResponsiveChartTokens | ResponsiveSnackbarTokens | ResponsiveKeyValuePairTokens | ResponsiveCardTokens | ResponsiveSkeletonTokens | ResponsiveTopbarTokens | ResponsiveAvatarTokens | ResponsiveAvatarGroupTokens | ResponsiveSidebarTokens;
39
+ import { ResponsiveCodeBlockTokens } from '../components/CodeBlock/codeBlock.token';
40
+ export declare const useComponentToken: (component: keyof ComponentTokenType) => ResponsiveSearchInputTokens | ResponsiveTagTokens | ResponsiveTextAreaTokens | ResponsiveTextInputTokens | ResponsiveNumberInputTokens | ResponsiveAlertTokens | ResponsiveRadioTokens | ResponsiveOTPInputTokens | ResponsiveUnitInputTokens | ResponsiveMultiValueInputTokens | ResponsiveSwitchTokens | ResponsiveCheckboxTokens | ResponsiveTabsTokens | ResponsiveTooltipTokens | ResponsiveDropdownInputTokens | ResponsiveButtonTokens | ResponsiveModalTokens | ResponsiveBreadcrumbTokens | ResponsivePopoverTokens | ResponsiveMenuTokensType | ResponsiveMultiSelectTokens | ResponsiveSingleSelectTokens | ResponsiveTableTokens | ResponsiveCalendarTokens | ResponsiveAccordionTokens | ResponsiveStatCardTokens | ResponsiveProgressBarTokens | ResponsiveDrawerTokens | ResponsiveChartTokens | ResponsiveSnackbarTokens | ResponsiveKeyValuePairTokens | ResponsiveCardTokens | ResponsiveSkeletonTokens | ResponsiveTopbarTokens | ResponsiveAvatarTokens | ResponsiveAvatarGroupTokens | ResponsiveSidebarTokens | ResponsiveCodeBlockTokens;