playbook_ui_docs 16.1.0.pre.alpha.play264213818 → 16.1.0.pre.alpha.play273614090

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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.jsx +71 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.md +4 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  6. data/app/pb_kits/playbook/pb_card/docs/_card_light.html.erb +3 -35
  7. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.html.erb +6 -0
  8. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.jsx +17 -0
  9. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.md +3 -0
  10. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
  11. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.md +1 -0
  13. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +3 -0
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +3 -0
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +52 -0
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +72 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +5 -0
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +33 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +20 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +8 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +8 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +6 -3
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +1 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +3 -1
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +9 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +33 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +3 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +4 -1
  31. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
  32. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +16 -9
  33. data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +6 -2
  34. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
  35. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
  36. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +3 -3
  37. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +4 -7
  38. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.md +3 -0
  39. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +1 -0
  40. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +7 -0
  41. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +24 -0
  42. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +3 -0
  43. data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +2 -0
  44. data/app/pb_kits/playbook/pb_passphrase/docs/index.js +1 -0
  45. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +5 -0
  46. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +14 -0
  47. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +3 -0
  48. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
  49. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  50. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.jsx +44 -0
  51. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.md +1 -0
  52. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.jsx +1 -0
  53. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +28 -0
  54. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +1 -0
  55. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +1 -0
  56. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -0
  57. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -0
  58. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.html.erb +3 -3
  59. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +3 -0
  60. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.md +1 -0
  61. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +5 -2
  62. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.html.erb +6 -0
  63. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.jsx +16 -0
  64. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.md +3 -0
  65. data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +2 -0
  66. data/app/pb_kits/playbook/pb_time_picker/docs/index.js +1 -0
  67. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.html.erb +16 -0
  68. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.jsx +23 -0
  69. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.md +3 -0
  70. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
  71. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
  72. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  73. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +22 -21
  74. metadata +38 -2
@@ -1,13 +1,17 @@
1
1
  <%= pb_form_with(scope: :example, url: "", method: :get, validate: true) do |form| %>
2
+ <%= form.typeahead :example_typeahead_field, props: { label: true, required: true, required_indicator: true } %>
2
3
  <%= form.text_field :example_text_field, props: { label: true, required: true, required_indicator: true } %>
3
4
  <%= form.text_field :example_text_field_2, props: { label: "Text Field Custom Label", required: true, required_indicator: true } %>
4
- <%= form.text_area :example_text_area, props: { label: true, required: true, required_indicator: true } %>
5
- <%= form.text_area :example_text_area_2, props: { label: "Textarea Custom Label", required: true, required_indicator: true } %>
5
+ <%= form.phone_number_field :example_phone_number_field, props: { label: true, required: true, required_indicator: true } %>
6
6
  <%= form.email_field :example_email_field, props: { label: true, required: true, required_indicator: true } %>
7
7
  <%= form.number_field :example_number_field, props: { label: true, required: true, required_indicator: true } %>
8
8
  <%= form.search_field :example_search_field, props: { label: true, required: true, required_indicator: true } %>
9
9
  <%= form.password_field :example_password_field, props: { label: true, required: true, required_indicator: true } %>
10
10
  <%= form.url_field :example_url_field, props: { label: true, required: true, required_indicator: true } %>
11
+ <%= form.text_area :example_text_area, props: { label: true, required: true, required_indicator: true } %>
12
+ <%= form.text_area :example_text_area_2, props: { label: "Textarea Custom Label", required: true, required_indicator: true } %>
13
+ <%# <%= form.check_box :example_checkbox, props: { label: true, text: "Checkbox Label", required: true, required_indicator: true } %>
14
+ <%= form.time_picker :example_time_picker_required_indicator, props: { label: true, required: true, required_indicator: true } %>
11
15
 
12
16
  <%= form.actions do |action| %>
13
17
  <%= action.submit %>
@@ -15,7 +15,7 @@
15
15
  options: names,
16
16
  label: "Truncation Within Typeahead",
17
17
  pills: true,
18
- truncate: 1,
18
+ truncate: "1",
19
19
  }) %>
20
20
 
21
21
  <%= pb_rails("caption", props: { text: "Form Pill Truncation" }) %>
