slint/tools/lsp/ui/components/expandable-group.slint
szecket 7c0b9b31a3
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
CI / files-changed (push) Waiting to run
CI / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
live-preview: added a component-name (#9364)
2025-09-08 20:02:29 +02:00

70 lines
2.5 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
import { Palette } from "std-widgets.slint";
import { BodyStrongText } from "../components/body-strong-text.slint";
import { StateLayer } from "../components/state-layer.slint";
import { EditorAnimationSettings, EditorSizeSettings, EditorSpaceSettings, Icons } from "../components/styling.slint";
export component ExpandableGroup {
in property <bool> enabled;
in property <string> text;
in property <length> panel-width;
in-out property <bool> open: true;
group-layer := Rectangle {
content-layer := VerticalLayout {
Rectangle {
touch-area := TouchArea {
clicked => {
root.open = !root.open;
}
}
state-layer := StateLayer {
width: panel-width;
height: group-layer.height + (EditorSpaceSettings.default-padding * 2);
y: group-layer.y - EditorSpaceSettings.default-padding;
has-hover: touch-area.has-hover;
pressed: touch-area.pressed;
}
HorizontalLayout {
spacing: EditorSpaceSettings.default-spacing / 2;
height: t.preferred-height;
icon-image := Image {
width: EditorSizeSettings.default-icon-width;
colorize: Palette.alternate-foreground.transparentize(0.7);
source: Icons.chevron-down;
rotation-origin-x: self.width / 2;
rotation-origin-y: self.height / 2;
states [
closed when !root.open: {
rotation-angle: -0.25turn;
}
]
animate rotation-angle { duration: EditorAnimationSettings.rotation-duration; }
}
t := BodyStrongText {
text: root.text != "" ? root.text : @tr("User Properties");
}
}
}
Rectangle {
height: root.open ? self.preferred-height : 0px;
clip: true;
@children
animate height { duration: EditorAnimationSettings.resize-duration; }
}
}
}
}