@seed-design/figma 1.1.2 → 1.1.3

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.2",
3
+ "version": "1.1.3",
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.0",
42
+ "@seed-design/css": "1.1.3",
43
43
  "change-case": "^5.4.4",
44
44
  "ts-pattern": "^5.7.0"
45
45
  },
@@ -848,3 +848,137 @@ export type InputButtonSuffixProperties = InferComponentDefinition<{
848
848
  }>;
849
849
 
850
850
  export type GenericFieldButtonProps = InferComponentDefinition<{}>;
851
+
852
+ export type LegacyTextFieldProperties = InferComponentDefinition<{
853
+ "Show Header#870:0": {
854
+ type: "BOOLEAN";
855
+ };
856
+ "Placeholder#958:0": {
857
+ type: "TEXT";
858
+ };
859
+ "Show Footer#958:25": {
860
+ type: "BOOLEAN";
861
+ };
862
+ "Show Description#958:50": {
863
+ type: "BOOLEAN";
864
+ };
865
+ "Show Character Count#958:75": {
866
+ type: "BOOLEAN";
867
+ };
868
+ "Show Suffix#958:100": {
869
+ type: "BOOLEAN";
870
+ };
871
+ "Show Prefix#958:125": {
872
+ type: "BOOLEAN";
873
+ };
874
+ "Show Indicator#1259:0": {
875
+ type: "BOOLEAN";
876
+ };
877
+ "Show Prefix Text#1267:0": {
878
+ type: "BOOLEAN";
879
+ };
880
+ "Prefix Icon#1267:25": {
881
+ type: "INSTANCE_SWAP";
882
+ preferredValues: [];
883
+ };
884
+ "Show Prefix Icon#1267:50": {
885
+ type: "BOOLEAN";
886
+ };
887
+ "Show Suffix Icon#1267:75": {
888
+ type: "BOOLEAN";
889
+ };
890
+ "Suffix Icon #1267:100": {
891
+ type: "INSTANCE_SWAP";
892
+ preferredValues: [];
893
+ };
894
+ "Show Suffix Text#1267:125": {
895
+ type: "BOOLEAN";
896
+ };
897
+ "Filled Text#1304:0": {
898
+ type: "TEXT";
899
+ };
900
+ "Description#12626:5": {
901
+ type: "TEXT";
902
+ };
903
+ "Label#14964:0": {
904
+ type: "TEXT";
905
+ };
906
+ "Max Character Count#15327:27": {
907
+ type: "TEXT";
908
+ };
909
+ "Character Count#15327:64": {
910
+ type: "TEXT";
911
+ };
912
+ "Prefix Text#15327:101": {
913
+ type: "TEXT";
914
+ };
915
+ "Suffix Text#15327:138": {
916
+ type: "TEXT";
917
+ };
918
+ "Indicator#15327:249": {
919
+ type: "TEXT";
920
+ };
921
+ Size: {
922
+ type: "VARIANT";
923
+ variantOptions: ["Medium", "Large(Default)"];
924
+ };
925
+ State: {
926
+ type: "VARIANT";
927
+ variantOptions: ["Enabled", "Focused", "Invalid", "Invalid-Focused", "Disabled", "Read Only"];
928
+ };
929
+ Filled: {
930
+ type: "VARIANT";
931
+ variantOptions: ["True", "False"];
932
+ };
933
+ }>;
934
+
935
+ export type LegacyMultilineTextFieldProperties = InferComponentDefinition<{
936
+ "Show Header#870:0": {
937
+ type: "BOOLEAN";
938
+ };
939
+ "Placeholder#958:0": {
940
+ type: "TEXT";
941
+ };
942
+ "Show Footer#958:25": {
943
+ type: "BOOLEAN";
944
+ };
945
+ "Show Description#958:50": {
946
+ type: "BOOLEAN";
947
+ };
948
+ "Show Character count#958:75": {
949
+ type: "BOOLEAN";
950
+ };
951
+ "Show Indicator#1259:0": {
952
+ type: "BOOLEAN";
953
+ };
954
+ "Filled Text#1304:0": {
955
+ type: "TEXT";
956
+ };
957
+ "Max Character Count#15327:175": {
958
+ type: "TEXT";
959
+ };
960
+ "Description#15327:212": {
961
+ type: "TEXT";
962
+ };
963
+ "Indicator#15327:286": {
964
+ type: "TEXT";
965
+ };
966
+ "Label#15327:323": {
967
+ type: "TEXT";
968
+ };
969
+ "Character Count#15327:360": {
970
+ type: "TEXT";
971
+ };
972
+ Size: {
973
+ type: "VARIANT";
974
+ variantOptions: ["Medium", "Large", "XLarge"];
975
+ };
976
+ State: {
977
+ type: "VARIANT";
978
+ variantOptions: ["Enabled", "Focused", "Invalid", "Invalid-Focused", "Disabled", "Read Only"];
979
+ };
980
+ Filled: {
981
+ type: "VARIANT";
982
+ variantOptions: ["True", "False"];
983
+ };
984
+ }>;
@@ -0,0 +1,196 @@
1
+ import type {
2
+ LegacyMultilineTextFieldProperties,
3
+ LegacyTextFieldProperties,
4
+ } from "@/codegen/component-properties";
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: "이 Figma 컴포넌트는 @seed-design/react@1.1보다 낮은 버전의 TextField입니다.",
116
+ });
117
+ },
118
+ );
119
+
120
+ export const createLegacyMultilineTextFieldHandler = (_ctx: ComponentHandlerDeps) =>
121
+ defineComponentHandler<LegacyMultilineTextFieldProperties>(
122
+ LEGACY_MULTILINE_TEXT_FIELD_KEY,
123
+ ({ componentProperties: props }) => {
124
+ const {
125
+ Size: { value: size },
126
+ State: { value: state },
127
+ Filled: { value: filled },
128
+ "Show Header#870:0": { value: showHeader },
129
+ "Label#15327:323": { value: label },
130
+ "Show Indicator#1259:0": { value: showIndicator },
131
+ "Indicator#15327:286": { value: indicator },
132
+ "Placeholder#958:0": { value: placeholder },
133
+ "Filled Text#1304:0": { value: defaultValue },
134
+ "Show Footer#958:25": { value: showFooter },
135
+ "Show Description#958:50": { value: showDescription },
136
+ "Description#15327:212": { value: description },
137
+ "Show Character count#958:75": { value: showCharacterCount },
138
+ "Character Count#15327:360": { value: _characterCount },
139
+ "Max Character Count#15327:175": { value: maxCharacterCount },
140
+ } = props;
141
+
142
+ const states = state.split("-");
143
+
144
+ const commonProps = {
145
+ size: handleSizeProp(size),
146
+ // header
147
+ ...(showHeader && {
148
+ label,
149
+ }),
150
+ ...(showHeader &&
151
+ showIndicator && {
152
+ indicator,
153
+ }),
154
+ // input
155
+ ...(filled === "True" && {
156
+ defaultValue,
157
+ }),
158
+ ...(states.includes("Invalid") && {
159
+ invalid: true,
160
+ }),
161
+ ...(states.includes("Disabled") && {
162
+ disabled: true,
163
+ }),
164
+ ...(states.includes("Read Only") && {
165
+ readOnly: true,
166
+ }),
167
+ // footer
168
+ ...(showFooter &&
169
+ showDescription &&
170
+ states.includes("Invalid") && {
171
+ // invalid인 경우 description을 error로 사용
172
+ errorMessage: description,
173
+ }),
174
+ ...(showFooter &&
175
+ showDescription &&
176
+ !states.includes("Invalid") && {
177
+ // invalid가 아닌 경우 description을 description으로 사용
178
+ description,
179
+ }),
180
+ ...(showFooter &&
181
+ showCharacterCount && {
182
+ maxGraphemeCount: Number(maxCharacterCount),
183
+ }),
184
+ };
185
+
186
+ const inputProps = {
187
+ placeholder,
188
+ };
189
+
190
+ const TextFieldChildren = createLocalSnippetElement("TextFieldTextarea", inputProps);
191
+
192
+ return createLocalSnippetElement("TextField", commonProps, TextFieldChildren, {
193
+ comment: "이 Figma 컴포넌트는 @seed-design/react@1.1보다 낮은 버전의 TextField입니다.",
194
+ });
195
+ },
196
+ );
@@ -56,6 +56,10 @@ import {
56
56
  createTagGroupHandler,
57
57
  createTagGroupItemHandler,
58
58
  } from "@/codegen/targets/react/component/handlers/tag-group";
59
+ import {
60
+ createLegacyTextFieldHandler,
61
+ createLegacyMultilineTextFieldHandler,
62
+ } from "./handlers/legacy-text-field";
59
63
 
60
64
  export type { ComponentHandlerDeps };
61
65
  export type UnboundComponentHandler<T extends NormalizedInstanceNode["componentProperties"]> = (
@@ -74,6 +78,10 @@ export const unboundSeedComponentHandlers: Array<UnboundComponentHandler<any>> =
74
78
  createActionButtonHandler,
75
79
  createTextInputFieldHandler,
76
80
  createTextareaFieldHandler,
81
+
82
+ createLegacyTextFieldHandler,
83
+ createLegacyMultilineTextFieldHandler,
84
+
77
85
  createBadgeHandler,
78
86
  createChipHandler,
79
87
  createCalloutHandler,