diff --git a/app/client/package.json b/app/client/package.json index 900d4d048e..7e3e04750f 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -36,6 +36,7 @@ "eslint": "^6.4.0", "flow-bin": "^0.91.0", "fontfaceobserver": "^2.1.0", + "fuse.js": "^3.4.5", "history": "^4.10.1", "husky": "^3.0.5", "jsonpath-plus": "^1.0.0", diff --git a/app/client/src/components/designSystems/appsmith/CreatableDropdown.tsx b/app/client/src/components/designSystems/appsmith/CreatableDropdown.tsx index 67326fc7b8..96eb551e3a 100644 --- a/app/client/src/components/designSystems/appsmith/CreatableDropdown.tsx +++ b/app/client/src/components/designSystems/appsmith/CreatableDropdown.tsx @@ -33,18 +33,29 @@ const selectStyles = { ...provided, backgroundColor: "rgba(104,113,239,0.1)", border: "1px solid rgba(104, 113, 239, 0.5)", - borderRadius: `${theme.radii[3]}px`, + borderRadius: `${theme.radii[1]}px`, padding: "2px 5px", fontSize: "14px", maxWidth: "95%", + position: "relative", + display: "inline-block", + transform: "none", }), container: (styles: any) => ({ ...styles, flex: 1, }), - control: (styles: any) => ({ + control: (styles: any, state: any) => ({ ...styles, + width: 370, minHeight: "32px", + border: state.isFocused + ? `${theme.colors.secondary} solid 1px` + : `${theme.colors.inputInactiveBorders} solid 1px`, + boxShadow: state.isFocused ? 0 : 0, + "&:hover": { + border: `${theme.colors.secondary} solid 1px`, + }, }), indicatorsContainer: (provided: any) => ({ ...provided, diff --git a/app/client/src/components/designSystems/appsmith/Dropdown.tsx b/app/client/src/components/designSystems/appsmith/Dropdown.tsx index e20276eefe..6e9fd92bec 100644 --- a/app/client/src/components/designSystems/appsmith/Dropdown.tsx +++ b/app/client/src/components/designSystems/appsmith/Dropdown.tsx @@ -1,6 +1,7 @@ import React from "react"; import Select from "react-select"; import { WrappedFieldInputProps } from "redux-form"; +import { theme } from "../../../constants/DefaultTheme"; type DropdownProps = { options: Array<{ @@ -12,10 +13,17 @@ type DropdownProps = { }; const selectStyles = { - control: (styles: any) => ({ + control: (styles: any, state: any) => ({ ...styles, width: 100, minHeight: "32px", + border: state.isFocused + ? `${theme.colors.secondary} solid 1px` + : `${theme.colors.inputInactiveBorders} solid 1px`, + boxShadow: state.isFocused ? 0 : 0, + "&:hover": { + border: `${theme.colors.secondary} solid 1px`, + }, }), indicatorsContainer: (provided: any) => ({ ...provided, diff --git a/app/client/src/components/designSystems/appsmith/TextInputComponent.tsx b/app/client/src/components/designSystems/appsmith/TextInputComponent.tsx index 2749bb9acb..b390b08eb9 100644 --- a/app/client/src/components/designSystems/appsmith/TextInputComponent.tsx +++ b/app/client/src/components/designSystems/appsmith/TextInputComponent.tsx @@ -4,9 +4,9 @@ import { WrappedFieldInputProps, WrappedFieldMetaProps } from "redux-form"; import { IconName, InputGroup, MaybeElement } from "@blueprintjs/core"; import { ComponentProps } from "./BaseComponent"; -const TextInput = styled(InputGroup)` +export const TextInput = styled(InputGroup)` flex: 1; - &&& input { + & input { border: 1px solid ${props => props.theme.colors.inputInactiveBorders}; border-radius: 4px; box-shadow: none; @@ -18,7 +18,7 @@ const TextInput = styled(InputGroup)` outline: 0; } } - &&&&.bp3-input-group .bp3-input:not(:first-child) { + &.bp3-input-group .bp3-input:not(:first-child) { padding-left: 35px; } .bp3-icon { @@ -59,12 +59,13 @@ export interface TextInputProps { meta?: WrappedFieldMetaProps; icon?: IconName | MaybeElement; showError?: boolean; + className?: string; } export const BaseTextInput = (props: TextInputProps) => { - const { placeholderMessage, input, meta, icon, showError } = props; + const { placeholderMessage, input, meta, icon, showError, className } = props; return ( - + {showError && {meta && meta.touched && meta.error}} diff --git a/app/client/src/components/designSystems/blueprint/ButtonComponent.tsx b/app/client/src/components/designSystems/blueprint/ButtonComponent.tsx index e641f3d2b3..ae759fff54 100644 --- a/app/client/src/components/designSystems/blueprint/ButtonComponent.tsx +++ b/app/client/src/components/designSystems/blueprint/ButtonComponent.tsx @@ -36,7 +36,8 @@ const ButtonWrapper = styled(AnchorButton)` ? props.theme.colors[props.styleName] : props.theme.colors.secondary}; border-radius: 4px; - font-weight: ${props => props.theme.fontWeights[1]}; + font-weight: ${props => props.theme.fontWeights[2]}; + font-family: "DM Sans"; outline: none; &&:hover, &&:focus { diff --git a/app/client/src/components/editorComponents/fields/DatasourcesField.tsx b/app/client/src/components/editorComponents/fields/DatasourcesField.tsx index 4f1cfed675..ca9fe70777 100644 --- a/app/client/src/components/editorComponents/fields/DatasourcesField.tsx +++ b/app/client/src/components/editorComponents/fields/DatasourcesField.tsx @@ -40,6 +40,7 @@ const DatasourcesField = ( onCreateOption={props.createDatasource} format={(value: string) => _.find(options, { value })} parse={(option: { value: string }) => (option ? option.value : null)} + formatCreateLabel={(value: string) => `Create data source "${value}"`} /> ); }; diff --git a/app/client/src/pages/Editor/ApiSidebar.tsx b/app/client/src/pages/Editor/ApiSidebar.tsx index dd6450cf5b..0cfca6a751 100644 --- a/app/client/src/pages/Editor/ApiSidebar.tsx +++ b/app/client/src/pages/Editor/ApiSidebar.tsx @@ -12,6 +12,7 @@ import { ApiPaneReduxState } from "../../reducers/uiReducers/apiPaneReducer"; import { BaseTextInput } from "../../components/designSystems/appsmith/TextInputComponent"; import { TICK } from "@blueprintjs/icons/lib/esm/generated/iconNames"; import { createActionRequest } from "../../actions/actionActions"; +import Fuse from "fuse.js"; const LoadingContainer = styled.div` height: 50%; @@ -27,6 +28,22 @@ const ApiSidebarWrapper = styled.div` width: 100%; flex-direction: column; `; + +const SearchBar = styled(BaseTextInput)` + margin-bottom: 10px; + input { + background-color: #23292e; + border: none; + color: ${props => props.theme.colors.textOnDarkBG} + :focus { + background-color: #23292e; + } + } + .bp3-icon { + background-color: #23292e; + } +`; + const ApiItemsWrapper = styled.div` flex: 1; margin-bottom: 15px; @@ -49,7 +66,7 @@ const ApiItem = styled.div<{ isSelected: boolean }>` } `; -const HTTPMethod = styled.span<{ method: string | undefined }>` +const HTTPMethod = styled.span<{ method?: string }>` flex: 1; font-size: 12px; color: ${props => { @@ -121,6 +138,15 @@ type Props = ReduxStateProps & type State = { isCreating: boolean; name: string; + search: string; +}; + +const fuseOptions = { + shouldSort: true, + threshold: 0.1, + location: 0, + minMatchCharLength: 3, + keys: ["name"], }; class ApiSidebar extends React.Component { @@ -129,6 +155,7 @@ class ApiSidebar extends React.Component { this.state = { isCreating: false, name: "", + search: "", }; } @@ -167,10 +194,24 @@ class ApiSidebar extends React.Component { }); }; + handleSearchChange = (e: React.ChangeEvent<{ value: string }>) => { + const value = e.target.value; + this.setState({ + search: value, + }); + }; + render() { - const { actions, apiPane, history, match } = this.props; - const { isCreating } = this.state; + const { + apiPane, + history, + match, + actions: { data }, + } = this.props; + const { isCreating, search, name } = this.state; const activeActionId = match.params.id; + const fuse = new Fuse(data, fuseOptions); + const actions = search ? fuse.search(search) : data; return ( {apiPane.isFetching ? ( @@ -180,15 +221,27 @@ class ApiSidebar extends React.Component { ) : ( - {actions.data.map(action => ( + + {actions.map(action => ( history.push(API_EDITOR_ID_URL(action.id))} isSelected={activeActionId === action.id} > - - {action.actionConfiguration.httpMethod} - + {action.actionConfiguration ? ( + + {action.actionConfiguration.httpMethod} + + ) : ( + + )} {action.name} ))} @@ -198,7 +251,7 @@ class ApiSidebar extends React.Component { @@ -208,6 +261,7 @@ class ApiSidebar extends React.Component { text="" onClick={this.saveAction} filled + loading={apiPane.isSaving} /> ) : ( diff --git a/app/client/yarn.lock b/app/client/yarn.lock index 5020eb9502..64eb8f8cbc 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -5429,6 +5429,11 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +fuse.js@^3.4.5: + version "3.4.5" + resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-3.4.5.tgz#8954fb43f9729bd5dbcb8c08f251db552595a7a6" + integrity sha512-s9PGTaQIkT69HaeoTVjwGsLfb8V8ScJLx5XGFcKHg0MqLUH/UZ4EKOtqtXX9k7AFqCGxD1aJmYb8Q5VYDibVRQ== + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"