@seed-design/figma 1.1.19 → 1.2.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.
- package/lib/codegen/index.cjs +12280 -190
- package/lib/codegen/index.d.ts +9 -1
- package/lib/codegen/index.d.ts.map +1 -1
- package/lib/codegen/index.js +12280 -190
- package/lib/codegen/targets/react/index.cjs +17286 -3116
- package/lib/codegen/targets/react/index.d.ts.map +1 -1
- package/lib/codegen/targets/react/index.js +17286 -3116
- package/lib/index.cjs +12286 -196
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12286 -196
- package/package.json +4 -4
- package/src/codegen/component-properties.archive.ts +1019 -0
- package/src/codegen/component-properties.ts +191 -885
- package/src/codegen/index.ts +1 -1
- package/src/codegen/targets/react/component/handlers/action-button.ts +69 -66
- package/src/codegen/targets/react/component/handlers/alert-dialog.ts +2 -4
- package/src/codegen/targets/react/component/handlers/app-bar.ts +90 -87
- package/src/codegen/targets/react/component/handlers/archive/action-button.ts +144 -0
- package/src/codegen/targets/react/component/handlers/archive/alert-dialog.ts +122 -0
- package/src/codegen/targets/react/component/handlers/archive/app-bar.ts +149 -0
- package/src/codegen/targets/react/component/handlers/archive/avatar-stack.ts +35 -0
- package/src/codegen/targets/react/component/handlers/archive/avatar.ts +55 -0
- package/src/codegen/targets/react/component/handlers/archive/badge.ts +18 -0
- package/src/codegen/targets/react/component/handlers/archive/bottom-sheet.ts +70 -0
- package/src/codegen/targets/react/component/handlers/archive/callout.ts +88 -0
- package/src/codegen/targets/react/component/handlers/archive/checkbox.ts +41 -0
- package/src/codegen/targets/react/component/handlers/archive/checkmark.ts +29 -0
- package/src/codegen/targets/react/component/handlers/archive/chip.ts +90 -0
- package/src/codegen/targets/react/component/handlers/archive/contextual-floating-button.ts +52 -0
- package/src/codegen/targets/react/component/handlers/archive/divider.ts +25 -0
- package/src/codegen/targets/react/component/handlers/archive/field-button.ts +197 -0
- package/src/codegen/targets/react/component/handlers/archive/field.ts +167 -0
- package/src/codegen/targets/react/component/handlers/archive/floating-action-button.ts +48 -0
- package/src/codegen/targets/react/component/handlers/archive/help-bubble.ts +73 -0
- package/src/codegen/targets/react/component/handlers/archive/identity-placeholder.ts +21 -0
- package/src/codegen/targets/react/component/handlers/archive/index.ts +41 -0
- package/src/codegen/targets/react/component/handlers/archive/legacy-select-box.ts +89 -0
- package/src/codegen/targets/react/component/handlers/archive/legacy-text-field.ts +198 -0
- package/src/codegen/targets/react/component/handlers/archive/list-header.ts +20 -0
- package/src/codegen/targets/react/component/handlers/archive/list-item.ts +162 -0
- package/src/codegen/targets/react/component/handlers/archive/manner-temp-badge.ts +21 -0
- package/src/codegen/targets/react/component/handlers/archive/manner-temp.ts +18 -0
- package/src/codegen/targets/react/component/handlers/archive/menu-sheet.ts +108 -0
- package/src/codegen/targets/react/component/handlers/archive/page-banner.ts +101 -0
- package/src/codegen/targets/react/component/handlers/archive/progress-circle.ts +55 -0
- package/src/codegen/targets/react/component/handlers/archive/radio-group.ts +31 -0
- package/src/codegen/targets/react/component/handlers/archive/radiomark.ts +27 -0
- package/src/codegen/targets/react/component/handlers/archive/reaction-button.ts +37 -0
- package/src/codegen/targets/react/component/handlers/archive/result-section.ts +67 -0
- package/src/codegen/targets/react/component/handlers/archive/segmented-control.ts +64 -0
- package/src/codegen/targets/react/component/handlers/archive/skeleton.ts +26 -0
- package/src/codegen/targets/react/component/handlers/archive/slider.ts +114 -0
- package/src/codegen/targets/react/component/handlers/archive/snackbar.ts +25 -0
- package/src/codegen/targets/react/component/handlers/archive/switch.ts +39 -0
- package/src/codegen/targets/react/component/handlers/archive/switchmark.ts +26 -0
- package/src/codegen/targets/react/component/handlers/archive/tabs.ts +297 -0
- package/src/codegen/targets/react/component/handlers/archive/tag-group.ts +86 -0
- package/src/codegen/targets/react/component/handlers/archive/text-field.ts +264 -0
- package/src/codegen/targets/react/component/handlers/archive/toggle-button.ts +43 -0
- package/src/codegen/targets/react/component/handlers/avatar-stack.ts +5 -2
- package/src/codegen/targets/react/component/handlers/avatar.ts +42 -39
- package/src/codegen/targets/react/component/handlers/badge.ts +1 -1
- package/src/codegen/targets/react/component/handlers/bottom-sheet.ts +56 -49
- package/src/codegen/targets/react/component/handlers/callout.ts +1 -1
- package/src/codegen/targets/react/component/handlers/checkbox.ts +1 -1
- package/src/codegen/targets/react/component/handlers/checkmark.ts +1 -1
- package/src/codegen/targets/react/component/handlers/chip.ts +8 -5
- package/src/codegen/targets/react/component/handlers/contextual-floating-button.ts +1 -1
- package/src/codegen/targets/react/component/handlers/divider.ts +1 -1
- package/src/codegen/targets/react/component/handlers/field-button.ts +18 -16
- package/src/codegen/targets/react/component/handlers/field.ts +71 -74
- package/src/codegen/targets/react/component/handlers/floating-action-button.ts +3 -6
- package/src/codegen/targets/react/component/handlers/help-bubble.ts +1 -1
- package/src/codegen/targets/react/component/handlers/identity-placeholder.ts +10 -2
- package/src/codegen/targets/react/component/handlers/index.ts +41 -0
- package/src/codegen/targets/react/component/handlers/legacy-select-box.ts +3 -5
- package/src/codegen/targets/react/component/handlers/legacy-text-field.ts +3 -5
- package/src/codegen/targets/react/component/handlers/list-header.ts +1 -1
- package/src/codegen/targets/react/component/handlers/list-item.ts +22 -21
- package/src/codegen/targets/react/component/handlers/manner-temp-badge.ts +1 -1
- package/src/codegen/targets/react/component/handlers/manner-temp.ts +1 -1
- package/src/codegen/targets/react/component/handlers/menu-sheet.ts +59 -54
- package/src/codegen/targets/react/component/handlers/page-banner.ts +77 -72
- package/src/codegen/targets/react/component/handlers/progress-circle.ts +1 -1
- package/src/codegen/targets/react/component/handlers/radio-group.ts +1 -1
- package/src/codegen/targets/react/component/handlers/radiomark.ts +2 -2
- package/src/codegen/targets/react/component/handlers/reaction-button.ts +1 -1
- package/src/codegen/targets/react/component/handlers/result-section.ts +1 -1
- package/src/codegen/targets/react/component/handlers/segmented-control.ts +2 -3
- package/src/codegen/targets/react/component/handlers/skeleton.ts +1 -1
- package/src/codegen/targets/react/component/handlers/slider.ts +11 -8
- package/src/codegen/targets/react/component/handlers/snackbar.ts +1 -1
- package/src/codegen/targets/react/component/handlers/switch.ts +2 -2
- package/src/codegen/targets/react/component/handlers/switchmark.ts +2 -2
- package/src/codegen/targets/react/component/handlers/tabs.ts +39 -42
- package/src/codegen/targets/react/component/handlers/tag-group.ts +57 -59
- package/src/codegen/targets/react/component/handlers/text-field.ts +11 -22
- package/src/codegen/targets/react/component/handlers/toggle-button.ts +1 -1
- package/src/codegen/targets/react/component/index.ts +5 -115
- package/src/entities/data/__generated__/archive/component-sets/index.d.ts +2074 -0
- package/src/entities/data/__generated__/archive/component-sets/index.mjs +2074 -0
- package/src/entities/data/__generated__/archive/components/index.d.ts +116 -0
- package/src/entities/data/__generated__/archive/components/index.mjs +116 -0
- package/src/entities/data/__generated__/archive/styles/index.d.ts +3 -0
- package/src/entities/data/__generated__/archive/styles/index.mjs +429 -0
- package/src/entities/data/__generated__/archive/variable-collections/index.d.ts +3 -0
- package/src/entities/data/__generated__/archive/variable-collections/index.mjs +501 -0
- package/src/entities/data/__generated__/archive/variables/index.d.ts +3 -0
- package/src/entities/data/__generated__/archive/variables/index.mjs +7019 -0
- package/src/entities/data/__generated__/component-sets/index.d.ts +3442 -1306
- package/src/entities/data/__generated__/component-sets/index.mjs +3442 -1306
- package/src/entities/data/__generated__/components/index.d.ts +87 -85
- package/src/entities/data/__generated__/components/index.mjs +87 -85
- package/src/entities/data/__generated__/styles/index.mjs +9 -2
- package/src/entities/data/__generated__/variable-collections/index.mjs +150 -173
- package/src/entities/data/__generated__/variables/index.mjs +0 -74
- package/src/entities/index.ts +21 -7
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
LegacyMultilineTextFieldProperties,
|
|
3
|
+
LegacyTextFieldProperties,
|
|
4
|
+
} from "@/codegen/component-properties.archive";
|
|
5
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
6
|
+
import { createLocalSnippetHelper } from "../../../element-factories";
|
|
7
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
8
|
+
import { handleSizeProp } from "../../size";
|
|
9
|
+
|
|
10
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("text-field");
|
|
11
|
+
|
|
12
|
+
const LEGACY_TEXT_FIELD_KEY = "c49873c37a639f0dffdea4efd0eb43760d66c141";
|
|
13
|
+
const LEGACY_MULTILINE_TEXT_FIELD_KEY = "88b2399c930c85f9ce2972163a078bc684b84bbe";
|
|
14
|
+
|
|
15
|
+
export const createLegacyTextFieldHandler = (ctx: ComponentHandlerDeps) =>
|
|
16
|
+
defineComponentHandler<LegacyTextFieldProperties>(
|
|
17
|
+
LEGACY_TEXT_FIELD_KEY,
|
|
18
|
+
({ componentProperties: props }) => {
|
|
19
|
+
const {
|
|
20
|
+
Size: { value: size },
|
|
21
|
+
State: { value: state },
|
|
22
|
+
Filled: { value: filled },
|
|
23
|
+
"Show Header#870:0": { value: showHeader },
|
|
24
|
+
"Label#14964:0": { value: label },
|
|
25
|
+
"Show Indicator#1259:0": { value: showIndicator },
|
|
26
|
+
"Indicator#15327:249": { value: indicator },
|
|
27
|
+
"Show Prefix#958:125": { value: showPrefix },
|
|
28
|
+
"Show Prefix Icon#1267:50": { value: showPrefixIcon },
|
|
29
|
+
"Prefix Icon#1267:25": prefixIcon,
|
|
30
|
+
"Show Prefix Text#1267:0": { value: showPrefixText },
|
|
31
|
+
"Prefix Text#15327:101": { value: prefix },
|
|
32
|
+
"Placeholder#958:0": { value: placeholder },
|
|
33
|
+
"Filled Text#1304:0": { value: defaultValue },
|
|
34
|
+
"Show Suffix#958:100": { value: showSuffix },
|
|
35
|
+
"Show Suffix Icon#1267:75": { value: showSuffixIcon },
|
|
36
|
+
"Suffix Icon #1267:100": suffixIcon,
|
|
37
|
+
"Show Suffix Text#1267:125": { value: showSuffixText },
|
|
38
|
+
"Suffix Text#15327:138": { value: suffix },
|
|
39
|
+
"Show Footer#958:25": { value: showFooter },
|
|
40
|
+
"Show Description#958:50": { value: showDescription },
|
|
41
|
+
"Description#12626:5": { value: description },
|
|
42
|
+
"Show Character Count#958:75": { value: showCharacterCount },
|
|
43
|
+
"Character Count#15327:64": { value: _characterCount },
|
|
44
|
+
"Max Character Count#15327:27": { value: maxCharacterCount },
|
|
45
|
+
} = props;
|
|
46
|
+
|
|
47
|
+
const states = state.split("-");
|
|
48
|
+
|
|
49
|
+
const commonProps = {
|
|
50
|
+
size: handleSizeProp(size),
|
|
51
|
+
// header
|
|
52
|
+
...(showHeader && {
|
|
53
|
+
label,
|
|
54
|
+
}),
|
|
55
|
+
...(showHeader &&
|
|
56
|
+
showIndicator && {
|
|
57
|
+
indicator,
|
|
58
|
+
}),
|
|
59
|
+
// input affixes
|
|
60
|
+
...(showPrefix &&
|
|
61
|
+
showPrefixIcon && {
|
|
62
|
+
prefixIcon: ctx.iconHandler.transform(prefixIcon),
|
|
63
|
+
}),
|
|
64
|
+
...(showPrefix &&
|
|
65
|
+
showPrefixText && {
|
|
66
|
+
prefix,
|
|
67
|
+
}),
|
|
68
|
+
...(showSuffix &&
|
|
69
|
+
showSuffixIcon && {
|
|
70
|
+
suffixIcon: ctx.iconHandler.transform(suffixIcon),
|
|
71
|
+
}),
|
|
72
|
+
...(showSuffix &&
|
|
73
|
+
showSuffixText && {
|
|
74
|
+
suffix,
|
|
75
|
+
}),
|
|
76
|
+
// input
|
|
77
|
+
...(filled === "True" && {
|
|
78
|
+
defaultValue,
|
|
79
|
+
}),
|
|
80
|
+
...(states.includes("Invalid") && {
|
|
81
|
+
invalid: true,
|
|
82
|
+
}),
|
|
83
|
+
...(states.includes("Disabled") && {
|
|
84
|
+
disabled: true,
|
|
85
|
+
}),
|
|
86
|
+
...(states.includes("Read Only") && {
|
|
87
|
+
readOnly: true,
|
|
88
|
+
}),
|
|
89
|
+
// footer
|
|
90
|
+
...(showFooter &&
|
|
91
|
+
showDescription &&
|
|
92
|
+
states.includes("Invalid") && {
|
|
93
|
+
// invalid인 경우 description을 error로 사용
|
|
94
|
+
errorMessage: description,
|
|
95
|
+
}),
|
|
96
|
+
...(showFooter &&
|
|
97
|
+
showDescription &&
|
|
98
|
+
!states.includes("Invalid") && {
|
|
99
|
+
// invalid가 아닌 경우 description을 description으로 사용
|
|
100
|
+
description,
|
|
101
|
+
}),
|
|
102
|
+
...(showFooter &&
|
|
103
|
+
showCharacterCount && {
|
|
104
|
+
maxGraphemeCount: Number(maxCharacterCount),
|
|
105
|
+
}),
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const inputProps = {
|
|
109
|
+
placeholder,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const TextFieldChildren = createLocalSnippetElement("TextFieldInput", inputProps);
|
|
113
|
+
|
|
114
|
+
return createLocalSnippetElement("TextField", commonProps, TextFieldChildren, {
|
|
115
|
+
comment:
|
|
116
|
+
"이 Figma 컴포넌트는 @seed-design/react@1.1보다 낮은 버전의 TextField입니다. 신규 컴포넌트로 교체할 수 있습니다.",
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
export const createLegacyMultilineTextFieldHandler = (_ctx: ComponentHandlerDeps) =>
|
|
122
|
+
defineComponentHandler<LegacyMultilineTextFieldProperties>(
|
|
123
|
+
LEGACY_MULTILINE_TEXT_FIELD_KEY,
|
|
124
|
+
({ componentProperties: props }) => {
|
|
125
|
+
const {
|
|
126
|
+
Size: { value: size },
|
|
127
|
+
State: { value: state },
|
|
128
|
+
Filled: { value: filled },
|
|
129
|
+
"Show Header#870:0": { value: showHeader },
|
|
130
|
+
"Label#15327:323": { value: label },
|
|
131
|
+
"Show Indicator#1259:0": { value: showIndicator },
|
|
132
|
+
"Indicator#15327:286": { value: indicator },
|
|
133
|
+
"Placeholder#958:0": { value: placeholder },
|
|
134
|
+
"Filled Text#1304:0": { value: defaultValue },
|
|
135
|
+
"Show Footer#958:25": { value: showFooter },
|
|
136
|
+
"Show Description#958:50": { value: showDescription },
|
|
137
|
+
"Description#15327:212": { value: description },
|
|
138
|
+
"Show Character count#958:75": { value: showCharacterCount },
|
|
139
|
+
"Character Count#15327:360": { value: _characterCount },
|
|
140
|
+
"Max Character Count#15327:175": { value: maxCharacterCount },
|
|
141
|
+
} = props;
|
|
142
|
+
|
|
143
|
+
const states = state.split("-");
|
|
144
|
+
|
|
145
|
+
const commonProps = {
|
|
146
|
+
size: handleSizeProp(size),
|
|
147
|
+
// header
|
|
148
|
+
...(showHeader && {
|
|
149
|
+
label,
|
|
150
|
+
}),
|
|
151
|
+
...(showHeader &&
|
|
152
|
+
showIndicator && {
|
|
153
|
+
indicator,
|
|
154
|
+
}),
|
|
155
|
+
// input
|
|
156
|
+
...(filled === "True" && {
|
|
157
|
+
defaultValue,
|
|
158
|
+
}),
|
|
159
|
+
...(states.includes("Invalid") && {
|
|
160
|
+
invalid: true,
|
|
161
|
+
}),
|
|
162
|
+
...(states.includes("Disabled") && {
|
|
163
|
+
disabled: true,
|
|
164
|
+
}),
|
|
165
|
+
...(states.includes("Read Only") && {
|
|
166
|
+
readOnly: true,
|
|
167
|
+
}),
|
|
168
|
+
// footer
|
|
169
|
+
...(showFooter &&
|
|
170
|
+
showDescription &&
|
|
171
|
+
states.includes("Invalid") && {
|
|
172
|
+
// invalid인 경우 description을 error로 사용
|
|
173
|
+
errorMessage: description,
|
|
174
|
+
}),
|
|
175
|
+
...(showFooter &&
|
|
176
|
+
showDescription &&
|
|
177
|
+
!states.includes("Invalid") && {
|
|
178
|
+
// invalid가 아닌 경우 description을 description으로 사용
|
|
179
|
+
description,
|
|
180
|
+
}),
|
|
181
|
+
...(showFooter &&
|
|
182
|
+
showCharacterCount && {
|
|
183
|
+
maxGraphemeCount: Number(maxCharacterCount),
|
|
184
|
+
}),
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const inputProps = {
|
|
188
|
+
placeholder,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const TextFieldChildren = createLocalSnippetElement("TextFieldTextarea", inputProps);
|
|
192
|
+
|
|
193
|
+
return createLocalSnippetElement("TextField", commonProps, TextFieldChildren, {
|
|
194
|
+
comment:
|
|
195
|
+
"이 Figma 컴포넌트는 @seed-design/react@1.1보다 낮은 버전의 TextField입니다. 신규 컴포넌트로 교체할 수 있습니다.",
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ListHeaderProperties } from "@/codegen/component-properties.archive";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
3
|
+
import * as metadata from "@/entities/data/__generated__/archive/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper } from "../../../element-factories";
|
|
5
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
6
|
+
import { camelCase } from "change-case";
|
|
7
|
+
|
|
8
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("list-header");
|
|
9
|
+
|
|
10
|
+
export const createListHeaderHandler = (_ctx: ComponentHandlerDeps) =>
|
|
11
|
+
defineComponentHandler<ListHeaderProperties>(
|
|
12
|
+
metadata.listHeader.key,
|
|
13
|
+
({ componentProperties: props }) => {
|
|
14
|
+
const commonProps = {
|
|
15
|
+
variant: camelCase(props["Variant"].value),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return createLocalSnippetElement("ListHeader", commonProps, props["Title#28588:0"].value);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ListItemSuffixIconProperties,
|
|
3
|
+
ListItemPrefixIconProperties,
|
|
4
|
+
ListItemProperties,
|
|
5
|
+
} from "@/codegen/component-properties.archive";
|
|
6
|
+
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
7
|
+
import * as metadata from "@/entities/data/__generated__/archive/component-sets";
|
|
8
|
+
import type { NormalizedTextNode } from "@/normalizer";
|
|
9
|
+
import { findAllInstances, findOne } from "@/utils/figma-node";
|
|
10
|
+
import { createLocalSnippetHelper, createSeedReactElement } from "../../../element-factories";
|
|
11
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
12
|
+
import { match } from "ts-pattern";
|
|
13
|
+
|
|
14
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("list");
|
|
15
|
+
|
|
16
|
+
const PREFIX_KEYS = {
|
|
17
|
+
checkmark: "f24c9ef42ef08df79483fbae0fa7d9037e566748",
|
|
18
|
+
radiomark: "5a77ad37a2291989dfe77c44ddee9aa39e447f90",
|
|
19
|
+
icon: "0e4c05f097d3fa2dc0cbfdbf8db2662bcf8439ca",
|
|
20
|
+
avatar: "ef0e8bd6c2f92e620acf204bb9a8079ef25a1e5c",
|
|
21
|
+
image: "82239325aa1cb65af7c649fc71a8f2b48fb9b9f3",
|
|
22
|
+
custom: "81f201fc876e38f016ab7427a6b3da000ee919a2",
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
const SUFFIX_KEYS = {
|
|
26
|
+
checkmark: "abf9810103ae6e6afe8fa253ec5f05d6a7304b38",
|
|
27
|
+
radiomark: "0a9464ad270bfd7f56438f62bb0155a25ca146a9",
|
|
28
|
+
chevron: "8c52207687ffed15cd5931d71ed9d196b3358a68",
|
|
29
|
+
switch: "1e933f75dd6bb4b21c3289b5c3b4402d2c623125",
|
|
30
|
+
custom: "3a70bf5bb9856c13893931b7a0df652bcf0be895",
|
|
31
|
+
icon: "4cc7e9b84a8388a36cb3898c6c02e6110a3281b9",
|
|
32
|
+
chevronWithText: "fe0e25f4fecda59d0a3730ead7c5bc0a66a41e7e",
|
|
33
|
+
iconButton: "5636566f6de6f58200dce388f7b1ac9f517b30e1",
|
|
34
|
+
actionButton: "3d788f28c785d1c60b937b253c39ce582dbe1ed3",
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
export const createListItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
38
|
+
defineComponentHandler<ListItemProperties>(metadata.listItem.key, (node, traverse) => {
|
|
39
|
+
const { componentProperties: props } = node;
|
|
40
|
+
|
|
41
|
+
const { alignItems, title } = match(props.Variants.value)
|
|
42
|
+
.with("Single Line", () => ({ alignItems: undefined, title: props["Title#28452:21"].value }))
|
|
43
|
+
.with("Multi Line", () => ({
|
|
44
|
+
alignItems: "flex-start",
|
|
45
|
+
title: props["Title #28487:0"].value,
|
|
46
|
+
}))
|
|
47
|
+
.exhaustive();
|
|
48
|
+
|
|
49
|
+
const detailNode = findOne(
|
|
50
|
+
node,
|
|
51
|
+
(node) => node.type === "TEXT" && node.name === "Sub Text",
|
|
52
|
+
) as NormalizedTextNode | null;
|
|
53
|
+
|
|
54
|
+
const prefixNode = (() => {
|
|
55
|
+
if (props["Has Prefix#28452:85"].value === false) return null;
|
|
56
|
+
|
|
57
|
+
for (const key of Object.values(PREFIX_KEYS)) {
|
|
58
|
+
const [found] = findAllInstances<ListItemPrefixIconProperties | {}>({ node, key });
|
|
59
|
+
|
|
60
|
+
if (found) return found;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return null;
|
|
64
|
+
})();
|
|
65
|
+
|
|
66
|
+
const prefix = (() => {
|
|
67
|
+
if (!prefixNode) return undefined;
|
|
68
|
+
|
|
69
|
+
if ("Icon#28452:111" in prefixNode.componentProperties) {
|
|
70
|
+
return createSeedReactElement("Icon", {
|
|
71
|
+
svg: ctx.iconHandler.transform(prefixNode.componentProperties["Icon#28452:111"]),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return traverse(prefixNode.children[0]);
|
|
76
|
+
})();
|
|
77
|
+
|
|
78
|
+
const suffixNode = (() => {
|
|
79
|
+
if (props["Has Suffix#28452:64"].value === false) return null;
|
|
80
|
+
|
|
81
|
+
for (const key of Object.values(SUFFIX_KEYS)) {
|
|
82
|
+
const [found] = findAllInstances<ListItemSuffixIconProperties | {}>({ node, key });
|
|
83
|
+
|
|
84
|
+
if (found) return found;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return null;
|
|
88
|
+
})();
|
|
89
|
+
|
|
90
|
+
const suffix = (() => {
|
|
91
|
+
if (!suffixNode) return undefined;
|
|
92
|
+
|
|
93
|
+
if ("Icon#28347:9" in suffixNode.componentProperties) {
|
|
94
|
+
return createSeedReactElement("Icon", {
|
|
95
|
+
svg: ctx.iconHandler.transform(suffixNode.componentProperties["Icon#28347:9"]),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return traverse(suffixNode.children[0]);
|
|
100
|
+
})();
|
|
101
|
+
|
|
102
|
+
const disabled = props.State.value === "Disabled";
|
|
103
|
+
|
|
104
|
+
const tag = (() => {
|
|
105
|
+
if (suffix?.tag === "Switchmark") {
|
|
106
|
+
return "ListSwitchItem";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (prefix?.tag === "Checkmark" || suffix?.tag === "Checkmark") {
|
|
110
|
+
return "ListCheckItem";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (prefix?.tag === "Radiomark" || suffix?.tag === "Radiomark") {
|
|
114
|
+
return "ListRadioItem";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// checkmark/radiomark 없는데 disabled인 경우 Button으로 추측
|
|
118
|
+
if (disabled) {
|
|
119
|
+
return "ListButtonItem";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return "ListItem";
|
|
123
|
+
})();
|
|
124
|
+
|
|
125
|
+
const commonProps = {
|
|
126
|
+
...(tag === "ListRadioItem" && {
|
|
127
|
+
value: title,
|
|
128
|
+
}),
|
|
129
|
+
alignItems,
|
|
130
|
+
title,
|
|
131
|
+
...(props["Has Detail#28469:1"].value &&
|
|
132
|
+
detailNode && {
|
|
133
|
+
detail: detailNode.characters,
|
|
134
|
+
}),
|
|
135
|
+
...(prefix && { prefix }),
|
|
136
|
+
...(suffix && { suffix }),
|
|
137
|
+
...(disabled &&
|
|
138
|
+
(tag === "ListButtonItem" ||
|
|
139
|
+
tag === "ListCheckItem" ||
|
|
140
|
+
tag === "ListRadioItem" ||
|
|
141
|
+
tag === "ListSwitchItem") && {
|
|
142
|
+
disabled: true,
|
|
143
|
+
}),
|
|
144
|
+
...(props.Highlighted.value === "True" && {
|
|
145
|
+
highlighted: true,
|
|
146
|
+
}),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const comment = match(tag)
|
|
150
|
+
.with("ListItem", () => "목적에 따라 ListButtonItem이나 ListLinkItem으로 바꿔 사용하세요.")
|
|
151
|
+
.with("ListCheckItem", () => `<List as="fieldset">과 함께 사용하세요.`)
|
|
152
|
+
.with("ListRadioItem", () => "<RadioGroup.Root>와 함께 사용하세요.")
|
|
153
|
+
.otherwise(() => undefined);
|
|
154
|
+
|
|
155
|
+
const list = createLocalSnippetElement(tag, commonProps, undefined, { comment });
|
|
156
|
+
|
|
157
|
+
if (props["Divider#28441:0"].value) {
|
|
158
|
+
return createElement("", {}, [list, createLocalSnippetElement("ListDivider")]);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return list;
|
|
162
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MannerTempBadgeProperties } from "@/codegen/component-properties.archive";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
3
|
+
import * as metadata from "@/entities/data/__generated__/archive/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper } from "../../../element-factories";
|
|
5
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
6
|
+
|
|
7
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("manner-temp-badge");
|
|
8
|
+
|
|
9
|
+
export const createMannerTempBadgeHandler = (_ctx: ComponentHandlerDeps) =>
|
|
10
|
+
defineComponentHandler<MannerTempBadgeProperties>(
|
|
11
|
+
metadata.mannerTempBadge.key,
|
|
12
|
+
({ children }) => {
|
|
13
|
+
const textNode = children.find((child) => child.type === "TEXT");
|
|
14
|
+
|
|
15
|
+
const commonProps = {
|
|
16
|
+
temperature: Number(textNode?.characters.replace(/[^\d.-]/g, "") ?? "-1"),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return createLocalSnippetElement("MannerTempBadge", commonProps);
|
|
20
|
+
},
|
|
21
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MannerTempProperties } from "@/codegen/component-properties.archive";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
3
|
+
import * as metadata from "@/entities/data/__generated__/archive/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper } from "../../../element-factories";
|
|
5
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
6
|
+
|
|
7
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("manner-temp");
|
|
8
|
+
|
|
9
|
+
export const createMannerTempHandler = (_ctx: ComponentHandlerDeps) =>
|
|
10
|
+
defineComponentHandler<MannerTempProperties>(metadata.mannerTemp.key, ({ children }) => {
|
|
11
|
+
const textNode = children.find((child) => child.type === "TEXT");
|
|
12
|
+
|
|
13
|
+
const commonProps = {
|
|
14
|
+
temperature: Number(textNode?.characters.replace(/[^\d.-]/g, "") ?? "-1"),
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return createLocalSnippetElement("MannerTemp", commonProps);
|
|
18
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
MenuSheetGroupProperties,
|
|
3
|
+
MenuSheetItemProperties,
|
|
4
|
+
MenuSheetProperties,
|
|
5
|
+
} from "@/codegen/component-properties.archive";
|
|
6
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
7
|
+
import * as metadata from "@/entities/data/__generated__/archive/component-sets";
|
|
8
|
+
import { findAllInstances } from "@/utils/figma-node";
|
|
9
|
+
import { camelCase } from "change-case";
|
|
10
|
+
import { createLocalSnippetHelper } from "../../../element-factories";
|
|
11
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
12
|
+
import { match } from "ts-pattern";
|
|
13
|
+
|
|
14
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("menu-sheet");
|
|
15
|
+
const { createLocalSnippetElement: createLocalSnippetElementTrigger } =
|
|
16
|
+
createLocalSnippetHelper("action-button");
|
|
17
|
+
|
|
18
|
+
const MENU_SHEET_ITEM_KEY = "057083e95466da59051119eec0b41d4ad5a07f8f";
|
|
19
|
+
const createMenuSheetItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
20
|
+
defineComponentHandler<MenuSheetItemProperties>(
|
|
21
|
+
MENU_SHEET_ITEM_KEY,
|
|
22
|
+
({ componentProperties: props }) => {
|
|
23
|
+
const states = props.State.value.split("-");
|
|
24
|
+
|
|
25
|
+
const commonProps = {
|
|
26
|
+
tone: camelCase(props.Tone.value),
|
|
27
|
+
...(states.includes("Disabled") && {
|
|
28
|
+
disabled: true,
|
|
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
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return createLocalSnippetElement("MenuSheetItem", commonProps);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const MENU_SHEET_GROUP_KEY = "2a504a1c6b7810d5e652862dcba2cb7048f9eb16";
|
|
44
|
+
const createMenuSheetGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
45
|
+
const menuSheetItemHandler = createMenuSheetItemHandler(ctx);
|
|
46
|
+
|
|
47
|
+
return defineComponentHandler<MenuSheetGroupProperties>(
|
|
48
|
+
MENU_SHEET_GROUP_KEY,
|
|
49
|
+
(node, traverse) => {
|
|
50
|
+
const items = findAllInstances<MenuSheetItemProperties>({
|
|
51
|
+
node,
|
|
52
|
+
key: menuSheetItemHandler.key,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const contentChildren = items.map((item) => menuSheetItemHandler.transform(item, traverse));
|
|
56
|
+
|
|
57
|
+
return createLocalSnippetElement("MenuSheetGroup", undefined, contentChildren);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const createMenuSheetHandler = (ctx: ComponentHandlerDeps) => {
|
|
63
|
+
const menuSheetGroupHandler = createMenuSheetGroupHandler(ctx);
|
|
64
|
+
|
|
65
|
+
return defineComponentHandler<MenuSheetProperties>(metadata.menuSheet.key, (node, traverse) => {
|
|
66
|
+
const { componentProperties: props } = node;
|
|
67
|
+
|
|
68
|
+
const groups = findAllInstances<MenuSheetGroupProperties>({
|
|
69
|
+
node,
|
|
70
|
+
key: menuSheetGroupHandler.key,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const contentChildren = groups.map((group) => menuSheetGroupHandler.transform(group, traverse));
|
|
74
|
+
|
|
75
|
+
const title = props["Show Header#17043:12"].value
|
|
76
|
+
? props["Title Text#14599:0"].value
|
|
77
|
+
: undefined;
|
|
78
|
+
|
|
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;
|
|
83
|
+
|
|
84
|
+
const { labelAlign } = match(props.Layout.value)
|
|
85
|
+
.with("Text with Icon", () => ({ labelAlign: "left" }))
|
|
86
|
+
.with("Text Only", () => ({ labelAlign: "center" }))
|
|
87
|
+
.exhaustive();
|
|
88
|
+
|
|
89
|
+
const content = createLocalSnippetElement(
|
|
90
|
+
"MenuSheetContent",
|
|
91
|
+
{ title, description, labelAlign },
|
|
92
|
+
contentChildren,
|
|
93
|
+
{
|
|
94
|
+
comment: title
|
|
95
|
+
? undefined
|
|
96
|
+
: "title을 제공하지 않는 경우 aria-label이나 aria-labelledby 중 하나를 제공해야 합니다.",
|
|
97
|
+
},
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const trigger = createLocalSnippetElement(
|
|
101
|
+
"MenuSheetTrigger",
|
|
102
|
+
{ asChild: true },
|
|
103
|
+
createLocalSnippetElementTrigger("ActionButton", {}, "MenuSheet 열기"),
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
return createLocalSnippetElement("MenuSheet", undefined, [trigger, content]);
|
|
107
|
+
});
|
|
108
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PageBannerButtonProperties,
|
|
3
|
+
PageBannerProperties,
|
|
4
|
+
} from "@/codegen/component-properties.archive";
|
|
5
|
+
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
6
|
+
import * as metadata from "@/entities/data/__generated__/archive/component-sets";
|
|
7
|
+
import type { NormalizedInstanceNode, NormalizedTextNode } from "@/normalizer";
|
|
8
|
+
import { findAllInstances, findOne } from "@/utils/figma-node";
|
|
9
|
+
import { camelCase } from "change-case";
|
|
10
|
+
import { createLocalSnippetHelper } from "../../../element-factories";
|
|
11
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
12
|
+
import { match } from "ts-pattern";
|
|
13
|
+
|
|
14
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("page-banner");
|
|
15
|
+
|
|
16
|
+
const SUFFIX_BUTTON_KEY = "7dce4e1242761ccd8e5da42278fc2d870918039c";
|
|
17
|
+
|
|
18
|
+
const createPageBannerButtonHandler = (_ctx: ComponentHandlerDeps) =>
|
|
19
|
+
defineComponentHandler<PageBannerButtonProperties>(SUFFIX_BUTTON_KEY, (node) => {
|
|
20
|
+
return createElement(
|
|
21
|
+
"PageBannerButton",
|
|
22
|
+
undefined,
|
|
23
|
+
node.componentProperties["Label#39890:0"].value,
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const createPageBannerHandler = (ctx: ComponentHandlerDeps) => {
|
|
28
|
+
const buttonHandler = createPageBannerButtonHandler(ctx);
|
|
29
|
+
|
|
30
|
+
return defineComponentHandler<PageBannerProperties>(metadata.pageBanner.key, (node, traverse) => {
|
|
31
|
+
const { componentProperties: props } = node;
|
|
32
|
+
|
|
33
|
+
const { tag, suffix } = match(props.Interaction.value)
|
|
34
|
+
.with("Actionable", () => ({ tag: "ActionablePageBanner", suffix: undefined }))
|
|
35
|
+
.with("Dismissible", () => ({ tag: "DismissiblePageBanner", suffix: undefined }))
|
|
36
|
+
.with("Display", () => ({ tag: "PageBanner", suffix: undefined }))
|
|
37
|
+
.with("Display (With Action)", () => {
|
|
38
|
+
const [buttonNode] = findAllInstances<PageBannerButtonProperties>({
|
|
39
|
+
node,
|
|
40
|
+
key: SUFFIX_BUTTON_KEY,
|
|
41
|
+
});
|
|
42
|
+
const suffix = buttonNode ? buttonHandler.transform(buttonNode, traverse) : undefined;
|
|
43
|
+
|
|
44
|
+
return { tag: "PageBanner", suffix };
|
|
45
|
+
})
|
|
46
|
+
.with("Actionable (Custom)", () => ({
|
|
47
|
+
tag: "PageBanner",
|
|
48
|
+
suffix: createElement("div", undefined, "Custom Content"),
|
|
49
|
+
}))
|
|
50
|
+
.exhaustive();
|
|
51
|
+
|
|
52
|
+
const textNode = findOne(
|
|
53
|
+
node,
|
|
54
|
+
(child) => child.type === "TEXT" && child.name === "Text",
|
|
55
|
+
) as NormalizedTextNode | null;
|
|
56
|
+
|
|
57
|
+
if (!textNode) {
|
|
58
|
+
return createLocalSnippetElement(tag, undefined, undefined, {
|
|
59
|
+
comment: "내용을 제공해주세요.",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const slices = textNode.segments;
|
|
64
|
+
|
|
65
|
+
let title: string | undefined;
|
|
66
|
+
let description: string | undefined;
|
|
67
|
+
|
|
68
|
+
switch (slices.length) {
|
|
69
|
+
case 1: {
|
|
70
|
+
description = slices[0]?.characters.trim();
|
|
71
|
+
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case 2: {
|
|
75
|
+
title = slices[0]?.characters.trim();
|
|
76
|
+
description = slices[1]?.characters.trim();
|
|
77
|
+
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const iconNode = findOne(
|
|
83
|
+
node,
|
|
84
|
+
(child) => child.type === "INSTANCE" && child.name === "icon",
|
|
85
|
+
) as NormalizedInstanceNode | null;
|
|
86
|
+
|
|
87
|
+
const showPrefixIcon = props["Show Prefix Icon#11840:27"].value && iconNode;
|
|
88
|
+
const prefixIcon = showPrefixIcon ? ctx.iconHandler.transform(iconNode) : undefined;
|
|
89
|
+
|
|
90
|
+
const commonProps = {
|
|
91
|
+
title,
|
|
92
|
+
description,
|
|
93
|
+
prefixIcon,
|
|
94
|
+
tone: camelCase(props.Tone.value),
|
|
95
|
+
variant: camelCase(props.Variant.value),
|
|
96
|
+
...(suffix && { suffix }),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return createLocalSnippetElement(tag, commonProps);
|
|
100
|
+
});
|
|
101
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ProgressCircleProperties } from "@/codegen/component-properties.archive";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
3
|
+
import * as metadata from "@/entities/data/__generated__/archive/component-sets";
|
|
4
|
+
import { camelCase } from "change-case";
|
|
5
|
+
import { match } from "ts-pattern";
|
|
6
|
+
import { createLocalSnippetHelper } from "../../../element-factories";
|
|
7
|
+
import type { ComponentHandlerDeps } from "../../deps.interface";
|
|
8
|
+
|
|
9
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("progress-circle");
|
|
10
|
+
|
|
11
|
+
export const createProgressCircleHandler = (_ctx: ComponentHandlerDeps) =>
|
|
12
|
+
defineComponentHandler<ProgressCircleProperties>(
|
|
13
|
+
metadata.progressCircle.key,
|
|
14
|
+
({ componentProperties: props }) => {
|
|
15
|
+
const { value, minValue, maxValue } = match(props.Value.value)
|
|
16
|
+
.with("Indeterminate", () => ({
|
|
17
|
+
value: undefined,
|
|
18
|
+
minValue: undefined,
|
|
19
|
+
maxValue: undefined,
|
|
20
|
+
}))
|
|
21
|
+
.with("0%", () => ({
|
|
22
|
+
value: 0,
|
|
23
|
+
minValue: 0,
|
|
24
|
+
maxValue: 100,
|
|
25
|
+
}))
|
|
26
|
+
.with("25%", () => ({
|
|
27
|
+
value: 25,
|
|
28
|
+
minValue: 0,
|
|
29
|
+
maxValue: 100,
|
|
30
|
+
}))
|
|
31
|
+
.with("75%", () => ({
|
|
32
|
+
value: 75,
|
|
33
|
+
minValue: 0,
|
|
34
|
+
maxValue: 100,
|
|
35
|
+
}))
|
|
36
|
+
.with("100%", () => ({
|
|
37
|
+
value: 100,
|
|
38
|
+
minValue: 0,
|
|
39
|
+
maxValue: 100,
|
|
40
|
+
}))
|
|
41
|
+
.exhaustive();
|
|
42
|
+
|
|
43
|
+
const commonProps = {
|
|
44
|
+
value,
|
|
45
|
+
minValue,
|
|
46
|
+
maxValue,
|
|
47
|
+
size: props.Size.value,
|
|
48
|
+
...(props.Tone.value !== "Custom(inherit)" && {
|
|
49
|
+
tone: camelCase(props.Tone.value),
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return createLocalSnippetElement("ProgressCircle", commonProps);
|
|
54
|
+
},
|
|
55
|
+
);
|