@import "~@packages/style/common/mixin.scss";

@include b(tree) {
	position: relative;
	cursor: default;
	color: $--tree-font-color;

	@include e(empty-block) {
		position: relative;
		min-height: 60px;
		text-align: center;
		width: 100%;
		height: 100%;
	}

	@include e(empty-text) {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		color: $--color-greyLight-3;
		font-size: $--font-size-base;
	}

	@include e(drop-indicator) {
		position: absolute;
		left: 0;
		right: 0;
		height: 1px;
		background-color: $--color-primary;
	}
}

@include b(tree-node) {
	white-space: nowrap;
	outline: none;
	&:focus {
		> .tu-tree-node__content {
			color: $--color-primary;
		}
	}

	@include when(drop-inner) {
		> .tu-tree-node__content .tu-tree-node__label {
			color: $--color-primary;
		}
	}

	@include e(content) {
		display: flex;
		align-items: center;
		height: 28px;
		line-height: 28px;
		cursor: pointer;
		transition: background-color 0.3s;

		& > .tu-tree-node__expand-icon {
			font-size: 13px;
			padding: 8px 6px;
		}
		& > label.tu-checkbox {
			margin-right: 8px;
		}
		&:hover {
			color: $--color-primary;
		}

		.tu-tree.is-dragging & {
			cursor: move;

			& * {
				pointer-events: none;
			}
		}

		.tu-tree.is-dragging.is-drop-not-allow & {
			cursor: not-allowed;
		}
	}

	@include e(expand-icon) {
		cursor: pointer;
		color: $--tree-expand-icon-color;
		font-size: 12px;

		transform: rotate(0deg);
		transition: transform 0.3s ease-in-out;

		&.expanded {
			transform: rotate(90deg);
		}

		&.is-leaf {
			color: transparent;
			cursor: default;
		}
	}

	@include e(label) {
		transition: all 0.3s;
		font-size: $--font-size-base;
	}

	@include e(loading-icon) {
		margin-right: 8px;
		font-size: $--font-size-base;
		color: $--tree-expand-icon-color;
	}

	& > .tu-tree-node__children {
		overflow: hidden;
		background-color: transparent;
	}

	&.is-expanded > .tu-tree-node__children {
		display: block;
	}
}
