diff --git a/packages/core/src/components/DateField/DateField.jsx b/packages/core/src/components/DateField/DateField.jsx index 4b5fb375a1..d89e57b278 100644 --- a/packages/core/src/components/DateField/DateField.jsx +++ b/packages/core/src/components/DateField/DateField.jsx @@ -82,7 +82,7 @@ export class DateField extends React.PureComponent { inversed: this.props.inversed, onBlur: (this.props.onBlur || this.props.onComponentBlur) && this.handleBlur, onChange: this.props.onChange && this.handleChange, - type: 'number' + numeric: true }; const labelId = this.labelId(); @@ -109,8 +109,6 @@ export class DateField extends React.PureComponent { this.monthInput = el; if (this.props.monthFieldRef) this.props.monthFieldRef(el); }} - max="12" - min="1" defaultValue={this.props.monthDefaultValue} label={this.props.monthLabel} name={this.props.monthName} @@ -127,8 +125,6 @@ export class DateField extends React.PureComponent { this.dayInput = el; if (this.props.dayFieldRef) this.props.dayFieldRef(el); }} - max="31" - min="1" defaultValue={this.props.dayDefaultValue} label={this.props.dayLabel} name={this.props.dayName} @@ -147,8 +143,6 @@ export class DateField extends React.PureComponent { }} defaultValue={this.props.yearDefaultValue} label={this.props.yearLabel} - min={this.props.yearMin} - max={this.props.yearMax} name={this.props.yearName} value={this.props.yearValue} aria-describedby={labelId} @@ -167,7 +161,6 @@ DateField.defaultProps = { monthLabel: 'Month', monthName: 'month', yearLabel: 'Year', - yearMin: 1900, yearName: 'year', dateFormatter: defaultDateFormatter }; @@ -282,14 +275,6 @@ DateField.propTypes = { * Label for the year `input` field */ yearLabel: PropTypes.node, - /** - * Max value for the year `input` field - */ - yearMax: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - /** - * Minimum value for the year `input` field - */ - yearMin: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), /** * `name` for the year field */ diff --git a/packages/core/src/components/DateField/__snapshots__/DateField.test.jsx.snap b/packages/core/src/components/DateField/__snapshots__/DateField.test.jsx.snap index 83f8cf0c4d..142055cc9e 100644 --- a/packages/core/src/components/DateField/__snapshots__/DateField.test.jsx.snap +++ b/packages/core/src/components/DateField/__snapshots__/DateField.test.jsx.snap @@ -43,13 +43,13 @@ exports[`DateField has custom yearMax and yearMin 1`] = ` className="ds-c-field ds-c-field--month" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -78,13 +78,13 @@ exports[`DateField has custom yearMax and yearMin 1`] = ` className="ds-c-field ds-c-field--day" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -113,13 +113,13 @@ exports[`DateField has custom yearMax and yearMin 1`] = ` className="ds-c-field ds-c-field--year" defaultValue={undefined} id="textfield_snapshot" - max={2000} - min="1990" + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -177,13 +177,13 @@ exports[`DateField has errorMessage 1`] = ` className="ds-c-field ds-c-field--month" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -212,13 +212,13 @@ exports[`DateField has errorMessage 1`] = ` className="ds-c-field ds-c-field--day" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -247,13 +247,13 @@ exports[`DateField has errorMessage 1`] = ` className="ds-c-field ds-c-field--year" defaultValue={undefined} id="textfield_snapshot" - max={undefined} - min={1900} + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -304,13 +304,13 @@ exports[`DateField has invalid day 1`] = ` className="ds-c-field ds-c-field--month" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -339,13 +339,13 @@ exports[`DateField has invalid day 1`] = ` className="ds-c-field ds-c-field--day ds-c-field--error" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -374,13 +374,13 @@ exports[`DateField has invalid day 1`] = ` className="ds-c-field ds-c-field--year" defaultValue={undefined} id="textfield_snapshot" - max={undefined} - min={1900} + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -431,13 +431,13 @@ exports[`DateField has invalid month 1`] = ` className="ds-c-field ds-c-field--month ds-c-field--error" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -466,13 +466,13 @@ exports[`DateField has invalid month 1`] = ` className="ds-c-field ds-c-field--day" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -501,13 +501,13 @@ exports[`DateField has invalid month 1`] = ` className="ds-c-field ds-c-field--year" defaultValue={undefined} id="textfield_snapshot" - max={undefined} - min={1900} + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -558,13 +558,13 @@ exports[`DateField has invalid year 1`] = ` className="ds-c-field ds-c-field--month" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -593,13 +593,13 @@ exports[`DateField has invalid year 1`] = ` className="ds-c-field ds-c-field--day" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -628,13 +628,13 @@ exports[`DateField has invalid year 1`] = ` className="ds-c-field ds-c-field--year ds-c-field--error" defaultValue={undefined} id="textfield_snapshot" - max={undefined} - min={1900} + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -687,13 +687,13 @@ exports[`DateField has requirementLabel 1`] = ` className="ds-c-field ds-c-field--month" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -722,13 +722,13 @@ exports[`DateField has requirementLabel 1`] = ` className="ds-c-field ds-c-field--day" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -757,13 +757,13 @@ exports[`DateField has requirementLabel 1`] = ` className="ds-c-field ds-c-field--year" defaultValue={undefined} id="textfield_snapshot" - max={undefined} - min={1900} + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -814,13 +814,13 @@ exports[`DateField is inversed 1`] = ` className="ds-c-field ds-c-field--inverse ds-c-field--month" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -849,13 +849,13 @@ exports[`DateField is inversed 1`] = ` className="ds-c-field ds-c-field--inverse ds-c-field--day" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -884,13 +884,13 @@ exports[`DateField is inversed 1`] = ` className="ds-c-field ds-c-field--inverse ds-c-field--year" defaultValue={undefined} id="textfield_snapshot" - max={undefined} - min={1900} + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -941,13 +941,13 @@ exports[`DateField renders with all defaultProps 1`] = ` className="ds-c-field ds-c-field--month" defaultValue={undefined} id="textfield_snapshot" - max="12" - min="1" + inputMode="numeric" name="month" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -976,13 +976,13 @@ exports[`DateField renders with all defaultProps 1`] = ` className="ds-c-field ds-c-field--day" defaultValue={undefined} id="textfield_snapshot" - max="31" - min="1" + inputMode="numeric" name="day" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> @@ -1011,13 +1011,13 @@ exports[`DateField renders with all defaultProps 1`] = ` className="ds-c-field ds-c-field--year" defaultValue={undefined} id="textfield_snapshot" - max={undefined} - min={1900} + inputMode="numeric" name="year" onBlur={undefined} onChange={undefined} + pattern="[0-9]*" rows={undefined} - type="number" + type="text" value={undefined} /> diff --git a/packages/core/src/components/DateField/datefield.example.html b/packages/core/src/components/DateField/datefield.example.html index 46d64bc188..d13472b00a 100644 --- a/packages/core/src/components/DateField/datefield.example.html +++ b/packages/core/src/components/DateField/datefield.example.html @@ -10,9 +10,9 @@ > @@ -22,9 +22,9 @@ @@ -34,9 +34,9 @@ diff --git a/packages/core/src/components/FormLabel/_FormLabel.docs.scss b/packages/core/src/components/FormLabel/_FormLabel.docs.scss index 8ec195297a..a93d78fee9 100644 --- a/packages/core/src/components/FormLabel/_FormLabel.docs.scss +++ b/packages/core/src/components/FormLabel/_FormLabel.docs.scss @@ -25,7 +25,7 @@ Style guide: components.form-label.react #### Labels -- Each form field should have a