@recursica/mui-adapter 0.23.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 CHANGED
@@ -1,5 +1,18 @@
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
+
3
16
  ## 0.23.0
4
17
 
5
18
  ### 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';
@@ -501,11 +500,39 @@ export declare interface EmptyValueRendererProps {
501
500
  emptyText?: string;
502
501
  }
503
502
 
504
- export declare const FileInput: FC<rawComponents.FileInputProps>;
503
+ export declare const FileInput: typeof rawComponents.FileInput;
505
504
 
506
- declare const FileInput_2: default_2.FC<FileInputProps>;
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>>;
507
534
 
508
- declare type FileInputProps = default_2.HTMLAttributes<HTMLDivElement>;
535
+ declare type FileInputProps = RecursicaOverStyled<RecursicaFileInputProps_2>;
509
536
 
510
537
  /**
511
538
  * Mirrors the semantics of the native HTML `accept` attribute (comma-separated file extensions,
@@ -1046,9 +1073,10 @@ declare namespace rawComponents {
1046
1073
  RecursicaDropdownProps,
1047
1074
  DropdownProps,
1048
1075
  Dropdown_2 as Dropdown,
1076
+ RecursicaFileUploadItem,
1077
+ RecursicaFileInputProps_2 as RecursicaFileInputProps,
1049
1078
  FileInputProps,
1050
1079
  FileInput_2 as FileInput,
1051
- RecursicaFileUploadItem,
1052
1080
  RecursicaFileUploadProps_2 as RecursicaFileUploadProps,
1053
1081
  FileUploadProps,
1054
1082
  FileUpload_2 as FileUpload,
@@ -1215,7 +1243,7 @@ export declare type ReadOnlyFieldType = "text" | "number" | "date" | "boolean" |
1215
1243
  /**
1216
1244
  * Official list of all components in Recursica.
1217
1245
  */
1218
- 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"];
1219
1247
 
1220
1248
  /**
1221
1249
  * Props for the Recursica Accordion Control component.
@@ -1493,10 +1521,95 @@ declare interface RecursicaDropdownProps_2 {
1493
1521
  placeholder?: string;
1494
1522
  }
1495
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
+
1496
1609
  /**
1497
1610
  * A single file entry rendered as a removable chip in the FileUpload's file list.
1498
1611
  */
1499
- export declare interface RecursicaFileUploadItem {
1612
+ declare interface RecursicaFileUploadItem {
1500
1613
  /** The underlying browser File object. */
1501
1614
  file: File;
1502
1615
  /**
@@ -1505,6 +1618,8 @@ export declare interface RecursicaFileUploadItem {
1505
1618
  */
1506
1619
  id?: string;
1507
1620
  }
1621
+ export { RecursicaFileUploadItem as RecursicaFileInputItem }
1622
+ export { RecursicaFileUploadItem }
1508
1623
 
1509
1624
  /**
1510
1625
  * Props for the Recursica FileUpload component.