Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@beforeyoubid/ui-lib",
"version": "2.3.4",
"version": "2.3.5",
"engines": {
"node": ">=18.0.0"
},
Expand Down
7 changes: 7 additions & 0 deletions src/components/DatePicker/DateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { forwardRef, useMemo } from 'react';
import { type TextFieldProps } from '@mui/material';
import { type DateFieldProps as MuiDateFieldProps } from '@mui/x-date-pickers';
import moment, { type Moment } from 'moment';
import { CalendarEvent } from 'tabler-icons-react';

import { automation } from '../../utils';
import { Adornment } from '../Adornment';
Expand Down Expand Up @@ -38,6 +39,8 @@ export type DateFieldProps = {
startAdornment?: string | React.ReactNode;
/** whether to add a border around the start adornment */
showStartAdornmentBorder?: boolean;
/** whether to show default calendar icon on the right */
showCalendarIcon?: boolean;
/** A react component that will show beneath the text field, good for checkboxes */
componentBelowTextField?: React.ReactNode;
} & Pick<MuiDateFieldProps<moment.Moment>, 'inputRef' | 'disabled'>;
Expand All @@ -57,6 +60,7 @@ const DateFieldNoRef: React.ForwardRefRenderFunction<HTMLInputElement, DateField
errorText,
startAdornment,
showStartAdornmentBorder = true,
showCalendarIcon = false,
automationKey,
leadingIcon,
componentBelowTextField,
Expand Down Expand Up @@ -99,6 +103,9 @@ const DateFieldNoRef: React.ForwardRefRenderFunction<HTMLInputElement, DateField
showBorder={showStartAdornmentBorder}
/>
),
endAdornment: showCalendarIcon ? (
<Adornment position="end" icon={CalendarEvent} showBorder={false} />
) : null,
},
},
}}
Expand Down
5 changes: 4 additions & 1 deletion src/components/DatePicker/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const StyledDateField = styled(DateField<Moment>)(({ theme }) => ({
position: 'relative',
width: '100%',
' .MuiInputBase-input': {
padding: theme.spacing(1.5, 1.75, 1.5, 1.25),
padding: theme.spacing(1.5, 0.5, 1.5, 1.25),
},
'&.MuiFormControl-root *': {
border: 'none',
Expand All @@ -96,6 +96,9 @@ export const StyledDateField = styled(DateField<Moment>)(({ theme }) => ({
fontSize: theme.typography.size.base.fontSize,
color: theme.palette.colors.dark90,
},
'&.MuiFormControl-root .MuiInputBase-root .MuiInputAdornment-root': {
marginRight: theme.spacing(1.5),
},
}));

export const StyledPaper = styled(Paper)(({ theme }) => ({
Expand Down