@lax-wp/design-system 0.3.12 → 0.3.13
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/forms/select-field/SelectField.d.ts +161 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +18287 -13913
- package/dist/index.umd.js +124 -96
- package/package.json +2 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { SelectProps } from 'antd';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { LabelType } from '../../data-display/label/Label';
|
|
4
|
+
/**
|
|
5
|
+
* Label-value pair for select options
|
|
6
|
+
*/
|
|
7
|
+
export type TLabelValue = {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
icon?: JSX.Element;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Select option interface
|
|
14
|
+
*/
|
|
15
|
+
export interface SelectOption {
|
|
16
|
+
label: string | any;
|
|
17
|
+
value: string | number;
|
|
18
|
+
color?: string;
|
|
19
|
+
}
|
|
20
|
+
type TagRender = SelectProps['tagRender'];
|
|
21
|
+
/**
|
|
22
|
+
* Risk details interface
|
|
23
|
+
*/
|
|
24
|
+
export interface RiskDetails {
|
|
25
|
+
color?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
hexBgColor?: string;
|
|
28
|
+
hexBorderColor?: string;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Risk details card component props
|
|
33
|
+
*/
|
|
34
|
+
export interface RiskDetailsCardProps {
|
|
35
|
+
riskDetails: RiskDetails;
|
|
36
|
+
maxWidth?: string;
|
|
37
|
+
showAllRisksSuggestions?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Props for the SelectField component
|
|
41
|
+
*/
|
|
42
|
+
export interface SelectFieldProps extends Omit<SelectProps, 'onChange'> {
|
|
43
|
+
/** Select mode - multiple or tags */
|
|
44
|
+
mode?: 'multiple' | 'tags';
|
|
45
|
+
/** The label text to display above the select */
|
|
46
|
+
label?: string | ReactNode;
|
|
47
|
+
/** Current value of the select */
|
|
48
|
+
value?: string | string[] | SelectOption | SelectOption[] | any;
|
|
49
|
+
/** Array of select options */
|
|
50
|
+
selectOptions?: SelectOption[];
|
|
51
|
+
/** Whether content is loading */
|
|
52
|
+
hasContentLoading?: boolean;
|
|
53
|
+
/** Callback function called when the select value changes */
|
|
54
|
+
onChange?: (value: any) => void;
|
|
55
|
+
/** Callback function for search */
|
|
56
|
+
onSearch?: (searchValue: string) => void;
|
|
57
|
+
/** Callback function for scroll */
|
|
58
|
+
onScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
59
|
+
/** Callback function for input change */
|
|
60
|
+
onInputChange?: (newValue: string) => void;
|
|
61
|
+
/** Debounce timeout for search */
|
|
62
|
+
debounceTimeout?: number;
|
|
63
|
+
/** Error message to display */
|
|
64
|
+
errorMessage?: string;
|
|
65
|
+
/** Whether the field is required */
|
|
66
|
+
required?: boolean;
|
|
67
|
+
/** Tooltip text for the help icon */
|
|
68
|
+
tooltip?: string;
|
|
69
|
+
/** Tags to display with the label */
|
|
70
|
+
tags?: (string | LabelType)[];
|
|
71
|
+
/** Whether the value was AI extracted */
|
|
72
|
+
isAiExtracted?: boolean;
|
|
73
|
+
/** Whether to preserve original case in the label */
|
|
74
|
+
originalCase?: boolean;
|
|
75
|
+
/** Whether this is a GTN (Global Technical Name) field */
|
|
76
|
+
isGTN?: boolean;
|
|
77
|
+
/** GTN name for the field */
|
|
78
|
+
gtnName?: any;
|
|
79
|
+
/** Handler for adding GTN to document */
|
|
80
|
+
handleAddGTNToDocument?: (value: string | string[]) => void;
|
|
81
|
+
/** Whether the field is hovered */
|
|
82
|
+
isHovered?: boolean;
|
|
83
|
+
/** Whether to enable filter option */
|
|
84
|
+
filterOption?: boolean;
|
|
85
|
+
/** Whether the select is loading */
|
|
86
|
+
isLoading?: boolean;
|
|
87
|
+
/** Whether to auto clear search value */
|
|
88
|
+
autoClearSearchValue?: boolean;
|
|
89
|
+
/** Whether to show label with full opacity */
|
|
90
|
+
fullOpacityLabel?: boolean;
|
|
91
|
+
/** Color for the select */
|
|
92
|
+
color?: string;
|
|
93
|
+
/** Whether to show all tags */
|
|
94
|
+
showAllTags?: boolean;
|
|
95
|
+
/** Custom tag render function */
|
|
96
|
+
customTagRender?: TagRender;
|
|
97
|
+
/** Custom inline styles for the select */
|
|
98
|
+
inputStyles?: React.CSSProperties;
|
|
99
|
+
/** Whether the select is disabled */
|
|
100
|
+
disabled?: boolean;
|
|
101
|
+
/** Whether to show select all option */
|
|
102
|
+
showSelectAll?: boolean;
|
|
103
|
+
/** Additional CSS classes for the label */
|
|
104
|
+
labelClassName?: string;
|
|
105
|
+
/** Additional CSS classes for the wrapper */
|
|
106
|
+
className?: string;
|
|
107
|
+
/** Risk details data */
|
|
108
|
+
riskDetails?: RiskDetails;
|
|
109
|
+
/** Whether risk analysis is open */
|
|
110
|
+
isRiskAnalysisOpen?: boolean;
|
|
111
|
+
/** Custom risk details card component */
|
|
112
|
+
RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps>;
|
|
113
|
+
/** AI extracted indicator component */
|
|
114
|
+
AIExtractedIndicator?: React.ComponentType;
|
|
115
|
+
/** Required indicator component */
|
|
116
|
+
RequiredIndicator?: React.ComponentType;
|
|
117
|
+
/** Add to document icon component */
|
|
118
|
+
AddToDocumentIcon?: React.ComponentType<{
|
|
119
|
+
fontSize?: number;
|
|
120
|
+
color?: string;
|
|
121
|
+
}>;
|
|
122
|
+
/** Primary color shades for styling */
|
|
123
|
+
primaryColorShades?: Record<number, string>;
|
|
124
|
+
/** User avatar component for option rendering */
|
|
125
|
+
UserAvatar?: React.ComponentType<{
|
|
126
|
+
firstName: string;
|
|
127
|
+
lastName: string;
|
|
128
|
+
profilePic: string;
|
|
129
|
+
size: string;
|
|
130
|
+
enablePopper: boolean;
|
|
131
|
+
userId: string;
|
|
132
|
+
}>;
|
|
133
|
+
/** Translation function */
|
|
134
|
+
t?: (key: string) => string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* SelectField component - A feature-rich select dropdown with multi-select, tags, search, and more
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```tsx
|
|
141
|
+
* <SelectField
|
|
142
|
+
* label="Country"
|
|
143
|
+
* value="us"
|
|
144
|
+
* selectOptions={[
|
|
145
|
+
* { label: 'United States', value: 'us' },
|
|
146
|
+
* { label: 'Canada', value: 'ca' }
|
|
147
|
+
* ]}
|
|
148
|
+
* onChange={(value) => console.log(value)}
|
|
149
|
+
* />
|
|
150
|
+
*
|
|
151
|
+
* <SelectField
|
|
152
|
+
* label="Tags"
|
|
153
|
+
* mode="multiple"
|
|
154
|
+
* value={['tag1', 'tag2']}
|
|
155
|
+
* selectOptions={tagOptions}
|
|
156
|
+
* onChange={(values) => console.log(values)}
|
|
157
|
+
* />
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare const SelectField: import("react").ForwardRefExoticComponent<SelectFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
161
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type { InputFieldProps } from "./components/forms/input-field/InputField"
|
|
|
3
3
|
export * from "./components/data-display/typography/Typography";
|
|
4
4
|
export { TextField } from "./components/forms/text-field/TextField";
|
|
5
5
|
export type { TextFieldProps } from "./components/forms/text-field/TextField";
|
|
6
|
+
export { SelectField } from "./components/forms/select-field/SelectField";
|
|
7
|
+
export type { SelectFieldProps, SelectOption as SelectFieldOption, TLabelValue, } from "./components/forms/select-field/SelectField";
|
|
6
8
|
export { Checkbox } from "./components/forms/checkbox/Checkbox";
|
|
7
9
|
export type { CheckboxComponentProps, TCheckboxComponentProps, } from "./components/forms/checkbox/Checkbox";
|
|
8
10
|
export { ColorPicker } from "./components/forms/color-picker/ColorPicker";
|