@seed-design/figma 0.1.8 → 0.1.9
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 +19 -6
- package/lib/codegen/index.d.ts +27 -7
- package/lib/codegen/index.d.ts.map +1 -1
- package/lib/codegen/index.js +19 -6
- package/lib/codegen/targets/react/index.cjs +74 -48
- package/lib/codegen/targets/react/index.d.ts +2 -2
- package/lib/codegen/targets/react/index.d.ts.map +1 -1
- package/lib/codegen/targets/react/index.js +74 -48
- package/lib/index.cjs +19 -6
- package/lib/index.js +19 -6
- package/package.json +2 -2
- package/src/codegen/component-properties.ts +8 -0
- package/src/codegen/targets/react/component/handlers/chip.ts +34 -12
- package/src/codegen/targets/react/component/handlers/identity-placeholder.ts +4 -2
- package/src/codegen/targets/react/component/handlers/manner-temp.ts +1 -1
- package/src/codegen/targets/react/component/handlers/progress-circle.ts +1 -1
- package/src/codegen/targets/react/component/handlers/select-box.ts +4 -4
- package/src/codegen/targets/react/component/handlers/switch.ts +2 -7
- package/src/codegen/targets/react/props.ts +5 -5
- package/src/entities/data/__generated__/component-sets/chip.d.ts +4 -0
- package/src/entities/data/__generated__/component-sets/chip.mjs +4 -0
- package/src/entities/data/__generated__/component-sets/progress-circle.d.ts +1 -1
- package/src/entities/data/__generated__/component-sets/progress-circle.mjs +1 -1
- package/src/entities/data/__generated__/component-sets/switch.d.ts +14 -5
- package/src/entities/data/__generated__/component-sets/switch.mjs +14 -5
|
@@ -14,7 +14,7 @@ export const createSelectBoxHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
14
14
|
({ componentProperties: props }) => {
|
|
15
15
|
const tag = match(props.Control.value)
|
|
16
16
|
.with("Checkbox", () => "CheckSelectBox")
|
|
17
|
-
.with("Radio", () => "
|
|
17
|
+
.with("Radio", () => "RadioSelectBoxItem")
|
|
18
18
|
.exhaustive();
|
|
19
19
|
|
|
20
20
|
const states = props.State.value.split("-");
|
|
@@ -24,7 +24,7 @@ export const createSelectBoxHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
24
24
|
...(props["Show Description#3033:0"].value && {
|
|
25
25
|
description: props["Description #3033:5"].value,
|
|
26
26
|
}),
|
|
27
|
-
...(tag === "
|
|
27
|
+
...(tag === "RadioSelectBoxItem" && {
|
|
28
28
|
value: props["Label#3635:0"].value,
|
|
29
29
|
}),
|
|
30
30
|
...(tag === "CheckSelectBox" &&
|
|
@@ -47,7 +47,7 @@ export const createSelectBoxGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
47
47
|
|
|
48
48
|
const tag = match(props.Control.value)
|
|
49
49
|
.with("Checkbox", () => "CheckSelectBoxGroup")
|
|
50
|
-
.with("Radio", () => "
|
|
50
|
+
.with("Radio", () => "RadioSelectBoxRoot")
|
|
51
51
|
.exhaustive();
|
|
52
52
|
|
|
53
53
|
const selectBoxes = findAllInstances<SelectBoxProperties>({
|
|
@@ -69,7 +69,7 @@ export const createSelectBoxGroupHandler = (ctx: ComponentHandlerDeps) => {
|
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
const commonProps = {
|
|
72
|
-
...(tag === "
|
|
72
|
+
...(tag === "RadioSelectBoxRoot" && {
|
|
73
73
|
defaultValue: selectedSelectBox?.componentProperties["Label#3635:0"].value,
|
|
74
74
|
}),
|
|
75
75
|
};
|
|
@@ -3,7 +3,6 @@ import { defineComponentHandler } from "@/codegen/core";
|
|
|
3
3
|
import * as metadata from "@/entities/data/__generated__/component-sets";
|
|
4
4
|
import { createLocalSnippetHelper } from "../../element-factories";
|
|
5
5
|
import type { ComponentHandlerDeps } from "../deps.interface";
|
|
6
|
-
import { handleSizeProp } from "../size";
|
|
7
6
|
|
|
8
7
|
const { createLocalSnippetElement } = createLocalSnippetHelper("switch");
|
|
9
8
|
|
|
@@ -13,13 +12,9 @@ export const createSwitchHandler = (_ctx: ComponentHandlerDeps) =>
|
|
|
13
12
|
({ componentProperties: props }) => {
|
|
14
13
|
const states = props.State.value.split("-");
|
|
15
14
|
|
|
16
|
-
const size = handleSizeProp(props.Size.value);
|
|
17
|
-
|
|
18
15
|
const commonProps = {
|
|
19
|
-
size,
|
|
20
|
-
|
|
21
|
-
label: props["Label#15191:2"].value,
|
|
22
|
-
}),
|
|
16
|
+
size: props.Size.value,
|
|
17
|
+
label: props["Label#36578:0"].value,
|
|
23
18
|
...(states.includes("Selected") && {
|
|
24
19
|
defaultChecked: true,
|
|
25
20
|
}),
|
|
@@ -143,7 +143,7 @@ export function createContainerLayoutPropsConverter(
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
export interface SelfLayoutProps {
|
|
146
|
-
|
|
146
|
+
flexGrow?: 0 | 1 | true;
|
|
147
147
|
alignSelf?: "stretch";
|
|
148
148
|
width?: string | number;
|
|
149
149
|
height?: string | number;
|
|
@@ -162,7 +162,7 @@ export function createSelfLayoutPropsConverter(
|
|
|
162
162
|
props: {} as SelfLayoutProps,
|
|
163
163
|
},
|
|
164
164
|
handlers: {
|
|
165
|
-
|
|
165
|
+
flexGrow: ({ layoutGrow }) => (layoutGrow === 1 ? true : layoutGrow),
|
|
166
166
|
alignSelf: ({ layoutAlign }) =>
|
|
167
167
|
match(layoutAlign)
|
|
168
168
|
.with("STRETCH", () => "stretch" as const)
|
|
@@ -198,7 +198,7 @@ export function createSelfLayoutPropsConverter(
|
|
|
198
198
|
: undefined,
|
|
199
199
|
},
|
|
200
200
|
defaults: {
|
|
201
|
-
|
|
201
|
+
flexGrow: 0,
|
|
202
202
|
},
|
|
203
203
|
});
|
|
204
204
|
}
|
|
@@ -371,7 +371,7 @@ export function createVectorChildrenFillPropsConverter(valueResolver: ReactValue
|
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
export interface StrokeProps {
|
|
374
|
-
borderWidth?:
|
|
374
|
+
borderWidth?: string;
|
|
375
375
|
borderColor?: string;
|
|
376
376
|
}
|
|
377
377
|
|
|
@@ -380,7 +380,7 @@ export function createStrokePropsConverter(
|
|
|
380
380
|
): PropsConverter<StrokeTrait, StrokeProps> {
|
|
381
381
|
return definePropsConverter((node) => {
|
|
382
382
|
const borderColor = valueResolver.getFormattedValue.stroke(node);
|
|
383
|
-
const borderWidth = borderColor ? node.strokeWeight : undefined;
|
|
383
|
+
const borderWidth = borderColor && node.strokeWeight ? `${node.strokeWeight}` : undefined;
|
|
384
384
|
|
|
385
385
|
return {
|
|
386
386
|
borderColor,
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
export declare const metadata: {
|
|
2
2
|
"name": "🟢 Switch",
|
|
3
|
-
"key": "
|
|
3
|
+
"key": "65e0e7ba1a0c13b42e5fd0ceb17d5f756128dd6b",
|
|
4
4
|
"componentPropertyDefinitions": {
|
|
5
|
-
"Label#
|
|
5
|
+
"Label#36578:0": {
|
|
6
6
|
"type": "TEXT"
|
|
7
7
|
},
|
|
8
8
|
"Size": {
|
|
9
9
|
"type": "VARIANT",
|
|
10
10
|
"variantOptions": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"16",
|
|
12
|
+
"24",
|
|
13
|
+
"32"
|
|
13
14
|
]
|
|
14
15
|
},
|
|
15
16
|
"State": {
|
|
16
17
|
"type": "VARIANT",
|
|
17
18
|
"variantOptions": [
|
|
18
19
|
"Enabled",
|
|
19
|
-
"Selected",
|
|
20
20
|
"Disabled",
|
|
21
|
+
"Selected",
|
|
21
22
|
"Selected-Disabled"
|
|
22
23
|
]
|
|
24
|
+
},
|
|
25
|
+
"Label Layout(Figma Only)": {
|
|
26
|
+
"type": "VARIANT",
|
|
27
|
+
"variantOptions": [
|
|
28
|
+
"None",
|
|
29
|
+
"Right",
|
|
30
|
+
"Left"
|
|
31
|
+
]
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
};
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
export const metadata = {
|
|
2
2
|
"name": "🟢 Switch",
|
|
3
|
-
"key": "
|
|
3
|
+
"key": "65e0e7ba1a0c13b42e5fd0ceb17d5f756128dd6b",
|
|
4
4
|
"componentPropertyDefinitions": {
|
|
5
|
-
"Label#
|
|
5
|
+
"Label#36578:0": {
|
|
6
6
|
"type": "TEXT"
|
|
7
7
|
},
|
|
8
8
|
"Size": {
|
|
9
9
|
"type": "VARIANT",
|
|
10
10
|
"variantOptions": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"16",
|
|
12
|
+
"24",
|
|
13
|
+
"32"
|
|
13
14
|
]
|
|
14
15
|
},
|
|
15
16
|
"State": {
|
|
16
17
|
"type": "VARIANT",
|
|
17
18
|
"variantOptions": [
|
|
18
19
|
"Enabled",
|
|
19
|
-
"Selected",
|
|
20
20
|
"Disabled",
|
|
21
|
+
"Selected",
|
|
21
22
|
"Selected-Disabled"
|
|
22
23
|
]
|
|
24
|
+
},
|
|
25
|
+
"Label Layout(Figma Only)": {
|
|
26
|
+
"type": "VARIANT",
|
|
27
|
+
"variantOptions": [
|
|
28
|
+
"None",
|
|
29
|
+
"Right",
|
|
30
|
+
"Left"
|
|
31
|
+
]
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
};
|