@altruist03/ui 0.0.0-stage → 0.1.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.css +514 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +289 -0
- package/dist/index.js +731 -0
- package/dist/index.js.map +1 -0
- package/package.json +37 -4
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, CSSProperties, TextareaHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type AltruistTheme = {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: string;
|
|
7
|
+
primaryHover: string;
|
|
8
|
+
onPrimary: string;
|
|
9
|
+
secondary: string;
|
|
10
|
+
onSecondary: string;
|
|
11
|
+
danger: string;
|
|
12
|
+
success: string;
|
|
13
|
+
warning: string;
|
|
14
|
+
text: string;
|
|
15
|
+
textMuted: string;
|
|
16
|
+
surface: string;
|
|
17
|
+
surfaceMuted: string;
|
|
18
|
+
border: string;
|
|
19
|
+
focus: string;
|
|
20
|
+
};
|
|
21
|
+
fontFamily: string;
|
|
22
|
+
fontSize: {
|
|
23
|
+
xs: string;
|
|
24
|
+
sm: string;
|
|
25
|
+
md: string;
|
|
26
|
+
lg: string;
|
|
27
|
+
};
|
|
28
|
+
radius: {
|
|
29
|
+
sm: string;
|
|
30
|
+
md: string;
|
|
31
|
+
lg: string;
|
|
32
|
+
};
|
|
33
|
+
spacing: {
|
|
34
|
+
sm: string;
|
|
35
|
+
md: string;
|
|
36
|
+
lg: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type ThemeOverride = {
|
|
40
|
+
colors?: Partial<AltruistTheme['colors']>;
|
|
41
|
+
fontFamily?: string;
|
|
42
|
+
fontSize?: Partial<AltruistTheme['fontSize']>;
|
|
43
|
+
radius?: Partial<AltruistTheme['radius']>;
|
|
44
|
+
spacing?: Partial<AltruistTheme['spacing']>;
|
|
45
|
+
};
|
|
46
|
+
type ColorProp = 'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'text' | 'textMuted' | 'border' | 'surface' | (string & {});
|
|
47
|
+
type FontSizeProp = 'xs' | 'sm' | 'md' | 'lg' | number | (string & {});
|
|
48
|
+
type ControlSize = 'sm' | 'md' | 'lg';
|
|
49
|
+
|
|
50
|
+
type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
|
|
51
|
+
color?: ColorProp;
|
|
52
|
+
variant?: 'soft' | 'solid';
|
|
53
|
+
fontSize?: FontSizeProp;
|
|
54
|
+
fontFamily?: string;
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
};
|
|
57
|
+
declare function Badge({ color, variant, fontSize, fontFamily, className, style, children, ...rest }: BadgeProps): react.JSX.Element;
|
|
58
|
+
|
|
59
|
+
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
60
|
+
variant?: 'solid' | 'outline' | 'ghost';
|
|
61
|
+
color?: ColorProp;
|
|
62
|
+
textColor?: ColorProp;
|
|
63
|
+
size?: ControlSize;
|
|
64
|
+
fontSize?: FontSizeProp;
|
|
65
|
+
fontFamily?: string;
|
|
66
|
+
fullWidth?: boolean;
|
|
67
|
+
loading?: boolean;
|
|
68
|
+
leftIcon?: ReactNode;
|
|
69
|
+
rightIcon?: ReactNode;
|
|
70
|
+
};
|
|
71
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
72
|
+
variant?: "solid" | "outline" | "ghost";
|
|
73
|
+
color?: ColorProp;
|
|
74
|
+
textColor?: ColorProp;
|
|
75
|
+
size?: ControlSize;
|
|
76
|
+
fontSize?: FontSizeProp;
|
|
77
|
+
fontFamily?: string;
|
|
78
|
+
fullWidth?: boolean;
|
|
79
|
+
loading?: boolean;
|
|
80
|
+
leftIcon?: ReactNode;
|
|
81
|
+
rightIcon?: ReactNode;
|
|
82
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
83
|
+
|
|
84
|
+
type CardProps = HTMLAttributes<HTMLElement> & {
|
|
85
|
+
title?: ReactNode;
|
|
86
|
+
description?: ReactNode;
|
|
87
|
+
footer?: ReactNode;
|
|
88
|
+
padding?: 'sm' | 'md' | 'lg';
|
|
89
|
+
fontSize?: FontSizeProp;
|
|
90
|
+
fontFamily?: string;
|
|
91
|
+
};
|
|
92
|
+
declare function Card({ title, description, footer, padding, fontSize, fontFamily, className, style, children, ...rest }: CardProps): react.JSX.Element;
|
|
93
|
+
|
|
94
|
+
type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> & {
|
|
95
|
+
label?: ReactNode;
|
|
96
|
+
description?: ReactNode;
|
|
97
|
+
error?: ReactNode;
|
|
98
|
+
fontSize?: FontSizeProp;
|
|
99
|
+
fontFamily?: string;
|
|
100
|
+
color?: ColorProp;
|
|
101
|
+
};
|
|
102
|
+
declare const Checkbox: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & {
|
|
103
|
+
label?: ReactNode;
|
|
104
|
+
description?: ReactNode;
|
|
105
|
+
error?: ReactNode;
|
|
106
|
+
fontSize?: FontSizeProp;
|
|
107
|
+
fontFamily?: string;
|
|
108
|
+
color?: ColorProp;
|
|
109
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
110
|
+
|
|
111
|
+
type FieldProps = {
|
|
112
|
+
id: string;
|
|
113
|
+
label?: ReactNode;
|
|
114
|
+
required?: boolean;
|
|
115
|
+
helperText?: ReactNode;
|
|
116
|
+
error?: ReactNode;
|
|
117
|
+
messageId?: string;
|
|
118
|
+
fontFamily?: string;
|
|
119
|
+
children: ReactNode;
|
|
120
|
+
className?: string;
|
|
121
|
+
};
|
|
122
|
+
declare function Field({ id, label, required, helperText, error, messageId, fontFamily, children, className, }: FieldProps): react.JSX.Element;
|
|
123
|
+
|
|
124
|
+
type FileInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> & {
|
|
125
|
+
label?: ReactNode;
|
|
126
|
+
helperText?: ReactNode;
|
|
127
|
+
error?: ReactNode;
|
|
128
|
+
emptyText?: ReactNode;
|
|
129
|
+
buttonLabel?: string;
|
|
130
|
+
fontSize?: FontSizeProp;
|
|
131
|
+
fontFamily?: string;
|
|
132
|
+
color?: ColorProp;
|
|
133
|
+
};
|
|
134
|
+
declare const FileInput: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & {
|
|
135
|
+
label?: ReactNode;
|
|
136
|
+
helperText?: ReactNode;
|
|
137
|
+
error?: ReactNode;
|
|
138
|
+
emptyText?: ReactNode;
|
|
139
|
+
buttonLabel?: string;
|
|
140
|
+
fontSize?: FontSizeProp;
|
|
141
|
+
fontFamily?: string;
|
|
142
|
+
color?: ColorProp;
|
|
143
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
144
|
+
|
|
145
|
+
type FloatingInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'placeholder'> & {
|
|
146
|
+
label: ReactNode;
|
|
147
|
+
placeholder?: string;
|
|
148
|
+
helperText?: ReactNode;
|
|
149
|
+
error?: ReactNode;
|
|
150
|
+
size?: ControlSize;
|
|
151
|
+
fontSize?: FontSizeProp;
|
|
152
|
+
fontFamily?: string;
|
|
153
|
+
color?: ColorProp;
|
|
154
|
+
};
|
|
155
|
+
declare const FloatingInput: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "placeholder"> & {
|
|
156
|
+
label: ReactNode;
|
|
157
|
+
placeholder?: string;
|
|
158
|
+
helperText?: ReactNode;
|
|
159
|
+
error?: ReactNode;
|
|
160
|
+
size?: ControlSize;
|
|
161
|
+
fontSize?: FontSizeProp;
|
|
162
|
+
fontFamily?: string;
|
|
163
|
+
color?: ColorProp;
|
|
164
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
165
|
+
|
|
166
|
+
type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
|
|
167
|
+
label?: ReactNode;
|
|
168
|
+
helperText?: ReactNode;
|
|
169
|
+
error?: ReactNode;
|
|
170
|
+
size?: ControlSize;
|
|
171
|
+
fontSize?: FontSizeProp;
|
|
172
|
+
fontFamily?: string;
|
|
173
|
+
color?: ColorProp;
|
|
174
|
+
leftIcon?: ReactNode;
|
|
175
|
+
rightIcon?: ReactNode;
|
|
176
|
+
};
|
|
177
|
+
declare const Input: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
178
|
+
label?: ReactNode;
|
|
179
|
+
helperText?: ReactNode;
|
|
180
|
+
error?: ReactNode;
|
|
181
|
+
size?: ControlSize;
|
|
182
|
+
fontSize?: FontSizeProp;
|
|
183
|
+
fontFamily?: string;
|
|
184
|
+
color?: ColorProp;
|
|
185
|
+
leftIcon?: ReactNode;
|
|
186
|
+
rightIcon?: ReactNode;
|
|
187
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
188
|
+
|
|
189
|
+
type SelectOption = {
|
|
190
|
+
label: string;
|
|
191
|
+
value: string;
|
|
192
|
+
disabled?: boolean;
|
|
193
|
+
};
|
|
194
|
+
type SelectProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> & {
|
|
195
|
+
label?: ReactNode;
|
|
196
|
+
helperText?: ReactNode;
|
|
197
|
+
error?: ReactNode;
|
|
198
|
+
placeholder?: string;
|
|
199
|
+
options: SelectOption[];
|
|
200
|
+
size?: ControlSize;
|
|
201
|
+
fontSize?: FontSizeProp;
|
|
202
|
+
fontFamily?: string;
|
|
203
|
+
color?: ColorProp;
|
|
204
|
+
};
|
|
205
|
+
declare const Select: react.ForwardRefExoticComponent<Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> & {
|
|
206
|
+
label?: ReactNode;
|
|
207
|
+
helperText?: ReactNode;
|
|
208
|
+
error?: ReactNode;
|
|
209
|
+
placeholder?: string;
|
|
210
|
+
options: SelectOption[];
|
|
211
|
+
size?: ControlSize;
|
|
212
|
+
fontSize?: FontSizeProp;
|
|
213
|
+
fontFamily?: string;
|
|
214
|
+
color?: ColorProp;
|
|
215
|
+
} & react.RefAttributes<HTMLSelectElement>>;
|
|
216
|
+
|
|
217
|
+
type TableColumn<Row> = {
|
|
218
|
+
key: string;
|
|
219
|
+
header: ReactNode;
|
|
220
|
+
align?: 'left' | 'center' | 'right';
|
|
221
|
+
width?: string | number;
|
|
222
|
+
render?: (row: Row) => ReactNode;
|
|
223
|
+
};
|
|
224
|
+
type TableProps<Row> = {
|
|
225
|
+
columns: Array<TableColumn<Row>>;
|
|
226
|
+
rows: Row[];
|
|
227
|
+
getRowKey: (row: Row, index: number) => string;
|
|
228
|
+
caption?: ReactNode;
|
|
229
|
+
emptyLabel?: ReactNode;
|
|
230
|
+
size?: ControlSize;
|
|
231
|
+
striped?: boolean;
|
|
232
|
+
fontSize?: FontSizeProp;
|
|
233
|
+
fontFamily?: string;
|
|
234
|
+
className?: string;
|
|
235
|
+
style?: CSSProperties;
|
|
236
|
+
};
|
|
237
|
+
declare function Table<Row>({ columns, rows, getRowKey, caption, emptyLabel, size, striped, fontSize, fontFamily, className, style, }: TableProps<Row>): react.JSX.Element;
|
|
238
|
+
|
|
239
|
+
type TextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
240
|
+
label?: ReactNode;
|
|
241
|
+
helperText?: ReactNode;
|
|
242
|
+
error?: ReactNode;
|
|
243
|
+
fontSize?: FontSizeProp;
|
|
244
|
+
fontFamily?: string;
|
|
245
|
+
color?: ColorProp;
|
|
246
|
+
};
|
|
247
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
248
|
+
label?: ReactNode;
|
|
249
|
+
helperText?: ReactNode;
|
|
250
|
+
error?: ReactNode;
|
|
251
|
+
fontSize?: FontSizeProp;
|
|
252
|
+
fontFamily?: string;
|
|
253
|
+
color?: ColorProp;
|
|
254
|
+
} & react.RefAttributes<HTMLTextAreaElement>>;
|
|
255
|
+
|
|
256
|
+
type AccordionItem = {
|
|
257
|
+
id: string;
|
|
258
|
+
title: ReactNode;
|
|
259
|
+
content: ReactNode;
|
|
260
|
+
};
|
|
261
|
+
type AccordionProps = {
|
|
262
|
+
items: AccordionItem[];
|
|
263
|
+
allowMultiple?: boolean;
|
|
264
|
+
defaultOpenIds?: string[];
|
|
265
|
+
color?: ColorProp;
|
|
266
|
+
fontSize?: FontSizeProp;
|
|
267
|
+
fontFamily?: string;
|
|
268
|
+
className?: string;
|
|
269
|
+
style?: CSSProperties;
|
|
270
|
+
};
|
|
271
|
+
declare function Accordion({ items, allowMultiple, defaultOpenIds, color, fontSize, fontFamily, className, style, }: AccordionProps): react.JSX.Element;
|
|
272
|
+
|
|
273
|
+
declare function themeToCssVars(theme: AltruistTheme): CSSProperties;
|
|
274
|
+
|
|
275
|
+
declare const altruistTheme: AltruistTheme;
|
|
276
|
+
|
|
277
|
+
declare const indigoTheme: ThemeOverride;
|
|
278
|
+
declare const darkTheme: ThemeOverride;
|
|
279
|
+
declare function mergeTheme(base?: AltruistTheme, override?: ThemeOverride): AltruistTheme;
|
|
280
|
+
|
|
281
|
+
type ThemeProviderProps = {
|
|
282
|
+
theme?: ThemeOverride;
|
|
283
|
+
children: ReactNode;
|
|
284
|
+
className?: string;
|
|
285
|
+
style?: CSSProperties;
|
|
286
|
+
};
|
|
287
|
+
declare function ThemeProvider({ theme, children, className, style }: ThemeProviderProps): react.JSX.Element;
|
|
288
|
+
|
|
289
|
+
export { Accordion, type AccordionItem, type AccordionProps, type AltruistTheme, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, type ColorProp, type ControlSize, Field, type FieldProps, FileInput, type FileInputProps, FloatingInput, type FloatingInputProps, type FontSizeProp, Input, type InputProps, Select, type SelectOption, type SelectProps, Table, type TableColumn, type TableProps, Textarea, type TextareaProps, type ThemeOverride, ThemeProvider, type ThemeProviderProps, altruistTheme, darkTheme, indigoTheme, mergeTheme, themeToCssVars };
|