playbook_ui_docs 14.20.0.pre.rc.2 → 14.21.0.pre.rc.0

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +6 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.jsx +1 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +3 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +137 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +3 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +40 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +1 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
  11. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +31 -0
  12. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.md +5 -0
  13. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +56 -0
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.md +3 -0
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +58 -0
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.md +3 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +20 -0
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.md +1 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +19 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.md +3 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +20 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +57 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.md +1 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +50 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +105 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +22 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +67 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +11 -1
  29. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -0
  30. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
  31. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
  32. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +12 -0
  33. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +31 -0
  34. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +1 -0
  35. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  36. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  37. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.jsx +23 -0
  38. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.md +1 -0
  39. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
  40. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  41. data/dist/playbook-doc.js +2 -2
  42. metadata +28 -3
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
@@ -0,0 +1,105 @@
1
+ import React from 'react'
2
+ import Dropdown from '../../pb_dropdown/_dropdown'
3
+ import Body from '../../pb_body/_body'
4
+ import Flex from '../../pb_flex/_flex'
5
+ import FlexItem from '../../pb_flex/_flex_item'
6
+ import Icon from '../../pb_icon/_icon'
7
+
8
+ const DropdownMultiSelectWithCustomOptions = (props) => {
9
+
10
+ const options = [
11
+ {
12
+ label: "United States",
13
+ value: "United States",
14
+ areaCode: "+1",
15
+ icon: "🇺🇸",
16
+ id: "United-states"
17
+ },
18
+ {
19
+ label: "Canada",
20
+ value: "Canada",
21
+ areaCode: "+1",
22
+ icon: "🇨🇦",
23
+ id: "canada"
24
+ },
25
+ {
26
+ label: "Pakistan",
27
+ value: "Pakistan",
28
+ areaCode: "+92",
29
+ icon: "🇵🇰",
30
+ id: "pakistan"
31
+ },
32
+ {
33
+ label: "India",
34
+ value: "India",
35
+ areaCode: "+91",
36
+ icon: "🇮🇳",
37
+ id: "india"
38
+ },
39
+ {
40
+ label: "Australia",
41
+ value: "Australia",
42
+ areaCode: "+61",
43
+ icon: "🇦🇺",
44
+ id: "australia"
45
+ },
46
+ {
47
+ label: "New Zealand",
48
+ value: "New Zealand",
49
+ areaCode: "+64",
50
+ icon: "🇳🇿",
51
+ id: "new-zealand"
52
+ },
53
+ {
54
+ label: "Italy",
55
+ value: "Italy",
56
+ areaCode: "+39",
57
+ icon: "🇮🇹",
58
+ id: "italy"
59
+ },
60
+ {
61
+ label: "Spain",
62
+ value: "Spain",
63
+ areaCode: "+34",
64
+ icon: "🇪🇸",
65
+ id: "spain"
66
+ }
67
+ ];
68
+
69
+ return (
70
+ <div>
71
+ <Dropdown
72
+ multiSelect
73
+ options={options}
74
+ {...props}
75
+ >
76
+ {options.map((option) => (
77
+ <Dropdown.Option key={option.id}
78
+ option={option}
79
+ >
80
+ <Flex
81
+ align="center"
82
+ justify="between"
83
+ >
84
+ <FlexItem>
85
+ <Flex>
86
+ <Icon icon={option.icon}
87
+ paddingRight="xs"
88
+ />
89
+ <Body text={option.label} />
90
+ </Flex>
91
+ </FlexItem>
92
+ <FlexItem>
93
+ <Body color="light"
94
+ text={option.areaCode}
95
+ />
96
+ </FlexItem>
97
+ </Flex>
98
+ </Dropdown.Option>
99
+ ))}
100
+ </Dropdown>
101
+ </div>
102
+ )
103
+ }
104
+
105
+ export default DropdownMultiSelectWithCustomOptions
@@ -0,0 +1,22 @@
1
+ <%
2
+ options = [
3
+ { label: 'United States', value: 'United States', id: 'us' },
4
+ { label: 'Canada', value: 'Canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
6
+ { label: 'India', value: 'India', id: 'in' },
7
+ { label: 'United Kingdom', value: 'United Kingdom', id: 'uk' },
8
+ { label: 'Australia', value: 'Australia', id: 'au' },
9
+ { label: 'New Zealand', value: 'New Zealand', id: 'nz' },
10
+ { label: 'Germany', value: 'Germany', id: 'de' },
11
+ { label: 'France', value: 'France', id: 'fr' },
12
+ { label: 'Italy', value: 'Italy', id: 'it' },
13
+ ]
14
+ %>
15
+
16
+ <%
17
+ default_value = [
18
+ { label: 'United States', value: 'United States', id: 'us' },
19
+ { label: 'Canada', value: 'Canada', id: 'ca' },
20
+ ]
21
+ %>
22
+ <%= pb_rails("dropdown", props: {options: options, multi_select: true, default_value: default_value}) %>
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import Dropdown from "../../pb_dropdown/_dropdown";
3
+
4
+ const DropdownMultiSelectWithDefault = (props) => {
5
+ const options = [
6
+ {
7
+ label: "United States",
8
+ value: "United States",
9
+ },
10
+ {
11
+ label: "United Kingdom",
12
+ value: "United Kingdom",
13
+ },
14
+ {
15
+ label: "Canada",
16
+ value: "Canada",
17
+ },
18
+ {
19
+ label: "Pakistan",
20
+ value: "Pakistan",
21
+ },
22
+ {
23
+ label: "India",
24
+ value: "India",
25
+ },
26
+ {
27
+ label: "Australia",
28
+ value: "Australia",
29
+ },
30
+ {
31
+ label: "New Zealand",
32
+ value: "New Zealand",
33
+ },
34
+ {
35
+ label: "Italy",
36
+ value: "Italy",
37
+ },
38
+ {
39
+ label: "Spain",
40
+ value: "Spain",
41
+ },
42
+ ];
43
+
44
+ const defaultSelectedOptions = [
45
+ {
46
+ label: "United States",
47
+ value: "United States",
48
+ },
49
+ {
50
+ label: "Italy",
51
+ value: "Italy",
52
+ },
53
+ ];
54
+
55
+ return (
56
+ <div>
57
+ <Dropdown
58
+ defaultValue={defaultSelectedOptions}
59
+ multiSelect
60
+ options={options}
61
+ {...props}
62
+ />
63
+ </div>
64
+ );
65
+ };
66
+
67
+ export default DropdownMultiSelectWithDefault;
@@ -1,35 +1,45 @@
1
1
  examples:
2
2
  rails:
3
- - dropdown_default: Default
3
+ - dropdown_default_rails: Default
4
4
  - dropdown_with_autocomplete: Autocomplete
5
+ - dropdown_multi_select_rails: Multi Select
6
+ - dropdown_multi_select_with_autocomplete: Multi Select with Autocomplete
7
+ - dropdown_multi_select_display_rails: Multi Select with Form Pill Props
5
8
  - dropdown_subtle_variant: Subtle Variant
6
9
  - dropdown_subcomponent_structure_rails: Subcomponent Structure
7
10
  - dropdown_with_autocomplete_with_subcomponents: Autocomplete with Subcomponent Structure
8
11
  - dropdown_with_label: With Label
9
12
  - dropdown_with_custom_options_rails: Custom Options
13
+ - dropdown_multi_select_with_custom_options: Multi Select with Custom Options
10
14
  - dropdown_with_custom_display_rails: Custom Display
11
15
  - dropdown_with_custom_trigger_rails: Custom Trigger
12
16
  - dropdown_with_search_rails: Custom Trigger Dropdown with Search
13
17
  - dropdown_with_custom_padding: Custom Option Padding
14
18
  - dropdown_error: Dropdown with Error
15
19
  - dropdown_default_value: Default Value
20
+ - dropdown_multi_select_with_default: Multi Select Default Value
16
21
  - dropdown_blank_selection: Blank Selection
17
22
  - dropdown_separators_hidden: Separators Hidden
18
23
 
19
24
  react:
20
25
  - dropdown_default: Default
21
26
  - dropdown_with_autocomplete: Autocomplete
27
+ - dropdown_multi_select: Multi Select
28
+ - dropdown_multi_select_with_autocomplete: Multi Select with Autocomplete
29
+ - dropdown_multi_select_display: Multi Select with Form Pill Props
22
30
  - dropdown_subtle_variant: Subtle Variant
23
31
  - dropdown_subcomponent_structure: Subcomponent Structure
24
32
  - dropdown_with_autocomplete_with_subcomponents: Autocomplete with Subcomponent Structure
25
33
  - dropdown_with_label: With Label
26
34
  - dropdown_with_custom_options: Custom Options
35
+ - dropdown_multi_select_with_custom_options: Multi Select with Custom Options
27
36
  - dropdown_with_custom_display: Custom Display
28
37
  - dropdown_with_custom_trigger: Custom Trigger
29
38
  - dropdown_with_search: Custom Trigger Dropdown with Search
30
39
  - dropdown_with_custom_padding: Custom Option Padding
31
40
  - dropdown_error: Dropdown with Error
32
41
  - dropdown_default_value: Default Value
42
+ - dropdown_multi_select_with_default: Multi Select Default Value
33
43
  - dropdown_blank_selection: Blank Selection
34
44
  - dropdown_clear_selection: Clear Selection
35
45
  - dropdown_separators_hidden: Separators Hidden
@@ -15,3 +15,8 @@ export { default as DropdownClearSelection } from './_dropdown_clear_selection.j
15
15
  export { default as DropdownSubtleVariant } from './_dropdown_subtle_variant.jsx'
16
16
  export { default as DropdownSeparatorsHidden } from './_dropdown_separators_hidden.jsx'
17
17
  export {default as DropdownWithSearch} from './_dropdown_with_search.jsx'
18
+ export { default as DropdownMultiSelect } from './_dropdown_multi_select.jsx'
19
+ export { default as DropdownMultiSelectDisplay } from './_dropdown_multi_select_display.jsx'
20
+ export { default as DropdownMultiSelectWithAutocomplete } from './_dropdown_multi_select_with_autocomplete.jsx'
21
+ export { default as DropdownMultiSelectWithDefault } from './_dropdown_multi_select_with_default.jsx'
22
+ export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
@@ -99,6 +99,7 @@
99
99
  <%= form.url_field :example_url_field, props: { label: true } %>
100
100
  <%= form.text_area :example_text_area, props: { label: true } %>
101
101
  <%= form.dropdown_field :example_dropdown, props: { label: true, options: example_dropdown_options } %>
102
+ <%= form.dropdown_field :example_dropdown_multi, props: { label: true, options: example_dropdown_options, multi_select: true } %>
102
103
  <%= form.select :example_select, [ ["Yes", 1], ["No", 2] ], props: { label: true } %>
103
104
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
104
105
  <%= form.check_box :example_checkbox,
@@ -98,6 +98,7 @@
98
98
  <%= form.url_field :example_url_field_validation, props: { label: true, required: true } %>
99
99
  <%= form.text_area :example_text_area_validation, props: { label: true, required: true } %>
100
100
  <%= form.dropdown_field :example_dropdown_validation, props: { label: true, options: example_dropdown_options, required: true } %>
101
+ <%= form.dropdown_field :example_dropdown_validation_multi, props: { label: true, options: example_dropdown_options, multi_select: true, required: true } %>
101
102
  <%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true, validation_message: "Please, select an option." } %>
