Skip to content

AI-native design editor. Open-source Figma alternative.

fix: label the variant values a behaviour draws on and off (#1722)

Danila Poyarkovb6de582e408f
diff --git a/changes/1722/changed.md b/changes/1722/changed.md
new file mode 100644
index 000000000..bfbc4d41f
--- /dev/null
+++ b/changes/1722/changed.md
@@ -0,0 +1 @@
+- The Behaviour section labels the two variant values a control draws as on and off, so a set whose values read like the value itself, such as Checked and Unchecked, is clear to set up (#1722).
diff --git a/packages/vue/src/i18n/locales/de/panels.json b/packages/vue/src/i18n/locales/de/panels.json
index 9380ef956..d47818469 100644
--- a/packages/vue/src/i18n/locales/de/panels.json
+++ b/packages/vue/src/i18n/locales/de/panels.json
@@ -601,6 +601,7 @@
"behaviourDisabled": "Deaktiviert",
"behaviourOnValue": "An",
"behaviourOffValue": "Aus",
+ "behaviourValueField": "{value}: {side}",
"behaviourTrack": "Spur",
"behaviourThumb": "Regler",
"behaviourRange": "Bereich",
diff --git a/packages/vue/src/i18n/locales/es/panels.json b/packages/vue/src/i18n/locales/es/panels.json
index d0f9ff5fc..778dcc886 100644
--- a/packages/vue/src/i18n/locales/es/panels.json
+++ b/packages/vue/src/i18n/locales/es/panels.json
@@ -601,6 +601,7 @@
"behaviourDisabled": "Desactivado",
"behaviourOnValue": "Encendido",
"behaviourOffValue": "Apagado",
+ "behaviourValueField": "{value}: {side}",
"behaviourTrack": "Pista",
"behaviourThumb": "Control",
"behaviourRange": "Rango",
diff --git a/packages/vue/src/i18n/locales/fr/panels.json b/packages/vue/src/i18n/locales/fr/panels.json
index 05d4a7513..1d97bec3d 100644
--- a/packages/vue/src/i18n/locales/fr/panels.json
+++ b/packages/vue/src/i18n/locales/fr/panels.json
@@ -601,6 +601,7 @@
"behaviourDisabled": "Désactivé",
"behaviourOnValue": "Activé",
"behaviourOffValue": "Désactivé",
+ "behaviourValueField": "{value}: {side}",
"behaviourTrack": "Piste",
"behaviourThumb": "Bouton",
"behaviourRange": "Plage",
diff --git a/packages/vue/src/i18n/locales/it/panels.json b/packages/vue/src/i18n/locales/it/panels.json
index b1750e703..1e4e0a659 100644
--- a/packages/vue/src/i18n/locales/it/panels.json
+++ b/packages/vue/src/i18n/locales/it/panels.json
@@ -601,6 +601,7 @@
"behaviourDisabled": "Disattivato",
"behaviourOnValue": "Acceso",
"behaviourOffValue": "Spento",
+ "behaviourValueField": "{value}: {side}",
"behaviourTrack": "Traccia",
"behaviourThumb": "Cursore",
"behaviourRange": "Intervallo",
diff --git a/packages/vue/src/i18n/locales/ja/panels.json b/packages/vue/src/i18n/locales/ja/panels.json
index 31a5a8dfe..7c5a9a00d 100644
--- a/packages/vue/src/i18n/locales/ja/panels.json
+++ b/packages/vue/src/i18n/locales/ja/panels.json
@@ -594,6 +594,7 @@
"behaviourDisabled": "無効",
"behaviourOnValue": "オン",
"behaviourOffValue": "オフ",
+ "behaviourValueField": "{value}:{side}",
"behaviourTrack": "トラック",
"behaviourThumb": "つまみ",
"behaviourRange": "範囲",
diff --git a/packages/vue/src/i18n/locales/pl/panels.json b/packages/vue/src/i18n/locales/pl/panels.json
index a65a32b72..69d4fbd53 100644
--- a/packages/vue/src/i18n/locales/pl/panels.json
+++ b/packages/vue/src/i18n/locales/pl/panels.json
@@ -608,6 +608,7 @@
"behaviourDisabled": "Wyłączony",
"behaviourOnValue": "Wł.",
"behaviourOffValue": "Wył.",
+ "behaviourValueField": "{value}: {side}",
"behaviourTrack": "Ścieżka",
"behaviourThumb": "Uchwyt",
"behaviourRange": "Zakres",
diff --git a/packages/vue/src/i18n/locales/ru/panels.json b/packages/vue/src/i18n/locales/ru/panels.json
index 348756ccd..964cfabcb 100644
--- a/packages/vue/src/i18n/locales/ru/panels.json
+++ b/packages/vue/src/i18n/locales/ru/panels.json
@@ -608,6 +608,7 @@
"behaviourDisabled": "Отключено",
"behaviourOnValue": "Вкл.",
"behaviourOffValue": "Выкл.",
+ "behaviourValueField": "{value}: {side}",
"behaviourTrack": "Дорожка",
"behaviourThumb": "Бегунок",
"behaviourRange": "Диапазон",
diff --git a/packages/vue/src/i18n/locales/zh-cn/panels.json b/packages/vue/src/i18n/locales/zh-cn/panels.json
index f3996f90f..393b71642 100644
--- a/packages/vue/src/i18n/locales/zh-cn/panels.json
+++ b/packages/vue/src/i18n/locales/zh-cn/panels.json
@@ -594,6 +594,7 @@
"behaviourDisabled": "已禁用",
"behaviourOnValue": "开",
"behaviourOffValue": "关",
+ "behaviourValueField": "{value}:{side}",
"behaviourTrack": "轨道",
"behaviourThumb": "滑块按钮",
"behaviourRange": "范围",
diff --git a/packages/vue/src/i18n/messages/panels.ts b/packages/vue/src/i18n/messages/panels.ts
index 8b9c4226b..457a12060 100644
--- a/packages/vue/src/i18n/messages/panels.ts
+++ b/packages/vue/src/i18n/messages/panels.ts
@@ -291,6 +291,8 @@ export const panelMessageDefaults = {
behaviourDisabled: 'Disabled',
behaviourOnValue: 'On',
behaviourOffValue: 'Off',
+ /** A value's on or off variant field, such as "Checked: On". */
+ behaviourValueField: params('{value}: {side}'),
behaviourTrack: 'Track',
behaviourThumb: 'Thumb',
behaviourRange: 'Range',
diff --git a/src/components/properties/component-properties/behaviour/BehaviourRow.vue b/src/components/properties/component-properties/behaviour/BehaviourRow.vue
index 3bf2bd3b2..3e276234f 100644
--- a/src/components/properties/component-properties/behaviour/BehaviourRow.vue
+++ b/src/components/properties/component-properties/behaviour/BehaviourRow.vue
@@ -50,6 +50,11 @@ function variantValues(boolean: BehaviourBooleanControl) {
return (option?.values ?? []).map((name) => ({ value: name, label: name }))
}
+const MAPPING_SIDES = ['on', 'off'] as const
+
+const mappingLabel = (side: 'on' | 'off') =>
+ side === 'on' ? panels.value.behaviourOnValue : panels.value.behaviourOffValue
+
function setMapping(boolean: BehaviourBooleanControl, side: 'on' | 'off', choice: string) {
emit('mapValue', {
on: side === 'on' ? choice : (boolean.on ?? ''),
@@ -123,22 +128,20 @@ function numberLabel(field: NumberSetting) {
@bind="emit('bind', $event)"
@create="emit('create', label)"
/>
+ <!-- Which variant value draws the control on and which off, labelled as the states are. -->
<div
v-if="value.propertyId && variantValues(value).length"
- class="mt-1 grid grid-cols-2 gap-1"
+ class="mt-1.5 grid grid-cols-2 gap-x-1 gap-y-1.5"
>
- <AppSelect
- :label="panels.behaviourOnValue"
- :model-value="value.on ?? ''"
- :options="variantValues(value)"
- @update:model-value="setMapping(value, 'on', $event)"
- />
- <AppSelect
- :label="panels.behaviourOffValue"
- :model-value="value.off ?? ''"
- :options="variantValues(value)"
- @update:model-value="setMapping(value, 'off', $event)"
- />
+ <PanelFieldGroup v-for="side in MAPPING_SIDES" :key="side" :label="mappingLabel(side)">
+ <AppSelect
+ :label="panels.behaviourValueField({ value: label, side: mappingLabel(side) })"
+ :model-value="value[side] ?? ''"
+ :options="variantValues(value)"
+ :data-property="`behaviour-value-${id}-${side}`"
+ @update:model-value="setMapping(value, side, $event)"
+ />
+ </PanelFieldGroup>
</div>
</template>
<BehaviourBindingField
diff --git a/tools/checks/i18n/translation-baseline.txt b/tools/checks/i18n/translation-baseline.txt
index 11a99e783..5529f3ab4 100644
--- a/tools/checks/i18n/translation-baseline.txt
+++ b/tools/checks/i18n/translation-baseline.txt
@@ -60,6 +60,7 @@ de:panels.behaviourMin
de:panels.behaviourMax
de:panels.behaviourStateHover
de:panels.behaviourText
+de:panels.behaviourValueField
de:panels.shader
de:settings.mcp
de:settings.navigation
@@ -94,6 +95,7 @@ es:diagnostics.categoryMCP
es:diagnostics.durationMs
es:diagnostics.runtimeError
es:panels.auto
+es:panels.behaviourValueField
es:panels.blendModeColor
es:panels.blendModeNormal
es:panels.colorFormatHsb
@@ -184,6 +186,7 @@ fr:panels.slotDescription
fr:panels.behaviourMin
fr:panels.behaviourMax
fr:panels.behaviourStateFocus
+fr:panels.behaviourValueField
fr:panels.shader
fr:panels.variableModeAuto
fr:panels.variableModeAutoMixed
@@ -238,6 +241,7 @@ it:panels.behaviourMin
it:panels.behaviourMax
it:panels.behaviourStateHover
it:panels.behaviourStateFocus
+it:panels.behaviourValueField
it:panels.shader
it:panels.variableModeAuto
it:panels.variableModeAutoMixed
@@ -301,6 +305,7 @@ pl:panels.framePresetCategoryFigmaCommunity
pl:panels.framePresetCategoryTablet
pl:panels.kerning
pl:panels.behaviourMin
+pl:panels.behaviourValueField
pl:panels.shader
pl:settings.mcp
pl:settings.media
@@ -320,6 +325,7 @@ ru:code.stylingCSS
ru:code.stylingTailwind
ru:diagnostics.categoryMCP
ru:panels.ai
+ru:panels.behaviourValueField
ru:panels.colorFormatHsb
ru:panels.colorFormatHsl
ru:panels.colorFormatOkhcl