@seed-design/figma 1.1.9 → 1.1.12
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/lib/codegen/index.cjs +318 -473
- package/lib/codegen/index.d.ts +78 -28
- package/lib/codegen/index.d.ts.map +1 -1
- package/lib/codegen/index.js +318 -473
- package/lib/codegen/targets/react/index.cjs +485 -552
- package/lib/codegen/targets/react/index.d.ts.map +1 -1
- package/lib/codegen/targets/react/index.js +485 -552
- package/lib/index.cjs +372 -473
- package/lib/index.js +372 -473
- package/package.json +3 -3
- package/src/codegen/component-properties.ts +4 -4
- package/src/codegen/targets/react/component/handlers/alert-dialog.ts +97 -56
- package/src/codegen/targets/react/component/handlers/list-item.ts +1 -1
- package/src/codegen/targets/react/component/handlers/menu-sheet.ts +4 -4
- package/src/codegen/targets/react/component/handlers/result-section.ts +67 -0
- package/src/codegen/targets/react/component/index.ts +2 -2
- package/src/entities/data/__generated__/component-sets/index.d.ts +108 -117
- package/src/entities/data/__generated__/component-sets/index.mjs +108 -117
- package/src/entities/data/__generated__/components/index.d.ts +13 -5
- package/src/entities/data/__generated__/components/index.mjs +13 -5
- package/src/entities/data/__generated__/icons/index.mjs +54 -0
- package/src/entities/data/__generated__/variable-collections/index.mjs +71 -20
- package/src/entities/data/__generated__/variables/index.mjs +137 -334
- package/src/codegen/targets/react/component/handlers/error-state.ts +0 -56
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/figma",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -39,14 +39,14 @@
|
|
|
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.
|
|
42
|
+
"@seed-design/css": "1.1.12",
|
|
43
43
|
"change-case": "^5.4.4",
|
|
44
44
|
"ts-pattern": "^5.7.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@figma/plugin-typings": "^1.110.0",
|
|
48
48
|
"@figma/rest-api-spec": "^0.34.0",
|
|
49
|
-
"@karrotmarket/icon-data": "^1.
|
|
49
|
+
"@karrotmarket/icon-data": "^1.13.0",
|
|
50
50
|
"@seed-design/figma-extractor": "^1.0.0",
|
|
51
51
|
"typescript": "^5.9.2"
|
|
52
52
|
},
|
|
@@ -76,10 +76,6 @@ export type DividerProperties = InferComponentDefinition<
|
|
|
76
76
|
typeof sets.divider.componentPropertyDefinitions
|
|
77
77
|
>;
|
|
78
78
|
|
|
79
|
-
export type ErrorStateProperties = InferComponentDefinition<
|
|
80
|
-
typeof sets.templateErrorState.componentPropertyDefinitions
|
|
81
|
-
>;
|
|
82
|
-
|
|
83
79
|
export type FieldHeaderProperties = InferComponentDefinition<{
|
|
84
80
|
"Label#34796:0": {
|
|
85
81
|
type: "TEXT";
|
|
@@ -321,6 +317,10 @@ export type ReactionButtonProperties = InferComponentDefinition<
|
|
|
321
317
|
typeof sets.reactionButton.componentPropertyDefinitions
|
|
322
318
|
>;
|
|
323
319
|
|
|
320
|
+
export type ResultSectionProperties = InferComponentDefinition<
|
|
321
|
+
typeof sets.templateResultSection.componentPropertyDefinitions
|
|
322
|
+
>;
|
|
323
|
+
|
|
324
324
|
export type SegmentedControlProperties = InferComponentDefinition<
|
|
325
325
|
typeof sets.segmentedControl.componentPropertyDefinitions
|
|
326
326
|
>;
|
|
@@ -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 = (
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
const footerNodes = findAllInstances<AlertDialogFooterProperties>({
|
|
50
|
+
node,
|
|
51
|
+
key: ALERT_DIALOG_FOOTER_KEY,
|
|
46
52
|
});
|
|
47
|
-
}
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
79
|
+
const [ghostButtonNode] = findAllInstances<ActionButtonGhostProperties>({
|
|
80
|
+
node: footerNode,
|
|
81
|
+
key: actionButtonGhostHandler.key,
|
|
82
|
+
});
|
|
53
83
|
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
+
};
|
|
@@ -141,7 +141,7 @@ export const createListItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
141
141
|
tag === "ListSwitchItem") && {
|
|
142
142
|
disabled: true,
|
|
143
143
|
}),
|
|
144
|
-
...(props.
|
|
144
|
+
...(props.Highlighted.value === "True" && {
|
|
145
145
|
highlighted: true,
|
|
146
146
|
}),
|
|
147
147
|
};
|
|
@@ -79,14 +79,14 @@ export const createMenuSheetHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
79
79
|
// TODO: React 구현체에 description 추가 이후
|
|
80
80
|
// const description = props["Description Text#21827:0"].value;
|
|
81
81
|
|
|
82
|
-
const {
|
|
83
|
-
.with("Text with Icon", () => ({
|
|
84
|
-
.with("Text Only", () => ({
|
|
82
|
+
const { labelAlign } = match(props.Layout.value)
|
|
83
|
+
.with("Text with Icon", "Text with Subtext", () => ({ labelAlign: "left" }))
|
|
84
|
+
.with("Text Only", () => ({ labelAlign: "center" }))
|
|
85
85
|
.exhaustive();
|
|
86
86
|
|
|
87
87
|
const content = createLocalSnippetElement(
|
|
88
88
|
"MenuSheetContent",
|
|
89
|
-
{ title,
|
|
89
|
+
{ title, labelAlign },
|
|
90
90
|
contentChildren,
|
|
91
91
|
{
|
|
92
92
|
comment: title
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActionButtonGhostProperties,
|
|
3
|
+
ActionButtonProperties,
|
|
4
|
+
ResultSectionProperties,
|
|
5
|
+
} from "@/codegen/component-properties";
|
|
6
|
+
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
7
|
+
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
8
|
+
import { findAllInstances } from "@/utils/figma-node";
|
|
9
|
+
import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
|
|
10
|
+
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
11
|
+
import { createActionButtonGhostHandler, createActionButtonHandler } from "./action-button";
|
|
12
|
+
import { handleSizeProp } from "@/codegen/targets/react/component/size";
|
|
13
|
+
|
|
14
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("result-section");
|
|
15
|
+
|
|
16
|
+
export const createResultSectionHandler = (ctx: ComponentHandlerDeps) => {
|
|
17
|
+
const actionButtonHandler = createActionButtonHandler(ctx);
|
|
18
|
+
const ghostButtonHandler = createActionButtonGhostHandler(ctx);
|
|
19
|
+
|
|
20
|
+
return defineComponentHandler<ResultSectionProperties>(
|
|
21
|
+
metadata.templateResultSection.key,
|
|
22
|
+
(node, traverse) => {
|
|
23
|
+
const props = node.componentProperties;
|
|
24
|
+
|
|
25
|
+
const [actionButton] =
|
|
26
|
+
props["Show Buttons#53435:0"].value && props["ㄴShow First Button#53766:0"].value
|
|
27
|
+
? findAllInstances<ActionButtonProperties>({
|
|
28
|
+
node,
|
|
29
|
+
key: actionButtonHandler.key,
|
|
30
|
+
})
|
|
31
|
+
: [undefined];
|
|
32
|
+
|
|
33
|
+
const [ghostButton] =
|
|
34
|
+
props["Show Buttons#53435:0"].value && props["ㄴShow Second Button#53766:3"].value
|
|
35
|
+
? findAllInstances<ActionButtonGhostProperties>({
|
|
36
|
+
node,
|
|
37
|
+
key: ghostButtonHandler.key,
|
|
38
|
+
})
|
|
39
|
+
: [undefined];
|
|
40
|
+
|
|
41
|
+
const commonProps = {
|
|
42
|
+
size: handleSizeProp(props.Size.value),
|
|
43
|
+
...(props["Show Asset#45154:14"].value && {
|
|
44
|
+
asset: createSeedReactElement(
|
|
45
|
+
"Box",
|
|
46
|
+
undefined,
|
|
47
|
+
createElement("div", undefined, undefined, { comment: "Asset Placeholder" }),
|
|
48
|
+
),
|
|
49
|
+
}),
|
|
50
|
+
title: props["Title#16237:0"].value,
|
|
51
|
+
description: props["Description#16237:5"].value,
|
|
52
|
+
...(actionButton && {
|
|
53
|
+
primaryActionProps: {
|
|
54
|
+
children: actionButtonHandler.transform(actionButton, traverse).children[0],
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
...(ghostButton && {
|
|
58
|
+
secondaryActionProps: {
|
|
59
|
+
children: ghostButtonHandler.transform(ghostButton, traverse).children[0],
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return createLocalSnippetElement("ResultSection", commonProps);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -18,7 +18,6 @@ import { createCheckmarkHandler } from "@/codegen/targets/react/component/handle
|
|
|
18
18
|
import { createChipHandler } from "./handlers/chip";
|
|
19
19
|
import { createContextualFloatingButtonHandler } from "./handlers/contextual-floating-button";
|
|
20
20
|
import { createDividerHandler } from "./handlers/divider";
|
|
21
|
-
import { createErrorStateHandler } from "./handlers/error-state";
|
|
22
21
|
import {
|
|
23
22
|
createFieldButtonHandler,
|
|
24
23
|
createAddressFieldHandler,
|
|
@@ -39,6 +38,7 @@ import { createProgressCircleHandler } from "./handlers/progress-circle";
|
|
|
39
38
|
import { createRadioGroupItemHandler } from "@/codegen/targets/react/component/handlers/radio-group";
|
|
40
39
|
import { createRadioMarkHandler } from "@/codegen/targets/react/component/handlers/radio-mark";
|
|
41
40
|
import { createReactionButtonHandler } from "./handlers/reaction-button";
|
|
41
|
+
import { createResultSectionHandler } from "./handlers/result-section";
|
|
42
42
|
import { createSegmentedControlHandler } from "./handlers/segmented-control";
|
|
43
43
|
import { createSelectBoxGroupHandler, createSelectBoxHandler } from "./handlers/select-box";
|
|
44
44
|
import { createSkeletonHandler } from "./handlers/skeleton";
|
|
@@ -112,7 +112,7 @@ export const unboundSeedComponentHandlers: Array<UnboundComponentHandler<any>> =
|
|
|
112
112
|
createDatePickerFieldHandler,
|
|
113
113
|
createSelectFieldHandler,
|
|
114
114
|
createTimePickerFieldHandler,
|
|
115
|
-
|
|
115
|
+
createResultSectionHandler,
|
|
116
116
|
createContextualFloatingButtonHandler,
|
|
117
117
|
createFloatingActionButtonHandler,
|
|
118
118
|
createHelpBubbleHandler,
|