@carrier-dpx/air-react-library 0.6.0 → 0.7.1

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 (75) hide show
  1. package/package.json +4 -4
  2. package/src/components/BottomNavigation/BottomNavigation.figma.tsx +63 -0
  3. package/src/components/BottomNavigation/BottomNavigation.tsx +45 -0
  4. package/src/components/BottomNavigation/BottomNavigationAction.figma.tsx +89 -0
  5. package/src/components/BottomNavigation/BottomNavigationAction.tsx +110 -0
  6. package/src/components/BottomNavigation/index.ts +7 -0
  7. package/src/components/Box/Box.tsx +29 -0
  8. package/src/components/Box/index.ts +3 -0
  9. package/src/components/Button/Button.figma.tsx +4 -3
  10. package/src/components/Icon/ArrowLeftIcon.figma.tsx +18 -17
  11. package/src/components/Icon/ArrowRightIcon.figma.tsx +18 -17
  12. package/src/components/Icon/CheckIcon.figma.tsx +18 -17
  13. package/src/components/Icon/CloseIcon.figma.tsx +18 -17
  14. package/src/components/Icon/HomeIcon.figma.tsx +18 -17
  15. package/src/components/Icon/Icon.figma.tsx +68 -0
  16. package/src/components/Icon/InfoIcon.figma.tsx +18 -17
  17. package/src/components/Icon/MenuIcon.figma.tsx +18 -17
  18. package/src/components/Icon/SearchIcon.figma.tsx +18 -17
  19. package/src/components/Icon/SettingsIcon.figma.tsx +2 -2
  20. package/src/components/Icon/UserIcon.figma.tsx +18 -17
  21. package/src/components/Icon/icons/demo/DEMO_USAGE.md +113 -0
  22. package/src/components/Icon/icons/demo/DeviceManagerIcon.figma.tsx +38 -0
  23. package/src/components/Icon/icons/demo/DeviceManagerIcon.tsx +16 -0
  24. package/src/components/Icon/icons/demo/HomeIcon.figma.tsx +33 -0
  25. package/src/components/Icon/icons/demo/HomeIcon.tsx +13 -0
  26. package/src/components/Icon/icons/demo/README.md +57 -0
  27. package/src/components/Icon/icons/demo/SiteIcon.figma.tsx +33 -0
  28. package/src/components/Icon/icons/demo/SiteIcon.tsx +13 -0
  29. package/src/components/Icon/icons/demo/SvgIcon.tsx +39 -0
  30. package/src/components/Icon/icons/demo/WarningTriangle.figma.tsx +33 -0
  31. package/src/components/Icon/icons/demo/WarningTriangle.tsx +15 -0
  32. package/src/components/Icon/icons/demo/devicemanager_outlined.svg +6 -0
  33. package/src/components/Icon/icons/demo/home_outlined.svg +3 -0
  34. package/src/components/Icon/icons/demo/iconRegistry.ts +91 -0
  35. package/src/components/Icon/icons/demo/index.ts +20 -0
  36. package/src/components/Icon/icons/demo/site_outlined.svg +3 -0
  37. package/src/components/Icon/icons/demo/warning_outlined.svg +5 -0
  38. package/src/components/Link/Link.figma.tsx +4 -2
  39. package/src/components/Navbar/ExtraNavigation/ExtraNavigation.tsx +86 -0
  40. package/src/components/Navbar/ExtraNavigation/index.ts +2 -0
  41. package/src/components/Navbar/ExtraNavigation/styles.tsx +10 -0
  42. package/src/components/Navbar/ExtraNavigation/types.ts +43 -0
  43. package/src/components/Navbar/Navbar.figma.tsx +118 -0
  44. package/src/components/Navbar/Navbar.tsx +110 -0
  45. package/src/components/Navbar/NavbarButtons/Item.figma.tsx +117 -0
  46. package/src/components/Navbar/NavbarButtons/NavbarFooterButton.tsx +57 -0
  47. package/src/components/Navbar/NavbarButtons/NavbarTooltip.tsx +56 -0
  48. package/src/components/Navbar/NavbarButtons/NavigationButton.tsx +98 -0
  49. package/src/components/Navbar/NavbarButtons/index.ts +3 -0
  50. package/src/components/Navbar/NavbarButtons/styles.tsx +112 -0
  51. package/src/components/Navbar/NavbarButtons/types.ts +8 -0
  52. package/src/components/Navbar/NavbarFooter/NavbarFooter.tsx +40 -0
  53. package/src/components/Navbar/NavbarFooter/index.ts +2 -0
  54. package/src/components/Navbar/NavbarFooter/styles.tsx +14 -0
  55. package/src/components/Navbar/NavbarFooter/types.ts +15 -0
  56. package/src/components/Navbar/NavbarLogo/NavbarLogo.tsx +45 -0
  57. package/src/components/Navbar/NavbarLogo/index.ts +2 -0
  58. package/src/components/Navbar/NavbarLogo/styles.ts +18 -0
  59. package/src/components/Navbar/NavbarLogo/types.ts +18 -0
  60. package/src/components/Navbar/NavbarProvider.tsx +15 -0
  61. package/src/components/Navbar/Navigation/Navigation.tsx +113 -0
  62. package/src/components/Navbar/Navigation/helpers.ts +9 -0
  63. package/src/components/Navbar/Navigation/index.ts +2 -0
  64. package/src/components/Navbar/Navigation/styles.tsx +10 -0
  65. package/src/components/Navbar/Navigation/types.ts +68 -0
  66. package/src/components/Navbar/constants.ts +45 -0
  67. package/src/components/Navbar/hooks/useNavbarContext.tsx +12 -0
  68. package/src/components/Navbar/index.tsx +7 -0
  69. package/src/components/Navbar/styles.tsx +44 -0
  70. package/src/components/Navbar/types.ts +67 -0
  71. package/src/components/Tooltip/Tooltip.figma.tsx +82 -0
  72. package/src/components/Tooltip/Tooltip.tsx +66 -0
  73. package/src/components/Tooltip/index.ts +2 -0
  74. package/src/components/Tooltip/styles.ts +40 -0
  75. package/src/index.ts +10 -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.1",
