@starasia/admin 1.0.6 → 1.2.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.
Files changed (42) hide show
  1. package/dist/assets/403.d.ts +4 -0
  2. package/dist/assets/404.d.ts +4 -0
  3. package/dist/assets/500.d.ts +4 -0
  4. package/dist/assets/database.d.ts +4 -0
  5. package/dist/components/ContentLayoutV2/index.d.ts +10 -0
  6. package/dist/components/DashboardLayout/index.d.ts +2 -1
  7. package/dist/components/Dialog/ConfirmationDialog.d.ts +25 -0
  8. package/dist/components/Dialog/index.d.ts +1 -0
  9. package/dist/components/HeaderV2/components/PhotoProfile.d.ts +11 -0
  10. package/dist/components/HeaderV2/components/UserProfile.d.ts +9 -0
  11. package/dist/components/HeaderV2/hooks.d.ts +4 -0
  12. package/dist/components/HeaderV2/index.d.ts +6 -0
  13. package/dist/components/PageState/EmptyStatePage.d.ts +16 -0
  14. package/dist/components/PageState/ForbiddenPage.d.ts +7 -0
  15. package/dist/components/PageState/NotFoundPage.d.ts +7 -0
  16. package/dist/components/PageState/ServerErrorPage.d.ts +7 -0
  17. package/dist/components/PageState/index.d.ts +4 -0
  18. package/dist/components/Sidebar/components/Group.d.ts +1 -1
  19. package/dist/components/Sidebar/components/Item.d.ts +1 -1
  20. package/dist/components/Sidebar/components/Wrapper.d.ts +1 -1
  21. package/dist/components/SidebarV2/components/Group.d.ts +7 -0
  22. package/dist/components/SidebarV2/components/Item.d.ts +7 -0
  23. package/dist/components/SidebarV2/components/Wrapper.d.ts +7 -0
  24. package/dist/components/SidebarV2/index.d.ts +7 -0
  25. package/dist/components/VerticalField/index.d.ts +13 -0
  26. package/dist/components/index.d.ts +3 -0
  27. package/dist/entries/App/context.d.ts +1 -0
  28. package/dist/entries/App/index.d.ts +3 -2
  29. package/dist/hooks/index.d.ts +1 -0
  30. package/dist/hooks/useRouteInfo.d.ts +55 -0
  31. package/dist/hooks/useRouteParams.d.ts +8 -2
  32. package/dist/index.cjs.js +12645 -12
  33. package/dist/index.es.js +52023 -5410
  34. package/dist/index.umd.js +12645 -12
  35. package/dist/style.css +1 -1
  36. package/dist/types/form.d.ts +4 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/utils/formatter.d.ts +1 -0
  39. package/dist/utils/styles.d.ts +1 -0
  40. package/dist/utils/validator.d.ts +1 -0
  41. package/package.json +45 -48
  42. package/README.md +0 -124
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { IconProps } from '@starasia/icon';
3
+
4
+ export declare function ForbiddenImage({ width, height }: IconProps): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { IconProps } from '@starasia/icon';
2
+ import { default as React } from 'react';
3
+
4
+ export declare function NotFoundImage({ width, height }: IconProps): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { IconProps } from '@starasia/icon';
3
+
4
+ export declare function ServerErrorImage({ width, height }: IconProps): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { IconProps } from '@starasia/icon';
2
+ import { default as React } from 'react';
3
+
4
+ export declare function DatabaseImage({ width, height }: IconProps): React.JSX.Element;
@@ -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,9 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ photoURL?: string;
5
+ name?: string;
6
+ email?: string;
7
+ };
8
+ export declare const UserProfile: React.MemoExoticComponent<({ name, email, photoURL }: Props) => React.JSX.Element>;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const useHeaderState: () => {
2
+ mobileLogout: boolean;
3
+ toggleMobileLogout: () => void;
4
+ };
@@ -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 {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ onClick?: () => void;
5
+ };
6
+ export declare function ForbiddenPage({ onClick }: Props): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ onClick?: () => void;
5
+ };
6
+ export declare function NotFoundPage({ onClick }: Props): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ onClick?: () => void;
5
+ };
6
+ export declare function ServerErrorPage({ onClick }: Props): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './EmptyStatePage';
2
+ export * from './NotFoundPage';
3
+ export * from './ForbiddenPage';
4
+ export * from './ServerErrorPage';
@@ -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 { IconName } from '@starasia/icon/dist/types';
2
2
  import { default as React } from 'react';
3
3
 
4
- interface ItemProps {
4
+ export interface ItemProps {
5
5
  to: string;
6
6
  title: string;
7
7
  icon: IconName;
@@ -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 {};
@@ -21,3 +21,6 @@ export * from './ScrollToTopButton';
21
21
  export * from './InputImage';
22
22
  export * from './AsideBar';
23
23
  export * from './FloatingFooter';
24
+ export * from './VerticalField';
25
+ export * from './PageState';
26
+ export * from './Dialog';
@@ -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';
@@ -1,4 +1,5 @@
1
1
  export * from './useTabState';
2
2
  export * from './useDynamicTitle';
3
3
  export * from './useRouteParams';
4
+ export * from './useRouteInfo';
4
5
  export * from './useAuthRole';
@@ -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-dom';
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 {};