@compill/admin 1.0.69 → 1.0.71

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/index.cjs.js CHANGED
@@ -2840,61 +2840,64 @@ function Content(_a) {
2840
2840
  }));
2841
2841
  }
2842
2842
 
2843
- /**
2844
- *
2845
- *
2846
- */
2847
- function Menu(_a) {
2843
+ function SelectedIndicator({
2844
+ darkMode
2845
+ }) {
2846
+ return jsxRuntime.jsx("div", {
2847
+ position: "absolute",
2848
+ bgColor: darkMode ? "white" : "black",
2849
+ bgOpacity: "90",
2850
+ w: "0.5",
2851
+ h: "6",
2852
+ top: "1.5",
2853
+ start: "-4"
2854
+ });
2855
+ }
2856
+
2857
+ function MenuButton(_a) {
2848
2858
  var {
2859
+ depth,
2849
2860
  darkMode,
2850
- config,
2851
- useNextRouter
2861
+ icon,
2862
+ selected,
2863
+ children
2852
2864
  } = _a,
2853
- props = __rest$1(_a, ["darkMode", "config", "useNextRouter"]);
2854
- const Comp = useNextRouter ? NextMenuItem : MenuItem;
2855
- return jsxRuntime.jsx("ul", Object.assign({}, props, {
2856
- children: config.map((item, index) => {
2857
- if (item.type == "divider") return jsxRuntime.jsx(Divider, {
2858
- title: item.label
2859
- }, index);
2860
- if (item.type == "item") {
2861
- return jsxRuntime.jsx(Comp, {
2862
- icon: item.icon,
2863
- path: item.path,
2864
- depth: 0,
2865
- darkMode: darkMode,
2866
- subMenu: item.children,
2867
- children: item.label
2868
- }, index);
2869
- }
2870
- })
2865
+ props = __rest$1(_a, ["depth", "darkMode", "icon", "selected", "children"]);
2866
+ return jsxRuntime.jsxs(ui.Button, Object.assign({
2867
+ as: "li",
2868
+ minH: "8",
2869
+ ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
2870
+ p: "2",
2871
+ font: "title",
2872
+ textColor: darkMode ? "white" : "black",
2873
+ fontWeight: "600",
2874
+ rounded: "lg",
2875
+ textSize: "sm",
2876
+ variant: "borderless",
2877
+ hover_bgColor: darkMode ? "white" : "black",
2878
+ hover_bgOpacity: "10",
2879
+ hover_textColor: darkMode ? "white" : "zinc-800",
2880
+ cursor: "pointer",
2881
+ dflex: true,
2882
+ alignItems: "center",
2883
+ gap: "3"
2884
+ }, props, {
2885
+ children: [icon && jsxRuntime.jsx(ui.Icon, {
2886
+ path: icon,
2887
+ opacity: selected ? "100" : "60"
2888
+ }), children]
2871
2889
  }));
2872
2890
  }
2873
- function Divider({
2874
- title
2875
- }) {
2876
- return jsxRuntime.jsx("div", {
2877
- px: "2",
2878
- mt: "5",
2879
- mb: "2",
2880
- opacity: "75",
2881
- textTransform: "capitalize",
2882
- letterSpacing: "widest",
2883
- fontWeight: "700",
2884
- textSize: "xs",
2885
- children: title
2886
- });
2887
- }
2891
+
2888
2892
  function MenuItem(_a) {
2889
2893
  var {
2890
2894
  icon,
2891
2895
  path,
2892
2896
  depth,
2893
2897
  darkMode,
2894
- subMenu,
2895
- children
2898
+ subMenu
2896
2899
  } = _a,
2897
- props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
2900
+ props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
2898
2901
  const location = reactRouterDom.useLocation();
2899
2902
  const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
2900
2903
  const match = reactRouterDom.useMatch("/" + path) != null;
@@ -2923,16 +2926,16 @@ function MenuItem(_a) {
2923
2926
  }, index))]
2924
2927
  });
2925
2928
  }
2929
+
2926
2930
  function NextMenuItem(_a) {
2927
2931
  var {
2928
2932
  icon,
2929
2933
  path,
2930
2934
  depth,
2931
2935
  darkMode,
2932
- subMenu,
2933
- children
2936
+ subMenu
2934
2937
  } = _a,
2935
- props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
2938
+ props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
2936
2939
  const {
2937
2940
  pathname
2938
2941
  } = router.useRouter();
@@ -2962,51 +2965,50 @@ function NextMenuItem(_a) {
2962
2965
  }, index))]
2963
2966
  });
2964
2967
  }
