PromucFlow_constructor/app/client/src/components/propertyControls/StyledControls.tsx

366 lines
8.4 KiB
TypeScript
Raw Normal View History

import { Classes, Popover, MenuItem, Menu } from "@blueprintjs/core";
2019-11-25 05:07:27 +00:00
import { ContainerOrientation } from "constants/WidgetConstants";
import { DateRangeInput } from "@blueprintjs/datetime";
2020-02-18 10:41:52 +00:00
import { Colors } from "constants/Colors";
import styled, { Skin } from "constants/DefaultTheme";
import { AnyStyledComponent } from "styled-components";
import { ControlIcons } from "icons/ControlIcons";
import { FormIcons } from "icons/FormIcons";
import Button from "components/ads/Button";
import TextInput from "components/ads/TextInput";
import Dropdown from "components/ads/Dropdown";
import MultiSelectDropdown from "components/ads/MultiselectDropdown";
2019-11-05 05:09:50 +00:00
type ControlWrapperProps = {
orientation?: ContainerOrientation;
isAction?: boolean;
2019-11-05 05:09:50 +00:00
};
export const ControlWrapper = styled.div<ControlWrapperProps>`
2020-12-24 04:32:25 +00:00
display: ${(props) =>
props.orientation === "HORIZONTAL" ? "flex" : "block"};
2019-11-07 10:33:04 +00:00
justify-content: space-between;
align-items: center;
2020-12-24 04:32:25 +00:00
flex-direction: ${(props) =>
2020-06-10 13:41:26 +00:00
props.orientation === "VERTICAL" ? "column" : "row"};
2020-12-24 04:32:25 +00:00
padding: ${(props) => (props.isAction ? "0" : "4px 0 ")};
& > label {
color: ${(props) => props.theme.colors.propertyPane.label};
2020-12-24 04:32:25 +00:00
margin-bottom: ${(props) => props.theme.spaces[1]}px;
font-size: ${(props) => props.theme.fontSizes[3]}px;
}
&&& > label:first-of-type {
display: block;
}
&&& > label {
display: inline-block;
2020-06-10 13:41:26 +00:00
}
`;
export const ControlPropertyLabelContainer = styled.div`
display: flex;
align-items: center;
2020-03-20 09:45:44 +00:00
label {
color: ${(props) => props.theme.colors.propertyPane.label};
2020-12-24 04:32:25 +00:00
margin-bottom: ${(props) => props.theme.spaces[1]}px;
font-size: ${(props) => props.theme.fontSizes[3]}px;
}
2020-03-20 09:45:44 +00:00
.underline {
2020-12-24 04:32:25 +00:00
color: ${(props) => props.theme.colors.paneTextUnderline};
2020-03-20 09:45:44 +00:00
}
`;
export const JSToggleButton = styled.span<{ active: boolean }>`
margin: 4px;
margin-top: 0px;
cursor: pointer;
height: auto;
width: 28px;
height: 16px;
border: 0.5px solid ${Colors.BLACK};
background-color: ${(props) =>
props.active ? Colors.GREY_10 : Colors.GREY_2};
&:hover {
background-color: ${(props) =>
props.active ? Colors.GREY_9 : Colors.GREY_3};
&&& svg {
path {
fill: ${(props) => (props.active ? Colors.GREY_2 : Colors.GREY_9)};
}
}
}
& > div {
display: flex;
align-items: center;
justify-content: center;
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 06:01:05 +00:00
cursor: pointer;
}
&&& svg {
width: 28px;
height: 16px;
transform: scale(1.4);
rect {
fill: transparent;
}
path {
2020-12-24 04:32:25 +00:00
fill: ${(props) =>
props.active ? props.theme.colors.GREY_2 : Colors.GREY_9};
}
}
`;
2020-02-18 10:41:52 +00:00
export const StyledDropDownContainer = styled.div`
width: 100%;
height: 100%;
`;
export const StyledDropDown = styled(Dropdown)`
background-color: ${(props) => props.theme.colors.propertyPane.buttonText};
box-shadow: none;
height: 36px;
border: 1px solid ${Colors.GREY_5};
`;
export const StyledMultiSelectDropDown = styled(MultiSelectDropdown)`
height: auto;
background-color: ${(props) => props.theme.colors.propertyPane.buttonText};
2020-02-18 10:41:52 +00:00
`;
2020-05-22 05:15:41 +00:00
export const StyledMenu = styled(Menu)`
&& {
background: ${(props) => props.theme.dropdown[Skin.LIGHT].background};
border-radius: unset;
2020-05-22 05:15:41 +00:00
}
.bp3-submenu .bp3-menu {
background: ${(props) => props.theme.dropdown[Skin.LIGHT].background};
2020-05-22 05:15:41 +00:00
}
`;
2020-02-20 15:03:14 +00:00
export const StyledPopover = styled(Popover)`
2020-04-22 09:15:24 +00:00
.${Classes.POPOVER_TARGET} {
display: flex;
}
2020-02-20 15:03:14 +00:00
div {
flex: 1 1 auto;
}
span {
width: 100%;
position: relative;
}
.${Classes.BUTTON} {
display: flex;
width: 100%;
align-items: center;
justify-content: space-between;
}
.${Classes.BUTTON_TEXT} {
text-overflow: ellipsis;
text-align: left;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
&& {
.${Classes.ICON} {
width: fit-content;
color: ${Colors.SLATE_GRAY};
}
}
`;
export const StyledMenuItem = styled(MenuItem)`
&&&&&& {
border-radius: 0;
background: ${(props) => props.theme.dropdown[Skin.LIGHT].background};
color: ${(props) => props.theme.dropdown[Skin.LIGHT].inActiveText};
2020-05-22 05:15:41 +00:00
padding: 4px 8px;
margin: 4px 0px;
2020-02-20 15:03:14 +00:00
&:hover {
background: ${(props) => props.theme.dropdown[Skin.LIGHT].hoverBG};
2020-04-22 09:15:24 +00:00
&&&.bp3-menu-item.bp3-intent-danger:hover {
color: ${(props) => props.theme.colors.error};
2020-04-22 09:15:24 +00:00
}
2020-02-20 15:03:14 +00:00
}
&.${Classes.ACTIVE} {
background: ${(props) => props.theme.dropdown[Skin.LIGHT].hoverBG};
2020-02-20 15:03:14 +00:00
position: relative;
&.single-select {
&:before {
left: 0;
top: -2px;
position: absolute;
content: "";
background: ${(props) => props.theme.dropdown[Skin.LIGHT].hoverBG};
border-radius: 0;
2020-02-20 15:03:14 +00:00
width: 4px;
height: 100%;
}
}
}
2020-05-22 05:15:41 +00:00
&&&& .${Classes.MENU} {
background: ${(props) => props.theme.dropdown[Skin.LIGHT].inActiveBG};
2020-05-22 05:15:41 +00:00
}
2020-02-20 15:03:14 +00:00
}
`;
2019-12-06 13:16:08 +00:00
export const StyledDynamicInput = styled.div`
2020-04-15 11:42:11 +00:00
width: 100%;
2019-12-06 13:16:08 +00:00
&&& {
input {
border: none;
2020-12-24 04:32:25 +00:00
color: ${(props) => props.theme.colors.textOnDarkBG};
background: ${(props) => props.theme.colors.paneInputBG};
2019-12-06 13:16:08 +00:00
&:focus {
border: none;
2020-12-24 04:32:25 +00:00
color: ${(props) => props.theme.colors.textOnDarkBG};
background: ${(props) => props.theme.colors.paneInputBG};
2019-12-06 13:16:08 +00:00
}
}
}
`;
export const StyledInputGroup = styled(TextInput)`
width: 100%;
border-radius: 0;
background-color: ${(props) => props.theme.colors.propertyPane.radioGroupBg};
color: ${(props) => props.theme.colors.propertyPane.radioGroupText};
&:focus {
box-shadow: none;
2020-03-20 11:03:50 +00:00
}
2019-11-07 10:33:04 +00:00
`;
export const StyledDateRangePicker = styled(DateRangeInput)`
> input {
2020-12-24 04:32:25 +00:00
color: ${(props) => props.theme.colors.textOnDarkBG};
background: ${(props) => props.theme.colors.paneInputBG};
border: 1px solid green;
}
`;
2020-05-22 05:15:41 +00:00
export const FieldWrapper = styled.div`
position: relative;
width: 100%;
`;
export const StyledEditIcon = styled(
ControlIcons.SETTINGS_CONTROL as AnyStyledComponent,
)`
padding: 0;
position: absolute;
margin-left: 0;
cursor: pointer;
right: 40px;
display: flex;
align-items: center;
&& svg {
width: 16px;
height: 16px;
position: relative;
path {
fill: ${(props) => props.theme.colors.propertyPane.iconColor};
}
}
`;
export const StyledDragIcon = styled(
ControlIcons.DRAG_CONTROL as AnyStyledComponent,
)`
padding: 0;
position: absolute;
margin-right: 15px;
cursor: move;
z-index: 1;
left: 4px;
&& svg {
width: 16px;
height: 16px;
position: relative;
top: 2px;
path {
fill: ${(props) => props.theme.colors.propertyPane.iconColor};
}
}
`;
export const StyledDeleteIcon = styled(
FormIcons.DELETE_ICON as AnyStyledComponent,
)`
padding: 0;
position: absolute;
margin-left: 15px;
cursor: pointer;
right: ${(props) => props.marginRight ?? 12}px;
display: flex;
align-items: center;
&& svg {
width: 16px;
height: 16px;
position: relative;
path {
fill: ${(props) => props.theme.colors.propertyPane.iconColor};
}
}
`;
export const FlexWrapper = styled.div`
display: flex;
`;
export const StyledVisibleIcon = styled(
ControlIcons.SHOW_COLUMN as AnyStyledComponent,
)`
padding: 0;
position: absolute;
margin-left: 15px;
cursor: pointer;
display: flex;
align-items: center;
right: ${(props) => props.marginRight ?? 12}px;
&& svg {
width: 16px;
height: 16px;
position: relative;
path {
fill: ${(props) => props.theme.colors.propertyPane.iconColor};
}
}
`;
export const StyledHiddenIcon = styled(
ControlIcons.HIDE_COLUMN as AnyStyledComponent,
)`
padding: 0;
position: absolute;
margin-left: 15px;
cursor: pointer;
right: ${(props) => props.marginRight ?? 12}px;
display: flex;
align-items: center;
&& svg {
width: 16px;
height: 16px;
position: relative;
path {
fill: ${(props) => props.theme.colors.propertyPane.iconColor};
}
}
`;
export const StyledPropertyPaneButton = styled(Button)`
margin-top: 4px;
margin-left: auto;
display: flex;
justify-content: flex-end;
border: 1px solid ${Colors.GREY_8};
&,
&:active {
border: 1px solid ${Colors.GREY_8};
color: ${Colors.GREY_8};
background-color: transparent;
}
&:hover {
border: 1px solid ${Colors.GREY_8};
color: ${Colors.GREY_8};
background-color: ${Colors};
}
&&& svg {
width: 14px;
height: 14px;
path {
fill: ${Colors.GREY_8};
stroke: ${Colors.GREY_8};
}
}
`;