@@ -24,19 +24,19 @@
24
24
  name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
25
25
  avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
26
26
  tabindex: 0,
27
- truncate: 1,
27
+ truncate: "1",
28
28
  id: "truncation-1"
29
29
  }) %>
30
30
  <%= pb_rails("form_pill", props: {
31
31
  icon: "badge-check",
32
32
  text: "icon and a very long tag to show truncation",
33
33
  tabindex: 0,
34
- truncate: 1,
34
+ truncate: "1",
35
35
  id: "truncation-2"
36
36
  }) %>
37
37
  <%= pb_rails("form_pill", props: {
38
38
  text: "form pill long tag no tooltip show truncation",
39
39
  tabindex: 0,
40
- truncate: 1,
40
+ truncate: "1",
41
41
  }) %>
42
- <% end %>
42
+ <% end %>
@@ -21,7 +21,7 @@ const FormPillTruncatedText = (props) => {
21
21
  isMulti
22
22
  label="Truncation Within Typeahead"
23
23
  options={names}
24
- truncate={1}
24
+ truncate={"1"}
25
25
  {...props}
26
26
  />
27
27
  <Caption text="Form Pill Truncation"/>
@@ -31,20 +31,20 @@ const FormPillTruncatedText = (props) => {
31
31
  name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
32
32
  onClick={() => alert('Click!')}
33
33
  tabIndex={0}
34
- truncate={1}
34
+ truncate={"1"}
35
35
  />
36
36
  <FormPill
37
37
  icon="badge-check"
38
38
  onClick={() => {alert('Click!')}}
39
39
  tabIndex={0}
40
40
  text="icon and a very long tag to show truncation"
41
- truncate={1}
41
+ truncate={"1"}
42
42
  />
43
43
  <FormPill
44
44
  onClick={() => {alert('Click!')}}
45
45
  tabIndex={0}
46
46
  text="form pill with a very long tag to show truncation"
47
- truncate={1}
47
+ truncate={"1"}
48
48
  />
49
49
  </Card>
50
50
  </>
@@ -65,7 +65,7 @@
65
65
  }] %>
66
66
 
67
67
  <%= pb_rails("multi_level_select", props: {
68
- id: "multi-level-select-label-rails",
69
- label: "Select a department",
70
- tree_data: treeData
68
+ id: "select_a_department",
69
+ label: "Select a Department",
70
+ tree_data: treeData
71
71
  }) %>
@@ -73,14 +73,11 @@ const MultiLevelSelectDefault = (props) => {
73
73
  return (
74
74
  <div>
75
75
  <MultiLevelSelect
76
- id='multiselect-label'
76
+ id="select_a_department"
77
77
  label="Select a Department"
78
78
  onSelect={(selectedNodes) =>
79
- console.log(
80
- "Selected Items",
81
- selectedNodes
82
- )
83
- }
79
+ console.log("Selected Items", selectedNodes)
80
+ }
84
81
  treeData={treeData}
85
82
  {...props}
86
83
  />
@@ -88,4 +85,4 @@ const MultiLevelSelectDefault = (props) => {
88
85
  )
89
86
  };
90
87
 
91
- export default MultiLevelSelectDefault;
88
+ export default MultiLevelSelectDefault;
@@ -0,0 +1,3 @@
1
+ The MultiLevelSelect component optionally accepts a `label` prop to produce a label above the input.
2
+
3
+ Add an `id` to wire the label to the input so that clicking the label will move focus directly to the input, and open the drop-down.
@@ -120,6 +120,7 @@ const PassphraseMeterSettings = (props) => {
120
120
  "These examples will all share the same input value. Type in any of the inputs to see how the strength meter changes in response to different settings."
121
121
  }
122
122
  </Body>
123
+ <br/>
123
124
  <Passphrase
124
125
  label={"Type your passphrase"}
125
126
  onChange={handleChange}
