@orioro/react-ui-core 0.0.2 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppHeader/AppHeaderContext.d.ts +11 -2
- package/dist/AppHeader/Root.d.ts +1 -1
- package/dist/AppHeader/index.d.ts +2 -2
- package/dist/Box/Box.d.ts +2 -0
- package/dist/Button/Button.d.ts +2 -2
- package/dist/Button/ButtonCore.d.ts +2 -0
- package/dist/Button/LinkButton.d.ts +2 -2
- package/dist/Debug/index.d.ts +1 -0
- package/dist/Dialog/AuthDialog/AuthDialog.d.ts +2 -1
- package/dist/Dialog/AuthDialog/SignUpForm.d.ts +2 -2
- package/dist/Dialog/AuthDialog/dialogSystemSpec.d.ts +2 -0
- package/dist/Dialog/AuthDialog/index.d.ts +1 -0
- package/dist/Dialog/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/dist/Dialog/ConfirmDialog/dialogSystemSpec.d.ts +2 -0
- package/dist/Dialog/ConfirmDialog/index.d.ts +1 -0
- package/dist/Dialog/ConfirmDialog/types.d.ts +1 -0
- package/dist/Dialog/DialogSystem_legacy/DialogSystem_.d.ts +2 -0
- package/dist/Dialog/DialogSystem_legacy/index.stories_.d.ts +7 -0
- package/dist/Dialog/DialogSystem_legacy/prompt.stories_.d.ts +6 -0
- package/dist/Dialog/DialogSystem_legacy/tmpDialogSystem.d.ts +3 -0
- package/dist/Dialog/DialogSystem_legacy/types.d.ts +25 -0
- package/dist/Dialog/InfoDialog/dialogSystemSpec.d.ts +2 -0
- package/dist/Dialog/InfoDialog/index.d.ts +1 -0
- package/dist/Dialog/LoadingDialog/dialogSystemSpec.d.ts +2 -0
- package/dist/Dialog/LoadingDialog/index.d.ts +1 -0
- package/dist/Dialog/OptionsDialog/dialogSystemSpec.d.ts +2 -0
- package/dist/Dialog/OptionsDialog/index.d.ts +1 -0
- package/dist/Dialog/PromptDialog/dialogSystemSpec.d.ts +2 -0
- package/dist/Dialog/PromptDialog/index.d.ts +1 -0
- package/dist/Dialog/createDialogSystem/createDialogSystem.d.ts +3 -10
- package/dist/Dialog/createDialogSystem/dialogSystemReducer.d.ts +2 -0
- package/dist/Dialog/createDialogSystem/dialogSystemSpecs.d.ts +2 -0
- package/dist/Dialog/createDialogSystem/index.d.ts +2 -1
- package/dist/Dialog/createDialogSystem/tmp_util.d.ts +16 -0
- package/dist/Dialog/createDialogSystem/types.d.ts +48 -0
- package/dist/Dialog/createDialogSystem/useDialog.d.ts +6 -2
- package/dist/Dialog/createDialogSystem/util.d.ts +16 -0
- package/dist/Dialog/createDialogSystem2/createDialogSystem.d.ts +6 -0
- package/dist/Dialog/createDialogSystem2/dialogSystemReducer.d.ts +2 -0
- package/dist/Dialog/createDialogSystem2/index.d.ts +2 -0
- package/dist/Dialog/createDialogSystem2/proxyRef.d.ts +2 -0
- package/dist/Dialog/createDialogSystem2/types.d.ts +48 -0
- package/dist/Dialog/createDialogSystem2/util.d.ts +16 -0
- package/dist/Dialog/createDialogSystem_legacy/createDialogSystem.d.ts +13 -0
- package/dist/Dialog/createDialogSystem_legacy/index.d.ts +1 -0
- package/dist/Dialog/createDialogSystem_legacy/proxyRef.d.ts +2 -0
- package/dist/Dialog/createDialogSystem_legacy/useDialog.d.ts +22 -0
- package/dist/Dialog/specUtil/index.d.ts +5 -0
- package/dist/EvenSpacedList/EvenSpacedList.d.ts +6 -2
- package/dist/FileDropzone/index.d.ts +1 -0
- package/dist/Flex/Flex.d.ts +27 -16
- package/dist/FlexGrid/FlexGrid.d.ts +23 -1
- package/dist/Input/BooleanCheckboxInput/index.d.ts +28 -6
- package/dist/Input/InputGrid/index.d.ts +5 -1
- package/dist/Input/ObjectInput/index.d.ts +44 -8
- package/dist/Input/RangeInput/RangeInput.d.ts +11 -0
- package/dist/Input/RangeInput/index.d.ts +1 -0
- package/dist/Input/RichTextInput/RichTextInput.d.ts +13 -13
- package/dist/Input/RichTextInput/RichTextInput_20240730_backup_NO_MARKDOWN.d.ts +13 -13
- package/dist/Input/SingleFileInput/index.d.ts +65 -6
- package/dist/Input/SingleFileInput/middleware.d.ts +4 -0
- package/dist/Input/SliderInput/SliderInput.d.ts +16 -0
- package/dist/Input/SliderInput/index.d.ts +1 -0
- package/dist/Input/SwitchInput/index.d.ts +6 -0
- package/dist/Input/TextInput/index.d.ts +14 -13
- package/dist/Input/TextInput/parseValidator.d.ts +1 -1
- package/dist/Input/TextInput/types.d.ts +1 -0
- package/dist/Input/TextInput/useTextInput.d.ts +3 -2
- package/dist/Input/TextareaInput/index.d.ts +13 -13
- package/dist/Input/TreeSelectInput/TreeSelectInput.d.ts +42 -0
- package/dist/Input/TreeSelectInput/index.d.ts +1 -0
- package/dist/Input/index.d.ts +5 -0
- package/dist/Input/types.d.ts +1 -1
- package/dist/Input/useValidation/useValidation.d.ts +1 -1
- package/dist/Interaction/constants.d.ts +1 -0
- package/dist/Interaction/index.d.ts +1 -0
- package/dist/LanguageSelector/index.d.ts +3 -2
- package/dist/Markdown/index.d.ts +7 -0
- package/dist/Menu/ButtonBarMenu/ButtonBarMenu.d.ts +13 -0
- package/dist/Menu/ButtonBarMenu/OverflowableButtonBarMenu.d.ts +8 -0
- package/dist/Menu/ButtonBarMenu/index.d.ts +2 -13
- package/dist/RichTextRenderer/types/blocknote.d.ts +1 -1
- package/dist/ShadowExpandable/index.d.ts +2 -1
- package/dist/UIContext/UIContext.d.ts +16 -0
- package/dist/UIContext/index.d.ts +1 -0
- package/dist/cascadingContextProvider/index.d.ts +8 -0
- package/dist/componentMaker/componentMaker.d.ts +4 -0
- package/dist/entriesByIdReducer/entriesByIdReducer.d.ts +26 -0
- package/dist/entriesByIdReducer/index.d.ts +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +4587 -5283
- package/dist/makeLink/locationAwareLink.d.ts +1 -1
- package/dist/mergeable/index.d.ts +1 -0
- package/dist/mergeable/mergeRender.d.ts +3 -0
- package/dist/mergeable/types.d.ts +2 -2
- package/dist/mergeable/util.d.ts +1 -0
- package/dist/useByIdState/index.d.ts +8 -0
- package/dist/usePromptUI/renderPromptInput.d.ts +1 -1
- package/dist/usePromptUI/types.d.ts +1 -2
- package/dist/useRefByKey/index.d.ts +1 -0
- package/dist/util/htmlTagComponent.d.ts +2 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/mergeChildren.d.ts +2 -0
- package/package.json +9 -6
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export type AppHeaderContextType = {
|
|
3
3
|
headerHeight: number;
|
|
4
|
+
menuOpen: boolean;
|
|
5
|
+
setMenuOpen: (nextMenuOpen: boolean) => void;
|
|
4
6
|
};
|
|
5
|
-
export declare const AppHeaderContext:
|
|
7
|
+
export declare const AppHeaderContext: React.Context<AppHeaderContextType>;
|
|
8
|
+
export type AppHeaderProviderProps = {
|
|
9
|
+
initialMenuOpen: boolean;
|
|
10
|
+
headerHeight: number;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare function AppHeaderProvider({ initialMenuOpen, headerHeight, children, }: AppHeaderProviderProps): React.JSX.Element;
|
|
14
|
+
export declare function useAppHeader(): AppHeaderContextType;
|
package/dist/AppHeader/Root.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export type RootProps = Omit<ContainerProps, 'as'> & {
|
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
gap?: ResponsiveValueInput<CSSLength>;
|
|
8
8
|
};
|
|
9
|
-
export declare
|
|
9
|
+
export declare const Root: React.ForwardRefExoticComponent<Omit<RootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Root } from './Root';
|
|
3
2
|
import { OverlayMenu } from './OverlayMenu';
|
|
3
|
+
export * from './AppHeaderContext';
|
|
4
4
|
export declare const AppHeader: {
|
|
5
|
-
Root:
|
|
5
|
+
Root: import("react").ForwardRefExoticComponent<Omit<import("./Root").RootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Logo: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
7
7
|
Main: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
8
8
|
OverlayMenu: typeof OverlayMenu;
|
package/dist/Box/Box.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ type InsetDirection = 'top' | 'bottom' | 'left' | 'right';
|
|
|
6
6
|
export type BoxProps = SpacingStyles & ResponsiveProps & {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
width?: ResponsiveValueInput<CSSLength>;
|
|
9
|
+
maxWidth?: ResponsiveValueInput<CSSLength>;
|
|
9
10
|
height?: ResponsiveValueInput<CSSLength>;
|
|
11
|
+
maxHeight?: ResponsiveValueInput<CSSLength>;
|
|
10
12
|
position?: ResponsiveValueInput<CSSPosition>;
|
|
11
13
|
top?: ResponsiveValueInput<CSSLength>;
|
|
12
14
|
right?: ResponsiveValueInput<CSSLength>;
|
package/dist/Button/Button.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Button: import("react").ForwardRefExoticComponent<(Omit<{
|
|
3
3
|
value?: string | number | readonly string[] | undefined;
|
|
4
|
-
form?: string | undefined;
|
|
5
4
|
key?: import("react").Key | null | undefined;
|
|
5
|
+
form?: string | undefined;
|
|
6
6
|
m?: import("@radix-ui/themes/dist/cjs/props/prop-def").Responsive<import("@radix-ui/themes/dist/cjs/props/prop-def").Union<string, "1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-1" | "-2" | "-3" | "-4" | "-5" | "-6" | "-7" | "-8" | "-9">> | undefined;
|
|
7
7
|
my?: import("@radix-ui/themes/dist/cjs/props/prop-def").Responsive<import("@radix-ui/themes/dist/cjs/props/prop-def").Union<string, "1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-1" | "-2" | "-3" | "-4" | "-5" | "-6" | "-7" | "-8" | "-9">> | undefined;
|
|
8
8
|
mx?: import("@radix-ui/themes/dist/cjs/props/prop-def").Responsive<import("@radix-ui/themes/dist/cjs/props/prop-def").Union<string, "1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-1" | "-2" | "-3" | "-4" | "-5" | "-6" | "-7" | "-8" | "-9">> | undefined;
|
|
@@ -78,7 +78,7 @@ export declare const Button: import("react").ForwardRefExoticComponent<(Omit<{
|
|
|
78
78
|
results?: number | undefined;
|
|
79
79
|
security?: string | undefined;
|
|
80
80
|
unselectable?: "on" | "off" | undefined;
|
|
81
|
-
inputMode?: "
|
|
81
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
82
82
|
is?: string | undefined;
|
|
83
83
|
"aria-activedescendant"?: string | undefined;
|
|
84
84
|
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
|
@@ -7,8 +7,8 @@ declare const DefaultLinkComponent: import("styled-components").IStyledComponent
|
|
|
7
7
|
export declare function makeLinkButton(LinkComponent: typeof DefaultLinkComponent): React.FC<LinkButtonProps>;
|
|
8
8
|
export declare const LinkButton: React.FC<{
|
|
9
9
|
value?: string | number | readonly string[] | undefined;
|
|
10
|
-
form?: string | undefined;
|
|
11
10
|
key?: React.Key | null | undefined;
|
|
11
|
+
form?: string | undefined;
|
|
12
12
|
m?: import("@radix-ui/themes/dist/cjs/props/prop-def").Responsive<import("@radix-ui/themes/dist/cjs/props/prop-def").Union<string, "1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-1" | "-2" | "-3" | "-4" | "-5" | "-6" | "-7" | "-8" | "-9">> | undefined;
|
|
13
13
|
my?: import("@radix-ui/themes/dist/cjs/props/prop-def").Responsive<import("@radix-ui/themes/dist/cjs/props/prop-def").Union<string, "1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-1" | "-2" | "-3" | "-4" | "-5" | "-6" | "-7" | "-8" | "-9">> | undefined;
|
|
14
14
|
mx?: import("@radix-ui/themes/dist/cjs/props/prop-def").Responsive<import("@radix-ui/themes/dist/cjs/props/prop-def").Union<string, "1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-1" | "-2" | "-3" | "-4" | "-5" | "-6" | "-7" | "-8" | "-9">> | undefined;
|
|
@@ -84,7 +84,7 @@ export declare const LinkButton: React.FC<{
|
|
|
84
84
|
results?: number | undefined;
|
|
85
85
|
security?: string | undefined;
|
|
86
86
|
unselectable?: "on" | "off" | undefined;
|
|
87
|
-
inputMode?: "
|
|
87
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
88
88
|
is?: string | undefined;
|
|
89
89
|
"aria-activedescendant"?: string | undefined;
|
|
90
90
|
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
package/dist/Debug/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function AuthDialog({ open, onCancel, onAuthed, onLogIn, onSignUp, onRequestAccountRecovery, initialValue, initialActiveTab, DialogsContext, messages, localeOptions, locale, onSetLocale, ...props }: {
|
|
1
|
+
export function AuthDialog({ open, onCancel, onAuthed, onLogIn, onSignUp, onRequestAccountRecovery, initialValue, initialActiveTab, DialogsContext, onInfo, messages, localeOptions, locale, onSetLocale, ...props }: {
|
|
2
2
|
[x: string]: any;
|
|
3
3
|
open: any;
|
|
4
4
|
onCancel: any;
|
|
@@ -9,6 +9,7 @@ export function AuthDialog({ open, onCancel, onAuthed, onLogIn, onSignUp, onRequ
|
|
|
9
9
|
initialValue?: {} | undefined;
|
|
10
10
|
initialActiveTab?: string | undefined;
|
|
11
11
|
DialogsContext: any;
|
|
12
|
+
onInfo: any;
|
|
12
13
|
messages?: {
|
|
13
14
|
dialogTitle: string;
|
|
14
15
|
logIn: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function SignupForm({ onSignUp, onCancel, initialValue,
|
|
1
|
+
export function SignupForm({ onSignUp, onCancel, initialValue, onInfo, messages, __lockInitialValue, }: {
|
|
2
2
|
onSignUp: any;
|
|
3
3
|
onCancel: any;
|
|
4
4
|
initialValue?: {
|
|
@@ -7,7 +7,7 @@ export function SignupForm({ onSignUp, onCancel, initialValue, DialogsContext, m
|
|
|
7
7
|
primaryEmail: string;
|
|
8
8
|
password: string;
|
|
9
9
|
} | undefined;
|
|
10
|
-
|
|
10
|
+
onInfo: any;
|
|
11
11
|
messages: any;
|
|
12
12
|
__lockInitialValue?: boolean | undefined;
|
|
13
13
|
}): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AlertDialog } from '@radix-ui/themes';
|
|
3
3
|
import { ConfirmDialogContentProps, ConfirmDialogProps } from './types';
|
|
4
|
-
export declare function ConfirmDialogContent({ title, message, cancel, confirm, onConfirm, onCancel, }: ConfirmDialogContentProps): React.JSX.Element;
|
|
4
|
+
export declare function ConfirmDialogContent({ title, message, cancel, confirm, dismissable, onConfirm, onCancel, }: ConfirmDialogContentProps): React.JSX.Element;
|
|
5
5
|
export declare function ConfirmDialog({ open, ...contentProps }: ConfirmDialogProps): React.JSX.Element;
|
|
6
6
|
export declare namespace ConfirmDialog {
|
|
7
7
|
var Root: React.FC<AlertDialog.RootProps>;
|
|
@@ -8,6 +8,7 @@ export type ConfirmDialogLabels = {
|
|
|
8
8
|
export type ConfirmDialogContentProps = {
|
|
9
9
|
onConfirm: () => void | Promise<void>;
|
|
10
10
|
onCancel?: () => void | Promise<void>;
|
|
11
|
+
dismissable?: boolean;
|
|
11
12
|
} & Partial<ConfirmDialogLabels>;
|
|
12
13
|
export type ConfirmDialogProps = ConfirmDialogContentProps & {
|
|
13
14
|
open?: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useConfirmDialog } from '../ConfirmDialog';
|
|
3
|
+
import { ConfirmDialogProps } from '../ConfirmDialog/types';
|
|
4
|
+
import { InfoDialogProps, useInfoDialog } from '../InfoDialog';
|
|
5
|
+
import { LoadingDialogProps, useLoadingDialog } from '../LoadingDialog';
|
|
6
|
+
import { PromptDialogProps, usePromptDialog } from '../PromptDialog';
|
|
7
|
+
import { OptionsDialogProps } from '../OptionsDialog/types';
|
|
8
|
+
import { useOptionsDialog } from '../OptionsDialog';
|
|
9
|
+
export type DialogSystemDialogProps = Partial<{
|
|
10
|
+
info: InfoDialogProps;
|
|
11
|
+
loading: LoadingDialogProps;
|
|
12
|
+
prompt: PromptDialogProps;
|
|
13
|
+
confirm: ConfirmDialogProps;
|
|
14
|
+
options: OptionsDialogProps;
|
|
15
|
+
}>;
|
|
16
|
+
export type DialogSystemProps = DialogSystemDialogProps & {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export type DialogSystemContextValue = {
|
|
20
|
+
info: ReturnType<typeof useInfoDialog>[1];
|
|
21
|
+
loading: ReturnType<typeof useLoadingDialog>[1];
|
|
22
|
+
prompt: ReturnType<typeof usePromptDialog>[1];
|
|
23
|
+
confirm: ReturnType<typeof useConfirmDialog>[1];
|
|
24
|
+
options: ReturnType<typeof useOptionsDialog>[1];
|
|
25
|
+
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
[key: string]: ((props: any) => React.ReactElement) | [(props: any) => React.ReactElement, UseDialogOptions?];
|
|
5
|
-
};
|
|
6
|
-
type CreateDialogSystemProps = {
|
|
7
|
-
dialogs: DialogSpecs;
|
|
8
|
-
};
|
|
9
|
-
export declare function createDialogSystem({ dialogs }: CreateDialogSystemProps): (React.Context<{}> | (({ children, ...props }: {
|
|
2
|
+
import { CreateDialogSystemProps, DialogSpecList, DialogsAPI } from './types';
|
|
3
|
+
export declare function createDialogSystem<T extends DialogSpecList = DialogSpecList>({ dialogs: dialogSpecs, unmountDelay, }: CreateDialogSystemProps): [({ children, ...props }: {
|
|
10
4
|
[key: string]: Record<string, any>;
|
|
11
5
|
children: React.ReactElement;
|
|
12
|
-
}) => React.JSX.Element
|
|
13
|
-
export {};
|
|
6
|
+
}) => React.JSX.Element, () => DialogsAPI<T>, React.Context<DialogsAPI<T>>];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Deferred<T> {
|
|
2
|
+
promise: Promise<T>;
|
|
3
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
4
|
+
reject: (reason?: any) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function makeDeferred<T>(): Deferred<T>;
|
|
7
|
+
type AnyFn = (...args: any[]) => any;
|
|
8
|
+
type Hooks = Partial<{
|
|
9
|
+
input: AnyFn;
|
|
10
|
+
validate: AnyFn;
|
|
11
|
+
before: AnyFn;
|
|
12
|
+
output: AnyFn;
|
|
13
|
+
after: AnyFn;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function hook(fn: AnyFn, { input, validate, before, output, after }: Hooks): (...args: any[]) => Promise<any>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Deferred } from './util';
|
|
3
|
+
export type DialogPropSetter = Record<string, any> | ((currentProps: Record<string, any>) => Record<string, any>);
|
|
4
|
+
export type DialogInstanceCtrl = {
|
|
5
|
+
resolve: (result?: any) => void;
|
|
6
|
+
reject: (err?: any) => void;
|
|
7
|
+
dialogs: Record<string, (...args: any[]) => any>;
|
|
8
|
+
setProps: (nextProps: DialogPropSetter) => void;
|
|
9
|
+
props: Record<string, any> | null;
|
|
10
|
+
};
|
|
11
|
+
export type DialogSpec<ComponentT extends React.FC<any> = React.FC<any>, ArgsT extends any[] = any[]> = [
|
|
12
|
+
ComponentT,
|
|
13
|
+
{
|
|
14
|
+
getProps: (ctrl: DialogInstanceCtrl, ...args: ArgsT) => Record<string, any> | false;
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
export type DialogSpecList = {
|
|
18
|
+
[key: string]: DialogSpec;
|
|
19
|
+
};
|
|
20
|
+
export type DialogsAPI<T extends DialogSpecList> = {
|
|
21
|
+
[K in keyof T]: (...args: Parameters<T[K][1]['getProps']>[1]) => Promise<any>;
|
|
22
|
+
};
|
|
23
|
+
export type CreateDialogSystemProps = {
|
|
24
|
+
dialogs: DialogSpecList;
|
|
25
|
+
unmountDelay?: number;
|
|
26
|
+
};
|
|
27
|
+
export type DialogInstanceState = {
|
|
28
|
+
id: string;
|
|
29
|
+
methodName: string;
|
|
30
|
+
deferred: Deferred<any>;
|
|
31
|
+
props: Record<string, any>;
|
|
32
|
+
};
|
|
33
|
+
export type DialogSytemState = {
|
|
34
|
+
dialogInstances: DialogInstanceState[];
|
|
35
|
+
};
|
|
36
|
+
export type DialogSytemAction = {
|
|
37
|
+
type: 'addInstance';
|
|
38
|
+
payload: DialogInstanceState;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'setInstanceProps';
|
|
41
|
+
payload: {
|
|
42
|
+
id: DialogInstanceState['id'];
|
|
43
|
+
props: Record<string, any> | ((currProps: Record<string, any>) => Record<string, any>);
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
type: 'removeInstance';
|
|
47
|
+
payload: DialogInstanceState['id'];
|
|
48
|
+
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
type DialogsAPI = Record<string, (...args: any[]) => Promise<any>>;
|
|
1
2
|
export type UseDialogOptions = {
|
|
2
|
-
|
|
3
|
+
dialogs: DialogsAPI;
|
|
4
|
+
props?: (api: {
|
|
3
5
|
resolve: (result?: any) => void;
|
|
4
6
|
reject: (err: any) => void;
|
|
7
|
+
dialogs: DialogsAPI;
|
|
5
8
|
}, ...args: any[]) => Record<string, any>;
|
|
6
9
|
};
|
|
7
10
|
/**
|
|
8
11
|
* Utility hook that sets up promise resolution systems
|
|
9
12
|
*/
|
|
10
|
-
export declare function useDialog<DialogProps, OnExecuteResultType = any>(baseDialogProps
|
|
13
|
+
export declare function useDialog<DialogProps, OnExecuteResultType = any>(baseDialogProps: Partial<DialogProps> | undefined, options: UseDialogOptions): {
|
|
11
14
|
dialogProps: Partial<DialogProps> & {
|
|
12
15
|
[key: string]: any;
|
|
13
16
|
open?: boolean | undefined;
|
|
@@ -16,3 +19,4 @@ export declare function useDialog<DialogProps, OnExecuteResultType = any>(baseDi
|
|
|
16
19
|
reject: (error: any) => Promise<void>;
|
|
17
20
|
invoke: (...args: any[]) => Promise<OnExecuteResultType>;
|
|
18
21
|
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Deferred<T> {
|
|
2
|
+
promise: Promise<T>;
|
|
3
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
4
|
+
reject: (reason?: any) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function makeDeferred<T>(): Deferred<T>;
|
|
7
|
+
type AnyFn = (...args: any[]) => any;
|
|
8
|
+
type Hooks = Partial<{
|
|
9
|
+
input: AnyFn;
|
|
10
|
+
validate: AnyFn;
|
|
11
|
+
before: AnyFn;
|
|
12
|
+
output: AnyFn;
|
|
13
|
+
after: AnyFn;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function hook(fn: AnyFn, { input, validate, before, output, after }: Hooks): (...args: any[]) => Promise<any>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CreateDialogSystemProps, DialogSpecList, DialogsAPI } from './types';
|
|
3
|
+
export declare function createDialogSystem<T extends DialogSpecList = DialogSpecList>({ dialogs: dialogSpecs, unmountDelay, }: CreateDialogSystemProps): [({ children, ...props }: {
|
|
4
|
+
[key: string]: Record<string, any>;
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
}) => React.JSX.Element, () => DialogsAPI<T>, React.Context<DialogsAPI<T>>];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Deferred } from './util';
|
|
3
|
+
export type DialogPropSetter = Record<string, any> | ((currentProps: Record<string, any>) => Record<string, any>);
|
|
4
|
+
export type DialogInstanceCtrl = {
|
|
5
|
+
resolve: (result?: any) => void;
|
|
6
|
+
reject: (err?: any) => void;
|
|
7
|
+
dialogs: Record<string, (...args: any[]) => any>;
|
|
8
|
+
setProps: (nextProps: DialogPropSetter) => void;
|
|
9
|
+
props: Record<string, any> | null;
|
|
10
|
+
};
|
|
11
|
+
export type DialogSpec<ComponentT extends React.FC<any> = React.FC<any>, ArgsT extends any[] = any[]> = [
|
|
12
|
+
ComponentT,
|
|
13
|
+
{
|
|
14
|
+
getProps: (ctrl: DialogInstanceCtrl, ...args: ArgsT) => Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
export type DialogSpecList = {
|
|
18
|
+
[key: string]: DialogSpec;
|
|
19
|
+
};
|
|
20
|
+
export type DialogsAPI<T extends DialogSpecList> = {
|
|
21
|
+
[K in keyof T]: (...args: Parameters<T[K][1]['getProps']>[1]) => Promise<any>;
|
|
22
|
+
};
|
|
23
|
+
export type CreateDialogSystemProps = {
|
|
24
|
+
dialogs: DialogSpecList;
|
|
25
|
+
unmountDelay?: number;
|
|
26
|
+
};
|
|
27
|
+
export type DialogInstanceState = {
|
|
28
|
+
id: string;
|
|
29
|
+
methodName: string;
|
|
30
|
+
deferred: Deferred<any>;
|
|
31
|
+
props: Record<string, any>;
|
|
32
|
+
};
|
|
33
|
+
export type DialogSytemState = {
|
|
34
|
+
dialogInstances: DialogInstanceState[];
|
|
35
|
+
};
|
|
36
|
+
export type DialogSytemAction = {
|
|
37
|
+
type: 'addInstance';
|
|
38
|
+
payload: DialogInstanceState;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'setInstanceProps';
|
|
41
|
+
payload: {
|
|
42
|
+
id: DialogInstanceState['id'];
|
|
43
|
+
props: Record<string, any> | ((currProps: Record<string, any>) => Record<string, any>);
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
type: 'removeInstance';
|
|
47
|
+
payload: DialogInstanceState['id'];
|
|
48
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Deferred<T> {
|
|
2
|
+
promise: Promise<T>;
|
|
3
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
4
|
+
reject: (reason?: any) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function makeDeferred<T>(): Deferred<T>;
|
|
7
|
+
type AnyFn = (...args: any[]) => any;
|
|
8
|
+
type Hooks = Partial<{
|
|
9
|
+
input: AnyFn;
|
|
10
|
+
validate: AnyFn;
|
|
11
|
+
before: AnyFn;
|
|
12
|
+
output: AnyFn;
|
|
13
|
+
after: AnyFn;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function hook(fn: AnyFn, { input, validate, before, output, after }: Hooks): (...args: any[]) => Promise<any>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UseDialogOptions } from './useDialog';
|
|
3
|
+
export type DialogSpecs = {
|
|
4
|
+
[key: string]: ((props: any) => React.ReactElement) | [(props: any) => React.ReactElement, Partial<UseDialogOptions>?];
|
|
5
|
+
};
|
|
6
|
+
type CreateDialogSystemProps = {
|
|
7
|
+
dialogs: DialogSpecs;
|
|
8
|
+
};
|
|
9
|
+
export declare function createDialogSystem({ dialogs: dialogSpecs, }: CreateDialogSystemProps): (React.Context<{}> | (({ children, ...props }: {
|
|
10
|
+
[key: string]: Record<string, any>;
|
|
11
|
+
children: React.ReactElement;
|
|
12
|
+
}) => React.JSX.Element) | (() => {}))[];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../createDialogSystem2';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type DialogsAPI = Record<string, (...args: any[]) => Promise<any>>;
|
|
2
|
+
export type UseDialogOptions = {
|
|
3
|
+
dialogs: DialogsAPI;
|
|
4
|
+
props?: (api: {
|
|
5
|
+
resolve: (result?: any) => void;
|
|
6
|
+
reject: (err: any) => void;
|
|
7
|
+
dialogs: DialogsAPI;
|
|
8
|
+
}, ...args: any[]) => Record<string, any>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Utility hook that sets up promise resolution systems
|
|
12
|
+
*/
|
|
13
|
+
export declare function useDialog<DialogProps, OnExecuteResultType = any>(baseDialogProps: Partial<DialogProps> | undefined, options: UseDialogOptions): {
|
|
14
|
+
dialogProps: Partial<DialogProps> & {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
open?: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
resolve: (value: OnExecuteResultType) => Promise<void>;
|
|
19
|
+
reject: (error: any) => Promise<void>;
|
|
20
|
+
invoke: (...args: any[]) => Promise<OnExecuteResultType>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -9,10 +9,12 @@ export declare const EvenSpacedList: import("styled-components").IStyledComponen
|
|
|
9
9
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
10
10
|
}, keyof import("..").ResponsiveProps> & import("..").ResponsiveProps, import("styled-components/dist/types").FastOmit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
11
11
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
12
|
-
}, keyof import("..").ResponsiveProps> & import("..").ResponsiveProps>, never>, keyof import("..").ResponsiveProps | "top" | "bottom" | "left" | "right" | "width" | "height" | "position" | "flexShrink" | "flexGrow" | "inset" | keyof import("../Box/spacing").SpacingStyles> & import("../Box/spacing").SpacingStyles & import("..").ResponsiveProps & {
|
|
12
|
+
}, keyof import("..").ResponsiveProps> & import("..").ResponsiveProps>, never>, "maxWidth" | keyof import("..").ResponsiveProps | "top" | "bottom" | "left" | "right" | "width" | "height" | "maxHeight" | "position" | "flexShrink" | "flexGrow" | "inset" | keyof import("../Box/spacing").SpacingStyles> & import("../Box/spacing").SpacingStyles & import("..").ResponsiveProps & {
|
|
13
13
|
children?: import("react").ReactNode;
|
|
14
14
|
width?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
15
|
+
maxWidth?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
15
16
|
height?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
17
|
+
maxHeight?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
16
18
|
position?: import("..").ResponsiveValueInput<import("..").CSSPosition> | undefined;
|
|
17
19
|
top?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
18
20
|
right?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
@@ -25,10 +27,12 @@ export declare const EvenSpacedList: import("styled-components").IStyledComponen
|
|
|
25
27
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
26
28
|
}, keyof import("..").ResponsiveProps> & import("..").ResponsiveProps, import("styled-components/dist/types").FastOmit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
27
29
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
28
|
-
}, keyof import("..").ResponsiveProps> & import("..").ResponsiveProps>, never>, keyof import("..").ResponsiveProps | "top" | "bottom" | "left" | "right" | "width" | "height" | "position" | "flexShrink" | "flexGrow" | "inset" | keyof import("../Box/spacing").SpacingStyles> & import("../Box/spacing").SpacingStyles & import("..").ResponsiveProps & {
|
|
30
|
+
}, keyof import("..").ResponsiveProps> & import("..").ResponsiveProps>, never>, "maxWidth" | keyof import("..").ResponsiveProps | "top" | "bottom" | "left" | "right" | "width" | "height" | "maxHeight" | "position" | "flexShrink" | "flexGrow" | "inset" | keyof import("../Box/spacing").SpacingStyles> & import("../Box/spacing").SpacingStyles & import("..").ResponsiveProps & {
|
|
29
31
|
children?: import("react").ReactNode;
|
|
30
32
|
width?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
33
|
+
maxWidth?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
31
34
|
height?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
35
|
+
maxHeight?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
32
36
|
position?: import("..").ResponsiveValueInput<import("..").CSSPosition> | undefined;
|
|
33
37
|
top?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
34
38
|
right?: import("..").ResponsiveValueInput<import("..").CSSLength> | undefined;
|
|
@@ -14,5 +14,6 @@ type DropzoneStateProps = {
|
|
|
14
14
|
isDragAccept: boolean;
|
|
15
15
|
isFileDialogActive: boolean;
|
|
16
16
|
};
|
|
17
|
+
export declare function fileDropzoneLabel({ isDragReject, isDragActive, }: DropzoneStateProps): React.JSX.Element | "Solte seus arquivos aqui" | "Solte arquivos aqui ou clique para selecionar";
|
|
17
18
|
export declare function FileDropzone({ dropzoneLabel, accept, style, ...props }: FileDropzoneProps): React.JSX.Element;
|
|
18
19
|
export {};
|