Skip to content

Feature: improve file size input and tables - #286

Merged
smarcet merged 2 commits into
mainfrom
feature/improve-file-size-input
Jul 8, 2026
Merged

Feature: improve file size input and tables#286
smarcet merged 2 commits into
mainfrom
feature/improve-file-size-input

Conversation

@santipalenque

@santipalenque santipalenque commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

https://app.clickup.com/t/9014802374/86bapy7m1

Summary by CodeRabbit

  • New Features
    • File size fields now support configurable input and display units, including automatic conversion and matching unit labels.
    • Tables can now accept custom styling options for more flexible appearance.
  • Tests
    • Added coverage for file size unit conversion and unit display behavior.
  • Chores
    • Updated the package version to 5.0.41-beta.0.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4afc9334-3aff-4155-ae76-d2dee9d2849f

📥 Commits

Reviewing files that changed from the base of the PR and between 72d7f58 and ec4861d.

📒 Files selected for processing (6)
  • package.json
  • src/components/mui/__tests__/mui-formik-file-size-field.test.js
  • src/components/mui/editable-table/mui-table-editable.js
  • src/components/mui/formik-inputs/mui-formik-file-size-field.js
  • src/components/mui/sortable-table/mui-table-sortable.js
  • src/components/mui/table/mui-table.js

📝 Walkthrough

Walkthrough

MuiFormikFilesizeField is generalized to support configurable displayUnit/valueUnit conversion instead of a fixed MB/bytes assumption, with corresponding tests. Three MUI table components (MuiTable, MuiTableEditable, MuiTableSortable) gain an optional tableSx prop forwarded to their Table's sx attribute. The package version is bumped.

Changes

File Size Field Unit Conversion

Layer / File(s) Summary
Generic unit conversion implementation
src/components/mui/formik-inputs/mui-formik-file-size-field.js
Adds UNIT_POWERS and conversionFactor logic, converts display/typed values between displayUnit and valueUnit, renders dynamic unit adornment, and extends propTypes/defaultProps.
Custom unit conversion tests
src/components/mui/__tests__/mui-formik-file-size-field.test.js
Adds a "custom units" test suite for KB-based display/submit conversion and adornment rendering.

Estimated code review effort: 2 (Simple) | ~12 minutes

Table Styling Customization (tableSx prop)

Layer / File(s) Summary
tableSx prop on MuiTable
src/components/mui/table/mui-table.js
Adds tableSx prop (default {}), merges it into Table sx with tableLayout fixed, and declares it in propTypes.
tableSx prop on editable and sortable tables
src/components/mui/editable-table/mui-table-editable.js, src/components/mui/sortable-table/mui-table-sortable.js
Adds tableSx prop (default {}) and forwards it to the rendered Table's sx attribute.
Package version bump
package.json
Bumps version from 5.0.38 to 5.0.41-beta.0.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: smarcet

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: file size input behavior and table support improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/improve-file-size-input

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurability for file-size Formik inputs (input/display units with conversion) and enables passing custom sx styling into several MUI table components, supporting more flexible UI composition across the component library.

Changes:

  • Add displayUnit/valueUnit support to MuiFormikFilesizeField, including unit label adornment and conversion logic.
  • Add tableSx prop to table components to allow custom MUI sx styling on the <Table />.
  • Extend Jest coverage for custom unit behavior and update package version to 5.0.41-beta.0.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/mui/table/mui-table.js Adds tableSx prop and merges it into the Table sx (keeping fixed layout by default).
src/components/mui/sortable-table/mui-table-sortable.js Adds tableSx prop and applies it to the Table sx.
src/components/mui/editable-table/mui-table-editable.js Adds tableSx prop and applies it to the Table sx.
src/components/mui/formik-inputs/mui-formik-file-size-field.js Implements configurable display/storage units with conversion and dynamic unit adornment.
src/components/mui/tests/mui-formik-file-size-field.test.js Adds tests for unit conversion and unit label behavior.
package.json Bumps package version to 5.0.41-beta.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +26
const UNIT_POWERS = { B: 0, KB: 1, MB: 2 };

const MuiFormikFilesizeField = ({ name, label, ...props }) => {
const unitToBytesFactor = (unit) => 1024 ** UNIT_POWERS[unit];

Comment on lines 59 to 61
setCleared(false);
const bytes = Number(mbValue) * BYTES_PER_MB;
helpers.setValue(bytes);
helpers.setValue(Number(displayValue) / conversionFactor);
};
@smarcet
smarcet merged commit bf75645 into main Jul 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants