mithril-materialized 2.0.0-beta.1 → 2.0.0-beta.11
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 +287 -308
- package/dist/advanced.css +1888 -0
- package/dist/autocomplete.d.ts +3 -3
- package/dist/breadcrumb.d.ts +53 -0
- package/dist/button.d.ts +66 -21
- package/dist/carousel.d.ts +2 -2
- package/dist/chip.d.ts +2 -2
- package/dist/code-block.d.ts +2 -2
- package/dist/collapsible.d.ts +2 -2
- package/dist/collection.d.ts +2 -2
- package/dist/components.css +2310 -0
- package/dist/core.css +3402 -0
- package/dist/datatable.d.ts +291 -0
- package/dist/datepicker.d.ts +66 -0
- package/dist/dropdown.d.ts +2 -2
- package/dist/file-upload.d.ts +34 -0
- package/dist/floating-action-button.d.ts +2 -2
- package/dist/forms.css +2284 -0
- package/dist/index.css +1825 -184
- package/dist/index.d.ts +14 -1
- package/dist/index.esm.js +4752 -2143
- package/dist/index.js +4776 -2142
- package/dist/index.min.css +8 -0
- package/dist/index.umd.js +4776 -2142
- package/dist/input-options.d.ts +1 -1
- package/dist/input.d.ts +9 -10
- package/dist/label.d.ts +4 -2
- package/dist/material-box.d.ts +2 -2
- package/dist/modal.d.ts +2 -2
- package/dist/option.d.ts +4 -4
- package/dist/pagination.d.ts +2 -2
- package/dist/parallax.d.ts +2 -2
- package/dist/pickers.css +487 -0
- package/dist/pushpin.d.ts +32 -0
- package/dist/radio.d.ts +4 -4
- package/dist/search-select.d.ts +2 -2
- package/dist/select.d.ts +2 -2
- package/dist/sidenav.d.ts +76 -0
- package/dist/switch.d.ts +2 -2
- package/dist/tabs.d.ts +2 -4
- package/dist/theme-switcher.d.ts +49 -0
- package/dist/timepicker.d.ts +42 -0
- package/dist/toast.d.ts +45 -0
- package/dist/tooltip.d.ts +59 -0
- package/dist/types.d.ts +226 -0
- package/dist/utilities.css +3204 -0
- package/dist/wizard.d.ts +58 -0
- package/package.json +20 -9
- package/sass/components/_breadcrumb.scss +248 -0
- package/sass/components/_buttons.scss +3 -3
- package/sass/components/_cards.scss +10 -3
- package/sass/components/_chips.scss +8 -8
- package/sass/components/_collapsible.scss +8 -8
- package/sass/components/_datatable.scss +417 -0
- package/sass/components/_datepicker.scss +45 -14
- package/sass/components/_dropdown.scss +5 -5
- package/sass/components/_file-upload.scss +228 -0
- package/sass/components/_global.scss +13 -11
- package/sass/components/_modal.scss +5 -2
- package/sass/components/_navbar.scss +13 -5
- package/sass/components/_sidenav.scss +164 -7
- package/sass/components/_tabs.scss +5 -4
- package/sass/components/_theme-switcher.scss +120 -0
- package/sass/components/_theme-variables.scss +205 -0
- package/sass/components/_timepicker.scss +179 -87
- package/sass/components/_wizard.scss +416 -0
- package/sass/components/forms/_input-fields.scss +34 -12
- package/sass/components/forms/_radio-buttons.scss +10 -10
- package/sass/components/forms/_range.scss +5 -5
- package/sass/components/forms/_select.scss +9 -9
- package/sass/components/forms/_switches.scss +6 -6
- package/sass/materialize.scss +8 -0
- package/dist/pickers.d.ts +0 -130
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { Attributes, Component, Vnode, type FactoryComponent } from 'mithril';
|
|
2
|
+
/**
|
|
3
|
+
* Attributes for custom cell renderer components in DataTable
|
|
4
|
+
* @template T The type of the data object for each row
|
|
5
|
+
*/
|
|
6
|
+
export interface CellRendererAttrs<T = Record<string, any>> {
|
|
7
|
+
/** The processed value from the data object for this cell */
|
|
8
|
+
value: any;
|
|
9
|
+
/** The complete row data object */
|
|
10
|
+
row: T;
|
|
11
|
+
/** The row index in the processed data */
|
|
12
|
+
index: number;
|
|
13
|
+
/** The column configuration object */
|
|
14
|
+
column: DataTableColumn<T>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for a DataTable column
|
|
18
|
+
* @template T The type of the data object for each row
|
|
19
|
+
*/
|
|
20
|
+
export interface DataTableColumn<T = Record<string, any>> {
|
|
21
|
+
/** Unique identifier for the column (required for sorting/filtering) */
|
|
22
|
+
key: string;
|
|
23
|
+
/** Display title shown in the column header */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Property name in the data object to display. If not provided, the entire row object is passed to the renderer */
|
|
26
|
+
field?: keyof T;
|
|
27
|
+
/** Custom cell renderer component for advanced cell content */
|
|
28
|
+
cellRenderer?: FactoryComponent<CellRendererAttrs<T>>;
|
|
29
|
+
/** @deprecated Use cellRenderer instead - Legacy render function for cell content */
|
|
30
|
+
render?: (value: any, row: T, index: number) => string | number | Vnode | Vnode[];
|
|
31
|
+
/** Enable sorting for this column */
|
|
32
|
+
sortable?: boolean;
|
|
33
|
+
/** Enable global search filtering for this column */
|
|
34
|
+
filterable?: boolean;
|
|
35
|
+
/** CSS width value (e.g., '100px', '20%', '10rem') */
|
|
36
|
+
width?: string;
|
|
37
|
+
/** Text alignment within cells */
|
|
38
|
+
align?: 'left' | 'center' | 'right';
|
|
39
|
+
/** CSS class applied to all cells in this column */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** CSS class applied to the column header */
|
|
42
|
+
headerClassName?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Configuration for DataTable sorting state
|
|
46
|
+
*/
|
|
47
|
+
export interface DataTableSort {
|
|
48
|
+
/** Key of the column to sort by (must match a column's key) */
|
|
49
|
+
column: string;
|
|
50
|
+
/** Sort direction - ascending or descending */
|
|
51
|
+
direction: 'asc' | 'desc';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration for DataTable pagination
|
|
55
|
+
*/
|
|
56
|
+
export interface DataTablePagination {
|
|
57
|
+
/** Current page number (0-based indexing) */
|
|
58
|
+
page: number;
|
|
59
|
+
/** Number of items to display per page */
|
|
60
|
+
pageSize: number;
|
|
61
|
+
/** Total number of items in the dataset */
|
|
62
|
+
total: number;
|
|
63
|
+
/** Array of available page size options for user selection */
|
|
64
|
+
pageSizes?: number[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for DataTable row selection functionality
|
|
68
|
+
* @template T The type of the data object for each row
|
|
69
|
+
*/
|
|
70
|
+
export interface DataTableSelection<T = Record<string, any>> {
|
|
71
|
+
/** Selection mode - controls how many rows can be selected */
|
|
72
|
+
mode: 'single' | 'multiple' | 'none';
|
|
73
|
+
/** Array of currently selected row keys */
|
|
74
|
+
selectedKeys: string[];
|
|
75
|
+
/** Function to generate a unique key for each row */
|
|
76
|
+
getRowKey: (row: T, index: number) => string;
|
|
77
|
+
/** Callback invoked when row selection changes */
|
|
78
|
+
onSelectionChange?: (selectedKeys: string[], selectedRows: T[]) => void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Configuration for DataTable filtering functionality
|
|
82
|
+
*/
|
|
83
|
+
export interface DataTableFilter {
|
|
84
|
+
/** Global search term applied across all filterable columns */
|
|
85
|
+
searchTerm?: string;
|
|
86
|
+
/** Column-specific filter values keyed by column key */
|
|
87
|
+
columnFilters?: Record<string, any>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Main DataTable component attributes
|
|
91
|
+
* @template T The type of the data object for each row
|
|
92
|
+
*
|
|
93
|
+
* @example Basic usage
|
|
94
|
+
* ```typescript
|
|
95
|
+
* m(DataTable, {
|
|
96
|
+
* data: users,
|
|
97
|
+
* columns: [
|
|
98
|
+
* { key: 'name', title: 'Name', field: 'name', sortable: true },
|
|
99
|
+
* { key: 'email', title: 'Email', field: 'email', filterable: true }
|
|
100
|
+
* ]
|
|
101
|
+
* })
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example With pagination and selection
|
|
105
|
+
* ```typescript
|
|
106
|
+
* m(DataTable, {
|
|
107
|
+
* data: users,
|
|
108
|
+
* columns,
|
|
109
|
+
* pagination: { page: 0, pageSize: 10, total: users.length },
|
|
110
|
+
* selection: {
|
|
111
|
+
* mode: 'multiple',
|
|
112
|
+
* selectedKeys: [],
|
|
113
|
+
* getRowKey: (user) => user.id,
|
|
114
|
+
* onSelectionChange: (keys, users) => console.log('Selected:', users)
|
|
115
|
+
* }
|
|
116
|
+
* })
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export interface DataTableAttrs<T = Record<string, any>> extends Attributes {
|
|
120
|
+
/** Array of data objects to display in the table */
|
|
121
|
+
data: T[];
|
|
122
|
+
/** Column configuration array defining how data should be displayed */
|
|
123
|
+
columns: DataTableColumn<T>[];
|
|
124
|
+
/** Optional title displayed above the table */
|
|
125
|
+
title?: string;
|
|
126
|
+
/** Show loading spinner and disable interactions */
|
|
127
|
+
loading?: boolean;
|
|
128
|
+
/** Message to display when data array is empty */
|
|
129
|
+
emptyMessage?: string;
|
|
130
|
+
/** Apply alternating row background colors */
|
|
131
|
+
striped?: boolean;
|
|
132
|
+
/** Enable row highlighting on hover */
|
|
133
|
+
hoverable?: boolean;
|
|
134
|
+
/** Make table responsive with horizontal scrolling on small screens */
|
|
135
|
+
responsive?: boolean;
|
|
136
|
+
/** Center-align all table content */
|
|
137
|
+
centered?: boolean;
|
|
138
|
+
/** Fixed table height in pixels (enables scrolling) */
|
|
139
|
+
height?: number;
|
|
140
|
+
/** Additional CSS classes to apply to the table */
|
|
141
|
+
className?: string;
|
|
142
|
+
/** Custom HTML id attribute for the table container */
|
|
143
|
+
id?: string;
|
|
144
|
+
/** Current sort configuration. If provided, sorting is controlled externally */
|
|
145
|
+
sort?: DataTableSort;
|
|
146
|
+
/** Callback invoked when user changes sort order */
|
|
147
|
+
onSortChange?: (sort: DataTableSort) => void;
|
|
148
|
+
/** Pagination configuration. If provided, pagination is controlled externally */
|
|
149
|
+
pagination?: DataTablePagination;
|
|
150
|
+
/** Callback invoked when user changes page or page size */
|
|
151
|
+
onPaginationChange?: (pagination: DataTablePagination) => void;
|
|
152
|
+
/** Row selection configuration */
|
|
153
|
+
selection?: DataTableSelection<T>;
|
|
154
|
+
/** Current filter state. If provided, filtering is controlled externally */
|
|
155
|
+
filter?: DataTableFilter;
|
|
156
|
+
/** Callback invoked when filter values change */
|
|
157
|
+
onFilterChange?: (filter: DataTableFilter) => void;
|
|
158
|
+
/** Show global search input above the table */
|
|
159
|
+
enableGlobalSearch?: boolean;
|
|
160
|
+
/** Placeholder text for the global search input */
|
|
161
|
+
searchPlaceholder?: string;
|
|
162
|
+
/** Callback invoked when a row is clicked */
|
|
163
|
+
onRowClick?: (row: T, index: number, event: Event) => void;
|
|
164
|
+
/** Callback invoked when a row is double-clicked */
|
|
165
|
+
onRowDoubleClick?: (row: T, index: number, event: Event) => void;
|
|
166
|
+
/** Function to generate custom CSS classes for each row */
|
|
167
|
+
getRowClassName?: (row: T, index: number) => string;
|
|
168
|
+
/** Internationalization configuration for UI text */
|
|
169
|
+
i18n?: DataTableI18n;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Internationalization configuration for DataTable UI text
|
|
173
|
+
* Allows customization of all user-facing text strings
|
|
174
|
+
*/
|
|
175
|
+
export interface DataTableI18n {
|
|
176
|
+
/** Label for the search input */
|
|
177
|
+
search?: string;
|
|
178
|
+
/** Placeholder text for the search input */
|
|
179
|
+
searchPlaceholder?: string;
|
|
180
|
+
/** "Showing" text in pagination display */
|
|
181
|
+
showing?: string;
|
|
182
|
+
/** "to" text in pagination display (e.g., "Showing 1 to 10 of 100") */
|
|
183
|
+
to?: string;
|
|
184
|
+
/** "of" text in pagination display */
|
|
185
|
+
of?: string;
|
|
186
|
+
/** "entries" text in pagination display */
|
|
187
|
+
entries?: string;
|
|
188
|
+
/** "Page" text in pagination controls */
|
|
189
|
+
page?: string;
|
|
190
|
+
/** Message displayed when no data is available */
|
|
191
|
+
noDataAvailable?: string;
|
|
192
|
+
/** Loading message displayed during data fetch */
|
|
193
|
+
loading?: string;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Attributes for the PaginationControls component
|
|
197
|
+
*/
|
|
198
|
+
export interface PaginationControlsAttrs {
|
|
199
|
+
/** Pagination configuration object */
|
|
200
|
+
pagination?: DataTablePagination;
|
|
201
|
+
/** Callback function invoked when pagination state changes */
|
|
202
|
+
onPaginationChange: (pagination: DataTablePagination) => void;
|
|
203
|
+
/** Internationalization strings for pagination text */
|
|
204
|
+
i18n?: DataTableI18n;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Standalone Pagination Controls component
|
|
208
|
+
*
|
|
209
|
+
* Provides navigation controls for paginated data with customizable text labels.
|
|
210
|
+
* Includes first page, previous page, next page, last page buttons and page info display.
|
|
211
|
+
* Can be used independently of DataTable for any paginated content.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* m(PaginationControls, {
|
|
216
|
+
* pagination: { page: 0, pageSize: 10, total: 100 },
|
|
217
|
+
* onPaginationChange: (newPagination) => console.log('Page changed:', newPagination),
|
|
218
|
+
* i18n: { showing: 'Showing', to: 'to', of: 'of', entries: 'entries', page: 'Page' }
|
|
219
|
+
* })
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
export declare const PaginationControls: FactoryComponent<PaginationControlsAttrs>;
|
|
223
|
+
/**
|
|
224
|
+
* A comprehensive data table component with sorting, filtering, pagination, and selection capabilities.
|
|
225
|
+
*
|
|
226
|
+
* @template T The type of data objects displayed in each row
|
|
227
|
+
*
|
|
228
|
+
* @description
|
|
229
|
+
* The DataTable component provides a feature-rich interface for displaying and interacting with tabular data.
|
|
230
|
+
* It supports both controlled and uncontrolled modes for all interactive features.
|
|
231
|
+
*
|
|
232
|
+
* **Key Features:**
|
|
233
|
+
* - Sorting: Click column headers to sort data ascending/descending
|
|
234
|
+
* - Filtering: Global search across filterable columns
|
|
235
|
+
* - Pagination: Navigate through large datasets with customizable page sizes
|
|
236
|
+
* - Selection: Single or multiple row selection with callbacks
|
|
237
|
+
* - Custom rendering: Use cellRenderer for complex cell content
|
|
238
|
+
* - Responsive: Adapts to different screen sizes
|
|
239
|
+
* - Internationalization: Customize all UI text
|
|
240
|
+
* - Accessibility: Proper ARIA attributes and keyboard navigation
|
|
241
|
+
*
|
|
242
|
+
* @example Basic usage
|
|
243
|
+
* ```typescript
|
|
244
|
+
* interface User { id: number; name: string; email: string; }
|
|
245
|
+
* const users: User[] = [...];
|
|
246
|
+
* const columns: DataTableColumn<User>[] = [
|
|
247
|
+
* { key: 'name', title: 'Name', field: 'name', sortable: true, filterable: true },
|
|
248
|
+
* { key: 'email', title: 'Email', field: 'email', sortable: true, filterable: true }
|
|
249
|
+
* ];
|
|
250
|
+
*
|
|
251
|
+
* return m(DataTable<User>, { data: users, columns });
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @example Advanced usage with all features
|
|
255
|
+
* ```typescript
|
|
256
|
+
* return m(DataTable<User>, {
|
|
257
|
+
* data: users,
|
|
258
|
+
* columns,
|
|
259
|
+
* title: 'User Management',
|
|
260
|
+
* striped: true,
|
|
261
|
+
* hoverable: true,
|
|
262
|
+
* height: 400,
|
|
263
|
+
*
|
|
264
|
+
* // Pagination
|
|
265
|
+
* pagination: { page: 0, pageSize: 10, total: users.length },
|
|
266
|
+
* onPaginationChange: (pagination) => console.log('Page changed:', pagination),
|
|
267
|
+
*
|
|
268
|
+
* // Selection
|
|
269
|
+
* selection: {
|
|
270
|
+
* mode: 'multiple',
|
|
271
|
+
* selectedKeys: [],
|
|
272
|
+
* getRowKey: (user) => String(user.id),
|
|
273
|
+
* onSelectionChange: (keys, selectedUsers) => console.log('Selection:', selectedUsers)
|
|
274
|
+
* },
|
|
275
|
+
*
|
|
276
|
+
* // Search
|
|
277
|
+
* enableGlobalSearch: true,
|
|
278
|
+
* searchPlaceholder: 'Search users...',
|
|
279
|
+
*
|
|
280
|
+
* // Events
|
|
281
|
+
* onRowClick: (user, index, event) => console.log('Clicked:', user),
|
|
282
|
+
* onRowDoubleClick: (user) => editUser(user),
|
|
283
|
+
*
|
|
284
|
+
* // Styling
|
|
285
|
+
* getRowClassName: (user) => user.active ? '' : 'inactive-row'
|
|
286
|
+
* });
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* @returns A Mithril component that renders the data table
|
|
290
|
+
*/
|
|
291
|
+
export declare const DataTable: <T = Record<string, any>>() => Component<DataTableAttrs<T>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { FactoryComponent } from 'mithril';
|
|
2
|
+
import { InputAttrs } from './input-options';
|
|
3
|
+
export interface DatePickerI18n {
|
|
4
|
+
cancel?: string;
|
|
5
|
+
clear?: string;
|
|
6
|
+
done?: string;
|
|
7
|
+
previousMonth?: string;
|
|
8
|
+
nextMonth?: string;
|
|
9
|
+
months?: string[];
|
|
10
|
+
monthsShort?: string[];
|
|
11
|
+
weekdays?: string[];
|
|
12
|
+
weekdaysShort?: string[];
|
|
13
|
+
weekdaysAbbrev?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface DatePickerOptions {
|
|
16
|
+
/** Close when date is selected */
|
|
17
|
+
autoClose?: boolean;
|
|
18
|
+
/** The default output format for the input field value */
|
|
19
|
+
format?: string;
|
|
20
|
+
/** Custom parse function */
|
|
21
|
+
parse?: (dateString: string, format: string) => Date | null;
|
|
22
|
+
/** The initial date to view when first opened */
|
|
23
|
+
defaultDate?: Date;
|
|
24
|
+
/** Make the defaultDate the initial selected value */
|
|
25
|
+
setDefaultDate?: boolean;
|
|
26
|
+
/** Disable weekends */
|
|
27
|
+
disableWeekends?: boolean;
|
|
28
|
+
/** Custom function to disable specific days */
|
|
29
|
+
disableDayFn?: (date: Date) => boolean;
|
|
30
|
+
/** First day of week (0: Sunday, 1: Monday etc) */
|
|
31
|
+
firstDay?: number;
|
|
32
|
+
/** The earliest date that can be selected */
|
|
33
|
+
minDate?: Date;
|
|
34
|
+
/** The latest date that can be selected */
|
|
35
|
+
maxDate?: Date;
|
|
36
|
+
/** Number of years either side, or array of upper/lower range */
|
|
37
|
+
yearRange?: number | number[];
|
|
38
|
+
/** Show clear button */
|
|
39
|
+
showClearBtn?: boolean;
|
|
40
|
+
/** Show week numbers */
|
|
41
|
+
showWeekNumbers?: boolean;
|
|
42
|
+
/** Week numbering system: 'iso' (ISO 8601) or 'local' (local convention) */
|
|
43
|
+
weekNumbering?: 'iso' | 'local';
|
|
44
|
+
/** Internationalization */
|
|
45
|
+
i18n?: DatePickerI18n;
|
|
46
|
+
/** Callback when date is selected */
|
|
47
|
+
onSelect?: (date: Date) => void;
|
|
48
|
+
/** Callback when picker is opened */
|
|
49
|
+
onOpen?: () => void;
|
|
50
|
+
/** Callback when picker is closed */
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
}
|
|
53
|
+
export interface DatePickerAttrs extends InputAttrs<string>, DatePickerOptions {
|
|
54
|
+
/** Date format attribute (alternative to format property) */
|
|
55
|
+
format?: string;
|
|
56
|
+
/** Year range attribute (alternative to yearRange property) */
|
|
57
|
+
yearrange?: string;
|
|
58
|
+
/** Legacy: Date label (use label instead) */
|
|
59
|
+
dateLabel?: string;
|
|
60
|
+
/** Legacy: Display format (use format instead) */
|
|
61
|
+
displayFormat?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Enhanced DatePicker component based on Materialize CSS datepicker
|
|
65
|
+
*/
|
|
66
|
+
export declare const DatePicker: FactoryComponent<DatePickerAttrs>;
|
package/dist/dropdown.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface DropdownItem<T extends string | number> {
|
|
|
11
11
|
/** Add a divider */
|
|
12
12
|
divider?: boolean;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface DropdownAttrs<T extends string | number> extends Attributes {
|
|
15
15
|
/**
|
|
16
16
|
* Optional id of the dropdown element
|
|
17
17
|
* @default 'dropdown'
|
|
@@ -42,4 +42,4 @@ export interface DropdownAttributes<T extends string | number> extends Attribute
|
|
|
42
42
|
helperText?: string;
|
|
43
43
|
}
|
|
44
44
|
/** Pure TypeScript Dropdown component - no Materialize dependencies */
|
|
45
|
-
export declare const Dropdown: <T extends string | number>() => Component<
|
|
45
|
+
export declare const Dropdown: <T extends string | number>() => Component<DropdownAttrs<T>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FactoryComponent, Attributes } from 'mithril';
|
|
2
|
+
export interface FileUploadAttrs extends Attributes {
|
|
3
|
+
/** Accept specific file types (e.g., "image/*", ".pdf,.doc") */
|
|
4
|
+
accept?: string;
|
|
5
|
+
/** Allow multiple file selection */
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
/** Maximum file size in bytes */
|
|
8
|
+
maxSize?: number;
|
|
9
|
+
/** Maximum number of files (for multiple uploads) */
|
|
10
|
+
maxFiles?: number;
|
|
11
|
+
/** Callback when files are selected/dropped */
|
|
12
|
+
onFilesSelected?: (files: File[]) => void;
|
|
13
|
+
/** Callback for upload progress (if implementing upload) */
|
|
14
|
+
onProgress?: (progress: number, file: File) => void;
|
|
15
|
+
/** Callback when files are removed */
|
|
16
|
+
onFileRemoved?: (file: File) => void;
|
|
17
|
+
/** Disable the upload area */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Custom label text */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Helper text */
|
|
22
|
+
helperText?: string;
|
|
23
|
+
/** Show file preview for images */
|
|
24
|
+
showPreview?: boolean;
|
|
25
|
+
/** Custom class */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Validation error message */
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* File Upload Component with Drag and Drop
|
|
32
|
+
* Supports multiple files, file type validation, size limits, and image preview
|
|
33
|
+
*/
|
|
34
|
+
export declare const FileUpload: FactoryComponent<FileUploadAttrs>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FactoryComponent } from 'mithril';
|
|
2
|
-
export interface
|
|
2
|
+
export interface FloatingActionButtonAttrs {
|
|
3
3
|
/** Optional classes to add to the top element */
|
|
4
4
|
className?: string;
|
|
5
5
|
/** Optional style to add to the top element, e.g. for positioning it inline */
|
|
@@ -34,4 +34,4 @@ export interface FloatingActionButtonAttributes {
|
|
|
34
34
|
/**
|
|
35
35
|
* Floating Action Button
|
|
36
36
|
*/
|
|
37
|
-
export declare const FloatingActionButton: FactoryComponent<
|
|
37
|
+
export declare const FloatingActionButton: FactoryComponent<FloatingActionButtonAttrs>;
|