<template>
	<view class="demo-block">
		<text class="demo-block__title-text ultra">Input 输入框</text>
		<text class="demo-block__desc-text">用于文本信息输入。</text>	
		<view class="demo-block__body">
			<view class="demo-block">
				<text class="demo-block__title-text">基础使用</text>
				<view class="demo-block__body">
					<l-input v-model="inputVulae" type="number" placeholder="请输入文字"></l-input>
				</view>	
			</view>	
			<view class="demo-block">
				<text class="demo-block__title-text">标题</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字"></l-input>
				</view>	
			</view>	
			<view class="demo-block">
				<text class="demo-block__title-text">字数限制</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" :maxlength="10" tips="最大输入10个字符"></l-input>
				</view>	
			</view>	
			<view class="demo-block">
				<text class="demo-block__title-text">前置图标</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" prefix-icon="fingerprint-2" ></l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">前置图标插槽</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" prefix-icon="fingerprint-2">
						<template #prefix-icon>
							<l-icon  class="icon-text" name="fingerprint-2" size="44rpx"></l-icon>
						</template>
					</l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">后置图标</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" suffix-icon="info-circle-filled"></l-input>
				</view>	
			</view>
			 
			<view class="demo-block">
				<text class="demo-block__title-text">后置插槽</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" >
						<template #suffix>
						     <l-button type="primary" size="mini"> 操作按钮 </l-button>
						</template>
					</l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">后置图标插槽</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" >
						<template #suffix-icon>
							<l-icon class="icon-text" name="user-avatar" size="44rpx"></l-icon>
						</template>
					</l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">密码</text>
				<view class="demo-block__body">
					<l-input label="输入密码" placeholder="请输入密码" v-model="value" type="password" clearable clearI></l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">错误状态</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" value="已输入文字" status="error" tips="辅助说明"></l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">禁用状态</text>
				<view class="demo-block__body">
					<l-input label="不可编辑" placeholder="请输入文字" value="不可编辑文字" disabled></l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">竖向布局</text>
				<view class="demo-block__body">
					<l-input label="标签文字" layout="vertical" placeholder="请输入文字"></l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">无描边</text>
				<view class="demo-block__body">
					<l-input label="标签文字" placeholder="请输入文字" :bordered="bordered"></l-input>
				</view>	
			</view>
			<view class="demo-block">
				<text class="demo-block__title-text">经典</text>
				<view class="demo-block__body">
					<view style="padding:0 16px">
						<l-input 
							classic 
							disabled
							layout="vertical"
							status="error" tips="辅助说明"
							placeholder="请输入文字" :bordered="bordered"></l-input>
					</view>
				</view>	
			</view>
		</view>	
	</view>
</template>

<script lang="uts" setup>
	const inputVulae = ref<number|string>('')
	const value = ref('password')
	const bordered = ref(false)
	
	setTimeout(()=>{
		bordered.value = true
	},1000)
</script>

<style lang="scss">
	$card-bg-color: var(--doc-card-bg-color, white);
	// $page-bg-color: var(--doc-page-bg-color, #f5f5f5);
	$title-color: var(--doc-title-color, #000000E6);
	$summary-color: var(--doc-summary-color, #00000099);
	
	.icon-text {
		color: $summary-color !important;
	}
	.row{
		display: flex;
		// #ifndef APP-IOS || APP-ANDROID
		gap: 20rpx;
		// #endif
		flex-direction: row;
		flex-wrap: wrap;
	}
	.tag{
		// #ifdef APP-IOS || APP-ANDROID
		margin-right: 20rpx;
		// #endif
	}
	.demo-block {
		margin: 32px 0 0;
		// overflow: visible;
		&.card{
			background-color: $card-bg-color;
			transition-property: background-color;
			// transition-duration: 300ms;
			padding: 30rpx;
			margin-bottom: 20rpx !important;
		}
		&__title {
			margin: 0;
			margin-top: 8px;
			
			&-text {
				color: $summary-color;
				font-weight: 400;
				font-size: 14px;
				line-height: 16px;
				margin-left: 16px;
				&.large {
					color: $title-color;
					font-size: 18px;
					font-weight: 700;
					line-height: 26px;
					display: flex;
				}
				&.ultra {
					color: $title-color;
					font-size: 24px;
					font-weight: 700;
					line-height: 32px;
					display: flex;
				}
			}
		}
		&__desc-text {
			color: $summary-color;
			margin: 8px 16px 0 0;
			font-size: 14px;
			line-height: 22px;
			margin-left: 16px;
		}
		&__body {
			margin: 16px 0;
			overflow: visible;
			.demo-block {
				// margin-top: 0px;
				margin: 0;
			}
		}
	}
</style>