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