-
Notifications
You must be signed in to change notification settings - Fork 832
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
Consolidate classes naming #1950
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/mui-org/material-ui-pickers/agvwk1473 |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
import { createMuiTheme, ThemeProvider } from '@material-ui/core'; | ||
import { DatePicker, DatePickerProps } from '@material-ui/pickers'; | ||
|
||
const materialTheme = createMuiTheme({ | ||
overrides: { | ||
MuiPickersToolbar: { | ||
toolbar: { | ||
MuiPickerToolbar: { |
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.
Could a version without an s
feels inconsistent with the name of the package? @material-ui/pickers
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.
I don't understand, it was original intent of the naming, isn't it? (#1778) but we decided to move out?
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.
I don't understand either. What do you think of the last comment on #1778? If you agree with it, the intended name is
MuiPickerToolbar: { | |
MuiPickersToolbar: { |
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.
I still think that correct prefix is with a s
to match the package name MuiPickersToolbar
.
lib/src/typings/overrides.ts
Outdated
@@ -2,24 +2,21 @@ import { useStyles as DayStyles } from '../views/Calendar/Day'; | |||
import { useStyles as ClockStyles } from '../views/Clock/Clock'; | |||
import { useStyles as MuiBasePickerStyles } from '../Picker/Picker'; | |||
import { useStyles as CalendarStyles } from '../views/Calendar/Calendar'; | |||
import { useStyles as MuiPickersYearStyles } from '../views/Calendar/Year'; | |||
import { useStyles as MuiPickerYearStyles } from '../views/Calendar/Year'; |
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.
I think that we will need to rename the components to so they can be imported and grep as they were in a single namespace.
import { useStyles as MuiPickerYearStyles } from '../views/Calendar/Year'; | |
import { useStyles as MuiPickersYearStyles } from '../views/Calendar/PickerYear'; |
@oliviertassinari I am not sure that we need to name all the files with |
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.
Nice! Happy to see that coming :D
import { createMuiTheme, ThemeProvider } from '@material-ui/core'; | ||
import { DatePicker, DatePickerProps } from '@material-ui/pickers'; | ||
|
||
const materialTheme = createMuiTheme({ | ||
overrides: { | ||
MuiPickersToolbar: { | ||
toolbar: { | ||
MuiPickerToolbar: { |
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.
I still think that correct prefix is with a s
to match the package name MuiPickersToolbar
.
@@ -1,11 +1,11 @@ | |||
import React from 'react'; | |||
import { IUtils } from '@date-io/core/IUtils'; | |||
import { Day, DayProps } from '@material-ui/pickers'; | |||
import { PickersDay, PickersDayProps } from '@material-ui/pickers'; |
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.
Perfect!
lib/src/views/Calendar/Month.tsx
Outdated
@@ -27,15 +27,15 @@ export const useStyles = makeStyles( | |||
color: theme.palette.primary.main, | |||
fontWeight: theme.typography.fontWeightMedium, | |||
}, | |||
'&:disabled': { | |||
pointerEvents: 'none', | |||
color: theme.palette.text.hint, |
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.
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.
Thanks, bad merge :)
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.
Seems to be still present
lib/src/views/Clock/ClockPointer.tsx
Outdated
@@ -102,5 +102,5 @@ export const styles = (theme: Theme) => | |||
}); | |||
|
|||
export default withStyles(styles, { | |||
name: 'MuiPickersClockPointer', | |||
name: 'MuiPickerClockPointer', |
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.
name: 'MuiPickerClockPointer', | |
name: 'MuiPickersClockPointer', |
{ | ||
padding: '16px 24px', | ||
}, | ||
{ name: 'MuiPickersMobileKeyboardInputView' } |
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.
Maybe? Not sure
{ name: 'MuiPickersMobileKeyboardInputView' } | |
{ name: 'MuiMobileKeyboardInputView' } |
Do you mean on the file system? |
Yes I mean the file system |
So, assuming we bring nested imports, we would have? import { PickersDay, PickersDayProps } from '@material-ui/pickers';
import PickersDay, { PickersDayProps } from '@material-ui/pickers/Day'; No strong point of view, points that support your proposal:
👍 from my end |
My point of view: We must drop support of public nested imports and default exports at all, we could discuss it separately :) |
I'm pinning this subject, a potentially good one to discuss the next team meeting. |
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
// this guy required only on the docs site to work with dynamic date library | ||
import { makeJSDateObject } from '../../../utils/helpers'; | ||
import { DatePicker, PickersDay } from '@material-ui/pickers'; |
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.
Ohh, look like eslint-plugin-pretty-imports
comes with a new cost I didn't see coming (first one is that it requires running eslint --fix): it creates harder review and git diff: it's moving code around.
'&$disabled': { | ||
color: lightBlue['100'], | ||
}, | ||
'&$selected': { |
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.
Regarding the change of pseudo classes, I think that we could have handled in a different pull request, keeping our focus on a single topic at the time :)
@@ -4,7 +4,7 @@ import { getByMuiTest } from './test-utils'; | |||
import { screen, waitFor } from '@testing-library/react'; | |||
import { utilsToUse, FakeTransitionComponent } from './test-utils'; | |||
import { createClientRender, fireEvent } from './createClientRender'; | |||
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '@material-ui/pickers'; | |||
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '../index'; |
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.
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '../index'; | |
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '@material-ui/pickers'; |
import { screen, waitFor } from '@testing-library/react'; | ||
import { utilsToUse, getAllByMuiTest } from './test-utils'; | ||
import { TextField, TextFieldProps } from '@material-ui/core'; | ||
import { DesktopDateRangePicker, StaticDateRangePicker } from '../'; |
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.
import { DesktopDateRangePicker, StaticDateRangePicker } from '../'; | |
import { DesktopDateRangePicker, StaticDateRangePicker } from '@material-ui/picker'; |
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.
No it doesn’t work locally for some reason. Need investigation
lib/src/views/Calendar/Month.tsx
Outdated
@@ -27,15 +27,15 @@ export const useStyles = makeStyles( | |||
color: theme.palette.primary.main, | |||
fontWeight: theme.typography.fontWeightMedium, | |||
}, | |||
'&:disabled': { | |||
pointerEvents: 'none', | |||
color: theme.palette.text.hint, |
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.
Seems to be still present
* Change component name from MuiPickers to MuiPicker * Name root classnames "root" * Use pseudo-classes for disabled styling * Remove useless yearDisabled class * Update demo and typescript tests for overrides * Repalce MuiPicker with MuiPickers * Consolidate right component display name with mui component name * Update index.ts reexports to match component display names * Remove useless parameter * Fix docs example * Fix override example tsc * Use pseudo-classes for selected and disabled, closes mui#1845 * Address PR feedback * Update lib/src/Picker/Picker.tsx Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com> * Update lib/src/views/Clock/Clock.tsx Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com> * Make more convenient css classes names * Remove today border from selected day * Remove useless comment * Update tests * Fix global overrid of Mui-selected and Mui-disabled classes * Use theme.palette.secondary instead of hint * Fix linter * Fix incorrect package prefix Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
edit @oliviertassinari
Related to #1778 and #1631.