playbook_ui_docs 15.0.0.pre.alpha.PLAY2361datepickerarrownav10322 → 15.0.0.pre.alpha.PLAY2369textinputautocompleteprop10372

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 539205d0c391e17b5ddc5f4dae2a341c201b534a379735df7bb05e73d786efce
4
- data.tar.gz: e7eac85b56babca0b31f6ada9925943e5d27bc1a7ef720b3b56d6fd36741fb7b
3
+ metadata.gz: 45de412baf432884fe355df978304a7817712c41a4d35277d6690837e49b2050
4
+ data.tar.gz: 8971f889b86a0978aeba02b8e1f4ce6ff8e5f410cf91731ee9d797d20cbd6e39
5
5
  SHA512:
6
- metadata.gz: 26f36f041756e896924ebe43d5be91edddf3bfe6807e0526caff3a6e61d06f0dac03e29879fcc532eff7d72bc76dd19d1c86a223c50528e63e41ebf61d4fc1d5
7
- data.tar.gz: 9ab1468ee7872cfb131f228f1038b7145762d0e3b1a0e61976125586c33e1a0f40e2d46024cb26bd6fa00bcf2f8171ee3bf8f23bc1cae6f750720d1b1ee1f3de
6
+ metadata.gz: cf73b20ed1e5d75d97bdb6ec67ab791574ccb5d03fef49cc3fc14aa0562c48044ebc48535099614a721326ecc3b94889cab4a9d9f3a8715c3432e5cd17d4b9dd
7
+ data.tar.gz: aade9bd00562cc09e6189e85e6a507f2433125d58382e96e3de1d3d6355b39362caa226c9952151e3b062721dfe6cc8807cdabff7c1ea2d6c2986ad44512b3fe
@@ -0,0 +1,41 @@
1
+ <%= pb_rails("text_input", props: {
2
+ autocomplete: false,
3
+ label: "autocomplete='off'",
4
+ name: "firstName",
5
+ placeholder: "Enter first name",
6
+ }) %>
7
+
8
+ <%= pb_rails("text_input", props: {
9
+ label: "no autocomplete attribute (let browser decide- basically 'on')",
10
+ name: "lastName",
11
+ placeholder: "Enter last name"
12
+ }) %>
13
+
14
+ <%= pb_rails("text_input", props: {
15
+ autocomplete: true,
16
+ label: "autocomplete='on'",
17
+ name: "phone",
18
+ type: "phone",
19
+ placeholder: "Enter phone number"
20
+ }) %>
21
+
22
+ <%= pb_rails("body", props: { margin_bottom: "sm" }) do %>
23
+ The following have the same autocomplete attributes (email), but have
24
+ different name attributes (email and emailAlt). Many browsers will
25
+ open autocomplete based on name attributes instead of autocomplete:
26
+ <% end %>
27
+
28
+ <%= pb_rails("text_input", props: {
29
+ autocomplete: "email",
30
+ label: "autocomplete='email' name='email'",
31
+ name: "email",
32
+ placeholder: "Enter email address"
33
+ }) %>
34
+
35
+ <%= pb_rails("text_input", props: {
36
+ autocomplete: "email",
37
+ label: "autocomplete='email' name='emailAlt'",
38
+ name: "emailAlt",
39
+ type: "email",
40
+ placeholder: "Enter email address"
41
+ }) %>
@@ -0,0 +1,80 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import TextInput from '../../pb_text_input/_text_input'
4
+ import Body from '../../pb_body/_body'
5
+
6
+
7
+ const TextInputAutocomplete = (props) => {
8
+ const [formFields, setFormFields] = useState({
9
+ firstName: "",
10
+ lastName: "",
11
+ phone: "",
12
+ emailTest: "",
13
+ email: "",
14
+ });
15
+
16
+ const handleOnChangeFormField = ({ target }) => {
17
+ const { name, value } = target;
18
+ setFormFields({ ...formFields, [name]: value });
19
+ };
20
+
21
+ return (
22
+ <div>
23
+ <TextInput
24
+ autoComplete={false}
25
+ label="autocomplete='off'"
26
+ name="firstName"
27
+ onChange={handleOnChangeFormField}
28
+ placeholder="Enter first name"
29
+ value={formFields.firstName}
30
+ {...props}
31
+ />
32
+ <TextInput
33
+ label="no autocomplete attribute (let browser decide- basically 'on')"
34
+ name="lastName"
35
+ onChange={handleOnChangeFormField}
36
+ placeholder="Enter last name"
37
+ value={formFields.lastName}
38
+ {...props}
39
+ />
40
+ <TextInput
41
+ autoComplete
42
+ label="autocomplete='on'"
43
+ name="phone"
44
+ onChange={handleOnChangeFormField}
45
+ placeholder="Enter phone number"
46
+ type="phone"
47
+ value={formFields.phone}
48
+ {...props}
49
+ />
50
+ <Body marginBottom="sm">
51
+ The following have the same autocomplete attributes (email), but have
52
+ different name attributes (email and emailAlt). Many browsers will
53
+ open autocomplete based on name attributes instead of autocomplete:
54
+ </Body>
55
+ <TextInput
56
+ autoComplete="email"
57
+ label="autocomplete='email' name='email'"
58
+ name="email"
59
+ onChange={handleOnChangeFormField}
60
+ placeholder="Enter email address"
61
+ type="email"
62
+ value={formFields.email}
63
+ {...props}
64
+ />
65
+ <TextInput
66
+ autoComplete="email"
67
+ label="autocomplete='email' name='emailAlt'"
68
+ marginTop="sm"
69
+ name="emailTest"
70
+ onChange={handleOnChangeFormField}
71
+ placeholder="Enter email address"
72
+ type="email"
73
+ value={formFields.emailTest}
74
+ {...props}
75
+ />
76
+ </div>
77
+ );
78
+ };
79
+
80
+ export default TextInputAutocomplete;
@@ -0,0 +1 @@
1
+ Set this prop to `false` or `"off"` to remove autocomplete from text inputs. You can also set it to a string, but browsers will often defer to other attributes like `name`.
@@ -9,6 +9,8 @@ examples:
9
9
  - text_input_no_label: No Label
10
10
  - text_input_options: Input Options
11
11
  - text_input_mask: Mask
12
+ - text_input_autocomplete: Autocomplete
13
+
12
14
  react:
13
15
  - text_input_default: Default
14
16
  - text_input_error: With Error
@@ -19,6 +21,7 @@ examples:
19
21
  - text_input_no_label: No Label
20
22
  - text_input_mask: Mask
21
23
  - text_input_sanitize: Sanitized Masked Input
24
+ - text_input_autocomplete: Autocomplete
22
25
 
23
26
 
24
27
  swift:
@@ -7,3 +7,4 @@ export { default as TextInputInline } from './_text_input_inline.jsx'
7
7
  export { default as TextInputNoLabel } from './_text_input_no_label.jsx'
8
8
  export { default as TextInputMask } from './_text_input_mask.jsx'
9
9
  export { default as TextInputSanitize } from './_text_input_sanitize.jsx'
10
+ export { default as TextInputAutocomplete } from './_text_input_autocomplete.jsx'