chore(package): add missing typings

This commit is contained in:
Luke
2023-02-15 13:51:46 +01:00
parent 829bec2592
commit 66585521b4
4 changed files with 39 additions and 9 deletions

View File

@@ -1,14 +1,17 @@
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types'; import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
interface ContextMenuItem { interface ContextMenuItem {
title?: string;
menu?: string; menu?: string;
title?: string;
description?: string;
arrow?: boolean;
image?: string;
icon?: IconName | [IconPrefix, IconName]; icon?: IconName | [IconPrefix, IconName];
iconColor?: string; iconColor?: string;
progress?: number;
colorScheme?: string;
onSelect?: (args: any) => void; onSelect?: (args: any) => void;
arrow?: boolean; metadata?: string[] | { [key: string]: any } | { label: string; value: any; progress?: number }[];
description?: string;
metadata?: string | { [key: string]: any } | string[];
disabled?: boolean; disabled?: boolean;
event?: string; event?: string;
serverEvent?: string; serverEvent?: string;

View File

@@ -1,7 +1,19 @@
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types'; import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
// Should really be improved at some point to only display properties depending on the input type
interface InputDialogRowProps { interface InputDialogRowProps {
type: 'input' | 'number' | 'checkbox' | 'select' | 'slider'; type:
| 'input'
| 'number'
| 'checkbox'
| 'select'
| 'multi-select'
| 'slider'
| 'color'
| 'date'
| 'date-range'
| 'time'
| 'text-area';
label: string; label: string;
options?: { value: string; label: string; default?: string }[]; options?: { value: string; label: string; default?: string }[];
password?: boolean; password?: boolean;
@@ -13,13 +25,19 @@ interface InputDialogRowProps {
checked?: boolean; checked?: boolean;
min?: number; min?: number;
max?: number; max?: number;
autosize?: boolean;
step?: number; step?: number;
required?: boolean;
format?: string;
description?: string; description?: string;
} }
type inputDialog = ( type inputDialog = (
heading: string, heading: string,
rows: string[] | InputDialogRowProps[] rows: string[] | InputDialogRowProps[],
options: {
allowCancel?: boolean;
}
) => Promise<Array<string | number | boolean> | undefined>; ) => Promise<Array<string | number | boolean> | undefined>;
export const inputDialog: inputDialog = async (heading, rows) => await exports.ox_lib.inputDialog(heading, rows); export const inputDialog: inputDialog = async (heading, rows) => await exports.ox_lib.inputDialog(heading, rows);

View File

@@ -1,11 +1,19 @@
import { CSSProperties } from 'react'; import { CSSProperties } from 'react';
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types'; import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
type NotificationPosition = 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'; type NotificationPosition =
| 'top'
| 'top-right'
| 'top-left'
| 'bottom'
| 'bottom-right'
| 'bottom-left'
| 'center-right'
| 'center-left';
type NotificationType = 'inform' | 'error' | 'success'; type NotificationType = 'inform' | 'error' | 'success';
interface NotifyProps { interface NotifyProps {
id?: string; id?: string | number;
title?: string; title?: string;
description?: string; description?: string;
duration?: number; duration?: number;
@@ -18,6 +26,7 @@ interface NotifyProps {
export const notify = (data: NotifyProps): void => exports.ox_lib.notify(data); export const notify = (data: NotifyProps): void => exports.ox_lib.notify(data);
// Keep for backwards compat with v2
interface DefaultNotifyProps { interface DefaultNotifyProps {
title?: string; title?: string;
description?: string; description?: string;

View File

@@ -1,4 +1,4 @@
type SkillCheckDifficulty = 'easy' | 'medium' | 'hard' | { areaSize: number; speedMultiplier: number }; type SkillCheckDifficulty = 'easy' | 'medium' | 'hard' | { areaSize: number; speedMultiplier: number };
export const skillCheck = (difficulty: SkillCheckDifficulty | SkillCheckDifficulty[]) => export const skillCheck = (difficulty: SkillCheckDifficulty | SkillCheckDifficulty[], inputs?: string[]) =>
exports.ox_lib.skillCheck(difficulty); exports.ox_lib.skillCheck(difficulty);