@starasia/admin 1.0.6 → 1.1.0
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/assets/403.d.ts +4 -0
- package/dist/assets/404.d.ts +4 -0
- package/dist/assets/500.d.ts +4 -0
- package/dist/assets/database.d.ts +4 -0
- package/dist/components/ContentLayoutV2/index.d.ts +10 -0
- package/dist/components/DashboardLayout/index.d.ts +2 -1
- package/dist/components/Dialog/ConfirmationDialog.d.ts +25 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/HeaderV2/components/PhotoProfile.d.ts +11 -0
- package/dist/components/HeaderV2/components/UserProfile.d.ts +9 -0
- package/dist/components/HeaderV2/hooks.d.ts +4 -0
- package/dist/components/HeaderV2/index.d.ts +6 -0
- package/dist/components/PageState/EmptyStatePage.d.ts +16 -0
- package/dist/components/PageState/ForbiddenPage.d.ts +7 -0
- package/dist/components/PageState/NotFoundPage.d.ts +7 -0
- package/dist/components/PageState/ServerErrorPage.d.ts +7 -0
- package/dist/components/PageState/index.d.ts +4 -0
- package/dist/components/Sidebar/components/Group.d.ts +1 -1
- package/dist/components/Sidebar/components/Item.d.ts +1 -1
- package/dist/components/Sidebar/components/Wrapper.d.ts +1 -1
- package/dist/components/SidebarV2/components/Group.d.ts +7 -0
- package/dist/components/SidebarV2/components/Item.d.ts +7 -0
- package/dist/components/SidebarV2/components/Wrapper.d.ts +7 -0
- package/dist/components/SidebarV2/index.d.ts +7 -0
- package/dist/components/VerticalField/index.d.ts +13 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/entries/App/context.d.ts +1 -0
- package/dist/entries/App/index.d.ts +3 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useRouteInfo.d.ts +55 -0
- package/dist/hooks/useRouteParams.d.ts +8 -2
- package/dist/index.cjs.js +12664 -12
- package/dist/index.es.js +52087 -5407
- package/dist/index.umd.js +12664 -12
- package/dist/style.css +1 -1
- package/dist/types/form.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/formatter.d.ts +1 -0
- package/dist/utils/styles.d.ts +1 -0
- package/dist/utils/validator.d.ts +1 -0
- package/package.json +15 -18
- package/README.md +0 -124
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BoxProps } from '@starasia/box';
|
|
2
|
+
import { default as React, PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ContentLayoutProps extends PropsWithChildren {
|
|
5
|
+
sidebarWidth?: string | number;
|
|
6
|
+
overflowContent?: BoxProps["overflow"];
|
|
7
|
+
isPadding?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const ContentLayoutV2: React.MemoExoticComponent<({ children, sidebarWidth, overflowContent, isPadding, }: ContentLayoutProps) => React.JSX.Element>;
|
|
10
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import { BoxProps } from '@starasia/box';
|
|
|
5
5
|
import { MenuSelectButtonProps } from '../Header/MenuSelectButton';
|
|
6
6
|
|
|
7
7
|
interface DashboardLayoutProps extends PropsWithChildren {
|
|
8
|
+
variant?: "default" | "simple";
|
|
8
9
|
userData?: HeaderUserData;
|
|
9
10
|
menus?: SidebarMenus;
|
|
10
11
|
menuBottom?: SidebarMenuItem[];
|
|
@@ -29,5 +30,5 @@ interface DashboardLayoutProps extends PropsWithChildren {
|
|
|
29
30
|
paddingContent?: boolean;
|
|
30
31
|
bottomDrawerContent?: React.ReactNode;
|
|
31
32
|
}
|
|
32
|
-
export declare const DashboardLayout: React.MemoExoticComponent<({ userData, menus, menuBottom, children, logo, headerButtons, onClickLogout, sidebar, overflowContent, logoutButton, headerButtonsLeft, menuSelectButtons, menuSelectCustom, paddingContent, bottomDrawerContent, }: DashboardLayoutProps) => React.JSX.Element>;
|
|
33
|
+
export declare const DashboardLayout: React.MemoExoticComponent<({ userData, menus, menuBottom, children, logo, headerButtons, onClickLogout, sidebar, overflowContent, logoutButton, headerButtonsLeft, menuSelectButtons, menuSelectCustom, paddingContent, bottomDrawerContent, variant: variantProp, }: DashboardLayoutProps) => React.JSX.Element>;
|
|
33
34
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BoxProps } from '@starasia/box';
|
|
2
|
+
import { ButtonProps } from '@starasia/button';
|
|
3
|
+
import { IDialogTitle } from '@starasia/dialog';
|
|
4
|
+
import { default as React } from 'react';
|
|
5
|
+
|
|
6
|
+
interface DialogTitleProps extends Omit<IDialogTitle, "children"> {
|
|
7
|
+
}
|
|
8
|
+
type TConfirmationDialog = {
|
|
9
|
+
customMinWidth?: string;
|
|
10
|
+
key?: string;
|
|
11
|
+
isShow: boolean;
|
|
12
|
+
onHide: () => void;
|
|
13
|
+
title: string | React.ReactNode;
|
|
14
|
+
description: string | React.ReactNode;
|
|
15
|
+
onConfirm: () => void;
|
|
16
|
+
onCancel?: () => void;
|
|
17
|
+
dialogTitleProps?: DialogTitleProps;
|
|
18
|
+
buttonConfirmProps?: ButtonProps;
|
|
19
|
+
titleConfirmBtn?: string;
|
|
20
|
+
titleCancelBtn?: string;
|
|
21
|
+
containerConfirmBtnProps?: Omit<BoxProps, "children">;
|
|
22
|
+
wrapperConfirmBtnProps?: Omit<BoxProps, "children">;
|
|
23
|
+
};
|
|
24
|
+
export declare const ConfirmationDialog: (props: TConfirmationDialog) => React.JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConfirmationDialog';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BoxProps } from '@starasia/box';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
width: BoxProps["width"];
|
|
6
|
+
height: BoxProps["height"];
|
|
7
|
+
photoURL?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const PhotoProfile: ({ width, height, photoURL, name }: Props) => React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { HeaderProps } from '../Header';
|
|
3
|
+
|
|
4
|
+
export interface HeaderV2Props extends HeaderProps {
|
|
5
|
+
}
|
|
6
|
+
export declare function HeaderV2({ userData, onClickLogout, logo, buttons, logoutButton, menuSelectButtons, menuSelectCustom, bottomDrawerContent, }: HeaderProps): React.JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React, ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface EmptyStateProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
children: Array<string>;
|
|
6
|
+
onClickAction?: () => void;
|
|
7
|
+
variant?: "primary" | "secondary" | "success";
|
|
8
|
+
variantTitle?: "success";
|
|
9
|
+
leftIcon?: ReactElement;
|
|
10
|
+
childrenButton?: ReactNode;
|
|
11
|
+
showButton?: boolean;
|
|
12
|
+
customHeight?: string;
|
|
13
|
+
customIcon?: ReactElement;
|
|
14
|
+
}
|
|
15
|
+
export declare const EmptyStatePage: React.FC<EmptyStateProps>;
|
|
16
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React, PropsWithChildren } from 'react';
|
|
2
2
|
import { BoxProps } from '@starasia/box';
|
|
3
3
|
|
|
4
|
-
interface GroupProps extends PropsWithChildren {
|
|
4
|
+
export interface GroupProps extends PropsWithChildren {
|
|
5
5
|
border?: boolean;
|
|
6
6
|
paddingTop?: BoxProps["paddingTop"];
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren, default as React } from 'react';
|
|
2
2
|
import { SidebarMenuItem } from '../types';
|
|
3
3
|
|
|
4
|
-
interface WrapperProps extends PropsWithChildren {
|
|
4
|
+
export interface WrapperProps extends PropsWithChildren {
|
|
5
5
|
show?: boolean;
|
|
6
6
|
maxWidth?: React.CSSProperties["maxWidth"];
|
|
7
7
|
menuBottom?: SidebarMenuItem[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React, PropsWithChildren } from 'react';
|
|
2
|
+
import { GroupProps } from '../../Sidebar/components/Group';
|
|
3
|
+
|
|
4
|
+
interface GroupPropsV2 extends PropsWithChildren, GroupProps {
|
|
5
|
+
}
|
|
6
|
+
declare const GroupV2: React.MemoExoticComponent<({ children, border, paddingTop }: GroupPropsV2) => React.JSX.Element>;
|
|
7
|
+
export default GroupV2;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ItemProps } from '../../Sidebar/components/Item';
|
|
3
|
+
|
|
4
|
+
interface ItemPropsV2 extends ItemProps {
|
|
5
|
+
}
|
|
6
|
+
declare const ItemV2: React.MemoExoticComponent<({ to, title, collapse, onHide, maxWidth, icon }: ItemPropsV2) => React.JSX.Element>;
|
|
7
|
+
export default ItemV2;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren, default as React } from 'react';
|
|
2
|
+
import { WrapperProps } from '../../Sidebar/components/Wrapper';
|
|
3
|
+
|
|
4
|
+
interface WrapperV2Props extends PropsWithChildren, WrapperProps {
|
|
5
|
+
}
|
|
6
|
+
declare const WrapperV2: React.MemoExoticComponent<({ show, children, maxWidth, menuBottom }: WrapperV2Props) => React.JSX.Element>;
|
|
7
|
+
export default WrapperV2;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SidebarProps } from '../Sidebar';
|
|
3
|
+
import { HeaderProps } from '../Header';
|
|
4
|
+
|
|
5
|
+
export interface SidebarV2Props extends SidebarProps, Pick<HeaderProps, "logo"> {
|
|
6
|
+
}
|
|
7
|
+
export declare const SidebarV2: React.MemoExoticComponent<({ menus, maxWidth, header, menuBottom, logo, }: SidebarV2Props) => React.JSX.Element>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconName } from '@starasia/icon';
|
|
3
|
+
|
|
4
|
+
export type VerticalFieldProps = {
|
|
5
|
+
fields: FieldProps[];
|
|
6
|
+
};
|
|
7
|
+
export declare const VerticalField: ({ fields }: VerticalFieldProps) => React.JSX.Element;
|
|
8
|
+
type FieldProps = {
|
|
9
|
+
title: string;
|
|
10
|
+
icon?: IconName;
|
|
11
|
+
value: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -12,5 +12,6 @@ export interface AppContextValue {
|
|
|
12
12
|
menuSelectButtons?: MenuSelectButtonProps[];
|
|
13
13
|
menuSelectCustom?: React.ReactNode;
|
|
14
14
|
bottomDrawerContent?: React.ReactNode;
|
|
15
|
+
variant?: "default" | "simple";
|
|
15
16
|
}
|
|
16
17
|
export declare const AppContext: import('react').Context<AppContextValue>;
|
|
@@ -15,8 +15,9 @@ interface AppProps extends PropsWithChildren {
|
|
|
15
15
|
menuSelectButtons?: MenuSelectButtonProps[];
|
|
16
16
|
menuSelectCustom?: React.ReactNode;
|
|
17
17
|
bottomDrawerContent?: React.ReactNode;
|
|
18
|
+
variant?: "default" | "simple";
|
|
18
19
|
}
|
|
19
|
-
export declare const AppComponent: ({ router, menus, menuBottom, logo, initialUserData, theme, headerButtons, headerButtonsLeft, menuSelectButtons, menuSelectCustom, bottomDrawerContent, }: AppProps) => React.JSX.Element;
|
|
20
|
-
export declare const App: React.MemoExoticComponent<({ router, menus, menuBottom, logo, initialUserData, theme, headerButtons, headerButtonsLeft, menuSelectButtons, menuSelectCustom, bottomDrawerContent, }: AppProps) => React.JSX.Element>;
|
|
20
|
+
export declare const AppComponent: ({ router, menus, menuBottom, logo, initialUserData, theme, headerButtons, headerButtonsLeft, menuSelectButtons, menuSelectCustom, bottomDrawerContent, variant, }: AppProps) => React.JSX.Element;
|
|
21
|
+
export declare const App: React.MemoExoticComponent<({ router, menus, menuBottom, logo, initialUserData, theme, headerButtons, headerButtonsLeft, menuSelectButtons, menuSelectCustom, bottomDrawerContent, variant, }: AppProps) => React.JSX.Element>;
|
|
21
22
|
export * from './hooks';
|
|
22
23
|
export * from './context';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useSearchParams, Location } from 'react-router';
|
|
2
|
+
|
|
3
|
+
type UseRouteInfoReturn = {
|
|
4
|
+
setSearchParams: ReturnType<typeof useSearchParams>[1];
|
|
5
|
+
searchParams: URLSearchParams;
|
|
6
|
+
searchQueries: Record<string, string>;
|
|
7
|
+
isHasQuery: (key: string, value: string) => boolean;
|
|
8
|
+
getQueryParam: (key: string) => string | null;
|
|
9
|
+
getRouteParam: (key: string) => string | undefined;
|
|
10
|
+
params: Record<string, string | undefined>;
|
|
11
|
+
location: Location;
|
|
12
|
+
id?: string;
|
|
13
|
+
hasId: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Custom hook untuk mengakses dan memodifikasi **route params** (`useParams`)
|
|
17
|
+
* dan **query params** (`useSearchParams`) dalam satu utilitas.
|
|
18
|
+
*
|
|
19
|
+
* Cocok digunakan ketika ingin membaca parameter dari URL
|
|
20
|
+
* (misalnya `/users/:id?tab=profile`) secara konsisten.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Route: /users/123?tab=profile&filter=active
|
|
24
|
+
* const {
|
|
25
|
+
* id,
|
|
26
|
+
* hasId,
|
|
27
|
+
* getRouteParam,
|
|
28
|
+
* getQueryParam,
|
|
29
|
+
* isHasQuery,
|
|
30
|
+
* setSearchParams,
|
|
31
|
+
* searchQueries,
|
|
32
|
+
* location
|
|
33
|
+
* } = useRouteInfo();
|
|
34
|
+
*
|
|
35
|
+
* console.log(id); // "123"
|
|
36
|
+
* console.log(hasId); // true
|
|
37
|
+
* console.log(getRouteParam("id")); // "123"
|
|
38
|
+
*
|
|
39
|
+
* // query params
|
|
40
|
+
* console.log(getQueryParam("tab")); // "profile"
|
|
41
|
+
* console.log(isHasQuery("filter", "active")); // true
|
|
42
|
+
*
|
|
43
|
+
* // searchQueries → object hasil parsing query string
|
|
44
|
+
* console.log(searchQueries);
|
|
45
|
+
* // { tab: "profile", filter: "active" }
|
|
46
|
+
*
|
|
47
|
+
* // Update query param
|
|
48
|
+
* setSearchParams({ tab: "settings" });
|
|
49
|
+
*
|
|
50
|
+
* // location
|
|
51
|
+
* console.log(location); // { pathname: "/users/123", search: "?tab=profile&filter=active", ... }
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
export declare const useRouteInfo: () => UseRouteInfoReturn;
|
|
55
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useSearchParams } from 'react-router
|
|
1
|
+
import { useSearchParams, Location } from 'react-router';
|
|
2
2
|
|
|
3
3
|
type UseRouteParamsReturn = {
|
|
4
4
|
setSearchParams: ReturnType<typeof useSearchParams>[1];
|
|
@@ -8,6 +8,7 @@ type UseRouteParamsReturn = {
|
|
|
8
8
|
getQueryParam: (key: string) => string | null;
|
|
9
9
|
getRouteParam: (key: string) => string | undefined;
|
|
10
10
|
params: Record<string, string | undefined>;
|
|
11
|
+
location: Location;
|
|
11
12
|
id?: string;
|
|
12
13
|
hasId: boolean;
|
|
13
14
|
};
|
|
@@ -27,7 +28,8 @@ type UseRouteParamsReturn = {
|
|
|
27
28
|
* getQueryParam,
|
|
28
29
|
* isHasQuery,
|
|
29
30
|
* setSearchParams,
|
|
30
|
-
* searchQueries
|
|
31
|
+
* searchQueries,
|
|
32
|
+
* location
|
|
31
33
|
* } = useRouteParams();
|
|
32
34
|
*
|
|
33
35
|
* console.log(id); // "123"
|
|
@@ -44,6 +46,10 @@ type UseRouteParamsReturn = {
|
|
|
44
46
|
*
|
|
45
47
|
* // Update query param
|
|
46
48
|
* setSearchParams({ tab: "settings" });
|
|
49
|
+
*
|
|
50
|
+
* // location
|
|
51
|
+
* console.log(location); // { pathname: "/users/123", search: "?tab=profile&filter=active", ... }
|
|
52
|
+
*
|
|
47
53
|
*/
|
|
48
54
|
export declare const useRouteParams: () => UseRouteParamsReturn;
|
|
49
55
|
export {};
|