@compill/admin 1.0.64 → 1.0.66

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
@@ -2895,7 +2895,7 @@ function MenuItem(_a) {
2895
2895
  props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
2896
2896
  const location = reactRouterDom.useLocation();
2897
2897
  const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
2898
- // const match = useMatch("/" + path)// + "/*")
2898
+ const match = reactRouterDom.useMatch("/" + path) != null;
2899
2899
  // const selected = match != null
2900
2900
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2901
2901
  children: [jsxRuntime.jsxs(reactRouterDom.Link, {
@@ -2926,7 +2926,7 @@ function MenuItem(_a) {
2926
2926
  path: icon,
2927
2927
  opacity: selected ? "100" : "60"
2928
2928
  }), children]
2929
- })), selected && jsxRuntime.jsx("div", {
2929
+ })), match && jsxRuntime.jsx("div", {
2930
2930
  position: "absolute",
2931
2931
  bgColor: darkMode ? "white" : "black",
2932
2932
  bgOpacity: "90",
package/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import Link from 'next/link';
4
4
  import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
5
5
  import { INVALIDATE_API } from '@compill/admin-api';
6
6
  import { useApiMutation, useMutate, useInvalidateMutation, useApiQuery, useInvalidateQuery, useInvalidateParentMutation, useApiQueries } from '@compill/api';
7
- import { useNavigate, useParams, Outlet, useLocation, Link as Link$1 } from 'react-router-dom';
7
+ import { useNavigate, useParams, Outlet, useLocation, useMatch, Link as Link$1 } from 'react-router-dom';
8
8
  import { toast } from 'react-toastify';
9
9
  import { SubmitButton, FormProvider, TextArea, FormRenderer, mergeInitialFormValues, FieldLabel } from '@compill/form';
10
10
  import { useFormikContext, Field, Formik, Form } from 'formik';
@@ -2885,7 +2885,7 @@ function MenuItem(_a) {
2885
2885
  props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
2886
2886
  const location = useLocation();
2887
2887
  const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
2888
- // const match = useMatch("/" + path)// + "/*")
2888
+ const match = useMatch("/" + path) != null;
2889
2889
  // const selected = match != null
2890
2890
  return jsxs(Fragment, {
2891
2891
  children: [jsxs(Link$1, {
@@ -2916,7 +2916,7 @@ function MenuItem(_a) {
2916
2916
  path: icon,
2917
2917
  opacity: selected ? "100" : "60"
2918
2918
  }), children]
2919
- })), selected && jsx("div", {
2919
+ })), match && jsx("div", {
2920
2920
  position: "absolute",
2921
2921
  bgColor: darkMode ? "white" : "black",
2922
2922
  bgOpacity: "90",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }
package/src/index.d.ts CHANGED
@@ -20,7 +20,7 @@ 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 { MenuConfig } from "./lib/layout/Menu";
23
+ export * from "./lib/layout/Menu";
24
24
  export * from "./lib/modal/AttachDialog";
25
25
  export * from "./lib/modal/FormActionDialog";
26
26
  export * from "./lib/page/PageContainer";
@@ -1,19 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import { ParentComponent, SoperioComponent } from "@soperio/react";
3
- interface MenuProps extends SoperioComponent, ParentComponent {
3
+ export interface MenuProps extends SoperioComponent, ParentComponent {
4
4
  darkMode?: boolean;
5
5
  config: MenuConfig;
6
6
  }
7
7
  export type MenuConfig = MenuItems;
8
8
  type MenuItems = (MenuItem | MenuDivider)[];
9
- type MenuItem = {
9
+ export type MenuItem = {
10
10
  type: "item";
11
11
  path: string;
12
12
  icon?: string;
13
13
  label: string;
14
14
  children?: MenuItem[];
15
15
  };
16
- type MenuDivider = {
16
+ export type MenuDivider = {
17
17
  type: "divider";
18
18
  label?: string;
19
19
  };
@@ -22,12 +22,4 @@ type MenuDivider = {
22
22
  *
23
23
  */
24
24
  export default function Menu({ darkMode, config, ...props }: MenuProps): JSX.Element;
25
- interface MenuItemProps extends SoperioComponent, ParentComponent {
26
- path: string;
27
- depth?: number;
28
- icon?: string;
29
- darkMode?: boolean;
30
- subMenu?: MenuItem[];
31
- }
32
- declare function MenuItem({ icon, path, depth, darkMode, subMenu, children, ...props }: MenuItemProps): JSX.Element;
33
25
  export {};