@seed-design/figma 1.3.12 → 1.3.14

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.
Files changed (28) hide show
  1. package/lib/codegen/index.cjs +1297 -394
  2. package/lib/codegen/index.js +1297 -394
  3. package/lib/codegen/targets/react/index.cjs +1462 -511
  4. package/lib/codegen/targets/react/index.js +1462 -511
  5. package/lib/index.cjs +1415 -446
  6. package/lib/index.js +1415 -446
  7. package/package.json +4 -4
  8. package/src/codegen/component-properties.ts +9 -9
  9. package/src/codegen/targets/react/component/handlers/app-bar.ts +1 -1
  10. package/src/codegen/targets/react/component/handlers/checkbox.ts +1 -1
  11. package/src/codegen/targets/react/component/handlers/field-button.ts +5 -5
  12. package/src/codegen/targets/react/component/handlers/index.ts +1 -1
  13. package/src/codegen/targets/react/component/handlers/legacy-chip.ts +96 -0
  14. package/src/codegen/targets/react/component/handlers/list-item.ts +3 -3
  15. package/src/codegen/targets/react/component/handlers/radio-group.ts +1 -1
  16. package/src/codegen/targets/react/component/handlers/select-box.ts +1 -1
  17. package/src/codegen/targets/react/component/handlers/slider.ts +1 -1
  18. package/src/codegen/targets/react/component/handlers/tabs.ts +11 -5
  19. package/src/codegen/targets/react/component/handlers/text-field.ts +2 -2
  20. package/src/entities/data/__generated__/component-sets/index.d.ts +503 -264
  21. package/src/entities/data/__generated__/component-sets/index.mjs +503 -264
  22. package/src/entities/data/__generated__/components/index.d.ts +258 -96
  23. package/src/entities/data/__generated__/components/index.mjs +258 -96
  24. package/src/entities/data/__generated__/icons/index.mjs +66 -0
  25. package/src/entities/data/__generated__/styles/index.mjs +252 -0
  26. package/src/entities/data/__generated__/variable-collections/index.mjs +25 -5
  27. package/src/entities/data/__generated__/variables/index.mjs +461 -69
  28. package/src/codegen/targets/react/component/handlers/chip.ts +0 -93
@@ -1,93 +0,0 @@
1
- import type {
2
- AvatarProperties,
3
- ChipIconSuffixProperties,
4
- ChipProperties,
5
- } from "@/codegen/component-properties";
6
- import { defineComponentHandler } from "@/codegen/core";
7
- import * as metadata from "@/entities/data/__generated__/component-sets";
8
- import * as components from "@/entities/data/__generated__/components";
9
- import { match } from "ts-pattern";
10
- import { createLocalSnippetHelper, createSeedReactElement } from "../../element-factories";
11
- import type { ComponentHandlerDeps } from "../deps.interface";
12
- import { handleSizeProp } from "../size";
13
- import { camelCase } from "change-case";
14
- import { findAllInstances } from "@/utils/figma-node";
15
- import { createAvatarHandler } from "@/codegen/targets/react/component/handlers/avatar";
16
-
17
- const { createLocalSnippetElement } = createLocalSnippetHelper("chip");
18
-
19
- const createChipIconSuffixHandler = (ctx: ComponentHandlerDeps) => {
20
- return defineComponentHandler<ChipIconSuffixProperties>(
21
- components.componentChipSuffixIcon.key,
22
- ({ componentProperties }) => {
23
- return createLocalSnippetElement(
24
- "Chip.SuffixIcon",
25
- undefined,
26
- createSeedReactElement("Icon", {
27
- svg: ctx.iconHandler.transform(componentProperties["Icon#33203:0"]),
28
- }),
29
- );
30
- },
31
- );
32
- };
33
-
34
- export const createChipHandler = (ctx: ComponentHandlerDeps) => {
35
- const avatarHandler = createAvatarHandler(ctx);
36
- const iconSuffixHandler = createChipIconSuffixHandler(ctx);
37
-
38
- return defineComponentHandler<ChipProperties>(metadata.componentChip.key, (node, traverse) => {
39
- const props = node.componentProperties;
40
-
41
- const prefix = match(props["Prefix Type"].value)
42
- .with("None", "Image", () => undefined)
43
- .with("Icon", () =>
44
- createLocalSnippetElement(
45
- "Chip.PrefixIcon",
46
- undefined,
47
- createSeedReactElement("Icon", {
48
- svg: ctx.iconHandler.transform(props["Prefix Icon#8722:0"]),
49
- }),
50
- ),
51
- )
52
- .with("Avatar", () => {
53
- const [avatar] = findAllInstances<AvatarProperties>({
54
- node,
55
- key: avatarHandler.key,
56
- });
57
- if (!avatar) return undefined;
58
-
59
- return createLocalSnippetElement(
60
- "Chip.PrefixAvatar",
61
- undefined,
62
- avatarHandler.transform(avatar, traverse),
63
- );
64
- })
65
- .exhaustive();
66
-
67
- const label = createLocalSnippetElement("Chip.Label", undefined, props["Label#7185:0"].value);
68
-
69
- const [suffixIcon] = findAllInstances<ChipIconSuffixProperties>({
70
- node,
71
- key: components.componentChipSuffixIcon.key,
72
- });
73
-
74
- const commonProps = {
75
- variant: camelCase(props.Variant.value),
76
- size: handleSizeProp(props.Size.value),
77
- layout: props["Label#7185:0"].value ? "withText" : "iconOnly",
78
- ...(props.Selected.value === "True" && {
79
- defaultChecked: true,
80
- }),
81
- ...(props.State.value === "Disabled" && {
82
- disabled: true,
83
- }),
84
- };
85
-
86
- return createLocalSnippetElement(
87
- "Chip.Toggle",
88
- commonProps,
89
- [prefix, label, suffixIcon ? iconSuffixHandler.transform(suffixIcon, traverse) : undefined],
90
- { comment: "목적에 따라 Chip.Button, Chip.RadioItem 등으로 바꿔 사용하세요." },
91
- );
92
- });
93
- };