Skip to content
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

[pickers] Migrate PickersDay to emotion #25995

Merged
merged 18 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/pages/api-docs/date-range-picker-day.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"props": {
"classes": { "type": { "name": "object" }, "required": true },
"day": { "type": { "name": "any" }, "required": true },
"isEndOfHighlighting": { "type": { "name": "bool" }, "required": true },
"isEndOfPreviewing": { "type": { "name": "bool" }, "required": true },
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/api-docs/pickers-day.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"allowKeyboardControl": { "type": { "name": "bool" } },
"allowSameDateSelection": { "type": { "name": "bool" } },
"children": { "type": { "name": "node" } },
"classes": { "type": { "name": "object" } },
"disabled": { "type": { "name": "bool" } },
"disableHighlightToday": { "type": { "name": "bool" } },
"disableMargin": { "type": { "name": "bool" } },
Expand All @@ -31,6 +32,6 @@
"filename": "/packages/material-ui-lab/src/PickersDay/PickersDay.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/date-picker/\">Date Picker</a></li></ul>",
"styledComponent": false,
"styledComponent": true,
"cssComponent": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"componentDescription": "",
"propDescriptions": {
"children": "The content of the component.",
"classes": "Override or extend the styles applied to the component. See <a href=\"#css\">CSS API</a> below for more details.",
"day": "The date to show.",
"isEndOfHighlighting": "Set to <code>true</code> if the <code>day</code> is the end of a highlighted date range.",
"isEndOfPreviewing": "Set to <code>true</code> if the <code>day</code> is the start of a highlighted date range.",
Expand Down
35 changes: 34 additions & 1 deletion docs/translations/api-docs/pickers-day/pickers-day.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"allowKeyboardControl": "If <code>true</code>, keyboard control and focus management is enabled.",
"allowSameDateSelection": "If <code>true</code>, <code>onChange</code> is fired on click even if the same date is selected.",
"children": "The content of the component.",
"classes": "Override or extend the styles applied to the component. See <a href=\"#css\">CSS API</a> below for more details.",
"day": "The date to show.",
"disabled": "If <code>true</code>, renders as disabled.",
"disableHighlightToday": "If <code>true</code>, todays date is rendering without highlighting with circle.",
Expand All @@ -13,5 +14,37 @@
"showDaysOutsideCurrentMonth": "If <code>true</code>, days that have <code>outsideCurrentMonth={true}</code> are displayed.",
"today": "If <code>true</code>, renders as today date."
},
"classDescriptions": {}
"classDescriptions": {
"root": { "description": "Styles applied to the root element." },
"dayWithMargin": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>disableMargin=false</code>"
},
"dayOutsideMonth": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>outsideCurrentMonth=true</code> and <code>showDaysOutsideCurrentMonth=true</code>"
},
"hiddenDaySpacingFiller": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>outsideCurrentMonth=true</code> and <code>showDaysOutsideCurrentMonth=false</code>"
},
"today": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>disableHighlightToday=false</code> and <code>today=true</code>"
},
"selected": {
"description": "Pseudo-class applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>selected=true</code>"
},
"disabled": {
"description": "Pseudo-class applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>disabled=true</code>"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ DateRangePickerDay.propTypes /* remove-proptypes */ = {
*/
children: PropTypes.node,
/**
* @ignore
* Override or extend the styles applied to the component.
*/
classes: PropTypes.object.isRequired,
/**
Expand Down
22 changes: 6 additions & 16 deletions packages/material-ui-lab/src/PickersDay/PickersDay.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { getClasses, describeConformance, fireEvent, screen } from 'test/utils';
import PickersDay from '@material-ui/lab/PickersDay';
import { describeConformanceV5, fireEvent, screen } from 'test/utils';
import PickersDay, { pickersDayClasses as classes } from '@material-ui/lab/PickersDay';
import {
adapterToUse,
createPickerMount,
Expand All @@ -12,20 +12,8 @@ import {
describe('<PickersDay />', () => {
const mount = createPickerMount();
const render = createPickerRender();
let classes: Record<string, string>;

before(() => {
classes = getClasses(
<PickersDay
day={adapterToUse.date()}
outsideCurrentMonth={false}
selected
onDaySelect={() => {}}
/>,
);
});

describeConformance(
describeConformanceV5(
<PickersDay
day={adapterToUse.date()}
outsideCurrentMonth={false}
Expand All @@ -37,9 +25,11 @@ describe('<PickersDay />', () => {
inheritComponent: 'button',
render,
mount,
muiName: 'MuiPickersDay',
refInstanceof: window.HTMLButtonElement,
testVariantProps: { variant: 'disableMargin' },
// cannot test reactTestRenderer because of required context
skip: ['componentProp', 'reactTestRenderer'],
skip: ['componentProp', 'componentsProp', 'reactTestRenderer'],
}),
);

Expand Down
Loading