import ParcelConfig import SwiftUI struct TourWelcomeView: View { let configuration: ParcelConfiguration let intent: TourStartIntent let isEnabled: Bool let choose: (TourStartIntent) -> Void @FocusState private var focusedIntent: TourStartIntent? var body: some View { VStack(spacing: 16) { TourDemoWelcome(configuration: configuration) .frame(width: 280, height: 175) .frame(maxWidth: .infinity) VStack(spacing: 12) { Button { choose(.automatic) } label: { VStack(spacing: 4) { Text(TourText.text("Auto Mode")).font(.headline) Text(TourText.text("Always arranged.")).font(.callout) } .fixedSize(horizontal: false, vertical: true) .frame(maxWidth: .infinity, minHeight: 48) } .buttonStyle(.borderedProminent) .controlSize(.large) .frame(maxWidth: 320) .focused($focusedIntent, equals: .automatic) .accessibilityLabel(TourText.text("Auto Mode")) .accessibilityHint(TourText.text("Always arranged.")) .accessibilityInputLabels([TourText.text("Auto Mode")]) .accessibilityIdentifier("tour.mode.automatic") Button { choose(.manual) } label: { ViewThatFits(in: .horizontal) { HStack(spacing: 8) { manualLabel } VStack(spacing: 4) { manualLabel } } .fixedSize(horizontal: false, vertical: true) } .buttonStyle(.borderless) .controlSize(.regular) .focused($focusedIntent, equals: .manual) .accessibilityLabel(TourText.text("Manual Mode")) .accessibilityHint(TourText.text("Only when you ask.")) .accessibilityInputLabels([TourText.text("Manual Mode")]) .accessibilityIdentifier("tour.mode.manual") } .disabled(!isEnabled) .frame(maxWidth: .infinity) } .onAppear { focusedIntent = intent } } @ViewBuilder private var manualLabel: some View { Text(TourText.text("Manual Mode")) Text(TourText.text("Only when you ask.")).font(.callout).foregroundStyle(.secondary) } }