102
103
  <%= form.collection_select :example_collection_select_validation, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
103
104
  <%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("select", props: { label: "Favorite Animal" }) do %>
2
+ <select name="animal" id="animal">
3
+ <optgroup label="Mammal">
4
+ <option value="1">Cat</option>
5
+ <option value="2">Dog</option>
6
+ </optgroup>
7
+ <optgroup label="Amphibian">
8
+ <option value="3">Frog</option>
9
+ <option value="4">Salamander</option>
10
+ </optgroup>
11
+ </select>
12
+ <% end %>
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+
3
+ import Select from '../_select'
4
+
5
+ const SelectCustomSelectSubheaders = (props) => {
6
+ return (
7
+ <div>
8
+ <Select
9
+ label="Favorite Animal"
10
+ {...props}
11
+ >
12
+ <select
13
+ id="animal"
14
+ name="animal"
15
+ {...props}
16
+ >
17
+ <optgroup label="Mammal">
18
+ <option value="1">{'Cat'}</option>
19
+ <option value="2">{'Dog'}</option>
20
+ </optgroup>
21
+ <optgroup label="Amphibian">
22
+ <option value="3">{'Frog'}</option>
23
+ <option value="4">{'Salamander'}</option>
24
+ </optgroup>
25
+ </select>
26
+ </Select>
27
+ </div>
28
+ )
29
+ }
30
+
31
+ export default SelectCustomSelectSubheaders
@@ -0,0 +1 @@
1
+ To create a select with non-selectable subheaders, use a Custom Select component to render a native `<select>` containing `<optgroup>` elements. The [optgroup HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/optgroup) groups related options under a non-selectable label in the dropdown.
@@ -8,6 +8,7 @@ examples:
8
8
  - select_required: Required Select Field
