<commit_before>import React, { useState } from 'react'
import {
  Form,
  Input,
  Button,
  Dialog,
  TextArea,
  DatePicker,
  Selector,
  Slider,
  Stepper,
} from 'antd-mobile'
import dayjs from 'dayjs'

export default () => {
  const onFinish = (values: any) => {
    Dialog.alert({
      content: JSON.stringify(values),
    })
  }

  const [pickerVisible, setPickerVisible] = useState(false)

  return (
    <>
      <Form
        onFinish={onFinish}
        footer={
          <Button block type='submit' color='primary' size='large'>
            提交
          </Button>
        }
      >
        <Form.Header>基础用法</Form.Header>
        <Form.Item
          name='姓名'
          label='姓名'
          rules={[{ required: true, message: '姓名不能为空' }]}
        >
          <Input placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='address' label='地址' help='详情地址'>
          <Input placeholder='请输入地址' />
        </Form.Item>
        <Form.Item
          name='birthday'
          label='生日'
          trigger='onConfirm'
          onClick={() => {
            setPickerVisible(true)
          }}
        >
          <DatePicker
            visible={pickerVisible}
            onClose={() => {
              setPickerVisible(false)
            }}
          >
            {value =>
              value ? dayjs(value).format('YYYY-MM-DD') : '请选择日期'
            }
          </DatePicker>
        </Form.Item>
        <Form.Item name='favoriteFruits' label='喜爱的水果'>
          <Selector
            columns={3}
            multiple
            options={[
              { label: '苹果', value: 'apple' },
              { label: '橘子', value: 'orange' },
              { label: '香蕉', value: 'banana' },
            ]}
          />
        </Form.Item>
        <Form.Item name='slider-demo' label='滑块选择'>
          <Slider ticks step={10} />
        </Form.Item>
        <Form.Item name='stepper-demo' label='数量'>
          <Stepper />
        </Form.Item>
        <Form.Item name='disabledField' label='禁用' disabled>
          <Input placeholder='禁止输入' />
        </Form.Item>
      </Form>

      <Form
        layout='horizontal'
        footer={
          <Button block type='submit' color='primary' size='large'>
            提交
          </Button>
        }
      >
        <Form.Header>水平布局</Form.Header>
        <Form.Item
          name='姓名'
          label='姓名'
          rules={[{ required: true, message: '姓名不能为空' }]}
        >
          <Input onChange={console.log} placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='address' label='地址' help='详情地址'>
          <TextArea placeholder='请输入地址' maxLength={100} rows={4} />
        </Form.Item>
      </Form>
    </>
  )
}<commit_msg>doc: (Form) fix field names of demo (#4854)<commit_after>import React, { useState } from 'react'
import {
  Form,
  Input,
  Button,
  Dialog,
  TextArea,
  DatePicker,
  Selector,
  Slider,
  Stepper,
} from 'antd-mobile'
import dayjs from 'dayjs'

export default () => {
  const onFinish = (values: any) => {
    Dialog.alert({
      content: JSON.stringify(values),
    })
  }

  const [pickerVisible, setPickerVisible] = useState(false)

  return (
    <>
      <Form
        onFinish={onFinish}
        footer={
          <Button block type='submit' color='primary' size='large'>
            提交
          </Button>
        }
      >
        <Form.Header>基础用法</Form.Header>
        <Form.Item
          name='name'
          label='姓名'
          rules={[{ required: true, message: '姓名不能为空' }]}
        >
          <Input placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='address' label='地址' help='详情地址'>
          <Input placeholder='请输入地址' />
        </Form.Item>
        <Form.Item
          name='birthday'
          label='生日'
          trigger='onConfirm'
          onClick={() => {
            setPickerVisible(true)
          }}
        >
          <DatePicker
            visible={pickerVisible}
            onClose={() => {
              setPickerVisible(false)
            }}
          >
            {value =>
              value ? dayjs(value).format('YYYY-MM-DD') : '请选择日期'
            }
          </DatePicker>
        </Form.Item>
        <Form.Item name='favoriteFruits' label='喜爱的水果'>
          <Selector
            columns={3}
            multiple
            options={[
              { label: '苹果', value: 'apple' },
              { label: '橘子', value: 'orange' },
              { label: '香蕉', value: 'banana' },
            ]}
          />
        </Form.Item>
        <Form.Item name='slider-demo' label='滑块选择'>
          <Slider ticks step={10} />
        </Form.Item>
        <Form.Item name='stepper-demo' label='数量'>
          <Stepper />
        </Form.Item>
        <Form.Item name='disabledField' label='禁用' disabled>
          <Input placeholder='禁止输入' />
        </Form.Item>
      </Form>

      <Form
        layout='horizontal'
        footer={
          <Button block type='submit' color='primary' size='large'>
            提交
          </Button>
        }
      >
        <Form.Header>水平布局</Form.Header>
        <Form.Item
          name='name'
          label='姓名'
          rules={[{ required: true, message: '姓名不能为空' }]}
        >
          <Input onChange={console.log} placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='address' label='地址' help='详情地址'>
          <TextArea placeholder='请输入地址' maxLength={100} rows={4} />
        </Form.Item>
      </Form>
    </>
  )
}
{'fraction_non_alphanumeric': 0.1525795828759605, 'fraction_numerical': 0.003293084522502744, 'mean_word_length': 1.5522875816993464, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1063222', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1793, 'n_words': 313}