added input text view + moved things
This commit is contained in:
1 parent
9694ffb238
commit
54c1edba0c
17 files changed
+166
-121
No files matched your search
File renamed without changes.
@@ -1,4 +1,3 @@
|
|||||||
import { SelectHTMLAttributes } from "react";
|
|
||||||
import InputWrapper from "./InputWrapper";
|
import InputWrapper from "./InputWrapper";
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useToolTip } from "../tooltip/context";
|
|
||||||
import InputWrapper from "./InputWrapper";
|
import InputWrapper from "./InputWrapper";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@@ -11,7 +10,6 @@ export default function InputNumber({
|
|||||||
value=0,
|
value=0,
|
||||||
onChange,
|
onChange,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const tooltip = useToolTip();
|
|
||||||
return <InputWrapper label={label}>
|
return <InputWrapper label={label}>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useToolTip } from "../tooltip/context";
|
import { useToolTip } from "~/tooltip/context";
|
||||||
import InputWrapper from "./InputWrapper";
|
import InputWrapper from "./InputWrapper";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@@ -27,7 +27,7 @@ export default function InputText({
|
|||||||
e.target.getBoundingClientRect(),
|
e.target.getBoundingClientRect(),
|
||||||
{
|
{
|
||||||
searchObject: textBoxFor,
|
searchObject: textBoxFor,
|
||||||
textInput: value,
|
searchText: value,
|
||||||
filterObjects: additionalTooltipFilters,
|
filterObjects: additionalTooltipFilters,
|
||||||
},
|
},
|
||||||
onChange
|
onChange
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import { useRef, useState, useEffect } from "react";
|
||||||
|
import CheckMarkIcon from "~/icons/checkmark";
|
||||||
|
import PencilIcon from "~/icons/pencil";
|
||||||
|
import { useToolTip } from "~/tooltip/context";
|
||||||
|
import InputWrapper from "./InputWrapper";
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
textBoxFor?: string;
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
onChange: (v: string) => void;
|
||||||
|
additionalTooltipFilters?: Record<string, string>;
|
||||||
|
}
|
||||||
|
export default function InputViewEdit({
|
||||||
|
label,
|
||||||
|
textBoxFor,
|
||||||
|
value="",
|
||||||
|
onChange,
|
||||||
|
additionalTooltipFilters={},
|
||||||
|
}: Props) {
|
||||||
|
const tooltip = useToolTip();
|
||||||
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
const onChangeWrapped = (t: string) => {
|
||||||
|
onChange(t);
|
||||||
|
setIsEditing(false);
|
||||||
|
}
|
||||||
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||||
|
useEffect(() => {
|
||||||
|
if (isEditing && inputRef.current) {
|
||||||
|
inputRef.current.focus()
|
||||||
|
}
|
||||||
|
}, [inputRef.current, isEditing])
|
||||||
|
return <InputWrapper label={label}>
|
||||||
|
{isEditing ? <input
|
||||||
|
ref={inputRef}
|
||||||
|
value={value}
|
||||||
|
onChange={e => {
|
||||||
|
e.preventDefault();
|
||||||
|
onChangeWrapped(e.target.value)
|
||||||
|
}}
|
||||||
|
onFocus={e => textBoxFor && tooltip.setFocus(
|
||||||
|
e.target.getBoundingClientRect(),
|
||||||
|
{
|
||||||
|
searchObject: textBoxFor,
|
||||||
|
searchText: value,
|
||||||
|
filterObjects: additionalTooltipFilters,
|
||||||
|
},
|
||||||
|
onChangeWrapped
|
||||||
|
)}
|
||||||
|
/>:<div className="input-view">
|
||||||
|
{value}
|
||||||
|
</div>}
|
||||||
|
<PencilIcon onClick={() => setIsEditing(!isEditing)} className={`icon pencil ${isEditing ? 'opened' : ''}`}/>
|
||||||
|
<CheckMarkIcon onClick={() => setIsEditing(!isEditing)} className={`icon checkmark ${isEditing ? 'opened' : ''}`}/>
|
||||||
|
</InputWrapper>
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
Whitespace-only changes.
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import { AnchorHTMLAttributes } from "react";
|
||||||
|
|
||||||
|
|
||||||
|
export default function CheckMarkIcon(props: AnchorHTMLAttributes<HTMLAnchorElement>) {
|
||||||
|
return <a className="icon" {...props}>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { AnchorHTMLAttributes } from "react";
|
||||||
|
|
||||||
|
|
||||||
|
export default function PencilIcon(props: AnchorHTMLAttributes<HTMLAnchorElement>) {
|
||||||
|
return <a className="icon" {...props}>
|
||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 512 512">
|
||||||
|
<g>
|
||||||
|
<path d="M358.752,51.159L70.113,339.798l102.063,102.064L455.088,158.95L512,0.282L358.752,51.159z M172.176,419.287
|
||||||
|
l-79.488-79.489L349.536,82.949l0.069,11.622l22.52-0.089l0.089,22.667l22.625,0.048l-0.048,22.691l22.467-0.271l0.27,22.847
|
||||||
|
l11.538-0.068L172.176,419.287z M442.648,146.351l-9.345,0.055l-0.27-22.946l-22.244,0.269l0.048-22.464l-22.721-0.048
|
||||||
|
l-0.091-22.764l-22.551,0.089l-0.068-11.463l1.963-1.963l75.812-25.169l4.761,23.811l22.704,4.541L442.648,146.351z
|
||||||
|
M461.506,50.195l-3.062-15.313l27.457-9.116l-9.808,27.346L461.506,50.195z"/>
|
||||||
|
|
||||||
|
<rect x="37.686" y="394.032" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 -97.0284 763.8365)" width="143.992" height="15.962"/>
|
||||||
|
<path d="M10.388,399.522c-13.851,13.852-13.851,36.391,0,50.244l51.546,51.545c6.711,6.711,15.632,10.406,25.122,10.406
|
||||||
|
s18.412-3.696,25.122-10.406l37.073-37.073L47.462,362.45L10.388,399.522z M100.891,490.025
|
||||||
|
c-3.695,3.696-8.608,5.731-13.834,5.731s-10.139-2.036-13.834-5.731L21.676,438.48c-7.629-7.628-7.629-20.042,0-27.67
|
||||||
|
l25.785-25.785l79.215,79.216L100.891,490.025z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
height: 99%;
|
height: 99%;
|
||||||
width: 99%;
|
width: 99%;
|
||||||
border: 1px solid $secondary-accent;
|
border: 1px solid $secondary-accent;
|
||||||
|
font-size: 0.5em;
|
||||||
|
color: $primary-accent;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -9,6 +12,27 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
.input-wrapper {
|
||||||
|
max-height: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
input,
|
||||||
|
div {
|
||||||
|
// min-height: 100%;
|
||||||
|
// max-height: 100%;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.edge {
|
.edge {
|
||||||
stroke: $secondary-accent;
|
stroke: $secondary-accent;
|
||||||
}
|
}
|
||||||
@@ -25,7 +49,6 @@
|
|||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 0.5em;
|
|
||||||
|
|
||||||
&-inner {
|
&-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
.automation-editor {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.automation-node {
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
> &-inner {
|
|
||||||
min-width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&--root {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 100%;
|
|
||||||
// justify-content: center;
|
|
||||||
// align-items: center;
|
|
||||||
}
|
|
||||||
&--triggers {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
&--playground {
|
|
||||||
width: 100%;
|
|
||||||
> .automation-editor--elm-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
button.elm-list {
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
&--elm-list {
|
|
||||||
max-height: 20vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: auto;
|
|
||||||
padding: 5%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
.automation-node {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
|
|
||||||
&-inner {
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 25px;
|
|
||||||
background-color: $secondary;
|
|
||||||
max-width: 200px;
|
|
||||||
max-height: 75px;
|
|
||||||
min-width: 200px;
|
|
||||||
min-height: 75px;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
justify-content: space-around;
|
|
||||||
|
|
||||||
&-text {
|
|
||||||
flex: 2;
|
|
||||||
display: flex;
|
|
||||||
text-align: center;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
&-edge {
|
|
||||||
flex: 1;
|
|
||||||
border-radius: 30px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
|
|
||||||
justify-content: space-around;
|
|
||||||
align-items: center;
|
|
||||||
&.left {
|
|
||||||
border-left: 1px $secondary-accent solid;
|
|
||||||
border-top-right-radius: 0;
|
|
||||||
border-bottom-right-radius: 0;
|
|
||||||
}
|
|
||||||
&.right {
|
|
||||||
border-right: 1px $secondary-accent solid;
|
|
||||||
border-top-left-radius: 0;
|
|
||||||
border-bottom-left-radius: 0;
|
|
||||||
}
|
|
||||||
&:hover {
|
|
||||||
background-color: $primary-accent;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-children {
|
|
||||||
min-width: 250px;
|
|
||||||
padding: 20px;
|
|
||||||
|
|
||||||
&.closed {
|
|
||||||
height: 0;
|
|
||||||
width: 0;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
&.open {
|
|
||||||
border-radius: 25px;
|
|
||||||
border-color: $secondary-accent;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,49 @@
|
|||||||
.input-wrapper {
|
.input-wrapper {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
label {
|
label {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
.input-view {
|
||||||
|
@extend input;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
a.icon {
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
right: 0.5em;
|
||||||
|
top: 0.5em;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
> svg {
|
||||||
|
fill: $secondary-accent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.opened {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
height: 0.5em;
|
||||||
|
right: 0.25em;
|
||||||
|
&.checkmark {
|
||||||
|
opacity: 1;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
&.pencil {
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.pencil {
|
||||||
|
opacity: 1;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
&.checkmark {
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
@import "./AutomationNode.scss";
|
|
||||||
@import "./AutomationEditor.scss";
|
|
||||||
@import "./NewNodeModal.scss";
|
@import "./NewNodeModal.scss";
|
||||||
@import "./InputWrapper.scss";
|
@import "./InputWrapper.scss";
|
||||||
@import "./AutomationDAG.scss";
|
@import "./AutomationDAG.scss";
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
a.icon {
|
||||||
|
height: 1em;
|
||||||
|
width: 1em;
|
||||||
|
display: flex;
|
||||||
|
svg {
|
||||||
|
fill: $primary-accent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,3 +4,4 @@
|
|||||||
@import "./common.scss";
|
@import "./common.scss";
|
||||||
@import "./components/index.scss";
|
@import "./components/index.scss";
|
||||||
@import "./tooltip.scss";
|
@import "./tooltip.scss";
|
||||||
|
@import "./icons.scss";
|
||||||
Reference in new issue
Block a user