PromucFlow_constructor/app/client/src/components/ads/DatePickerComponent.tsx
albinAppsmith 71886c3b9e
feat: Property pane dropdown overflow issues (#8236)
* * hide subtext for date picker fix
* EE clicking on entity, unfolding/folding added

* * bug fixes in action dropdown

* bug fix for cursor

* fix: 8190 background api request and welcome helper button (#8281)

* chore: Move action/js debugger tabs related logic to a common component (#8199)

* removed background of api request textbox and added hover text on "no thanks" button

Co-authored-by: akash-codemonk <67054171+akash-codemonk@users.noreply.github.com>

* fix: added scrolling in invited users more popup (#8226)

* added scrolling in invited users more popup

* always scrollbar displaying on invited users pan

* fixed issue related with 8190

* updated cursor of invited users more

* replace edit data source icon with remix icon (#8192)

* * active text color

* fix: dropdownlist props issue (#8322)

* Commented failing JS tests (#8276)

Co-authored-by: Yatin Chaubal <yatin.chaubal@gmail.com>

* docs: Update ServerSetup.md (#8255)

* Make port customizable from env variable (#8288)

* fix: issue with string templates (#7848)

* Remove bracket highlight on error

* fix string template issue

* using string template to join strings

* fix breaking tests

* fixed props pass issue

Co-authored-by: yatinappsmith <84702014+yatinappsmith@users.noreply.github.com>
Co-authored-by: Yatin Chaubal <yatin.chaubal@gmail.com>
Co-authored-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: Vinod <4994565+vnodecg@users.noreply.github.com>

* * bug fixes

* * bug fix

* * test cases fix

* - test case fix

* * test fixes

* * bug fix in test case

Co-authored-by: haojin111 <63215848+haojin111@users.noreply.github.com>
Co-authored-by: akash-codemonk <67054171+akash-codemonk@users.noreply.github.com>
Co-authored-by: yatinappsmith <84702014+yatinappsmith@users.noreply.github.com>
Co-authored-by: Yatin Chaubal <yatin.chaubal@gmail.com>
Co-authored-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: Vinod <4994565+vnodecg@users.noreply.github.com>
Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2021-10-11 11:31:05 +05:30

129 lines
3.4 KiB
TypeScript

import React from "react";
import { DateInput, TimePrecision } from "@blueprintjs/datetime";
import styled from "constants/DefaultTheme";
import { Classes } from "./common";
import { Colors } from "constants/Colors";
const StyledDateInput = styled(DateInput)`
& {
input {
color: ${(props) => props.theme.colors.propertyPane.radioGroupText};
background-color: ${(props) =>
props.theme.colors.propertyPane.buttonText};
border: 1px solid ${Colors.ALTO2};
border-radius: 0;
padding: 0px 8px;
height: 32px;
box-shadow: none;
&:focus {
box-shadow: none;
}
}
}
.${Classes.DATE_PICKER_OVARLAY} {
background-color: ${(props) =>
props.theme.colors.propertyPane.radioGroupBg};
color: ${(props) => props.theme.colors.propertyPane.buttonBg};
box-shadow: 0px 12px 28px -8px rgba(0, 0, 0, 0.75);
margin-top: -3px;
.DayPicker-Day,
.bp3-datepicker-day-wrapper,
.DayPicker-Day.DayPicker-Day--selected,
.DayPicker-Day--today.bp3-datepicker-day-wrapper {
border-radius: 0;
border: none;
&&&&&&.bp3-datepicker-day-wrapper {
border: none;
}
}
.DayPicker-Day--today {
background-color: ${(props) =>
props.theme.colors.propertyPane.zoomButtonBG};
.bp3-datepicker-day-wrapper.bp3-datepicker-day-wrapper {
border: none;
}
}
.DayPicker-Day.DayPicker-Day--selected,
.DayPicker-Day.DayPicker-Day--selected:hover {
background-color: ${(props) =>
props.theme.colors.propertyPane.activeButtonText};
font-weight: 500;
letter-spacing: 0.4px;
}
.bp3-timepicker-input-row {
height: 35px;
width: 110px;
box-shadow: none;
border-radius: 0;
border: none;
background-color: ${(props) =>
props.theme.colors.propertyPane.zoomButtonBG};
margin-bottom: 5px;
.bp3-timepicker-input {
color: inherit;
box-shadow: none;
width: 50px;
height: 100%;
}
}
.DayPicker-Day.DayPicker-Day--outside {
color: ${(props) => props.theme.colors.propertyPane.jsIconBg};
}
}
`;
export const TimePrecisions = {
MILLISECOND: TimePrecision.MILLISECOND,
SECOND: TimePrecision.SECOND,
MINUTE: TimePrecision.MINUTE,
};
interface DatePickerComponentProps {
maxDate: Date;
minDate: Date;
placeholder: string;
showActionsBar?: boolean;
timePrecision?: TimePrecision;
closeOnSelection?: boolean;
highlightCurrentDay?: boolean;
value: Date | null;
onChange?: (selectedDate: Date, isUserChange: boolean) => void;
formatDate?: (date: Date) => string;
parseDate?: (dateStr: string) => Date | null;
}
function DatePickerComponent(props: DatePickerComponentProps) {
return (
<StyledDateInput
className={Classes.DATE_PICKER_OVARLAY}
closeOnSelection={props.closeOnSelection}
formatDate={props.formatDate}
highlightCurrentDay={props.highlightCurrentDay}
maxDate={props.maxDate}
minDate={props.minDate}
onChange={props.onChange}
parseDate={props.parseDate}
placeholder={props.placeholder}
popoverProps={{ usePortal: true }}
showActionsBar={props.showActionsBar}
timePrecision={props.timePrecision}
value={props.value}
/>
);
}
DatePickerComponent.defaultProps = {
highlightCurrentDay: true,
};
export default DatePickerComponent;