// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 import { html, LitElement } from 'lit'; import { ButtonFormControlMixin } from '@nvidia-elements/forms/mixins'; import { Icon } from '@nvidia-elements/core/icon'; import { scopedRegistry } from '@nvidia-elements/foundations/internal/decorators'; import { useStyles } from '@nvidia-elements/foundations/internal/styles'; import styles from './drag-handle.css?inline'; /** * @element nve-drag-handle * @description A draggable grip button with a native drag preview. Activation toggles the pressed state; the application controls movement. * @documentation https://nvidia.github.io/elements/docs/elements/drag-handle/ * @since 0.0.0 * @entrypoint \@nvidia-elements/core/drag-handle * @cssprop --cursor - The cursor over the handle. * @cssprop --color - The grip color. * @cssprop --width - The horizontal size of the pointer target. * @cssprop --height - The vertical size of the pointer target. * @cssprop --border-radius - The handle corner radius. * @csspart icon - The fixed grip icon. * @aria https://www.w3.org/WAI/ARIA/apg/patterns/button/ */ @scopedRegistry() export class DragHandle extends ButtonFormControlMixin(LitElement) { static styles = useStyles([styles]); static readonly metadata = { tag: 'nve-drag-handle', version: '0.0.0' }; static elementDefinitions = { [Icon.metadata.tag]: Icon }; constructor() { super(); this.type = 'button'; this.pressed = false; } render() { return html`