fix(ui): fix readonly inputs (#3689)

There was a props on IAISlider to make the input component readonly - I
didn't know this existed and at some point used a component with that
prop as a template for other sliders, copying the flag over.

It's not actually used anywhere, so I removed the prop entirely,
enabling the number inputs everywhere.
This commit is contained in:
blessedcoolant 2023-07-08 20:24:01 +12:00 committed by GitHub
commit 018cd00b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1 additions and 10 deletions

View File

@ -56,7 +56,6 @@ export type IAIFullSliderProps = {
withInput?: boolean; withInput?: boolean;
isInteger?: boolean; isInteger?: boolean;
inputWidth?: string | number; inputWidth?: string | number;
inputReadOnly?: boolean;
withReset?: boolean; withReset?: boolean;
handleReset?: () => void; handleReset?: () => void;
tooltipSuffix?: string; tooltipSuffix?: string;
@ -90,7 +89,6 @@ const IAISlider = (props: IAIFullSliderProps) => {
withInput = false, withInput = false,
isInteger = false, isInteger = false,
inputWidth = 16, inputWidth = 16,
inputReadOnly = false,
withReset = false, withReset = false,
hideTooltip = false, hideTooltip = false,
isCompact = false, isCompact = false,
@ -152,6 +150,7 @@ const IAISlider = (props: IAIFullSliderProps) => {
); );
const handleInputChange = useCallback((v: number | string) => { const handleInputChange = useCallback((v: number | string) => {
console.log('input');
setLocalInputValue(v); setLocalInputValue(v);
}, []); }, []);
@ -311,7 +310,6 @@ const IAISlider = (props: IAIFullSliderProps) => {
{...sliderNumberInputProps} {...sliderNumberInputProps}
> >
<NumberInputField <NumberInputField
readOnly={inputReadOnly}
minWidth={inputWidth} minWidth={inputWidth}
{...sliderNumberInputFieldProps} {...sliderNumberInputFieldProps}
/> />

View File

@ -235,7 +235,6 @@ const IAICanvasToolChooserOptions = () => {
withInput withInput
onChange={(newSize) => dispatch(setBrushSize(newSize))} onChange={(newSize) => dispatch(setBrushSize(newSize))}
sliderNumberInputProps={{ max: 500 }} sliderNumberInputProps={{ max: 500 }}
inputReadOnly={false}
/> />
</Flex> </Flex>
<IAIColorPicker <IAIColorPicker

View File

@ -51,7 +51,6 @@ const ParamDynamicPromptsMaxPrompts = () => {
sliderNumberInputProps={{ max: inputMax }} sliderNumberInputProps={{ max: inputMax }}
withSliderMarks withSliderMarks
withInput withInput
inputReadOnly
withReset withReset
handleReset={handleReset} handleReset={handleReset}
/> />

View File

@ -59,7 +59,6 @@ const ParamBoundingBoxWidth = () => {
sliderNumberInputProps={{ max: 4096 }} sliderNumberInputProps={{ max: 4096 }}
withSliderMarks withSliderMarks
withInput withInput
inputReadOnly
withReset withReset
handleReset={handleResetHeight} handleReset={handleResetHeight}
/> />

View File

@ -59,7 +59,6 @@ const ParamBoundingBoxWidth = () => {
sliderNumberInputProps={{ max: 4096 }} sliderNumberInputProps={{ max: 4096 }}
withSliderMarks withSliderMarks
withInput withInput
inputReadOnly
withReset withReset
handleReset={handleResetWidth} handleReset={handleResetWidth}
/> />

View File

@ -58,7 +58,6 @@ const ParamScaledHeight = () => {
sliderNumberInputProps={{ max: 4096 }} sliderNumberInputProps={{ max: 4096 }}
withSliderMarks withSliderMarks
withInput withInput
inputReadOnly
withReset withReset
handleReset={handleResetScaledHeight} handleReset={handleResetScaledHeight}
/> />

View File

@ -56,7 +56,6 @@ const ParamScaledWidth = () => {
sliderNumberInputProps={{ max: 4096 }} sliderNumberInputProps={{ max: 4096 }}
withSliderMarks withSliderMarks
withInput withInput
inputReadOnly
withReset withReset
handleReset={handleResetScaledWidth} handleReset={handleResetScaledWidth}
/> />

View File

@ -48,7 +48,6 @@ export default function UnifiedCanvasBrushSize() {
withInput withInput
onChange={(newSize) => dispatch(setBrushSize(newSize))} onChange={(newSize) => dispatch(setBrushSize(newSize))}
sliderNumberInputProps={{ max: 500 }} sliderNumberInputProps={{ max: 500 }}
inputReadOnly={false}
isCompact isCompact
/> />
); );