@lax-wp/design-system 0.1.8 → 0.2.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/buttons/option-button/OptionButton.d.ts +79 -0
- package/dist/components/data-display/diff-viewer/DiffViewer.d.ts +64 -0
- package/dist/components/data-display/label-value/LabelValue.d.ts +121 -0
- package/dist/components/data-display/modal/Modal.d.ts +77 -0
- package/dist/components/data-display/resizable-sidebar/ResizableSidebar.d.ts +54 -0
- package/dist/components/data-display/tag/Tag.d.ts +53 -0
- package/dist/components/floating-bar/FloatingBar.d.ts +147 -0
- package/dist/components/forms/currency-input/currency.constant.d.ts +6 -0
- package/dist/components/forms/file-upload/FileUpload.d.ts +81 -0
- package/dist/components/forms/multi-file-upload/MultiFileUpload.d.ts +78 -0
- package/dist/components/forms/toggle/Toggle.d.ts +1 -1
- package/dist/components/icons/CloseIcon.d.ts +16 -0
- package/dist/components/icons/HelpIcon.d.ts +6 -0
- package/dist/components/icons/SearchIcon.d.ts +6 -0
- package/dist/components/tooltip/Tooltip.d.ts +4 -9
- package/dist/constants/colors.d.ts +263 -0
- package/dist/design-system.css +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.es.js +23279 -14720
- package/dist/index.umd.js +183 -61
- package/dist/utils/formatters.d.ts +24 -0
- package/dist/utils/tagUtils.d.ts +12 -0
- package/package.json +3 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type ReactNode, type MouseEvent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Available button sizes
|
|
4
|
+
*/
|
|
5
|
+
export type OptionButtonSize = "small" | "medium" | "large";
|
|
6
|
+
/**
|
|
7
|
+
* Available button variants
|
|
8
|
+
*/
|
|
9
|
+
export type OptionButtonVariant = "default" | "highlight" | "destructive";
|
|
10
|
+
/**
|
|
11
|
+
* Props for the OptionButton component
|
|
12
|
+
*/
|
|
13
|
+
export interface OptionButtonProps {
|
|
14
|
+
/** Button text content */
|
|
15
|
+
text: string;
|
|
16
|
+
/** Click handler for the button */
|
|
17
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
18
|
+
/** Whether the button is disabled */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Whether the button should be hidden */
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
/** Additional CSS classes */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Button size variant */
|
|
25
|
+
size?: OptionButtonSize;
|
|
26
|
+
/** Button visual variant */
|
|
27
|
+
variant?: OptionButtonVariant;
|
|
28
|
+
/** Icon to display before the text */
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
/** Icon to display after the text (trailing) */
|
|
31
|
+
trailingIcon?: ReactNode;
|
|
32
|
+
/** Whether to hide hover effects */
|
|
33
|
+
hideHoverEffect?: boolean;
|
|
34
|
+
/** Callback when the button is closed */
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/** Whether to stop event propagation on click */
|
|
37
|
+
stopPropagation?: boolean;
|
|
38
|
+
/** Toggle functionality props */
|
|
39
|
+
onToggle?: (checked: boolean) => void;
|
|
40
|
+
/** Whether the toggle is checked (if onToggle is provided) */
|
|
41
|
+
checked?: boolean;
|
|
42
|
+
/** Text to highlight within the button text */
|
|
43
|
+
highlightText?: string;
|
|
44
|
+
/** Whether to truncate text */
|
|
45
|
+
truncateText?: boolean;
|
|
46
|
+
/** Whether to show a checkmark tick */
|
|
47
|
+
showTick?: boolean;
|
|
48
|
+
/** Custom width for the text container */
|
|
49
|
+
textWidth?: string;
|
|
50
|
+
/** Tooltip text to display */
|
|
51
|
+
tooltip?: string;
|
|
52
|
+
/** Suffix badge content */
|
|
53
|
+
suffixBadge?: ReactNode;
|
|
54
|
+
/** Custom aria-label for accessibility */
|
|
55
|
+
"aria-label"?: string;
|
|
56
|
+
/** Test ID for testing purposes */
|
|
57
|
+
"data-testid"?: string;
|
|
58
|
+
/** Whether the button should take full width */
|
|
59
|
+
fullWidth?: boolean;
|
|
60
|
+
/** Error state */
|
|
61
|
+
error?: boolean;
|
|
62
|
+
/** Loading state */
|
|
63
|
+
loading?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* OptionButton component provides a flexible button for lists, menus, and option selections
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <OptionButton
|
|
71
|
+
* text="Save Document"
|
|
72
|
+
* icon={<SaveIcon />}
|
|
73
|
+
* onClick={() => console.log('Save clicked')}
|
|
74
|
+
* size="medium"
|
|
75
|
+
* variant="default"
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare const OptionButton: import("react").ForwardRefExoticComponent<OptionButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Change } from "diff";
|
|
2
|
+
/**
|
|
3
|
+
* Available diff types for comparison
|
|
4
|
+
*/
|
|
5
|
+
export type DiffType = "words" | "lines" | "chars";
|
|
6
|
+
/**
|
|
7
|
+
* Theme variants for diff display
|
|
8
|
+
*/
|
|
9
|
+
export type DiffTheme = "default" | "minimal" | "github";
|
|
10
|
+
/**
|
|
11
|
+
* Props for the DiffViewer component
|
|
12
|
+
*/
|
|
13
|
+
export interface DiffViewerProps {
|
|
14
|
+
/** The original/old text content */
|
|
15
|
+
oldText: string;
|
|
16
|
+
/** The new/updated text content */
|
|
17
|
+
newText: string;
|
|
18
|
+
/** Type of diff comparison to perform */
|
|
19
|
+
diffType?: DiffType;
|
|
20
|
+
/** Visual theme for the diff display */
|
|
21
|
+
theme?: DiffTheme;
|
|
22
|
+
/** Whether to show line numbers (for line diffs) */
|
|
23
|
+
showLineNumbers?: boolean;
|
|
24
|
+
/** Whether to enable word wrapping */
|
|
25
|
+
wordWrap?: boolean;
|
|
26
|
+
/** Additional CSS classes for the wrapper */
|
|
27
|
+
className?: string;
|
|
28
|
+
/** Additional CSS classes for diff segments */
|
|
29
|
+
segmentClassName?: string;
|
|
30
|
+
/** Custom styles for added content */
|
|
31
|
+
addedClassName?: string;
|
|
32
|
+
/** Custom styles for removed content */
|
|
33
|
+
removedClassName?: string;
|
|
34
|
+
/** Custom styles for unchanged content */
|
|
35
|
+
unchangedClassName?: string;
|
|
36
|
+
/** Whether to ignore case differences */
|
|
37
|
+
ignoreCase?: boolean;
|
|
38
|
+
/** Whether to ignore whitespace (for line diffs only) */
|
|
39
|
+
ignoreWhitespace?: boolean;
|
|
40
|
+
/** Maximum width for the diff container */
|
|
41
|
+
maxWidth?: string | number;
|
|
42
|
+
/** Custom aria-label for accessibility */
|
|
43
|
+
"aria-label"?: string;
|
|
44
|
+
/** Callback when diff changes are calculated */
|
|
45
|
+
onDiffCalculated?: (changes: Change[]) => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* DiffViewer component displays text differences with visual highlighting
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <DiffViewer
|
|
53
|
+
* oldText="Hello world"
|
|
54
|
+
* newText="Hello beautiful world"
|
|
55
|
+
* diffType="words"
|
|
56
|
+
* theme="github"
|
|
57
|
+
* />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare const DiffViewer: import("react").ForwardRefExoticComponent<DiffViewerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
61
|
+
/**
|
|
62
|
+
* Legacy export for backward compatibility
|
|
63
|
+
*/
|
|
64
|
+
export declare const InlineDiffHighlighter: import("react").ForwardRefExoticComponent<DiffViewerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Available label value size options
|
|
4
|
+
*/
|
|
5
|
+
export type LabelValueSize = 'small' | 'medium' | 'large';
|
|
6
|
+
/**
|
|
7
|
+
* Available highlight color options
|
|
8
|
+
*/
|
|
9
|
+
export type HighlightColor = 'success' | 'warning' | 'error' | 'info';
|
|
10
|
+
/**
|
|
11
|
+
* Theme mode for styling
|
|
12
|
+
*/
|
|
13
|
+
export type ThemeMode = 'light' | 'dark';
|
|
14
|
+
/**
|
|
15
|
+
* Upload handler function type
|
|
16
|
+
*/
|
|
17
|
+
export type UploadHandler = (file: File) => void | Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Master data item interface
|
|
20
|
+
*/
|
|
21
|
+
export interface MasterDataItem {
|
|
22
|
+
is_master_data?: boolean;
|
|
23
|
+
reference?: string;
|
|
24
|
+
group_technical_name?: string;
|
|
25
|
+
currency_code?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Risk details interface
|
|
29
|
+
*/
|
|
30
|
+
export interface RiskDetails {
|
|
31
|
+
color?: string;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Master data modal component props
|
|
36
|
+
*/
|
|
37
|
+
export interface MasterDataModalProps {
|
|
38
|
+
isVisible: boolean;
|
|
39
|
+
onClose: () => void;
|
|
40
|
+
masterdataInfo: any;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Props for the LabelValue component
|
|
44
|
+
*/
|
|
45
|
+
export interface LabelValueProps {
|
|
46
|
+
/** The label text to display */
|
|
47
|
+
label?: string;
|
|
48
|
+
/** The value to display */
|
|
49
|
+
value?: string | number | boolean;
|
|
50
|
+
/** Additional CSS classes */
|
|
51
|
+
className?: string;
|
|
52
|
+
/** Data type for formatting */
|
|
53
|
+
type?: 'string' | 'number' | 'boolean' | 'currency' | 'date' | 'datetime' | 'percentage' | 'url';
|
|
54
|
+
/** Tags to display with the label */
|
|
55
|
+
tags?: Array<{
|
|
56
|
+
label: string;
|
|
57
|
+
color?: string;
|
|
58
|
+
value?: string;
|
|
59
|
+
}>;
|
|
60
|
+
/** Tooltip text for the help icon */
|
|
61
|
+
tooltip?: string;
|
|
62
|
+
/** Master data item information */
|
|
63
|
+
items?: MasterDataItem;
|
|
64
|
+
/** Whether the value has been modified */
|
|
65
|
+
isModified?: boolean;
|
|
66
|
+
/** Whether the value has been changed */
|
|
67
|
+
isChanged?: boolean;
|
|
68
|
+
/** Size variant */
|
|
69
|
+
size?: LabelValueSize;
|
|
70
|
+
/** Whether the value is highlighted */
|
|
71
|
+
isHighlighted?: boolean;
|
|
72
|
+
/** Deleted value for diff display */
|
|
73
|
+
deletedValue?: string;
|
|
74
|
+
/** Highlight color for changes */
|
|
75
|
+
highlightColor?: HighlightColor;
|
|
76
|
+
/** Whether search is active */
|
|
77
|
+
isSearchActive?: boolean;
|
|
78
|
+
/** Whether to show original boolean value */
|
|
79
|
+
originalValue?: boolean;
|
|
80
|
+
/** Whether to show diff between old and new values */
|
|
81
|
+
showDiff?: boolean;
|
|
82
|
+
/** Theme mode */
|
|
83
|
+
theme?: ThemeMode;
|
|
84
|
+
/** Upload handler function */
|
|
85
|
+
onUpload?: UploadHandler;
|
|
86
|
+
/** Whether the component accepts file uploads */
|
|
87
|
+
acceptsUpload?: boolean;
|
|
88
|
+
/** Master data modal component */
|
|
89
|
+
MasterDataModal?: React.ComponentType<MasterDataModalProps>;
|
|
90
|
+
/** Risk analysis data */
|
|
91
|
+
riskDetails?: RiskDetails;
|
|
92
|
+
/** Whether risk analysis is open */
|
|
93
|
+
isRiskAnalysisOpen?: boolean;
|
|
94
|
+
/** Custom aria-label for accessibility */
|
|
95
|
+
'aria-label'?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* LabelValue component displays a label-value pair with various formatting options
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```tsx
|
|
102
|
+
* <LabelValue
|
|
103
|
+
* label="Status"
|
|
104
|
+
* value="Active"
|
|
105
|
+
* type="string"
|
|
106
|
+
* size="medium"
|
|
107
|
+
* />
|
|
108
|
+
* <LabelValue
|
|
109
|
+
* label="Price"
|
|
110
|
+
* value={99.99}
|
|
111
|
+
* type="currency"
|
|
112
|
+
* items={{ currency_code: 'USD' }}
|
|
113
|
+
* />
|
|
114
|
+
* <LabelValue
|
|
115
|
+
* label="Upload File"
|
|
116
|
+
* acceptsUpload
|
|
117
|
+
* onUpload={handleUpload}
|
|
118
|
+
* />
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare const LabelValue: React.ForwardRefExoticComponent<LabelValueProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Modal size variants
|
|
4
|
+
*/
|
|
5
|
+
export type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
6
|
+
/**
|
|
7
|
+
* Modal appearance variants
|
|
8
|
+
*/
|
|
9
|
+
export type ModalAppearance = "default" | "centered" | "fullscreen";
|
|
10
|
+
/**
|
|
11
|
+
* Props for the Modal component
|
|
12
|
+
*/
|
|
13
|
+
export interface ModalProps {
|
|
14
|
+
/** Whether the modal is open */
|
|
15
|
+
open: boolean;
|
|
16
|
+
/** Modal content */
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/** Modal title */
|
|
19
|
+
title?: string | ReactNode;
|
|
20
|
+
/** Whether to show the backdrop mask */
|
|
21
|
+
mask?: boolean;
|
|
22
|
+
/** Whether to show only the body content without header */
|
|
23
|
+
onlyBody?: boolean;
|
|
24
|
+
/** Whether to add spacing to the body */
|
|
25
|
+
bodySpacing?: boolean;
|
|
26
|
+
/** Custom header content on the right side */
|
|
27
|
+
headerRightContent?: ReactNode;
|
|
28
|
+
/** Container element ID for portal rendering */
|
|
29
|
+
parentContainer?: string;
|
|
30
|
+
/** Whether to add a line after the header */
|
|
31
|
+
addLineAfterHeader?: boolean;
|
|
32
|
+
/** Custom z-index for the modal */
|
|
33
|
+
zIndex?: number;
|
|
34
|
+
/** Whether to render as a form */
|
|
35
|
+
asForm?: boolean;
|
|
36
|
+
/** Form submit handler */
|
|
37
|
+
onSubmit?: () => void;
|
|
38
|
+
/** Whether to show the close button */
|
|
39
|
+
showCloseButton?: boolean;
|
|
40
|
+
/** Whether to remove padding */
|
|
41
|
+
noPadding?: boolean;
|
|
42
|
+
/** Close handler */
|
|
43
|
+
onClose?: () => void;
|
|
44
|
+
/** Cancel handler */
|
|
45
|
+
onCancel?: () => void;
|
|
46
|
+
/** Upload handler function */
|
|
47
|
+
onUpload?: (files: FileList | null) => void;
|
|
48
|
+
/** Modal size */
|
|
49
|
+
size?: ModalSize;
|
|
50
|
+
/** Modal appearance */
|
|
51
|
+
appearance?: ModalAppearance;
|
|
52
|
+
/** Additional CSS classes */
|
|
53
|
+
className?: string;
|
|
54
|
+
/** Custom width */
|
|
55
|
+
width?: number | string;
|
|
56
|
+
/** Custom height */
|
|
57
|
+
height?: number | string;
|
|
58
|
+
/** Footer content */
|
|
59
|
+
footer?: ReactNode;
|
|
60
|
+
/** Whether the modal is closable by clicking outside */
|
|
61
|
+
closable?: boolean;
|
|
62
|
+
/** Whether to center the modal */
|
|
63
|
+
centered?: boolean;
|
|
64
|
+
/** Custom styles */
|
|
65
|
+
style?: React.CSSProperties;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Modal component for displaying overlay content
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <Modal open={isOpen} onClose={() => setIsOpen(false)} title="Example Modal">
|
|
73
|
+
* <p>Modal content goes here</p>
|
|
74
|
+
* </Modal>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare const Modal: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar placement options
|
|
3
|
+
*/
|
|
4
|
+
export type ResizableSidebarPlacement = "left" | "right";
|
|
5
|
+
/**
|
|
6
|
+
* Theme options for the sidebar
|
|
7
|
+
*/
|
|
8
|
+
export type ResizableSidebarTheme = "light" | "dark";
|
|
9
|
+
/**
|
|
10
|
+
* Props for the ResizableSidebar component
|
|
11
|
+
*/
|
|
12
|
+
export interface ResizableSidebarProps {
|
|
13
|
+
/** Whether the sidebar is open */
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
/** Content to display in the sidebar */
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/** Whether to display in full screen mode */
|
|
18
|
+
fullScreen?: boolean;
|
|
19
|
+
/** Callback when drag/resize ends */
|
|
20
|
+
onDragEnd?: (() => void) | null;
|
|
21
|
+
/** Callback when resize occurs */
|
|
22
|
+
onResize?: (width: number) => void;
|
|
23
|
+
/** Additional CSS classes for the wrapper */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Default size of the sidebar */
|
|
26
|
+
defaultSize?: string;
|
|
27
|
+
/** Minimum width of the sidebar */
|
|
28
|
+
minWidth?: number;
|
|
29
|
+
/** Placement of the sidebar */
|
|
30
|
+
placement?: ResizableSidebarPlacement;
|
|
31
|
+
/** Parent container ID for portal rendering */
|
|
32
|
+
parentContainer?: string;
|
|
33
|
+
/** Header content */
|
|
34
|
+
header?: React.ReactNode;
|
|
35
|
+
/** Unique ID for the sidebar */
|
|
36
|
+
id?: string;
|
|
37
|
+
/** Additional CSS classes for the container */
|
|
38
|
+
containerClassName?: string;
|
|
39
|
+
/** Whether to ignore parent container height */
|
|
40
|
+
ignoreParentContainerHeight?: boolean;
|
|
41
|
+
/** Custom height */
|
|
42
|
+
height?: string;
|
|
43
|
+
/** Whether the main sidebar is expanded (affects max width calculation) */
|
|
44
|
+
isMainSidebarExpanded?: boolean;
|
|
45
|
+
/** Width of the main sidebar when expanded */
|
|
46
|
+
mainSidebarExpandedWidth?: number;
|
|
47
|
+
/** Width of the main sidebar when collapsed */
|
|
48
|
+
mainSidebarCollapsedWidth?: number;
|
|
49
|
+
/** Height offset for navbar */
|
|
50
|
+
navbarHeight?: number;
|
|
51
|
+
/** Theme for styling */
|
|
52
|
+
theme?: ResizableSidebarTheme;
|
|
53
|
+
}
|
|
54
|
+
export declare const ResizableSidebar: import("react").ForwardRefExoticComponent<ResizableSidebarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { COLORS } from "../../../constants/colors";
|
|
2
|
+
/**
|
|
3
|
+
* Available tag size options
|
|
4
|
+
*/
|
|
5
|
+
export type TagSize = "xs" | "sm" | "md" | "lg";
|
|
6
|
+
/**
|
|
7
|
+
* Available color names for tags
|
|
8
|
+
*/
|
|
9
|
+
export type TagColor = keyof typeof COLORS;
|
|
10
|
+
/**
|
|
11
|
+
* Theme mode for styling
|
|
12
|
+
*/
|
|
13
|
+
export type ThemeMode = "light" | "dark";
|
|
14
|
+
/**
|
|
15
|
+
* Upload handler function type
|
|
16
|
+
*/
|
|
17
|
+
export type UploadHandler = (file: File) => void | Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Props for the Tag component
|
|
20
|
+
*/
|
|
21
|
+
export interface TagProps {
|
|
22
|
+
/** The text content to display */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Color name or hex color value */
|
|
25
|
+
color?: TagColor | string;
|
|
26
|
+
/** Size variant */
|
|
27
|
+
size?: TagSize;
|
|
28
|
+
/** Additional CSS classes */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Click handler for the tag */
|
|
31
|
+
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
32
|
+
/** Mouse down handler */
|
|
33
|
+
onMouseDown?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
34
|
+
/** Maximum character length before truncation */
|
|
35
|
+
truncate?: number;
|
|
36
|
+
/** Whether to use hash color generation for string colors */
|
|
37
|
+
isHashColor?: boolean;
|
|
38
|
+
/** Icon to display before the label */
|
|
39
|
+
icon?: React.ReactNode;
|
|
40
|
+
/** Whether the tag is removable (shows close button) */
|
|
41
|
+
removable?: boolean;
|
|
42
|
+
/** Handler for remove button click */
|
|
43
|
+
onRemove?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
44
|
+
/** Upload handler function */
|
|
45
|
+
onUpload?: UploadHandler;
|
|
46
|
+
/** Whether the tag accepts file uploads */
|
|
47
|
+
acceptsUpload?: boolean;
|
|
48
|
+
/** Theme mode for styling */
|
|
49
|
+
theme?: ThemeMode;
|
|
50
|
+
/** Custom aria-label for accessibility */
|
|
51
|
+
"aria-label"?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type ReactNode, type MouseEvent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Available floating bar sizes
|
|
4
|
+
*/
|
|
5
|
+
export type FloatingBarSize = "small" | "medium" | "large";
|
|
6
|
+
/**
|
|
7
|
+
* Available floating bar positions
|
|
8
|
+
*/
|
|
9
|
+
export type FloatingBarPosition = "top" | "bottom";
|
|
10
|
+
/**
|
|
11
|
+
* Available floating bar themes
|
|
12
|
+
*/
|
|
13
|
+
export type FloatingBarTheme = "primary" | "dark" | "light";
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for action buttons in the floating bar
|
|
16
|
+
*/
|
|
17
|
+
export interface FloatingBarActionConfig {
|
|
18
|
+
/** Unique identifier for the action */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Button label text */
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Icon element to display */
|
|
23
|
+
icon: ReactNode;
|
|
24
|
+
/** Click handler for the action */
|
|
25
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
26
|
+
/** Icon for dropdown mode */
|
|
27
|
+
dropdownIcon?: ReactNode;
|
|
28
|
+
/** Whether the action is visible */
|
|
29
|
+
visible?: boolean;
|
|
30
|
+
/** Whether the action is disabled */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Tooltip text */
|
|
33
|
+
tooltip?: string;
|
|
34
|
+
/** Whether to hide the label text */
|
|
35
|
+
hideLabel?: boolean;
|
|
36
|
+
/** Action type */
|
|
37
|
+
type?: "button" | "dropdown";
|
|
38
|
+
/** Dropdown menu items */
|
|
39
|
+
dropdownItems?: Array<{
|
|
40
|
+
label: ReactNode;
|
|
41
|
+
key: string;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
onClick?: () => void;
|
|
44
|
+
}>;
|
|
45
|
+
/** Custom CSS classes */
|
|
46
|
+
className?: string;
|
|
47
|
+
/** Test ID for testing */
|
|
48
|
+
"data-testid"?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Configuration for the delete action
|
|
52
|
+
*/
|
|
53
|
+
export interface FloatingBarDeleteConfig {
|
|
54
|
+
/** Delete button label */
|
|
55
|
+
label?: string;
|
|
56
|
+
/** Whether delete is disabled */
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
/** Delete action handler */
|
|
59
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
60
|
+
/** Custom icon for delete */
|
|
61
|
+
icon?: ReactNode;
|
|
62
|
+
/** Delete confirmation required */
|
|
63
|
+
confirmRequired?: boolean;
|
|
64
|
+
/** Confirmation message */
|
|
65
|
+
confirmMessage?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Props for the FloatingBar component
|
|
69
|
+
*/
|
|
70
|
+
export interface FloatingBarProps {
|
|
71
|
+
/** Whether the floating bar is visible */
|
|
72
|
+
show?: boolean;
|
|
73
|
+
/** Close handler */
|
|
74
|
+
onClose: () => void;
|
|
75
|
+
/** Array of action configurations */
|
|
76
|
+
actionItems: FloatingBarActionConfig[];
|
|
77
|
+
/** Number of selected items */
|
|
78
|
+
selectedItemsCount?: number;
|
|
79
|
+
/** Delete action configuration */
|
|
80
|
+
deleteConfig?: FloatingBarDeleteConfig;
|
|
81
|
+
/** Whether to show action background */
|
|
82
|
+
showActionBackground?: boolean;
|
|
83
|
+
/** Floating bar size */
|
|
84
|
+
size?: FloatingBarSize;
|
|
85
|
+
/** Floating bar position */
|
|
86
|
+
position?: FloatingBarPosition;
|
|
87
|
+
/** Floating bar theme */
|
|
88
|
+
theme?: FloatingBarTheme;
|
|
89
|
+
/** Custom width */
|
|
90
|
+
width?: string | number;
|
|
91
|
+
/** Custom CSS classes */
|
|
92
|
+
className?: string;
|
|
93
|
+
/** Custom selected text */
|
|
94
|
+
selectedText?: string;
|
|
95
|
+
/** Custom actions text for collapsed mode */
|
|
96
|
+
actionsText?: string;
|
|
97
|
+
/** Whether to auto-hide on small screens */
|
|
98
|
+
autoHide?: boolean;
|
|
99
|
+
/** Maximum items before collapsing */
|
|
100
|
+
maxVisibleItems?: number;
|
|
101
|
+
/** Animation duration in seconds */
|
|
102
|
+
animationDuration?: number;
|
|
103
|
+
/** Custom aria-label */
|
|
104
|
+
"aria-label"?: string;
|
|
105
|
+
/** Test ID for testing */
|
|
106
|
+
"data-testid"?: string;
|
|
107
|
+
/** Error state */
|
|
108
|
+
error?: boolean;
|
|
109
|
+
/** Loading state */
|
|
110
|
+
loading?: boolean;
|
|
111
|
+
/** Error message */
|
|
112
|
+
errorMessage?: string;
|
|
113
|
+
/** Callback when actions overflow */
|
|
114
|
+
onOverflow?: (isOverflowing: boolean) => void;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* FloatingBar component provides a floating action bar for bulk operations
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <FloatingBar
|
|
122
|
+
* show={selectedItems.length > 0}
|
|
123
|
+
* onClose={() => setSelectedItems([])}
|
|
124
|
+
* selectedItemsCount={selectedItems.length}
|
|
125
|
+
* actionItems={[
|
|
126
|
+
* {
|
|
127
|
+
* id: "edit",
|
|
128
|
+
* label: "Edit",
|
|
129
|
+
* icon: <EditIcon />,
|
|
130
|
+
* onClick: handleEdit,
|
|
131
|
+
* },
|
|
132
|
+
* {
|
|
133
|
+
* id: "archive",
|
|
134
|
+
* label: "Archive",
|
|
135
|
+
* icon: <ArchiveIcon />,
|
|
136
|
+
* onClick: handleArchive,
|
|
137
|
+
* },
|
|
138
|
+
* ]}
|
|
139
|
+
* deleteConfig={{
|
|
140
|
+
* label: "Delete",
|
|
141
|
+
* onClick: handleDelete,
|
|
142
|
+
* confirmRequired: true,
|
|
143
|
+
* }}
|
|
144
|
+
* />
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export declare const FloatingBar: import("react").ForwardRefExoticComponent<FloatingBarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available currencies for the CurrencyInputField component
|
|
3
|
+
*/
|
|
1
4
|
export declare const CURRENCIES: {
|
|
2
5
|
value: string;
|
|
3
6
|
label: string;
|
|
4
7
|
symbol: string;
|
|
5
8
|
}[];
|
|
9
|
+
/**
|
|
10
|
+
* Currency symbols mapping for display purposes
|
|
11
|
+
*/
|
|
6
12
|
export declare const CURRENCY_SYMBOLS: Record<string, string>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* File upload size options
|
|
4
|
+
*/
|
|
5
|
+
export type FileUploadSize = "small" | "medium" | "large";
|
|
6
|
+
/**
|
|
7
|
+
* File upload variant options
|
|
8
|
+
*/
|
|
9
|
+
export type FileUploadVariant = "primary" | "secondary";
|
|
10
|
+
/**
|
|
11
|
+
* Props for the FileUpload component
|
|
12
|
+
*/
|
|
13
|
+
export interface FileUploadProps {
|
|
14
|
+
/** Unique identifier for the file upload */
|
|
15
|
+
id?: string;
|
|
16
|
+
/** Callback function called when file is selected */
|
|
17
|
+
onFileSelect: (file: File | File[] | null, fileName?: string) => void;
|
|
18
|
+
/** Custom upload handler function */
|
|
19
|
+
onUpload?: (file: File | File[]) => Promise<void>;
|
|
20
|
+
/** Description text to display */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Error message to display */
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
/** Whether the upload is disabled */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Default file to display */
|
|
27
|
+
defaultFile?: File | null;
|
|
28
|
+
/** Accepted file types (e.g., ".pdf,.doc,.docx") */
|
|
29
|
+
acceptedFiles?: string;
|
|
30
|
+
/** Whether the upload is in loading state */
|
|
31
|
+
isLoading?: boolean;
|
|
32
|
+
/** Whether to convert file to base64 */
|
|
33
|
+
asBase64?: boolean;
|
|
34
|
+
/** Whether to allow multiple file selection */
|
|
35
|
+
multiple?: boolean;
|
|
36
|
+
/** Whether to hide the selected file display */
|
|
37
|
+
hideSelectedFile?: boolean;
|
|
38
|
+
/** Callback when file is deleted */
|
|
39
|
+
onDelete?: () => void;
|
|
40
|
+
/** Maximum file size in bytes (default: 200MB) */
|
|
41
|
+
maxSize?: number;
|
|
42
|
+
/** Additional CSS classes for the wrapper container */
|
|
43
|
+
wrapperClassName?: string;
|
|
44
|
+
/** Additional CSS classes for the upload area */
|
|
45
|
+
uploadClassName?: string;
|
|
46
|
+
/** Size variant for the upload area */
|
|
47
|
+
size?: FileUploadSize;
|
|
48
|
+
/** Visual variant for the upload area */
|
|
49
|
+
variant?: FileUploadVariant;
|
|
50
|
+
/** Custom upload icon */
|
|
51
|
+
uploadIcon?: ReactNode;
|
|
52
|
+
/** Custom delete icon */
|
|
53
|
+
deleteIcon?: ReactNode;
|
|
54
|
+
/** Custom file type icons */
|
|
55
|
+
fileTypeIcons?: {
|
|
56
|
+
pdf?: ReactNode;
|
|
57
|
+
default?: ReactNode;
|
|
58
|
+
};
|
|
59
|
+
/** Whether to show file size */
|
|
60
|
+
showFileSize?: boolean;
|
|
61
|
+
/** Whether to show upload progress */
|
|
62
|
+
showProgress?: boolean;
|
|
63
|
+
/** Upload progress percentage */
|
|
64
|
+
progress?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A highly customizable file upload component with drag-and-drop support.
|
|
68
|
+
* Features multiple sizes, variants, file type detection, and comprehensive styling options.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <FileUpload
|
|
73
|
+
* id="document-upload"
|
|
74
|
+
* onFileSelect={(file) => console.log('File selected:', file)}
|
|
75
|
+
* description="Upload your document here"
|
|
76
|
+
* acceptedFiles=".pdf,.doc,.docx"
|
|
77
|
+
* maxSize={10 * 1024 * 1024} // 10MB
|
|
78
|
+
* />
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare const FileUpload: import("react").ForwardRefExoticComponent<FileUploadProps & import("react").RefAttributes<HTMLDivElement>>;
|