@lax-wp/design-system 0.3.36 → 0.3.38
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/data-display/code-editor/CodeEditor.d.ts +3 -1
- package/dist/components/forms/base-input-field/BaseInputField.d.ts +136 -0
- package/dist/components/forms/customizable-select-field/CustomizableSelectField.d.ts +112 -0
- package/dist/components/forms/text-area-field/TextAreaField.d.ts +122 -0
- package/dist/components/forms/toggle/Toggle.d.ts +9 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +10225 -9346
- package/dist/index.umd.js +69 -51
- package/dist/types/index.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import { type CodeEditorProps } from '../../../types';
|
|
3
|
-
|
|
3
|
+
declare const TABS: ('JSON' | 'Grid')[];
|
|
4
|
+
export type TTabKey = (typeof TABS)[number];
|
|
4
5
|
export declare const CodeEditor: FC<CodeEditorProps>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { LabelType } from "../../data-display/label/Label";
|
|
3
|
+
/**
|
|
4
|
+
* Risk details interface
|
|
5
|
+
*/
|
|
6
|
+
export interface RiskDetails {
|
|
7
|
+
color?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
hexBgColor?: string;
|
|
10
|
+
hexBorderColor?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Risk details card component props
|
|
15
|
+
*/
|
|
16
|
+
export interface RiskDetailsCardProps {
|
|
17
|
+
riskDetails: RiskDetails;
|
|
18
|
+
maxWidth?: string;
|
|
19
|
+
showAllRisksSuggestions?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Props for the BaseInputField component
|
|
23
|
+
*/
|
|
24
|
+
export type TBaseInputFieldProps = any & {
|
|
25
|
+
/** Current value of the input */
|
|
26
|
+
value: string;
|
|
27
|
+
/** Callback function called when the input value changes */
|
|
28
|
+
onChange(data: any): void;
|
|
29
|
+
/** Callback function for key down events */
|
|
30
|
+
onKeyDown?: void;
|
|
31
|
+
/** Error message to display */
|
|
32
|
+
errorMessage: string;
|
|
33
|
+
/** Default value for the input */
|
|
34
|
+
defaultValue?: string;
|
|
35
|
+
/** Whether the input is disabled */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** Maximum value for number inputs */
|
|
38
|
+
max?: number;
|
|
39
|
+
/** Minimum value for number inputs */
|
|
40
|
+
min?: number;
|
|
41
|
+
/** Whether the field is required */
|
|
42
|
+
required?: boolean;
|
|
43
|
+
/** Whether the required indicator shows as conditional */
|
|
44
|
+
isRequiredConditional?: boolean;
|
|
45
|
+
/** Background color class */
|
|
46
|
+
bg?: string;
|
|
47
|
+
/** Tags to display with the label */
|
|
48
|
+
tags?: (string | LabelType)[];
|
|
49
|
+
/** Text color class */
|
|
50
|
+
color?: string;
|
|
51
|
+
/** Unique identifier for the input */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Label text for the input */
|
|
54
|
+
label?: string;
|
|
55
|
+
/** Input type (text, email, password, number, etc.) */
|
|
56
|
+
type?: string;
|
|
57
|
+
/** Value to revert back to */
|
|
58
|
+
revertBackValue?: any;
|
|
59
|
+
/** Placeholder text */
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
/** Whether this is a password field with visibility toggle */
|
|
62
|
+
isPasswordField?: boolean;
|
|
63
|
+
/** Callback to set password visibility */
|
|
64
|
+
setIsPasswordVisible?: any;
|
|
65
|
+
/** Tooltip text */
|
|
66
|
+
tooltip?: string;
|
|
67
|
+
/** Whether to preserve original case in the label */
|
|
68
|
+
originalCase?: boolean;
|
|
69
|
+
/** Icon or element to display at the end of the input */
|
|
70
|
+
suffixIcon?: React.ReactNode;
|
|
71
|
+
/** Text size class */
|
|
72
|
+
textSize?: string;
|
|
73
|
+
/** Whether the value was AI extracted */
|
|
74
|
+
isAiExtracted?: boolean;
|
|
75
|
+
/** Whether this is a GTN field */
|
|
76
|
+
isGTN?: boolean;
|
|
77
|
+
/** GTN name for document integration */
|
|
78
|
+
gtnName?: any;
|
|
79
|
+
/** Success message to display */
|
|
80
|
+
successMessage?: string;
|
|
81
|
+
/** Additional CSS classes for the input element */
|
|
82
|
+
inputClassName?: string;
|
|
83
|
+
/** Inline styles for the input element */
|
|
84
|
+
inputStyle?: React.CSSProperties;
|
|
85
|
+
/** Additional CSS classes for the label */
|
|
86
|
+
labelClassName?: string;
|
|
87
|
+
/** Whether this is a live field */
|
|
88
|
+
isLiveField?: boolean;
|
|
89
|
+
/** Callback function for blur events */
|
|
90
|
+
onBlur?: () => void;
|
|
91
|
+
/** Whether the input is clearable */
|
|
92
|
+
isClearable?: boolean;
|
|
93
|
+
/** Additional CSS classes for the wrapper */
|
|
94
|
+
className?: string;
|
|
95
|
+
/** Ref for the input element */
|
|
96
|
+
inputRef?: React.RefObject<HTMLInputElement>;
|
|
97
|
+
/** Risk details data */
|
|
98
|
+
riskDetails?: RiskDetails;
|
|
99
|
+
/** Whether risk analysis is open */
|
|
100
|
+
isRiskAnalysisOpen?: boolean;
|
|
101
|
+
/** Custom risk details card component */
|
|
102
|
+
RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps>;
|
|
103
|
+
/** AI extracted indicator component */
|
|
104
|
+
AIExtractedIndicator?: React.ComponentType;
|
|
105
|
+
/** Required indicator component */
|
|
106
|
+
RequiredIndicator?: React.ComponentType<{
|
|
107
|
+
isConditional?: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
/** Handler for adding GTN to document */
|
|
110
|
+
onAddGTNToDocument?: (keyValuePair: {
|
|
111
|
+
key: string;
|
|
112
|
+
value: string;
|
|
113
|
+
}) => void;
|
|
114
|
+
/** Translation function */
|
|
115
|
+
t?: (key: string) => string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* A feature-rich input field component with label, validation, GTN integration,
|
|
119
|
+
* risk analysis support, and comprehensive styling options.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx
|
|
123
|
+
* <BaseInputField
|
|
124
|
+
* id="email"
|
|
125
|
+
* label="Email Address"
|
|
126
|
+
* type="email"
|
|
127
|
+
* value={email}
|
|
128
|
+
* onChange={setEmail}
|
|
129
|
+
* placeholder="Enter your email"
|
|
130
|
+
* required
|
|
131
|
+
* errorMessage={emailError}
|
|
132
|
+
* />
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare const BaseInputField: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
136
|
+
export default BaseInputField;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Option type for CustomizableSelectField
|
|
3
|
+
*/
|
|
4
|
+
export interface CustomizableSelectOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Option config for customizing option rendering
|
|
11
|
+
*/
|
|
12
|
+
export interface OptionConfig {
|
|
13
|
+
/** Custom component to render for options */
|
|
14
|
+
component?: React.ComponentType<any>;
|
|
15
|
+
/** Props to pass to the custom component */
|
|
16
|
+
componentProps?: Record<string, any>;
|
|
17
|
+
/** Indicator to show when option is selected */
|
|
18
|
+
selectIndecator?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Menu config for customizing menu rendering
|
|
22
|
+
*/
|
|
23
|
+
export interface MenuConfig {
|
|
24
|
+
/** Additional CSS class for the menu */
|
|
25
|
+
className?: string;
|
|
26
|
+
/** Additional CSS class for each option */
|
|
27
|
+
optionClassName?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Props for the CustomizableSelectField component
|
|
31
|
+
*/
|
|
32
|
+
export interface CustomizableSelectFieldProps {
|
|
33
|
+
/** Unique identifier for the select */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Label text to display above the select */
|
|
36
|
+
label?: string;
|
|
37
|
+
/** Array of select options */
|
|
38
|
+
options: CustomizableSelectOption[];
|
|
39
|
+
/** Placeholder text for the select */
|
|
40
|
+
placeholder: string;
|
|
41
|
+
/** Callback function called when selection changes */
|
|
42
|
+
onChange: (_value: any) => void;
|
|
43
|
+
/** Whether the select is in loading state */
|
|
44
|
+
isLoading?: boolean;
|
|
45
|
+
/** Whether to hide the label */
|
|
46
|
+
hideLabel?: boolean;
|
|
47
|
+
/** Error message to display */
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
/** Whether the field is required */
|
|
50
|
+
required?: boolean;
|
|
51
|
+
/** Configuration for option rendering */
|
|
52
|
+
optionConfig?: OptionConfig;
|
|
53
|
+
/** Configuration for menu rendering */
|
|
54
|
+
menuConfig?: MenuConfig;
|
|
55
|
+
/** Parent container selector (deprecated, not used) */
|
|
56
|
+
parentContainer?: string;
|
|
57
|
+
/** Current value of the select */
|
|
58
|
+
value?: any;
|
|
59
|
+
/** Whether multiple selections are allowed */
|
|
60
|
+
isMulti?: boolean;
|
|
61
|
+
/** Whether the select is clearable */
|
|
62
|
+
isClearable?: boolean;
|
|
63
|
+
/** Whether the select is disabled */
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
/** Additional CSS classes */
|
|
66
|
+
className?: string;
|
|
67
|
+
/** Whether dark mode is enabled */
|
|
68
|
+
isDark?: boolean;
|
|
69
|
+
/** Primary color shades for styling */
|
|
70
|
+
primaryColorShades?: Record<number, string>;
|
|
71
|
+
/** Required indicator component */
|
|
72
|
+
RequiredIndicator?: React.ComponentType;
|
|
73
|
+
/** Additional props */
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A highly customizable select field component with custom option and menu rendering support.
|
|
78
|
+
* Features dark mode support, multi-select capability, and comprehensive prop support.
|
|
79
|
+
* Built on top of react-select for advanced functionality.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <CustomizableSelectField
|
|
84
|
+
* id="country"
|
|
85
|
+
* label="Country"
|
|
86
|
+
* options={[
|
|
87
|
+
* { label: 'United States', value: 'us' },
|
|
88
|
+
* { label: 'Canada', value: 'ca' }
|
|
89
|
+
* ]}
|
|
90
|
+
* placeholder="Select a country"
|
|
91
|
+
* onChange={(value) => console.log(value)}
|
|
92
|
+
* />
|
|
93
|
+
*
|
|
94
|
+
* // With custom option rendering
|
|
95
|
+
* <CustomizableSelectField
|
|
96
|
+
* id="user"
|
|
97
|
+
* label="User"
|
|
98
|
+
* options={users}
|
|
99
|
+
* placeholder="Select a user"
|
|
100
|
+
* onChange={(value) => console.log(value)}
|
|
101
|
+
* optionConfig={{
|
|
102
|
+
* component: UserOption,
|
|
103
|
+
* componentProps: { showAvatar: true },
|
|
104
|
+
* selectIndecator: <CheckIcon />
|
|
105
|
+
* }}
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare const CustomizableSelectField: {
|
|
110
|
+
({ id, label, options, placeholder, onChange, isLoading, hideLabel, errorMessage, required, optionConfig, menuConfig, value, isMulti, isClearable, disabled, className, isDark, primaryColorShades, RequiredIndicator, }: CustomizableSelectFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
111
|
+
displayName: string;
|
|
112
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
import type { LabelType } from "../../data-display/label/Label";
|
|
3
|
+
/**
|
|
4
|
+
* Risk details interface
|
|
5
|
+
*/
|
|
6
|
+
export interface RiskDetails {
|
|
7
|
+
color?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
hexBgColor?: string;
|
|
10
|
+
hexBorderColor?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Risk details card component props
|
|
15
|
+
*/
|
|
16
|
+
export interface RiskDetailsCardProps {
|
|
17
|
+
riskDetails: RiskDetails;
|
|
18
|
+
maxWidth?: string;
|
|
19
|
+
showAllRisksSuggestions?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Props for the TextAreaField component
|
|
23
|
+
*/
|
|
24
|
+
export interface TextAreaFieldProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "maxLength"> {
|
|
25
|
+
/** The label text to display above the textarea */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Placeholder text for the textarea */
|
|
28
|
+
placeholder: string;
|
|
29
|
+
/** Current value of the textarea */
|
|
30
|
+
value?: string | any;
|
|
31
|
+
/** Callback function called when the textarea value changes */
|
|
32
|
+
onChange: (value: string) => void;
|
|
33
|
+
/** Number of visible text lines for the textarea (alias for rows) */
|
|
34
|
+
row?: number;
|
|
35
|
+
/** Error message to display below the textarea */
|
|
36
|
+
errorMessage?: string;
|
|
37
|
+
/** Default value for the textarea */
|
|
38
|
+
defaultValue?: string;
|
|
39
|
+
/** Whether the field is required */
|
|
40
|
+
required?: boolean;
|
|
41
|
+
/** Whether the required indicator shows as conditional (yellow instead of red) */
|
|
42
|
+
isRequiredConditional?: boolean;
|
|
43
|
+
/** Tags/labels to display next to the label */
|
|
44
|
+
tags?: (string | LabelType)[];
|
|
45
|
+
/** Whether the textarea is disabled */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** Additional CSS classes for the textarea element */
|
|
48
|
+
className?: string;
|
|
49
|
+
/** Ref object for the textarea element */
|
|
50
|
+
inputRef?: RefObject<HTMLTextAreaElement>;
|
|
51
|
+
/** Maximum character length allowed */
|
|
52
|
+
maxLength?: number | null;
|
|
53
|
+
/** Tooltip text to display */
|
|
54
|
+
tooltip?: string;
|
|
55
|
+
/** Whether to preserve original case in the label */
|
|
56
|
+
originalCase?: boolean;
|
|
57
|
+
/** Whether the value was AI extracted */
|
|
58
|
+
isAiExtracted?: boolean;
|
|
59
|
+
/** Whether this is a GTN (Global Term Name) field */
|
|
60
|
+
isGTN?: boolean;
|
|
61
|
+
/** GTN field name for document integration */
|
|
62
|
+
gtnName?: any;
|
|
63
|
+
/** Whether to remove border styling */
|
|
64
|
+
noBorder?: boolean;
|
|
65
|
+
/** Unique identifier for the textarea */
|
|
66
|
+
id?: string;
|
|
67
|
+
/** Custom inline styles for the textarea */
|
|
68
|
+
inputStyle?: React.CSSProperties;
|
|
69
|
+
/** Additional CSS classes for the label */
|
|
70
|
+
labelClassName?: string;
|
|
71
|
+
/** Whether this is a live field */
|
|
72
|
+
isLiveField?: boolean;
|
|
73
|
+
/** Callback function called when the textarea loses focus */
|
|
74
|
+
onBlur?: () => void;
|
|
75
|
+
/** Risk details data */
|
|
76
|
+
riskDetails?: RiskDetails;
|
|
77
|
+
/** Whether risk analysis is open */
|
|
78
|
+
isRiskAnalysisOpen?: boolean;
|
|
79
|
+
/** Custom risk details card component */
|
|
80
|
+
RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps>;
|
|
81
|
+
/** AI extracted indicator component */
|
|
82
|
+
AIExtractedIndicator?: React.ComponentType;
|
|
83
|
+
/** Required indicator component */
|
|
84
|
+
RequiredIndicator?: React.ComponentType<{
|
|
85
|
+
isConditional?: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
/** Handler for adding GTN to document */
|
|
88
|
+
onAddGTNToDocument?: (keyValuePair: {
|
|
89
|
+
key: string;
|
|
90
|
+
value: string;
|
|
91
|
+
}) => void;
|
|
92
|
+
/** Translation function */
|
|
93
|
+
t?: (key: string) => string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A customizable textarea field component with label, validation, GTN integration,
|
|
97
|
+
* risk analysis support, and styling support. Features dark mode support,
|
|
98
|
+
* accessibility enhancements, and character count display.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```tsx
|
|
102
|
+
* <TextAreaField
|
|
103
|
+
* label="Description"
|
|
104
|
+
* placeholder="Enter a description..."
|
|
105
|
+
* value={description}
|
|
106
|
+
* onChange={(value) => setDescription(value)}
|
|
107
|
+
* required
|
|
108
|
+
* />
|
|
109
|
+
*
|
|
110
|
+
* <TextAreaField
|
|
111
|
+
* label="Comments"
|
|
112
|
+
* placeholder="Enter comments..."
|
|
113
|
+
* value={comments}
|
|
114
|
+
* onChange={(value) => setComments(value)}
|
|
115
|
+
* maxLength={500}
|
|
116
|
+
* isGTN
|
|
117
|
+
* gtnName="comments_field"
|
|
118
|
+
* onAddGTNToDocument={(kv) => handleAddToDocument(kv)}
|
|
119
|
+
* />
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare const TextAreaField: import("react").ForwardRefExoticComponent<TextAreaFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -87,6 +87,15 @@ export interface ToggleProps {
|
|
|
87
87
|
key: string;
|
|
88
88
|
value: string;
|
|
89
89
|
}) => void;
|
|
90
|
+
/** Add to document icon component */
|
|
91
|
+
AddToDocumentIcon?: React.ComponentType<{
|
|
92
|
+
fontSize?: number;
|
|
93
|
+
color?: string;
|
|
94
|
+
}>;
|
|
95
|
+
/** Primary color shades for styling */
|
|
96
|
+
primaryColorShades?: Record<number, string>;
|
|
97
|
+
/** Translation function */
|
|
98
|
+
t?: (key: string) => string;
|
|
90
99
|
}
|
|
91
100
|
/**
|
|
92
101
|
* A highly customizable toggle component with label, validation, and styling support.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { InputField } from "./components/forms/input-field/InputField";
|
|
2
2
|
export type { InputFieldProps } from "./components/forms/input-field/InputField";
|
|
3
|
+
export { BaseInputField, default as BaseInputFieldDefault } from "./components/forms/base-input-field/BaseInputField";
|
|
4
|
+
export type { TBaseInputFieldProps, RiskDetails as BaseInputFieldRiskDetails, RiskDetailsCardProps as BaseInputFieldRiskDetailsCardProps, } from "./components/forms/base-input-field/BaseInputField";
|
|
3
5
|
export * from "./components/data-display/typography/Typography";
|
|
4
6
|
export { TextField } from "./components/forms/text-field/TextField";
|
|
5
7
|
export type { TextFieldProps } from "./components/forms/text-field/TextField";
|
|
8
|
+
export { TextAreaField } from "./components/forms/text-area-field/TextAreaField";
|
|
9
|
+
export type { TextAreaFieldProps, RiskDetails as TextAreaFieldRiskDetails, RiskDetailsCardProps as TextAreaFieldRiskDetailsCardProps, } from "./components/forms/text-area-field/TextAreaField";
|
|
6
10
|
export { SelectField } from "./components/forms/select-field/SelectField";
|
|
7
11
|
export type { SelectFieldProps, SelectOption as SelectFieldOption, TLabelValue, } from "./components/forms/select-field/SelectField";
|
|
8
12
|
export { Checkbox } from "./components/forms/checkbox/Checkbox";
|
|
@@ -11,6 +15,8 @@ export { ColorPicker } from "./components/forms/color-picker/ColorPicker";
|
|
|
11
15
|
export type { ColorPickerProps, ColorPickerComponentProps, } from "./components/forms/color-picker/ColorPicker";
|
|
12
16
|
export { CreatableSelectField } from "./components/forms/creatable-select/CreatableSelect";
|
|
13
17
|
export type { CreatableSelectProps, SelectOption, TProps, } from "./components/forms/creatable-select/CreatableSelect";
|
|
18
|
+
export { CustomizableSelectField } from "./components/forms/customizable-select-field/CustomizableSelectField";
|
|
19
|
+
export type { CustomizableSelectFieldProps, CustomizableSelectOption, OptionConfig, MenuConfig, } from "./components/forms/customizable-select-field/CustomizableSelectField";
|
|
14
20
|
export { CurrencyInputField } from "./components/forms/currency-input/CurrencyInputField";
|
|
15
21
|
export type { CurrencyInputFieldProps } from "./components/forms/currency-input/CurrencyInputField";
|
|
16
22
|
export { CURRENCIES, CURRENCY_SYMBOLS } from "./components/forms/currency-input/currency.constant";
|