Move "ValueRotationButton" props to component
This commit is contained in:
@@ -27,27 +27,6 @@ interface DisplayData {
|
|||||||
|
|
||||||
export type ValueToDisplayData<Value extends string | number> = Record<Value, DisplayData>;
|
export type ValueToDisplayData<Value extends string | number> = Record<Value, DisplayData>;
|
||||||
|
|
||||||
export interface ValueRotationButtonBaseProps<Value extends string | number> {
|
|
||||||
tooltip?: string;
|
|
||||||
value: Value;
|
|
||||||
defaultValue?: Value;
|
|
||||||
values: Value[];
|
|
||||||
setValue: (value: Value) => void;
|
|
||||||
valueToDisplayData: ValueToDisplayData<Value>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ValueRotationButtonDefaultableProps<Value extends string | number> extends OptionalProperty<
|
|
||||||
ValueRotationButtonBaseProps<Value>,
|
|
||||||
'value'
|
|
||||||
> {
|
|
||||||
isDefaultable?: boolean;
|
|
||||||
onDefault?: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ValueRotationButtonProps<Value extends string | number> =
|
|
||||||
| (ValueRotationButtonBaseProps<Value> & PropertiesNever<ValueRotationButtonDefaultableProps<Value>>)
|
|
||||||
| ValueRotationButtonDefaultableProps<Value>;
|
|
||||||
|
|
||||||
export enum ScrollOffset {
|
export enum ScrollOffset {
|
||||||
BACKWARD,
|
BACKWARD,
|
||||||
FORWARD,
|
FORWARD,
|
||||||
|
|||||||
@@ -11,9 +11,30 @@ import { useMemo } from 'react';
|
|||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
|
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
|
||||||
import type { ValueRotationButtonProps } from '@/base/Base.types.ts';
|
|
||||||
import { getNextRotationValue } from '@/base/utils/ValueRotationButton.utils.ts';
|
import { getNextRotationValue } from '@/base/utils/ValueRotationButton.utils.ts';
|
||||||
import { Superscript } from '@/base/components/texts/Superscript.tsx';
|
import { Superscript } from '@/base/components/texts/Superscript.tsx';
|
||||||
|
import type { ValueToDisplayData } from '@/base/Base.types.ts';
|
||||||
|
|
||||||
|
export interface ValueRotationButtonBaseProps<Value extends string | number> {
|
||||||
|
tooltip?: string;
|
||||||
|
value: Value;
|
||||||
|
defaultValue?: Value;
|
||||||
|
values: Value[];
|
||||||
|
setValue: (value: Value) => void;
|
||||||
|
valueToDisplayData: ValueToDisplayData<Value>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ValueRotationButtonDefaultableProps<Value extends string | number> extends OptionalProperty<
|
||||||
|
ValueRotationButtonBaseProps<Value>,
|
||||||
|
'value'
|
||||||
|
> {
|
||||||
|
isDefaultable?: boolean;
|
||||||
|
onDefault?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ValueRotationButtonProps<Value extends string | number> =
|
||||||
|
| (ValueRotationButtonBaseProps<Value> & PropertiesNever<ValueRotationButtonDefaultableProps<Value>>)
|
||||||
|
| ValueRotationButtonDefaultableProps<Value>;
|
||||||
|
|
||||||
export const ValueRotationButton = <Value extends string | number>({
|
export const ValueRotationButton = <Value extends string | number>({
|
||||||
tooltip,
|
tooltip,
|
||||||
|
|||||||
Reference in New Issue
Block a user