corestack-ui 0.1.0 → 0.2.0

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/index.d.ts CHANGED
@@ -1,40 +1,225 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import * as React from 'react';
3
+ import React__default from 'react';
2
4
 
3
- type ButtonVariant = 'primary' | 'secondary' | 'ghost';
4
- type ButtonSize = 'sm' | 'md' | 'lg';
5
+ type AutocompleteChangeReason = "selectOption" | "removeOption" | "clear" | "blur";
6
+ interface AutocompleteRenderOptionState {
7
+ selected: boolean;
8
+ index: number;
9
+ }
10
+ interface RenderInputParams {
11
+ ref: React.Ref<HTMLInputElement>;
12
+ value: string;
13
+ placeholder?: string;
14
+ disabled?: boolean;
15
+ onChange: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
16
+ onKeyDown: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
17
+ onFocus: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
18
+ onBlur: React.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.ReactNode;
27
+ endAdornment?: React.ReactNode;
28
+ className?: string;
29
+ };
30
+ }
31
+ interface BaseAutocompleteProps<T> {
32
+ options: T[];
33
+ getOptionLabel: (option: T) => string;
34
+ isOptionEqualToValue?: (option: T, value: T) => boolean;
35
+ renderInput: (params: RenderInputParams) => React.ReactNode;
36
+ renderOption?: (props: React.HTMLAttributes<HTMLLIElement>, option: T, state: AutocompleteRenderOptionState) => React.ReactNode;
37
+ loading?: boolean;
38
+ disabled?: boolean;
39
+ placeholder?: string;
40
+ className?: string;
41
+ /** Text to show when there are no options and not loading */
42
+ emptyText?: string;
43
+ }
44
+ type NativeInputProps = Omit<React.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.SyntheticEvent, value: T | null, reason: AutocompleteChangeReason) => void;
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.SyntheticEvent, value: T[], reason: AutocompleteChangeReason) => void;
58
+ }
59
+ type AutocompleteProps<T> = SingleAutocompleteProps<T> | MultipleAutocompleteProps<T>;
60
+
61
+ declare function Autocomplete<T>(props: AutocompleteProps<T>): react_jsx_runtime.JSX.Element;
62
+
63
+ type ButtonVariant = "primary" | "secondary" | "ghost";
64
+ type ButtonSize = "sm" | "md" | "lg";
5
65
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
66
  variant?: ButtonVariant;
7
67
  size?: ButtonSize;
68
+ disableRipple?: boolean;
69
+ isLoading?: boolean;
8
70
  }
9
71
 
10
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
72
+ declare function Button({ children, disableRipple, isLoading, className, onClick, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
11
73
 
12
- interface AutocompleteOption {
13
- label: string;
14
- value: string;
15
- }
16
- interface AutocompleteProps {
17
- options: AutocompleteOption[];
18
- value?: string;
19
- onChange?: (value?: string) => void;
74
+ declare const TextField: React__default.ForwardRefExoticComponent<{
75
+ value?: string | number | 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>;
20
80
  placeholder?: string;
21
- renderItem?: (option: AutocompleteOption) => React.ReactNode;
22
- }
23
-
24
- declare const Autocomplete: React.FC<AutocompleteProps>;
81
+ label?: string;
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>>;
25
102
 
26
- declare function useAutocomplete(options: AutocompleteOption[]): {
27
- readonly input: string;
28
- readonly setInput: React.Dispatch<React.SetStateAction<string>>;
29
- readonly filtered: AutocompleteOption[];
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
+ };
30
180
  };
31
-
32
- declare const cn: (...parts: Array<string | false | null | undefined>) => string;
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
+ };
210
+ };
211
+ spacing: {
212
+ xs: string;
213
+ sm: string;
214
+ md: string;
215
+ lg: string;
216
+ xl: string;
37
217
  };
38
218
  };
39
219
 
40
- export { Autocomplete, type AutocompleteOption, type AutocompleteProps, Button, type ButtonProps, cn, tokens, useAutocomplete };
220
+ type ClassValue = string | false | null | undefined;
221
+ declare const cn: (...parts: ClassValue[]) => string;
222
+
223
+ declare const cssFile = "./styles.css";
224
+
225
+ export { Autocomplete, Button, type ButtonProps, type ClassValue, TextField, ThemeProvider, cn, cssFile, tokens, useTheme };