@juspay/blend-design-system 0.0.20 → 0.0.21

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.
Files changed (42) hide show
  1. package/dist/components/Accordion/types.d.ts +0 -1
  2. package/dist/components/Button/Button.d.ts +0 -2
  3. package/dist/components/Button/types.d.ts +1 -3
  4. package/dist/components/CodeBlock/CodeBlock.d.ts +3 -0
  5. package/dist/components/CodeBlock/codeBlock.token.d.ts +90 -0
  6. package/dist/components/CodeBlock/index.d.ts +2 -0
  7. package/dist/components/CodeBlock/types.d.ts +25 -0
  8. package/dist/components/CodeBlock/utils.d.ts +38 -0
  9. package/dist/components/DataTable/DataTableHeader/types.d.ts +1 -0
  10. package/dist/components/DataTable/types.d.ts +1 -0
  11. package/dist/components/Directory/types.d.ts +1 -0
  12. package/dist/components/Inputs/OTPInput/OTPInput.d.ts +1 -1
  13. package/dist/components/Inputs/OTPInput/types.d.ts +1 -0
  14. package/dist/components/KeyValuePair/types.d.ts +23 -0
  15. package/dist/components/KeyValuePair/utils.d.ts +23 -0
  16. package/dist/components/Snackbar/snackbar.tokens.d.ts +0 -1
  17. package/dist/components/Stepper/HorizonatlLine.d.ts +6 -0
  18. package/dist/components/Stepper/HorizontalStepper.d.ts +4 -0
  19. package/dist/components/Stepper/Stepper.d.ts +3 -0
  20. package/dist/components/Stepper/StepperLine.d.ts +6 -0
  21. package/dist/components/Stepper/VerticalLine.d.ts +5 -0
  22. package/dist/components/Stepper/VerticalStepper.d.ts +3 -0
  23. package/dist/components/Stepper/index.d.ts +2 -0
  24. package/dist/components/Stepper/stepper.tokens.d.ts +67 -0
  25. package/dist/components/Stepper/types.d.ts +48 -0
  26. package/dist/components/Upload/Upload.d.ts +4 -0
  27. package/dist/components/Upload/components/DefaultState.d.ts +10 -0
  28. package/dist/components/Upload/components/ErrorState.d.ts +14 -0
  29. package/dist/components/Upload/components/FileListDisplay.d.ts +11 -0
  30. package/dist/components/Upload/components/MixedState.d.ts +13 -0
  31. package/dist/components/Upload/components/SuccessState.d.ts +14 -0
  32. package/dist/components/Upload/components/UploadingState.d.ts +13 -0
  33. package/dist/components/Upload/components/index.d.ts +6 -0
  34. package/dist/components/Upload/index.d.ts +2 -0
  35. package/dist/components/Upload/types.d.ts +56 -0
  36. package/dist/components/Upload/upload.tokens.d.ts +101 -0
  37. package/dist/components/Upload/utils.d.ts +114 -0
  38. package/dist/context/ThemeContext.d.ts +7 -1
  39. package/dist/context/useComponentToken.d.ts +4 -1
  40. package/dist/main.d.ts +2 -0
  41. package/dist/main.js +18951 -16026
  42. package/package.json +1 -1
@@ -16,7 +16,6 @@ export type AccordionItemProps = {
16
16
  subtextSlot?: ReactNode;
17
17
  children: ReactNode;
18
18
  isDisabled?: boolean;
19
- className?: string;
20
19
  chevronPosition?: AccordionChevronPosition;
21
20
  };
