@headless-adminapp/fluent 1.1.8 → 1.1.9

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.
@@ -23,6 +23,7 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
23
23
  const strings = (0, AppStringContext_1.useAppStrings)();
24
24
  const { language } = (0, locale_1.useLocale)();
25
25
  const isMobile = (0, hooks_2.useIsMobile)();
26
+ const isTablet = (0, hooks_2.useIsTablet)();
26
27
  const initials = (0, react_1.useMemo)(() => {
27
28
  return authSession?.fullName
28
29
  .split(' ')
@@ -42,8 +43,13 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
42
43
  background: react_components_1.tokens.colorBrandBackground,
43
44
  paddingInline: 8,
44
45
  gap: 8,
45
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flex: 1, alignItems: 'center', gap: 8 }, children: [isMobile && ((0, jsx_runtime_1.jsx)("div", { role: "button", style: {
46
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flex: 1, alignItems: 'center', gap: 8 }, children: [isTablet && ((0, jsx_runtime_1.jsx)("div", { role: "button", style: {
46
47
  cursor: 'pointer',
48
+ width: !isMobile ? 44 : undefined,
49
+ display: 'flex',
50
+ flexDirection: 'row',
51
+ justifyContent: 'center',
52
+ alignItems: 'center',
47
53
  }, onClick: onNavToggle, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.Hamburger, { style: { color: 'white' } }) })), (0, jsx_runtime_1.jsxs)("div", { style: {
48
54
  display: 'flex',
49
55
  alignItems: 'center',
package/App/AppUI.js CHANGED
@@ -9,11 +9,12 @@ const AppHeaderContianer_1 = require("./AppHeaderContianer");
9
9
  const Navigation_1 = require("./Navigation");
10
10
  const AppUI = ({ children }) => {
11
11
  const isMobile = (0, hooks_1.useIsMobile)();
12
+ const isTablet = (0, hooks_1.useIsTablet)();
12
13
  const [isNavOpen, setIsNavOpen] = (0, react_1.useState)(!isMobile);
13
14
  const navType = (0, react_1.useMemo)(() => (isMobile ? 'overlay' : 'inline'), [isMobile]);
14
15
  (0, react_1.useEffect)(() => {
15
- setIsNavOpen(!isMobile);
16
- }, [isMobile]);
16
+ setIsNavOpen(!isTablet);
17
+ }, [isMobile, isTablet]);
17
18
  return ((0, jsx_runtime_1.jsxs)("main", { style: {
18
19
  display: 'flex',
19
20
  flexDirection: 'column',
@@ -24,7 +25,7 @@ const AppUI = ({ children }) => {
24
25
  flex: 1,
25
26
  overflow: 'hidden',
26
27
  background: react_components_1.tokens.colorNeutralBackground1,
27
- }, children: [(0, jsx_runtime_1.jsx)(Navigation_1.NavigationContainer, { open: isNavOpen, type: navType, onOpenChange: (open) => setIsNavOpen(open) }), (0, jsx_runtime_1.jsx)("div", { style: {
28
+ }, children: [(0, jsx_runtime_1.jsx)(Navigation_1.NavigationContainer, { open: isNavOpen, type: navType, isMini: !isMobile && isTablet && !isNavOpen, onOpenChange: (open) => setIsNavOpen(open) }), (0, jsx_runtime_1.jsx)("div", { style: {
28
29
  display: 'flex',
29
30
  flexDirection: 'column',
30
31
  flex: 1,
@@ -3,6 +3,7 @@ import { NavItemInfo } from './types';
3
3
  interface NavItemComponentProps {
4
4
  item: NavItemInfo;
5
5
  onClick: (item: NavItemInfo) => void;
6
+ isMini?: boolean;
6
7
  }
7
8
  export declare const NavItemComponent: FC<NavItemComponentProps>;
8
9
  export {};
@@ -4,8 +4,8 @@ exports.NavItemComponent = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const react_nav_preview_1 = require("@fluentui/react-nav-preview");
7
- const NavItemComponent = ({ item, onClick, }) => {
8
- return ((0, jsx_runtime_1.jsxs)(react_nav_preview_1.NavItem, { href: item.link, onClick: (event) => {
7
+ const NavItemComponent = ({ item, onClick, isMini, }) => {
8
+ return ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavItem, { href: item.link, onClick: (event) => {
9
9
  event.preventDefault();
10
10
  onClick(item);
11
11
  }, style: {
@@ -14,6 +14,6 @@ const NavItemComponent = ({ item, onClick, }) => {
14
14
  : undefined,
15
15
  }, icon: (0, jsx_runtime_1.jsx)(item.Icon, { size: 20, filled: item.active, color: item.active
16
16
  ? 'var(--colorNeutralForeground2BrandSelected)'
17
- : undefined }), value: item.active ? 'active' : '', children: [item.label, !!item.RightComponent && ((0, jsx_runtime_1.jsx)("span", { style: { flex: 1, justifyContent: 'flex-end', display: 'flex' }, children: (0, jsx_runtime_1.jsx)(item.RightComponent, {}) }))] }));
17
+ : undefined }), value: item.active ? 'active' : '', children: !isMini && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [item.label, !!item.RightComponent && ((0, jsx_runtime_1.jsx)("span", { style: { flex: 1, justifyContent: 'flex-end', display: 'flex' }, children: (0, jsx_runtime_1.jsx)(item.RightComponent, {}) }))] })) }));
18
18
  };
19
19
  exports.NavItemComponent = NavItemComponent;
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ import { NavCategoryInfo, NavSubItemInfo } from './types';
3
+ interface NavMiniCategoryMenuProps {
4
+ item: NavCategoryInfo;
5
+ isActive: boolean;
6
+ onSelect: (item: NavSubItemInfo) => void;
7
+ }
8
+ export declare const NavMiniCategoryMenu: FC<NavMiniCategoryMenuProps>;
9
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavMiniCategoryMenu = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const NavItemComponent_1 = require("./NavItemComponent");
7
+ const NavMiniCategoryMenu = ({ item, isActive, onSelect, }) => {
8
+ return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "after-top", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(NavItemComponent_1.NavItemComponent, { item: {
9
+ key: item.key,
10
+ active: isActive,
11
+ Icon: item.Icon,
12
+ label: item.label,
13
+ link: '',
14
+ isExternal: false,
15
+ RightComponent: undefined,
16
+ type: 'item',
17
+ }, onClick: () => { }, isMini: true }, item.key) }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: item.items.map((subItem) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => onSelect(subItem), children: subItem.label }, subItem.key))) }) })] }));
18
+ };
19
+ exports.NavMiniCategoryMenu = NavMiniCategoryMenu;
@@ -3,6 +3,7 @@ import { DrawerType } from './types';
3
3
  interface NavigationContainerProps {
4
4
  open: boolean;
5
5
  type: DrawerType;
6
+ isMini: boolean;
6
7
  onOpenChange: (open: boolean) => void;
7
8
  }
8
9
  export declare const NavigationContainer: FC<NavigationContainerProps>;
@@ -11,6 +11,7 @@ const app_2 = require("@headless-adminapp/core/experience/app");
11
11
  const react_1 = require("react");
12
12
  const NavCategoryItemComponent_1 = require("./NavCategoryItemComponent");
13
13
  const NavItemComponent_1 = require("./NavItemComponent");
14
+ const NavMiniCategoryMenu_1 = require("./NavMiniCategoryMenu");
14
15
  const NavSubItemComponent_1 = require("./NavSubItemComponent");
15
16
  const utils_1 = require("./utils");
16
17
  const useStyles = (0, react_components_1.makeStyles)({
@@ -22,7 +23,7 @@ const useStyles = (0, react_components_1.makeStyles)({
22
23
  zIndex: 1,
23
24
  },
24
25
  });
25
- const NavigationContainer = ({ open, type, onOpenChange, }) => {
26
+ const NavigationContainer = ({ open, type, onOpenChange, isMini, }) => {
26
27
  const styles = useStyles();
27
28
  const { appExperience: app } = (0, app_1.useAppContext)();
28
29
  const { schemaMetadataDic } = (0, app_1.useAppContext)();
@@ -70,16 +71,19 @@ const NavigationContainer = ({ open, type, onOpenChange, }) => {
70
71
  router.push(item.link);
71
72
  }
72
73
  };
73
- return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", selectedCategoryValue: "active", defaultOpenCategories: ['active'], open: open, type: type, onOpenChange: (_value, data) => onOpenChange(data.open), onNavItemSelect: () => {
74
+ return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", selectedCategoryValue: "active", defaultOpenCategories: ['active'], open: open || isMini, type: type, onOpenChange: (_value, data) => onOpenChange(data.open), onNavItemSelect: () => {
74
75
  // do nothing
75
- }, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawerBody, { style: {
76
+ }, style: { width: isMini ? 60 : undefined }, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawerBody, { style: {
76
77
  paddingTop: 8,
77
- }, children: sections.map((section) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!section.hideLabel && ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavSectionHeader, { children: section.label })), section.items.map((item) => {
78
+ }, children: sections.map((section, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!section.hideLabel && !isMini && ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavSectionHeader, { children: section.label })), isMini && index > 0 && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.5 } }) })), section.items.map((item) => {
78
79
  if (item.type === app_2.PageType.Category) {
79
80
  const isActive = item.items.some((subItem) => subItem.active);
81
+ if (isMini) {
82
+ return ((0, jsx_runtime_1.jsx)(NavMiniCategoryMenu_1.NavMiniCategoryMenu, { isActive: isActive, item: item, onSelect: handleNavigation }, item.key));
83
+ }
80
84
  return ((0, jsx_runtime_1.jsxs)(react_nav_preview_1.NavCategory, { value: isActive ? 'active' : '', children: [(0, jsx_runtime_1.jsx)(NavCategoryItemComponent_1.NavCategoryItemComponent, { item: item, isActive: isActive }), (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavSubItemGroup, { children: item.items.map((subItem) => ((0, jsx_runtime_1.jsx)(NavSubItemComponent_1.NavSubItemComponent, { item: subItem, onClick: handleNavigation }, subItem.key))) })] }, item.key));
81
85
  }
82
- return ((0, jsx_runtime_1.jsx)(NavItemComponent_1.NavItemComponent, { item: item, onClick: handleNavigation }, item.key));
86
+ return ((0, jsx_runtime_1.jsx)(NavItemComponent_1.NavItemComponent, { item: item, onClick: handleNavigation, isMini: isMini }, item.key));
83
87
  })] }, section.label))) }) }) }));
