@seed-design/figma 0.0.23 → 0.0.25
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 +32 -9
- package/lib/codegen/index.d.ts +19 -7
- package/lib/codegen/index.js +32 -9
- package/lib/codegen/targets/react/index.cjs +224 -116
- package/lib/codegen/targets/react/index.d.ts +9 -3
- package/lib/codegen/targets/react/index.js +224 -116
- package/package.json +3 -3
- package/src/codegen/core/codegen.ts +6 -3
- package/src/codegen/core/jsx.ts +38 -7
- package/src/codegen/targets/figma/shape.ts +3 -1
- package/src/codegen/targets/figma/text.ts +4 -7
- package/src/codegen/targets/react/component/handlers/action-button.ts +8 -5
- package/src/codegen/targets/react/component/handlers/action-chip.ts +9 -8
- package/src/codegen/targets/react/component/handlers/action-sheet.ts +17 -15
- package/src/codegen/targets/react/component/handlers/app-bar.ts +31 -24
- package/src/codegen/targets/react/component/handlers/avatar-stack.ts +6 -5
- package/src/codegen/targets/react/component/handlers/avatar.ts +12 -7
- package/src/codegen/targets/react/component/handlers/badge.ts +4 -3
- package/src/codegen/targets/react/component/handlers/callout.ts +9 -4
- package/src/codegen/targets/react/component/handlers/checkbox.ts +6 -3
- package/src/codegen/targets/react/component/handlers/chip-tabs.ts +8 -5
- package/src/codegen/targets/react/component/handlers/control-chip.ts +14 -8
- package/src/codegen/targets/react/component/handlers/error-state.ts +6 -3
- package/src/codegen/targets/react/component/handlers/extended-action-sheet.ts +22 -20
- package/src/codegen/targets/react/component/handlers/extended-fab.ts +5 -4
- package/src/codegen/targets/react/component/handlers/fab.ts +9 -5
- package/src/codegen/targets/react/component/handlers/help-bubble.ts +9 -5
- package/src/codegen/targets/react/component/handlers/identity-placeholder.ts +4 -4
- package/src/codegen/targets/react/component/handlers/inline-banner.ts +8 -3
- package/src/codegen/targets/react/component/handlers/manner-temp-badge.ts +6 -3
- package/src/codegen/targets/react/component/handlers/multiline-text-field.ts +7 -4
- package/src/codegen/targets/react/component/handlers/progress-circle.ts +6 -3
- package/src/codegen/targets/react/component/handlers/reaction-button.ts +7 -4
- package/src/codegen/targets/react/component/handlers/segmented-control.ts +15 -11
- package/src/codegen/targets/react/component/handlers/select-box.ts +17 -21
- package/src/codegen/targets/react/component/handlers/skeleton.ts +5 -4
- package/src/codegen/targets/react/component/handlers/snackbar.ts +6 -3
- package/src/codegen/targets/react/component/handlers/switch.ts +6 -3
- package/src/codegen/targets/react/component/handlers/tabs.ts +13 -10
- package/src/codegen/targets/react/component/handlers/text-button.ts +3 -2
- package/src/codegen/targets/react/component/handlers/text-field.ts +7 -4
- package/src/codegen/targets/react/component/handlers/toggle-button.ts +8 -5
- package/src/codegen/targets/react/element-factories.ts +59 -0
- package/src/codegen/targets/react/frame.ts +5 -9
- package/src/codegen/targets/react/icon.ts +7 -2
- package/src/codegen/targets/react/instance.ts +2 -2
- package/src/codegen/targets/react/shape.ts +11 -4
- package/src/codegen/targets/react/text.ts +6 -8
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ControlChipProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
4
|
import { match } from "ts-pattern";
|
|
5
|
+
import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
|
|
4
6
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
5
|
-
import type { ControlChipProperties } from "@/codegen/component-properties";
|
|
6
7
|
import { handleSizeProp } from "../size";
|
|
7
8
|
|
|
9
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("control-chip");
|
|
10
|
+
|
|
8
11
|
export const createControlChipHandler = (ctx: ComponentHandlerDeps) =>
|
|
9
12
|
defineComponentHandler<ControlChipProperties>(
|
|
10
13
|
metadata.controlChip.key,
|
|
11
14
|
({ componentProperties: props }) => {
|
|
12
15
|
const states = props.State.value.split("-");
|
|
13
16
|
|
|
17
|
+
const count = props["Show Count#7185:42"].value ? props["Count#7185:21"].value : undefined;
|
|
18
|
+
|
|
14
19
|
const { layout, children } = match(props.Layout.value)
|
|
15
20
|
.with("Icon Only", () => ({
|
|
16
21
|
layout: "iconOnly",
|
|
17
22
|
children: [
|
|
18
|
-
|
|
23
|
+
createSeedReactElement("Icon", {
|
|
19
24
|
svg: ctx.iconHandler.transform(props["Icon#8722:41"]),
|
|
20
25
|
}),
|
|
21
26
|
],
|
|
@@ -23,17 +28,18 @@ export const createControlChipHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
23
28
|
.with("Icon First", () => ({
|
|
24
29
|
layout: "withText",
|
|
25
30
|
children: [
|
|
26
|
-
|
|
31
|
+
createSeedReactElement("PrefixIcon", {
|
|
27
32
|
svg: ctx.iconHandler.transform(props["Prefix Icon#8722:0"]),
|
|
28
33
|
}),
|
|
29
34
|
props["Label#7185:0"].value,
|
|
35
|
+
count ? createSeedReactElement("Count", undefined, [count]) : undefined,
|
|
30
36
|
],
|
|
31
37
|
}))
|
|
32
38
|
.with("Icon Last", () => ({
|
|
33
39
|
layout: "withText",
|
|
34
40
|
children: [
|
|
35
41
|
props["Label#7185:0"].value,
|
|
36
|
-
|
|
42
|
+
createSeedReactElement("SuffixIcon", {
|
|
37
43
|
svg: ctx.iconHandler.transform(props["Suffix Icon#8722:82"]),
|
|
38
44
|
}),
|
|
39
45
|
],
|
|
@@ -41,11 +47,11 @@ export const createControlChipHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
41
47
|
.with("Icon Both", () => ({
|
|
42
48
|
layout: "withText",
|
|
43
49
|
children: [
|
|
44
|
-
|
|
50
|
+
createSeedReactElement("PrefixIcon", {
|
|
45
51
|
svg: ctx.iconHandler.transform(props["Prefix Icon#8722:0"]),
|
|
46
52
|
}),
|
|
47
53
|
props["Label#7185:0"].value,
|
|
48
|
-
|
|
54
|
+
createSeedReactElement("SuffixIcon", {
|
|
49
55
|
svg: ctx.iconHandler.transform(props["Suffix Icon#8722:82"]),
|
|
50
56
|
}),
|
|
51
57
|
],
|
|
@@ -70,6 +76,6 @@ export const createControlChipHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
70
76
|
}),
|
|
71
77
|
};
|
|
72
78
|
|
|
73
|
-
return
|
|
79
|
+
return createLocalSnippetElement("ControlChip.Toggle", commonProps, children);
|
|
74
80
|
},
|
|
75
81
|
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ActionButtonProperties, ErrorStateProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
4
|
import { findAllInstances } from "@/utils/figma-node";
|
|
4
5
|
import { camelCase } from "change-case";
|
|
6
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
5
7
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
|
-
import type { ActionButtonProperties, ErrorStateProperties } from "@/codegen/component-properties";
|
|
7
8
|
import { createActionButtonHandler } from "./action-button";
|
|
8
9
|
|
|
10
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("error-state");
|
|
11
|
+
|
|
9
12
|
export const createErrorStateHandler = (ctx: ComponentHandlerDeps) => {
|
|
10
13
|
const actionButtonHandler = createActionButtonHandler(ctx);
|
|
11
14
|
|
|
@@ -33,6 +36,6 @@ export const createErrorStateHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
33
36
|
}),
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
return
|
|
39
|
+
return createLocalSnippetElement("ErrorState", commonProps);
|
|
37
40
|
});
|
|
38
41
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
2
|
-
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
|
-
import { findAllInstances } from "@/utils/figma-node";
|
|
4
|
-
import { camelCase } from "change-case";
|
|
5
|
-
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
1
|
import type {
|
|
7
2
|
ExtendedActionSheetGroupProperties,
|
|
8
3
|
ExtendedActionSheetItemProperties,
|
|
9
4
|
ExtendedActionSheetProperties,
|
|
10
5
|
} from "@/codegen/component-properties";
|
|
6
|
+
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
7
|
+
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
8
|
+
import { findAllInstances } from "@/utils/figma-node";
|
|
9
|
+
import { camelCase } from "change-case";
|
|
10
|
+
import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
|
|
11
|
+
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
12
|
+
|
|
13
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("extended-action-sheet");
|
|
11
14
|
|
|
12
15
|
const EXTENDED_ACTION_SHEET_ITEM_KEY = "057083e95466da59051119eec0b41d4ad5a07f8f";
|
|
13
16
|
const createExtendedActionSheetItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
@@ -23,9 +26,9 @@ const createExtendedActionSheetItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
23
26
|
}),
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
return
|
|
29
|
+
return createLocalSnippetElement("ExtendedActionSheetItem", commonProps, [
|
|
27
30
|
props["Show Prefix Icon#17043:5"].value
|
|
28
|
-
?
|
|
31
|
+
? createSeedReactElement("PrefixIcon", {
|
|
29
32
|
svg: ctx.iconHandler.transform(props["Prefix Icon#55948:0"]),
|
|
30
33
|
})
|
|
31
34
|
: undefined,
|
|
@@ -48,7 +51,7 @@ const createExtendedActionSheetGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
48
51
|
|
|
49
52
|
const contentChildren = items.map(extendedActionSheetItemHandler.transform);
|
|
50
53
|
|
|
51
|
-
return
|
|
54
|
+
return createLocalSnippetElement("ExtendedActionSheetGroup", undefined, contentChildren);
|
|
52
55
|
},
|
|
53
56
|
);
|
|
54
57
|
};
|
|
@@ -70,27 +73,26 @@ export const createExtendedActionSheetHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
70
73
|
|
|
71
74
|
const title = props["Show Title#17043:12"].value ? props["Title#14599:0"].value : undefined;
|
|
72
75
|
|
|
73
|
-
const content =
|
|
76
|
+
const content = createLocalSnippetElement(
|
|
74
77
|
"ExtendedActionSheetContent",
|
|
75
78
|
{ title },
|
|
76
79
|
contentChildren,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
{
|
|
81
|
+
comment: title
|
|
82
|
+
? undefined
|
|
83
|
+
: "title을 제공하지 않는 경우 aria-label이나 aria-labelledby 중 하나를 제공해야 합니다.",
|
|
84
|
+
},
|
|
80
85
|
);
|
|
81
86
|
|
|
82
|
-
const trigger =
|
|
87
|
+
const trigger = createLocalSnippetElement(
|
|
83
88
|
"ExtendedActionSheetTrigger",
|
|
84
89
|
{ asChild: true },
|
|
85
|
-
createElement(
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
"열기",
|
|
89
|
-
"ExtendedActionSheet을 여는 요소를 제공해주세요.",
|
|
90
|
-
),
|
|
90
|
+
createElement("button", undefined, "열기", {
|
|
91
|
+
comment: "ExtendedActionSheet을 여는 요소를 제공해주세요.",
|
|
92
|
+
}),
|
|
91
93
|
);
|
|
92
94
|
|
|
93
|
-
return
|
|
95
|
+
return createLocalSnippetElement("ExtendedActionSheet", undefined, [trigger, content]);
|
|
94
96
|
},
|
|
95
97
|
);
|
|
96
98
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ExtendedFabProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
4
|
import { camelCase } from "change-case";
|
|
5
|
+
import { createSeedReactElement } from "../../element-factories";
|
|
4
6
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
5
|
-
import type { ExtendedFabProperties } from "@/codegen/component-properties";
|
|
6
7
|
import { handleSizeProp } from "../size";
|
|
7
8
|
|
|
8
9
|
export const createExtendedFabHandler = (ctx: ComponentHandlerDeps) =>
|
|
@@ -14,8 +15,8 @@ export const createExtendedFabHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
14
15
|
variant: camelCase(props.Variant.value),
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
return
|
|
18
|
-
|
|
18
|
+
return createSeedReactElement("ExtendedFab", commonProps, [
|
|
19
|
+
createSeedReactElement("PrefixIcon", {
|
|
19
20
|
svg: ctx.iconHandler.transform(props["Icon#28796:0"]),
|
|
20
21
|
}),
|
|
21
22
|
props["Label#28936:0"].value,
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
import type { FabProperties } from "@/codegen/component-properties";
|
|
1
2
|
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
|
-
import {
|
|
4
|
-
import type { FabProperties } from "@/codegen/component-properties";
|
|
4
|
+
import { createSeedReactElement } from "../../element-factories";
|
|
5
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
6
|
|
|
7
7
|
export const createFabHandler = (ctx: ComponentHandlerDeps) =>
|
|
8
8
|
defineComponentHandler<FabProperties>(
|
|
9
9
|
metadata.floatingActionButton.key,
|
|
10
10
|
({ componentProperties: props }) => {
|
|
11
|
-
return
|
|
11
|
+
return createSeedReactElement(
|
|
12
12
|
"Fab",
|
|
13
13
|
undefined,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
createSeedReactElement("Icon", {
|
|
15
|
+
svg: ctx.iconHandler.transform(props["Icon#28796:0"]),
|
|
16
|
+
}),
|
|
17
|
+
{
|
|
18
|
+
comment: "aria-label이나 aria-labelledby 중 하나를 제공해야 합니다.",
|
|
19
|
+
},
|
|
16
20
|
);
|
|
17
21
|
},
|
|
18
22
|
);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { defineComponentHandler } from "@/codegen/core";
|
|
2
|
-
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
|
-
import { createElement } from "@/codegen/core";
|
|
4
1
|
import type { HelpBubbleProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
3
|
+
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
5
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
6
|
|
|
7
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("help-bubble");
|
|
8
|
+
|
|
7
9
|
export const createHelpBubbleHandler = (_ctx: ComponentHandlerDeps) =>
|
|
8
10
|
defineComponentHandler<HelpBubbleProperties>(
|
|
9
11
|
metadata.helpBubble.key,
|
|
@@ -59,10 +61,12 @@ export const createHelpBubbleHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
59
61
|
placement,
|
|
60
62
|
};
|
|
61
63
|
|
|
62
|
-
return
|
|
64
|
+
return createLocalSnippetElement(
|
|
63
65
|
"HelpBubbleTrigger",
|
|
64
66
|
commonProps,
|
|
65
|
-
createElement("
|
|
67
|
+
createElement("button", undefined, "열기", {
|
|
68
|
+
comment: "HelpBubble을 여는 요소를 제공해주세요.",
|
|
69
|
+
}),
|
|
66
70
|
);
|
|
67
71
|
},
|
|
68
72
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { IdentityPlaceholderProperties } from "@/codegen/component-properties";
|
|
1
2
|
import { defineComponentHandler } from "@/codegen/core";
|
|
2
|
-
import { camelCase } from "change-case";
|
|
3
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { camelCase } from "change-case";
|
|
5
|
+
import { createSeedReactElement } from "../../element-factories";
|
|
6
6
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
7
7
|
|
|
8
8
|
export const createIdentityPlaceholderHandler = (_ctx: ComponentHandlerDeps) =>
|
|
@@ -13,6 +13,6 @@ export const createIdentityPlaceholderHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
13
13
|
identity: camelCase(props.Identity.value),
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
return
|
|
16
|
+
return createSeedReactElement("IdentityPlaceholder", commonProps);
|
|
17
17
|
},
|
|
18
18
|
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { InlineBannerProperties } from "@/codegen/component-properties";
|
|
2
|
-
import {
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
3
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
4
|
import type { NormalizedInstanceNode, NormalizedTextNode } from "@/normalizer";
|
|
5
5
|
import { findOne } from "@/utils/figma-node";
|
|
6
6
|
import { camelCase } from "change-case";
|
|
7
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
7
8
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
8
9
|
|
|
10
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("inline-banner");
|
|
11
|
+
|
|
9
12
|
export const createInlineBannerHandler = (ctx: ComponentHandlerDeps) =>
|
|
10
13
|
defineComponentHandler<InlineBannerProperties>(metadata.inlineBanner.key, (node) => {
|
|
11
14
|
const { componentProperties: props } = node;
|
|
@@ -31,7 +34,9 @@ export const createInlineBannerHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
31
34
|
) as NormalizedTextNode | null;
|
|
32
35
|
|
|
33
36
|
if (!textNode) {
|
|
34
|
-
return
|
|
37
|
+
return createLocalSnippetElement(tag, undefined, undefined, {
|
|
38
|
+
comment: "내용을 제공해주세요.",
|
|
39
|
+
});
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
const slices = textNode.segments;
|
|
@@ -73,5 +78,5 @@ export const createInlineBannerHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
73
78
|
prefixIcon,
|
|
74
79
|
};
|
|
75
80
|
|
|
76
|
-
return
|
|
81
|
+
return createLocalSnippetElement(tag, commonProps);
|
|
77
82
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { MannerTempBadgeProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
3
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("manner-temp-badge");
|
|
5
8
|
|
|
6
9
|
export const createMannerTempBadgeHandler = (_ctx: ComponentHandlerDeps) =>
|
|
7
10
|
defineComponentHandler<MannerTempBadgeProperties>(
|
|
@@ -13,6 +16,6 @@ export const createMannerTempBadgeHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
13
16
|
temperature: Number(textNode?.characters.replace(/[^\d.-]/g, "") ?? "-1"),
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
return
|
|
19
|
+
return createLocalSnippetElement("MannerTempBadge", commonProps);
|
|
17
20
|
},
|
|
18
21
|
);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { MultilineTextFieldProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
3
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
4
|
-
import type { MultilineTextFieldProperties } from "@/codegen/component-properties";
|
|
5
6
|
import { handleSizeProp } from "../size";
|
|
6
7
|
|
|
8
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("multiline-text-field");
|
|
9
|
+
|
|
7
10
|
export const createMultilineTextFieldHandler = (_ctx: ComponentHandlerDeps) =>
|
|
8
11
|
defineComponentHandler<MultilineTextFieldProperties>(
|
|
9
12
|
metadata.multilineTextField.key,
|
|
@@ -74,8 +77,8 @@ export const createMultilineTextFieldHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
74
77
|
placeholder,
|
|
75
78
|
};
|
|
76
79
|
|
|
77
|
-
const TextFieldChildren =
|
|
80
|
+
const TextFieldChildren = createLocalSnippetElement("TextFieldTextarea", inputProps);
|
|
78
81
|
|
|
79
|
-
return
|
|
82
|
+
return createLocalSnippetElement("TextField", commonProps, TextFieldChildren);
|
|
80
83
|
},
|
|
81
84
|
);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ProgressCircleProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
4
|
import { camelCase } from "change-case";
|
|
4
5
|
import { match } from "ts-pattern";
|
|
6
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
5
7
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
|
-
|
|
8
|
+
|
|
9
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("progress-circle");
|
|
7
10
|
|
|
8
11
|
export const createProgressCircleHandler = (_ctx: ComponentHandlerDeps) =>
|
|
9
12
|
defineComponentHandler<ProgressCircleProperties>(
|
|
@@ -45,6 +48,6 @@ export const createProgressCircleHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
45
48
|
tone: camelCase(props.Tone.value),
|
|
46
49
|
};
|
|
47
50
|
|
|
48
|
-
return
|
|
51
|
+
return createLocalSnippetElement("ProgressCircle", commonProps);
|
|
49
52
|
},
|
|
50
53
|
);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { ReactionButtonProperties } from "@/codegen/component-properties";
|
|
2
|
-
import {
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
3
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
|
|
4
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
5
6
|
import { handleSizeProp } from "../size";
|
|
6
7
|
|
|
8
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("reaction-button");
|
|
9
|
+
|
|
7
10
|
export const createReactionButtonHandler = (ctx: ComponentHandlerDeps) =>
|
|
8
11
|
defineComponentHandler<ReactionButtonProperties>(
|
|
9
12
|
metadata.reactionButton.key,
|
|
@@ -23,13 +26,13 @@ export const createReactionButtonHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
23
26
|
}),
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
return
|
|
27
|
-
|
|
29
|
+
return createLocalSnippetElement("ReactionButton", commonProps, [
|
|
30
|
+
createSeedReactElement("PrefixIcon", {
|
|
28
31
|
svg: ctx.iconHandler.transform(props["Icon#12379:0"]),
|
|
29
32
|
}),
|
|
30
33
|
props["Label#6397:0"].value,
|
|
31
34
|
props["Show Count#6397:33"].value
|
|
32
|
-
?
|
|
35
|
+
? createSeedReactElement("Count", {}, props["Count#15816:0"].value)
|
|
33
36
|
: undefined,
|
|
34
37
|
]);
|
|
35
38
|
},
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
2
|
-
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
|
-
import { findAllInstances } from "@/utils/figma-node";
|
|
4
|
-
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
5
1
|
import type {
|
|
6
2
|
SegmentedControlItemProperties,
|
|
7
3
|
SegmentedControlProperties,
|
|
8
4
|
} from "@/codegen/component-properties";
|
|
5
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
6
|
+
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
7
|
+
import { findAllInstances } from "@/utils/figma-node";
|
|
8
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
9
|
+
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
10
|
+
|
|
11
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("segmented-control");
|
|
9
12
|
|
|
10
13
|
const SEGMENTED_CONTROL_ITEM_KEY = "9a7ba0d4c041ddbce84ee48881788434fd6bccc8";
|
|
11
14
|
const createSegmentedControlItemHandler = (_ctx: ComponentHandlerDeps) =>
|
|
@@ -20,7 +23,11 @@ const createSegmentedControlItemHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
20
23
|
}),
|
|
21
24
|
};
|
|
22
25
|
|
|
23
|
-
return
|
|
26
|
+
return createLocalSnippetElement(
|
|
27
|
+
"SegmentedControlItem",
|
|
28
|
+
commonProps,
|
|
29
|
+
props["Label#11366:15"].value,
|
|
30
|
+
);
|
|
24
31
|
},
|
|
25
32
|
);
|
|
26
33
|
|
|
@@ -47,12 +54,9 @@ export const createSegmentedControlHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
47
54
|
}),
|
|
48
55
|
};
|
|
49
56
|
|
|
50
|
-
return
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
segmentedControlChildren,
|
|
54
|
-
"aria-label이나 aria-labelledby 중 하나를 제공해야 합니다.",
|
|
55
|
-
);
|
|
57
|
+
return createLocalSnippetElement("SegmentedControl", commonProps, segmentedControlChildren, {
|
|
58
|
+
comment: "aria-label이나 aria-labelledby 중 하나를 제공해야 합니다.",
|
|
59
|
+
});
|
|
56
60
|
},
|
|
57
61
|
);
|
|
58
62
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SelectBoxGroupProperties, SelectBoxProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
4
|
import { findAllInstances } from "@/utils/figma-node";
|
|
5
|
+
import { match } from "ts-pattern";
|
|
6
|
+
import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
|
|
4
7
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
5
|
-
|
|
8
|
+
|
|
9
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("select-box");
|
|
6
10
|
|
|
7
11
|
export const createSelectBoxHandler = (_ctx: ComponentHandlerDeps) =>
|
|
8
12
|
defineComponentHandler<SelectBoxProperties>(
|
|
9
13
|
metadata.selectBox.key,
|
|
10
14
|
({ componentProperties: props }) => {
|
|
11
|
-
const tag = (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
case "Radio":
|
|
16
|
-
return "RadioSelectBox";
|
|
17
|
-
}
|
|
18
|
-
})();
|
|
15
|
+
const tag = match(props.Control.value)
|
|
16
|
+
.with("Checkbox", () => "CheckSelectBox")
|
|
17
|
+
.with("Radio", () => "RadioSelectBox")
|
|
18
|
+
.exhaustive();
|
|
19
19
|
|
|
20
20
|
const states = props.State.value.split("-");
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ export const createSelectBoxHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
33
33
|
}),
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
return
|
|
36
|
+
return createLocalSnippetElement(tag, commonProps);
|
|
37
37
|
},
|
|
38
38
|
);
|
|
39
39
|
|
|
@@ -45,14 +45,10 @@ export const createSelectBoxGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
45
45
|
(node) => {
|
|
46
46
|
const props = node.componentProperties;
|
|
47
47
|
|
|
48
|
-
const tag = (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
case "Radio":
|
|
53
|
-
return "RadioSelectBoxGroup";
|
|
54
|
-
}
|
|
55
|
-
})();
|
|
48
|
+
const tag = match(props.Control.value)
|
|
49
|
+
.with("Checkbox", () => "CheckSelectBoxGroup")
|
|
50
|
+
.with("Radio", () => "RadioSelectBoxGroup")
|
|
51
|
+
.exhaustive();
|
|
56
52
|
|
|
57
53
|
const selectBoxes = findAllInstances<SelectBoxProperties>({
|
|
58
54
|
node,
|
|
@@ -63,7 +59,7 @@ export const createSelectBoxGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
63
59
|
selectBox.componentProperties.State.value.split("-").includes("Selected"),
|
|
64
60
|
);
|
|
65
61
|
|
|
66
|
-
const stack =
|
|
62
|
+
const stack = createSeedReactElement(
|
|
67
63
|
"Stack",
|
|
68
64
|
{ gap: "spacingY.componentDefault" },
|
|
69
65
|
selectBoxes.map(selectBoxHandler.transform),
|
|
@@ -75,7 +71,7 @@ export const createSelectBoxGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
75
71
|
}),
|
|
76
72
|
};
|
|
77
73
|
|
|
78
|
-
return
|
|
74
|
+
return createLocalSnippetElement(tag, commonProps, stack);
|
|
79
75
|
},
|
|
80
76
|
);
|
|
81
77
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SkeletonProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
4
|
import { camelCase } from "change-case";
|
|
4
|
-
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
5
|
-
import type { SkeletonProperties } from "@/codegen/component-properties";
|
|
6
5
|
import { match } from "ts-pattern";
|
|
6
|
+
import { createSeedReactElement } from "../../element-factories";
|
|
7
|
+
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
7
8
|
|
|
8
9
|
export const createSkeletonHandler = (ctx: ComponentHandlerDeps) =>
|
|
9
10
|
defineComponentHandler<SkeletonProperties>(metadata.skeleton.key, (node) => {
|
|
@@ -21,5 +22,5 @@ export const createSkeletonHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
21
22
|
.otherwise(() => "full"),
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
return
|
|
25
|
+
return createSeedReactElement("Skeleton", commonProps);
|
|
25
26
|
});
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SnackbarProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
3
4
|
import { camelCase } from "change-case";
|
|
5
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
4
6
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
5
|
-
|
|
7
|
+
|
|
8
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("snackbar");
|
|
6
9
|
|
|
7
10
|
export const createSnackbarHandler = (_ctx: ComponentHandlerDeps) =>
|
|
8
11
|
defineComponentHandler<SnackbarProperties>(
|
|
@@ -17,6 +20,6 @@ export const createSnackbarHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
// TODO: adapter.create({ render })
|
|
20
|
-
return
|
|
23
|
+
return createLocalSnippetElement("Snackbar", commonProps);
|
|
21
24
|
},
|
|
22
25
|
);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SwitchProperties } from "@/codegen/component-properties";
|
|
2
|
+
import { defineComponentHandler } from "@/codegen/core";
|
|
2
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
3
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
4
|
-
import type { SwitchProperties } from "@/codegen/component-properties";
|
|
5
6
|
import { handleSizeProp } from "../size";
|
|
6
7
|
|
|
8
|
+
const { createLocalSnippetElement } = createLocalSnippetHelper("switch");
|
|
9
|
+
|
|
7
10
|
export const createSwitchHandler = (_ctx: ComponentHandlerDeps) =>
|
|
8
11
|
defineComponentHandler<SwitchProperties>(
|
|
9
12
|
metadata.switch.key,
|
|
@@ -25,6 +28,6 @@ export const createSwitchHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
25
28
|
}),
|
|
26
29
|
};
|
|
27
30
|
|
|
28
|
-
return
|
|
31
|
+
return createLocalSnippetElement("Switch", commonProps);
|
|
29
32
|
},
|
|
30
33
|
);
|