@pautena/react-design-system 0.4.2 → 0.4.3
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/cjs/index.js +1 -31
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/app-bar/app-bar.types.d.ts +2 -2
- package/dist/cjs/types/components/bullet/bullet.d.ts +1 -1
- package/dist/cjs/types/components/content/content.types.d.ts +3 -3
- package/dist/cjs/types/components/drawer/drawer.provider.d.ts +1 -1
- package/dist/cjs/types/components/drawer/drawer.types.d.ts +4 -4
- package/dist/cjs/types/components/enhanced-select/enhanced-select.d.ts +1 -2
- package/dist/cjs/types/components/header/header.dummy.d.ts +1 -1
- package/dist/cjs/types/components/header/header.types.d.ts +6 -6
- package/dist/cjs/types/components/label/label.d.ts +1 -1
- package/dist/cjs/types/components/link/link.d.ts +1 -1
- package/dist/cjs/types/components/placeholder/placeholder.d.ts +1 -1
- package/dist/cjs/types/components/query-container/query-container.d.ts +1 -1
- package/dist/cjs/types/components/sign-in/sign-in.d.ts +2 -3
- package/dist/cjs/types/components/tab/tab-card/tab-card.d.ts +3 -4
- package/dist/cjs/types/components/tab/tab-card/tab-card.dummy.d.ts +2 -3
- package/dist/cjs/types/components/table/enhanced-remote-table/enhanced-remote-table.d.ts +5 -6
- package/dist/cjs/types/components/table/enhanced-remote-table/enhanced-remote-table.mock.d.ts +6 -6
- package/dist/cjs/types/components/table/enhanced-table/enhanced-table-head.d.ts +8 -8
- package/dist/cjs/types/components/table/enhanced-table/enhanced-table.d.ts +2 -2
- package/dist/cjs/types/components/table/enhanced-table/enhanced-table.mock.d.ts +6 -7
- package/dist/cjs/types/components/table-list/table-list.d.ts +2 -2
- package/dist/cjs/types/components/value-displays/group-value-card/group-value-card.d.ts +7 -4
- package/dist/cjs/types/components/value-displays/group-value-card/group-value-card.mock.d.ts +2 -1
- package/dist/cjs/types/components/value-displays/index.d.ts +1 -0
- package/dist/cjs/types/components/value-displays/value-boolean/value-boolean.d.ts +3 -11
- package/dist/cjs/types/components/value-displays/value-card/value-card.d.ts +1 -1
- package/dist/cjs/types/components/value-displays/value-content/index.d.ts +1 -0
- package/dist/cjs/types/components/value-displays/value-content/value-content.d.ts +24 -0
- package/dist/cjs/types/components/value-displays/value-datetime/value-datetime.d.ts +3 -10
- package/dist/cjs/types/components/value-displays/value-displays.types.d.ts +15 -0
- package/dist/cjs/types/components/value-displays/value-image/index.d.ts +1 -0
- package/dist/cjs/types/components/value-displays/value-image/value-image.d.ts +11 -0
- package/dist/cjs/types/components/value-displays/value-text/value-text.d.ts +3 -11
- package/dist/cjs/types/generators/generators.mock.d.ts +2 -1
- package/dist/cjs/types/generators/generators.model.d.ts +36 -20
- package/dist/cjs/types/generators/generators.model.test.d.ts +1 -0
- package/dist/cjs/types/generators/model-router/model-router.d.ts +1 -1
- package/dist/cjs/types/generators/model-router/screens/add-screen.d.ts +1 -1
- package/dist/cjs/types/generators/model-router/screens/details-screen.d.ts +1 -1
- package/dist/cjs/types/generators/model-router/screens/list-screen.d.ts +1 -1
- package/dist/cjs/types/generators/model-router/screens/update-screen.d.ts +1 -1
- package/dist/cjs/types/layouts/header-layout/header-layout.d.ts +1 -2
- package/dist/cjs/types/providers/notification-center/notification-center.context.d.ts +0 -2
- package/dist/cjs/types/providers/notification-center/notification-center.provider.d.ts +1 -1
- package/dist/cjs/types/providers/tab-provider/tab-provider.provider.d.ts +1 -1
- package/dist/cjs/types/utils/theme.d.ts +1 -1
- package/dist/esm/index.js +1 -31
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/app-bar/app-bar.types.d.ts +2 -2
- package/dist/esm/types/components/bullet/bullet.d.ts +1 -1
- package/dist/esm/types/components/content/content.types.d.ts +3 -3
- package/dist/esm/types/components/drawer/drawer.provider.d.ts +1 -1
- package/dist/esm/types/components/drawer/drawer.types.d.ts +4 -4
- package/dist/esm/types/components/enhanced-select/enhanced-select.d.ts +1 -2
- package/dist/esm/types/components/header/header.dummy.d.ts +1 -1
- package/dist/esm/types/components/header/header.types.d.ts +6 -6
- package/dist/esm/types/components/label/label.d.ts +1 -1
- package/dist/esm/types/components/link/link.d.ts +1 -1
- package/dist/esm/types/components/placeholder/placeholder.d.ts +1 -1
- package/dist/esm/types/components/query-container/query-container.d.ts +1 -1
- package/dist/esm/types/components/sign-in/sign-in.d.ts +2 -3
- package/dist/esm/types/components/tab/tab-card/tab-card.d.ts +3 -4
- package/dist/esm/types/components/tab/tab-card/tab-card.dummy.d.ts +2 -3
- package/dist/esm/types/components/table/enhanced-remote-table/enhanced-remote-table.d.ts +5 -6
- package/dist/esm/types/components/table/enhanced-remote-table/enhanced-remote-table.mock.d.ts +6 -6
- package/dist/esm/types/components/table/enhanced-table/enhanced-table-head.d.ts +8 -8
- package/dist/esm/types/components/table/enhanced-table/enhanced-table.d.ts +2 -2
- package/dist/esm/types/components/table/enhanced-table/enhanced-table.mock.d.ts +6 -7
- package/dist/esm/types/components/table-list/table-list.d.ts +2 -2
- package/dist/esm/types/components/value-displays/group-value-card/group-value-card.d.ts +7 -4
- package/dist/esm/types/components/value-displays/group-value-card/group-value-card.mock.d.ts +2 -1
- package/dist/esm/types/components/value-displays/index.d.ts +1 -0
- package/dist/esm/types/components/value-displays/value-boolean/value-boolean.d.ts +3 -11
- package/dist/esm/types/components/value-displays/value-card/value-card.d.ts +1 -1
- package/dist/esm/types/components/value-displays/value-content/index.d.ts +1 -0
- package/dist/esm/types/components/value-displays/value-content/value-content.d.ts +24 -0
- package/dist/esm/types/components/value-displays/value-datetime/value-datetime.d.ts +3 -10
- package/dist/esm/types/components/value-displays/value-displays.types.d.ts +15 -0
- package/dist/esm/types/components/value-displays/value-image/index.d.ts +1 -0
- package/dist/esm/types/components/value-displays/value-image/value-image.d.ts +11 -0
- package/dist/esm/types/components/value-displays/value-text/value-text.d.ts +3 -11
- package/dist/esm/types/generators/generators.mock.d.ts +2 -1
- package/dist/esm/types/generators/generators.model.d.ts +36 -20
- package/dist/esm/types/generators/generators.model.test.d.ts +1 -0
- package/dist/esm/types/generators/model-router/model-router.d.ts +1 -1
- package/dist/esm/types/generators/model-router/screens/add-screen.d.ts +1 -1
- package/dist/esm/types/generators/model-router/screens/details-screen.d.ts +1 -1
- package/dist/esm/types/generators/model-router/screens/list-screen.d.ts +1 -1
- package/dist/esm/types/generators/model-router/screens/update-screen.d.ts +1 -1
- package/dist/esm/types/layouts/header-layout/header-layout.d.ts +1 -2
- package/dist/esm/types/providers/notification-center/notification-center.context.d.ts +0 -2
- package/dist/esm/types/providers/notification-center/notification-center.provider.d.ts +1 -1
- package/dist/esm/types/providers/tab-provider/tab-provider.provider.d.ts +1 -1
- package/dist/esm/types/utils/theme.d.ts +1 -1
- package/dist/index.d.ts +155 -150
- package/package.json +58 -53
- package/src/components/app-bar/app-bar.stories.tsx +2 -1
- package/src/components/app-bar/app-bar.test.tsx +1 -1
- package/src/components/bullet/bullet.test.tsx +1 -1
- package/src/components/center-container/center-container.test.tsx +1 -1
- package/src/components/content/content.stories.tsx +1 -1
- package/src/components/content/content.test.tsx +1 -1
- package/src/components/drawer/__snapshots__/drawer.test.tsx.snap +3 -3
- package/src/components/drawer/drawer.test.tsx +8 -8
- package/src/components/drawer-content/drawer-content.stories.tsx +0 -1
- package/src/components/drawer-content/drawer-content.test.tsx +1 -1
- package/src/components/drawer-item/drawer-item.test.tsx +3 -3
- package/src/components/drawer-section/drawer-section.test.tsx +1 -1
- package/src/components/enhanced-select/enhanced-select.stories.tsx +10 -10
- package/src/components/enhanced-select/enhanced-select.test.tsx +9 -4
- package/src/components/enhanced-select/enhanced-select.tsx +1 -3
- package/src/components/header/header.dummy.ts +1 -1
- package/src/components/header/header.stories.tsx +0 -6
- package/src/components/header/header.test.tsx +1 -1
- package/src/components/label/label.test.tsx +1 -1
- package/src/components/link/link.tsx +2 -2
- package/src/components/loading-area/loading-area.test.tsx +2 -1
- package/src/components/placeholder/placeholder.test.tsx +3 -2
- package/src/components/query-container/query-container.test.tsx +2 -1
- package/src/components/sign-in/sign-in.test.tsx +2 -1
- package/src/components/sign-in/sign-in.tsx +3 -3
- package/src/components/tab/tab-card/tab-card.dummy.tsx +2 -2
- package/src/components/tab/tab-card/tab-card.stories.tsx +2 -2
- package/src/components/tab/tab-card/tab-card.test.tsx +1 -1
- package/src/components/tab/tab-card/tab-card.tsx +3 -3
- package/src/components/table/enhanced-remote-table/enhanced-remote-table.mock.tsx +7 -6
- package/src/components/table/enhanced-remote-table/enhanced-remote-table.test.tsx +3 -3
- package/src/components/table/enhanced-remote-table/enhanced-remote-table.tsx +8 -8
- package/src/components/table/enhanced-table/enhanced-table-head.tsx +14 -9
- package/src/components/table/enhanced-table/enhanced-table.mock.tsx +12 -6
- package/src/components/table/enhanced-table/enhanced-table.test.tsx +6 -5
- package/src/components/table/enhanced-table/enhanced-table.tsx +8 -8
- package/src/components/table-list/table-list.stories.tsx +27 -17
- package/src/components/table-list/table-list.test.tsx +11 -6
- package/src/components/table-list/table-list.tsx +23 -12
- package/src/components/value-displays/group-value-card/group-value-card.mock.tsx +2 -2
- package/src/components/value-displays/group-value-card/group-value-card.stories.tsx +24 -1
- package/src/components/value-displays/group-value-card/group-value-card.test.tsx +7 -2
- package/src/components/value-displays/group-value-card/group-value-card.tsx +13 -4
- package/src/components/value-displays/index.ts +1 -0
- package/src/components/value-displays/value-boolean/value-boolean.test.tsx +15 -3
- package/src/components/value-displays/value-boolean/value-boolean.tsx +17 -17
- package/src/components/value-displays/value-card/value-card.test.tsx +1 -1
- package/src/components/value-displays/value-content/index.ts +1 -0
- package/src/components/value-displays/value-content/value-content.stories.tsx +20 -0
- package/src/components/value-displays/value-content/value-content.test.tsx +50 -0
- package/src/components/value-displays/value-content/value-content.tsx +55 -0
- package/src/components/value-displays/value-datetime/value-datetime.stories.tsx +13 -0
- package/src/components/value-displays/value-datetime/value-datetime.test.tsx +24 -5
- package/src/components/value-displays/value-datetime/value-datetime.tsx +15 -22
- package/src/components/value-displays/value-displays.types.ts +18 -0
- package/src/components/value-displays/value-image/index.ts +1 -0
- package/src/components/value-displays/value-image/value-image.stories.tsx +28 -0
- package/src/components/value-displays/value-image/value-image.test.tsx +22 -0
- package/src/components/value-displays/value-image/value-image.tsx +24 -0
- package/src/components/value-displays/value-text/value-text.stories.tsx +11 -0
- package/src/components/value-displays/value-text/value-text.test.tsx +19 -5
- package/src/components/value-displays/value-text/value-text.tsx +16 -22
- package/src/generators/generators.mock.ts +25 -22
- package/src/generators/generators.model.test.ts +77 -0
- package/src/generators/generators.model.ts +78 -6
- package/src/generators/model-form/model-form.test.tsx +11 -14
- package/src/generators/model-form/model-form.tsx +33 -65
- package/src/generators/model-router/model-router.test.tsx +45 -32
- package/src/generators/model-router/screens/add-screen.tsx +2 -1
- package/src/generators/model-router/screens/details-screen.tsx +2 -1
- package/src/generators/model-router/screens/list-screen.tsx +1 -1
- package/src/generators/model-router/screens/update-screen.tsx +4 -5
- package/src/generators/model-router/stories/model-router.stories.tsx +1 -1
- package/src/generators/object-details/object-details.test.tsx +2 -1
- package/src/generators/object-details/object-details.tsx +18 -9
- package/src/hooks/routing/routing.test.tsx +1 -1
- package/src/layouts/app-bar-with-drawer-layout/app-bar-with-drawer-layout.stories.tsx +1 -1
- package/src/layouts/app-bar-with-drawer-layout/app-bar-with-drawer-layout.test.tsx +2 -1
- package/src/layouts/header-layout/header-layout.stories.tsx +11 -4
- package/src/layouts/header-layout/header-layout.test.tsx +1 -1
- package/src/layouts/header-layout/header-layout.tsx +1 -1
- package/src/providers/notification-center/notification-center.context.ts +0 -6
- package/src/providers/notification-center/notification-center.stories.tsx +1 -1
- package/src/providers/notification-center/notification-center.test.tsx +6 -7
- package/src/storybook.tsx +1 -1
- package/src/tests/actions.ts +4 -0
- package/src/tests/assertions.ts +18 -10
- package/src/tests/components.tsx +35 -1
- package/src/tests/file-mock.ts +1 -0
- package/src/tests/mocks.ts +21 -0
- package/src/tests/testing-library.tsx +11 -8
- package/src/types/index.d.ts +4 -0
- package/src/tests/index.ts +0 -4
|
@@ -10,5 +10,5 @@ export interface AppBarProps extends MuiAppBarProps {
|
|
|
10
10
|
profile?: AppBarProfile;
|
|
11
11
|
onClickSignOut: () => void;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type AppBarComponent = FunctionComponent<AppBarProps>;
|
|
14
|
+
export type AppBarElement = ReactElement<AppBarProps, AppBarComponent>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PropsWithChildren, FunctionComponent, ReactElement } from "react";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type ContentProps = PropsWithChildren;
|
|
3
|
+
export type ContentComponent = FunctionComponent<ContentProps>;
|
|
4
|
+
export type ContentElement = ReactElement<ContentElement, ContentComponent>;
|
|
@@ -35,10 +35,10 @@ export interface DrawerContentProps {
|
|
|
35
35
|
*/
|
|
36
36
|
nav: Nav;
|
|
37
37
|
}
|
|
38
|
-
export
|
|
39
|
-
export
|
|
38
|
+
export type DrawerContentComponent = FunctionComponent<DrawerContentProps>;
|
|
39
|
+
export type DrawerContentElement = ReactElement<DrawerContentProps, DrawerContentComponent>;
|
|
40
40
|
export interface DrawerProps extends MuiDrawerProps {
|
|
41
41
|
children: DrawerContentElement;
|
|
42
42
|
}
|
|
43
|
-
export
|
|
44
|
-
export
|
|
43
|
+
export type DrawerComponent = FunctionComponent<DrawerProps>;
|
|
44
|
+
export type DrawerElement = ReactElement<DrawerProps, DrawerComponent>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { SelectInputProps } from "@mui/material/Select/SelectInput";
|
|
3
|
-
|
|
3
|
+
export type EnhancedSelectSize = "small" | "medium";
|
|
4
4
|
export interface EnhancedSelectProps<T> {
|
|
5
5
|
label: string;
|
|
6
6
|
value: T;
|
|
@@ -13,4 +13,3 @@ export interface EnhancedSelectProps<T> {
|
|
|
13
13
|
onChange?: SelectInputProps<T>["onChange"];
|
|
14
14
|
}
|
|
15
15
|
export declare const EnhancedSelect: <T extends React.ReactNode>({ label, value, loading, fetching, size, fullWidth, color, children, onChange, }: EnhancedSelectProps<T>) => JSX.Element;
|
|
16
|
-
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HeaderBreadcrumb, HeaderAction, HeaderTab } from "./header";
|
|
1
|
+
import { HeaderBreadcrumb, HeaderAction, HeaderTab } from "./header.types";
|
|
2
2
|
export declare const breadcrumbs: HeaderBreadcrumb[];
|
|
3
3
|
export declare const actions: HeaderAction[];
|
|
4
4
|
export declare const tabs: HeaderTab[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropTypes } from "@mui/material";
|
|
2
2
|
import { FunctionComponent, ReactElement } from "react";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type HeaderPreset = PropTypes.Color | "transparent";
|
|
4
|
+
export type HeaderActionVariant = "text" | "outlined" | "contained";
|
|
5
|
+
export type HeaderAction = {
|
|
6
6
|
id: string;
|
|
7
7
|
text: string;
|
|
8
8
|
disabled?: boolean;
|
|
@@ -19,7 +19,7 @@ export interface HeaderTab {
|
|
|
19
19
|
label: string;
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type HeaderProps = {
|
|
23
23
|
/**
|
|
24
24
|
* Title of the header
|
|
25
25
|
*/
|
|
@@ -51,5 +51,5 @@ export declare type HeaderProps = {
|
|
|
51
51
|
*/
|
|
52
52
|
tabs?: HeaderTab[];
|
|
53
53
|
};
|
|
54
|
-
export
|
|
55
|
-
export
|
|
54
|
+
export type HeaderComponent = FunctionComponent<HeaderProps>;
|
|
55
|
+
export type HeaderElement = ReactElement<HeaderProps, HeaderComponent>;
|
|
@@ -4,4 +4,4 @@ import { LinkProps } from "@mui/material";
|
|
|
4
4
|
export declare const LinkBehaviour: React.ForwardRefExoticComponent<Omit<RouterLinkProps, "to"> & {
|
|
5
5
|
href: RouterLinkProps["to"];
|
|
6
6
|
} & React.RefAttributes<any>>;
|
|
7
|
-
export declare const Link: React.ForwardRefExoticComponent<
|
|
7
|
+
export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<"a", {}>, "ref"> & React.RefAttributes<any>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
-
|
|
2
|
+
type IconColor = "inherit" | "action" | "disabled" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
|
|
3
3
|
export interface PlaceholderAction {
|
|
4
4
|
id: string;
|
|
5
5
|
text: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
export interface SignInProps {
|
|
2
2
|
title: string;
|
|
3
3
|
subtitle: string;
|
|
4
4
|
error?: Error;
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
onSubmitSignIn: (email: string, password: string) => void;
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
9
|
-
export {};
|
|
8
|
+
export declare const SignIn: ({ title, subtitle, loading, error, onSubmitSignIn }: SignInProps) => JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
|
-
|
|
2
|
+
export type TabCardProps = PropsWithChildren<{
|
|
3
3
|
tabs: string[];
|
|
4
|
-
}
|
|
5
|
-
export declare const TabCard: ({ children, tabs }:
|
|
6
|
-
export {};
|
|
4
|
+
}>;
|
|
5
|
+
export declare const TabCard: ({ children, tabs }: TabCardProps) => JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const DummyTabs: string[];
|
|
2
|
-
interface
|
|
2
|
+
export interface TabCardDummyProps {
|
|
3
3
|
tabs: string[];
|
|
4
4
|
initialTab: number;
|
|
5
5
|
}
|
|
6
|
-
export declare function TabCardDummy({ tabs, initialTab }:
|
|
7
|
-
export {};
|
|
6
|
+
export declare function TabCardDummy({ tabs, initialTab }: TabCardDummyProps): JSX.Element;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { HeadCell, Order } from "../enhanced-table";
|
|
3
|
-
interface
|
|
3
|
+
export interface EnhancedRemoteTableProps<T> {
|
|
4
4
|
data: T[];
|
|
5
5
|
loading: boolean;
|
|
6
|
-
defaultSort:
|
|
6
|
+
defaultSort: keyof T;
|
|
7
7
|
defaultOrder?: Order;
|
|
8
|
-
columns: HeadCell[];
|
|
8
|
+
columns: HeadCell<T>[];
|
|
9
9
|
children: (data: T, index: number) => ReactNode;
|
|
10
|
-
onRequestSort: (col:
|
|
10
|
+
onRequestSort: (col: keyof T, orderBy: "asc" | "desc") => void;
|
|
11
11
|
}
|
|
12
|
-
export declare const EnhancedRemoteTable: <T>({ children, data, loading, columns, defaultSort, defaultOrder, onRequestSort, }:
|
|
13
|
-
export {};
|
|
12
|
+
export declare const EnhancedRemoteTable: <T>({ children, data, loading, columns, defaultSort, defaultOrder, onRequestSort, }: EnhancedRemoteTableProps<T>) => JSX.Element;
|
package/dist/cjs/types/components/table/enhanced-remote-table/enhanced-remote-table.mock.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HeadCell, Order } from "../enhanced-table/enhanced-table-head";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { Data } from "../enhanced-table/enhanced-table.mock";
|
|
3
|
+
export interface EnhancedRemoteDummyTableProps {
|
|
4
|
+
data: Data[];
|
|
4
5
|
loading: boolean;
|
|
5
|
-
defaultSort:
|
|
6
|
+
defaultSort: keyof Data;
|
|
6
7
|
defaultOrder?: Order;
|
|
7
|
-
columns: HeadCell[];
|
|
8
|
+
columns: HeadCell<Data>[];
|
|
8
9
|
onRequestSort: (col: string, orderBy: Order) => void;
|
|
9
10
|
}
|
|
10
|
-
export declare function EnhancedRemoteDummyTable
|
|
11
|
-
export {};
|
|
11
|
+
export declare function EnhancedRemoteDummyTable(props: EnhancedRemoteDummyTableProps): JSX.Element;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export interface HeadCell {
|
|
1
|
+
export type Order = "asc" | "desc";
|
|
2
|
+
export interface HeadCell<T> {
|
|
3
3
|
disablePadding: boolean;
|
|
4
|
-
id:
|
|
4
|
+
id: keyof T;
|
|
5
5
|
label: string;
|
|
6
6
|
numeric: boolean;
|
|
7
7
|
sort: boolean;
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
10
|
-
onRequestSort: (property:
|
|
9
|
+
interface EnhancedTableHeadProps<T> {
|
|
10
|
+
onRequestSort: (property: keyof T) => void;
|
|
11
11
|
order: Order;
|
|
12
|
-
orderBy:
|
|
13
|
-
headCells: HeadCell[];
|
|
12
|
+
orderBy: keyof T;
|
|
13
|
+
headCells: HeadCell<T>[];
|
|
14
14
|
}
|
|
15
|
-
export declare
|
|
15
|
+
export declare const EnhancedTableHead: <T>({ order, orderBy, headCells, onRequestSort, }: EnhancedTableHeadProps<T>) => JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -3,10 +3,10 @@ import { HeadCell, Order } from "./enhanced-table-head";
|
|
|
3
3
|
interface Props<T> {
|
|
4
4
|
readonly data: T[];
|
|
5
5
|
search?: boolean;
|
|
6
|
-
defaultSort:
|
|
6
|
+
defaultSort: keyof T;
|
|
7
7
|
defaultOrder?: Order;
|
|
8
8
|
loading?: boolean;
|
|
9
|
-
columns: HeadCell[];
|
|
9
|
+
columns: HeadCell<T>[];
|
|
10
10
|
children: (data: T[]) => ReactNode;
|
|
11
11
|
}
|
|
12
12
|
export declare const EnhancedTable: {
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { HeadCell, Order } from "./enhanced-table-head";
|
|
2
|
-
export declare const columns: HeadCell[];
|
|
3
|
-
interface Data {
|
|
2
|
+
export declare const columns: HeadCell<Data>[];
|
|
3
|
+
export interface Data {
|
|
4
4
|
id: number;
|
|
5
5
|
name: string;
|
|
6
6
|
startDate: string;
|
|
7
7
|
}
|
|
8
8
|
export declare const data: Data[];
|
|
9
|
-
interface
|
|
9
|
+
export interface TestTableProps {
|
|
10
10
|
data: Data[];
|
|
11
|
-
columns: HeadCell[];
|
|
12
|
-
defaultSort:
|
|
11
|
+
columns: HeadCell<Data>[];
|
|
12
|
+
defaultSort: keyof Data;
|
|
13
13
|
defaultOrder: Order;
|
|
14
14
|
loading: boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare const TestTable: ({ data, columns, defaultOrder, defaultSort, loading }:
|
|
17
|
-
export {};
|
|
16
|
+
export declare const TestTable: ({ data, columns, defaultOrder, defaultSort, loading, }: TestTableProps) => JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { HeadCell, Order } from "../table/enhanced-table";
|
|
2
|
-
import { BasicModelInstance } from "
|
|
2
|
+
import { BasicModelInstance } from "../../generators/generators.model";
|
|
3
3
|
export interface TableRowOption<T extends BasicModelInstance> {
|
|
4
4
|
id: string;
|
|
5
5
|
label: string;
|
|
6
6
|
onClick: (item: T) => void;
|
|
7
7
|
}
|
|
8
8
|
export interface TableListProps<T extends BasicModelInstance> {
|
|
9
|
-
columns: HeadCell[];
|
|
9
|
+
columns: HeadCell<T>[];
|
|
10
10
|
data: T[];
|
|
11
11
|
search?: boolean;
|
|
12
12
|
defaultSort: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { GridProps } from "@mui/material";
|
|
2
2
|
import { FunctionComponent, PropsWithChildren, ReactElement } from "react";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type GroupValueItemProps = PropsWithChildren<Omit<GridProps, "item" | "container"> & {
|
|
4
|
+
bordered?: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export type GroupValueItemComponent = FunctionComponent<GroupValueItemProps>;
|
|
7
|
+
export type GroupValueItemElement = ReactElement<GroupValueItemProps, GroupValueItemComponent>;
|
|
6
8
|
export declare const groupValueItemClasses: {
|
|
7
9
|
root: string;
|
|
8
10
|
};
|
|
@@ -10,6 +12,7 @@ export declare const GroupValueItem: GroupValueItemComponent;
|
|
|
10
12
|
export interface GroupValueCardProps {
|
|
11
13
|
title: string;
|
|
12
14
|
subtitle?: string;
|
|
15
|
+
centered?: boolean;
|
|
13
16
|
children: GroupValueItemElement | GroupValueItemElement[];
|
|
14
17
|
}
|
|
15
|
-
export declare const GroupValueCard: ({ title, subtitle, children }: GroupValueCardProps) => JSX.Element;
|
|
18
|
+
export declare const GroupValueCard: ({ title, subtitle, centered, children }: GroupValueCardProps) => JSX.Element;
|
package/dist/cjs/types/components/value-displays/group-value-card/group-value-card.mock.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { GroupValueCardProps } from "./group-value-card";
|
|
2
|
+
export declare const GroupValueCardDummy: (props: GroupValueCardProps) => JSX.Element;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Name of the displayed value
|
|
4
|
-
*/
|
|
5
|
-
label: string;
|
|
6
|
-
/**
|
|
7
|
-
* Value displayed
|
|
8
|
-
*/
|
|
9
|
-
value: boolean;
|
|
10
|
-
}
|
|
1
|
+
import { BaseValueProps } from "../value-displays.types";
|
|
2
|
+
export type ValueBooleanProps = BaseValueProps<boolean>;
|
|
11
3
|
/**
|
|
12
4
|
* Displays a boolean value with a label
|
|
13
5
|
*/
|
|
14
|
-
export declare const ValueBoolean: ({ label, value }: ValueBooleanProps) => JSX.Element;
|
|
6
|
+
export declare const ValueBoolean: ({ label, value, placeholder, }: ValueBooleanProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./value-content";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const getValueContentLabelId: (label: string) => string;
|
|
3
|
+
export interface ValueContentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Name of the displayed value
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* If defined, a tooltip is going to be added arround the children;
|
|
10
|
+
*/
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Timeout before the tooltip appears when the user hovers the value
|
|
14
|
+
*/
|
|
15
|
+
tooltipEnterDelay?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Component that's going to be renderd under the label
|
|
18
|
+
*/
|
|
19
|
+
children: React.ReactElement<any, any>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Displays a string value with a label
|
|
23
|
+
*/
|
|
24
|
+
export declare const ValueContent: ({ label, tooltip, tooltipEnterDelay, children, }: ValueContentProps) => JSX.Element;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Name of the displayed value
|
|
4
|
-
*/
|
|
5
|
-
label: string;
|
|
6
|
-
/**
|
|
7
|
-
* Value displayed
|
|
8
|
-
*/
|
|
9
|
-
value: Date;
|
|
1
|
+
import { BaseValueProps } from "../value-displays.types";
|
|
2
|
+
export interface ValueDatetimeProps extends BaseValueProps<Date> {
|
|
10
3
|
/**
|
|
11
4
|
* Datetime format
|
|
12
5
|
*/
|
|
@@ -15,4 +8,4 @@ export interface ValueDatetimeProps {
|
|
|
15
8
|
/**
|
|
16
9
|
* Displays a formated datetime with a label
|
|
17
10
|
*/
|
|
18
|
-
export declare const ValueDatetime: ({ label, value, format: fmt }: ValueDatetimeProps) => JSX.Element;
|
|
11
|
+
export declare const ValueDatetime: ({ label, value: valueProp, format: fmt, placeholder, }: ValueDatetimeProps) => JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface BaseValueProps<T> {
|
|
2
|
+
/**
|
|
3
|
+
* Name of the displayed value
|
|
4
|
+
*/
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* Value displayed
|
|
8
|
+
*/
|
|
9
|
+
value?: T;
|
|
10
|
+
/**
|
|
11
|
+
* String rendered if value is undefined
|
|
12
|
+
*/
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DefaultPlaceholder = "-";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./value-image";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseValueProps } from "../value-displays.types";
|
|
2
|
+
export interface ValueImageProps extends BaseValueProps<string> {
|
|
3
|
+
/**
|
|
4
|
+
* Image size
|
|
5
|
+
*/
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Displays a image value with a label
|
|
10
|
+
*/
|
|
11
|
+
export declare const ValueImage: ({ label, value, size }: ValueImageProps) => JSX.Element;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Name of the displayed value
|
|
4
|
-
*/
|
|
5
|
-
label: string;
|
|
6
|
-
/**
|
|
7
|
-
* Value displayed
|
|
8
|
-
*/
|
|
9
|
-
value: string;
|
|
10
|
-
}
|
|
1
|
+
import { BaseValueProps } from "../value-displays.types";
|
|
2
|
+
export type ValueTextProps = BaseValueProps<string>;
|
|
11
3
|
/**
|
|
12
4
|
* Displays a string value with a label
|
|
13
5
|
*/
|
|
14
|
-
export declare const ValueText: ({ label, value }: ValueTextProps) => JSX.Element;
|
|
6
|
+
export declare const ValueText: ({ label, value: valueProp, placeholder, }: ValueTextProps) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicModelInstance, Model } from "./generators.model";
|
|
1
|
+
import { BasicModelInstance, FieldType, Model } from "./generators.model";
|
|
2
2
|
export declare const BirthDateFormat = "dd/MM/yyyy";
|
|
3
3
|
export declare const ReturnTimeFormat = "HH:mm";
|
|
4
4
|
export declare const TradeDateFormat = "dd/MM/yyyy HH:mm";
|
|
@@ -24,5 +24,6 @@ export interface MockInstance {
|
|
|
24
24
|
available: boolean;
|
|
25
25
|
currency: string;
|
|
26
26
|
tradeDate: Date;
|
|
27
|
+
[key: string]: FieldType;
|
|
27
28
|
}
|
|
28
29
|
export declare const createModelInstance: <T extends BasicModelInstance>(model: Model, seed?: number) => T;
|
|
@@ -1,61 +1,77 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MODEL TYPES
|
|
3
|
+
* Types used to specify the model
|
|
4
|
+
*/
|
|
5
|
+
export type ModelFieldTypes = "string" | "number" | "boolean" | "enum" | "multienum" | "date" | "time" | "datetime";
|
|
6
|
+
type Base = {
|
|
2
7
|
id: string;
|
|
3
8
|
description: string;
|
|
4
9
|
name: string;
|
|
5
10
|
listable?: boolean;
|
|
6
11
|
};
|
|
7
|
-
|
|
12
|
+
type Breakpoints = {
|
|
8
13
|
xs?: number;
|
|
9
14
|
sm?: number;
|
|
10
15
|
md?: number;
|
|
11
16
|
lg?: number;
|
|
12
17
|
xl?: number;
|
|
13
18
|
};
|
|
14
|
-
|
|
19
|
+
type StringField = {
|
|
15
20
|
type: "string";
|
|
16
21
|
};
|
|
17
|
-
|
|
22
|
+
type NumberField = {
|
|
18
23
|
type: "number";
|
|
19
24
|
};
|
|
20
|
-
|
|
25
|
+
type BooleanField = {
|
|
21
26
|
type: "boolean";
|
|
22
27
|
};
|
|
23
|
-
|
|
28
|
+
type EnumField = {
|
|
24
29
|
type: "enum";
|
|
25
30
|
value: string[];
|
|
26
31
|
};
|
|
27
|
-
|
|
32
|
+
type MultiEnumField = {
|
|
28
33
|
type: "multienum";
|
|
29
34
|
value: string[];
|
|
30
35
|
};
|
|
31
|
-
|
|
36
|
+
type DateField = {
|
|
32
37
|
type: "date";
|
|
33
38
|
format: string;
|
|
34
|
-
default:
|
|
39
|
+
default: Date;
|
|
35
40
|
};
|
|
36
|
-
|
|
41
|
+
type TimeField = {
|
|
37
42
|
type: "time";
|
|
38
43
|
format: string;
|
|
39
|
-
default:
|
|
44
|
+
default: Date;
|
|
40
45
|
};
|
|
41
|
-
|
|
46
|
+
type DatetimeField = {
|
|
42
47
|
type: "datetime";
|
|
43
48
|
format: string;
|
|
44
|
-
default:
|
|
49
|
+
default: Date;
|
|
45
50
|
};
|
|
46
|
-
|
|
47
|
-
export
|
|
51
|
+
type SingleFields = StringField | NumberField | BooleanField | EnumField | MultiEnumField | DateField | TimeField | DatetimeField;
|
|
52
|
+
export type GroupField = {
|
|
48
53
|
type: "group";
|
|
49
54
|
value: (Base & Breakpoints & SingleFields)[];
|
|
50
55
|
} & Base;
|
|
51
|
-
|
|
52
|
-
export
|
|
53
|
-
export
|
|
56
|
+
type Fields = SingleFields | GroupField;
|
|
57
|
+
export type ModelField = Base & Breakpoints & Fields;
|
|
58
|
+
export type Model = {
|
|
54
59
|
fields: ModelField[];
|
|
55
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* INSTANCE TYPES
|
|
63
|
+
* Types used to represent an instance of a model specification
|
|
64
|
+
*/
|
|
65
|
+
export type BaseFieldType = string | number | boolean | Date;
|
|
66
|
+
export type ArrayFieldType = string[];
|
|
67
|
+
export type SingleFieldType = BaseFieldType | ArrayFieldType;
|
|
68
|
+
export type GroupInstanceType = {
|
|
69
|
+
[key: string]: SingleFieldType;
|
|
70
|
+
};
|
|
71
|
+
export type FieldType = SingleFieldType | GroupInstanceType;
|
|
56
72
|
export interface BasicModelInstance {
|
|
57
73
|
id: string;
|
|
58
|
-
[key: string]:
|
|
74
|
+
[key: string]: FieldType;
|
|
59
75
|
}
|
|
60
|
-
export declare
|
|
76
|
+
export declare const newInstanceFromValuesOrZeroValue: <T extends BasicModelInstance>(model: Model, values?: T | undefined) => T;
|
|
61
77
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BasicModelInstance } from "../generators.model";
|
|
2
2
|
import { AddScreenProps, DetailsScreenProps, ListScreenProps, UpdateScreenProps } from "./screens";
|
|
3
|
-
export
|
|
3
|
+
export type ModelRouterProps<T extends BasicModelInstance> = DetailsScreenProps<T> & ListScreenProps<T> & AddScreenProps<T> & UpdateScreenProps<T>;
|
|
4
4
|
export declare const ModelRouter: <T extends BasicModelInstance>(props: ModelRouterProps<T>) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicModelInstance } from "
|
|
1
|
+
import { BasicModelInstance } from "../../generators.model";
|
|
2
2
|
import { RequestState } from "../model-router.types";
|
|
3
3
|
import { BaseScreenProps } from "./screens.types";
|
|
4
4
|
export interface AddScreenProps<T extends BasicModelInstance> extends BaseScreenProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RequestState } from "../model-router.types";
|
|
2
2
|
import { BaseScreenProps } from "./screens.types";
|
|
3
|
-
import { BasicModelInstance } from "
|
|
3
|
+
import { BasicModelInstance } from "../../generators.model";
|
|
4
4
|
export interface DetailsScreenProps<T extends BasicModelInstance> extends BaseScreenProps {
|
|
5
5
|
/**
|
|
6
6
|
* Callback executed each time we want
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicModelInstance } from "
|
|
1
|
+
import { BasicModelInstance } from "../../generators.model";
|
|
2
2
|
import { RequestState } from "../model-router.types";
|
|
3
3
|
import { BaseScreenProps } from "./screens.types";
|
|
4
4
|
export interface ListScreenProps<T extends BasicModelInstance> extends BaseScreenProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicModelInstance } from "
|
|
1
|
+
import { BasicModelInstance } from "../../generators.model";
|
|
2
2
|
import { RequestState } from "../model-router.types";
|
|
3
3
|
import { BaseScreenProps } from "./screens.types";
|
|
4
4
|
export interface UpdateScreenProps<T extends BasicModelInstance> extends BaseScreenProps {
|