84
88
  };
85
89
  exports.NavigationContainer = NavigationContainer;
@@ -47,21 +47,14 @@ function useLookupData({ schema, view, searchText, dataService, enabled, }) {
47
47
  const columns = (0, react_1.useMemo)(() => {
48
48
  return extractColumns(schema, view);
49
49
  }, [schema, view]);
50
- const expand = (0, react_1.useMemo)(() => extractExpand(view), [view?.card?.secondaryColumns]);
50
+ const expand = (0, react_1.useMemo)(() => extractExpand(view), [view]);
51
51
  const queryKey = (0, react_1.useMemo)(() => getKey({
52
52
  columns,
53
53
  expand,
54
54
  schema,
55
55
  search,
56
56
  view,
57
- }), [
58
- columns,
59
- expand,
60
- schema.logicalName,
61
- search,
62
- view?.filter,
63
- view?.defaultSorting,
64
- ]);
57
+ }), [columns, expand, schema, search, view]);
65
58
  const { data, isFetching } = (0, react_query_1.useQuery)({
66
59
  queryKey: queryKey,
67
60
  queryFn: async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/fluent",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -50,5 +50,5 @@
50
50
  "uuid": "11.0.3",
51
51
  "yup": "^1.4.0"
52
52
  },
53
- "gitHead": "918b655a582c5c63864e8bbe6999289ec959b917"
53
+ "gitHead": "5ee9022d0e1bc4c75ef4777a4cfbd4557ae34a99"
54
54
  }