4
4
  "description": "Air web React component library for Figma Make",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -16,8 +16,8 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "figma:connect": "figma connect",
20
- "figma:publish": "figma connect publish"
19
+ "figma:connect": "npx figma connect",
20
+ "figma:publish": "npx figma connect publish"
21
21
  },
22
22
  "keywords": [
23
23
  "react",
@@ -41,7 +41,7 @@
41
41
  "devDependencies": {
42
42
  "@emotion/react": "^11.11.0",
43
43
  "@emotion/styled": "^11.11.0",
44
- "@figma/code-connect": "^1.0.0",
44
+ "@figma/code-connect": "^1.3.13",
45
45
  "@mui/material": "^5.15.0",
46
46
  "@types/react": "^18.0.0",
47
47
  "@types/react-dom": "^18.0.0",
@@ -0,0 +1,63 @@
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 so Figma Code Connect can resolve component instances
15
+ import BottomNavigationAction from "./BottomNavigationAction";
16
+
17
+ figma.connect(
18
+ BottomNavigation,
19
+ "https://www.figma.com/design/vkoHdM6rchIhH9IWetZeP0/Air--Components?node-id=6572-50307",
20
+ {
21
+ props: {
22
+ /**
23
+ * SHOW LABELS
24
+ * Maps Figma's "showLabels" property to React's "showLabel" prop
25
+ * Figma: on, selected-only, off
26
+ * React: "On", "Selected Only", "Off"
27
+ */
28
+ showLabel: figma.enum("showLabels", {
29
+ on: "On",
30
+ "selected-only": "Selected Only",
31
+ off: "Off",
32
+ }),
33
+ /**
34
+ * CHILDREN
35
+ * Maps nested BottomNavigationAction instances from Figma
36
+ * Each "Nav Item X" is an instance of the BottomNavigationAction component
37
+ * We map each one individually using the exact layer names, then combine them
38
+ */
39
+ navItem1: figma.children("Nav Item 1"),
40
+ navItem2: figma.children("Nav Item 2"),
41
+ navItem3: figma.children("Nav Item 3"),
42
+ navItem4: figma.children("Nav Item 4"),
43
+ navItem5: figma.children("Nav Item 5"),
44
+ },
45
+ /**
46
+ * EXAMPLE CODE TEMPLATE
47
+ * Shows how BottomNavigation should be used with BottomNavigationAction children
48
+ */
49
+ example: ({ showLabel, navItem1, navItem2, navItem3, navItem4, navItem5 }) => (
50
+ <BottomNavigation
51
+ showLabel={showLabel}
52
+ value={0}
53
+ onChange={() => {}}
54
+ >
55
+ {navItem1}
56
+ {navItem2}
57
+ {navItem3}
58
+ {navItem4}
59
+ {navItem5}
60
+ </BottomNavigation>
61
+ ),
62
+ }
63
+ );
@@ -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,89 @@
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 property "✏️ Label" from BottomNavigationAction component
54
+ * This requires the "✏️ Label" text property to be surfaced from the "Label" layer
55
+ * Similar to Navbar Item which uses figma.string("✏️ Label")
56
+ * The label is rendered as a Typography component in React
57
+ */
58
+ label: figma.string("✏️ Label"),
59
+
60
+
61
+ /**
62
+ * ICON NESTED PROPERTIES
63
+ * Access Icon's fontSize and SVG through nested properties
64
+ */
65
+ icon: figma.nestedProps("Icon", {
66
+ fontSize: figma.enum("fontSize", {
67
+ "medium": "medium",
68
+ "large": "large",
69
+ "small": "small",
70
+ "xsmall": "xsmall",
71
+ }),
72
+ children: figma.instance("SVG"), // The SVG instance swap
73
+ }),
74
+ },
75
+ /**
76
+ * EXAMPLE CODE TEMPLATE
77
+ * Shows how BottomNavigationAction should be used
78
+ */
79
+ example: ({ selected, disabled, labelvisibility, label, icon }) => (
80
+ <BottomNavigationAction
81
+ selected={selected}
82
+ disabled={disabled}
83
+ labelvisibility={labelvisibility}
84
+ icon={<Icon fontSize={icon.fontSize}>{icon.children}</Icon>}
85
+ label={<Typography variant="body3Semibold">{label}</Typography>}
86
+ />
87
+ ),
88
+ }
89
+ );
@@ -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";
@@ -0,0 +1,29 @@
1
+ import { forwardRef } from "react";
2
+
3
+ import MuiBox, { BoxProps as MuiBoxProps } from "@mui/material/Box";
4
+ import { AllSystemCSSProperties, ResponsiveStyleValue } from "@mui/system";
5
+
6
+ export interface BoxProps extends MuiBoxProps {
7
+ /**
8
+ *
9
+ * Specifies how to capitalize an element's text
10
+ */
11
+ textTransform?: ResponsiveStyleValue<AllSystemCSSProperties["textTransform"]>;
12
+ }
13
+
14
+ /** The Box component serves as a wrapper component for most of the CSS utility needs.
15
+ *
16
+ * // Default import
17
+ * import Box from '@carrier-io/air-react/Box'
18
+ *
19
+ * // Named import
20
+ * import { Box } from '@carrier-io/air-react'
21
+ */
22
+
23
+ const Box = forwardRef<unknown, BoxProps>((props: BoxProps, ref) => {
24
+ return <MuiBox {...props} ref={ref} />;
25
+ });
26
+
27
+ Box.displayName = "Box";
28
+
29
+ export default Box;
@@ -0,0 +1,3 @@
1
+ export { default } from "./Box";
2
+ export { default as Box } from "./Box";
3
+ export * from "./Box";
@@ -92,10 +92,11 @@ figma.connect(
92
92
 
93
93
  /**
94
94
  * BUTTON TEXT/CHILDREN
95
- * Maps the text content from the "Button Label" layer
96
- * Uses figma.children() to capture nested text content
95
+ * Maps text property "✏️ Text" from Button component
96
+ * The text property must be surfaced from the "Button Label" layer
97
+ * Similar to BottomNavigationAction which uses figma.string("✏️ Label")
97
98
  */
98
- children: figma.children("Button Label"),
99
+ children: figma.string("✏️ Text"),
99
100
 
100
101
  /**
101
102
  * START ICON
@@ -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
+ );