@@ -0,0 +1,7 @@
1
+ <%= pb_rails("passphrase", props: {
2
+ id: "passphrase_required_indicator",
3
+ label: "Passphrase",
4
+ placeholder: "Enter passphrase",
5
+ required_indicator: true,
6
+ value: "passphrase",
7
+ }) %>
@@ -0,0 +1,24 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Passphrase from '../_passphrase'
4
+
5
+ const PassphraseRequiredIndicator = (props) => {
6
+ const [passphrase, setPassphrase] = useState('')
7
+ const handleOnChangePassphrase = (e) => {
8
+ setPassphrase(e.target ? e.target.value : e)
9
+ }
10
+
11
+ return (
12
+ <Passphrase
13
+ id="passphrase_required_indicator"
14
+ label="Passphrase"
15
+ name="passphrase"
16
+ onChange={handleOnChangePassphrase}
17
+ requiredIndicator
18
+ value={passphrase}
19
+ {...props}
20
+ />
21
+ )
22
+ }
23
+
24
+ export default PassphraseRequiredIndicator
@@ -0,0 +1,3 @@
1
+ The `requiredIndicator`/`required_indicator` prop displays a red asterisk (*) next to the label, visually indicating that the field is required. This is purely visual and does not enforce validation.
2
+
3
+ You can use `requiredIndicator`/`required_indicator` with any validation approach: HTML5 validation via the `required` prop, client-side validation, or backend validation. For this reason, it works independently and doesn't need to be paired with the `required` prop.
@@ -9,6 +9,7 @@ examples:
9
9
  - passphrase_strength_change: Strength Change
10
10
  - passphrase_common: Common Passphrases
11
11
  - passphrase_breached: Breached Passphrases
12
+ - passphrase_required_indicator: Required Indicator
12
13
 
13
14
  react:
14
15
  - passphrase_default: Default
@@ -19,3 +20,4 @@ examples:
19
20
  - passphrase_strength_change: Strength Change
20
21
  - passphrase_common: Common Passphrases
21
22
  - passphrase_breached: Breached Passphrases
23
+ - passphrase_required_indicator: Required Indicator
@@ -6,3 +6,4 @@ export { default as PassphraseTips } from './_passphrase_tips'
6
6
  export { default as PassphraseStrengthChange } from './_passphrase_strength_change'
7
7
  export { default as PassphraseCommon } from './_passphrase_common'
8
8
  export { default as PassphraseBreached } from './_passphrase_breached'
9
+ export { default as PassphraseRequiredIndicator } from './_passphrase_required_indicator.jsx'
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("phone_number_input", props: {
2
+ id: "phone_number_input_required_indicator",
3
+ label: "Required Phone Number",
4
+ required_indicator: true,
5
+ }) %>
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import PhoneNumberInput from '../../pb_phone_number_input/_phone_number_input'
3
+
4
+ const PhoneNumberInputRequiredIndicator = (props) => (
5
+ <>
6
+ <PhoneNumberInput
7
+ id='phone_number_input_required_indicator'
8
+ label='Phone Number'
9
+ requiredIndicator
10
+ {...props} />
11
+ </>
12
+ )
13
+
14
+ export default PhoneNumberInputRequiredIndicator
@@ -0,0 +1,3 @@
1
+ The `requiredIndicator`/`required_indicator` prop displays a red asterisk (*) next to the label, visually indicating that the field is required. This is purely visual and does not enforce validation.
2
+
3
+ You can use `requiredIndicator`/`required_indicator` with any validation approach: HTML5 validation via the `required` prop, client-side validation, or backend validation. For this reason, it works independently and doesn't need to be paired with the `required` prop.
@@ -12,6 +12,7 @@ examples:
12
12
  - phone_number_input_format: Format as You Type
13
13
  - phone_number_input_strict_mode: Strict Mode
14
14
  - phone_number_input_country_search: Country Search
15
+ - phone_number_input_required_indicator: Required Indicator
15
16
 
16
17
  rails:
17
18
  - phone_number_input_default: Default
@@ -24,3 +25,4 @@ examples:
24
25
  - phone_number_input_strict_mode: Strict Mode
25
26
  - phone_number_input_hidden_inputs: Hidden Inputs
26
27
  - phone_number_input_country_search: Country Search
28
+ - phone_number_input_required_indicator: Required Indicator
@@ -9,3 +9,4 @@ export { default as PhoneNumberInputAccessInputElement } from './_phone_number_i
9
9
  export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
10
10
  export { default as PhoneNumberInputStrictMode } from './_phone_number_input_strict_mode'