2965
- function MenuButton(_a) {
2968
+
2969
+ /**
2970
+ *
2971
+ *
2972
+ */
2973
+ function Menu(_a) {
2966
2974
  var {
2967
- depth,
2968
2975
  darkMode,
2969
- icon,
2970
- selected,
2971
- children
2976
+ config,
2977
+ useNextRouter
2972
2978
  } = _a,
2973
- props = __rest$1(_a, ["depth", "darkMode", "icon", "selected", "children"]);
2974
- return jsxRuntime.jsxs(ui.Button, Object.assign({
2975
- as: "li",
2976
- minH: "8",
2977
- ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
2978
- p: "2",
2979
- font: "title",
2980
- textColor: darkMode ? "white" : "black",
2981
- fontWeight: "600",
2982
- rounded: "lg",
2983
- textSize: "sm",
2984
- variant: "borderless",
2985
- hover_bgColor: darkMode ? "white" : "black",
2986
- hover_bgOpacity: "10",
2987
- hover_textColor: darkMode ? "white" : "zinc-800",
2988
- cursor: "pointer",
2989
- dflex: true,
2990
- alignItems: "center",
2991
- gap: "3"
2992
- }, props, {
2993
- children: [icon && jsxRuntime.jsx(ui.Icon, {
2994
- path: icon,
2995
- opacity: selected ? "100" : "60"
2996
- }), children]
2979
+ props = __rest$1(_a, ["darkMode", "config", "useNextRouter"]);
2980
+ const Comp = useNextRouter ? NextMenuItem : MenuItem;
2981
+ return jsxRuntime.jsx("ul", Object.assign({}, props, {
2982
+ children: config.map((item, index) => {
2983
+ if (item.type == "divider") return jsxRuntime.jsx(Divider, {
2984
+ title: item.label
2985
+ }, index);
2986
+ if (item.type == "item") {
2987
+ return jsxRuntime.jsx(Comp, {
2988
+ icon: item.icon,
2989
+ path: item.path,
2990
+ depth: 0,
2991
+ darkMode: darkMode,
2992
+ subMenu: item.children,
2993
+ children: item.label
2994
+ }, index);
2995
+ }
2996
+ })
2997
2997
  }));
2998
2998
  }
2999
- function SelectedIndicator({
3000
- darkMode
2999
+ function Divider({
3000
+ title
3001
3001
  }) {
3002
3002
  return jsxRuntime.jsx("div", {
3003
- position: "absolute",
3004
- bgColor: darkMode ? "white" : "black",
3005
- bgOpacity: "90",
3006
- w: "0.5",
3007
- h: "6",
3008
- top: "1.5",
3009
- start: "-4"
3003
+ px: "2",
3004
+ mt: "5",
3005
+ mb: "2",
3006
+ opacity: "75",
3007
+ textTransform: "capitalize",
3008
+ letterSpacing: "widest",
3009
+ fontWeight: "700",
3010
+ textSize: "xs",
3011
+ children: title
3010
3012
  });
3011
3013
  }
3012
3014
 
package/index.esm.js CHANGED
@@ -2830,61 +2830,64 @@ function Content(_a) {
2830
2830
  }));
2831
2831
  }
2832
2832
 
2833
- /**
2834
- *
2835
- *
2836
- */
2837
- function Menu(_a) {
2833
+ function SelectedIndicator({
2834
+ darkMode
2835
+ }) {
2836
+ return jsx("div", {
2837
+ position: "absolute",
2838
+ bgColor: darkMode ? "white" : "black",
2839
+ bgOpacity: "90",
2840
+ w: "0.5",
2841
+ h: "6",
2842
+ top: "1.5",
2843
+ start: "-4"
2844
+ });
2845
+ }
2846
+
2847
+ function MenuButton(_a) {
2838
2848
  var {
2849
+ depth,
2839
2850
  darkMode,
2840
- config,
2841
- useNextRouter
2851
+ icon,
2852
+ selected,
2853
+ children
2842
2854
  } = _a,
2843
- props = __rest$1(_a, ["darkMode", "config", "useNextRouter"]);
2844
- const Comp = useNextRouter ? NextMenuItem : MenuItem;
2845
- return jsx("ul", Object.assign({}, props, {
2846
- children: config.map((item, index) => {
2847
- if (item.type == "divider") return jsx(Divider, {
2848
- title: item.label
2849
- }, index);
2850
- if (item.type == "item") {
2851
- return jsx(Comp, {
2852
- icon: item.icon,
2853
- path: item.path,
2854
- depth: 0,
2855
- darkMode: darkMode,
2856
- subMenu: item.children,
2857
- children: item.label
2858
- }, index);
2859
- }
2860
- })
2855
+ props = __rest$1(_a, ["depth", "darkMode", "icon", "selected", "children"]);
2856
+ return jsxs(Button, Object.assign({
2857
+ as: "li",
2858
+ minH: "8",
2859
+ ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
2860
+ p: "2",
2861
+ font: "title",
2862
+ textColor: darkMode ? "white" : "black",
2863
+ fontWeight: "600",
2864
+ rounded: "lg",
2865
+ textSize: "sm",
2866
+ variant: "borderless",
2867
+ hover_bgColor: darkMode ? "white" : "black",
2868
+ hover_bgOpacity: "10",
2869
+ hover_textColor: darkMode ? "white" : "zinc-800",
2870
+ cursor: "pointer",
2871
+ dflex: true,
2872
+ alignItems: "center",
2873
+ gap: "3"
2874
+ }, props, {
2875
+ children: [icon && jsx(Icon, {
2876
+ path: icon,
2877
+ opacity: selected ? "100" : "60"
2878
+ }), children]
2861
2879
  }));
2862
2880
  }
2863
- function Divider({
2864
- title
2865
- }) {
2866
- return jsx("div", {
2867
- px: "2",
2868
- mt: "5",
2869
- mb: "2",
2870
- opacity: "75",
2871
- textTransform: "capitalize",
2872
- letterSpacing: "widest",
2873
- fontWeight: "700",
2874
- textSize: "xs",
2875
- children: title
2876
- });
2877
- }
2881
+
2878
2882
  function MenuItem(_a) {
2879
2883
  var {
2880
2884
  icon,
2881
2885
  path,
2882
2886
  depth,
2883
2887
  darkMode,
2884
- subMenu,
2885
- children
2888
+ subMenu
2886
2889
  } = _a,
2887
- props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
2890
+ props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
2888
2891
  const location = useLocation();
2889
2892
  const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
2890
2893
  const match = useMatch("/" + path) != null;
@@ -2913,16 +2916,16 @@ function MenuItem(_a) {
2913
2916
  }, index))]
2914
2917
  });
2915
2918
  }
2919
+
2916
2920
  function NextMenuItem(_a) {
2917
2921
  var {
2918
2922
  icon,
2919
2923
  path,
2920
2924
  depth,
2921
2925
  darkMode,
2922
- subMenu,
2923
- children
2926
+ subMenu
2924
2927
  } = _a,
2925
- props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
2928
+ props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
2926
2929
  const {
2927
2930
  pathname
2928
2931
  } = useRouter();
@@ -2952,51 +2955,50 @@ function NextMenuItem(_a) {
2952
2955
  }, index))]
