@seed-design/figma 1.1.18 → 1.2.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/lib/codegen/index.d.ts +9 -1
- package/lib/codegen/index.d.ts.map +1 -1
- package/lib/codegen/targets/react/index.cjs +135 -133
- package/lib/codegen/targets/react/index.js +135 -133
- package/package.json +2 -2
- package/src/codegen/component-properties.ts +9 -1
- package/src/codegen/targets/react/component/handlers/list-item.ts +5 -5
- package/src/codegen/targets/react/component/handlers/menu-sheet.ts +14 -12
- package/src/codegen/targets/react/component/handlers/radiomark.ts +1 -1
- package/src/codegen/targets/react/component/handlers/switch.ts +1 -1
- package/src/codegen/targets/react/component/handlers/switchmark.ts +1 -1
- package/src/codegen/targets/react/component/handlers/tag-group.ts +17 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/figma",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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.
|
|
42
|
+
"@seed-design/css": "1.2.0",
|
|
43
43
|
"change-case": "^5.4.4",
|
|
44
44
|
"ts-pattern": "^5.7.0"
|
|
45
45
|
},
|
|
@@ -166,6 +166,14 @@ export type MenuSheetItemProperties = InferComponentDefinition<{
|
|
|
166
166
|
type: "BOOLEAN";
|
|
167
167
|
defaultValue: true;
|
|
168
168
|
};
|
|
169
|
+
"Sub Text#51411:0": {
|
|
170
|
+
type: "TEXT";
|
|
171
|
+
defaultValue: "설명을 입력해주세요.";
|
|
172
|
+
};
|
|
173
|
+
"Show Item Description#51411:19": {
|
|
174
|
+
type: "BOOLEAN";
|
|
175
|
+
defaultValue: false;
|
|
176
|
+
};
|
|
169
177
|
"Label#55905:8": {
|
|
170
178
|
type: "TEXT";
|
|
171
179
|
defaultValue: "라벨";
|
|
@@ -188,7 +196,7 @@ export type MenuSheetItemProperties = InferComponentDefinition<{
|
|
|
188
196
|
Layout: {
|
|
189
197
|
type: "VARIANT";
|
|
190
198
|
defaultValue: "Text Only";
|
|
191
|
-
variantOptions: ["Text
|
|
199
|
+
variantOptions: ["Text Only", "Text with Icon"];
|
|
192
200
|
};
|
|
193
201
|
}>;
|
|
194
202
|
|
|
@@ -15,7 +15,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("list");
|
|
|
15
15
|
|
|
16
16
|
const PREFIX_KEYS = {
|
|
17
17
|
checkmark: "f24c9ef42ef08df79483fbae0fa7d9037e566748",
|
|
18
|
-
|
|
18
|
+
radiomark: "5a77ad37a2291989dfe77c44ddee9aa39e447f90",
|
|
19
19
|
icon: "0e4c05f097d3fa2dc0cbfdbf8db2662bcf8439ca",
|
|
20
20
|
avatar: "ef0e8bd6c2f92e620acf204bb9a8079ef25a1e5c",
|
|
21
21
|
image: "82239325aa1cb65af7c649fc71a8f2b48fb9b9f3",
|
|
@@ -24,7 +24,7 @@ const PREFIX_KEYS = {
|
|
|
24
24
|
|
|
25
25
|
const SUFFIX_KEYS = {
|
|
26
26
|
checkmark: "abf9810103ae6e6afe8fa253ec5f05d6a7304b38",
|
|
27
|
-
|
|
27
|
+
radiomark: "0a9464ad270bfd7f56438f62bb0155a25ca146a9",
|
|
28
28
|
chevron: "8c52207687ffed15cd5931d71ed9d196b3358a68",
|
|
29
29
|
switch: "1e933f75dd6bb4b21c3289b5c3b4402d2c623125",
|
|
30
30
|
custom: "3a70bf5bb9856c13893931b7a0df652bcf0be895",
|
|
@@ -102,7 +102,7 @@ export const createListItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
102
102
|
const disabled = props.State.value === "Disabled";
|
|
103
103
|
|
|
104
104
|
const tag = (() => {
|
|
105
|
-
if (suffix?.tag === "
|
|
105
|
+
if (suffix?.tag === "Switchmark") {
|
|
106
106
|
return "ListSwitchItem";
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -110,11 +110,11 @@ export const createListItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
110
110
|
return "ListCheckItem";
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
if (prefix?.tag === "
|
|
113
|
+
if (prefix?.tag === "Radiomark" || suffix?.tag === "Radiomark") {
|
|
114
114
|
return "ListRadioItem";
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
// checkmark/
|
|
117
|
+
// checkmark/radiomark 없는데 disabled인 경우 Button으로 추측
|
|
118
118
|
if (disabled) {
|
|
119
119
|
return "ListButtonItem";
|
|
120
120
|
}
|
|
@@ -7,7 +7,7 @@ import { defineComponentHandler } from "@/codegen/core";
|
|
|
7
7
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
8
8
|
import { findAllInstances } from "@/utils/figma-node";
|
|
9
9
|
import { camelCase } from "change-case";
|
|
10
|
-
import { createLocalSnippetHelper
|
|
10
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
11
11
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
12
12
|
import { match } from "ts-pattern";
|
|
13
13
|
|
|
@@ -27,16 +27,16 @@ const createMenuSheetItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
27
27
|
...(states.includes("Disabled") && {
|
|
28
28
|
disabled: true,
|
|
29
29
|
}),
|
|
30
|
+
...(props["Show Prefix Icon#17043:5"].value && {
|
|
31
|
+
prefixIcon: ctx.iconHandler.transform(props["Prefix Icon#55948:0"]),
|
|
32
|
+
}),
|
|
33
|
+
label: props["Label#55905:8"].value,
|
|
34
|
+
...(props["Show Item Description#51411:19"].value && {
|
|
35
|
+
description: props["Sub Text#51411:0"].value,
|
|
36
|
+
}),
|
|
30
37
|
};
|
|
31
38
|
|
|
32
|
-
return createLocalSnippetElement("MenuSheetItem", commonProps
|
|
33
|
-
props["Show Prefix Icon#17043:5"].value
|
|
34
|
-
? createSeedReactElement("PrefixIcon", {
|
|
35
|
-
svg: ctx.iconHandler.transform(props["Prefix Icon#55948:0"]),
|
|
36
|
-
})
|
|
37
|
-
: undefined,
|
|
38
|
-
props["Label#55905:8"].value,
|
|
39
|
-
]);
|
|
39
|
+
return createLocalSnippetElement("MenuSheetItem", commonProps);
|
|
40
40
|
},
|
|
41
41
|
);
|
|
42
42
|
|
|
@@ -76,8 +76,10 @@ export const createMenuSheetHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
76
76
|
? props["Title Text#14599:0"].value
|
|
77
77
|
: undefined;
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const description =
|
|
80
|
+
props["Show Header#17043:12"].value && props["Show Header Description#32984:0"].value
|
|
81
|
+
? props["Description Text#21827:0"].value
|
|
82
|
+
: undefined;
|
|
81
83
|
|
|
82
84
|
const { labelAlign } = match(props.Layout.value)
|
|
83
85
|
.with("Text with Icon", () => ({ labelAlign: "left" }))
|
|
@@ -86,7 +88,7 @@ export const createMenuSheetHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
86
88
|
|
|
87
89
|
const content = createLocalSnippetElement(
|
|
88
90
|
"MenuSheetContent",
|
|
89
|
-
{ title, labelAlign },
|
|
91
|
+
{ title, description, labelAlign },
|
|
90
92
|
contentChildren,
|
|
91
93
|
{
|
|
92
94
|
comment: title
|
|
@@ -22,7 +22,7 @@ export const createSwitchHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
if (props["Layout(Figma Only)"].value === "🚫[Switch Mark 사용] Switch Only") {
|
|
25
|
-
return createLocalSnippetElement("
|
|
25
|
+
return createLocalSnippetElement("Switchmark", commonProps);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return createLocalSnippetElement("Switch", {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { TagGroupItemProperties, TagGroupProperties } from "@/codegen/component-properties";
|
|
2
2
|
import { defineComponentHandler, type ElementNode } from "@/codegen/core";
|
|
3
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
|
-
import {
|
|
4
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
5
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
6
|
import { camelCase } from "change-case";
|
|
7
7
|
import { match } from "ts-pattern";
|
|
8
8
|
import { findAllInstances } from "@/utils/figma-node";
|
|
9
9
|
|
|
10
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("tag-group");
|
|
11
|
+
|
|
10
12
|
export const createTagGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
11
13
|
const itemHandler = createTagGroupItemHandler(ctx);
|
|
12
14
|
|
|
@@ -20,10 +22,10 @@ export const createTagGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
20
22
|
})[];
|
|
21
23
|
|
|
22
24
|
if (items.length === 0) {
|
|
23
|
-
return
|
|
25
|
+
return createLocalSnippetElement("TagGroupRoot");
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
// if size/weight/tone are all the same among item[n].props, lift them up to
|
|
28
|
+
// if size/weight/tone are all the same among item[n].props, lift them up to TagGroupRoot
|
|
27
29
|
|
|
28
30
|
const consistent = {
|
|
29
31
|
size: items.map((item) => item.props.size).every((size) => size === items[0].props.size),
|
|
@@ -33,8 +35,8 @@ export const createTagGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
33
35
|
tone: items.map((item) => item.props.tone).every((tone) => tone === items[0].props.tone),
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
return
|
|
37
|
-
"
|
|
38
|
+
return createLocalSnippetElement(
|
|
39
|
+
"TagGroupRoot",
|
|
38
40
|
{
|
|
39
41
|
// lift up consistent props
|
|
40
42
|
...(consistent.size && { size: items[0].props.size }),
|
|
@@ -51,6 +53,7 @@ export const createTagGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
51
53
|
tone: consistent.tone ? undefined : item.props.tone,
|
|
52
54
|
},
|
|
53
55
|
})),
|
|
56
|
+
{ comment: "`truncate` prop을 통해 한 줄로 표시되도록 할 수 있습니다." },
|
|
54
57
|
);
|
|
55
58
|
});
|
|
56
59
|
};
|
|
@@ -67,26 +70,17 @@ export const createTagGroupItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
67
70
|
.with("t4(14pt)", () => "t4")
|
|
68
71
|
.exhaustive();
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
return createLocalSnippetElement("TagGroupItem", {
|
|
71
74
|
size,
|
|
72
75
|
weight: camelCase(props["Weight"].value),
|
|
73
76
|
tone: camelCase(props["Tone"].value),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
props["Label#5409:0"].value,
|
|
83
|
-
props.Layout.value === "Icon Last"
|
|
84
|
-
? createSeedReactElement("SuffixIcon", {
|
|
85
|
-
svg: ctx.iconHandler.transform(props["Suffix Icon#47948:55"]),
|
|
86
|
-
})
|
|
87
|
-
: undefined,
|
|
88
|
-
].filter(Boolean);
|
|
89
|
-
|
|
90
|
-
return createSeedReactElement("TagGroup.Item", commonProps, children);
|
|
77
|
+
label: props["Label#5409:0"].value,
|
|
78
|
+
...(props.Layout.value === "Icon First" && {
|
|
79
|
+
prefixIcon: ctx.iconHandler.transform(props["Prefix Icon#47948:0"]),
|
|
80
|
+
}),
|
|
81
|
+
...(props.Layout.value === "Icon Last" && {
|
|
82
|
+
suffixIcon: ctx.iconHandler.transform(props["Suffix Icon#47948:55"]),
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
91
85
|
},
|
|
92
86
|
);
|