11
11
  export { default as PhoneNumberInputCountrySearch } from './_phone_number_input_country_search'
12
+ export { default as PhoneNumberInputRequiredIndicator } from './_phone_number_input_required_indicator.jsx'
@@ -0,0 +1,44 @@
1
+ import React from 'react'
2
+ import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
3
+ import { useEditor, EditorContent } from "@tiptap/react"
4
+ import StarterKit from "@tiptap/starter-kit"
5
+ import Link from '@tiptap/extension-link'
6
+
7
+
8
+ const RichTextEditorAdvancedLabel = (props) => {
9
+
10
+ const editor = useEditor({
11
+ extensions: [StarterKit, Link],
12
+ content: "Add your text here. You can format your text, add links, quotes, and bullets.",
13
+ })
14
+
15
+ const editorNoLabel = useEditor({
16
+ extensions: [StarterKit, Link],
17
+ content: "Add your text here. You can format your text, add links, quotes, and bullets.",
18
+ })
19
+
20
+ if (!editor || !editorNoLabel) return null
21
+
22
+ return (
23
+ <div>
24
+ <RichTextEditor
25
+ advancedEditor={editor}
26
+ id={"advanced-example"}
27
+ label="Advanced Example Label"
28
+ {...props}
29
+ >
30
+ <EditorContent editor={editor}/>
31
+ </RichTextEditor>
32
+ <br/>
33
+ <RichTextEditor
34
+ advancedEditor={editorNoLabel}
35
+ label="Advanced Example Label No ID"
36
+ {...props}
37
+ >
38
+ <EditorContent editor={editorNoLabel}/>
39
+ </RichTextEditor>
40
+ </div>
41
+ )
42
+ }
43
+
44
+ export default RichTextEditorAdvancedLabel
@@ -0,0 +1 @@
1
+ The optional `label` prop adds a visible label to the advanced editor. Passing in the `id` prop associates the `label` with the editor for accessibility, enabling screen reader support and label-based focus behavior.
@@ -22,6 +22,7 @@ const RichTextEditorAdvancedRequiredIndicator = (props) => {
22
22
  <div>
23
23
  <RichTextEditor
24
24
  advancedEditor={editor}
25
+ id={"required-advanced"}
25
26
  label="Label"
26
27
  requiredIndicator
27
28
  {...props}
@@ -0,0 +1,28 @@
1
+ import React, { useState } from 'react'
2
+ import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
3
+
4
+ const RichTextEditorLabel = (props) => {
5
+ const [value, setValue] = useState(''),
6
+ handleOnChange = (html) => setValue(html)
7
+
8
+ return (
9
+ <div>
10
+ <RichTextEditor
11
+ id="example"
12
+ label="Example Label"
13
+ onChange={handleOnChange}
14
+ value={value}
15
+ {...props}
16
+ />
17
+ <br/>
18
+ <RichTextEditor
19
+ label="Example Label No ID"
20
+ onChange={handleOnChange}
21
+ value={value}
22
+ {...props}
23
+ />
24
+ </div>
25
+ )
26
+ }
27
+
28
+ export default RichTextEditorLabel
@@ -0,0 +1 @@
1
+ The optional `label` prop adds a visible label to the editor. Passing in the `id` prop associates the `label` with the editor for accessibility, enabling screen reader support and label-based focus behavior.
@@ -8,6 +8,7 @@ const RichTextEditorRequiredIndicator = (props) => {
8
8
  return (
9
9
  <div>
10
10
  <RichTextEditor
11
+ inputOptions = {{ id: "required" }}
11
12
  label="Label"
12
13
  onChange={handleOnChange}
13
14
  requiredIndicator
@@ -32,6 +32,8 @@ examples:
32
32
  - rich_text_editor_advanced_inline: Advanced (Inline)
33
33
  - rich_text_editor_advanced_height: Advanced Height
34
34
  - rich_text_editor_advanced_min_height: Advanced Min Height
35
+ - rich_text_editor_label: Label
36
+ - rich_text_editor_advanced_label: Advanced (Label)
35
37
  - rich_text_editor_required_indicator: Required Indicator
36
38
  - rich_text_editor_advanced_required_indicator: Advanced Required Indicator
37
39
  - rich_text_editor_preview: Preview
@@ -21,3 +21,5 @@ export { default as RichTextEditorAdvancedHeight } from './_rich_text_editor_adv
21
21
  export { default as RichTextEditorAdvancedMinHeight } from './_rich_text_editor_advanced_min_height.jsx'
22
22
  export { default as RichTextEditorRequiredIndicator } from './_rich_text_editor_required_indicator.jsx'
23
23
  export { default as RichTextEditorAdvancedRequiredIndicator } from './_rich_text_editor_advanced_required_indicator.jsx'
24
+ export { default as RichTextEditorLabel } from './_rich_text_editor_label.jsx'
25
+ export { default as RichTextEditorAdvancedLabel } from './_rich_text_editor_advanced_label.jsx'
@@ -1,9 +1,9 @@
1
- <%= pb_rails("textarea", props: { label: "Label", rows: 4}) %>
1
+ <%= pb_rails("textarea", props: { label: "Label", rows: 4, id: "default-example-1" }) %>
2
2
 
3
3
  <br/>
4
4
 
5
- <%= pb_rails("textarea", props: { label: "Label", placeholder: "Placeholder text" }) %>
5
+ <%= pb_rails("textarea", props: { label: "Label", placeholder: "Placeholder text", id: "default-example-2" }) %>
6
6
 
7
7
  <br/>
8
8
 
9
- <%= pb_rails("textarea", props: { label: "Label", name: "comment", value: "Default value text" }) %>
9
+ <%= pb_rails("textarea", props: { label: "Label", name: "comment", value: "Default value text", id: "default-example-3" }) %>
@@ -13,6 +13,7 @@ const TextareaDefault = (props) => {
13
13
  label="Label"
14
14
  rows={4}
15
15
  {...props}
16
+ id="default-example-1"
16
17
  />
17
18
 
18
19
  <br />
@@ -21,6 +22,7 @@ const TextareaDefault = (props) => {
21
22
  label="Label"
22
23
  placeholder="Placeholder text"
23
24
  {...props}
25
+ id="default-example-2"
24
26
  />
25
27
 
26
28
  <br />
@@ -32,6 +34,7 @@ const TextareaDefault = (props) => {
32
34
  placeholder="Placeholder text"
33
35
  value={value}
34
36
  {...props}
37
+ id="default-example-3"
35
38
  />
36
39
 
37
40
  </div>
@@ -0,0 +1 @@
1
+ Add an `id` to your Textarea so that clicking the label will move focus directly to the input.
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import TimePicker from '../../pb_time_picker/_time_picker'
3
3
  import Body from '../../pb_body/_body'
4
+ import Flex from '../../pb_flex/_flex'
4
5
 
5
6
  const TimePickerOnHandler = (props) => {
6
7
  const [selectedTime, setSelectedTime] = useState('')
@@ -17,7 +18,9 @@ const TimePickerOnHandler = (props) => {
17
18
  return (
18
19
  <div>
19
20
  {(selectedTime || closedTime) && (
20
- <div style={{ marginBottom: '16px' }}>
21
+ <Flex marginBottom="sm"
22
+ orientation="column"
23
+ >
21
24
  {selectedTime && (
22
25
  <Body
23
26
  text={`onChange: ${selectedTime}`}
@@ -29,7 +32,7 @@ const TimePickerOnHandler = (props) => {
29
32
  text={`onClose: ${closedTime}`}
30
33
  />
31
34
  )}
32
- </div>
35
+ </Flex>
33
36
  )}
34
37
  <TimePicker
35
38
  id="time-picker-on-handler"
@@ -0,0 +1,6 @@
1
+ <%= pb_rails("time_picker", props: {
2
+ id: "time-picker-required-indicator",
3
+ label: "Select Time",
4
+ required_indicator: true,
5
+ }) %>
6
+
@@ -0,0 +1,16 @@
1
+ import React from 'react'
2
+ import TimePicker from '../_time_picker'
3
+
4
+ const TimePickerRequiredIndicator = (props) => (
5
+ <div>
6
+ <TimePicker
7
+ id="time-picker-required-indicator"
8
+ label="Select Time"
9
+ requiredIndicator
10
+ {...props}
11
+ />
12
+ </div>
13
+ )
14
+
15
+ export default TimePickerRequiredIndicator
16
+
@@ -0,0 +1,3 @@
1
+ The `requiredIndicator`/`required_indicator` prop displays a red asterisk (*) next to the label, visually indicating that the field is required. This is purely visual and does not enforce validation.
2
+
3
+ You can use `requiredIndicator`/`required_indicator` with any validation approach: HTML5 validation via the `required` prop, client-side validation, or backend validation. For this reason, it works independently and doesn't need to be paired with the `required` prop.
@@ -9,6 +9,7 @@ examples:
9
9
  - time_picker_min_max_time: Min & Max Time
10
10
  - time_picker_error: Error
11
11
  - time_picker_disabled: Disabled
12
+ - time_picker_required_indicator: Required Indicator
12
13
  - time_picker_input_options: Input Options
13
14
 
14
15
 
@@ -21,4 +22,5 @@ examples:
21
22
  - time_picker_min_max_time: Min & Max Time
22
23
  - time_picker_error: Error
23
24
  - time_picker_disabled: Disabled
25
+ - time_picker_required_indicator: Required Indicator
24
26
  - time_picker_on_handler: onChange & onClose Handlers
@@ -7,3 +7,4 @@ export { default as TimePickerOnHandler } from './_time_picker_on_handler.jsx'
7
7
  export { default as TimePickerMinMaxTime } from './_time_picker_min_max_time.jsx'
8
8
  export { default as TimePickerError } from './_time_picker_error.jsx'
9
9
  export { default as TimePickerDisabled } from './_time_picker_disabled.jsx'
10
+ export { default as TimePickerRequiredIndicator } from './_time_picker_required_indicator.jsx'
@@ -0,0 +1,16 @@
1
+ <%
2
+ options = [
3
+ { label: 'Orange', value: '#FFA500' },
4
+ { label: 'Red', value: '#FF0000' },
5
+ { label: 'Green', value: '#00FF00' },
6
+ { label: 'Blue', value: '#0000FF' },
7
+ ]
8
+ %>
9
+
10
+ <%= pb_rails("typeahead", props: {
11
+ id: "typeahead-required-indicator",
12
+ is_multi: false,
13
+ label: "Colors",
14
+ options: options,
15
+ required_indicator: true,
16
+ }) %>
@@ -0,0 +1,23 @@
1
+ import React from "react"
2
+ import Typeahead from "../../pb_typeahead/_typeahead"
3
+
4
+ const options = [
5
+ {label: "Orange", value: "#FFA500"},
6
+ {label: "Red", value: "#FF0000"},
7
+ {label: "Green", value: "#00FF00"},
8
+ {label: "Blue", value: "#0000FF"},
9
+ ]
10
+
11
+ const TypeaheadRequiredIndicator = (props) => {
12
+ return (
13
+ <Typeahead
14
+ id="typeahead_required_indicator"
15
+ label="Colors"
16
+ options={options}
17
+ requiredIndicator
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ export default TypeaheadRequiredIndicator
@@ -0,0 +1,3 @@
1
+ The `requiredIndicator`/`required_indicator` prop displays a red asterisk (*) next to the label, visually indicating that the field is required. This is purely visual and does not enforce validation.
2
+
3
+ You can use `requiredIndicator`/`required_indicator` with any validation approach: HTML5 validation via the `required` prop, client-side validation, or backend validation. For this reason, it works independently and doesn't need to be paired with the `required` prop.
@@ -15,5 +15,5 @@
15
15
  options: names,
16
16
  label: "Truncation Within Typeahead",
17
17
  pills: true,
18
- truncate: 1,
18
+ truncate: "1",
19
19
  }) %>
@@ -17,7 +17,7 @@ const TypeaheadTruncatedText = (props) => {
17
17
  isMulti
18
18
  label="Truncation Within Typeahead"
19
19
  options={names}
20
- truncate={1}
20
+ truncate={"1"}
21
21
  {...props}
22
22
  />
23
23
  </>
@@ -19,6 +19,7 @@ examples:
19
19
  - typeahead_dynamic_options_pure_rails: Dynamic Options (Pure Rails)
20
20
  - typeahead_disabled: Disabled
21
21
  - typeahead_preserve_input: Preserve Search Input
22
+ - typeahead_required_indicator: Required Indicator
22
23
 
23
24
  react:
24
25
  - typeahead_default: Default
@@ -42,3 +43,4 @@ examples:
42
43
  - typeahead_truncated_text: Truncated Text
43
44
  - typeahead_disabled: Disabled
44
45
  - typeahead_preserve_input: Preserve Search Input
46
+ - typeahead_required_indicator: Required Indicator
@@ -1,21 +1,22 @@
1
- export { default as TypeaheadDefault } from './_typeahead_default.jsx'
2
- export { default as TypeaheadWithHighlight } from './_typeahead_with_highlight.jsx'
3
- export { default as TypeaheadWithPills } from './_typeahead_with_pills.jsx'
4
- export { default as TypeaheadWithPillsAsync } from './_typeahead_with_pills_async.jsx'
5
- export { default as TypeaheadWithPillsAsyncUsers } from './_typeahead_with_pills_async_users.jsx'
6
- export { default as TypeaheadWithPillsAsyncCustomOptions } from './_typeahead_with_pills_async_custom_options.jsx'
7
- export { default as TypeaheadInline } from './_typeahead_inline.jsx'
8
- export { default as TypeaheadMultiKit } from './_typeahead_multi_kit.jsx'
9
- export { default as TypeaheadCreateable } from './_typeahead_createable.jsx'
10
- export { default as TypeaheadAsyncCreateable } from './_typeahead_async_createable.jsx'
11
- export { default as TypeaheadErrorState } from './_typeahead_error_state.jsx'
12
- export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_list.jsx'
13
- export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
14
- export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
15
- export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
16
- export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
17
- export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
18
- export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'
19
- export { default as TypeaheadDefaultValue } from './_typeahead_default_value.jsx'
20
- export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
21
- export { default as TypeaheadInputDisplay } from './_typeahead_input_display.jsx'
1
+ export {default as TypeaheadDefault} from "./_typeahead_default.jsx"
2
+ export {default as TypeaheadWithHighlight} from "./_typeahead_with_highlight.jsx"
3
+ export {default as TypeaheadWithPills} from "./_typeahead_with_pills.jsx"
4
+ export {default as TypeaheadWithPillsAsync} from "./_typeahead_with_pills_async.jsx"
5
+ export {default as TypeaheadWithPillsAsyncUsers} from "./_typeahead_with_pills_async_users.jsx"
6
+ export {default as TypeaheadWithPillsAsyncCustomOptions} from "./_typeahead_with_pills_async_custom_options.jsx"
7
+ export {default as TypeaheadInline} from "./_typeahead_inline.jsx"
8
+ export {default as TypeaheadMultiKit} from "./_typeahead_multi_kit.jsx"
9
+ export {default as TypeaheadCreateable} from "./_typeahead_createable.jsx"
10
+ export {default as TypeaheadAsyncCreateable} from "./_typeahead_async_createable.jsx"
11
+ export {default as TypeaheadErrorState} from "./_typeahead_error_state.jsx"
12
+ export {default as TypeaheadCustomMenuList} from "./_typeahead_custom_menu_list.jsx"
13
+ export {default as TypeaheadMarginBottom} from "./_typeahead_margin_bottom.jsx"
14
+ export {default as TypeaheadWithPillsColor} from "./_typeahead_with_pills_color.jsx"
15
+ export {default as TypeaheadTruncatedText} from "./_typeahead_truncated_text.jsx"
16
+ export {default as TypeaheadReactHook} from "./_typeahead_react_hook.jsx"
17
+ export {default as TypeaheadDisabled} from "./_typeahead_disabled.jsx"
18
+ export {default as TypeaheadPreserveInput} from "./_typeahead_preserve_input.jsx"
19
+ export {default as TypeaheadDefaultValue} from "./_typeahead_default_value.jsx"
20
+ export {default as TypeaheadCustomOptions} from "./_typeahead_custom_options.jsx"
21
+ export {default as TypeaheadInputDisplay} from "./_typeahead_input_display.jsx"
22
+ export {default as TypeaheadRequiredIndicator} from "./_typeahead_required_indicator.jsx"