@carrier-dpx/air-react-library 0.1.0 → 0.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.
package/README.md CHANGED
@@ -18,6 +18,35 @@ npm install react react-dom @mui/material @emotion/react @emotion/styled
18
18
 
19
19
  ## Usage
20
20
 
21
+ ### Quick Start with Theme
22
+
23
+ **Important:** To get the correct Carrier DPX colors and styling, wrap your app with the `FleetThemeProvider`:
24
+
25
+ ```tsx
26
+ import { Button, FleetThemeProvider } from '@carrier-dpx/air-react-library';
27
+
28
+ function App() {
29
+ return (
30
+ <FleetThemeProvider theme="AirLight">
31
+ <Button
32
+ variant="contained"
33
+ color="primary"
34
+ size="large"
35
+ onClick={() => console.log('clicked')}
36
+ >
37
+ Get Started
38
+ </Button>
39
+ </FleetThemeProvider>
40
+ );
41
+ }
42
+ ```
43
+
44
+ ### Available Themes
45
+
46
+ - `"AirLight"` - Light theme (default)
47
+ - `"AirDark"` - Dark theme
48
+ - `"AHP"` - AHP theme
49
+
21
50
  ### Button Component
22
51
 
23
52
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrier-dpx/air-react-library",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Air web React component library for Figma Make",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -0,0 +1,39 @@
1
+ import React, { ReactNode } from "react";
2
+ import { Theme, ThemeProvider, createTheme } from "@mui/material/styles";
3
+ import { airDarkThemeOptions, fleetThemeOptions } from "./fleetThemeOptions";
4
+
5
+ // Define theme instances
6
+ const ahpTheme: Theme = createTheme({ ...fleetThemeOptions });
7
+
8
+ const airLightTheme: Theme = createTheme(fleetThemeOptions);
9
+
10
+ const airDarkTheme: Theme = createTheme(airDarkThemeOptions);
11
+
12
+ // Mapping from theme names to actual Theme instances
13
+ export const ThemeMap = {
14
+ AHP: ahpTheme,
15
+ AirLight: airLightTheme,
16
+ AirDark: airDarkTheme,
17
+ } as const;
18
+
19
+ // Define props for FleetThemeProvider
20
+ export type ThemeProviderProps = {
21
+ /** Content to render with the specified theme */
22
+ children?: ReactNode;
23
+
24
+ /** Custom Theme instance or predefined theme key */
25
+ theme?: Theme | keyof typeof ThemeMap;
26
+ };
27
+
28
+ // FleetThemeProvider component
29
+ const FleetThemeProvider: React.FC<ThemeProviderProps> = ({
30
+ children,
31
+ theme = airLightTheme, // Default to airLightTheme
32
+ }) => {
33
+ const resolvedTheme = typeof theme === "string" ? ThemeMap[theme] : theme;
34
+
35
+ return <ThemeProvider theme={resolvedTheme}>{children}</ThemeProvider>;
36
+ };
37
+
38
+ export default FleetThemeProvider;
39
+ export { FleetThemeProvider };
@@ -0,0 +1,122 @@
1
+ import { BaseColors } from "../types/colors";
2
+
3
+ export const airDarkColors = {
4
+ primary: {
5
+ main: "#4B87FB",
6
+ dark: "#D9E5FE",
7
+ light: "#0E49C7",
8
+ contrastText: "#0D2358",
9
+ containedHoverBackground: "#7AA7FC",
10
+ outlinedHoverBackground: "#0D2358",
11
+ outlinedRestingBorder: "#123B97",
12
+ selectedHover: "#123B97",
13
+ },
14
+ secondary: {
15
+ main: "#F4F5F5",
16
+ dark: "#EEEFEF",
17
+ light: "#616669",
18
+ contrastText: "#252728",
19
+ containedHoverBackground: "#FFFFFF",
20
+ outlinedHoverBackground: "#2E3132",
21
+ outlinedRestingBorder: "#3F4344",
22
+ selectedHover: "#3F4344",
23
+ },
24
+ error: {
25
+ main: "#F55246",
26
+ dark: "#FEE9E8",
27
+ light: "#C9180A",
28
+ contrastText: "#3D0703",
29
+ containedHoverBackground: "#F7766C",
30
+ outlinedHoverBackground: "#3D0703",
31
+ outlinedRestingBorder: "#871007",
32
+ content: "#FFFFFF",
33
+ background: "#630C05",
34
+ selectedHover: "#871007",
35
+ },
36
+ info: {
37
+ main: "#118EF1",
38
+ dark: "#E0F0FD",
39
+ light: "#0A68B1",
40
+ contrastText: "#042845",
41
+ containedHoverBackground: "#3DA3F4",
42
+ outlinedHoverBackground: "#042845",
43
+ outlinedRestingBorder: "#074475",
44
+ content: "#FFFFFF",
45
+ background: "#053155",
46
+ selectedHover: "#074475",
47
+ },
48
+ warning: {
49
+ main: "#FFC800",
50
+ dark: "#FFD641",
51
+ light: "#A68200",
52
+ contrastText: "#0D2358",
53
+ containedHoverBackground: "#FFD641",
54
+ outlinedHoverBackground: "#3B2E00",
55
+ outlinedRestingBorder: "#7D6200",
56
+ content: "#FFFFFF",
57
+ background: "#3B2E00",
58
+ selectedHover: "#4B3A00",
59
+ },
60
+ success: {
61
+ main: "#3E9E38",
62
+ dark: "#E2F4E1",
63
+ light: "#2D7429",
64
+ contrastText: "#112C10",
65
+ containedHoverBackground: "#4DBD46",
66
+ outlinedHoverBackground: "#112C10",
67
+ outlinedRestingBorder: "#1E4B1B",
68
+ content: "#FFFFFF",
69
+ background: "#163714",
70
+ selectedHover: "#1E4B1B",
71
+ },
72
+ };
73
+
74
+ export const baseDarkColors: BaseColors = {
75
+ dark: "#F1F3F5",
76
+ light: "#64686B",
77
+ main: "#DCDEE0",
78
+ contrastText: "#1F2326",
79
+ backdropOverlay: "#54595BB8",
80
+ divider: "#434749",
81
+ standardInputLine: "#434749",
82
+ background: {
83
+ accent: "#282C2F",
84
+ appBar: "#1F2326",
85
+ paper: "#1F2326",
86
+ skeleton: "#303537",
87
+ snackbar: "#C4D7FE",
88
+ },
89
+ common: {
90
+ black: "#000000",
91
+ white: "#FFFFFF",
92
+ },
93
+ filledInput: {
94
+ background: "#303537",
95
+ backgroundHover: "#434749",
96
+ outlinedBorder: "#434749",
97
+ outlinedBorderHover: "#64686B",
98
+ placeholderLabel: "#64686B",
99
+ required: "#F55246",
100
+ },
101
+ text: {
102
+ primary: "#F1F3F5",
103
+ secondary: "#B9BCBE",
104
+ disabled: "#64686B",
105
+ },
106
+ state: {
107
+ hover: "#F1F3F50F",
108
+ disabledBackground: "#303537",
109
+ disabledContent: "#54595B",
110
+ selected: "#303537",
111
+ selectedHover: "#434749",
112
+ focus: "#434749",
113
+ active: "#B9BCBE",
114
+ },
115
+ };
116
+
117
+ export const airDarkPalette = {
118
+ ...airDarkColors,
119
+ base: baseDarkColors,
120
+ };
121
+
122
+ export default airDarkPalette;
@@ -0,0 +1,6 @@
1
+ // Air Dark theme uses the same shadows as light theme
2
+ import { fleetShadows } from "./shadows";
3
+
4
+ export const airDarkShadows = fleetShadows;
5
+
6
+ export default airDarkShadows;
@@ -0,0 +1,122 @@
1
+ import { BaseColors } from "../types/colors";
2
+
3
+ export const bootstrapColors = {
4
+ primary: {
5
+ main: "#0659F9",
6
+ dark: "#102B6E",
7
+ light: "#7AA7FC",
8
+ contrastText: "#FFFFFF",
9
+ containedHoverBackground: "#0E49C7",
10
+ outlinedHoverBackground: "#EEF3FF",
11
+ outlinedRestingBorder: "#A4C3FD",
12
+ selectedHover: "#D9E5FE",
13
+ },
14
+ secondary: {
15
+ main: "#3F4344",
16
+ dark: "#252728",
17
+ light: "#999EA1",
18
+ contrastText: "#FFFFFF",
19
+ containedHoverBackground: "#2E3132",
20
+ outlinedHoverBackground: "#F4F5F5",
21
+ outlinedRestingBorder: "#C0C3C5",
22
+ selectedHover: "#EEEFEF",
23
+ },
24
+ error: {
25
+ main: "#E71B0C",
26
+ dark: "#630C05",
27
+ light: "#F7766C",
28
+ contrastText: "#FFFFFF",
29
+ containedHoverBackground: "#C9180A",
30
+ outlinedHoverBackground: "#FEF4F3",
31
+ outlinedRestingBorder: "#FBAFA9",
32
+ content: "#3D0703",
33
+ background: "#FEF4F3",
34
+ selectedHover: "#FEE9E8",
35
+ },
36
+ info: {
37
+ main: "#0C77CD",
38
+ dark: "#053155",
39
+ light: "#3DA3F4",
40
+ contrastText: "#FFFFFF",
41
+ containedHoverBackground: "#0A68B1",
42
+ outlinedHoverBackground: "#EDF7FE",
43
+ outlinedRestingBorder: "#8CC9F8",
44
+ content: "#042845",
45
+ background: "#EDF7FE",
46
+ selectedHover: "#E0F0FD",
47
+ },
48
+ warning: {
49
+ main: "#FFC800",
50
+ dark: "#7D6200",
51
+ light: "#FFD641",
52
+ contrastText: "#302500",
53
+ containedHoverBackground: "#EDBA00",
54
+ outlinedHoverBackground: "#FFF5D0",
55
+ outlinedRestingBorder: "#FFD641",
56
+ content: "#302500",
57
+ background: "#FFF5D0",
58
+ selectedHover: "#FFEEB2",
59
+ },
60
+ success: {
61
+ main: "#33862F",
62
+ dark: "#163714",
63
+ light: "#4DBD46",
64
+ contrastText: "#FFFFFF",
65
+ containedHoverBackground: "#2D7429",
66
+ outlinedHoverBackground: "#EDF8EC",
67
+ outlinedRestingBorder: "#8AD485",
68
+ content: "#112C10",
69
+ background: "#EDF8EC",
70
+ selectedHover: "#E2F4E1",
71
+ },
72
+ };
73
+
74
+ export const base: BaseColors = {
75
+ dark: "#141618",
76
+ light: "#999D9F",
77
+ main: "#434749",
78
+ contrastText: "#FFFFFF",
79
+ backdropOverlay: "#14161899",
80
+ divider: "#DCDEE0",
81
+ standardInputLine: "#D5D8D9",
82
+ background: {
83
+ accent: "#F6F8FA",
84
+ appBar: "#FFFFFF",
85
+ paper: "#FFFFFF",
86
+ skeleton: "#F1F3F5",
87
+ snackbar: "#0D2358",
88
+ },
89
+ common: {
90
+ black: "#000000",
91
+ white: "#FFFFFF",
92
+ },
93
+ filledInput: {
94
+ background: "#F1F3F5",
95
+ backgroundHover: "#E7E9EB",
96
+ outlinedBorder: "#D5D8D9",
97
+ outlinedBorderHover: "#999D9F",
98
+ placeholderLabel: "#999D9F",
99
+ required: "#E71B0C",
100
+ },
101
+ text: {
102
+ primary: "#141618",
103
+ secondary: "#64686B",
104
+ disabled: "#999D9F",
105
+ },
106
+ state: {
107
+ hover: "#1416180A",
108
+ disabledBackground: "#F1F3F5",
109
+ disabledContent: "#B9BCBE",
110
+ selected: "#F1F3F5",
111
+ selectedHover: "#E7E9EB",
112
+ focus: "#DCDEE0",
113
+ active: "#64686B",
114
+ },
115
+ };
116
+
117
+ export const fleetPalette = {
118
+ ...bootstrapColors,
119
+ base: base,
120
+ };
121
+
122
+ export default fleetPalette;
@@ -0,0 +1,13 @@
1
+ import { BreakpointsOptions } from "@mui/material";
2
+
3
+ const fleetBreakpoints: BreakpointsOptions = {
4
+ values: {
5
+ xs: 0,
6
+ sm: 481,
7
+ md: 768,
8
+ lg: 1024,
9
+ xl: 1440,
10
+ },
11
+ };
12
+
13
+ export default fleetBreakpoints;