corestack-ui 0.1.0 → 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/README.md +297 -8
- package/dist/index.css +20 -0
- package/dist/index.d.mts +241 -24
- package/dist/index.d.ts +241 -24
- package/dist/index.js +938 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +933 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +57 -54
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,257 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
2
4
|
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
size?: ButtonSize;
|
|
5
|
+
type AutocompleteChangeReason = "selectOption" | "removeOption" | "clear" | "blur";
|
|
6
|
+
interface AutocompleteRenderOptionState {
|
|
7
|
+
selected: boolean;
|
|
8
|
+
index: number;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
interface AutocompleteOption {
|
|
13
|
-
label: string;
|
|
10
|
+
interface RenderInputParams {
|
|
11
|
+
ref: React$1.Ref<HTMLInputElement>;
|
|
14
12
|
value: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
onChange: React$1.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
16
|
+
onKeyDown: React$1.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
17
|
+
onFocus: React$1.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
18
|
+
onBlur: React$1.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
19
|
+
role: string;
|
|
20
|
+
"aria-autocomplete": "list";
|
|
21
|
+
"aria-controls"?: string;
|
|
22
|
+
"aria-expanded": boolean;
|
|
23
|
+
"aria-activedescendant"?: string;
|
|
24
|
+
autoComplete?: string;
|
|
25
|
+
InputProps: {
|
|
26
|
+
startAdornment?: React$1.ReactNode;
|
|
27
|
+
endAdornment?: React$1.ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
15
30
|
}
|
|
16
|
-
interface
|
|
17
|
-
options:
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
interface BaseAutocompleteProps<T> {
|
|
32
|
+
options: T[];
|
|
33
|
+
getOptionLabel: (option: T) => string;
|
|
34
|
+
isOptionEqualToValue?: (option: T, value: T) => boolean;
|
|
35
|
+
renderInput: (params: RenderInputParams) => React$1.ReactNode;
|
|
36
|
+
renderOption?: (props: React$1.HTMLAttributes<HTMLLIElement>, option: T, state: AutocompleteRenderOptionState) => React$1.ReactNode;
|
|
37
|
+
loading?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
20
39
|
placeholder?: string;
|
|
21
|
-
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Text to show when there are no options and not loading */
|
|
42
|
+
emptyText?: string;
|
|
43
|
+
}
|
|
44
|
+
type NativeInputProps = Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "defaultValue">;
|
|
45
|
+
interface SingleAutocompleteProps<T> extends BaseAutocompleteProps<T>, NativeInputProps {
|
|
46
|
+
multiple?: false;
|
|
47
|
+
value?: T | null;
|
|
48
|
+
defaultValue?: T | null;
|
|
49
|
+
disableCloseOnSelect?: boolean;
|
|
50
|
+
onChange?: (event: React$1.SyntheticEvent, value: T | null, reason: AutocompleteChangeReason) => void;
|
|
22
51
|
}
|
|
52
|
+
interface MultipleAutocompleteProps<T> extends BaseAutocompleteProps<T>, NativeInputProps {
|
|
53
|
+
multiple: true;
|
|
54
|
+
value?: T[];
|
|
55
|
+
defaultValue?: T[];
|
|
56
|
+
disableCloseOnSelect?: boolean;
|
|
57
|
+
onChange?: (event: React$1.SyntheticEvent, value: T[], reason: AutocompleteChangeReason) => void;
|
|
58
|
+
}
|
|
59
|
+
type AutocompleteProps<T> = SingleAutocompleteProps<T> | MultipleAutocompleteProps<T>;
|
|
23
60
|
|
|
24
|
-
declare
|
|
61
|
+
declare function Autocomplete<T>(props: AutocompleteProps<T>): react_jsx_runtime.JSX.Element;
|
|
25
62
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
63
|
+
type ButtonVariant = "primary" | "secondary" | "ghost";
|
|
64
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
65
|
+
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
66
|
+
variant?: ButtonVariant;
|
|
67
|
+
size?: ButtonSize;
|
|
68
|
+
disableRipple?: boolean;
|
|
69
|
+
isLoading?: boolean;
|
|
70
|
+
}
|
|
31
71
|
|
|
32
|
-
declare
|
|
72
|
+
declare function Button({ children, disableRipple, isLoading, className, onClick, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
73
|
+
|
|
74
|
+
declare const TextField: React__default.ForwardRefExoticComponent<{
|
|
75
|
+
value?: string | number | null | readonly string[];
|
|
76
|
+
defaultValue?: string | number | readonly string[];
|
|
77
|
+
onChange?: React__default.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
78
|
+
onBlur?: React__default.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
79
|
+
onFocus?: React__default.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
label?: string | React__default.ReactNode;
|
|
82
|
+
helperText?: string | false | undefined;
|
|
83
|
+
error?: boolean;
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
required?: boolean;
|
|
86
|
+
multiline?: boolean;
|
|
87
|
+
rows?: number;
|
|
88
|
+
type?: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
id?: string;
|
|
91
|
+
fullWidth?: boolean;
|
|
92
|
+
size?: "small" | "medium";
|
|
93
|
+
variant?: "outlined" | "filled" | "standard";
|
|
94
|
+
InputProps?: {
|
|
95
|
+
startAdornment?: React__default.ReactNode;
|
|
96
|
+
endAdornment?: React__default.ReactNode;
|
|
97
|
+
inputComponent?: React__default.ElementType;
|
|
98
|
+
className?: string;
|
|
99
|
+
};
|
|
100
|
+
className?: string;
|
|
101
|
+
} & Omit<React__default.InputHTMLAttributes<HTMLInputElement> & React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "disabled" | "name" | "type" | "value" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "placeholder" | "required"> & React__default.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
102
|
+
|
|
103
|
+
declare const defaultTheme: {
|
|
104
|
+
colors: {
|
|
105
|
+
primary: string;
|
|
106
|
+
secondary: string;
|
|
107
|
+
success: string;
|
|
108
|
+
danger: string;
|
|
109
|
+
warning: string;
|
|
110
|
+
background: string;
|
|
111
|
+
surface: string;
|
|
112
|
+
border: string;
|
|
113
|
+
textPrimary: string;
|
|
114
|
+
textSecondary: string;
|
|
115
|
+
};
|
|
116
|
+
fonts: {
|
|
117
|
+
body: string;
|
|
118
|
+
heading: string;
|
|
119
|
+
monospace: string;
|
|
120
|
+
size: {
|
|
121
|
+
sm: string;
|
|
122
|
+
md: string;
|
|
123
|
+
lg: string;
|
|
124
|
+
xl: string;
|
|
125
|
+
};
|
|
126
|
+
weight: {
|
|
127
|
+
regular: number;
|
|
128
|
+
medium: number;
|
|
129
|
+
bold: number;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
spacing: {
|
|
133
|
+
xs: string;
|
|
134
|
+
sm: string;
|
|
135
|
+
md: string;
|
|
136
|
+
lg: string;
|
|
137
|
+
xl: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
declare const ThemeProvider: ({ theme, children, }: {
|
|
141
|
+
theme?: Partial<typeof defaultTheme>;
|
|
142
|
+
children: React__default.ReactNode;
|
|
143
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
144
|
+
declare const useTheme: () => {
|
|
145
|
+
colors: {
|
|
146
|
+
primary: string;
|
|
147
|
+
secondary: string;
|
|
148
|
+
success: string;
|
|
149
|
+
danger: string;
|
|
150
|
+
warning: string;
|
|
151
|
+
background: string;
|
|
152
|
+
surface: string;
|
|
153
|
+
border: string;
|
|
154
|
+
textPrimary: string;
|
|
155
|
+
textSecondary: string;
|
|
156
|
+
};
|
|
157
|
+
fonts: {
|
|
158
|
+
body: string;
|
|
159
|
+
heading: string;
|
|
160
|
+
monospace: string;
|
|
161
|
+
size: {
|
|
162
|
+
sm: string;
|
|
163
|
+
md: string;
|
|
164
|
+
lg: string;
|
|
165
|
+
xl: string;
|
|
166
|
+
};
|
|
167
|
+
weight: {
|
|
168
|
+
regular: number;
|
|
169
|
+
medium: number;
|
|
170
|
+
bold: number;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
spacing: {
|
|
174
|
+
xs: string;
|
|
175
|
+
sm: string;
|
|
176
|
+
md: string;
|
|
177
|
+
lg: string;
|
|
178
|
+
xl: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
33
181
|
|
|
34
182
|
declare const tokens: {
|
|
35
183
|
colors: {
|
|
36
184
|
primary: string;
|
|
185
|
+
secondary: string;
|
|
186
|
+
success: string;
|
|
187
|
+
danger: string;
|
|
188
|
+
warning: string;
|
|
189
|
+
background: string;
|
|
190
|
+
surface: string;
|
|
191
|
+
border: string;
|
|
192
|
+
textPrimary: string;
|
|
193
|
+
textSecondary: string;
|
|
194
|
+
};
|
|
195
|
+
fonts: {
|
|
196
|
+
body: string;
|
|
197
|
+
heading: string;
|
|
198
|
+
monospace: string;
|
|
199
|
+
size: {
|
|
200
|
+
sm: string;
|
|
201
|
+
md: string;
|
|
202
|
+
lg: string;
|
|
203
|
+
xl: string;
|
|
204
|
+
};
|
|
205
|
+
weight: {
|
|
206
|
+
regular: number;
|
|
207
|
+
medium: number;
|
|
208
|
+
bold: number;
|
|
209
|
+
};
|
|
37
210
|
};
|
|
211
|
+
spacing: {
|
|
212
|
+
xs: string;
|
|
213
|
+
sm: string;
|
|
214
|
+
md: string;
|
|
215
|
+
lg: string;
|
|
216
|
+
xl: string;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
type TextFieldSize = "small" | "medium";
|
|
221
|
+
type TextFieldVariant = "outlined" | "filled" | "standard";
|
|
222
|
+
type TextFieldInputProps = {
|
|
223
|
+
startAdornment?: React.ReactNode;
|
|
224
|
+
endAdornment?: React.ReactNode;
|
|
225
|
+
inputComponent?: React.ElementType;
|
|
226
|
+
className?: string;
|
|
38
227
|
};
|
|
228
|
+
type TextFieldProps = {
|
|
229
|
+
value?: string | number | null | readonly string[];
|
|
230
|
+
defaultValue?: string | number | readonly string[];
|
|
231
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
232
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
233
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
234
|
+
placeholder?: string;
|
|
235
|
+
label?: string | React.ReactNode;
|
|
236
|
+
helperText?: string | false | undefined;
|
|
237
|
+
error?: boolean;
|
|
238
|
+
disabled?: boolean;
|
|
239
|
+
required?: boolean;
|
|
240
|
+
multiline?: boolean;
|
|
241
|
+
rows?: number;
|
|
242
|
+
type?: string;
|
|
243
|
+
name?: string;
|
|
244
|
+
id?: string;
|
|
245
|
+
fullWidth?: boolean;
|
|
246
|
+
size?: TextFieldSize;
|
|
247
|
+
variant?: TextFieldVariant;
|
|
248
|
+
InputProps?: TextFieldInputProps;
|
|
249
|
+
className?: string;
|
|
250
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement> & React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "type" | "onChange" | "value" | "defaultValue" | "disabled" | "required" | "name" | "id" | "placeholder" | "onBlur" | "onFocus">;
|
|
251
|
+
|
|
252
|
+
type ClassValue = string | false | null | undefined;
|
|
253
|
+
declare const cn: (...parts: ClassValue[]) => string;
|
|
254
|
+
|
|
255
|
+
declare const cssFile = "./styles.css";
|
|
39
256
|
|
|
40
|
-
export { Autocomplete, type
|
|
257
|
+
export { Autocomplete, type AutocompleteProps, Button, type ButtonProps, type ClassValue, TextField, type TextFieldProps, ThemeProvider, cn, cssFile, tokens, useTheme };
|