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

chore(DatePickerInput): updated size prop #10912

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@ import DatePickerSkeleton from '../DatePicker.Skeleton';
import DatePickerInput from '../../DatePickerInput';
import { Layer } from '../../Layer';

// const patterns = {
// 'Short (d{1,2}/d{4})': '\\d{1,2}/\\d{4}',
// 'Regular (d{1,2}/d{1,2}/d{4})': '\\d{1,2}/\\d{1,2}/\\d{4}',
// };

// const sizes = {
// 'Small (sm)': 'sm',
// 'Medium (md) - default': undefined,
// 'Large (lg)': 'lg',
// };

// const types = {
// Simple: 'simple',
// Single: 'single',
// Range: 'range',
// };

const props = {
datePicker: () => ({
dateFormat: 'm/d/Y',
Expand Down Expand Up @@ -60,73 +43,92 @@ const props = {
export default {
title: 'Components/DatePicker',
component: DatePicker,
argTypes: {
size: {
options: ['sm', 'md', 'lg'],
control: { type: 'select' },
table: {
category: 'DatePickerInput',
},
},
},
args: {
size: 'md',
},
subcomponents: {
DatePickerInput,
DatePickerSkeleton,
},
};

export const Simple = () => (
<DatePicker datePickerType="simple">
export const Simple = (args) => (
<DatePicker datePickerType="simple" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-simple"
{...args}
/>
</DatePicker>
);

export const SingleWithCalendar = () => (
<DatePicker datePickerType="single">
export const SingleWithCalendar = (args) => (
<DatePicker datePickerType="single" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-single"
{...args}
/>
</DatePicker>
);

export const RangeWithCalendar = () => {
export const RangeWithCalendar = (args) => {
return (
<DatePicker datePickerType="range">
<DatePicker datePickerType="range" {...args}>
<DatePickerInput
id="date-picker-input-id-start"
placeholder="mm/dd/yyyy"
labelText="Start date"
{...args}
/>
<DatePickerInput
id="date-picker-input-id-finish"
placeholder="mm/dd/yyyy"
labelText="End date"
{...args}
/>
</DatePicker>
);
};

export const SimpleWithLayer = () => {
export const SimpleWithLayer = (args) => {
return (
<>
<DatePicker datePickerType="simple">
<DatePicker datePickerType="simple" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-simple"
{...args}
/>
</DatePicker>
<Layer>
<DatePicker datePickerType="simple">
<Layer {...args}>
<DatePicker datePickerType="simple" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-simple"
{...args}
/>
</DatePicker>
<Layer>
<DatePicker datePickerType="simple">
<Layer {...args}>
<DatePicker datePickerType="simple" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-simple"
{...args}
/>
</DatePicker>
</Layer>
Expand All @@ -135,30 +137,33 @@ export const SimpleWithLayer = () => {
);
};

export const SingleWithCalendarWithLayer = () => {
export const SingleWithCalendarWithLayer = (args) => {
return (
<>
<DatePicker datePickerType="single">
<DatePicker datePickerType="single" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-single"
{...args}
/>
</DatePicker>
<Layer>
<DatePicker datePickerType="single">
<Layer {...args}>
<DatePicker datePickerType="single" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-single"
{...args}
/>
</DatePicker>
<Layer>
<DatePicker datePickerType="single">
<Layer {...args}>
<DatePicker datePickerType="single" {...args}>
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-single"
{...args}
/>
</DatePicker>
</Layer>
Expand All @@ -167,45 +172,51 @@ export const SingleWithCalendarWithLayer = () => {
);
};

export const RangeWithCalendarWithLayer = () => {
export const RangeWithCalendarWithLayer = (args) => {
return (
<>
<DatePicker datePickerType="range">
<DatePicker datePickerType="range" {...args}>
<DatePickerInput
id="date-picker-input-id-start"
placeholder="mm/dd/yyyy"
labelText="Start date"
{...args}
/>
<DatePickerInput
id="date-picker-input-id-finish"
placeholder="mm/dd/yyyy"
labelText="End date"
{...args}
/>
</DatePicker>
<Layer>
<DatePicker datePickerType="range">
<Layer {...args}>
<DatePicker datePickerType="range" {...args}>
<DatePickerInput
id="date-picker-input-id-start"
placeholder="mm/dd/yyyy"
labelText="Start date"
{...args}
/>
<DatePickerInput
id="date-picker-input-id-finish"
placeholder="mm/dd/yyyy"
labelText="End date"
{...args}
/>
</DatePicker>
<Layer>
<DatePicker datePickerType="range">
<Layer {...args}>
<DatePicker datePickerType="range" {...args}>
<DatePickerInput
id="date-picker-input-id-start"
placeholder="mm/dd/yyyy"
labelText="Start date"
{...args}
/>
<DatePickerInput
id="date-picker-input-id-finish"
placeholder="mm/dd/yyyy"
labelText="End date"
{...args}
/>
</DatePicker>
</Layer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const DatePickerInput = React.forwardRef(function DatePickerInput(props, ref) {
onChange = () => {},
pattern = '\\d{1,2}\\/\\d{1,2}\\/\\d{4}',
placeholder,
size,
size = 'md',
type = 'text',
warn,
warnText,
Expand Down Expand Up @@ -214,10 +214,9 @@ DatePickerInput.propTypes = {
placeholder: PropTypes.string,

/**
* Specify the size of the Date Picker Input. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
* TODO V11: remove `xl` (replaced with lg)
* Specify the size of the Date Picker Input. Currently supports either `sm`, `md`, or `lg` as an option.
*/
size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
size: PropTypes.oneOf(['sm', 'md', 'lg']),

/**
* Specify the type of the `<input>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@
}

// Size variant styles
// TODO V11: Remove xl selector
.#{$prefix}--date-picker__input--xl,
.#{$prefix}--date-picker__input--lg {
height: rem(48px);
}
Expand Down