@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrier-dpx/air-react-library",
3
- "version": "0.6.0",
3
+ "version": "0.7.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,54 @@
1
+ /**
2
+ * Figma Code Connect Configuration for BottomNavigation Component
3
+ *
4
+ * This connects Figma's BottomNavigation component to the React BottomNavigation component.
5
+ *
6
+ * Figma URL: https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=6572-50307
7
+ *
8
+ * Figma Properties:
9
+ * - showLabels (on, selected-only, off) → showLabel prop
10
+ */
11
+
12
+ import figma from "@figma/code-connect";
13
+ import BottomNavigation from "./BottomNavigation";
14
+ import BottomNavigationAction from "./BottomNavigationAction";
15
+
16
+ figma.connect(
17
+ BottomNavigation,
18
+ "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=6572-50307",
19
+ {
20
+ props: {
21
+ /**
22
+ * SHOW LABELS
23
+ * Maps Figma's "showLabels" property to React's "showLabel" prop
24
+ * Figma: on, selected-only, off
25
+ * React: "On", "Selected Only", "Off"
26
+ */
27
+ showLabel: figma.enum("showLabels", {
28
+ on: "On",
29
+ "selected-only": "Selected Only",
30
+ off: "Off",
31
+ }),
32
+
33
+ /**
34
+ * CHILDREN
35
+ * Maps BottomNavigationAction instances as children
36
+ * Use figma.instance() if BottomNavigationAction is an instance swap property
37
+ */
38
+ children: figma.instance("BottomNavigationAction"),
39
+ },
40
+ /**
41
+ * EXAMPLE CODE TEMPLATE
42
+ * Shows how BottomNavigation should be used with BottomNavigationAction children
43
+ */
44
+ example: ({ showLabel, children }) => (
45
+ <BottomNavigation
46
+ showLabel={showLabel}
47
+ value={0}
48
+ onChange={() => {}}
49
+ >
50
+ {children}
51
+ </BottomNavigation>
52
+ ),
53
+ }
54
+ );
@@ -0,0 +1,45 @@
1
+ import { forwardRef } from "react";
2
+
3
+ import {
4
+ BottomNavigation as MuiBottomNavigation,
5
+ BottomNavigationProps as MuiBottomNavigationProps,
6
+ } from "@mui/material";
7
+ import { CSSObject } from "@mui/material/styles";
8
+ import { getSxStyles } from "../utils/styles";
9
+
10
+ export interface BottomNavigationProps
11
+ extends Omit<MuiBottomNavigationProps, "showLabels"> {
12
+ /**
13
+ *
14
+ * Labels will be visible based on the selection.
15
+ */
16
+ showLabel?: "On" | "Selected Only" | "Off";
17
+ }
18
+
19
+ /** The BottomNavigation component provides a persistent and convenient way for users to visit primary destinations in an app.
20
+ *
21
+ * `import BottomNavigation from '@carrier-io/air-react/BottomNavigation'`
22
+ * `import BottomNavigationAction from '@carrier-io/air-react/BottomNavigationAction'`
23
+ */
24
+
25
+ const BottomNavigation = forwardRef<HTMLDivElement, BottomNavigationProps>(
26
+ ({ sx, ...props }, ref) => {
27
+ return (
28
+ <MuiBottomNavigation
29
+ {...props}
30
+ sx={(theme) =>
31
+ ({
32
+ ...getSxStyles(theme, sx),
33
+ // Theme-aware background: adapts to light/dark themes
34
+ backgroundColor: theme.palette.base?.background.paper,
35
+ } as CSSObject)
36
+ }
37
+ ref={ref}
38
+ />
39
+ );
40
+ }
41
+ );
42
+
43
+ BottomNavigation.displayName = "BottomNavigation";
44
+
45
+ export default BottomNavigation;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Figma Code Connect Configuration for BottomNavigationAction Component
3
+ *
4
+ * This connects Figma's BottomNavigationAction component to the React BottomNavigationAction component.
5
+ *
6
+ * Figma URL: https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=6572-50288
7
+ *
8
+ * Figma Properties:
9
+ * - selected (true, false) → selected prop
10
+ * - disabled (true, false) → disabled prop
11
+ * - focus (true, false) → Visual state (not a prop)
12
+ * - showLabel (true, false) → labelvisibility prop ("On" when true, "Off" when false)
13
+ * - ✏️ label (text property) → label prop (Typography component)
14
+ * - Icon (nested component) → icon prop
15
+ */
16
+
17
+ import figma from "@figma/code-connect";
18
+ import BottomNavigationAction from "./BottomNavigationAction";
19
+ import Typography from "../Typography";
20
+ import Icon from "../Icon";
21
+
22
+ figma.connect(
23
+ BottomNavigationAction,
24
+ "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=6572-50288",
25
+ {
26
+ props: {
27
+ /**
28
+ * SELECTED STATE
29
+ * Maps Figma's "selected" boolean to React's "selected" prop
30
+ */
31
+ selected: figma.boolean("selected"),
32
+
33
+ /**
34
+ * DISABLED STATE
35
+ * Maps Figma's "disabled" boolean to React's "disabled" prop
36
+ */
37
+ disabled: figma.boolean("disabled"),
38
+
39
+ /**
40
+ * LABEL VISIBILITY
41
+ * Maps Figma's "showLabel" boolean as an enum to React's "labelvisibility" prop
42
+ * Figma: showLabel=true → React: labelvisibility="On"
43
+ * Figma: showLabel=false → React: labelvisibility="Off"
44
+ */
45
+ labelvisibility: figma.enum("showLabel", {
46
+ true: "On",
47
+ false: "Off",
48
+ }),
49
+
50
+
51
+ /**
52
+ * LABEL TEXT
53
+ * Maps text content from "Label" layer to React label prop
54
+ * Similar to Button component which uses figma.children("Button Label")
55
+ * The label is rendered as a Typography component in React
56
+ */
57
+ label: figma.children("Label"),
58
+
59
+ /**
60
+ * ICON NESTED PROPERTIES
61
+ * Access Icon's fontSize and SVG through nested properties
62
+ */
63
+ icon: figma.nestedProps("Icon", {
64
+ fontSize: figma.enum("fontSize", {
65
+ "medium": "medium",
66
+ "large": "large",
67
+ "small": "small",
68
+ "xsmall": "xsmall",
69
+ }),
70
+ children: figma.instance("SVG"), // The SVG instance swap
71
+ }),
72
+ },
73
+ /**
74
+ * EXAMPLE CODE TEMPLATE
75
+ * Shows how BottomNavigationAction should be used
76
+ */
77
+ example: ({ selected, disabled, labelvisibility, label, icon }) => (
78
+ <BottomNavigationAction
79
+ selected={selected}
80
+ disabled={disabled}
81
+ labelvisibility={labelvisibility}
82
+ icon={<Icon fontSize={icon.fontSize}>{icon.children}</Icon>}
83
+ label={<Typography variant="body3Semibold">{label}</Typography>}
84
+ />
85
+ ),
86
+ }
87
+ );
@@ -0,0 +1,110 @@
1
+ import { forwardRef } from "react";
2
+
3
+ import {
4
+ BottomNavigationAction as MuiBottomNavigationAction,
5
+ BottomNavigationActionProps as MuiBottomNavigationActionProps,
6
+ } from "@mui/material";
7
+ import { CSSObject } from "@mui/material/styles";
8
+ import { getSxStyles } from "../utils/styles";
9
+
10
+ export const BottomNavigationLabelOptions = {
11
+ On: "On",
12
+ Off: "Off",
13
+ SelectedOnly: "Selected Only",
14
+ };
15
+
16
+ export interface BottomNavigationActionProps
17
+ extends MuiBottomNavigationActionProps {
18
+ /**
19
+ *
20
+ * Labels will be visible based on the selection.
21
+ */
22
+
23
+ labelvisibility?: "On" | "Selected Only" | "Off";
24
+
25
+ /**
26
+ *
27
+ * selected will be used to which item is selected.
28
+ */
29
+
30
+ selected?: boolean;
31
+ }
32
+
33
+ /** BottomNavigationAction
34
+ *
35
+ * `import BottomNavigationAction from '@carrier-io/air-react/BottomNavigationAction'`
36
+ */
37
+
38
+ const labelStyles = (props: BottomNavigationActionProps) => {
39
+ if (props.labelvisibility === BottomNavigationLabelOptions.On) {
40
+ return { opacity: "1", paddingTop: "0px" };
41
+ } else if (
42
+ props.labelvisibility === BottomNavigationLabelOptions.SelectedOnly &&
43
+ props.selected === true
44
+ ) {
45
+ return { opacity: "1" };
46
+ } else {
47
+ return { opacity: "0" };
48
+ }
49
+ };
50
+
51
+ const verticalAlignStyles = () => {
52
+ return { paddingTop: "0px" };
53
+ };
54
+
55
+ const BottomNavigationAction = forwardRef<
56
+ HTMLButtonElement,
57
+ BottomNavigationActionProps
58
+ >(({ sx, ...props }, ref) => {
59
+ return (
60
+ <MuiBottomNavigationAction
61
+ sx={(theme) =>
62
+ ({
63
+ ...getSxStyles(theme, sx),
64
+ "& .MuiBottomNavigationAction-iconOnly": { ...labelStyles(props) },
65
+ "& .Mui-selected": { ...labelStyles(props) },
66
+ "&.MuiButtonBase-root": { ...verticalAlignStyles() },
67
+ // Theme-aware colors: unselected uses secondary, selected uses primary.main
68
+ color: theme.palette.base?.text.secondary,
69
+ // Consistent label sizing prevents container resizing on selection
70
+ "& .MuiBottomNavigationAction-label": {
71
+ lineHeight: "1.2",
72
+ fontSize: theme.typography.body2.fontSize,
73
+ // Hide label container when Off or when SelectedOnly and not selected
74
+ ...((props.labelvisibility === BottomNavigationLabelOptions.Off ||
75
+ (props.labelvisibility ===
76
+ BottomNavigationLabelOptions.SelectedOnly &&
77
+ !props.selected)) && {
78
+ height: 0,
79
+ minHeight: 0,
80
+ padding: 0,
81
+ margin: 0,
82
+ overflow: "hidden",
83
+ }),
84
+ },
85
+ // Selected state: primary.main color for icon and label
86
+ "&.Mui-selected": {
87
+ color: theme.palette.primary.main,
88
+ "& .MuiBottomNavigationAction-icon": {
89
+ color: theme.palette.primary.main,
90
+ },
91
+ "& .MuiBottomNavigationAction-label": {
92
+ color: theme.palette.primary.main,
93
+ lineHeight: "1.2",
94
+ fontSize: theme.typography.body2.fontSize,
95
+ },
96
+ },
97
+ "&.Mui-disabled": {
98
+ color: theme.palette.base?.text.disabled,
99
+ },
100
+ } as CSSObject)
101
+ }
102
+ {...props}
103
+ ref={ref}
104
+ />
105
+ );
106
+ });
107
+
108
+ BottomNavigationAction.displayName = "BottomNavigationAction";
109
+
110
+ export default BottomNavigationAction;
@@ -0,0 +1,7 @@
1
+ // BottomNavigation component family exports
2
+ export { default } from "./BottomNavigation"; // For: import BottomNavigation from "BottomNavigation"
3
+ export { default as BottomNavigation } from "./BottomNavigation"; // For: import { BottomNavigation } from "BottomNavigation"
4
+ export * from "./BottomNavigation"; // For: BottomNavigationProps, etc.
5
+
6
+ export { default as BottomNavigationAction } from "./BottomNavigationAction";
7
+ export * from "./BottomNavigationAction";
@@ -13,20 +13,21 @@ import Icon from "./Icon";
13
13
  // Placeholder - replace with actual ArrowLeftIcon import
