@recursica/mui-adapter 0.22.0 → 0.24.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/CHANGELOG.md +36 -0
- package/dist/index.d.ts +277 -11
- package/dist/mui-adapter.cjs +80 -80
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +8709 -8222
- package/dist/mui-adapter.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.module.css +13 -0
- package/src/components/Chip/CHIP_IMPLEMENTATION_NOTES.md +102 -0
- package/src/components/Chip/Chip.module.css +30 -4
- package/src/components/Chip/Chip.tsx +40 -4
- package/src/components/Chip/USAGE.md +19 -0
- package/src/components/FileInput/FILEINPUT_IMPLEMENTATION_NOTES.md +148 -0
- package/src/components/FileInput/FileInput.module.css +268 -43
- package/src/components/FileInput/FileInput.stories.tsx +296 -4
- package/src/components/FileInput/FileInput.tsx +406 -6
- package/src/components/FileInput/USAGE.md +112 -4
- package/src/components/FileUpload/FILEUPLOAD_IMPLEMENTATION_NOTES.md +249 -0
- package/src/components/FileUpload/FileUpload.module.css +203 -38
- package/src/components/FileUpload/FileUpload.stories.tsx +348 -4
- package/src/components/FileUpload/FileUpload.tsx +350 -6
- package/src/components/FileUpload/USAGE.md +163 -5
- package/src/index.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @recursica/mui-adapter
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3d75770: Implement the `FileInput` component (single-line, `TextField`-shaped file picker with a native drag-and-drop drop target, single- and multiple-file modes, and a trailing clear icon) in `mantine-adapter` and `mui-adapter`, replacing the "coming soon" stub, with a shared `RecursicaFileInputProps` contract in `adapter-common` reusing `FileUpload`'s `RecursicaFileUploadItem`/validation interface (`accept`/`maxSize`/`maxFiles`/`readOnly`). Also adds `FileInput` to `RECURSICA_COMPONENTS` and moves `mui-adapter`'s export of it into the standard `wrapComponent` set (it was previously exported unwrapped, alongside the polymorphic layout primitives, as a leftover from its stub form).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b86ca2b: `FileInput` now renders every selected file as a removable `Chip` in a horizontally scrollable row, in both single- and multiple-file mode (previously single-file mode showed plain filename text with no remove affordance). The trailing clear-all control is now a real shared `Button` (icon-only, "text" variant) instead of a bespoke `<span role="button">`.
|
|
12
|
+
- Updated dependencies [3d75770]
|
|
13
|
+
- Updated dependencies [b86ca2b]
|
|
14
|
+
- @recursica/adapter-common@0.17.0
|
|
15
|
+
|
|
16
|
+
## 0.23.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 1c317a3: Implement the `FileUpload` component (drag-and-drop dropzone, browse-button fallback, removable file-chip list) in `mantine-adapter` and `mui-adapter`, replacing the "coming soon" stub, with a shared `RecursicaFileUploadProps`/`RecursicaFileUploadItem` contract in `adapter-common`. Also fixes `mui-adapter`'s `Chip` component's public type to allow `children` (a pre-existing type-only gap; the component already accepted them at runtime).
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 1c317a3: `FileUpload` now surfaces a built-in error message ("File type not accepted", overridable via the new `invalidFileTypeMessage` prop) when a dropped/picked file doesn't match `accept`, shown through the standard assistive-text error slot instead of requiring the integrator to wire up `onFilesRejected` themselves. Also reverts `FileUpload`'s assistive/error rendering back to `FormControlWrapper` (file list renders above the assistive/error text again, matching every other form control).
|
|
25
|
+
|
|
26
|
+
Fixes `Chip` clipping the descender (e.g. the "g" in "image.png") off long labels — `overflow: hidden` was clipping vertically as well as horizontally, cutting off glyph ink whenever the line-height token was tighter than the font's natural ascent+descent.
|
|
27
|
+
|
|
28
|
+
- 1c317a3: `FileUpload` now supports a `maxFiles` prop (with an overridable `maxFilesMessage`, defaulting to "Maximum of {maxFiles} files allowed") that rejects files past a total-count cap the same way `accept`/`maxSize` already do.
|
|
29
|
+
|
|
30
|
+
Fixes `Chip` rendered without a real handler (`onRemove`/`onClick`/`onChange`) — such as `FileUpload`'s `readOnly` file list — still showing a pointer cursor on hover and picking up a phantom, un-styled keyboard Tab stop on its truncated label text. Both were general `Chip` bugs, not specific to `FileUpload`.
|
|
31
|
+
|
|
32
|
+
- 1c317a3: Fix `Button` showing the native browser focus outline instead of the recursica focus ring, and fix `Chip` losing its remove (X) icon behind an overflowing long label instead of truncating with an ellipsis. Adds optional `removeTabIndex`/`removeIconRef` props to `Chip` for building keyboard-navigable chip groups. Also fixes the remove icon's own focus ring rendering in the chip's neutral border color instead of the recursica focus-ring color, making it barely visible.
|
|
33
|
+
- Updated dependencies [1c317a3]
|
|
34
|
+
- Updated dependencies [1c317a3]
|
|
35
|
+
- Updated dependencies [1c317a3]
|
|
36
|
+
- Updated dependencies [1c317a3]
|
|
37
|
+
- @recursica/adapter-common@0.16.0
|
|
38
|
+
|
|
3
39
|
## 0.22.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ import { DialogProps } from '@mui/material';
|
|
|
22
22
|
import { DialogTitleProps } from '@mui/material';
|
|
23
23
|
import { DividerProps } from '@mui/material';
|
|
24
24
|
import { DrawerProps } from '@mui/material';
|
|
25
|
-
import { FC } from 'react';
|
|
26
25
|
import { FormControlProps } from '@mui/material';
|
|
27
26
|
import { FormGroupProps } from '@mui/material';
|
|
28
27
|
import { FormHelperTextProps } from '@mui/material';
|
|
@@ -406,9 +405,13 @@ declare type CheckboxWrapperProps = Omit<CheckboxProps_2, "size" | "color"> & Re
|
|
|
406
405
|
|
|
407
406
|
export declare const Chip: typeof rawComponents.Chip;
|
|
408
407
|
|
|
409
|
-
declare const Chip_2: default_2.ForwardRefExoticComponent<(Omit<Omit<WithRecursicaSpacing<Omit<ChipProps_2, "color" | "variant" | "size" | "radius"> & RecursicaChipProps
|
|
408
|
+
declare const Chip_2: default_2.ForwardRefExoticComponent<(Omit<Omit<WithRecursicaSpacing<Omit<ChipProps_2, "color" | "children" | "variant" | "size" | "radius"> & RecursicaChipProps & {
|
|
409
|
+
children?: default_2.ReactNode;
|
|
410
|
+
}>, BlockedStylingKeys> & ForbiddenStyles & {
|
|
410
411
|
overStyled?: false | undefined;
|
|
411
|
-
}, "ref"> | Omit<Omit<Omit<ChipProps_2, "color" | "variant" | "size" | "radius"> & RecursicaChipProps
|
|
412
|
+
}, "ref"> | Omit<Omit<Omit<ChipProps_2, "color" | "children" | "variant" | "size" | "radius"> & RecursicaChipProps & {
|
|
413
|
+
children?: default_2.ReactNode;
|
|
414
|
+
}, "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "gap" | "rowGap" | "columnGap"> & {
|
|
412
415
|
m?: string | number | RecursicaSpacing;
|
|
413
416
|
mx?: string | number | RecursicaSpacing;
|
|
414
417
|
my?: string | number | RecursicaSpacing;
|
|
@@ -423,7 +426,9 @@ declare const Chip_2: default_2.ForwardRefExoticComponent<(Omit<Omit<WithRecursi
|
|
|
423
426
|
overStyled: true;
|
|
424
427
|
}, "ref">) & default_2.RefAttributes<HTMLInputElement>>;
|
|
425
428
|
|
|
426
|
-
declare type ChipProps = RecursicaOverStyled<Omit<ChipProps_2, "variant" | "size" | "color" | "radius"> & RecursicaChipProps
|
|
429
|
+
declare type ChipProps = RecursicaOverStyled<Omit<ChipProps_2, "variant" | "size" | "color" | "radius" | "children"> & RecursicaChipProps & {
|
|
430
|
+
children?: default_2.ReactNode;
|
|
431
|
+
}>;
|
|
427
432
|
|
|
428
433
|
export declare const Container: ForwardRefExoticComponent<Omit<rawComponents.ContainerProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
429
434
|
|
|
@@ -495,17 +500,81 @@ export declare interface EmptyValueRendererProps {
|
|
|
495
500
|
emptyText?: string;
|
|
496
501
|
}
|
|
497
502
|
|
|
498
|
-
export declare const FileInput:
|
|
503
|
+
export declare const FileInput: typeof rawComponents.FileInput;
|
|
499
504
|
|
|
500
|
-
|
|
505
|
+
/**
|
|
506
|
+
* A single-line, `TextField`-shaped control for choosing one or more files, sharing
|
|
507
|
+
* `FileUpload`'s selection/validation interface (`accept`/`maxSize`/`maxFiles`, `readOnly`)
|
|
508
|
+
* behind a different presentation.
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* <FileInput
|
|
512
|
+
* label="Resume"
|
|
513
|
+
* files={files}
|
|
514
|
+
* onFilesAdded={(added) => setFiles(added.map((file) => ({ file })))}
|
|
515
|
+
* onFileRemove={() => setFiles([])}
|
|
516
|
+
* />
|
|
517
|
+
*/
|
|
518
|
+
declare const FileInput_2: default_2.ForwardRefExoticComponent<(Omit<Omit<WithRecursicaSpacing<RecursicaFileInputProps_2>, BlockedStylingKeys> & ForbiddenStyles & {
|
|
519
|
+
overStyled?: false | undefined;
|
|
520
|
+
}, "ref"> | Omit<Omit<RecursicaFileInputProps_2, "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "gap" | "rowGap" | "columnGap"> & {
|
|
521
|
+
m?: string | number | RecursicaSpacing;
|
|
522
|
+
mx?: string | number | RecursicaSpacing;
|
|
523
|
+
my?: string | number | RecursicaSpacing;
|
|
524
|
+
mt?: string | number | RecursicaSpacing;
|
|
525
|
+
mb?: string | number | RecursicaSpacing;
|
|
526
|
+
ml?: string | number | RecursicaSpacing;
|
|
527
|
+
mr?: string | number | RecursicaSpacing;
|
|
528
|
+
gap?: string | number | RecursicaSpacing;
|
|
529
|
+
rowGap?: string | number | RecursicaSpacing;
|
|
530
|
+
columnGap?: string | number | RecursicaSpacing;
|
|
531
|
+
} & {
|
|
532
|
+
overStyled: true;
|
|
533
|
+
}, "ref">) & default_2.RefAttributes<HTMLDivElement>>;
|
|
501
534
|
|
|
502
|
-
declare type FileInputProps =
|
|
535
|
+
declare type FileInputProps = RecursicaOverStyled<RecursicaFileInputProps_2>;
|
|
503
536
|
|
|
504
|
-
|
|
537
|
+
/**
|
|
538
|
+
* Mirrors the semantics of the native HTML `accept` attribute (comma-separated file extensions,
|
|
539
|
+
* MIME types, or MIME wildcards like `image/*`) so drag-and-drop can be validated the same way —
|
|
540
|
+
* the browser only applies `accept` to its own file-picker dialog, never to a `drop` event, so
|
|
541
|
+
* without this a dropped file bypasses the restriction entirely.
|
|
542
|
+
*/
|
|
543
|
+
export declare function fileMatchesAccept(file: File, accept?: string): boolean;
|
|
505
544
|
|
|
506
|
-
declare const
|
|
545
|
+
export declare const FileUpload: typeof rawComponents.FileUpload;
|
|
507
546
|
|
|
508
|
-
|
|
547
|
+
/**
|
|
548
|
+
* A dropzone for uploading files, with a native browse-button fallback and a
|
|
549
|
+
* removable-chip list of the currently selected files.
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* <FileUpload
|
|
553
|
+
* label="Upload Files"
|
|
554
|
+
* assistiveText="Max file size 5MB"
|
|
555
|
+
* files={files}
|
|
556
|
+
* onFilesAdded={(added) => setFiles((f) => [...f, ...added.map((file) => ({ file }))])}
|
|
557
|
+
* onFileRemove={(id) => setFiles((f) => f.filter((item) => (item.id ?? item.file.name) !== id))}
|
|
558
|
+
* />
|
|
559
|
+
*/
|
|
560
|
+
declare const FileUpload_2: default_2.ForwardRefExoticComponent<(Omit<Omit<WithRecursicaSpacing<RecursicaFileUploadProps_2>, BlockedStylingKeys> & ForbiddenStyles & {
|
|
561
|
+
overStyled?: false | undefined;
|
|
562
|
+
}, "ref"> | Omit<Omit<RecursicaFileUploadProps_2, "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "gap" | "rowGap" | "columnGap"> & {
|
|
563
|
+
m?: string | number | RecursicaSpacing;
|
|
564
|
+
mx?: string | number | RecursicaSpacing;
|
|
565
|
+
my?: string | number | RecursicaSpacing;
|
|
566
|
+
mt?: string | number | RecursicaSpacing;
|
|
567
|
+
mb?: string | number | RecursicaSpacing;
|
|
568
|
+
ml?: string | number | RecursicaSpacing;
|
|
569
|
+
mr?: string | number | RecursicaSpacing;
|
|
570
|
+
gap?: string | number | RecursicaSpacing;
|
|
571
|
+
rowGap?: string | number | RecursicaSpacing;
|
|
572
|
+
columnGap?: string | number | RecursicaSpacing;
|
|
573
|
+
} & {
|
|
574
|
+
overStyled: true;
|
|
575
|
+
}, "ref">) & default_2.RefAttributes<HTMLDivElement>>;
|
|
576
|
+
|
|
577
|
+
declare type FileUploadProps = RecursicaOverStyled<RecursicaFileUploadProps_2>;
|
|
509
578
|
|
|
510
579
|
export declare const Flex: ForwardRefExoticComponent<Omit<rawComponents.FlexProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
511
580
|
|
|
@@ -1004,8 +1073,11 @@ declare namespace rawComponents {
|
|
|
1004
1073
|
RecursicaDropdownProps,
|
|
1005
1074
|
DropdownProps,
|
|
1006
1075
|
Dropdown_2 as Dropdown,
|
|
1076
|
+
RecursicaFileUploadItem,
|
|
1077
|
+
RecursicaFileInputProps_2 as RecursicaFileInputProps,
|
|
1007
1078
|
FileInputProps,
|
|
1008
1079
|
FileInput_2 as FileInput,
|
|
1080
|
+
RecursicaFileUploadProps_2 as RecursicaFileUploadProps,
|
|
1009
1081
|
FileUploadProps,
|
|
1010
1082
|
FileUpload_2 as FileUpload,
|
|
1011
1083
|
FlexProps,
|
|
@@ -1171,7 +1243,7 @@ export declare type ReadOnlyFieldType = "text" | "number" | "date" | "boolean" |
|
|
|
1171
1243
|
/**
|
|
1172
1244
|
* Official list of all components in Recursica.
|
|
1173
1245
|
*/
|
|
1174
|
-
export declare const RECURSICA_COMPONENTS: readonly ["Accordion", "AssistiveElement", "Autocomplete", "Avatar", "Badge", "Breadcrumb", "Button", "Card", "Checkbox", "Chip", "Container", "DatePicker", "Dropdown", "EmptyValueRenderer", "Flex", "FormControlLayout", "FormControlWrapper", "Grid", "Group", "HoverCard", "Label", "Layer", "Link", "Loader", "Menu", "Modal", "NumberInput", "Pagination", "Panel", "Popover", "Radio", "ReadOnlyField", "SegmentedControl", "Slider", "Stack", "Stepper", "Switch", "Table", "Tabs", "Text", "TextArea", "TextField", "TimePicker", "Timeline", "Title", "Toast", "Tooltip", "TransferList"];
|
|
1246
|
+
export declare const RECURSICA_COMPONENTS: readonly ["Accordion", "AssistiveElement", "Autocomplete", "Avatar", "Badge", "Breadcrumb", "Button", "Card", "Checkbox", "Chip", "Container", "DatePicker", "Dropdown", "EmptyValueRenderer", "FileInput", "Flex", "FormControlLayout", "FormControlWrapper", "Grid", "Group", "HoverCard", "Label", "Layer", "Link", "Loader", "Menu", "Modal", "NumberInput", "Pagination", "Panel", "Popover", "Radio", "ReadOnlyField", "SegmentedControl", "Slider", "Stack", "Stepper", "Switch", "Table", "Tabs", "Text", "TextArea", "TextField", "TimePicker", "Timeline", "Title", "Toast", "Tooltip", "TransferList"];
|
|
1175
1247
|
|
|
1176
1248
|
/**
|
|
1177
1249
|
* Props for the Recursica Accordion Control component.
|
|
@@ -1388,6 +1460,17 @@ export declare interface RecursicaChipProps {
|
|
|
1388
1460
|
removeLabel?: string;
|
|
1389
1461
|
/** Checked state for the chip (acts as a checkbox) */
|
|
1390
1462
|
checked?: boolean;
|
|
1463
|
+
/**
|
|
1464
|
+
* Tab index for the remove (X) icon. Defaults to `0`. Lets a parent implement a roving-tabindex
|
|
1465
|
+
* pattern across a group of chips (e.g. FileUpload's file list) by setting this to `-1` on every
|
|
1466
|
+
* chip except the currently-active one.
|
|
1467
|
+
*/
|
|
1468
|
+
removeTabIndex?: number;
|
|
1469
|
+
/**
|
|
1470
|
+
* Ref to the remove (X) icon element, so a parent can move focus to it imperatively — e.g.
|
|
1471
|
+
* arrow-key navigation across a group of chips.
|
|
1472
|
+
*/
|
|
1473
|
+
removeIconRef?: default_2.Ref<HTMLSpanElement>;
|
|
1391
1474
|
}
|
|
1392
1475
|
|
|
1393
1476
|
/**
|
|
@@ -1438,6 +1521,189 @@ declare interface RecursicaDropdownProps_2 {
|
|
|
1438
1521
|
placeholder?: string;
|
|
1439
1522
|
}
|
|
1440
1523
|
|
|
1524
|
+
/**
|
|
1525
|
+
* Props for the Recursica FileInput component.
|
|
1526
|
+
*
|
|
1527
|
+
* `FileInput` is presented as a single-line, `TextField`-shaped control rather than
|
|
1528
|
+
* `FileUpload`'s dropzone, but shares the same file-selection interface and validation
|
|
1529
|
+
* behavior (`accept`/`maxSize`/`maxFiles`, `onFilesRejected`, `readOnly`) so integrators can
|
|
1530
|
+
* move between them without relearning the contract.
|
|
1531
|
+
*/
|
|
1532
|
+
export declare interface RecursicaFileInputProps {
|
|
1533
|
+
/**
|
|
1534
|
+
* Files currently selected. This is a controlled list — `onFilesAdded`/`onFileRemove`
|
|
1535
|
+
* report changes, but `FileInput` never mutates this array itself; merge the reported
|
|
1536
|
+
* changes into your own state and pass the updated list back in.
|
|
1537
|
+
*/
|
|
1538
|
+
files?: RecursicaFileUploadItem[];
|
|
1539
|
+
/**
|
|
1540
|
+
* Called with the files the user just picked via the native file dialog or dropped onto
|
|
1541
|
+
* the control. Only the newly added files are passed — merge them into `files` yourself.
|
|
1542
|
+
*/
|
|
1543
|
+
onFilesAdded?: (files: File[]) => void;
|
|
1544
|
+
/**
|
|
1545
|
+
* Called when a file's remove affordance is activated, identified by its `id` (or
|
|
1546
|
+
* `file.name` when no `id` was given for that entry). In single-file mode this is also
|
|
1547
|
+
* called when the trailing clear icon removes the one selected file.
|
|
1548
|
+
*/
|
|
1549
|
+
onFileRemove?: (id: string) => void;
|
|
1550
|
+
/**
|
|
1551
|
+
* Native `accept` attribute for the underlying file input (e.g. `".pdf,.png"` or
|
|
1552
|
+
* `"image/*"`) — constrains the native file-picker dialog. Also enforced against files
|
|
1553
|
+
* dropped onto the control, the same way `FileUpload` enforces it.
|
|
1554
|
+
*/
|
|
1555
|
+
accept?: string;
|
|
1556
|
+
/** Whether more than one file can be selected/dropped at once. Defaults to `false`. */
|
|
1557
|
+
multiple?: boolean;
|
|
1558
|
+
/**
|
|
1559
|
+
* Maximum size per file, in bytes. Files exceeding this are passed to
|
|
1560
|
+
* `onFilesRejected` instead of `onFilesAdded`.
|
|
1561
|
+
*/
|
|
1562
|
+
maxSize?: number;
|
|
1563
|
+
/**
|
|
1564
|
+
* Maximum total number of files allowed in `files`. Only meaningful when `multiple` is
|
|
1565
|
+
* `true` — Once reached, further dropped/picked files are passed to `onFilesRejected`
|
|
1566
|
+
* instead of `onFilesAdded`.
|
|
1567
|
+
*/
|
|
1568
|
+
maxFiles?: number;
|
|
1569
|
+
/**
|
|
1570
|
+
* Called with any files rejected for exceeding `maxSize`/`maxFiles` or not matching
|
|
1571
|
+
* `accept`.
|
|
1572
|
+
*/
|
|
1573
|
+
onFilesRejected?: (files: File[]) => void;
|
|
1574
|
+
/**
|
|
1575
|
+
* Error message shown (via the standard assistive-text error slot) when a dropped/picked
|
|
1576
|
+
* file's extension or MIME type doesn't match `accept`. Defaults to
|
|
1577
|
+
* `"File type not accepted"`.
|
|
1578
|
+
*/
|
|
1579
|
+
invalidFileTypeMessage?: default_2.ReactNode;
|
|
1580
|
+
/**
|
|
1581
|
+
* Error message shown (via the standard assistive-text error slot) when a dropped/picked
|
|
1582
|
+
* file would exceed `maxFiles`. Defaults to `"Maximum of {maxFiles} files allowed"`.
|
|
1583
|
+
*/
|
|
1584
|
+
maxFilesMessage?: default_2.ReactNode;
|
|
1585
|
+
/** Leading icon shown inside the control. Defaults to the built-in upload icon. */
|
|
1586
|
+
icon?: default_2.ReactNode;
|
|
1587
|
+
/** Text shown when no file is selected. Defaults to `"Select a file..."`. */
|
|
1588
|
+
placeholder?: default_2.ReactNode;
|
|
1589
|
+
/** Screen-reader label for the control itself. Defaults to `"Choose file"`. */
|
|
1590
|
+
browseLabel?: string;
|
|
1591
|
+
/** Screen-reader label for a file chip's remove button. Defaults to `"Remove"`. */
|
|
1592
|
+
removeFileLabel?: string;
|
|
1593
|
+
/** Screen-reader label for the trailing clear-all icon. Defaults to `"Clear"`. */
|
|
1594
|
+
clearLabel?: string;
|
|
1595
|
+
/** Disables the control and its remove/clear icons. */
|
|
1596
|
+
disabled?: boolean;
|
|
1597
|
+
/**
|
|
1598
|
+
* Renders `files` as a static, non-interactive display with no clear/remove icons, and
|
|
1599
|
+
* disables picking or dropping new files.
|
|
1600
|
+
*/
|
|
1601
|
+
readOnly?: boolean;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
declare interface RecursicaFileInputProps_2 extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children" | "onDrop" | "onChange">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth">, RecursicaFileInputProps {
|
|
1605
|
+
/** Visually forces the mandatory asterisk. Accepted for API parity with other adapters; MUI's own `required` already renders the asterisk, so this has no separate effect here. */
|
|
1606
|
+
withAsterisk?: boolean;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* A single file entry rendered as a removable chip in the FileUpload's file list.
|
|
1611
|
+
*/
|
|
1612
|
+
declare interface RecursicaFileUploadItem {
|
|
1613
|
+
/** The underlying browser File object. */
|
|
1614
|
+
file: File;
|
|
1615
|
+
/**
|
|
1616
|
+
* Stable identifier for this entry, used as the React key and passed back to
|
|
1617
|
+
* `onFileRemove`. Defaults to the file's `name` when not provided.
|
|
1618
|
+
*/
|
|
1619
|
+
id?: string;
|
|
1620
|
+
}
|
|
1621
|
+
export { RecursicaFileUploadItem as RecursicaFileInputItem }
|
|
1622
|
+
export { RecursicaFileUploadItem }
|
|
1623
|
+
|
|
1624
|
+
/**
|
|
1625
|
+
* Props for the Recursica FileUpload component.
|
|
1626
|
+
*/
|
|
1627
|
+
export declare interface RecursicaFileUploadProps {
|
|
1628
|
+
/**
|
|
1629
|
+
* Files currently selected, rendered as removable chips below the dropzone.
|
|
1630
|
+
* This is a controlled list — `onFilesAdded`/`onFileRemove` report changes, but
|
|
1631
|
+
* `FileUpload` never mutates this array itself; merge the reported changes into
|
|
1632
|
+
* your own state and pass the updated list back in.
|
|
1633
|
+
*/
|
|
1634
|
+
files?: RecursicaFileUploadItem[];
|
|
1635
|
+
/**
|
|
1636
|
+
* Called with the files the user just dropped onto the dropzone or picked via
|
|
1637
|
+
* the browse button. Only the newly added files are passed — merge them into
|
|
1638
|
+
* `files` yourself (e.g. to assign an `id`, dedupe, or reject some of them).
|
|
1639
|
+
*/
|
|
1640
|
+
onFilesAdded?: (files: File[]) => void;
|
|
1641
|
+
/**
|
|
1642
|
+
* Called when a file chip's remove (X) icon is activated, identified by its
|
|
1643
|
+
* `id` (or `file.name` when no `id` was given for that entry).
|
|
1644
|
+
*/
|
|
1645
|
+
onFileRemove?: (id: string) => void;
|
|
1646
|
+
/**
|
|
1647
|
+
* Native `accept` attribute for the underlying file input (e.g. `".pdf,.png"`
|
|
1648
|
+
* or `"image/*"`) — constrains the browse-button file picker natively. Also
|
|
1649
|
+
* enforced against files dropped onto the dropzone: the browser only applies
|
|
1650
|
+
* `accept` to its own file-picker dialog, never to a `drop` event, so files
|
|
1651
|
+
* that don't match are rejected the same way (see `onFilesRejected`) rather
|
|
1652
|
+
* than silently bypassing the restriction.
|
|
1653
|
+
*/
|
|
1654
|
+
accept?: string;
|
|
1655
|
+
/** Whether more than one file can be selected/dropped at once. Defaults to `true`. */
|
|
1656
|
+
multiple?: boolean;
|
|
1657
|
+
/**
|
|
1658
|
+
* Maximum size per file, in bytes. Files exceeding this are passed to
|
|
1659
|
+
* `onFilesRejected` instead of `onFilesAdded`.
|
|
1660
|
+
*/
|
|
1661
|
+
maxSize?: number;
|
|
1662
|
+
/**
|
|
1663
|
+
* Maximum total number of files allowed in `files`. Once reached, further
|
|
1664
|
+
* dropped/picked files are passed to `onFilesRejected` instead of
|
|
1665
|
+
* `onFilesAdded`.
|
|
1666
|
+
*/
|
|
1667
|
+
maxFiles?: number;
|
|
1668
|
+
/**
|
|
1669
|
+
* Called with any files rejected for exceeding `maxSize`/`maxFiles` or not
|
|
1670
|
+
* matching `accept`.
|
|
1671
|
+
*/
|
|
1672
|
+
onFilesRejected?: (files: File[]) => void;
|
|
1673
|
+
/**
|
|
1674
|
+
* Error message shown (via the standard assistive-text error slot) when a
|
|
1675
|
+
* dropped/picked file's extension or MIME type doesn't match `accept`.
|
|
1676
|
+
* Defaults to `"File type not accepted"`.
|
|
1677
|
+
*/
|
|
1678
|
+
invalidFileTypeMessage?: default_2.ReactNode;
|
|
1679
|
+
/**
|
|
1680
|
+
* Error message shown (via the standard assistive-text error slot) when a
|
|
1681
|
+
* dropped/picked file would exceed `maxFiles`. Defaults to
|
|
1682
|
+
* `"Maximum of {maxFiles} files allowed"`.
|
|
1683
|
+
*/
|
|
1684
|
+
maxFilesMessage?: default_2.ReactNode;
|
|
1685
|
+
/** Icon shown above the dropzone label. Defaults to the built-in upload icon. */
|
|
1686
|
+
icon?: default_2.ReactNode;
|
|
1687
|
+
/** Text shown inside the dropzone. Defaults to `"Drag and drop files here to upload"`. */
|
|
1688
|
+
dropzoneLabel?: default_2.ReactNode;
|
|
1689
|
+
/** Label for the button that opens the native file picker. Defaults to `"Browse files"`. */
|
|
1690
|
+
browseButtonLabel?: default_2.ReactNode;
|
|
1691
|
+
/** Screen-reader label for each file chip's remove button. Defaults to `"Remove"`. */
|
|
1692
|
+
removeFileLabel?: string;
|
|
1693
|
+
/** Disables the dropzone, browse button, and every file chip's remove icon. */
|
|
1694
|
+
disabled?: boolean;
|
|
1695
|
+
/**
|
|
1696
|
+
* Renders `files` as a static list of chips with no remove icon, and omits
|
|
1697
|
+
* the dropzone/browse button entirely.
|
|
1698
|
+
*/
|
|
1699
|
+
readOnly?: boolean;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
declare interface RecursicaFileUploadProps_2 extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children" | "onDrop" | "onChange">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth">, RecursicaFileUploadProps {
|
|
1703
|
+
/** Visually forces the mandatory asterisk. Accepted for API parity with other adapters; MUI's own `required` already renders the asterisk, so this has no separate effect here. */
|
|
1704
|
+
withAsterisk?: boolean;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1441
1707
|
/**
|
|
1442
1708
|
* Props for the Recursica Flex layout component.
|
|
1443
1709
|
*/
|