@seed-design/figma 1.1.10 → 1.1.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-design/figma",
3
- "version": "1.1.10",
3
+ "version": "1.1.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/daangn/seed-design.git",
@@ -39,7 +39,7 @@
39
39
  "sync-entities": "rm -rf src/entities/data/__generated__ && bun figma-extractor src/entities/data/__generated__"
40
40
  },
41
41
  "dependencies": {
42
- "@seed-design/css": "1.1.10",
42
+ "@seed-design/css": "1.1.13",
43
43
  "change-case": "^5.4.4",
44
44
  "ts-pattern": "^5.7.0"
45
45
  },
@@ -1,5 +1,7 @@
1
1
  import { defineComponentHandler } from "@/codegen/core";
2
2
  import type {
3
+ ActionButtonGhostProperties,
4
+ ActionButtonProperties,
3
5
  AlertDialogFooterProperties,
4
6
  AlertDialogProperties,
5
7
  } from "@/codegen/component-properties";
@@ -8,6 +10,10 @@ import { createLocalSnippetHelper, createSeedReactElement } from "../../element-
8
10
  import type { ComponentHandlerDeps } from "../deps.interface";
9
11
  import { findAllInstances } from "@/utils/figma-node";
10
12
  import { match } from "ts-pattern";
13
+ import {
14
+ createActionButtonGhostHandler,
15
+ createActionButtonHandler,
16
+ } from "@/codegen/targets/react/component/handlers/action-button";
11
17
 
12
18
  const { createLocalSnippetElement } = createLocalSnippetHelper("alert-dialog");
13
19
  const { createLocalSnippetElement: createLocalSnippetElementTrigger } =
@@ -15,67 +21,102 @@ const { createLocalSnippetElement: createLocalSnippetElementTrigger } =
15
21
 
16
22
  const ALERT_DIALOG_FOOTER_KEY = "00b1b131d67edf2875a7a1df8dfa88098d7c04be";
17
23
 