14
14
  const ArrowLeftIcon = ({ variant, ...props }: any) => <span {...props}>ArrowLeftIcon</span>;
15
15
 
16
- figma.connect(
17
- ArrowLeftIcon,
18
- "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=ARROW-LEFT-ICON-NODE-ID",
19
- {
20
- props: {
21
- variant: figma.enum("variant", {
22
- outlined: "outlined",
23
- filled: "filled",
24
- }),
25
- },
26
- example: ({ variant }) => (
27
- <Icon fontSize="medium">
28
- <ArrowLeftIcon variant={variant} />
29
- </Icon>
30
- ),
31
- }
32
- );
16
+ // TODO: Uncomment and update with real Figma URL when ready
17
+ // figma.connect(
18
+ // ArrowLeftIcon,
19
+ // "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=ARROW-LEFT-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
+ // <ArrowLeftIcon variant={variant} />
30
+ // </Icon>
31
+ // ),
32
+ // }
33
+ // );
@@ -13,20 +13,21 @@ import Icon from "./Icon";
13
13
  // Placeholder - replace with actual ArrowRightIcon import
14
14
  const ArrowRightIcon = ({ variant, ...props }: any) => <span {...props}>ArrowRightIcon</span>;
15
15
 
16
- figma.connect(
17
- ArrowRightIcon,
18
- "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=ARROW-RIGHT-ICON-NODE-ID",
19
- {
20
- props: {
21
- variant: figma.enum("variant", {
22
- outlined: "outlined",
23
- filled: "filled",
24
- }),
25
- },
26
- example: ({ variant }) => (
27
- <Icon fontSize="medium">
28
- <ArrowRightIcon variant={variant} />
29
- </Icon>
30
- ),
31
- }
32
- );
16
+ // TODO: Uncomment and update with real Figma URL when ready
17
+ // figma.connect(
18
+ // ArrowRightIcon,
19
+ // "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=ARROW-RIGHT-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
+ // <ArrowRightIcon variant={variant} />
30
+ // </Icon>
31
+ // ),
32
+ // }
33
+ // );
@@ -13,20 +13,21 @@ import Icon from "./Icon";
13
13
  // Placeholder - replace with actual CheckIcon import