2953
2956
  });
2954
2957
  }
2955
- function MenuButton(_a) {
2958
+
2959
+ /**
2960
+ *
2961
+ *
2962
+ */
2963
+ function Menu(_a) {
2956
2964
  var {
2957
- depth,
2958
2965
  darkMode,
2959
- icon,
2960
- selected,
2961
- children
2966
+ config,
2967
+ useNextRouter
2962
2968
  } = _a,
2963
- props = __rest$1(_a, ["depth", "darkMode", "icon", "selected", "children"]);
2964
- return jsxs(Button, Object.assign({
2965
- as: "li",
2966
- minH: "8",
2967
- ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
2968
- p: "2",
2969
- font: "title",
2970
- textColor: darkMode ? "white" : "black",
2971
- fontWeight: "600",
2972
- rounded: "lg",
2973
- textSize: "sm",
2974
- variant: "borderless",
2975
- hover_bgColor: darkMode ? "white" : "black",
2976
- hover_bgOpacity: "10",
2977
- hover_textColor: darkMode ? "white" : "zinc-800",
2978
- cursor: "pointer",
2979
- dflex: true,
2980
- alignItems: "center",
2981
- gap: "3"
2982
- }, props, {
2983
- children: [icon && jsx(Icon, {
2984
- path: icon,
2985
- opacity: selected ? "100" : "60"
2986
- }), children]
2969
+ props = __rest$1(_a, ["darkMode", "config", "useNextRouter"]);
2970
+ const Comp = useNextRouter ? NextMenuItem : MenuItem;
2971
+ return jsx("ul", Object.assign({}, props, {
2972
+ children: config.map((item, index) => {
2973
+ if (item.type == "divider") return jsx(Divider, {
2974
+ title: item.label
2975
+ }, index);
2976
+ if (item.type == "item") {
2977
+ return jsx(Comp, {
2978
+ icon: item.icon,
2979
+ path: item.path,
2980
+ depth: 0,
2981
+ darkMode: darkMode,
2982
+ subMenu: item.children,
2983
+ children: item.label
2984
+ }, index);
2985
+ }
2986
+ })
2987
2987
  }));
2988
2988
  }
2989
- function SelectedIndicator({
2990
- darkMode
2989
+ function Divider({
2990
+ title
2991
2991
  }) {
2992
2992
  return jsx("div", {
2993
- position: "absolute",
2994
- bgColor: darkMode ? "white" : "black",
2995
- bgOpacity: "90",
2996
- w: "0.5",
2997
- h: "6",
2998
- top: "1.5",
2999
- start: "-4"
2993
+ px: "2",
2994
+ mt: "5",
2995
+ mb: "2",
2996
+ opacity: "75",
2997
+ textTransform: "capitalize",
2998
+ letterSpacing: "widest",
2999
+ fontWeight: "700",
3000
+ textSize: "xs",
3001
+ children: title
3000
3002
  });
3001
3003
  }
3002
3004
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }
package/src/index.d.ts CHANGED
@@ -20,7 +20,8 @@ export * from "./lib/json/types/TabbedView";
20
20
  export * from "./lib/json/types/TableView";
21
21
  export * from "./lib/layout/AdminLayout";
22
22
  export * from "./lib/layout/ButtonBar";
23
- export * from "./lib/layout/Menu";
23
+ export * from "./lib/layout/menu/Menu";
24
+ export * from "./lib/layout/menu/MenuConfig";
24
25
  export * from "./lib/modal/AttachDialog";
25
26
  export * from "./lib/modal/FormActionDialog";
26
27
  export * from "./lib/page/PageContainer";
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Color, ParentComponent, SoperioComponent } from "@soperio/react";
3
- import { MenuConfig } from "./Menu";
3
+ import { MenuConfig } from "./menu/MenuConfig";
4
4
  interface LayoutProps extends SoperioComponent, ParentComponent {
5
5
  color: Color;
6
6
  darkMode?: boolean;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Color, ParentComponent, SoperioComponent } from "@soperio/react";
3
- import { MenuConfig } from "./Menu";
3
+ import { MenuConfig } from "./menu/MenuConfig";
4
4
  interface SidebarProps extends SoperioComponent, ParentComponent {
5
5
  show?: boolean;
6
6
  color: Color;
@@ -1,26 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { ParentComponent, SoperioComponent } from "@soperio/react";
3
+ import { MenuConfig } from "./MenuConfig";
3
4
  export interface MenuProps extends SoperioComponent, ParentComponent {
4
5
  darkMode?: boolean;
5
6
  config: MenuConfig;
6
7
  useNextRouter?: boolean;
7
8
  }
8
- export type MenuConfig = MenuItems;
9
- type MenuItems = (MenuItem | MenuDivider)[];
10
- export type MenuItem = {
11
- type: "item";
12
- path: string;
13
- icon?: string;
14
- label: string;
15
- children?: MenuItem[];
16
- };
17
- export type MenuDivider = {
18
- type: "divider";
19
- label?: string;
20
- };
21
9
  /**
22
10
  *
23
11
  *
24
12
  */
25
13
  export declare function Menu({ darkMode, config, useNextRouter, ...props }: MenuProps): JSX.Element;
26
- export {};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from "@valerya/ui";
3
+ export declare function MenuButton({ depth, darkMode, icon, selected, children, ...props }: {
4
+ depth?: number;
5
+ icon?: string;
6
+ darkMode?: boolean;
7
+ } & ButtonProps): JSX.Element;
@@ -0,0 +1,13 @@
1
+ export type MenuConfig = MenuItems;
2
+ export type MenuItems = (Item | MenuDivider)[];
3
+ export type Item = {
4
+ type: "item";
5
+ path: string;
6
+ icon?: string;
7
+ label: string;
8
+ children?: Item[];
9
+ };
10
+ export type MenuDivider = {
11
+ type: "divider";
12
+ label?: string;
13
+ };
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { ParentComponent, SoperioComponent } from "@soperio/react";
3
+ import { Item } from "./MenuConfig";
4
+ interface MenuItemProps extends SoperioComponent, ParentComponent {
5
+ path: string;
6
+ depth?: number;
7
+ icon?: string;
8
+ darkMode?: boolean;
9
+ subMenu?: Item[];
10
+ }
11
+ export declare function MenuItem({ icon, path, depth, darkMode, subMenu, ...props }: MenuItemProps): JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { ParentComponent, SoperioComponent } from "@soperio/react";
3
+ import { Item } from "./MenuConfig";
4
+ interface NextMenuItemProps extends SoperioComponent, ParentComponent {
5
+ path: string;
6
+ depth?: number;
7
+ icon?: string;
8
+ darkMode?: boolean;
9
+ subMenu?: Item[];
10
+ }
11
+ export declare function NextMenuItem({ icon, path, depth, darkMode, subMenu, ...props }: NextMenuItemProps): JSX.Element;
12
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare function SelectedIndicator({ darkMode }: {
3
+ darkMode?: boolean;
4
+ }): JSX.Element;