@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
|
@@ -11,20 +11,17 @@ import { findAllInstances } from "@/utils/figma-node";
|
|
|
11
11
|
|
|
12
12
|
const { createLocalSnippetElement } = createLocalSnippetHelper("floating-action-button");
|
|
13
13
|
|
|
14
|
-
const BUTTON_TYPE_KEY = "8cecc85275115d653579d4c3156567ebf19f7b27";
|
|
15
|
-
const MENU_TYPE_KEY = "400124347392c15473f9cd2d8a6aedb64f3baf36";
|
|
16
|
-
|
|
17
14
|
export const createFloatingActionButtonHandler = (ctx: ComponentHandlerDeps) =>
|
|
18
15
|
defineComponentHandler<FloatingActionButtonProperties>(
|
|
19
|
-
metadata.
|
|
16
|
+
metadata.componentFloatingActionButton.key,
|
|
20
17
|
(node) => {
|
|
21
18
|
const [button] = findAllInstances<FloatingActionButtonButtonItemProperties>({
|
|
22
19
|
node,
|
|
23
|
-
key:
|
|
20
|
+
key: metadata.privateComponentItemButtonType.key,
|
|
24
21
|
});
|
|
25
22
|
const [menu] = findAllInstances<FloatingActionButtonMenuItemProperties>({
|
|
26
23
|
node,
|
|
27
|
-
key:
|
|
24
|
+
key: metadata.privateComponentItemMenuType.key,
|
|
28
25
|
});
|
|
29
26
|
|
|
30
27
|
const commonProps = (() => {
|
|
@@ -10,7 +10,7 @@ const { createLocalSnippetElement: createLocalSnippetElementTrigger } =
|
|
|
10
10
|
|
|
11
11
|
export const createHelpBubbleHandler = (_ctx: ComponentHandlerDeps) =>
|
|
12
12
|
defineComponentHandler<HelpBubbleProperties>(
|
|
13
|
-
metadata.
|
|
13
|
+
metadata.componentHelpBubble.key,
|
|
14
14
|
({ componentProperties: props }) => {
|
|
15
15
|
const placement:
|
|
16
16
|
| "top"
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { defineComponentHandler } from "@/codegen/core";
|
|
1
|
+
import { defineComponentHandler, type InferComponentDefinition } from "@/codegen/core";
|
|
3
2
|
import { camelCase } from "change-case";
|
|
4
3
|
import { createLocalSnippetHelper } from "../../element-factories";
|
|
5
4
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
5
|
|
|
6
|
+
// hardcoded since this lives in a different figma file
|
|
7
7
|
const IDENTITY_PLACEHOLDER_KEY = "b3563b6f16ba4cfe4240c9b33eef7edad4c304eb";
|
|
8
8
|
|
|
9
|
+
export type IdentityPlaceholderProperties = InferComponentDefinition<{
|
|
10
|
+
Identity: {
|
|
11
|
+
type: "VARIANT";
|
|
12
|
+
defaultValue: "Person";
|
|
13
|
+
variantOptions: ["Person", "Business"];
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
|
|
9
17
|
const { createLocalSnippetElement } = createLocalSnippetHelper("identity-placeholder");
|
|
10
18
|
|
|
11
19
|
export const createIdentityPlaceholderHandler = (_ctx: ComponentHandlerDeps) =>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export * from "./action-button";
|
|
2
|
+
export * from "./alert-dialog";
|
|
3
|
+
export * from "./app-bar";
|
|
4
|
+
export * from "./avatar";
|
|
5
|
+
export * from "./avatar-stack";
|
|
6
|
+
export * from "./badge";
|
|
7
|
+
export * from "./bottom-sheet";
|
|
8
|
+
export * from "./callout";
|
|
9
|
+
export * from "./checkbox";
|
|
10
|
+
export * from "./checkmark";
|
|
11
|
+
export * from "./chip";
|
|
12
|
+
export * from "./contextual-floating-button";
|
|
13
|
+
export * from "./divider";
|
|
14
|
+
export * from "./field";
|
|
15
|
+
export * from "./field-button";
|
|
16
|
+
export * from "./floating-action-button";
|
|
17
|
+
export * from "./help-bubble";
|
|
18
|
+
export * from "./identity-placeholder";
|
|
19
|
+
export * from "./legacy-select-box";
|
|
20
|
+
export * from "./legacy-text-field";
|
|
21
|
+
export * from "./list-header";
|
|
22
|
+
export * from "./list-item";
|
|
23
|
+
export * from "./manner-temp";
|
|
24
|
+
export * from "./manner-temp-badge";
|
|
25
|
+
export * from "./menu-sheet";
|
|
26
|
+
export * from "./page-banner";
|
|
27
|
+
export * from "./progress-circle";
|
|
28
|
+
export * from "./radio-group";
|
|
29
|
+
export * from "./radiomark";
|
|
30
|
+
export * from "./reaction-button";
|
|
31
|
+
export * from "./result-section";
|
|
32
|
+
export * from "./segmented-control";
|
|
33
|
+
export * from "./skeleton";
|
|
34
|
+
export * from "./slider";
|
|
35
|
+
export * from "./snackbar";
|
|
36
|
+
export * from "./switch";
|
|
37
|
+
export * from "./switchmark";
|
|
38
|
+
export * from "./tabs";
|
|
39
|
+
export * from "./tag-group";
|
|
40
|
+
export * from "./text-field";
|
|
41
|
+
export * from "./toggle-button";
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
LegacySelectBoxProperties,
|
|
4
4
|
} from "@/codegen/component-properties";
|
|
5
5
|
import { defineComponentHandler } from "@/codegen/core";
|
|
6
|
+
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
6
7
|
import { findAllInstances } from "@/utils/figma-node";
|
|
7
8
|
import { match } from "ts-pattern";
|
|
8
9
|
import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
|
|
@@ -10,12 +11,9 @@ import type { ComponentHandlerDeps } from "../deps.interface";
|
|
|
10
11
|
|
|
11
12
|
const { createLocalSnippetElement } = createLocalSnippetHelper("select-box");
|
|
12
13
|
|
|
13
|
-
const LEGACY_SELECT_BOX_KEY = "38722ffeb4c966256a709155e8ddac50c93d7c60";
|
|
14
|
-
const LEGACY_SELECT_BOX_GROUP_KEY = "a3d58bb8540600878742cdcf2608a4b3851667ec";
|
|
15
|
-
|
|
16
14
|
export const createLegacySelectBoxHandler = (_ctx: ComponentHandlerDeps) =>
|
|
17
15
|
defineComponentHandler<LegacySelectBoxProperties>(
|
|
18
|
-
|
|
16
|
+
metadata.componentDeprecatedSelectBox.key,
|
|
19
17
|
({ componentProperties: props }) => {
|
|
20
18
|
const tag = match(props.Control.value)
|
|
21
19
|
.with("Checkbox", () => "CheckSelectBox")
|
|
@@ -47,7 +45,7 @@ export const createLegacySelectBoxGroupHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
47
45
|
const selectBoxHandler = createLegacySelectBoxHandler(ctx);
|
|
48
46
|
|
|
49
47
|
return defineComponentHandler<LegacySelectBoxGroupProperties>(
|
|
50
|
-
|
|
48
|
+
metadata.componentDeprecatedSelectBoxGroup.key,
|
|
51
49
|
(node, traverse) => {
|
|
52
50
|
const props = node.componentProperties;
|
|
53
51
|
|
|
@@ -3,18 +3,16 @@ import type {
|
|
|
3
3
|
LegacyTextFieldProperties,
|
|
4
4
|
} from "@/codegen/component-properties";
|
|
5
5
|
import { defineComponentHandler } from "@/codegen/core";
|
|
6
|
+
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
6
7
|
import { createLocalSnippetHelper } from "../../element-factories";
|
|
7
8
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
8
9
|
import { handleSizeProp } from "../size";
|
|
9
10
|
|
|
10
11
|
const { createLocalSnippetElement } = createLocalSnippetHelper("text-field");
|
|
11
12
|
|
|
12
|
-
const LEGACY_TEXT_FIELD_KEY = "c49873c37a639f0dffdea4efd0eb43760d66c141";
|
|
13
|
-
const LEGACY_MULTILINE_TEXT_FIELD_KEY = "88b2399c930c85f9ce2972163a078bc684b84bbe";
|
|
14
|
-
|
|
15
13
|
export const createLegacyTextFieldHandler = (ctx: ComponentHandlerDeps) =>
|
|
16
14
|
defineComponentHandler<LegacyTextFieldProperties>(
|
|
17
|
-
|
|
15
|
+
metadata.componentDeprecatedTextField.key,
|
|
18
16
|
({ componentProperties: props }) => {
|
|
19
17
|
const {
|
|
20
18
|
Size: { value: size },
|
|
@@ -120,7 +118,7 @@ export const createLegacyTextFieldHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
120
118
|
|
|
121
119
|
export const createLegacyMultilineTextFieldHandler = (_ctx: ComponentHandlerDeps) =>
|
|
122
120
|
defineComponentHandler<LegacyMultilineTextFieldProperties>(
|
|
123
|
-
|
|
121
|
+
metadata.componentDeprecatedMultilineTextField.key,
|
|
124
122
|
({ componentProperties: props }) => {
|
|
125
123
|
const {
|
|
126
124
|
Size: { value: size },
|
|
@@ -9,7 +9,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("list-header");
|
|
|
9
9
|
|
|
10
10
|
export const createListHeaderHandler = (_ctx: ComponentHandlerDeps) =>
|
|
11
11
|
defineComponentHandler<ListHeaderProperties>(
|
|
12
|
-
metadata.
|
|
12
|
+
metadata.componentListHeader.key,
|
|
13
13
|
({ componentProperties: props }) => {
|
|
14
14
|
const commonProps = {
|
|
15
15
|
variant: camelCase(props["Variant"].value),
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
} from "@/codegen/component-properties";
|
|
6
6
|
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
7
7
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
8
|
+
import * as components from "@/entities/data/__generated__/components";
|
|
8
9
|
import type { NormalizedTextNode } from "@/normalizer";
|
|
9
10
|
import { findAllInstances, findOne } from "@/utils/figma-node";
|
|
10
11
|
import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
|
|
@@ -14,28 +15,28 @@ import { match } from "ts-pattern";
|
|
|
14
15
|
const { createLocalSnippetElement } = createLocalSnippetHelper("list");
|
|
15
16
|
|
|
16
17
|
const PREFIX_KEYS = {
|
|
17
|
-
checkmark: "
|
|
18
|
-
|
|
19
|
-
icon:
|
|
20
|
-
avatar: "
|
|
21
|
-
image: "
|
|
22
|
-
custom: "
|
|
23
|
-
}
|
|
18
|
+
checkmark: "563275de82ea1282cece0c35c0cd8d1625bc3a9d",
|
|
19
|
+
radiomark: "51f7c0917ebc559d81e63d0639cb632a792f40de",
|
|
20
|
+
icon: components.componentListItemPrefixIcon.key,
|
|
21
|
+
avatar: "27e33754113178be97e07195528c4ea020b3d3b7",
|
|
22
|
+
image: "d06216ff143a960844799c0b8f9212628f78c69d",
|
|
23
|
+
custom: "b8059f5e0f85e0745fc61ff70f04571177c2cdfc",
|
|
24
|
+
};
|
|
24
25
|
|
|
25
26
|
const SUFFIX_KEYS = {
|
|
26
|
-
checkmark: "
|
|
27
|
-
|
|
28
|
-
chevron:
|
|
29
|
-
switch: "
|
|
30
|
-
custom: "
|
|
31
|
-
icon:
|
|
32
|
-
chevronWithText:
|
|
33
|
-
iconButton:
|
|
34
|
-
actionButton:
|
|
35
|
-
}
|
|
27
|
+
checkmark: "385ba8d607029e15e0d38ab415f783016488b185",
|
|
28
|
+
radiomark: "09871d64c5c30407da586fb34425c2e83e147c81",
|
|
29
|
+
chevron: components.componentListItemSuffixChevron.key,
|
|
30
|
+
switch: "0c26bd64e117e168b06eea69be903e4be762a728",
|
|
31
|
+
custom: "26b86c9f8965d38aa5a1181a5cdc89fa487988d1",
|
|
32
|
+
icon: components.componentListItemSuffixIcon.key,
|
|
33
|
+
chevronWithText: components.componentListItemSuffixChevronWithText.key,
|
|
34
|
+
iconButton: metadata.componentListItemSuffixIconButton.key,
|
|
35
|
+
actionButton: metadata.componentListItemSuffixActionButton.key,
|
|
36
|
+
};
|
|
36
37
|
|
|
37
38
|
export const createListItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
38
|
-
defineComponentHandler<ListItemProperties>(metadata.
|
|
39
|
+
defineComponentHandler<ListItemProperties>(metadata.componentListItem.key, (node, traverse) => {
|
|
39
40
|
const { componentProperties: props } = node;
|
|
40
41
|
|
|
41
42
|
const { alignItems, title } = match(props.Variants.value)
|
|
@@ -102,7 +103,7 @@ export const createListItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
102
103
|
const disabled = props.State.value === "Disabled";
|
|
103
104
|
|
|
104
105
|
const tag = (() => {
|
|
105
|
-
if (suffix?.tag === "
|
|
106
|
+
if (suffix?.tag === "Switchmark") {
|
|
106
107
|
return "ListSwitchItem";
|
|
107
108
|
}
|
|
108
109
|
|
|
@@ -110,11 +111,11 @@ export const createListItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
110
111
|
return "ListCheckItem";
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
if (prefix?.tag === "
|
|
114
|
+
if (prefix?.tag === "Radiomark" || suffix?.tag === "Radiomark") {
|
|
114
115
|
return "ListRadioItem";
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
// checkmark/
|
|
118
|
+
// checkmark/radiomark 없는데 disabled인 경우 Button으로 추측
|
|
118
119
|
if (disabled) {
|
|
119
120
|
return "ListButtonItem";
|
|
120
121
|
}
|
|
@@ -8,7 +8,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("manner-temp-badg
|
|
|
8
8
|
|
|
9
9
|
export const createMannerTempBadgeHandler = (_ctx: ComponentHandlerDeps) =>
|
|
10
10
|
defineComponentHandler<MannerTempBadgeProperties>(
|
|
11
|
-
metadata.
|
|
11
|
+
metadata.componentMannerTempBadge.key,
|
|
12
12
|
({ children }) => {
|
|
13
13
|
const textNode = children.find((child) => child.type === "TEXT");
|
|
14
14
|
|
|
@@ -7,7 +7,7 @@ import type { ComponentHandlerDeps } from "../deps.interface";
|
|
|
7
7
|
const { createLocalSnippetElement } = createLocalSnippetHelper("manner-temp");
|
|
8
8
|
|
|
9
9
|
export const createMannerTempHandler = (_ctx: ComponentHandlerDeps) =>
|
|
10
|
-
defineComponentHandler<MannerTempProperties>(metadata.
|
|
10
|
+
defineComponentHandler<MannerTempProperties>(metadata.componentMannerTemp.key, ({ children }) => {
|
|
11
11
|
const textNode = children.find((child) => child.type === "TEXT");
|
|
12
12
|
|
|
13
13
|
const commonProps = {
|
|
@@ -7,7 +7,7 @@ import { defineComponentHandler } from "@/codegen/core";
|
|
|
7
7
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
8
8
|
import { findAllInstances } from "@/utils/figma-node";
|
|
9
9
|
import { camelCase } from "change-case";
|
|
10
|
-
import { createLocalSnippetHelper
|
|
10
|
+
import { createLocalSnippetHelper } from "../../element-factories";
|
|
11
11
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
12
12
|
import { match } from "ts-pattern";
|
|
13
13
|
|
|
@@ -15,10 +15,9 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("menu-sheet");
|
|
|
15
15
|
const { createLocalSnippetElement: createLocalSnippetElementTrigger } =
|
|
16
16
|
createLocalSnippetHelper("action-button");
|
|
17
17
|
|
|
18
|
-
const MENU_SHEET_ITEM_KEY = "057083e95466da59051119eec0b41d4ad5a07f8f";
|
|
19
18
|
const createMenuSheetItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
20
19
|
defineComponentHandler<MenuSheetItemProperties>(
|
|
21
|
-
|
|
20
|
+
metadata.privateComponentMenuSheetMenuItem.key,
|
|
22
21
|
({ componentProperties: props }) => {
|
|
23
22
|
const states = props.State.value.split("-");
|
|
24
23
|
|
|
@@ -27,25 +26,24 @@ const createMenuSheetItemHandler = (ctx: ComponentHandlerDeps) =>
|
|
|
27
26
|
...(states.includes("Disabled") && {
|
|
28
27
|
disabled: true,
|
|
29
28
|
}),
|
|
29
|
+
...(props["Show Prefix Icon#17043:5"].value && {
|
|
30
|
+
prefixIcon: ctx.iconHandler.transform(props["Prefix Icon#55948:0"]),
|
|
31
|
+
}),
|
|
32
|
+
label: props["Label#55905:8"].value,
|
|
33
|
+
...(props["Show Item Description#51411:19"].value && {
|
|
34
|
+
description: props["Sub Text#51411:0"].value,
|
|
35
|
+
}),
|
|
30
36
|
};
|
|
31
37
|
|
|
32
|
-
return createLocalSnippetElement("MenuSheetItem", commonProps
|
|
33
|
-
props["Show Prefix Icon#17043:5"].value
|
|
34
|
-
? createSeedReactElement("PrefixIcon", {
|
|
35
|
-
svg: ctx.iconHandler.transform(props["Prefix Icon#55948:0"]),
|
|
36
|
-
})
|
|
37
|
-
: undefined,
|
|
38
|
-
props["Label#55905:8"].value,
|
|
39
|
-
]);
|
|
38
|
+
return createLocalSnippetElement("MenuSheetItem", commonProps);
|
|
40
39
|
},
|
|
41
40
|
);
|
|
42
41
|
|
|
43
|
-
const MENU_SHEET_GROUP_KEY = "2a504a1c6b7810d5e652862dcba2cb7048f9eb16";
|
|
44
42
|
const createMenuSheetGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
45
43
|
const menuSheetItemHandler = createMenuSheetItemHandler(ctx);
|
|
46
44
|
|
|
47
45
|
return defineComponentHandler<MenuSheetGroupProperties>(
|
|
48
|
-
|
|
46
|
+
metadata.privateComponentMenuSheetMenuGroup.key,
|
|
49
47
|
(node, traverse) => {
|
|
50
48
|
const items = findAllInstances<MenuSheetItemProperties>({
|
|
51
49
|
node,
|
|
@@ -62,45 +60,52 @@ const createMenuSheetGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
62
60
|
export const createMenuSheetHandler = (ctx: ComponentHandlerDeps) => {
|
|
63
61
|
const menuSheetGroupHandler = createMenuSheetGroupHandler(ctx);
|
|
64
62
|
|
|
65
|
-
return defineComponentHandler<MenuSheetProperties>(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
63
|
+
return defineComponentHandler<MenuSheetProperties>(
|
|
64
|
+
metadata.componentMenuSheet.key,
|
|
65
|
+
(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) =>
|
|
74
|
+
menuSheetGroupHandler.transform(group, traverse),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const title = props["Show Header#17043:12"].value
|
|
78
|
+
? props["Title Text#14599:0"].value
|
|
79
|
+
: undefined;
|
|
80
|
+
|
|
81
|
+
const description =
|
|
82
|
+
props["Show Header#17043:12"].value && props["Show Header Description#32984:0"].value
|
|
83
|
+
? props["Description Text#21827:0"].value
|
|
84
|
+
: undefined;
|
|
85
|
+
|
|
86
|
+
const { labelAlign } = match(props.Layout.value)
|
|
87
|
+
.with("Text with Icon", () => ({ labelAlign: "left" }))
|
|
88
|
+
.with("Text Only", () => ({ labelAlign: "center" }))
|
|
89
|
+
.exhaustive();
|
|
90
|
+
|
|
91
|
+
const content = createLocalSnippetElement(
|
|
92
|
+
"MenuSheetContent",
|
|
93
|
+
{ title, description, labelAlign },
|
|
94
|
+
contentChildren,
|
|
95
|
+
{
|
|
96
|
+
comment: title
|
|
97
|
+
? undefined
|
|
98
|
+
: "title을 제공하지 않는 경우 aria-label이나 aria-labelledby 중 하나를 제공해야 합니다.",
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const trigger = createLocalSnippetElement(
|
|
103
|
+
"MenuSheetTrigger",
|
|
104
|
+
{ asChild: true },
|
|
105
|
+
createLocalSnippetElementTrigger("ActionButton", {}, "MenuSheet 열기"),
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return createLocalSnippetElement("MenuSheet", undefined, [trigger, content]);
|
|
109
|
+
},
|
|
110
|
+
);
|
|
106
111
|
};
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
} from "@/codegen/component-properties";
|
|
5
5
|
import { createElement, defineComponentHandler } from "@/codegen/core";
|
|
6
6
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
7
|
+
import * as components from "@/entities/data/__generated__/components";
|
|
7
8
|
import type { NormalizedInstanceNode, NormalizedTextNode } from "@/normalizer";
|
|
8
9
|
import { findAllInstances, findOne } from "@/utils/figma-node";
|
|
9
10
|
import { camelCase } from "change-case";
|
|
@@ -13,89 +14,93 @@ import { match } from "ts-pattern";
|
|
|
13
14
|
|
|
14
15
|
const { createLocalSnippetElement } = createLocalSnippetHelper("page-banner");
|
|
15
16
|
|
|
16
|
-
const SUFFIX_BUTTON_KEY = "7dce4e1242761ccd8e5da42278fc2d870918039c";
|
|
17
|
-
|
|
18
17
|
const createPageBannerButtonHandler = (_ctx: ComponentHandlerDeps) =>
|
|
19
|
-
defineComponentHandler<PageBannerButtonProperties>(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
defineComponentHandler<PageBannerButtonProperties>(
|
|
19
|
+
components.componentPageBannerSuffixAction.key,
|
|
20
|
+
(node) => {
|
|
21
|
+
return createElement(
|
|
22
|
+
"PageBannerButton",
|
|
23
|
+
undefined,
|
|
24
|
+
node.componentProperties["Label#39890:0"].value,
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
);
|
|
26
28
|
|
|
27
29
|
export const createPageBannerHandler = (ctx: ComponentHandlerDeps) => {
|
|
28
30
|
const buttonHandler = createPageBannerButtonHandler(ctx);
|
|
29
31
|
|
|
30
|
-
return defineComponentHandler<PageBannerProperties>(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
return defineComponentHandler<PageBannerProperties>(
|
|
33
|
+
metadata.componentPageBanner.key,
|
|
34
|
+
(node, traverse) => {
|
|
35
|
+
const { componentProperties: props } = node;
|
|
36
|
+
|
|
37
|
+
const { tag, suffix } = match(props.Interaction.value)
|
|
38
|
+
.with("Actionable", () => ({ tag: "ActionablePageBanner", suffix: undefined }))
|
|
39
|
+
.with("Dismissible", () => ({ tag: "DismissiblePageBanner", suffix: undefined }))
|
|
40
|
+
.with("Display", () => ({ tag: "PageBanner", suffix: undefined }))
|
|
41
|
+
.with("Display (With Action)", () => {
|
|
42
|
+
const [buttonNode] = findAllInstances<PageBannerButtonProperties>({
|
|
43
|
+
node,
|
|
44
|
+
key: components.componentPageBannerSuffixAction.key,
|
|
45
|
+
});
|
|
46
|
+
const suffix = buttonNode ? buttonHandler.transform(buttonNode, traverse) : undefined;
|
|
47
|
+
|
|
48
|
+
return { tag: "PageBanner", suffix };
|
|
49
|
+
})
|
|
50
|
+
.with("Actionable (Custom)", () => ({
|
|
51
|
+
tag: "PageBanner",
|
|
52
|
+
suffix: createElement("div", undefined, "Custom Content"),
|
|
53
|
+
}))
|
|
54
|
+
.exhaustive();
|
|
55
|
+
|
|
56
|
+
const textNode = findOne(
|
|
57
|
+
node,
|
|
58
|
+
(child) => child.type === "TEXT" && child.name === "Text",
|
|
59
|
+
) as NormalizedTextNode | null;
|
|
60
|
+
|
|
61
|
+
if (!textNode) {
|
|
62
|
+
return createLocalSnippetElement(tag, undefined, undefined, {
|
|
63
|
+
comment: "내용을 제공해주세요.",
|
|
41
64
|
});
|
|
42
|
-
|
|
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;
|
|
65
|
+
}
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
return createLocalSnippetElement(tag, undefined, undefined, {
|
|
59
|
-
comment: "내용을 제공해주세요.",
|
|
60
|
-
});
|
|
61
|
-
}
|
|
67
|
+
const slices = textNode.segments;
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
let title: string | undefined;
|
|
70
|
+
let description: string | undefined;
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
switch (slices.length) {
|
|
73
|
+
case 1: {
|
|
74
|
+
description = slices[0]?.characters.trim();
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case 2: {
|
|
79
|
+
title = slices[0]?.characters.trim();
|
|
80
|
+
description = slices[1]?.characters.trim();
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
73
84
|
}
|
|
74
|
-
case 2: {
|
|
75
|
-
title = slices[0]?.characters.trim();
|
|
76
|
-
description = slices[1]?.characters.trim();
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return createLocalSnippetElement(tag, commonProps);
|
|
100
|
-
});
|
|
86
|
+
const iconNode = findOne(
|
|
87
|
+
node,
|
|
88
|
+
(child) => child.type === "INSTANCE" && child.name === "icon",
|
|
89
|
+
) as NormalizedInstanceNode | null;
|
|
90
|
+
|
|
91
|
+
const showPrefixIcon = props["Show Prefix Icon#11840:27"].value && iconNode;
|
|
92
|
+
const prefixIcon = showPrefixIcon ? ctx.iconHandler.transform(iconNode) : undefined;
|
|
93
|
+
|
|
94
|
+
const commonProps = {
|
|
95
|
+
title,
|
|
96
|
+
description,
|
|
97
|
+
prefixIcon,
|
|
98
|
+
tone: camelCase(props.Tone.value),
|
|
99
|
+
variant: camelCase(props.Variant.value),
|
|
100
|
+
...(suffix && { suffix }),
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return createLocalSnippetElement(tag, commonProps);
|
|
104
|
+
},
|
|
105
|
+
);
|
|
101
106
|
};
|
|
@@ -10,7 +10,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("progress-circle"
|
|
|
10
10
|
|
|
11
11
|
export const createProgressCircleHandler = (_ctx: ComponentHandlerDeps) =>
|
|
12
12
|
defineComponentHandler<ProgressCircleProperties>(
|
|
13
|
-
metadata.
|
|
13
|
+
metadata.componentProgressCircle.key,
|
|
14
14
|
({ componentProperties: props }) => {
|
|
15
15
|
const { value, minValue, maxValue } = match(props.Value.value)
|
|
16
16
|
.with("Indeterminate", () => ({
|
|
@@ -10,7 +10,7 @@ import { match } from "ts-pattern";
|
|
|
10
10
|
const { createLocalSnippetElement } = createLocalSnippetHelper("radio-group");
|
|
11
11
|
|
|
12
12
|
export const createRadioGroupItemHandler = (_ctx: ComponentHandlerDeps) =>
|
|
13
|
-
defineComponentHandler<RadioProperties>(metadata.
|
|
13
|
+
defineComponentHandler<RadioProperties>(metadata.componentRadio.key, ({ componentProperties: props }) => {
|
|
14
14
|
const tone = match(props.Tone.value)
|
|
15
15
|
.with("Neutral", () => "neutral")
|
|
16
16
|
.with("🚫[Deprecated]Brand", () => "brand")
|
|
@@ -10,7 +10,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("radio-group");
|
|
|
10
10
|
|
|
11
11
|
export const createRadiomarkHandler = (_ctx: ComponentHandlerDeps) =>
|
|
12
12
|
defineComponentHandler<RadiomarkProperties>(
|
|
13
|
-
metadata.
|
|
13
|
+
metadata.componentRadiomark.key,
|
|
14
14
|
({ componentProperties: props }) => {
|
|
15
15
|
const tone = match(props.Tone.value)
|
|
16
16
|
.with("Neutral", () => "neutral")
|
|
@@ -22,6 +22,6 @@ export const createRadiomarkHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
22
22
|
size: handleSizeProp(props.Size.value),
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
return createLocalSnippetElement("
|
|
25
|
+
return createLocalSnippetElement("Radiomark", commonProps);
|
|
26
26
|
},
|
|
27
27
|
);
|
|
@@ -9,7 +9,7 @@ const { createLocalSnippetElement } = createLocalSnippetHelper("reaction-button"
|
|
|
9
9
|
|
|
10
10
|
export const createReactionButtonHandler = (ctx: ComponentHandlerDeps) =>
|
|
11
11
|
defineComponentHandler<ReactionButtonProperties>(
|
|
12
|
-
metadata.
|
|
12
|
+
metadata.componentReactionButton.key,
|
|
13
13
|
({ componentProperties: props }) => {
|
|
14
14
|
const commonProps = {
|
|
15
15
|
size: handleSizeProp(props.Size.value),
|