14
14
  const CheckIcon = ({ variant, ...props }: any) => <span {...props}>CheckIcon</span>;
15
15
 
16
- figma.connect(
17
- CheckIcon,
18
- "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=CHECK-ICON-NODE-ID",
19
- {
20
- props: {
21
- variant: figma.enum("variant", {
22
- outlined: "outlined",
23
- filled: "filled",
24
- }),
25
- },
26
- example: ({ variant }) => (
27
- <Icon fontSize="medium">
28
- <CheckIcon variant={variant} />
29
- </Icon>
30
- ),
31
- }
32
- );
16
+ // TODO: Uncomment and update with real Figma URL when ready
17
+ // figma.connect(
18
+ // CheckIcon,
19
+ // "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=CHECK-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
+ // <CheckIcon variant={variant} />
30
+ // </Icon>
31
+ // ),
32
+ // }
33
+ // );
@@ -13,20 +13,21 @@ import Icon from "./Icon";
13
13
  // Placeholder - replace with actual CloseIcon import
14
14
  const CloseIcon = ({ variant, ...props }: any) => <span {...props}>CloseIcon</span>;
15
15
 
16
- figma.connect(
17
- CloseIcon,
18
- "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=CLOSE-ICON-NODE-ID",
19
- {
20
- props: {
21
- variant: figma.enum("variant", {
22
- outlined: "outlined",
23
- filled: "filled",
24
- }),
25
- },
26
- example: ({ variant }) => (
27
- <Icon fontSize="medium">
28
- <CloseIcon variant={variant} />
29
- </Icon>
30
- ),
31
- }
32
- );
16
+ // TODO: Uncomment and update with real Figma URL when ready
17
+ // figma.connect(
18
+ // CloseIcon,
19
+ // "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=CLOSE-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
+ // <CloseIcon variant={variant} />
30
+ // </Icon>
31
+ // ),
32
+ // }
33
+ // );
@@ -13,20 +13,21 @@ import Icon from "./Icon";
13
13
  // Placeholder - replace with actual HomeIcon import
