forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormPage.js
185 lines (164 loc) · 6.28 KB
/
FormPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/* eslint react/no-multi-comp: 0, react/prop-types: 0 */
import React from 'react';
import { PrismCode } from 'react-prism';
import PageTitle from '../UI/PageTitle';
import SectionTitle from '../UI/SectionTitle';
import FormExample from '../examples/Form';
const FormExampleSource = require('!!raw!../examples/Form');
import FormGridExample from '../examples/FormGrid';
const FormGridExampleSource = require('!!raw!../examples/FormGrid');
import FormInlineExample from '../examples/FormInline';
const FormInlineExampleSource = require('!!raw!../examples/FormInline');
import FormFeedbackExample from '../examples/FormFeedback';
const FormFeedbackExampleSource = require('!!raw!../examples/FormFeedback');
import InputTypeExample from '../examples/InputType';
const InputTypeExampleSource = require('!!raw!../examples/InputType');
import InlineCheckboxesExample from '../examples/InlineCheckboxes';
const InlineCheckboxesExampleSource = require('!!raw!../examples/InlineCheckboxes');
import InputSizingExample from '../examples/InputSizing';
const InputSizingExampleSource = require('!!raw!../examples/InputSizing');
import InputGridSizingExample from '../examples/InputGridSizing';
const InputGridSizingExampleSource = require('!!raw!../examples/InputGridSizing');
import LabelHiddenExample from '../examples/LabelHidden';
const LabelHiddenExampleSource = require('!!raw!../examples/LabelHidden');
import CustomControlsExample from '../examples/CustomControls';
const CustomControlsExampleSource = require('!!raw!../examples/CustomControls');
export default class FormPage extends React.Component {
render() {
return (
<div>
<PageTitle title="Form" />
<div className="docs-example">
<FormExample />
</div>
<pre>
<PrismCode className="language-jsx">
{FormExampleSource}
</PrismCode>
</pre>
<SectionTitle>Properties</SectionTitle>
<pre>
<PrismCode className="language-jsx">
{`Input.propTypes = {
children: PropTypes.node,
// type can be things like text, password, (typical input types) as well as select and textarea, providing children as you normally would to those.
type: PropTypes.string,
size: PropTypes.string,
bsSize: PropTypes.string,
state: deprecated(PropTypes.string, 'Please use the prop "valid"'),
valid: PropTypes.bool, // applied the is-valid class when true, does nothing when false
invalid: PropTypes.bool, // applied the is-invalid class when true, does nothing when false
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
// ref will only get you a reference to the Input component, use innerRef to get a reference to the DOM input (for things like focus management).
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
static: deprecated(PropTypes.bool, 'Please use the prop "plaintext"'),
plaintext: PropTypes.bool,
addon: PropTypes.bool,
className: PropTypes.string,
cssModule: PropTypes.object,
};`}
{`CustomInput.propTypes = {
className: PropTypes.string,
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
type: PropTypes.string.isRequired, // radio, checkbox, select, range.
label: PropTypes.string, // used for checkbox and radios
inline: PropTypes.bool,
valid: PropTypes.bool, // applied the is-invalid class when true, does nothing when false
invalid: PropTypes.bool, // applied the is-valid class when true, does nothing when false
bsSize: PropTypes.string,
cssModule: PropTypes.object,
children: PropTypes.oneOfType([PropTypes.node, PropTypes.array, PropTypes.func]), // for type="select"
// innerRef would be referenced to select node or input DOM node, depends on type property
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
])
};`}
</PrismCode>
</pre>
<SectionTitle>Form Grid</SectionTitle>
<div className="docs-example">
<FormGridExample />
</div>
<pre>
<PrismCode className="language-jsx">
{FormGridExampleSource}
</PrismCode>
</pre>
<SectionTitle>Inline Form</SectionTitle>
<div className="docs-example">
<FormInlineExample />
</div>
<pre>
<PrismCode className="language-jsx">
{FormInlineExampleSource}
</PrismCode>
</pre>
<SectionTitle>Form Validation</SectionTitle>
<div className="docs-example">
<FormFeedbackExample />
</div>
<pre>
<PrismCode className="language-jsx">
{FormFeedbackExampleSource}
</PrismCode>
</pre>
<SectionTitle>Input Types</SectionTitle>
<div className="docs-example">
<InputTypeExample />
</div>
<pre>
<PrismCode className="language-jsx">
{InputTypeExampleSource}
</PrismCode>
</pre>
<SectionTitle>Inline checkboxes</SectionTitle>
<div className="docs-example">
<InlineCheckboxesExample />
</div>
<pre>
<PrismCode className="language-jsx">
{InlineCheckboxesExampleSource}
</PrismCode>
</pre>
<SectionTitle>Input Sizing</SectionTitle>
<div className="docs-example">
<InputSizingExample />
</div>
<pre>
<PrismCode className="language-jsx">
{InputSizingExampleSource}
</PrismCode>
</pre>
<SectionTitle>Input Grid Sizing</SectionTitle>
<div className="docs-example">
<InputGridSizingExample />
</div>
<pre>
<PrismCode className="language-jsx">
{InputGridSizingExampleSource}
</PrismCode>
</pre>
<SectionTitle>Hidden Labels</SectionTitle>
<div className="docs-example">
<LabelHiddenExample />
</div>
<pre>
<PrismCode className="language-jsx">
{LabelHiddenExampleSource}
</PrismCode>
</pre>
<SectionTitle>Custom Inputs</SectionTitle>
<div className="docs-example">
<CustomControlsExample />
</div>
<pre>
<PrismCode className="language-jsx">
{CustomControlsExampleSource}
</PrismCode>
</pre>
</div>
);
}
}