18
- export const createAlertDialogHandler = (_ctx: ComponentHandlerDeps) =>
19
- defineComponentHandler<AlertDialogProperties>(metadata.alertDialog.key, (node, traverse) => {
20
- const props = node.componentProperties;
21
- const alertDialogHeader = createLocalSnippetElement("AlertDialogHeader", undefined, [
22
- ...(props["Show Title#20361:14"].value
23
- ? [
24
- createLocalSnippetElement(
25
- "AlertDialogTitle",
26
- undefined,
27
- props["Title Text#20361:0"].value,
28
- ),
29
- ]
30
- : []),
31
- createLocalSnippetElement(
32
- "AlertDialogDescription",
33
- undefined,
34
- props["Description Text#20361:7"].value,
35
- ),
36
- ]);
24
+ export const createAlertDialogHandler = (ctx: ComponentHandlerDeps) => {
25
+ const actionButtonHandler = createActionButtonHandler(ctx);
26
+ const actionButtonGhostHandler = createActionButtonGhostHandler(ctx);
37
27
 
38
- const footerNodes = findAllInstances<AlertDialogFooterProperties>({
39
- node,
40
- key: ALERT_DIALOG_FOOTER_KEY,
41
- });
28
+ return defineComponentHandler<AlertDialogProperties>(
29
+ metadata.alertDialog.key,
30
+ (node, traverse) => {
31
+ const props = node.componentProperties;
32
+ const alertDialogHeader = createLocalSnippetElement("AlertDialogHeader", undefined, [
33
+ ...(props["Show Title#20361:14"].value
34
+ ? [
35
+ createLocalSnippetElement(
36
+ "AlertDialogTitle",
37
+ undefined,
38
+ props["Title Text#20361:0"].value,
39
+ ),
40
+ ]
41
+ : []),
42
+ createLocalSnippetElement(
43
+ "AlertDialogDescription",
44
+ undefined,
45
+ props["Description Text#20361:7"].value,
46
+ ),
47
+ ]);
42
48
 
43
- if (footerNodes.length === 0 || footerNodes.length > 1) {
44
- return createLocalSnippetElement("AlertDialog", undefined, alertDialogHeader, {
45
- comment: "Footer 영역을 확인해주세요.",
49
+ const footerNodes = findAllInstances<AlertDialogFooterProperties>({
50
+ node,
51
+ key: ALERT_DIALOG_FOOTER_KEY,
46
52
  });
47
- }
48
53
 
49
- const footerNode = footerNodes[0];
50
- const footerNodeProps = traverse(footerNode)?.props;
54
+ if (footerNodes.length === 0 || footerNodes.length > 1) {
55
+ return createLocalSnippetElement("AlertDialog", undefined, alertDialogHeader, {
56
+ comment: "Footer 영역을 확인해주세요.",
57
+ });
58
+ }
59
+
60
+ const footerNode = footerNodes[0];
61
+ const footerNodeProps = traverse(footerNode)?.props;
62
+
63
+ const buttons = footerNode.children.map(traverse);
64
+
65
+ const alertDialogFooterChildren = match(footerNode.componentProperties.Type.value)
66
+ .with("Single", () => buttons)
67
+ .with("Neutral", "Critical", () =>
68
+ createSeedReactElement("ResponsivePair", footerNodeProps, buttons),
69
+ )
70
+ .with("Neutral (Overflow)", "Critical (Overflow)", () =>
71
+ createSeedReactElement("VStack", footerNodeProps, buttons),
72
+ )
73
+ .with("Nonpreferred", () => {
74
+ const [actionButtonNode] = findAllInstances<ActionButtonProperties>({
75
+ node: footerNode,
76
+ key: actionButtonHandler.key,
77
+ });
51
78
 
52
- const buttons = footerNode.children.map(traverse);
79
+ const [ghostButtonNode] = findAllInstances<ActionButtonGhostProperties>({
80
+ node: footerNode,
81
+ key: actionButtonGhostHandler.key,
82
+ });
53
83
 
54
- const alertDialogFooterChildren = match(footerNode.componentProperties.Type.value)
55
- .with("Single", () => buttons)
56
- .with("Neutral", "Critical", () =>
57
- createSeedReactElement("ResponsivePair", footerNodeProps, buttons),
58
- )
59
- .with("Neutral (Overflow)", "Critical (Overflow)", "Nonpreferred", () =>
60
- createSeedReactElement("VStack", footerNodeProps, buttons),
61
- )
62
- .exhaustive();
84
+ const actionButton = actionButtonHandler.transform(actionButtonNode, traverse);
85
+ const ghostButton = actionButtonGhostHandler.transform(ghostButtonNode, traverse);
63
86
 
64
- const alertDialogFooter = createLocalSnippetElement(
65
- "AlertDialogFooter",
66
- undefined,
67
- alertDialogFooterChildren,
68
- );
87
+ const buttons = [
88
+ actionButton,
89
+ {
90
+ ...ghostButton,
91
+ props: {
92
+ ...ghostButton.props,
93
+ // nonpreferred shouldn't have bleedX, but in Figma it's not possible to represent that
94
+ bleedX: undefined,
95
+ },
96
+ },
97
+ ];
98
+
99
+ return createSeedReactElement("VStack", footerNodeProps, buttons);
100
+ })
101
+ .exhaustive();
102
+
103
+ const alertDialogFooter = createLocalSnippetElement(
104
+ "AlertDialogFooter",
105
+ undefined,
106
+ alertDialogFooterChildren,
107
+ );
69
108
 
70
- return createLocalSnippetElement("AlertDialogRoot", { open: true }, [
71
- createLocalSnippetElement(
72
- "AlertDialogTrigger",
73
- { asChild: true },
74
- createLocalSnippetElementTrigger("ActionButton", {}, "AlertDialog 열기"),
75
- ),
76
- createLocalSnippetElement("AlertDialogContent", undefined, [
77
- alertDialogHeader,
78
- alertDialogFooter,
79
- ]),
80
- ]);
81
- });
109
+ return createLocalSnippetElement("AlertDialogRoot", { open: true }, [
110
+ createLocalSnippetElement(
111
+ "AlertDialogTrigger",
112
+ { asChild: true },
113
+ createLocalSnippetElementTrigger("ActionButton", {}, "AlertDialog 열기"),
114
+ ),
115
+ createLocalSnippetElement("AlertDialogContent", undefined, [
116
+ alertDialogHeader,
117
+ alertDialogFooter,
118
+ ]),
119
+ ]);
120
+ },
121
+ );
122
+ };
@@ -6,9 +6,7 @@ export declare const templateBannerDetach: {
6
6
  "type": "VARIANT",
7
7
  "variantOptions": [
8
8
  "Title + Description",
9
- "Description + Title",
10
- "Layout3",
11
- "Layout4"
9
+ "Description + Title"
12
10
  ]
13
11
  },
14
12
  "Rounded": {
@@ -1261,7 +1259,8 @@ export declare const pageBanner: {
1261
1259
  "Informative",
1262
1260
  "Positive",
1263
1261
  "Warning",
1264
- "Critical"
1262
+ "Critical",
1263
+ "Magic"
1265
1264
  ]
1266
1265
  },
1267
1266
  "Variant": {
@@ -6,9 +6,7 @@ export const templateBannerDetach = {
6
6
  "type": "VARIANT",
7
7
  "variantOptions": [
8
8
  "Title + Description",
9
- "Description + Title",
10
- "Layout3",
11
- "Layout4"
9
+ "Description + Title"
12
10
  ]
13
11
  },
14
12
  "Rounded": {
@@ -1261,7 +1259,8 @@ export const pageBanner = {
1261
1259
  "Informative",
1262
1260
  "Positive",
1263
1261
  "Warning",
1264
- "Critical"
1262
+ "Critical",
1263
+ "Magic"
1265
1264
  ]
1266
1265
  },
1267
1266
  "Variant": {
@@ -16,6 +16,7 @@ export const FIGMA_VARIABLE_COLLECTIONS = {
16
16
  ],
17
17
  "key": "34e782f5d238a8c5be4618ff4a24ae0f4fc4e1da",
18
18
  "hiddenFromPublishing": false,
19
+ "isExtension": false,
19
20
  "variableIds": [
20
21
  "VariableID:1:129",
21
22
  "VariableID:1:130",
@@ -42,19 +43,18 @@ export const FIGMA_VARIABLE_COLLECTIONS = {
42
43
  "VariableID:8482:98909",
43
44
  "VariableID:1:155",
44
45
  "VariableID:1:156",
46
+ "VariableID:1:157",
45
47
  "VariableID:238:17662",
46
48
  "VariableID:670:2700",
47
- "VariableID:1:157",
48
49
  "VariableID:52349:2",
49
50
  "VariableID:52349:3",
50
51
  "VariableID:1:164",
51
52
  "VariableID:1:165",
52
53
  "VariableID:654:20851",
53
54
  "VariableID:1:171",
54
- "VariableID:17544:4057",
55
55
  "VariableID:41186:6437",
56
- "VariableID:1:158",
57
56
  "VariableID:1:172",
57
+ "VariableID:1:158",
58
58
  "VariableID:1:161",
59
59
  "VariableID:1:159",
60
60
  "VariableID:576:22878",
@@ -85,7 +85,6 @@ export const FIGMA_VARIABLE_COLLECTIONS = {
85
85
  "VariableID:33327:83273",
86
86
  "VariableID:1:167",
87
87
  "VariableID:764:14294",
88
- "VariableID:1:170",
89
88
  "VariableID:1883:92911",
90
89
  "VariableID:1:169",
91
90
  "VariableID:41338:804",
@@ -221,14 +220,20 @@ export const FIGMA_VARIABLE_COLLECTIONS = {
221
220
  "VariableID:30894:36313",
222
221
  "VariableID:30894:36314",
223
222
  "VariableID:30894:36315",
223
+ "VariableID:54554:3095",
224
+ "VariableID:54554:3097",
225
+ "VariableID:54554:3098",
226
+ "VariableID:50088:12999",
224
227
  "VariableID:1884:93034",
228
+ "VariableID:1:168",
225
229
  "VariableID:1883:93030",
226
230
  "VariableID:1883:93031",
227
231
  "VariableID:30501:79135",
228
232
  "VariableID:12973:26217",
229
233
  "VariableID:10181:34417",
230
- "VariableID:50088:12999",
231
- "VariableID:1:168",
234
+ "VariableID:17544:4057",
235
+ "VariableID:1:170",
236
+ "VariableID:54461:116345",
232
237
  "VariableID:51280:230267",
233
238
  "VariableID:51280:230268",
234
239
  "VariableID:51280:230269",
@@ -321,6 +326,7 @@ export const FIGMA_VARIABLE_COLLECTIONS = {
321
326
  ],
322
327
  "key": "2d3b4ad8e4ba14ef53b92ba019942ca633ce21ba",
323
328
  "hiddenFromPublishing": false,
329
+ "isExtension": false,
324
330
  "variableIds": [
325
331
  "VariableID:1:189",
326
332
  "VariableID:1:196",
@@ -388,6 +394,7 @@ export const FIGMA_VARIABLE_COLLECTIONS = {
388
394
  ],
389
395
  "key": "75a9a164e0f9d49ba07e82176cbc7240569928a5",
390
396
  "hiddenFromPublishing": false,
397
+ "isExtension": false,
391
398
  "variableIds": [
392
399
  "VariableID:1:199",
393
400
  "VariableID:1:200",
@@ -469,6 +476,7 @@ export const FIGMA_VARIABLE_COLLECTIONS = {
469
476
  ],
470
477
  "key": "7b0f506ae5e0955f152efe15b7982265075ad655",
471
478
  "hiddenFromPublishing": false,
479
+ "isExtension": false,
472
480
  "variableIds": [
473
481
  "VariableID:6075:34488",
474
482
  "VariableID:6075:34489",