@recursica/mantine-adapter 0.39.0 → 0.41.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,42 @@
1
1
  # @recursica/mantine-adapter
2
2
 
3
+ ## 0.41.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.40.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
+ - 1c317a3: Fix `TimePicker`'s AM/PM dropdown showing blank until an hour is typed; it now defaults to "AM", matching `mui-adapter`.
34
+ - Updated dependencies [1c317a3]
35
+ - Updated dependencies [1c317a3]
36
+ - Updated dependencies [1c317a3]
37
+ - Updated dependencies [1c317a3]
38
+ - @recursica/adapter-common@0.16.0
39
+
3
40
  ## 0.39.0
4
41
 
5
42
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -371,15 +371,49 @@ export declare interface EmptyValueRendererProps {
371
371
 
372
372
  export declare const FileInput: typeof rawComponents.FileInput;
373
373
 
374
- declare const FileInput_2: default_2.FC<FileInputProps>;
374
+ /**
375
+ * A single-line, `TextField`-shaped control for choosing one or more files, sharing
376
+ * `FileUpload`'s selection/validation interface (`accept`/`maxSize`/`maxFiles`, `readOnly`)
377
+ * behind a different presentation.
378
+ *
379
+ * @example
380
+ * <FileInput
381
+ * label="Resume"
382
+ * files={files}
383
+ * onFilesAdded={(added) => setFiles(added.map((file) => ({ file })))}
384
+ * onFileRemove={() => setFiles([])}
385
+ * />
386
+ */
387
+ declare const FileInput_2: default_2.ForwardRefExoticComponent<FileInputProps & default_2.RefAttributes<HTMLDivElement>>;
375
388
 
376
- declare type FileInputProps = default_2.HTMLAttributes<HTMLDivElement>;
389
+ declare type FileInputProps = RecursicaOverStyled<RecursicaFileInputProps_2>;
390
+
391
+ /**
392
+ * Mirrors the semantics of the native HTML `accept` attribute (comma-separated file extensions,
393
+ * MIME types, or MIME wildcards like `image/*`) so drag-and-drop can be validated the same way —
394
+ * the browser only applies `accept` to its own file-picker dialog, never to a `drop` event, so
395
+ * without this a dropped file bypasses the restriction entirely.
396
+ */
397
+ export declare function fileMatchesAccept(file: File, accept?: string): boolean;
377
398
 
378
399
  export declare const FileUpload: typeof rawComponents.FileUpload;
379
400
 
380
- declare const FileUpload_2: default_2.FC<FileUploadProps>;
401
+ /**
402
+ * A dropzone for uploading files, with a native browse-button fallback and a
403
+ * removable-chip list of the currently selected files.
404
+ *
405
+ * @example
406
+ * <FileUpload
407
+ * label="Upload Files"
408
+ * assistiveText="Max file size 5MB"
409
+ * files={files}
410
+ * onFilesAdded={(added) => setFiles((f) => [...f, ...added.map((file) => ({ file }))])}
411
+ * onFileRemove={(id) => setFiles((f) => f.filter((item) => (item.id ?? item.file.name) !== id))}
412
+ * />
413
+ */
414
+ declare const FileUpload_2: default_2.ForwardRefExoticComponent<FileUploadProps & default_2.RefAttributes<HTMLDivElement>>;
381
415
 
382
- declare type FileUploadProps = default_2.HTMLAttributes<HTMLDivElement>;
416
+ declare type FileUploadProps = RecursicaOverStyled<RecursicaFileUploadProps_2>;
383
417
 
384
418
  export declare const Flex: (<C = "div">(props: PolymorphicComponentProps<C, rawComponents.FlexProps>) => React.ReactElement) & Omit<FunctionComponent<(Omit<FlexProps_2 & RecursicaFlexProps, "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "gap" | "rowGap" | "columnGap"> & {
385
419
  m?: string | number | RecursicaSpacing;
@@ -1327,8 +1361,11 @@ declare namespace rawComponents {
1327
1361
  RecursicaDropdownProps,
1328
1362
  DropdownProps,
1329
1363
  Dropdown_2 as Dropdown,
1364
+ RecursicaFileUploadItem,
1365
+ RecursicaFileInputProps_2 as RecursicaFileInputProps,
1330
1366
  FileInputProps,
1331
1367
  FileInput_2 as FileInput,
1368
+ RecursicaFileUploadProps_2 as RecursicaFileUploadProps,
1332
1369
  FileUploadProps,
1333
1370
  FileUpload_2 as FileUpload,
1334
1371
  FlexProps,
@@ -1538,7 +1575,7 @@ declare type ReadOnlyTextFieldProps = RecursicaOverStyled<RecursicaReadOnlyTextF
1538
1575
  /**
1539
1576
  * Official list of all components in Recursica.
1540
1577
  */
1541
- 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"];
1578
+ 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"];
1542
1579
 
1543
1580
  /**
1544
1581
  * Props for the Recursica Accordion Control component.
@@ -1757,6 +1794,17 @@ export declare interface RecursicaChipProps {
1757
1794
  removeLabel?: string;
1758
1795
  /** Checked state for the chip (acts as a checkbox) */
1759
1796
  checked?: boolean;
1797
+ /**
1798
+ * Tab index for the remove (X) icon. Defaults to `0`. Lets a parent implement a roving-tabindex
1799
+ * pattern across a group of chips (e.g. FileUpload's file list) by setting this to `-1` on every
1800
+ * chip except the currently-active one.
1801
+ */
1802
+ removeTabIndex?: number;
1803
+ /**
1804
+ * Ref to the remove (X) icon element, so a parent can move focus to it imperatively — e.g.
1805
+ * arrow-key navigation across a group of chips.
1806
+ */
1807
+ removeIconRef?: default_2.Ref<HTMLSpanElement>;
1760
1808
  }
1761
1809
 
1762
1810
  /**
@@ -1810,6 +1858,185 @@ declare interface RecursicaDropdownProps_2 {
1810
1858
  placeholder?: string;
1811
1859
  }
1812
1860
 
1861
+ /**
1862
+ * Props for the Recursica FileInput component.
1863
+ *
1864
+ * `FileInput` is presented as a single-line, `TextField`-shaped control rather than
1865
+ * `FileUpload`'s dropzone, but shares the same file-selection interface and validation
1866
+ * behavior (`accept`/`maxSize`/`maxFiles`, `onFilesRejected`, `readOnly`) so integrators can
1867
+ * move between them without relearning the contract.
1868
+ */
1869
+ export declare interface RecursicaFileInputProps {
1870
+ /**
1871
+ * Files currently selected. This is a controlled list — `onFilesAdded`/`onFileRemove`
1872
+ * report changes, but `FileInput` never mutates this array itself; merge the reported
1873
+ * changes into your own state and pass the updated list back in.
1874
+ */
1875
+ files?: RecursicaFileUploadItem[];
1876
+ /**
1877
+ * Called with the files the user just picked via the native file dialog or dropped onto
1878
+ * the control. Only the newly added files are passed — merge them into `files` yourself.
1879
+ */
1880
+ onFilesAdded?: (files: File[]) => void;
1881
+ /**
1882
+ * Called when a file's remove affordance is activated, identified by its `id` (or
1883
+ * `file.name` when no `id` was given for that entry). In single-file mode this is also
1884
+ * called when the trailing clear icon removes the one selected file.
1885
+ */
1886
+ onFileRemove?: (id: string) => void;
1887
+ /**
1888
+ * Native `accept` attribute for the underlying file input (e.g. `".pdf,.png"` or
1889
+ * `"image/*"`) — constrains the native file-picker dialog. Also enforced against files
1890
+ * dropped onto the control, the same way `FileUpload` enforces it.
1891
+ */
1892
+ accept?: string;
1893
+ /** Whether more than one file can be selected/dropped at once. Defaults to `false`. */
1894
+ multiple?: boolean;
1895
+ /**
1896
+ * Maximum size per file, in bytes. Files exceeding this are passed to
1897
+ * `onFilesRejected` instead of `onFilesAdded`.
1898
+ */
1899
+ maxSize?: number;
1900
+ /**
1901
+ * Maximum total number of files allowed in `files`. Only meaningful when `multiple` is
1902
+ * `true` — Once reached, further dropped/picked files are passed to `onFilesRejected`
1903
+ * instead of `onFilesAdded`.
1904
+ */
1905
+ maxFiles?: number;
1906
+ /**
1907
+ * Called with any files rejected for exceeding `maxSize`/`maxFiles` or not matching
1908
+ * `accept`.
1909
+ */
1910
+ onFilesRejected?: (files: File[]) => void;
1911
+ /**
1912
+ * Error message shown (via the standard assistive-text error slot) when a dropped/picked
1913
+ * file's extension or MIME type doesn't match `accept`. Defaults to
1914
+ * `"File type not accepted"`.
1915
+ */
1916
+ invalidFileTypeMessage?: default_2.ReactNode;
1917
+ /**
1918
+ * Error message shown (via the standard assistive-text error slot) when a dropped/picked
1919
+ * file would exceed `maxFiles`. Defaults to `"Maximum of {maxFiles} files allowed"`.
1920
+ */
1921
+ maxFilesMessage?: default_2.ReactNode;
1922
+ /** Leading icon shown inside the control. Defaults to the built-in upload icon. */
1923
+ icon?: default_2.ReactNode;
1924
+ /** Text shown when no file is selected. Defaults to `"Select a file..."`. */
1925
+ placeholder?: default_2.ReactNode;
1926
+ /** Screen-reader label for the control itself. Defaults to `"Choose file"`. */
1927
+ browseLabel?: string;
1928
+ /** Screen-reader label for a file chip's remove button. Defaults to `"Remove"`. */
1929
+ removeFileLabel?: string;
1930
+ /** Screen-reader label for the trailing clear-all icon. Defaults to `"Clear"`. */
1931
+ clearLabel?: string;
1932
+ /** Disables the control and its remove/clear icons. */
1933
+ disabled?: boolean;
1934
+ /**
1935
+ * Renders `files` as a static, non-interactive display with no clear/remove icons, and
1936
+ * disables picking or dropping new files.
1937
+ */
1938
+ readOnly?: boolean;
1939
+ }
1940
+
1941
+ declare interface RecursicaFileInputProps_2 extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children" | "onDrop" | "onChange">, Pick<InputWrapperProps, "label" | "error" | "required" | "withAsterisk" | "id">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth">, RecursicaFileInputProps {
1942
+ }
1943
+
1944
+ /**
1945
+ * A single file entry rendered as a removable chip in the FileUpload's file list.
1946
+ */
1947
+ declare interface RecursicaFileUploadItem {
1948
+ /** The underlying browser File object. */
1949
+ file: File;
1950
+ /**
1951
+ * Stable identifier for this entry, used as the React key and passed back to
1952
+ * `onFileRemove`. Defaults to the file's `name` when not provided.
1953
+ */
1954
+ id?: string;
1955
+ }
1956
+ export { RecursicaFileUploadItem as RecursicaFileInputItem }
1957
+ export { RecursicaFileUploadItem }
1958
+
1959
+ /**
1960
+ * Props for the Recursica FileUpload component.
1961
+ */
1962
+ export declare interface RecursicaFileUploadProps {
1963
+ /**
1964
+ * Files currently selected, rendered as removable chips below the dropzone.
1965
+ * This is a controlled list — `onFilesAdded`/`onFileRemove` report changes, but
1966
+ * `FileUpload` never mutates this array itself; merge the reported changes into
1967
+ * your own state and pass the updated list back in.
1968
+ */
1969
+ files?: RecursicaFileUploadItem[];
1970
+ /**
1971
+ * Called with the files the user just dropped onto the dropzone or picked via
1972
+ * the browse button. Only the newly added files are passed — merge them into
1973
+ * `files` yourself (e.g. to assign an `id`, dedupe, or reject some of them).
1974
+ */
1975
+ onFilesAdded?: (files: File[]) => void;
1976
+ /**
1977
+ * Called when a file chip's remove (X) icon is activated, identified by its
1978
+ * `id` (or `file.name` when no `id` was given for that entry).
1979
+ */
1980
+ onFileRemove?: (id: string) => void;
1981
+ /**
1982
+ * Native `accept` attribute for the underlying file input (e.g. `".pdf,.png"`
1983
+ * or `"image/*"`) — constrains the browse-button file picker natively. Also
1984
+ * enforced against files dropped onto the dropzone: the browser only applies
1985
+ * `accept` to its own file-picker dialog, never to a `drop` event, so files
1986
+ * that don't match are rejected the same way (see `onFilesRejected`) rather
1987
+ * than silently bypassing the restriction.
1988
+ */
1989
+ accept?: string;
1990
+ /** Whether more than one file can be selected/dropped at once. Defaults to `true`. */
1991
+ multiple?: boolean;
1992
+ /**
1993
+ * Maximum size per file, in bytes. Files exceeding this are passed to
1994
+ * `onFilesRejected` instead of `onFilesAdded`.
1995
+ */
1996
+ maxSize?: number;
1997
+ /**
1998
+ * Maximum total number of files allowed in `files`. Once reached, further
1999
+ * dropped/picked files are passed to `onFilesRejected` instead of
2000
+ * `onFilesAdded`.
2001
+ */
2002
+ maxFiles?: number;
2003
+ /**
2004
+ * Called with any files rejected for exceeding `maxSize`/`maxFiles` or not
2005
+ * matching `accept`.
2006
+ */
2007
+ onFilesRejected?: (files: File[]) => void;
2008
+ /**
2009
+ * Error message shown (via the standard assistive-text error slot) when a
2010
+ * dropped/picked file's extension or MIME type doesn't match `accept`.
2011
+ * Defaults to `"File type not accepted"`.
2012
+ */
2013
+ invalidFileTypeMessage?: default_2.ReactNode;
2014
+ /**
2015
+ * Error message shown (via the standard assistive-text error slot) when a
2016
+ * dropped/picked file would exceed `maxFiles`. Defaults to
2017
+ * `"Maximum of {maxFiles} files allowed"`.
2018
+ */
2019
+ maxFilesMessage?: default_2.ReactNode;
2020
+ /** Icon shown above the dropzone label. Defaults to the built-in upload icon. */
2021
+ icon?: default_2.ReactNode;
2022
+ /** Text shown inside the dropzone. Defaults to `"Drag and drop files here to upload"`. */
2023
+ dropzoneLabel?: default_2.ReactNode;
2024
+ /** Label for the button that opens the native file picker. Defaults to `"Browse files"`. */
2025
+ browseButtonLabel?: default_2.ReactNode;
2026
+ /** Screen-reader label for each file chip's remove button. Defaults to `"Remove"`. */
2027
+ removeFileLabel?: string;
2028
+ /** Disables the dropzone, browse button, and every file chip's remove icon. */
2029
+ disabled?: boolean;
2030
+ /**
2031
+ * Renders `files` as a static list of chips with no remove icon, and omits
2032
+ * the dropzone/browse button entirely.
2033
+ */
2034
+ readOnly?: boolean;
2035
+ }
2036
+
2037
+ declare interface RecursicaFileUploadProps_2 extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "children" | "onDrop" | "onChange">, Pick<InputWrapperProps, "label" | "error" | "required" | "withAsterisk" | "id">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth">, RecursicaFileUploadProps {
2038
+ }
2039
+
1813
2040
  /**
1814
2041
  * Props for the Recursica Flex layout component.
1815
2042
  */