14
14
  const HomeIcon = ({ variant, ...props }: any) => <span {...props}>HomeIcon</span>;
15
15
 
16
- figma.connect(
17
- HomeIcon,
18
- "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=HOME-ICON-NODE-ID",
19
- {
20
- props: {
21
- variant: figma.enum("variant", {
22
- outlined: "outlined",
23
- filled: "filled",
24
- }),
25
- },
26
- example: ({ variant }) => (
27
- <Icon fontSize="medium">
28
- <HomeIcon variant={variant} />
29
- </Icon>
30
- ),
31
- }
32
- );
16
+ // TODO: Uncomment and update with real Figma URL when ready
17
+ // figma.connect(
18
+ // HomeIcon,
19
+ // "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=HOME-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
+ // <HomeIcon variant={variant} />
30
+ // </Icon>
31
+ // ),
32
+ // }
33
+ // );
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Figma Code Connect Configuration for Icon Component
3
+ *
4
+ * This connects Figma's Icon component to the React Icon wrapper component.
5
+ * The Icon wrapper handles fontSize and wraps icon components passed as children.
6
+ *
7
+ * Figma URL: https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=6594-47648
8
+ *
9
+ * Figma Properties:
10
+ * - fontSize: large (28px), medium (24px), small (20px), xsmall (16px)
11
+ * Note: Figma enum values are "large", "medium", "small", "xsmall" (without px)
12
+ * - SVG: Instance swap property for swapping icon components
13
+ */
14
+
15
+ import figma from "@figma/code-connect";
16
+ import Icon from "./Icon";
17
+
18
+ figma.connect(
19
+ Icon,
20
+ "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=6594-47648",
21
+ {
22
+ props: {
23
+ /**
24
+ * FONT SIZE MAPPING
25
+ * Maps Figma's fontSize property to React's fontSize prop
26
+ *
27
+ * NOTE: If Figma enum values include "px" (e.g., "large: 32px"),
28
+ * update the left side of the mapping to match exactly what Figma shows.
29
+ *
30
+ * Common patterns:
31
+ * - "large" → "large" (if enum value is just "large")
32
+ * - "large: 32px" → "large" (if enum value includes px)
33
+ * - "32px" → "large" (if enum value is just the px value)
34
+ */
35
+ fontSize: figma.enum("fontSize", {
36
+ // Map Figma enum values to React fontSize prop values
37
+ // If Figma shows "large: 32px", use the left side as shown in Figma
38
+ "large": "large",
39
+ "medium": "medium",
40
+ "small": "small",
41
+ "xsmall": "xsmall",
42
+ // Alternative: If Figma enum values include px, try these:
43
+ "large: 32px": "large",
44
+ "medium: 24px": "medium",
45
+ "small: 20px": "small",
46
+ "xsmall: 16px": "xsmall",
47
+ }),
48
+
49
+ /**
50
+ * SVG INSTANCE SWAP
51
+ * Maps Figma's "SVG" instance swap property to React children
52
+ * The property name is "SVG" (the layer it swaps is named "placeholder")
53
+ * When users swap the SVG instance in Figma, it maps to the icon component passed as children
54
+ */
55
+ children: figma.instance("SVG"),
56
+ },
57
+ /**
58
+ * EXAMPLE CODE TEMPLATE
59
+ * Shows the Icon wrapper with fontSize and the swapped icon component as children
60
+ * fontSize defaults to "medium" if not provided
61
+ */
62
+ example: ({ fontSize = "medium", children }) => (
63
+ <Icon fontSize={fontSize}>
64
+ {children}
65
+ </Icon>
66
+ ),
67
+ }
68
+ );
@@ -13,20 +13,21 @@ import Icon from "./Icon";
13
13
  // Placeholder - replace with actual InfoIcon import
