Files
suwayomi-material-you-webui/src/base/Base.types.ts

76 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-10-05 19:33:09 +02:00
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
2026-03-11 00:11:29 +01:00
import type { MessageDescriptor } from '@lingui/core';
import type { ReactNode } from 'react';
2024-10-03 04:03:04 +02:00
2024-10-05 19:33:09 +02:00
export enum GridLayout {
Compact = 0,
Comfortable = 1,
List = 2,
}
2024-10-03 04:03:04 +02:00
export enum DirectionOffset {
PREVIOUS = -1,
NEXT = 1,
}
interface DisplayDataTranslation {
2024-10-28 18:03:29 +01:00
isTitleString?: never;
title: MessageDescriptor;
2024-10-28 18:03:29 +01:00
icon: ReactNode;
}
interface DisplayDataString {
isTitleString: true;
title: string;
icon: ReactNode;
}
type DisplayData = DisplayDataTranslation | DisplayDataString;
2024-10-28 18:03:29 +01:00
export type ValueToDisplayData<Value extends string | number> = Record<Value, DisplayData>;
2024-11-04 18:00:35 +01:00
export interface MultiValueButtonBaseProps<Value extends string | number> {
tooltip?: string;
2024-11-04 18:00:35 +01:00
value: Value;
defaultValue?: Value;
2024-11-04 18:00:35 +01:00
values: Value[];
setValue: (value: Value) => void;
valueToDisplayData: ValueToDisplayData<Value>;
}
2026-03-08 23:25:02 +01:00
export interface MultiValueButtonDefaultableProps<Value extends string | number> extends OptionalProperty<
MultiValueButtonBaseProps<Value>,
'value'
> {
2024-11-04 18:00:35 +01:00
isDefaultable?: boolean;
onDefault?: () => void;
}
export type MultiValueButtonProps<Value extends string | number> =
| (MultiValueButtonBaseProps<Value> & PropertiesNever<MultiValueButtonDefaultableProps<Value>>)
| MultiValueButtonDefaultableProps<Value>;
2024-11-03 03:09:00 +01:00
export enum ScrollOffset {
BACKWARD,
FORWARD,
}
export enum ScrollDirection {
X,
Y,
XY,
2024-11-03 03:09:00 +01:00
}
2025-07-23 01:52:41 +02:00
export enum SearchParam {
TAB = 'tab',
QUERY = 'query',
2025-07-27 00:03:51 +02:00
REDIRECT = 'redirect',
2025-07-23 01:52:41 +02:00
}