From ee4b281b7bd835f6e5bc6f427eaa60f236ca96e4 Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Fri, 31 Jan 2025 15:16:44 +0100 Subject: [PATCH 01/12] Add padding on the right of the text input depending on the size of the buttons div --- .../js/interview/components/main/widget/TextInput.js | 9 ++++++++- rdmo/projects/assets/scss/interview.scss | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js b/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js index 44b4f3ef57..6e16be15b9 100644 --- a/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js +++ b/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useRef } from 'react' +import React, { useState, useEffect, useLayoutEffect, useRef } from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' import { useDebouncedCallback } from 'use-debounce' @@ -15,6 +15,13 @@ const TextInput = ({ question, value, disabled, updateValue, buttons }) => { useEffect(() => {setInputValue(value.text)}, [value.text]) useFocusEffect(ref, value.focus) + useLayoutEffect(() => { + if (ref.current) { + // add a right padding of the size of the buttons div, plus some space for the success indicator + const buttonsWidth = ref.current.previousElementSibling.offsetWidth + 20 + ref.current.style.paddingRight = `${buttonsWidth}px` + } + }, [buttons]) const handleChange = useDebouncedCallback((value, text) => { updateValue(value, { text, unit: question.unit, value_type: question.value_type }) diff --git a/rdmo/projects/assets/scss/interview.scss b/rdmo/projects/assets/scss/interview.scss index 8e601ea3ec..0b11c17eaa 100644 --- a/rdmo/projects/assets/scss/interview.scss +++ b/rdmo/projects/assets/scss/interview.scss @@ -227,6 +227,10 @@ text-overflow: ellipsis; } + input[type="text"] { + text-overflow:ellipsis; + } + .radio, .checkbox { margin: 0; From bb8c9c782d12d73f938286098c229dfef67e44ae Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Fri, 31 Jan 2025 16:05:43 +0100 Subject: [PATCH 02/12] Move buttons to the bottom for the TextareaInput component --- .../components/main/widget/CheckboxWidget.js | 2 +- .../interview/components/main/widget/DateInput.js | 2 +- .../interview/components/main/widget/FileInput.js | 2 +- .../interview/components/main/widget/RadioInput.js | 2 +- .../interview/components/main/widget/RangeInput.js | 1 + .../components/main/widget/SelectInput.js | 2 +- .../interview/components/main/widget/TextInput.js | 2 +- .../components/main/widget/TextareaInput.js | 4 ++-- .../interview/components/main/widget/YesNoInput.js | 2 +- rdmo/projects/assets/scss/interview.scss | 14 ++++++++++++-- 10 files changed, 22 insertions(+), 11 deletions(-) diff --git a/rdmo/projects/assets/js/interview/components/main/widget/CheckboxWidget.js b/rdmo/projects/assets/js/interview/components/main/widget/CheckboxWidget.js index 6c411c3abb..d7652c44b2 100644 --- a/rdmo/projects/assets/js/interview/components/main/widget/CheckboxWidget.js +++ b/rdmo/projects/assets/js/interview/components/main/widget/CheckboxWidget.js @@ -39,7 +39,7 @@ const CheckboxWidget = ({ page, question, sets, values, siblings, currentSet, di return (
-
+
{ diff --git a/rdmo/projects/assets/js/interview/components/main/widget/DateInput.js b/rdmo/projects/assets/js/interview/components/main/widget/DateInput.js index 20e5f89b69..da4d37b26c 100644 --- a/rdmo/projects/assets/js/interview/components/main/widget/DateInput.js +++ b/rdmo/projects/assets/js/interview/components/main/widget/DateInput.js @@ -52,7 +52,7 @@ const DateInput = ({ question, value, disabled, updateValue, buttons }) => { }) return ( -
+
{buttons} { }) return ( -
+
{buttons}
diff --git a/rdmo/projects/assets/js/interview/components/main/widget/RadioInput.js b/rdmo/projects/assets/js/interview/components/main/widget/RadioInput.js index d119a81452..1590ac4bb4 100644 --- a/rdmo/projects/assets/js/interview/components/main/widget/RadioInput.js +++ b/rdmo/projects/assets/js/interview/components/main/widget/RadioInput.js @@ -44,7 +44,7 @@ const RadioInput = ({ question, value, options, disabled, updateValue, buttons } }) return ( -
+
{buttons}
diff --git a/rdmo/projects/assets/js/interview/components/main/widget/RangeInput.js b/rdmo/projects/assets/js/interview/components/main/widget/RangeInput.js index 7f28d9f28b..dc86dc4e16 100644 --- a/rdmo/projects/assets/js/interview/components/main/widget/RangeInput.js +++ b/rdmo/projects/assets/js/interview/components/main/widget/RangeInput.js @@ -18,6 +18,7 @@ const RangeInput = ({ question, value, disabled, updateValue, buttons }) => { const classnames = classNames({ 'interview-input': true, + 'range-input': true, 'range': true, 'default': isDefaultValue(question, value) }) diff --git a/rdmo/projects/assets/js/interview/components/main/widget/SelectInput.js b/rdmo/projects/assets/js/interview/components/main/widget/SelectInput.js index b53f1f6baf..a037a5eeff 100644 --- a/rdmo/projects/assets/js/interview/components/main/widget/SelectInput.js +++ b/rdmo/projects/assets/js/interview/components/main/widget/SelectInput.js @@ -105,7 +105,7 @@ const SelectInput = ({ question, value, options, disabled, creatable, updateValu } return ( -
+
{ creatable ? ( isAsync ? ( diff --git a/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js b/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js index 6e16be15b9..3a122f35e7 100644 --- a/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js +++ b/rdmo/projects/assets/js/interview/components/main/widget/TextInput.js @@ -33,7 +33,7 @@ const TextInput = ({ question, value, disabled, updateValue, buttons }) => { }) return ( -
+
{buttons} { }) return ( -
+
- {buttons}