@carrier-dpx/air-react-library 0.5.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.
- package/package.json +1 -1
- package/src/components/BottomNavigation/BottomNavigation.figma.tsx +54 -0
- package/src/components/BottomNavigation/BottomNavigation.tsx +45 -0
- package/src/components/BottomNavigation/BottomNavigationAction.figma.tsx +87 -0
- package/src/components/BottomNavigation/BottomNavigationAction.tsx +110 -0
- package/src/components/BottomNavigation/index.ts +7 -0
- package/src/components/Copyright/Copyright.figma.tsx +2 -10
- package/src/components/Icon/ArrowLeftIcon.figma.tsx +33 -0
- package/src/components/Icon/ArrowRightIcon.figma.tsx +33 -0
- package/src/components/Icon/CheckIcon.figma.tsx +33 -0
- package/src/components/Icon/CloseIcon.figma.tsx +33 -0
- package/src/components/Icon/HomeIcon.figma.tsx +33 -0
- package/src/components/Icon/Icon.figma.tsx +68 -0
- package/src/components/Icon/Icon.tsx +24 -0
- package/src/components/Icon/InfoIcon.figma.tsx +33 -0
- package/src/components/Icon/MenuIcon.figma.tsx +33 -0
- package/src/components/Icon/README.md +207 -0
- package/src/components/Icon/SearchIcon.figma.tsx +33 -0
- package/src/components/Icon/SettingsIcon.figma.tsx +61 -0
- package/src/components/Icon/UserIcon.figma.tsx +33 -0
- package/src/components/Icon/icons/demo/AlertIcon.figma.tsx +28 -0
- package/src/components/Icon/icons/demo/AlertIcon.tsx +19 -0
- package/src/components/Icon/icons/demo/DEMO_USAGE.md +113 -0
- package/src/components/Icon/icons/demo/DeviceManagerIcon.figma.tsx +38 -0
- package/src/components/Icon/icons/demo/DeviceManagerIcon.tsx +16 -0
- package/src/components/Icon/icons/demo/HomeIcon.figma.tsx +28 -0
- package/src/components/Icon/icons/demo/HomeIcon.tsx +13 -0
- package/src/components/Icon/icons/demo/README.md +57 -0
- package/src/components/Icon/icons/demo/SiteIcon.figma.tsx +28 -0
- package/src/components/Icon/icons/demo/SiteIcon.tsx +13 -0
- package/src/components/Icon/icons/demo/SvgIcon.tsx +39 -0
- package/src/components/Icon/icons/demo/WarningIcon.figma.tsx +28 -0
- package/src/components/Icon/icons/demo/WarningIcon.tsx +15 -0
- package/src/components/Icon/icons/demo/devicemanager_outlined.svg +6 -0
- package/src/components/Icon/icons/demo/home_outlined.svg +3 -0
- package/src/components/Icon/icons/demo/iconRegistry.ts +97 -0
- package/src/components/Icon/icons/demo/index.ts +23 -0
- package/src/components/Icon/icons/demo/site_outlined.svg +3 -0
- package/src/components/Icon/icons/demo/warning_outlined.svg +5 -0
- package/src/components/Icon/index.ts +3 -0
- package/src/components/Navbar/ExtraNavigation/ExtraNavigation.tsx +86 -0
- package/src/components/Navbar/ExtraNavigation/index.ts +2 -0
- package/src/components/Navbar/ExtraNavigation/styles.tsx +10 -0
- package/src/components/Navbar/ExtraNavigation/types.ts +43 -0
- package/src/components/Navbar/Navbar.figma.tsx +118 -0
- package/src/components/Navbar/Navbar.tsx +110 -0
- package/src/components/Navbar/NavbarButtons/Item.figma.tsx +117 -0
- package/src/components/Navbar/NavbarButtons/NavbarFooterButton.tsx +57 -0
- package/src/components/Navbar/NavbarButtons/NavbarTooltip.tsx +56 -0
- package/src/components/Navbar/NavbarButtons/NavigationButton.tsx +98 -0
- package/src/components/Navbar/NavbarButtons/index.ts +3 -0
- package/src/components/Navbar/NavbarButtons/styles.tsx +112 -0
- package/src/components/Navbar/NavbarButtons/types.ts +8 -0
- package/src/components/Navbar/NavbarFooter/NavbarFooter.tsx +40 -0
- package/src/components/Navbar/NavbarFooter/index.ts +2 -0
- package/src/components/Navbar/NavbarFooter/styles.tsx +14 -0
- package/src/components/Navbar/NavbarFooter/types.ts +15 -0
- package/src/components/Navbar/NavbarLogo/NavbarLogo.tsx +45 -0
- package/src/components/Navbar/NavbarLogo/index.ts +2 -0
- package/src/components/Navbar/NavbarLogo/styles.ts +18 -0
- package/src/components/Navbar/NavbarLogo/types.ts +18 -0
- package/src/components/Navbar/NavbarProvider.tsx +15 -0
- package/src/components/Navbar/Navigation/Navigation.tsx +113 -0
- package/src/components/Navbar/Navigation/helpers.ts +9 -0
- package/src/components/Navbar/Navigation/index.ts +2 -0
- package/src/components/Navbar/Navigation/styles.tsx +10 -0
- package/src/components/Navbar/Navigation/types.ts +68 -0
- package/src/components/Navbar/constants.ts +45 -0
- package/src/components/Navbar/hooks/useNavbarContext.tsx +12 -0
- package/src/components/Navbar/index.tsx +7 -0
- package/src/components/Navbar/styles.tsx +44 -0
- package/src/components/Navbar/types.ts +67 -0
- package/src/components/theme/FleetThemeProvider.tsx +50 -50
- package/src/components/theme/constants/fleetComponents.ts +873 -873
- package/src/index.ts +8 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Icon Component with Figma Code Connect
|
|
2
|
+
|
|
3
|
+
This directory contains the Icon wrapper component and Figma Code Connect mappings for individual icon components.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
### Icon Wrapper + Individual Icon Components
|
|
8
|
+
|
|
9
|
+
The Icon system uses:
|
|
10
|
+
- **One Icon wrapper component** (`Icon.tsx`) - Material-UI Icon wrapper that handles `fontSize` (xsmall, small, medium, large)
|
|
11
|
+
- **Individual icon components** - Separate components for each icon (SettingsIcon, HomeIcon, etc.) that handle `variant` (outlined, filled)
|
|
12
|
+
- **Individual Figma connections** - One `.figma.tsx` file per icon component
|
|
13
|
+
|
|
14
|
+
## Component Usage
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Icon } from '@carrier-dpx/air-react-library';
|
|
18
|
+
import { SettingsIcon, HomeIcon } from '@carrier-io/icons'; // Your icon library
|
|
19
|
+
|
|
20
|
+
// Basic usage
|
|
21
|
+
<Icon fontSize="medium">
|
|
22
|
+
<SettingsIcon variant="filled" />
|
|
23
|
+
</Icon>
|
|
24
|
+
|
|
25
|
+
// Different sizes
|
|
26
|
+
<Icon fontSize="xsmall">
|
|
27
|
+
<HomeIcon variant="outlined" />
|
|
28
|
+
</Icon>
|
|
29
|
+
|
|
30
|
+
<Icon fontSize="large">
|
|
31
|
+
<SettingsIcon variant="filled" />
|
|
32
|
+
</Icon>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Figma Code Connect Pattern
|
|
36
|
+
|
|
37
|
+
Each icon has its own `.figma.tsx` file that:
|
|
38
|
+
|
|
39
|
+
1. **Imports the icon component** (from your icon library)
|
|
40
|
+
2. **Imports the Icon wrapper** (for fontSize)
|
|
41
|
+
3. **Maps to a specific Figma icon component** (via Figma URL)
|
|
42
|
+
4. **Maps variant and optionally fontSize** props
|
|
43
|
+
|
|
44
|
+
### Example: SettingsIcon.figma.tsx
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import figma from "@figma/code-connect";
|
|
48
|
+
import Icon from "./Icon";
|
|
49
|
+
import { SettingsIcon } from '@carrier-io/icons'; // Your icon library
|
|
50
|
+
|
|
51
|
+
figma.connect(
|
|
52
|
+
SettingsIcon, // The actual icon component
|
|
53
|
+
"https://www.figma.com/design/.../SettingsIcon",
|
|
54
|
+
{
|
|
55
|
+
props: {
|
|
56
|
+
// Variant is handled by the icon component
|
|
57
|
+
variant: figma.enum("variant", {
|
|
58
|
+
outlined: "outlined",
|
|
59
|
+
filled: "filled",
|
|
60
|
+
}),
|
|
61
|
+
|
|
62
|
+
// fontSize is optional - can be mapped from Figma or set manually
|
|
63
|
+
// fontSize: figma.enum("fontSize", {
|
|
64
|
+
// "xsmall-12px": "xsmall",
|
|
65
|
+
// "small-16px": "small",
|
|
66
|
+
// "medium-24px": "medium",
|
|
67
|
+
// "large-32px": "large",
|
|
68
|
+
// }),
|
|
69
|
+
},
|
|
70
|
+
example: ({ variant }) => (
|
|
71
|
+
<Icon fontSize="medium">
|
|
72
|
+
<SettingsIcon variant={variant} />
|
|
73
|
+
</Icon>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Key Points**:
|
|
80
|
+
- The icon component (SettingsIcon) is what Figma connects to
|
|
81
|
+
- The Icon wrapper handles fontSize
|
|
82
|
+
- Each icon gets its own `.figma.tsx` file so Figma recognizes them separately
|
|
83
|
+
|
|
84
|
+
## Icon Component Structure
|
|
85
|
+
|
|
86
|
+
Your icon components should follow this pattern:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
// SettingsIcon.tsx (in your icon library)
|
|
90
|
+
export interface SettingsIconProps {
|
|
91
|
+
variant?: "outlined" | "filled";
|
|
92
|
+
// ... other props
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const SettingsIcon: FC<SettingsIconProps> = ({ variant = "outlined", ...props }) => {
|
|
96
|
+
// Render SVG based on variant
|
|
97
|
+
return <svg>...</svg>;
|
|
98
|
+
};
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Adding New Icons
|
|
102
|
+
|
|
103
|
+
To add a new icon to the Figma integration:
|
|
104
|
+
|
|
105
|
+
1. **Ensure the icon component exists** in your icon library (Bitbucket repo)
|
|
106
|
+
|
|
107
|
+
2. **Create a new `.figma.tsx` file** following the pattern:
|
|
108
|
+
```tsx
|
|
109
|
+
// {IconName}Icon.figma.tsx
|
|
110
|
+
import figma from "@figma/code-connect";
|
|
111
|
+
import Icon from "./Icon";
|
|
112
|
+
import { YourIconName } from '@carrier-io/icons'; // Your icon library
|
|
113
|
+
|
|
114
|
+
figma.connect(
|
|
115
|
+
YourIconName,
|
|
116
|
+
"YOUR_FIGMA_ICON_URL_HERE",
|
|
117
|
+
{
|
|
118
|
+
props: {
|
|
119
|
+
variant: figma.enum("variant", {
|
|
120
|
+
outlined: "outlined",
|
|
121
|
+
filled: "filled",
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
example: ({ variant }) => (
|
|
125
|
+
<Icon fontSize="medium">
|
|
126
|
+
<YourIconName variant={variant} />
|
|
127
|
+
</Icon>
|
|
128
|
+
),
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
3. **Get the Figma URL** by:
|
|
134
|
+
- Opening the icon component in Figma
|
|
135
|
+
- Right-clicking → "Copy link to selection"
|
|
136
|
+
- Replacing the URL in the `figma.connect()` call
|
|
137
|
+
|
|
138
|
+
## Scaling to 700 Icons
|
|
139
|
+
|
|
140
|
+
### Option 1: Manual Creation
|
|
141
|
+
Create individual `.figma.tsx` files for each icon. This gives you full control.
|
|
142
|
+
|
|
143
|
+
### Option 2: Code Generation Script
|
|
144
|
+
Create a script that generates `.figma.tsx` files from a list of icons:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// scripts/generateIconConnections.ts
|
|
148
|
+
const icons = [
|
|
149
|
+
{ name: "SettingsIcon", figmaNodeId: "SETTINGS-ICON-NODE-ID" },
|
|
150
|
+
{ name: "HomeIcon", figmaNodeId: "HOME-ICON-NODE-ID" },
|
|
151
|
+
// ... 698 more icons
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
icons.forEach(({ name, figmaNodeId }) => {
|
|
155
|
+
const content = `
|
|
156
|
+
import figma from "@figma/code-connect";
|
|
157
|
+
import Icon from "./Icon";
|
|
158
|
+
import { ${name} } from '@carrier-io/icons';
|
|
159
|
+
|
|
160
|
+
figma.connect(
|
|
161
|
+
${name},
|
|
162
|
+
"https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=${figmaNodeId}",
|
|
163
|
+
{
|
|
164
|
+
props: {
|
|
165
|
+
variant: figma.enum("variant", {
|
|
166
|
+
outlined: "outlined",
|
|
167
|
+
filled: "filled",
|
|
168
|
+
}),
|
|
169
|
+
},
|
|
170
|
+
example: ({ variant }) => (
|
|
171
|
+
<Icon fontSize="medium">
|
|
172
|
+
<${name} variant={variant} />
|
|
173
|
+
</Icon>
|
|
174
|
+
),
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
`;
|
|
178
|
+
// Write to file: ${name}.figma.tsx
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Icon Library Integration
|
|
183
|
+
|
|
184
|
+
The icon components should be imported from your icon library package (Bitbucket repo). Update the imports in each `.figma.tsx` file to point to your actual icon library:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
// Replace placeholder imports with actual icon library imports
|
|
188
|
+
import { SettingsIcon, HomeIcon, UserIcon } from '@carrier-io/icons';
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Testing
|
|
192
|
+
|
|
193
|
+
The current setup includes sample Figma connections for testing. To test:
|
|
194
|
+
|
|
195
|
+
1. **Update imports** in `.figma.tsx` files to point to your actual icon library
|
|
196
|
+
2. **Update Figma URLs** with real node IDs from your Figma file
|
|
197
|
+
3. **Run** `npm run figma:connect` to publish connections
|
|
198
|
+
4. **Open Figma** and check Dev Mode
|
|
199
|
+
5. **Select an icon component** → verify it shows the correct React code
|
|
200
|
+
|
|
201
|
+
## Notes
|
|
202
|
+
|
|
203
|
+
- Each icon needs its own Figma component with a "variant" property (outlined/filled)
|
|
204
|
+
- The Icon wrapper handles fontSize (xsmall, small, medium, large)
|
|
205
|
+
- Icon components handle variant (outlined, filled)
|
|
206
|
+
- Icon components are imported from your icon library (Bitbucket repo)
|
|
207
|
+
- The Figma URL must point to the specific icon component instance
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Code Connect Configuration for Search Icon
|
|
3
|
+
*
|
|
4
|
+
* NOTE: Import SearchIcon from your actual icon library package.
|
|
5
|
+
* Example: import { SearchIcon } from '@carrier-io/icons';
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import figma from "@figma/code-connect";
|
|
9
|
+
import Icon from "./Icon";
|
|
10
|
+
// TODO: Import from your actual icon library
|
|
11
|
+
// import { SearchIcon } from '@carrier-io/icons';
|
|
12
|
+
|
|
13
|
+
// Placeholder - replace with actual SearchIcon import
|
|
14
|
+
const SearchIcon = ({ variant, ...props }: any) => <span {...props}>SearchIcon</span>;
|
|
15
|
+
|
|
16
|
+
// TODO: Uncomment and update with real Figma URL when ready
|
|
17
|
+
// figma.connect(
|
|
18
|
+
// SearchIcon,
|
|
19
|
+
// "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=SEARCH-ICON-NODE-ID",
|
|
20
|
+
// {
|
|
21
|
+
// props: {
|
|
22
|
+
// variant: figma.enum("variant", {
|
|
23
|
+
// outlined: "outlined",
|
|
24
|
+
// filled: "filled",
|
|
25
|
+
// }),
|
|
26
|
+
// },
|
|
27
|
+
// example: ({ variant }) => (
|
|
28
|
+
// <Icon fontSize="medium">
|
|
29
|
+
// <SearchIcon variant={variant} />
|
|
30
|
+
// </Icon>
|
|
31
|
+
// ),
|
|
32
|
+
// }
|
|
33
|
+
// );
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Code Connect Configuration for Settings Icon
|
|
3
|
+
*
|
|
4
|
+
* This connects Figma's SettingsIcon component to the React SettingsIcon component.
|
|
5
|
+
* The icon component is wrapped in the Icon wrapper for fontSize control.
|
|
6
|
+
*
|
|
7
|
+
* Figma URL: https://www.figma.com/design/RT43n0bKuuIt7ylllD3DR0/Icon-Library?node-id=31-2
|
|
8
|
+
*
|
|
9
|
+
* NOTE: Import SettingsIcon from your actual icon library package.
|
|
10
|
+
* Example: import { SettingsIcon } from '@carrier-io/icons';
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import figma from "@figma/code-connect";
|
|
14
|
+
import Icon from "./Icon";
|
|
15
|
+
// TODO: Import from your actual icon library
|
|
16
|
+
// import { SettingsIcon } from '@carrier-io/icons';
|
|
17
|
+
|
|
18
|
+
// Placeholder - replace with actual SettingsIcon import
|
|
19
|
+
const SettingsIcon = ({ variant, ...props }: any) => <span {...props}>SettingsIcon</span>;
|
|
20
|
+
|
|
21
|
+
figma.connect(
|
|
22
|
+
SettingsIcon,
|
|
23
|
+
"https://www.figma.com/design/RT43n0bKuuIt7ylllD3DR0/Icon-Library?node-id=31-2",
|
|
24
|
+
{
|
|
25
|
+
props: {
|
|
26
|
+
/**
|
|
27
|
+
* STYLE MAPPING
|
|
28
|
+
* Maps Figma's "Style" property to the icon component's "variant" prop
|
|
29
|
+
* Figma uses "Style" with values "Outlined" and "Filled"
|
|
30
|
+
* React icon component expects "variant" with values "outlined" and "filled"
|
|
31
|
+
*/
|
|
32
|
+
variant: figma.enum("Style", {
|
|
33
|
+
Outlined: "outlined",
|
|
34
|
+
Filled: "filled",
|
|
35
|
+
}),
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* FONT SIZE MAPPING (optional)
|
|
39
|
+
* If your Figma icon component has a fontSize property, map it here
|
|
40
|
+
* Otherwise, fontSize is set on the Icon wrapper component
|
|
41
|
+
*/
|
|
42
|
+
// fontSize: figma.enum("fontSize", {
|
|
43
|
+
// "xsmall-12px": "xsmall",
|
|
44
|
+
// "small-16px": "small",
|
|
45
|
+
// "medium-24px": "medium",
|
|
46
|
+
// "large-32px": "large",
|
|
47
|
+
// }),
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* EXAMPLE CODE TEMPLATE
|
|
51
|
+
* Shows the icon component wrapped in Icon for fontSize control.
|
|
52
|
+
* The Icon wrapper handles fontSize (xsmall, small, medium, large).
|
|
53
|
+
* The icon component handles variant (outlined, filled).
|
|
54
|
+
*/
|
|
55
|
+
example: ({ variant }) => (
|
|
56
|
+
<Icon fontSize="medium">
|
|
57
|
+
<SettingsIcon variant={variant} />
|
|
58
|
+
</Icon>
|
|
59
|
+
),
|
|
60
|
+
}
|
|
61
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Code Connect Configuration for User Icon
|
|
3
|
+
*
|
|
4
|
+
* NOTE: Import UserIcon from your actual icon library package.
|
|
5
|
+
* Example: import { UserIcon } from '@carrier-io/icons';
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import figma from "@figma/code-connect";
|
|
9
|
+
import Icon from "./Icon";
|
|
10
|
+
// TODO: Import from your actual icon library
|
|
11
|
+
// import { UserIcon } from '@carrier-io/icons';
|
|
12
|
+
|
|
13
|
+
// Placeholder - replace with actual UserIcon import
|
|
14
|
+
const UserIcon = ({ variant, ...props }: any) => <span {...props}>UserIcon</span>;
|
|
15
|
+
|
|
16
|
+
// TODO: Uncomment and update with real Figma URL when ready
|
|
17
|
+
// figma.connect(
|
|
18
|
+
// UserIcon,
|
|
19
|
+
// "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=USER-ICON-NODE-ID",
|
|
20
|
+
// {
|
|
21
|
+
// props: {
|
|
22
|
+
// variant: figma.enum("variant", {
|
|
23
|
+
// outlined: "outlined",
|
|
24
|
+
// filled: "filled",
|
|
25
|
+
// }),
|
|
26
|
+
// },
|
|
27
|
+
// example: ({ variant }) => (
|
|
28
|
+
// <Icon fontSize="medium">
|
|
29
|
+
// <UserIcon variant={variant} />
|
|
30
|
+
// </Icon>
|
|
31
|
+
// ),
|
|
32
|
+
// }
|
|
33
|
+
// );
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Code Connect Configuration for AlertIcon
|
|
3
|
+
*
|
|
4
|
+
* This connects Figma's warning_triangle icon component to the React AlertIcon component.
|
|
5
|
+
* Also known as WarningIcon in some contexts.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import figma from "@figma/code-connect";
|
|
9
|
+
import Icon from "../../Icon";
|
|
10
|
+
import { AlertIcon } from "./AlertIcon";
|
|
11
|
+
|
|
12
|
+
figma.connect(
|
|
13
|
+
AlertIcon,
|
|
14
|
+
"https://www.figma.com/design/RT43n0bKuuIt7ylllD3DR0/Icon-Library?node-id=29-54",
|
|
15
|
+
{
|
|
16
|
+
props: {
|
|
17
|
+
variant: figma.enum("State", {
|
|
18
|
+
Outlined: "outlined",
|
|
19
|
+
Filled: "filled",
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
example: ({ variant }) => (
|
|
23
|
+
<Icon fontSize="medium">
|
|
24
|
+
<AlertIcon variant={variant} />
|
|
25
|
+
</Icon>
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FC, SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
export interface AlertIconProps extends SVGProps<SVGSVGElement> {
|
|
4
|
+
variant?: "outlined" | "filled";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* AlertIcon (also known as WarningIcon)
|
|
9
|
+
* Warning triangle icon for alerts
|
|
10
|
+
*/
|
|
11
|
+
export const AlertIcon: FC<AlertIconProps> = ({ variant = "outlined", ...props }) => {
|
|
12
|
+
return (
|
|
13
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
14
|
+
<path d="M12 16C12.2833 16 12.5212 16.0954 12.7129 16.2871C12.9046 16.4788 13 16.7167 13 17C13 17.2833 12.9046 17.5212 12.7129 17.7129C12.5212 17.9046 12.2833 18 12 18C11.7167 18 11.4788 17.9045 11.2871 17.7129C11.0955 17.5212 11 17.2833 11 17C11 16.7167 11.0955 16.4788 11.2871 16.2871C11.4788 16.0955 11.7167 16 12 16Z" fill="currentColor"/>
|
|
15
|
+
<path d="M12 10C12.2833 10 12.5212 10.0954 12.7129 10.2871C12.9046 10.4788 13 10.7167 13 11V14C13 14.2833 12.9046 14.5212 12.7129 14.7129C12.5212 14.9046 12.2833 15 12 15C11.7167 15 11.4788 14.9045 11.2871 14.7129C11.0955 14.5212 11 14.2833 11 14V11C11 10.7167 11.0955 10.4788 11.2871 10.2871C11.4788 10.0955 11.7167 10 12 10Z" fill="currentColor"/>
|
|
16
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M12 3C12.1666 3 12.329 3.04172 12.4873 3.125C12.6456 3.20833 12.775 3.33334 12.875 3.5L22.125 19.5C22.225 19.6667 22.271 19.8377 22.2627 20.0127C22.2544 20.1876 22.2083 20.3501 22.125 20.5C22.0417 20.6499 21.9252 20.7707 21.7754 20.8623C21.6255 20.9539 21.4586 20.9999 21.2754 21H2.72462C2.54144 20.9999 2.37452 20.9539 2.22462 20.8623C2.0748 20.7707 1.95828 20.6499 1.87501 20.5C1.79171 20.3501 1.74567 20.1876 1.73732 20.0127C1.72898 19.8377 1.77501 19.6667 1.87501 19.5L11.125 3.5C11.225 3.33334 11.3544 3.20833 11.5127 3.125C11.671 3.04173 11.8334 3 12 3ZM4.45021 19H19.5498L12 6L4.45021 19Z" fill="currentColor"/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Demo Icons Usage Guide
|
|
2
|
+
|
|
3
|
+
This guide shows how to use the demo icons in BottomNavigation for your Leadership demo.
|
|
4
|
+
|
|
5
|
+
## Available Icons
|
|
6
|
+
|
|
7
|
+
- `devicemanager` - Device Manager icon
|
|
8
|
+
- `home` - Home icon
|
|
9
|
+
- `site` - Site icon
|
|
10
|
+
- `warning` - Warning icon
|
|
11
|
+
|
|
12
|
+
## Usage in BottomNavigation
|
|
13
|
+
|
|
14
|
+
### Option 1: Using SvgIcon Component (Recommended)
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import BottomNavigation from '@carrier-dpx/air-react-library/BottomNavigation';
|
|
18
|
+
import BottomNavigationAction from '@carrier-dpx/air-react-library/BottomNavigationAction';
|
|
19
|
+
import Typography from '@carrier-dpx/air-react-library/Typography';
|
|
20
|
+
import Icon from '@carrier-dpx/air-react-library/Icon';
|
|
21
|
+
import { SvgIcon } from './icons/demo/SvgIcon';
|
|
22
|
+
|
|
23
|
+
function DemoBottomNavigation() {
|
|
24
|
+
return (
|
|
25
|
+
<BottomNavigation value={0} onChange={() => {}} showLabel="On">
|
|
26
|
+
<BottomNavigationAction
|
|
27
|
+
icon={
|
|
28
|
+
<Icon fontSize="medium">
|
|
29
|
+
<SvgIcon name="home" />
|
|
30
|
+
</Icon>
|
|
31
|
+
}
|
|
32
|
+
label={<Typography variant="body3Semibold">Home</Typography>}
|
|
33
|
+
labelvisibility="On"
|
|
34
|
+
/>
|
|
35
|
+
<BottomNavigationAction
|
|
36
|
+
icon={
|
|
37
|
+
<Icon fontSize="medium">
|
|
38
|
+
<SvgIcon name="devicemanager" />
|
|
39
|
+
</Icon>
|
|
40
|
+
}
|
|
41
|
+
label={<Typography variant="body3Semibold">Devices</Typography>}
|
|
42
|
+
labelvisibility="On"
|
|
43
|
+
/>
|
|
44
|
+
<BottomNavigationAction
|
|
45
|
+
icon={
|
|
46
|
+
<Icon fontSize="medium">
|
|
47
|
+
<SvgIcon name="site" />
|
|
48
|
+
</Icon>
|
|
49
|
+
}
|
|
50
|
+
label={<Typography variant="body3Semibold">Sites</Typography>}
|
|
51
|
+
labelvisibility="On"
|
|
52
|
+
/>
|
|
53
|
+
<BottomNavigationAction
|
|
54
|
+
icon={
|
|
55
|
+
<Icon fontSize="medium">
|
|
56
|
+
<SvgIcon name="warning" />
|
|
57
|
+
</Icon>
|
|
58
|
+
}
|
|
59
|
+
label={<Typography variant="body3Semibold">Alerts</Typography>}
|
|
60
|
+
labelvisibility="On"
|
|
61
|
+
/>
|
|
62
|
+
</BottomNavigation>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Option 2: Using Individual Icon Components
|
|
68
|
+
|
|
69
|
+
If you prefer individual components (already created):
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { DeviceManagerIcon, HomeIcon, SiteIcon, WarningIcon } from './icons/demo';
|
|
73
|
+
|
|
74
|
+
// Usage:
|
|
75
|
+
<Icon fontSize="medium">
|
|
76
|
+
<HomeIcon variant="outlined" />
|
|
77
|
+
</Icon>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Scaling to 700 Icons
|
|
81
|
+
|
|
82
|
+
For 700 icons, you would:
|
|
83
|
+
|
|
84
|
+
1. **Generate the icon registry programmatically** from your SVG folder:
|
|
85
|
+
```typescript
|
|
86
|
+
// scripts/generateIconRegistry.ts
|
|
87
|
+
// Reads all SVG files and generates iconRegistry.ts
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
2. **Use the SvgIcon component** with icon names:
|
|
91
|
+
```tsx
|
|
92
|
+
<SvgIcon name="iconname" />
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
3. **For Figma Code Connect**, you have two options:
|
|
96
|
+
- **Option A**: Create individual wrapper components programmatically (one per icon)
|
|
97
|
+
- **Option B**: Use a single generic component and map icon names in Figma
|
|
98
|
+
|
|
99
|
+
## Figma Code Connect Setup
|
|
100
|
+
|
|
101
|
+
For Figma connections, you'll need individual React components. You can:
|
|
102
|
+
|
|
103
|
+
1. **Generate components programmatically** from SVG files
|
|
104
|
+
2. **Create Figma connection files** for each icon
|
|
105
|
+
|
|
106
|
+
See the individual `.figma.tsx` files in this directory for examples.
|
|
107
|
+
|
|
108
|
+
## Notes
|
|
109
|
+
|
|
110
|
+
- Icons use `fill="currentColor"` so they inherit the text color from their parent
|
|
111
|
+
- Icons are wrapped in the `Icon` component for `fontSize` control
|
|
112
|
+
- The `BottomNavigationAction` component uses `figma.nestedProps()` to access icon properties
|
|
113
|
+
- For production with 700 icons, consider creating a build script to generate components from SVG files
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Code Connect Configuration for DeviceManagerIcon
|
|
3
|
+
*
|
|
4
|
+
* TODO: Update the Figma URL below with the actual Figma component URL
|
|
5
|
+
* Get the URL by:
|
|
6
|
+
* 1. Opening the icon component in Figma
|
|
7
|
+
* 2. Right-clicking → "Copy link to selection"
|
|
8
|
+
* 3. Replace the URL in the figma.connect() call below
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import figma from "@figma/code-connect";
|
|
12
|
+
import Icon from "../../Icon";
|
|
13
|
+
import { DeviceManagerIcon } from "./DeviceManagerIcon";
|
|
14
|
+
|
|
15
|
+
// TODO: Uncomment and update with real Figma URL when ready
|
|
16
|
+
figma.connect(
|
|
17
|
+
DeviceManagerIcon,
|
|
18
|
+
"https://www.figma.com/design/RT43n0bKuuIt7ylllD3DR0/Icon-Library?node-id=1380-3039",
|
|
19
|
+
{
|
|
20
|
+
props: {
|
|
21
|
+
/**
|
|
22
|
+
* STATE/VARIANT MAPPING
|
|
23
|
+
* Maps Figma's "State" property to React's "variant" prop
|
|
24
|
+
* Figma: State="Outlined" → React: variant="outlined"
|
|
25
|
+
* Figma: State="Filled" → React: variant="filled"
|
|
26
|
+
*/
|
|
27
|
+
variant: figma.enum("State", {
|
|
28
|
+
Outlined: "outlined",
|
|
29
|
+
Filled: "filled",
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
example: ({ variant }) => (
|
|
33
|
+
<Icon fontSize="medium">
|
|
34
|
+
<DeviceManagerIcon variant={variant} />
|
|
35
|
+
</Icon>
|
|
36
|
+
),
|
|
37
|
+
}
|
|
38
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
export interface DeviceManagerIconProps extends SVGProps<SVGSVGElement> {
|
|
4
|
+
variant?: "outlined" | "filled";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const DeviceManagerIcon: FC<DeviceManagerIconProps> = ({ variant = "outlined", ...props }) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path d="M2.49805 18.041C3.75805 18.2505 4.74948 19.2419 4.95898 20.502C5.00427 20.7744 4.77614 21 4.5 21H3C2.44772 21 2 20.5523 2 20V18.5C2 18.2239 2.22564 17.9957 2.49805 18.041Z" fill="currentColor"/>
|
|
11
|
+
<path d="M2.5 14.0176C5.97085 14.2618 8.73818 17.0292 8.98242 20.5C9.00176 20.7754 8.77612 21 8.5 21H7.5C7.22396 21 7.003 20.7756 6.97559 20.501C6.7411 18.1393 4.86065 16.2589 2.49902 16.0244C2.22437 15.997 2 15.776 2 15.5V14.5C2 14.2239 2.22457 13.9982 2.5 14.0176Z" fill="currentColor"/>
|
|
12
|
+
<path d="M2.5 10.0107C8.17278 10.2648 12.7351 14.8187 12.9893 20.5C13.0015 20.7758 12.7761 21 12.5 21H11.5C11.2239 21 11.0014 20.7757 10.9863 20.5C10.7359 15.928 7.07198 12.2641 2.5 12.0137C2.22427 11.9986 2 11.7761 2 11.5V10.5C2 10.2239 2.22424 9.99852 2.5 10.0107Z" fill="currentColor"/>
|
|
13
|
+
<path d="M9.09863 3.00488C9.32763 3.02757 9.54289 3.12883 9.70703 3.29297L11.4141 5H19C20.6569 5 22 6.34315 22 8V19.5C22 20.3284 21.3284 21 20.5 21H16C15.4477 21 15 20.5523 15 20C15 19.4477 15.4477 19 16 19H20V8C20 7.44772 19.5523 7 19 7H11C10.7348 7 10.4805 6.89457 10.293 6.70703L8.58594 5H4V7C4 7.55228 3.55228 8 3 8C2.44772 8 2 7.55228 2 7V4.5C2 3.67157 2.67157 3 3.5 3H9L9.09863 3.00488Z" fill="currentColor"/>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Code Connect Configuration for HomeIcon
|
|
3
|
+
*
|
|
4
|
+
* TODO: Update the Figma URL below with the actual Figma component URL
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import figma from "@figma/code-connect";
|
|
8
|
+
import Icon from "../../Icon";
|
|
9
|
+
import { HomeIcon } from "./HomeIcon";
|
|
10
|
+
|
|
11
|
+
// TODO: Uncomment and update with real Figma URL when ready
|
|
12
|
+
figma.connect(
|
|
13
|
+
HomeIcon,
|
|
14
|
+
"https://www.figma.com/design/RT43n0bKuuIt7ylllD3DR0/Icon-Library?node-id=38-171",
|
|
15
|
+
{
|
|
16
|
+
props: {
|
|
17
|
+
variant: figma.enum("State", {
|
|
18
|
+
Outlined: "outlined",
|
|
19
|
+
Filled: "filled",
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
example: ({ variant }) => (
|
|
23
|
+
<Icon fontSize="medium">
|
|
24
|
+
<HomeIcon variant={variant} />
|
|
25
|
+
</Icon>
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
export interface HomeIconProps extends SVGProps<SVGSVGElement> {
|
|
4
|
+
variant?: "outlined" | "filled";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const HomeIcon: FC<HomeIconProps> = ({ variant = "outlined", ...props }) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M11.4775 2.33597C11.7769 2.25498 12.0907 2.24493 12.3936 2.3057L12.5225 2.33597L12.6826 2.38871C13.0467 2.52881 13.3532 2.7853 13.5967 2.97464L20.3789 8.25003C20.7873 8.56768 21.1481 8.83746 21.4121 9.19437C21.6289 9.48753 21.7903 9.81791 21.8887 10.169C21.9784 10.4897 21.9967 10.8234 22 11.1885V17.7998C22 18.3431 22.001 18.8108 21.9697 19.1944C21.9374 19.5896 21.8655 19.9831 21.6729 20.3614C21.3853 20.9257 20.9266 21.3853 20.3623 21.6729C19.9841 21.8656 19.5905 21.9365 19.1953 21.9688C18.8117 22.0001 18.3432 22 17.7998 22H6.2002C5.65675 22 5.18831 22.0001 4.80469 21.9688C4.40952 21.9365 4.01591 21.8656 3.6377 21.6729C3.07338 21.3853 2.61471 20.9257 2.32715 20.3614C2.1345 19.9831 2.06257 19.5896 2.03027 19.1944C2.01464 19.0028 2.00763 18.7901 2.00391 18.5577L2 17.7998V11.1885C2.00325 10.8234 2.02155 10.4897 2.11133 10.169C2.20966 9.81791 2.37114 9.48752 2.58789 9.19437C2.8519 8.83747 3.21269 8.56768 3.62109 8.25003L10.4033 2.97464C10.6816 2.75819 11.0423 2.45384 11.4775 2.33597ZM11.9932 4.28128C11.9181 4.33146 11.8184 4.40766 11.6318 4.55277L4.84961 9.82816C4.35264 10.2147 4.25877 10.2985 4.19629 10.3828C4.12408 10.4805 4.0699 10.5911 4.03711 10.708C4.0088 10.8092 4 10.934 4 11.5645V17.7998L4.00293 18.5254C4.00602 18.7261 4.01284 18.8905 4.02441 19.0323C4.0466 19.3034 4.0842 19.4047 4.10938 19.4541C4.20522 19.642 4.35802 19.7949 4.5459 19.8907C4.59536 19.9158 4.69642 19.9534 4.96777 19.9756C5.25108 19.9988 5.62379 20 6.2002 20H8V14.5996C8 14.3362 7.99889 14.0782 8.0166 13.8614C8.03529 13.6329 8.0796 13.3631 8.21777 13.0918C8.40947 12.7157 8.71564 12.4095 9.0918 12.2178C9.36296 12.0797 9.63289 12.0353 9.86133 12.0166C10.0781 11.9989 10.3363 12 10.5996 12H13.4004C13.6637 12 13.9219 11.9989 14.1387 12.0166C14.3671 12.0353 14.637 12.0797 14.9082 12.2178C15.2374 12.3856 15.513 12.6409 15.7051 12.9541L15.7822 13.0918L15.8691 13.294C15.9408 13.4951 15.9694 13.6899 15.9834 13.8614C16.0011 14.0782 16 14.3362 16 14.5996V20H17.7998C18.3762 20 18.7489 19.9988 19.0322 19.9756C19.3036 19.9534 19.4046 19.9158 19.4541 19.8907C19.642 19.7949 19.7948 19.642 19.8906 19.4541C19.9158 19.4047 19.9534 19.3034 19.9756 19.0323C19.9987 18.749 20 18.3762 20 17.7998V11.5645C20 10.934 19.9912 10.8092 19.9629 10.708C19.9301 10.5911 19.8759 10.4805 19.8037 10.3828C19.7412 10.2985 19.6474 10.2147 19.1504 9.82816L12.3682 4.55277C12.1816 4.40765 12.0819 4.33146 12.0068 4.28128C12.0045 4.27969 12.0022 4.27783 12 4.2764C11.9978 4.27783 11.9955 4.2797 11.9932 4.28128ZM10.5996 14C10.3035 14 10.1409 14.0003 10.0244 14.0098C10.0201 14.0102 10.0156 14.0104 10.0117 14.0108C10.0113 14.015 10.0111 14.0197 10.0107 14.0244C10.0012 14.141 10 14.3033 10 14.5996V20H14V14.5996C14 14.3033 13.9988 14.141 13.9893 14.0244C13.9889 14.0197 13.9877 14.015 13.9873 14.0108C13.9837 14.0104 13.9796 14.0101 13.9756 14.0098C13.8591 14.0003 13.6965 14 13.4004 14H10.5996Z" fill="currentColor"/>
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Demo Icons
|
|
2
|
+
|
|
3
|
+
Place your SVG files here for the Leadership demo.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
icons/demo/
|
|
9
|
+
├── icon1.svg
|
|
10
|
+
├── icon2.svg
|
|
11
|
+
├── icon3.svg
|
|
12
|
+
└── ...
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
After placing your SVG files here, create React icon components that import them. See the example below.
|
|
18
|
+
|
|
19
|
+
## Example Icon Component
|
|
20
|
+
|
|
21
|
+
Create a file like `DemoIcon1.tsx`:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { FC } from "react";
|
|
25
|
+
import { ReactComponent as Icon1Svg } from "./icon1.svg";
|
|
26
|
+
|
|
27
|
+
export interface DemoIcon1Props {
|
|
28
|
+
variant?: "outlined" | "filled";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const DemoIcon1: FC<DemoIcon1Props> = ({ variant = "outlined", ...props }) => {
|
|
32
|
+
// If you have separate SVG files for outlined/filled:
|
|
33
|
+
// const IconSvg = variant === "filled" ? Icon1FilledSvg : Icon1OutlinedSvg;
|
|
34
|
+
|
|
35
|
+
return <Icon1Svg {...props} />;
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Alternative: Inline SVG
|
|
40
|
+
|
|
41
|
+
If you prefer to inline the SVG content directly in the component:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { FC } from "react";
|
|
45
|
+
|
|
46
|
+
export interface DemoIcon1Props {
|
|
47
|
+
variant?: "outlined" | "filled";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const DemoIcon1: FC<DemoIcon1Props> = ({ variant = "outlined", ...props }) => {
|
|
51
|
+
return (
|
|
52
|
+
<svg {...props} viewBox="0 0 24 24">
|
|
53
|
+
{/* Paste your SVG path/content here */}
|
|
54
|
+
</svg>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
```
|