@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
|
@@ -18,7 +18,7 @@ export const createResultSectionHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
18
18
|
const ghostButtonHandler = createActionButtonGhostHandler(ctx);
|
|
19
19
|
|
|
20
20
|
return defineComponentHandler<ResultSectionProperties>(
|
|
21
|
-
metadata.
|
|
21
|
+
metadata.componentResultSection.key,
|
|
22
22
|
(node, traverse) => {
|
|
23
23
|
const props = node.componentProperties;
|
|
24
24
|
|
|
@@ -10,10 +10,9 @@ import type { ComponentHandlerDeps } from "../deps.interface";
|
|
|
10
10
|
|
|
11
11
|
const { createLocalSnippetElement } = createLocalSnippetHelper("segmented-control");
|
|
12
12
|
|
|
13
|
-
const SEGMENTED_CONTROL_ITEM_KEY = "9a7ba0d4c041ddbce84ee48881788434fd6bccc8";
|
|
14
13
|
const createSegmentedControlItemHandler = (_ctx: ComponentHandlerDeps) =>
|
|
15
14
|
defineComponentHandler<SegmentedControlItemProperties>(
|
|
16
|
-
|
|
15
|
+
metadata.privateComponentSegmentedControlItem.key,
|
|
17
16
|
({ componentProperties: props }) => {
|
|
18
17
|
const states = props.State.value.split("-");
|
|
19
18
|
const commonProps = {
|
|
@@ -35,7 +34,7 @@ export const createSegmentedControlHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
35
34
|
const segmentedControlItemHandler = createSegmentedControlItemHandler(ctx);
|
|
36
35
|
|
|
37
36
|
return defineComponentHandler<SegmentedControlProperties>(
|
|
38
|
-
metadata.
|
|
37
|
+
metadata.componentSegmentedControl.key,
|
|
39
38
|
(node, traverse) => {
|
|
40
39
|
const segments = findAllInstances<SegmentedControlItemProperties>({
|
|
41
40
|
node,
|
|
@@ -7,7 +7,7 @@ import { createSeedReactElement } from "../../element-factories";
|
|
|
7
7
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
8
8
|
|
|
9
9
|
export const createSkeletonHandler = (ctx: ComponentHandlerDeps) =>
|
|
10
|
-
defineComponentHandler<SkeletonProperties>(metadata.
|
|
10
|
+
defineComponentHandler<SkeletonProperties>(metadata.componentSkeleton.key, (node) => {
|
|
11
11
|
const { componentProperties: props, layoutSizingHorizontal, layoutSizingVertical } = node;
|
|
12
12
|
|
|
13
13
|
const commonProps = {
|
|
@@ -14,15 +14,12 @@ import { findAllInstances } from "@/utils/figma-node";
|
|
|
14
14
|
import {
|
|
15
15
|
createFieldFooterHandler,
|
|
16
16
|
createFieldHeaderHandler,
|
|
17
|
-
FIELD_KEYS,
|
|
18
17
|
type FieldFooterProps,
|
|
19
18
|
type FieldHeaderProps,
|
|
20
19
|
} from "@/codegen/targets/react/component/handlers/field";
|
|
21
20
|
|
|
22
21
|
const { createLocalSnippetElement } = createLocalSnippetHelper("slider");
|
|
23
22
|
|
|
24
|
-
const SLIDER_TICK_KEY = "ace432ffb7a2af13bce549b19c932ac5f96a9a78";
|
|
25
|
-
|
|
26
23
|
function getSliderComment(props: { markers?: unknown; ticks?: unknown } & Record<string, unknown>) {
|
|
27
24
|
return [
|
|
28
25
|
"min, max, step 값을 적절히 조정해주세요.",
|
|
@@ -43,14 +40,17 @@ export const createSliderFieldHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
43
40
|
(node, traverse) => {
|
|
44
41
|
const props = node.componentProperties;
|
|
45
42
|
|
|
46
|
-
const [slider] = findAllInstances<SliderProperties>({
|
|
43
|
+
const [slider] = findAllInstances<SliderProperties>({
|
|
44
|
+
node,
|
|
45
|
+
key: metadata.componentSlider.key,
|
|
46
|
+
});
|
|
47
47
|
const [fieldHeader] = findAllInstances<FieldHeaderProperties>({
|
|
48
48
|
node,
|
|
49
|
-
key:
|
|
49
|
+
key: metadata.privateComponentFieldHeader.key,
|
|
50
50
|
});
|
|
51
51
|
const [fieldFooter] = findAllInstances<FieldFooterProperties>({
|
|
52
52
|
node,
|
|
53
|
-
key:
|
|
53
|
+
key: metadata.privateComponentFieldFooter.key,
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
const sliderProps = sliderHandler.transform(slider, traverse).props;
|
|
@@ -79,7 +79,7 @@ export const createSliderFieldHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
export const createSliderHandler = (_ctx: ComponentHandlerDeps) => {
|
|
82
|
-
return defineComponentHandler<SliderProperties>(metadata.
|
|
82
|
+
return defineComponentHandler<SliderProperties>(metadata.componentSlider.key, (node) => {
|
|
83
83
|
const { componentProperties: props } = node;
|
|
84
84
|
|
|
85
85
|
const { min, max, defaultValues } = match(props.Value.value)
|
|
@@ -87,7 +87,10 @@ export const createSliderHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
87
87
|
.with("Range", () => ({ min: 0, max: 100, defaultValues: [0, 50] }))
|
|
88
88
|
.exhaustive();
|
|
89
89
|
|
|
90
|
-
const [ticks] = findAllInstances<SliderTicksProperties>({
|
|
90
|
+
const [ticks] = findAllInstances<SliderTicksProperties>({
|
|
91
|
+
node,
|
|
92
|
+
key: metadata.privateComponentSliderItemTickMark.key,
|
|
93
|
+
});
|
|
91
94
|
|
|
92
95
|
const commonProps = {
|
|
93
96
|
min,
|
|
@@ -9,7 +9,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("snackbar");
|
|
|
9
9
|
|
|
10
10
|
export const createSnackbarHandler = (_ctx: ComponentHandlerDeps) =>
|
|
11
11
|
defineComponentHandler<SnackbarProperties>(
|
|
12
|
-
metadata.
|
|
12
|
+
metadata.componentSnackbar.key,
|
|
13
13
|
({ componentProperties: props }) => {
|
|
14
14
|
const commonProps = {
|
|
15
15
|
message: props["Message#1528:4"].value,
|
|
@@ -9,7 +9,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("switch");
|
|
|
9
9
|
|
|
10
10
|
export const createSwitchHandler = (_ctx: ComponentHandlerDeps) =>
|
|
11
11
|
defineComponentHandler<SwitchProperties>(
|
|
12
|
-
metadata.
|
|
12
|
+
metadata.componentSwitch.key,
|
|
13
13
|
({ componentProperties: props }) => {
|
|
14
14
|
const tone = match(props.Tone.value)
|
|
15
15
|
.with("Neutral", () => "neutral")
|
|
@@ -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", {
|
|
@@ -9,7 +9,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("switch");
|
|
|
9
9
|
|
|
10
10
|
export const createSwitchmarkHandler = (_ctx: ComponentHandlerDeps) =>
|
|
11
11
|
defineComponentHandler<SwitchmarkProperties>(
|
|
12
|
-
metadata.
|
|
12
|
+
metadata.componentSwitchmark.key,
|
|
13
13
|
({ componentProperties: props }) => {
|
|
14
14
|
const tone = match(props.Tone.value)
|
|
15
15
|
.with("Neutral", () => "neutral")
|
|
@@ -21,6 +21,6 @@ export const createSwitchmarkHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
21
21
|
size: props.Size.value,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
return createLocalSnippetElement("
|
|
24
|
+
return createLocalSnippetElement("Switchmark", commonProps);
|
|
25
25
|
},
|
|
26
26
|
);
|
|
@@ -22,21 +22,18 @@ const { createLocalSnippetElement: createTabsLocalSnippetElement } =
|
|
|
22
22
|
const { createLocalSnippetElement: createChipTabsLocalSnippetElement } =
|
|
23
23
|
createLocalSnippetHelper("chip-tabs");
|
|
24
24
|
|
|
25
|
-
const LINE_TABS_WRAPPER_KEY = "e114161387f800d3668d0585bed1d109e4edcbe4";
|
|
26
|
-
const CHIP_TABS_WRAPPER_KEY = "d7cf2983c79c8394aaab0185af83a9d1b9d10ece";
|
|
27
|
-
|
|
28
25
|
export const createTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
29
26
|
const lineHandler = createLineTabsHandler(_ctx);
|
|
30
27
|
const chipHandler = createChipTabsHandler(_ctx);
|
|
31
28
|
|
|
32
|
-
return defineComponentHandler<TabsProperties>(metadata.
|
|
29
|
+
return defineComponentHandler<TabsProperties>(metadata.componentTabs.key, (node, traverse) => {
|
|
33
30
|
const props = node.componentProperties;
|
|
34
31
|
|
|
35
32
|
const elementNode = match(props.Variant.value)
|
|
36
33
|
.with("Line", () => {
|
|
37
34
|
const [wrapper] = findAllInstances<TabsLineWrapperProperties>({
|
|
38
35
|
node,
|
|
39
|
-
key:
|
|
36
|
+
key: metadata.privateComponentTabsLine.key,
|
|
40
37
|
});
|
|
41
38
|
|
|
42
39
|
if (!wrapper) throw new Error("Line Tab wrapper not found");
|
|
@@ -46,7 +43,7 @@ export const createTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
46
43
|
.with("Chip", () => {
|
|
47
44
|
const [wrapper] = findAllInstances<TabsChipWrapperProperties>({
|
|
48
45
|
node,
|
|
49
|
-
key:
|
|
46
|
+
key: metadata.privateComponentTabsChip.key,
|
|
50
47
|
});
|
|
51
48
|
|
|
52
49
|
if (!wrapper) throw new Error("Chip Tab wrapper not found");
|
|
@@ -80,15 +77,12 @@ export const createTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
80
77
|
</TabsRoot>
|
|
81
78
|
*/
|
|
82
79
|
|
|
83
|
-
const LINE_TABS_HUG_ITEM_KEY = "946cc52671ac3f46e20a8ff12fcc1c7f618da675";
|
|
84
|
-
const LINE_TABS_FILL_ITEM_KEY = "78039b6b86852b685a6e93e9b6743b9e577cd7db";
|
|
85
|
-
|
|
86
80
|
const createLineTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
87
81
|
const hugHandler = createLineTriggerHugHandler(_ctx);
|
|
88
82
|
const fillHandler = createLineTriggerFillHandler(_ctx);
|
|
89
83
|
|
|
90
84
|
return defineComponentHandler<TabsLineWrapperProperties>(
|
|
91
|
-
|
|
85
|
+
metadata.privateComponentTabsLine.key,
|
|
92
86
|
(node, traverse) => {
|
|
93
87
|
const props = node.componentProperties;
|
|
94
88
|
|
|
@@ -96,7 +90,7 @@ const createLineTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
96
90
|
.with("Hug", () => {
|
|
97
91
|
const nodes = findAllInstances<TabsLineTriggerHugProperties>({
|
|
98
92
|
node,
|
|
99
|
-
key:
|
|
93
|
+
key: metadata.privateComponentTabItemLineHug.key,
|
|
100
94
|
});
|
|
101
95
|
|
|
102
96
|
return {
|
|
@@ -111,7 +105,7 @@ const createLineTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
111
105
|
.with("Fill", () => {
|
|
112
106
|
const nodes = findAllInstances<TabsLineTriggerFillProperties>({
|
|
113
107
|
node,
|
|
114
|
-
key:
|
|
108
|
+
key: metadata.privateComponentTabItemLineFill.key,
|
|
115
109
|
});
|
|
116
110
|
|
|
117
111
|
return {
|
|
@@ -148,11 +142,9 @@ const createLineTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
148
142
|
);
|
|
149
143
|
};
|
|
150
144
|
|
|
151
|
-
const LINE_TRIGGER_HUG_KEY = "946cc52671ac3f46e20a8ff12fcc1c7f618da675";
|
|
152
|
-
|
|
153
145
|
const createLineTriggerHugHandler = (_ctx: ComponentHandlerDeps) =>
|
|
154
146
|
defineComponentHandler<TabsLineTriggerHugProperties>(
|
|
155
|
-
|
|
147
|
+
metadata.privateComponentTabItemLineHug.key,
|
|
156
148
|
({ componentProperties: props }) => {
|
|
157
149
|
const commonProps = {
|
|
158
150
|
value: props["Label#4478:2"].value,
|
|
@@ -168,11 +160,9 @@ const createLineTriggerHugHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
168
160
|
},
|
|
169
161
|
);
|
|
170
162
|
|
|
171
|
-
const LINE_TRIGGER_FILL_KEY = "78039b6b86852b685a6e93e9b6743b9e577cd7db";
|
|
172
|
-
|
|
173
163
|
const createLineTriggerFillHandler = (_ctx: ComponentHandlerDeps) =>
|
|
174
164
|
defineComponentHandler<TabsLineTriggerFillProperties>(
|
|
175
|
-
|
|
165
|
+
metadata.privateComponentTabItemLineFill.key,
|
|
176
166
|
({ componentProperties: props }) => {
|
|
177
167
|
const commonProps = {
|
|
178
168
|
value: props["Label#4478:2"].value,
|
|
@@ -216,15 +206,18 @@ const createChipTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
216
206
|
const triggerHandler = createChipTabsTriggerHandler(_ctx);
|
|
217
207
|
|
|
218
208
|
return defineComponentHandler<TabsChipWrapperProperties>(
|
|
219
|
-
|
|
209
|
+
metadata.privateComponentTabsChip.key,
|
|
220
210
|
(node, traverse) => {
|
|
221
211
|
const props = node.componentProperties;
|
|
222
212
|
|
|
223
|
-
const nodes = findAllInstances<ChipTabsTriggerProperties>({
|
|
213
|
+
const nodes = findAllInstances<ChipTabsTriggerProperties>({
|
|
214
|
+
node,
|
|
215
|
+
key: metadata.privateComponentTabItemChip.key,
|
|
216
|
+
});
|
|
224
217
|
|
|
225
218
|
const triggers = nodes.map((node) => {
|
|
226
219
|
// this is redundant; can this be better?
|
|
227
|
-
const [chip] = findAllInstances<ChipProperties>({ node, key: metadata.
|
|
220
|
+
const [chip] = findAllInstances<ChipProperties>({ node, key: metadata.componentChip.key });
|
|
228
221
|
if (!chip) throw new Error("Chip not found in ChipTabsTrigger");
|
|
229
222
|
|
|
230
223
|
return {
|
|
@@ -237,7 +230,10 @@ const createChipTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
237
230
|
(node) => node.componentProperties.State.value === "Selected",
|
|
238
231
|
);
|
|
239
232
|
const [selectedChip] = selectedTrigger
|
|
240
|
-
? findAllInstances<ChipProperties>({
|
|
233
|
+
? findAllInstances<ChipProperties>({
|
|
234
|
+
node: selectedTrigger,
|
|
235
|
+
key: metadata.componentChip.key,
|
|
236
|
+
})
|
|
241
237
|
: [undefined];
|
|
242
238
|
if (!selectedChip) throw new Error("Chip not found in ChipTabsTrigger");
|
|
243
239
|
|
|
@@ -273,25 +269,26 @@ const createChipTabsHandler = (_ctx: ComponentHandlerDeps) => {
|
|
|
273
269
|
);
|
|
274
270
|
};
|
|
275
271
|
|
|
276
|
-
const CHIP_TRIGGER_KEY = "95bf31a329f9e8bba0d9aa2299d1552f1d388148";
|
|
277
|
-
|
|
278
272
|
const createChipTabsTriggerHandler = (_ctx: ComponentHandlerDeps) =>
|
|
279
|
-
defineComponentHandler<ChipTabsTriggerProperties>(
|
|
280
|
-
|
|
281
|
-
|
|
273
|
+
defineComponentHandler<ChipTabsTriggerProperties>(
|
|
274
|
+
metadata.privateComponentTabItemChip.key,
|
|
275
|
+
(node) => {
|
|
276
|
+
const [chip] = findAllInstances<ChipProperties>({ node, key: metadata.componentChip.key });
|
|
277
|
+
if (!chip) throw new Error("Chip not found in ChipTabsTrigger");
|
|
282
278
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
279
|
+
const props = node.componentProperties;
|
|
280
|
+
const chipProps = chip.componentProperties;
|
|
281
|
+
|
|
282
|
+
const commonProps = {
|
|
283
|
+
value: chipProps["Label#7185:0"].value,
|
|
284
|
+
...(chipProps.State.value === "Disabled" && {
|
|
285
|
+
disabled: true,
|
|
286
|
+
}),
|
|
287
|
+
...(props["Has Notification"].value === "True" && {
|
|
288
|
+
notification: true,
|
|
289
|
+
}),
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
return createChipTabsLocalSnippetElement("ChipTabsTrigger", commonProps);
|
|
293
|
+
},
|
|
294
|
+
);
|
|
@@ -1,65 +1,72 @@
|
|
|
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
|
|
|
13
|
-
return defineComponentHandler<TagGroupProperties>(
|
|
14
|
-
|
|
15
|
+
return defineComponentHandler<TagGroupProperties>(
|
|
16
|
+
metadata.componentTagGroup.key,
|
|
17
|
+
(node, traverse) => {
|
|
18
|
+
const itemNodes = findAllInstances<TagGroupItemProperties>({
|
|
19
|
+
node,
|
|
20
|
+
key: metadata.privateComponentItemTag.key,
|
|
21
|
+
});
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
const items = itemNodes.map((itemNode) =>
|
|
24
|
+
itemHandler.transform(itemNode, traverse),
|
|
25
|
+
) as (ElementNode & {
|
|
26
|
+
props: { size?: string; weight?: string; tone?: string };
|
|
27
|
+
})[];
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
if (items.length === 0) {
|
|
30
|
+
return createLocalSnippetElement("TagGroupRoot");
|
|
31
|
+
}
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
// if size/weight/tone are all the same among item[n].props, lift them up to TagGroupRoot
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const consistent = {
|
|
36
|
+
size: items.map((item) => item.props.size).every((size) => size === items[0].props.size),
|
|
37
|
+
weight: items
|
|
38
|
+
.map((item) => item.props.weight)
|
|
39
|
+
.every((weight) => weight === items[0].props.weight),
|
|
40
|
+
tone: items.map((item) => item.props.tone).every((tone) => tone === items[0].props.tone),
|
|
41
|
+
};
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
items.map((item) => ({
|
|
45
|
-
...item,
|
|
46
|
-
props: {
|
|
47
|
-
// remove lifted props
|
|
48
|
-
...item.props,
|
|
49
|
-
size: consistent.size ? undefined : item.props.size,
|
|
50
|
-
weight: consistent.weight ? undefined : item.props.weight,
|
|
51
|
-
tone: consistent.tone ? undefined : item.props.tone,
|
|
43
|
+
return createLocalSnippetElement(
|
|
44
|
+
"TagGroupRoot",
|
|
45
|
+
{
|
|
46
|
+
// lift up consistent props
|
|
47
|
+
...(consistent.size && { size: items[0].props.size }),
|
|
48
|
+
...(consistent.weight && { weight: items[0].props.weight }),
|
|
49
|
+
...(consistent.tone && { tone: items[0].props.tone }),
|
|
52
50
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
items.map((item) => ({
|
|
52
|
+
...item,
|
|
53
|
+
props: {
|
|
54
|
+
// remove lifted props
|
|
55
|
+
...item.props,
|
|
56
|
+
size: consistent.size ? undefined : item.props.size,
|
|
57
|
+
weight: consistent.weight ? undefined : item.props.weight,
|
|
58
|
+
tone: consistent.tone ? undefined : item.props.tone,
|
|
59
|
+
},
|
|
60
|
+
})),
|
|
61
|
+
{ comment: "`truncate` prop을 통해 한 줄로 표시되도록 할 수 있습니다." },
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
56
65
|
};
|
|
57
66
|
|
|
58
|
-
const TAG_GROUP_ITEM_KEY = "a7bbc318919053f96be00e509469f6294d6bb6bb";
|
|
59
|
-
|
|
60
67
|
export const createTagGroupItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
61
68
|
defineComponentHandler<TagGroupItemProperties>(
|
|
62
|
-
|
|
69
|
+
metadata.privateComponentItemTag.key,
|
|
63
70
|
({ componentProperties: props }) => {
|
|
64
71
|
const size = match(props.Size.value)
|
|
65
72
|
.with("t2(12pt)", () => "t2")
|
|
@@ -67,26 +74,17 @@ export const createTagGroupItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
67
74
|
.with("t4(14pt)", () => "t4")
|
|
68
75
|
.exhaustive();
|
|
69
76
|
|
|
70
|
-
|
|
77
|
+
return createLocalSnippetElement("TagGroupItem", {
|
|
71
78
|
size,
|
|
72
79
|
weight: camelCase(props["Weight"].value),
|
|
73
80
|
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);
|
|
81
|
+
label: props["Label#5409:0"].value,
|
|
82
|
+
...(props.Layout.value === "Icon First" && {
|
|
83
|
+
prefixIcon: ctx.iconHandler.transform(props["Prefix Icon#47948:0"]),
|
|
84
|
+
}),
|
|
85
|
+
...(props.Layout.value === "Icon Last" && {
|
|
86
|
+
suffixIcon: ctx.iconHandler.transform(props["Suffix Icon#47948:55"]),
|
|
87
|
+
}),
|
|
88
|
+
});
|
|
91
89
|
},
|
|
92
90
|
);
|
|
@@ -5,7 +5,6 @@ import type { ComponentHandlerDeps } from "../deps.interface";
|
|
|
5
5
|
import {
|
|
6
6
|
createFieldFooterHandler,
|
|
7
7
|
createFieldHeaderHandler,
|
|
8
|
-
FIELD_KEYS,
|
|
9
8
|
type FieldFooterProps,
|
|
10
9
|
type FieldHeaderProps,
|
|
11
10
|
} from "@/codegen/targets/react/component/handlers/field";
|
|
@@ -27,16 +26,6 @@ import type { NormalizedTextNode } from "@/normalizer";
|
|
|
27
26
|
|
|
28
27
|
const { createLocalSnippetElement } = createLocalSnippetHelper("text-field");
|
|
29
28
|
|
|
30
|
-
const TEXT_INPUT_OUTLINE_KEY = "22eebd645d310c086d9f5f69d8f179ff5c7cf7ca";
|
|
31
|
-
const TEXT_INPUT_OUTLINE_PREFIX_KEY = "1ab174dd51bc42a5efe530f52f1dd02255c50b18";
|
|
32
|
-
const TEXT_INPUT_OUTLINE_SUFFIX_KEY = "555fee288d9053760e301791665bbac31d19c43f";
|
|
33
|
-
|
|
34
|
-
const TEXT_INPUT_UNDERLINE_KEY = "16e9e343fc319190149369bd61076d6415e09a8a";
|
|
35
|
-
const TEXT_INPUT_UNDERLINE_PREFIX_KEY = "a7ceae43b6daf4490e8ab408d2c29fb63b2eb891";
|
|
36
|
-
const TEXT_INPUT_UNDERLINE_SUFFIX_KEY = "1b88368820be61f358e24a8aaa601e7f2a2ea101";
|
|
37
|
-
|
|
38
|
-
const TEXTAREA_KEY = "22bb206483f00cd635188eea6ae8a6aac058b5d5";
|
|
39
|
-
|
|
40
29
|
export const createTextInputFieldHandler = (ctx: ComponentHandlerDeps) => {
|
|
41
30
|
const fieldHeaderHandler = createFieldHeaderHandler(ctx);
|
|
42
31
|
const fieldFooterHandler = createFieldFooterHandler(ctx);
|
|
@@ -48,20 +37,20 @@ export const createTextInputFieldHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
48
37
|
|
|
49
38
|
const [textInputOutline] = findAllInstances<TextInputOutlineProperties>({
|
|
50
39
|
node,
|
|
51
|
-
key:
|
|
40
|
+
key: metadata.privateComponentTextInput.key,
|
|
52
41
|
});
|
|
53
42
|
const [textInputUnderline] = findAllInstances<TextInputUnderlineProperties>({
|
|
54
43
|
node,
|
|
55
|
-
key:
|
|
44
|
+
key: metadata.privateComponentUnderlineTextInput.key,
|
|
56
45
|
});
|
|
57
46
|
|
|
58
47
|
const [fieldHeader] = findAllInstances<FieldHeaderProperties>({
|
|
59
48
|
node,
|
|
60
|
-
key:
|
|
49
|
+
key: metadata.privateComponentFieldHeader.key,
|
|
61
50
|
});
|
|
62
51
|
const [fieldFooter] = findAllInstances<FieldFooterProperties>({
|
|
63
52
|
node,
|
|
64
|
-
key:
|
|
53
|
+
key: metadata.privateComponentFieldFooter.key,
|
|
65
54
|
});
|
|
66
55
|
|
|
67
56
|
const fieldProps = {
|
|
@@ -77,12 +66,12 @@ export const createTextInputFieldHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
77
66
|
if (textInputOutline) {
|
|
78
67
|
const [prefix] = findAllInstances<TextInputOutlinePrefixProperties>({
|
|
79
68
|
node: textInputOutline,
|
|
80
|
-
key:
|
|
69
|
+
key: metadata.privateComponentTextInputPrefix.key,
|
|
81
70
|
});
|
|
82
71
|
|
|
83
72
|
const [suffix] = findAllInstances<TextInputOutlineSuffixProperties>({
|
|
84
73
|
node: textInputOutline,
|
|
85
|
-
key:
|
|
74
|
+
key: metadata.privateComponentTextInputSuffix.key,
|
|
86
75
|
});
|
|
87
76
|
|
|
88
77
|
return {
|
|
@@ -120,12 +109,12 @@ export const createTextInputFieldHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
120
109
|
if (textInputUnderline) {
|
|
121
110
|
const [prefix] = findAllInstances<TextInputUnderlinePrefixProperties>({
|
|
122
111
|
node: textInputUnderline,
|
|
123
|
-
key:
|
|
112
|
+
key: metadata.privateComponentUnderlineTextInputPrefix.key,
|
|
124
113
|
});
|
|
125
114
|
|
|
126
115
|
const [suffix] = findAllInstances<TextInputUnderlineSuffixProperties>({
|
|
127
116
|
node: textInputUnderline,
|
|
128
|
-
key:
|
|
117
|
+
key: metadata.privateComponentUnderlineTextInputSuffix.key,
|
|
129
118
|
});
|
|
130
119
|
|
|
131
120
|
return {
|
|
@@ -204,15 +193,15 @@ export const createTextareaFieldHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
204
193
|
(node, traverse) => {
|
|
205
194
|
const [textarea] = findAllInstances<TextareaProperties>({
|
|
206
195
|
node,
|
|
207
|
-
key:
|
|
196
|
+
key: metadata.privateComponentTextarea.key,
|
|
208
197
|
});
|
|
209
198
|
const [fieldHeader] = findAllInstances<FieldHeaderProperties>({
|
|
210
199
|
node,
|
|
211
|
-
key:
|
|
200
|
+
key: metadata.privateComponentFieldHeader.key,
|
|
212
201
|
});
|
|
213
202
|
const [fieldFooter] = findAllInstances<FieldFooterProperties>({
|
|
214
203
|
node,
|
|
215
|
-
key:
|
|
204
|
+
key: metadata.privateComponentFieldFooter.key,
|
|
216
205
|
});
|
|
217
206
|
|
|
218
207
|
const fieldProps = {
|
|
@@ -10,7 +10,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("toggle-button");
|
|
|
10
10
|
|
|
11
11
|
export const createToggleButtonHandler = (ctx: ComponentHandlerDeps) =>
|
|
12
12
|
defineComponentHandler<ToggleButtonProperties>(
|
|
13
|
-
metadata.
|
|
13
|
+
metadata.componentToggleButton.key,
|
|
14
14
|
({ componentProperties: props }) => {
|
|
15
15
|
const commonProps = {
|
|
16
16
|
variant: camelCase(props.Variant.value),
|