diff --git a/src/atoms/Forms/Duplicate/duplicate.scss b/src/atoms/Forms/Duplicate/duplicate.scss index 15b9ff2..e4f6fa2 100644 --- a/src/atoms/Forms/Duplicate/duplicate.scss +++ b/src/atoms/Forms/Duplicate/duplicate.scss @@ -11,7 +11,8 @@ } } - .add-button { + .add-button, .delete-button { width: auto; + background-color: white; } } diff --git a/src/atoms/Forms/Duplicate/duplicateNode.tsx b/src/atoms/Forms/Duplicate/duplicateNode.tsx index 492eed5..7bb16ee 100644 --- a/src/atoms/Forms/Duplicate/duplicateNode.tsx +++ b/src/atoms/Forms/Duplicate/duplicateNode.tsx @@ -58,7 +58,7 @@ export default (props: Props) => { {React.createElement(props.element as any, elementProperties)} {props.removeDisplayed && props.isRemovable && ( - )} diff --git a/src/atoms/Forms/form.scss b/src/atoms/Forms/form.scss index c385956..9ee8253 100644 --- a/src/atoms/Forms/form.scss +++ b/src/atoms/Forms/form.scss @@ -120,9 +120,7 @@ white-space: nowrap; } - .input-component { - width: 300px; - } + .table-cell { .input-component { diff --git a/src/atoms/Forms/index.tsx b/src/atoms/Forms/index.tsx index e26adbd..fd4d985 100644 --- a/src/atoms/Forms/index.tsx +++ b/src/atoms/Forms/index.tsx @@ -724,6 +724,8 @@ export default class GenericForm< throw new Error( 'GenericForm has no render method. You need to extend from GenericForm to create a form.', ); + + return
; } } diff --git a/src/atoms/Input/index.tsx b/src/atoms/Input/index.tsx index af2d0fe..e01f7e2 100644 --- a/src/atoms/Input/index.tsx +++ b/src/atoms/Input/index.tsx @@ -6,6 +6,8 @@ import { Event } from 'tools/types'; import './input.scss'; +const KEY_ENTER = 13; + export interface IInputProps { autoComplete?: string; // HTML5 Property autoCompleteList?: boolean; @@ -137,6 +139,10 @@ export default class Input extends Component { private onKeyDown = (e: React.KeyboardEvent) => { const key = e.keyCode || e.charCode; + if (key === KEY_ENTER) { + e.preventDefault(); + } + if (this.props.onKeyDown) { this.props.onKeyDown({ name: this.props.name, @@ -211,12 +217,11 @@ export default class Input extends Component { public componentDidUpdate(prevProps, prevState) { const { value } = this.props; - if ( - (value || value === 0) && - prevProps.value !== value && - (typeof value === 'number' || value.length > 0) - ) { - this.setState({ value, isEmpty: false }); + if (value !== undefined && value !== null && prevProps.value !== value) { + this.setState({ + isEmpty: this.props.type !== 'number' && (value as string).length < 1, + value, + }); } } @@ -319,4 +324,4 @@ export default class Input extends Component {
); } -} +} \ No newline at end of file diff --git a/src/atoms/Select/index.tsx b/src/atoms/Select/index.tsx index 253dfee..12d24b4 100644 --- a/src/atoms/Select/index.tsx +++ b/src/atoms/Select/index.tsx @@ -7,6 +7,7 @@ import { Event } from 'tools/types'; import './select.scss'; interface ISelectProps { + className?: string; disabled?: boolean; isMandatory?: boolean; label?: string; @@ -88,7 +89,7 @@ export default class Select extends React.Component< public render() { return ( -
+
{this.props.label && ( )} diff --git a/src/atoms/Select/select.scss b/src/atoms/Select/select.scss index 8012228..da61a9a 100644 --- a/src/atoms/Select/select.scss +++ b/src/atoms/Select/select.scss @@ -1,67 +1,75 @@ .select { - position: relative; - user-select: none; + position: relative; + user-select: none; - &-clickable-view { - cursor: pointer; - padding: 7px 12px; - padding-right: 40px; - border: 1px solid var(--input-border-color); - border-radius: 2px; - box-sizing: border-box; - position: relative; + svg { + .internal-path { + fill: white; + } + } - &.with-dropdown { - border-radius: 2px 2px 0 0; - } + &-clickable-view { + cursor: pointer; + padding: 7px 12px; + padding-right: 40px; + border: 2px solid #f0f0f0; + border-top: 0px; + border-left: 0px; + border-right: 0px; + box-sizing: border-box; + position: relative; - &:focus { - outline-color: var(--main-color); - } + &.with-dropdown { + border-radius: 2px 2px 0 0; + } - .svg-icon { - position: absolute; - right: 8px; - margin: 0; - width: 16px; - height: 16px; - top: 6px; - } - } + &:focus { + outline-color: var(--main-color); + } - @keyframes selectDropdownAppear { - 0% { - opacity: 0; - } + .svg-icon { + position: absolute; + right: 8px; + margin: 0; + width: 16px; + height: 16px; + top: 6px; + } + } - 100% { - opacity: 1; - } - } + @keyframes selectDropdownAppear { + 0% { + opacity: 0; + } - .select-dropdown { - position: absolute; - width: 100%; - border-radius: 0 0 2px 2px; - z-index: 10; - max-height: 0; - animation: selectDropdownAppear 0.25s ease-in-out forwards; + 100% { + opacity: 1; + } + } - .option { - padding: 8px; - width: 100%; - box-sizing: border-box; - background-color: var(--select-option-background-color); - cursor: pointer; - transition: var(--t-fastest-ease-in-out); + .select-dropdown { + position: absolute; + width: 100%; + border-radius: 0 0 2px 2px; + z-index: 10; + max-height: 0; + animation: selectDropdownAppear 0.25s ease-in-out forwards; - &:hover { - background-color: var(--select-option-hover-background-color); - } + .option { + padding: 8px; + width: 100%; + box-sizing: border-box; + background-color: #2f2429; + cursor: pointer; + transition: all 1s ease; - &:last-child { - border-radius: 0 0 2px 2px; - } - } - } + &:hover { + background-color: #2f2429; + } + + &:last-child { + border-radius: 0 0 2px 2px; + } + } + } } diff --git a/src/atoms/TextArea/index.tsx b/src/atoms/TextArea/index.tsx index bb654b6..0367cbb 100644 --- a/src/atoms/TextArea/index.tsx +++ b/src/atoms/TextArea/index.tsx @@ -1,6 +1,6 @@ 'use strict'; -import React, { CSSProperties, Component } from 'react'; +import React, { CSSProperties, Component, useRef } from 'react'; import { Event } from 'tools/types'; @@ -8,6 +8,8 @@ import './textarea.scss'; export interface ITextAreaProps { className?: string; + label?: string; + focus?: boolean; name: string; placeholder?: string; readOnly?: boolean; @@ -15,13 +17,31 @@ export interface ITextAreaProps { style?: CSSProperties; value?: string; - textAreaRef?(e: HTMLTextAreaElement): void; onChange?(e: Event): void; onSelect?(e: Event<{ start: number; end: number }>): void; } export default (props: ITextAreaProps) => { - const { className, value, onChange, onSelect, textAreaRef, ...attributes } = props; + const {className, label, value, onChange, onSelect, ...attributes } = props; + let nameDiv; + + const textAreaRef = useRef(null); + + const onLabelClick = () => { + const textArea: any = textAreaRef.current; + + if (textArea) { + textArea.focus(); + } + }; + + if (label) { + nameDiv = ( + + ); + } const internalOnChange = (e: React.SyntheticEvent) => { if (props.onChange) { @@ -42,13 +62,17 @@ export default (props: ITextAreaProps) => { }; return ( -