22
21
  export type AccordionProps = {
@@ -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'>;
@@ -7,6 +7,7 @@ export declare enum KeyValuePairSize {
7
7
  MEDIUM = "md",
8
8
  LARGE = "lg"
9
9
  }
10
+ export type TextOverflowMode = 'truncate' | 'wrap' | 'wrap-clamp';
10
11
  export type KeyValuePairPropTypes = {
11
12
  keyString: string;
12
13
  size?: KeyValuePairSize;
@@ -16,4 +17,26 @@ export type KeyValuePairPropTypes = {
16
17
  valueRightSlot?: React.ReactNode;
17
18
  keyValuePairState?: KeyValuePairStateType;
18
19
  maxWidth?: string;
20
+ /**
21
+ * Controls how text overflow is handled for both key and value
22
+ * - 'truncate': Single line with ellipsis (default, all browsers)
23
+ * - 'wrap': Allow natural text wrapping (all browsers)
24
+ * - 'wrap-clamp': Wrap with line limit and ellipsis (Chrome/Edge/Safari/Firefox 68+, graceful fallback for older browsers)
25
+ *
26
+ * Note: 'wrap-clamp' uses -webkit-line-clamp which is widely supported but non-standard.
27
+ * In unsupported browsers, text will wrap naturally without the line limit.
28
+ *
29
+ * @default 'truncate'
30
+ */
31
+ textOverflow?: TextOverflowMode;
32
+ /**
33
+ * Maximum number of lines to display when textOverflow is 'wrap-clamp'
34
+ * @default 2
35
+ */
36
+ maxLines?: number;
37
+ /**
38
+ * Show tooltip on hover when text is truncated
39
+ * @default true
40
+ */
41
+ showTooltipOnTruncate?: boolean;
19
42
  };
@@ -0,0 +1,23 @@
1
+ import { CSSObject } from 'styled-components';
2
+ import { TextOverflowMode, KeyValuePairStateType } from './types';
3
+ import { KeyValuePairTokensType } from './KeyValuePair.tokens';
4
+ /**
5
+ * Get text styles based on overflow mode
6
+ */
7
+ export declare const getTextStyles: (textOverflow: TextOverflowMode, maxLines: number) => CSSObject;
8
+ /**
9
+ * Get PrimitiveText styles based on overflow mode
10
+ */
11
+ export declare const getPrimitiveTextStyles: (textOverflow: TextOverflowMode) => CSSObject;
12
+ /**
13
+ * Get container styles based on text overflow mode and max width
14
+ */
15
+ export declare const getContainerStyles: (textOverflow: TextOverflowMode, maxWidth: string) => CSSObject;
16
+ /**
17
+ * Get flex direction and gap based on layout state
18
+ */
19
+ export declare const getLayoutStyles: (keyValuePairState: KeyValuePairStateType, keyValuePairTokens: KeyValuePairTokensType) => CSSObject;
20
+ /**
21
+ * Get slot container styles
22
+ */
23
+ export declare const getSlotStyles: () => CSSObject;
@@ -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'];
@@ -0,0 +1,6 @@
1
+ declare const HorizonatlLine: ({ color, height, width, }: {
2
+ color?: string;
3
+ width?: string;
4
+ height?: string;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default HorizonatlLine;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { StepperProps } from './types';
3
+ declare const HorizontalStepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default HorizontalStepper;
@@ -0,0 +1,3 @@
1
+ import { StepperProps } from './types';
2
+ declare const Stepper: import('react').ForwardRefExoticComponent<StepperProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ export default Stepper;
@@ -0,0 +1,6 @@
1
+ import { StepperType } from './types';
2
+ declare const StepperLine: ({ stepperType, color, }: {
3
+ stepperType?: StepperType;
4
+ color?: string;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default StepperLine;
@@ -0,0 +1,5 @@
1
+ declare const VerticalLine: import('react').ForwardRefExoticComponent<{
2
+ color?: string;
3
+ height?: string;
4
+ } & import('react').RefAttributes<HTMLDivElement>>;
5
+ export default VerticalLine;
@@ -0,0 +1,3 @@
1
+ import { StepperProps } from './types';
2
+ declare const VerticalStepper: import('react').ForwardRefExoticComponent<StepperProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ export default VerticalStepper;
@@ -0,0 +1,2 @@
1
+ export { default as Stepper } from './Stepper';
2
+ export * from './types';
@@ -0,0 +1,67 @@
1
+ import { CSSObject } from 'styled-components';
2
+ import { FoundationTokenType } from '../../tokens/theme.token';
3
+ import { BreakpointType } from '../../breakpoints/breakPoints';
4
+ import { StepState } from './types';
5
+ export type StepperState = 'default' | 'hover' | 'focus' | 'disabled';
6
+ export type StepperTokensType = {
7
+ container: {
8
+ default: {
9
+ gap: CSSObject['gap'];
10
+ };
11
+ };
12
+ step: {
13
+ circle: {
14
+ [key in StepState]: {
15
+ [key in StepperState]: {
16
+ backgroundColor: CSSObject['backgroundColor'];
17
+ borderColor: CSSObject['borderColor'];
18
+ borderWidth: CSSObject['borderWidth'];
19
+ borderRadius: CSSObject['borderRadius'];
20
+ size: CSSObject['width'];
21
+ transition: CSSObject['transition'];
22
+ outline: CSSObject['outline'];
23
+ outlineOffset: CSSObject['outlineOffset'];
24
+ };
25
+ };
26
+ };
27
+ icon: {
28
+ [key in StepState]: {
29
+ [key in StepperState]: {
30
+ color: CSSObject['color'];
31
+ };
32
+ };
33
+ };
34
+ };
35
+ connector: {
36
+ line: {
37
+ active: {
38
+ default: {
39
+ color: CSSObject['color'];
40
+ height: CSSObject['height'];
41
+ };
42
+ };
43
+ inactive: {
44
+ default: {
45
+ color: CSSObject['color'];
46
+ height: CSSObject['height'];
47
+ };
48
+ };
49
+ };
50
+ };
51
+ title: {
52
+ text: {
53
+ [key in StepState]: {
54
+ [key in StepperState]: {
55
+ color: CSSObject['color'];
56
+ fontSize: CSSObject['fontSize'];
57
+ fontWeight: CSSObject['fontWeight'];
58
+ gap: CSSObject['gap'];
59
+ };
60
+ };
61
+ };
62
+ };
63
+ };
64
+ export type ResponsiveStepperTokens = {
65
+ [key in keyof BreakpointType]: StepperTokensType;
66
+ };
67
+ export declare const getStepperTokens: (foundationToken: FoundationTokenType) => ResponsiveStepperTokens;
@@ -0,0 +1,48 @@
1
+ import { ReactNode } from 'react';
2
+ export declare enum StepState {
3
+ COMPLETED = "completed",
4
+ CURRENT = "current",
5
+ PENDING = "pending",
6
+ DISABLED = "disabled",
7
+ SKIPPED = "skipped"
8
+ }
9
+ export declare enum StepperType {
10
+ HORIZONTAL = "horizontal",
11
+ VERTICAL = "vertical"
12
+ }
13
+ export type StepperProps = {
14
+ steps: Step[];
15
+ onStepClick?: (stepIndex: number) => void;
16
+ onSubstepClick?: (stepId: number, substepIndex: number) => void;
17
+ clickable?: boolean;
18
+ stepperType?: StepperType;
19
+ };
20
+ export type SubStep = {
21
+ id: number;
22
+ title: string;
23
+ status?: StepState;
24
+ disabled?: boolean;
25
+ };
26
+ export type Step = {
27
+ id: number;
28
+ title: string;
29
+ status?: StepState;
30
+ disabled?: boolean;
31
+ description?: string;
32
+ icon?: ReactNode;
33
+ substeps?: SubStep[];
34
+ isExpandable?: boolean;
35
+ isExpanded?: boolean;
36
+ };
37
+ export type StepProps = {
38
+ step: Step;
39
+ stepIndex: number;
40
+ isCompleted: boolean;
41
+ isCurrent: boolean;
42
+ isLast: boolean;
43
+ isFirst: boolean;
44
+ onClick?: (stepIndex: number) => void;
45
+ onSubstepClick?: (stepIndex: number, substepIndex: number) => void;
46
+ clickable?: boolean;
47
+ currentSubsteps?: Record<string, number>;
48
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { UploadProps } from './types';
3
+ declare const Upload: React.FC<UploadProps>;
4
+ export default Upload;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { UploadTokenType } from '../upload.tokens';
3
+ type DefaultStateProps = {
4
+ children?: React.ReactNode;
5
+ description?: string;
6
+ disabled: boolean;
7
+ uploadTokens: UploadTokenType;
8
+ };
9
+ declare const DefaultState: React.FC<DefaultStateProps>;
10
+ export default DefaultState;
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { UploadedFileWithStatus } from '../types';
3
+ import { UploadTokenType } from '../upload.tokens';
4
+ type ErrorStateProps = {
5
+ errorFiles: UploadedFileWithStatus[];
6
+ multiple: boolean;
7
+ children?: React.ReactNode;
8
+ errorText?: string;
9
+ onFileRemove?: (fileId: string) => void;
10
+ uploadTokens: UploadTokenType;
11
+ maxFiles?: number;
12
+ };
13
+ declare const ErrorState: React.FC<ErrorStateProps>;
14
+ export default ErrorState;
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { UploadedFileWithStatus } from '../types';
3
+ import { UploadTokenType } from '../upload.tokens';
4
+ type FileListDisplayProps = {
5
+ files: UploadedFileWithStatus[];
6
+ onFileRemove?: (fileId: string) => void;
7
+ uploadTokens: UploadTokenType;
8
+ maxFiles?: number;
9
+ };
10
+ declare const FileListDisplay: React.FC<FileListDisplayProps>;
11
+ export default FileListDisplay;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { UploadedFileWithStatus } from '../types';
3
+ import { UploadTokenType } from '../upload.tokens';
4
+ type MixedStateProps = {
5
+ successfulFiles: UploadedFileWithStatus[];
6
+ errorFiles: UploadedFileWithStatus[];
7
+ children?: React.ReactNode;
8
+ onFileRemove?: (fileId: string) => void;
9
+ uploadTokens: UploadTokenType;
10
+ maxFiles?: number;
11
+ };
12
+ declare const MixedState: React.FC<MixedStateProps>;
13
+ export default MixedState;
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { UploadedFileWithStatus } from '../types';
3
+ import { UploadTokenType } from '../upload.tokens';
4
+ type SuccessStateProps = {
5
+ successfulFiles: UploadedFileWithStatus[];
6
+ multiple: boolean;
7
+ children?: React.ReactNode;
8
+ onReplaceFile?: () => void;
9
+ onFileRemove?: (fileId: string) => void;
10
+ uploadTokens: UploadTokenType;
11
+ maxFiles?: number;
12
+ };
13
+ declare const SuccessState: React.FC<SuccessStateProps>;
14
+ export default SuccessState;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { UploadTokenType } from '../upload.tokens';
3
+ type UploadingStateProps = {
4
+ uploadingFile: {
5
+ file: File;
6
+ progress: number;
7
+ };
8
+ children?: React.ReactNode;
9
+ description?: string;
10
+ uploadTokens: UploadTokenType;
11
+ };
12
+ declare const UploadingState: React.FC<UploadingStateProps>;
13
+ export default UploadingState;
@@ -0,0 +1,6 @@
1
+ export { default as FileListDisplay } from './FileListDisplay';
2
+ export { default as UploadingState } from './UploadingState';
3
+ export { default as SuccessState } from './SuccessState';
4
+ export { default as MixedState } from './MixedState';
5
+ export { default as ErrorState } from './ErrorState';
6
+ export { default as DefaultState } from './DefaultState';
@@ -0,0 +1,2 @@
1
+ export { default as Upload } from './Upload';
2
+ export * from './types';
@@ -0,0 +1,56 @@
1
+ import { default as React } from 'react';
2
+ export declare enum UploadState {
3
+ IDLE = "idle",
4
+ UPLOADING = "uploading",
5
+ SUCCESS = "success",
6
+ ERROR = "error"
7
+ }
8
+ export type FileRejection = {
9
+ file: File;
10
+ errors: Array<{
11
+ code: string;
12
+ message: string;
13
+ }>;
14
+ };
15
+ export type UploadFile = {
16
+ file: File;
17
+ progress: number;
18
+ status: UploadState;
19
+ id: string;
20
+ error?: string;
21
+ };
22
+ export type UploadedFileWithStatus = {
23
+ file: File;
24
+ id: string;
25
+ status: 'success' | 'error';
26
+ error?: string;
27
+ };
28
+ export type UploadProps = {
29
+ multiple?: boolean;
30
+ accept?: string[];
31
+ maxSize?: number;
32
+ maxFiles?: number;
33
+ disabled?: boolean;
34
+ required?: boolean;
35
+ label?: string;
36
+ subLabel?: string;
37
+ helpIconHintText?: string;
38
+ children?: React.ReactNode;
39
+ description?: string;
40
+ className?: string;
41
+ errorText?: string;
42
+ state?: UploadState;
43
+ uploadingFiles?: UploadFile[];
44
+ uploadedFiles?: UploadedFileWithStatus[];
45
+ failedFiles?: UploadedFileWithStatus[];
46
+ enforceFileTypeConsistency?: boolean;
47
+ onDrop?: (acceptedFiles: File[], fileRejections: FileRejection[]) => void;
48
+ onDropAccepted?: (files: File[]) => void;
49
+ onDropRejected?: (fileRejections: FileRejection[]) => void;
50
+ onFileRemove?: (fileId: string) => void;
51
+ onReplaceFile?: () => void;
52
+ isDragActive?: boolean;
53
+ isDragAccept?: boolean;
54
+ isDragReject?: boolean;
55
+ validator?: (file: File) => FileRejection['errors'][0] | null;
56
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, 'onDrop' | 'onDragOver' | 'onDragLeave'>;