14
14
  const InfoIcon = ({ variant, ...props }: any) => <span {...props}>InfoIcon</span>;
15
15
 
16
- figma.connect(
17
- InfoIcon,
18
- "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=INFO-ICON-NODE-ID",
19
- {
20
- props: {
21
- variant: figma.enum("variant", {
22
- outlined: "outlined",
23
- filled: "filled",
24
- }),
25
- },
26
- example: ({ variant }) => (
27
- <Icon fontSize="medium">
28
- <InfoIcon variant={variant} />
29
- </Icon>
30
- ),
31
- }
32
- );
16
+ // TODO: Uncomment and update with real Figma URL when ready
17
+ // figma.connect(
18
+ // InfoIcon,
19
+ // "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=INFO-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
+ // <InfoIcon variant={variant} />
30
+ // </Icon>
31
+ // ),
32
+ // }
33
+ // );
@@ -13,20 +13,21 @@ import Icon from "./Icon";
13
13
  // Placeholder - replace with actual MenuIcon import
14
14
  const MenuIcon = ({ variant, ...props }: any) => <span {...props}>MenuIcon</span>;
15
15
 
16
- figma.connect(
17
- MenuIcon,
18
- "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=MENU-ICON-NODE-ID",
19
- {
20
- props: {
21
- variant: figma.enum("variant", {
22
- outlined: "outlined",
23
- filled: "filled",
24
- }),
25
- },
26
- example: ({ variant }) => (
27
- <Icon fontSize="medium">
28
- <MenuIcon variant={variant} />
29
- </Icon>
30
- ),
31
- }
32
- );
16
+ // TODO: Uncomment and update with real Figma URL when ready
17
+ // figma.connect(
18
+ // MenuIcon,
19
+ // "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=MENU-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
+ // <MenuIcon variant={variant} />
30
+ // </Icon>
31
+ // ),
32
+ // }
33
+ // );