@carrier-dpx/air-react-library 0.6.0 → 0.7.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 (69) hide show
  1. package/package.json +1 -1
  2. package/src/components/BottomNavigation/BottomNavigation.figma.tsx +54 -0
  3. package/src/components/BottomNavigation/BottomNavigation.tsx +45 -0
  4. package/src/components/BottomNavigation/BottomNavigationAction.figma.tsx +87 -0
  5. package/src/components/BottomNavigation/BottomNavigationAction.tsx +110 -0
  6. package/src/components/BottomNavigation/index.ts +7 -0
  7. package/src/components/Icon/ArrowLeftIcon.figma.tsx +18 -17
  8. package/src/components/Icon/ArrowRightIcon.figma.tsx +18 -17
  9. package/src/components/Icon/CheckIcon.figma.tsx +18 -17
  10. package/src/components/Icon/CloseIcon.figma.tsx +18 -17
  11. package/src/components/Icon/HomeIcon.figma.tsx +18 -17
  12. package/src/components/Icon/Icon.figma.tsx +68 -0
  13. package/src/components/Icon/InfoIcon.figma.tsx +18 -17
  14. package/src/components/Icon/MenuIcon.figma.tsx +18 -17
  15. package/src/components/Icon/SearchIcon.figma.tsx +18 -17
  16. package/src/components/Icon/SettingsIcon.figma.tsx +2 -2
  17. package/src/components/Icon/UserIcon.figma.tsx +18 -17
  18. package/src/components/Icon/icons/demo/AlertIcon.figma.tsx +28 -0
  19. package/src/components/Icon/icons/demo/AlertIcon.tsx +19 -0
  20. package/src/components/Icon/icons/demo/DEMO_USAGE.md +113 -0
  21. package/src/components/Icon/icons/demo/DeviceManagerIcon.figma.tsx +38 -0
  22. package/src/components/Icon/icons/demo/DeviceManagerIcon.tsx +16 -0
  23. package/src/components/Icon/icons/demo/HomeIcon.figma.tsx +28 -0
  24. package/src/components/Icon/icons/demo/HomeIcon.tsx +13 -0
  25. package/src/components/Icon/icons/demo/README.md +57 -0
  26. package/src/components/Icon/icons/demo/SiteIcon.figma.tsx +28 -0
  27. package/src/components/Icon/icons/demo/SiteIcon.tsx +13 -0
  28. package/src/components/Icon/icons/demo/SvgIcon.tsx +39 -0
  29. package/src/components/Icon/icons/demo/WarningIcon.figma.tsx +28 -0
  30. package/src/components/Icon/icons/demo/WarningIcon.tsx +15 -0
  31. package/src/components/Icon/icons/demo/devicemanager_outlined.svg +6 -0
  32. package/src/components/Icon/icons/demo/home_outlined.svg +3 -0
  33. package/src/components/Icon/icons/demo/iconRegistry.ts +97 -0
  34. package/src/components/Icon/icons/demo/index.ts +23 -0
  35. package/src/components/Icon/icons/demo/site_outlined.svg +3 -0
  36. package/src/components/Icon/icons/demo/warning_outlined.svg +5 -0
  37. package/src/components/Navbar/ExtraNavigation/ExtraNavigation.tsx +86 -0
  38. package/src/components/Navbar/ExtraNavigation/index.ts +2 -0
  39. package/src/components/Navbar/ExtraNavigation/styles.tsx +10 -0
  40. package/src/components/Navbar/ExtraNavigation/types.ts +43 -0
  41. package/src/components/Navbar/Navbar.figma.tsx +118 -0
  42. package/src/components/Navbar/Navbar.tsx +110 -0
  43. package/src/components/Navbar/NavbarButtons/Item.figma.tsx +117 -0
  44. package/src/components/Navbar/NavbarButtons/NavbarFooterButton.tsx +57 -0
  45. package/src/components/Navbar/NavbarButtons/NavbarTooltip.tsx +56 -0
  46. package/src/components/Navbar/NavbarButtons/NavigationButton.tsx +98 -0
  47. package/src/components/Navbar/NavbarButtons/index.ts +3 -0
  48. package/src/components/Navbar/NavbarButtons/styles.tsx +112 -0
  49. package/src/components/Navbar/NavbarButtons/types.ts +8 -0
  50. package/src/components/Navbar/NavbarFooter/NavbarFooter.tsx +40 -0
  51. package/src/components/Navbar/NavbarFooter/index.ts +2 -0
  52. package/src/components/Navbar/NavbarFooter/styles.tsx +14 -0
  53. package/src/components/Navbar/NavbarFooter/types.ts +15 -0
  54. package/src/components/Navbar/NavbarLogo/NavbarLogo.tsx +45 -0
  55. package/src/components/Navbar/NavbarLogo/index.ts +2 -0
  56. package/src/components/Navbar/NavbarLogo/styles.ts +18 -0
  57. package/src/components/Navbar/NavbarLogo/types.ts +18 -0
  58. package/src/components/Navbar/NavbarProvider.tsx +15 -0
  59. package/src/components/Navbar/Navigation/Navigation.tsx +113 -0
  60. package/src/components/Navbar/Navigation/helpers.ts +9 -0
  61. package/src/components/Navbar/Navigation/index.ts +2 -0
  62. package/src/components/Navbar/Navigation/styles.tsx +10 -0
  63. package/src/components/Navbar/Navigation/types.ts +68 -0
  64. package/src/components/Navbar/constants.ts +45 -0
  65. package/src/components/Navbar/hooks/useNavbarContext.tsx +12 -0
  66. package/src/components/Navbar/index.tsx +7 -0
  67. package/src/components/Navbar/styles.tsx +44 -0
  68. package/src/components/Navbar/types.ts +67 -0
  69. package/src/index.ts +6 -0
