-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Refactor: create base Checkbox #16445
base: master
Are you sure you want to change the base?
Changes from 3 commits
79d1961
f988128
e726b9d
6530e60
ba08681
89ec973
b0382f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -27,6 +27,28 @@ export type ButtonProps = { | |||||||||||||||||||
touchRippleRef?: any; // FIXME(v8:romgrk): find a way to remove | ||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
export type CheckboxProps = { | ||||||||||||||||||||
ref?: Ref<HTMLButtonElement>; | ||||||||||||||||||||
id?: string; | ||||||||||||||||||||
checked?: boolean; | ||||||||||||||||||||
className?: string; | ||||||||||||||||||||
disabled?: boolean; | ||||||||||||||||||||
indeterminate?: boolean; | ||||||||||||||||||||
inputRef?: React.Ref<HTMLInputElement>; | ||||||||||||||||||||
name?: string; | ||||||||||||||||||||
label?: React.ReactNode; | ||||||||||||||||||||
onClick?: React.MouseEventHandler; | ||||||||||||||||||||
onChange?: React.ChangeEventHandler; | ||||||||||||||||||||
onKeyDown?: React.KeyboardEventHandler; | ||||||||||||||||||||
size?: 'small' | 'medium'; | ||||||||||||||||||||
slotProps?: { | ||||||||||||||||||||
htmlInput?: React.InputHTMLAttributes<HTMLInputElement>; | ||||||||||||||||||||
}; | ||||||||||||||||||||
style?: React.CSSProperties; | ||||||||||||||||||||
tabIndex?: number; | ||||||||||||||||||||
touchRippleRef?: any; // FIXME(v8:romgrk): find a way to remove | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about moving this part to mui-x/packages/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx Lines 72 to 80 in 5ed0b65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that could work. I wonder if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, this makes sense 👍🏻 |
||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
export type IconButtonProps = Omit<ButtonProps, 'startIcon'> & { | ||||||||||||||||||||
label?: string; | ||||||||||||||||||||
color?: 'default' | 'inherit' | 'primary'; | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When translating padding/margin from
sx
tostyle
, the value needs to change also— the value was4px
, now it is0.5px
.Ideally, padding/margin styles should be calculated using the spacing value in the theme, perhaps we should wrap this in a
styled
to apply the padding?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is an issue with this approach https://app.argos-ci.com/mui/mui-x/builds/30524/135954282
It is applying the padding to the label rather than the checkbox. Not sure how we can target the checkbox here without using Material UI classes 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding
density?: 'standard' | 'compact'
prop toCheckboxProps
and applying padding inBaseCheckbox
for'compact'
density?