9
9
  - select_value_text_same: Equal option value and value text
10
10
  - select_custom_select: Custom Select
11
+ - select_custom_select_subheaders: Custom Select Subheaders
11
12
  - select_error: Select w/ Error
12
13
  - select_inline: Select Inline
13
14
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -25,6 +26,7 @@ examples:
25
26
  - select_required: Required Select Field
26
27
  - select_value_text_same: Equal option value and value text
27
28
  - select_custom_select: Custom Select
29
+ - select_custom_select_subheaders: Custom Select Subheaders
28
30
  - select_error: Select w/ Error
29
31
  - select_inline: Select Inline
30
32
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -11,3 +11,4 @@ export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.js
11
11
  export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
12
12
  export { default as SelectMultiple } from './_select_multiple.jsx'
13
13
  export { default as SelectReactHook } from './_select_react_hook.jsx'
14
+ export { default as SelectCustomSelectSubheaders } from './_select_custom_select_subheaders.jsx'
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+
3
+ import Typeahead from '../_typeahead'
4
+
5
+ const options = [
6
+ { label: 'Orange', value: '#FFA500' },
7
+ { label: 'Red', value: '#FF0000' },
8
+ { label: 'Green', value: '#00FF00' },
9
+ { label: 'Blue', value: '#0000FF' },
10
+ ]
11
+
12
+ const TypeaheadPreserveInput = (props) => {
13
+ return (
14
+ <Typeahead
15
+ label="Colors"
16
+ options={options}
17
+ preserveSearchInput
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ export default TypeaheadPreserveInput
@@ -0,0 +1 @@
1
+ By default, text is not preserved in the typeahead kit when you click off of the input field. You can utilize the `preserveSearchInput` prop in order to prevent text from being cleared when the field loses focus
@@ -34,3 +34,4 @@ examples:
34
34
  - typeahead_with_pills_color: With Pills (Custom Color)
35
35
  - typeahead_truncated_text: Truncated Text
36
36
  - typeahead_disabled: Disabled
37
+ - typeahead_preserve_input: Preserve Search Input
@@ -15,3 +15,4 @@ export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_colo
15
15
  export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
16
16
  export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
17
17
  export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
18
+ export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'