@@ -0,0 +1,68 @@
1
+ import { ReactNode } from "react";
2
+ import { BoxProps } from "../../Box";
3
+
4
+ export interface NavigationProps extends Pick<BoxProps, "sx" | "children"> {
5
+ /**
6
+ * Current application pathname.
7
+ */
8
+ currentPathname: string;
9
+ /**
10
+ * Navigation elements.
11
+ */
12
+ items: NavigationItem[];
13
+ /**
14
+ * Navigation elements style.
15
+ * @default basic
16
+ */
17
+ activeButtonType?: ActiveButtonType;
18
+ /**
19
+ * Callback fired when basic navigation button is clicked.
20
+ */
21
+ onClick?: ClickNavItem;
22
+ /**
23
+ * Allow show tooltip.
24
+ * @default false
25
+ */
26
+ disableTooltip?: boolean;
27
+ /**
28
+ * Allow ripple effect.
29
+ * @default false
30
+ */
31
+ disableRipple?: boolean;
32
+ /**
33
+ * Allow ripple touch effect.
34
+ * @default false
35
+ */
36
+ disableTouchRipple?: boolean;
37
+ /**
38
+ * If 'false', the active state for the first nav item is disabled during initial rendering.
39
+ * @default true
40
+ */
41
+ isDefaultActive?: boolean;
42
+ }
43
+
44
+ export interface NavigationItemType {
45
+ type?: "ITEM";
46
+ icon: JSX.Element;
47
+ label?: string;
48
+ id: string;
49
+ path: string;
50
+ disabled?: boolean;
51
+ }
52
+
53
+ export interface NavigationDividerType {
54
+ type: "DIVIDER";
55
+ children?: ReactNode;
56
+ }
57
+
58
+ export type NavigationItem = NavigationItemType | NavigationDividerType;
59
+
60
+ export type ClickNavItem = (params: {
61
+ path: string | null;
62
+ id: string;
63
+ }) => void;
64
+
65
+ export enum ActiveButtonType {
66
+ Basic = "basic",
67
+ Indicator = "indicator",
68
+ }
@@ -0,0 +1,45 @@
1
+ export const NAV_ANIMATION = "width 0.25s";
2
+
3
+ export const NAV_ICON_PADDING = "4px";
4
+
5
+ export const NAV_ICON_SIZE_PX = "24px";
6
+
7
+ export let navBackgroundTransparent = false;
8
+
9
+ export let navChildHeightPx = 56;
10
+
11
+ export let navChildMarginPx = 0;
12
+
13
+ export let navIsInWideMode = false;
14
+
15
+ export let navMaxWidthPx = "288px";
16
+
17
+ export let navBorder = true;
18
+
19
+ export const navItemPaddingPx = (wideMode: boolean) =>
20
+ `calc((${navItemSizePx(
21
+ wideMode
22
+ )} - ${NAV_ICON_SIZE_PX} - ${NAV_ICON_PADDING} * 2 ) / 2)`;
23
+
24
+ export const navItemSizePx = (wideMode: boolean) =>
25
+ wideMode ? "72px" : "56px";
26
+
27
+ export const navLogoLeftMargin = (wideMode: boolean) =>
28
+ wideMode ? "8px" : "0px";
29
+
30
+ export const navSetBackgroundTransparent = (transparent: boolean) =>
31
+ (navBackgroundTransparent = transparent);
32
+
33
+ export const navSetChildHeightPx = (height: number) =>
34
+ (navChildHeightPx = height);
35
+
36
+ export const navSetChildMarginPx = (margin: number) =>
37
+ (navChildMarginPx = margin);
38
+
39
+ export const navSetMaxWidthPx = (maxWidth: number) =>
40
+ (navMaxWidthPx = maxWidth + "px");
41
+
42
+ export const navSetWideMode = (wideMode: boolean) =>
43
+ (navIsInWideMode = wideMode);
44
+
45
+ export const navSetBorder = (border: boolean) => (navBorder = border);
@@ -0,0 +1,12 @@
1
+ import { useContext } from "react";
2
+ import { NavbarContext } from "../NavbarProvider";
3
+
4
+ export const useNavbarContext = () => {
5
+ const context = useContext(NavbarContext);
6
+
7
+ if (context === undefined) {
8
+ throw new Error("useNavbarProvider must be used within a NavbarProvider");
9
+ }
10
+
11
+ return context;
12
+ };
@@ -0,0 +1,7 @@
1
+ export * from "./types";
2
+ export * from "./Navbar";
3
+ export * from "./ExtraNavigation";
4
+ export * from "./NavbarFooter";
5
+ export * from "./NavbarLogo";
6
+ export * from "./Navigation";
7
+ export * from "./NavbarButtons";
@@ -0,0 +1,44 @@
1
+ import { CSSObject } from "@mui/material";
2
+
3
+ import {
4
+ navItemSizePx,
5
+ NAV_ANIMATION,
6
+ navIsInWideMode,
7
+ navMaxWidthPx,
8
+ navBackgroundTransparent,
9
+ navBorder,
10
+ } from "./constants";
11
+ import { StyledComponentDefaultProps } from "../types/common";
12
+ import { styleTokens } from "src/components/theme/constants/styleTokens";
13
+ import { NavbarProps } from "./types";
14
+
15
+ export default {
16
+ container: ({ theme, padded }: StyledComponentDefaultProps & NavbarProps) =>
17
+ ({
18
+ position: "relative",
19
+ display: "inline-flex",
20
+ flexDirection: "column",
21
+ alignItems: "flex-start",
22
+ justifyContent: "space-between",
23
+ boxSizing: "content-box",
24
+ overflowX: "hidden",
25
+ background: navBackgroundTransparent
26
+ ? "inherit"
27
+ : theme.palette.primary.contrastText,
28
+ borderRight: navBorder
29
+ ? `1px solid ${theme.palette.base?.divider}`
30
+ : "none",
31
+ paddingTop: "8px",
32
+ transition: NAV_ANIMATION,
33
+ width: navItemSizePx(navIsInWideMode),
34
+ minWidth: navItemSizePx(navIsInWideMode),
35
+ "&.opened": {
36
+ background: theme.palette.primary.contrastText,
37
+ borderRight: `1px solid ${theme.palette.base?.divider}`,
38
+ width: navMaxWidthPx,
39
+ },
40
+ ".MuiButtonBase-root": {
41
+ padding: padded && styleTokens.paddingItem,
42
+ },
43
+ } as CSSObject),
44
+ };
@@ -0,0 +1,67 @@
1
+ import { CSSObject } from "@mui/material";
2
+ import { BoxProps } from "../Box";
3
+ import { TooltipProps as FdsTooltipProps } from "../Tooltip";
4
+
5
+ export interface NavbarProps extends Pick<BoxProps, "children" | "sx"> {
6
+ /**
7
+ * Disallow expanding the drawer on hover.
8
+ * @default true
9
+ */
10
+ disableHoverListener?: boolean;
11
+ /**
12
+ * Changes the width from 56px to 72px
13
+ * @default false
14
+ */
15
+ wideMode?: boolean;
16
+ /**
17
+ * Height Offset for adjusting the height with headers
18
+ * @default 0
19
+ */
20
+ heightOffset?: number;
21
+ /**
22
+ * Callback fired when drawer state changed.
23
+ */
24
+ onDrawerSizeChanged?: (opened: boolean) => void;
25
+ /**
26
+ * Change the default height of cells
27
+ * @default 56
28
+ */
29
+ childHeight?: number;
30
+ /**
31
+ * Sets the Max Open Width of the drawer
32
+ * @default 288
33
+ */
34
+ maxOpenWidth?: number;
35
+ /**
36
+ * Turns background color of nav bar transparent while closed
37
+ * @default false
38
+ */
39
+ transparentBackground?: boolean;
40
+ /**
41
+ * Adds margin around each child
42
+ * @default 0
43
+ */
44
+ childMargin?: 0 | 4 | 8;
45
+ /**
46
+ * Props applied to the NavbarTooltip component
47
+ */
48
+ tooltipProps?: NavbarTooltipProps;
49
+ /**
50
+ * Controls right side border visibility. Right side border is optional in collapsed state only.
51
+ * @default true
52
+ */
53
+ border?: boolean;
54
+ /**
55
+ * Added padding between the list
56
+ * @default false
57
+ */
58
+ padded?: boolean;
59
+ }
60
+
61
+ export type NavbarStyleFunc = (payload: unknown) => CSSObject;
62
+
63
+ export interface NavbarTooltipProps
64
+ extends Omit<
65
+ FdsTooltipProps,
66
+ "title" | "disableHoverListener" | "children"
67
+ > { }
package/src/index.ts CHANGED
@@ -12,4 +12,10 @@ export { default as Copyright } from "./components/Copyright";
12
12
  export type { CopyrightProps } from "./components/Copyright";
13
13
  export { default as Icon } from "./components/Icon";
14
14
  export type { IconProps } from "./components/Icon";
15
+ export * from "./components/Navbar";
16
+ export type { NavbarProps } from "./components/Navbar";
17
+ export { default as BottomNavigation } from "./components/BottomNavigation";
18
+ export { default as BottomNavigationAction } from "./components/BottomNavigation/BottomNavigationAction";
19
+ export type { BottomNavigationProps } from "./components/BottomNavigation";
20
+ export type { BottomNavigationActionProps } from "./components/BottomNavigation/BottomNavigationAction";
15
21
  export * from "./components/theme";