playbook_ui_docs 14.19.0 → 14.20.0.pre.alpha.play2168firstcolumnborderbug7950

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 (92) 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.jsx +57 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.md +4 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.jsx +62 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.md +1 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.jsx +82 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.md +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.jsx +66 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +3 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +137 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +3 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +40 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +1 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +5 -1
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +31 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.md +5 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +56 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.md +3 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +58 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.md +3 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +20 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.md +1 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +19 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.md +3 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +20 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +57 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.md +1 -0
  32. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +50 -0
  33. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +105 -0
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +22 -0
  35. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +67 -0
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +11 -0
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +1 -1
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +33 -2
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +3 -1
  40. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +11 -1
  41. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -0
  42. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.html.erb +1 -0
  43. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.jsx +41 -0
  44. data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +2 -0
  45. data/app/pb_kits/playbook/pb_file_upload/docs/index.js +1 -0
  46. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
  47. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
  48. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +11 -11
  49. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +11 -11
  50. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.html.erb +11 -11
  51. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +11 -11
  52. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +11 -11
  53. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +11 -11
  54. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.html.erb +11 -11
  55. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.jsx +11 -11
  56. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.html.erb +11 -11
  57. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.jsx +11 -11
  58. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.html.erb +11 -11
  59. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx +11 -11
  60. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.html.erb +11 -11
  61. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.jsx +11 -11
  62. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +11 -11
  63. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +11 -11
  64. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +11 -11
  65. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +11 -11
  66. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.jsx +11 -11
  67. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +11 -11
  68. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.html.erb +11 -11
  69. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.jsx +11 -11
  70. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.html.erb +11 -11
  71. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.md +2 -0
  72. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids_react.jsx +11 -11
  73. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids_react.md +3 -1
  74. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.html.erb +22 -22
  75. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.jsx +22 -22
  76. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.html.erb +22 -22
  77. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.jsx +22 -22
  78. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +11 -11
  79. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +11 -11
  80. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_form.html.erb +11 -11
  81. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +12 -0
  82. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +31 -0
  83. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +1 -0
  84. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  85. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  86. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.jsx +23 -0
  87. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.md +1 -0
  88. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
  89. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  90. data/dist/playbook-doc.js +2 -2
  91. metadata +38 -3
  92. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
@@ -0,0 +1,58 @@
1
+ import React from 'react'
2
+ import Dropdown from '../../pb_dropdown/_dropdown'
3
+
4
+ const DropdownMultiSelectDisplay = (props) => {
5
+
6
+ const options = [
7
+ {
8
+ label: "United States",
9
+ value: "United States",
10
+ },
11
+ {
12
+ label: "United Kingdom",
13
+ value: "United Kingdom",
14
+ },
15
+ {
16
+ label: "Canada",
17
+ value: "Canada",
18
+ },
19
+ {
20
+ label: "Pakistan",
21
+ value: "Pakistan",
22
+ },
23
+ {
24
+ label: "India",
25
+ value: "India",
26
+ },
27
+ {
28
+ label: "Australia",
29
+ value: "Australia",
30
+ },
31
+ {
32
+ label: "New Zealand",
33
+ value: "New Zealand",
34
+ },
35
+ {
36
+ label: "Italy",
37
+ value: "Italy",
38
+ },
39
+ {
40
+ label: "Spain",
41
+ value: "Spain",
42
+ }
43
+ ];
44
+
45
+
46
+ return (
47
+ <div>
48
+ <Dropdown
49
+ formPillProps={{size:"small", color:"neutral"}}
50
+ multiSelect
51
+ options={options}
52
+ {...props}
53
+ />
54
+ </div>
55
+ )
56
+ }
57
+
58
+ export default DropdownMultiSelectDisplay
@@ -0,0 +1,3 @@
1
+ By default, the `multiSelect` prop will render selected options as the default FormPill. `FormPillProps` however can be used to customize these Pills with any props that exist for the FormPill.
2
+
3
+ This prop must be an object that contains valid FormPill props. For a full list of FormPill props, see [here](https://playbook.powerapp.cloud/kits/form_pill/react).
@@ -0,0 +1,20 @@
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
+ <%= pb_rails("dropdown", props: {
17
+ options: options,
18
+ multi_select: true,
19
+ form_pill_props: { size:"small", color:"neutral" },
20
+ }) %>
@@ -0,0 +1 @@
1
+ By default, the `multi_select` prop will render selected options as the default form_pill. `form_pill_props` however can be used to customize these Pills with props that exist for the form_pill. Currently, only the '[color](https://playbook.powerapp.cloud/kits/form_pill/rails#form-pill-colors)' and '[size](https://playbook.powerapp.cloud/kits/form_pill/rails#form-pill-size)' props are supported as shown here.
@@ -0,0 +1,19 @@
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
+ <%= pb_rails("dropdown", props: {
17
+ options: options,
18
+ multi_select: true,
19
+ }) %>
@@ -0,0 +1,3 @@
1
+ `multi_select` is a boolean prop that if set to true will allow for multiple options to be selected from the Dropdown.
2
+
3
+ `multi_select` is set to false by default.
@@ -0,0 +1,20 @@
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
+ <%= pb_rails("dropdown", props: {
17
+ autocomplete: true,
18
+ options: options,
19
+ multi_select: true,
20
+ }) %>
@@ -0,0 +1,57 @@
1
+ import React from 'react'
2
+ import Dropdown from '../../pb_dropdown/_dropdown'
3
+
4
+ const DropdownMultiSelectWithAutocomplete = (props) => {
5
+
6
+ const options = [
7
+ {
8
+ label: "United States",
9
+ value: "United States",
10
+ },
11
+ {
12
+ label: "United Kingdom",
13
+ value: "United Kingdom",
14
+ },
15
+ {
16
+ label: "Canada",
17
+ value: "Canada",
18
+ },
19
+ {
20
+ label: "Pakistan",
21
+ value: "Pakistan",
22
+ },
23
+ {
24
+ label: "India",
25
+ value: "India",
26
+ },
27
+ {
28
+ label: "Australia",
29
+ value: "Australia",
30
+ },
31
+ {
32
+ label: "New Zealand",
33
+ value: "New Zealand",
34
+ },
35
+ {
36
+ label: "Italy",
37
+ value: "Italy",
38
+ },
39
+ {
40
+ label: "Spain",
41
+ value: "Spain",
42
+ }
43
+ ];
44
+
45
+ return (
46
+ <div>
47
+ <Dropdown
48
+ autocomplete
49
+ multiSelect
50
+ options={options}
51
+ {...props}
52
+ />
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default DropdownMultiSelectWithAutocomplete
@@ -0,0 +1 @@
1
+ `multiSelect` can also be used with the `autocomplete` functionality.
@@ -0,0 +1,50 @@
1
+ <%
2
+ options = [
3
+ {
4
+ label: "United States",
5
+ value: "United States",
6
+ areaCode: "+1",
7
+ icon: "🇺🇸",
8
+ id: "us"
9
+ },
10
+ {
11
+ label: "Canada",
12
+ value: "Canada",
13
+ areaCode: "+1",
14
+ icon: "🇨🇦",
15
+ id: "ca"
16
+ },
17
+ {
18
+ label: "Pakistan",
19
+ value: "Pakistan",
20
+ areaCode: "+92",
21
+ icon: "🇵🇰",
22
+ id: "pk"
23
+ }
24
+ ]
25
+
26
+ %>
27
+
28
+ <%= pb_rails("dropdown", props: { options: options, multi_select: true }) do %>
29
+ <%= pb_rails("dropdown/dropdown_trigger", props:{ multi_select: true }) %>
30
+ <%= pb_rails("dropdown/dropdown_container") do %>
31
+ <% options.each do |option| %>
32
+ <%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
33
+ <%= pb_rails("flex", props: {
34
+ align: "center",
35
+ justify: "between",
36
+ }) do %>
37
+ <%= pb_rails("flex/flex_item") do %>
38
+ <%= pb_rails("flex") do %>
39
+ <%= pb_rails("icon", props: {icon: option[:icon]}) %>
40
+ <%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
41
+ <% end %>
42
+ <% end %>
43
+ <%= pb_rails("flex/flex_item") do %>
44
+ <%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
45
+ <% end %>
46
+ <% end %>
47
+ <% end %>
48
+ <% end %>
49
+ <% end %>
50
+ <% end %>
@@ -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;
@@ -6,6 +6,7 @@ import Flex from '../../pb_flex/_flex'
6
6
  import FlexItem from '../../pb_flex/_flex_item'
7
7
  import Avatar from '../../pb_avatar/_avatar'
8
8
  import User from '../../pb_user/_user'
9
+ import Body from '../../pb_body/_body'
9
10
 
10
11
  const DropdownWithCustomDisplay = (props) => {
11
12
  const [selectedOption, setSelectedOption] = useState();
@@ -50,10 +51,20 @@ const DropdownWithCustomDisplay = (props) => {
50
51
  <>
51
52
  {
52
53
  selectedOption && (
54
+ <Flex align="center">
53
55
  <Avatar
54
56
  name={selectedOption.label}
55
57
  size="xs"
56
58
  />
59
+ <Body
60
+ marginX="xs"
61
+ text={selectedOption.label}
62
+ />
63
+ <Badge
64
+ text={selectedOption.status}
65
+ variant={selectedOption.status == "Offline" ? "neutral" : selectedOption.status == "Online" ? "success" : "warning"}
66
+ />
67
+ </Flex>
57
68
  )
58
69
  }
59
70
  </>
@@ -1,4 +1,4 @@
1
- Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected. The component passed to customDisplay will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
1
+ Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected. Pass in any combination of kits to create a custom display. When a user clicks on an option, the kits passed into `customDisplay` will display as the selected option.
2
2
 
3
3
  The `placeholder` prop can also be used to customize the placeholder text for the default `Dropdown.Trigger`.
4
4
 
@@ -38,7 +38,11 @@
38
38
 
39
39
  <%
40
40
  custom_display = capture do
41
- pb_rails("avatar", props: { name: "Courtney Long", size: "xs" })
41
+ pb_rails("flex", props: { align: "center" }) do
42
+ concat(pb_rails("avatar", props: { name: "", size: "xs", id: "dropdown-avatar" }))
43
+ concat(pb_rails("body", props: { text: "", size: "xs", margin_x: "xs", id: "dropdown-avatar-name" }))
44
+ concat(pb_rails("badge", props: { text: "", id: "dropdown-avatar-status" }))
45
+ end
42
46
  end
43
47
  %>
44
48
 
@@ -62,4 +66,31 @@
62
66
  <% end %>
63
67
  <% end %>
64
68
  <% end %>
65
- <% end %>
69
+ <% end %>
70
+
71
+
72
+ <script>
73
+ document.addEventListener("pb:dropdown:selected", (e) => {
74
+ const option = e.detail;
75
+ const dropdown = e.target;
76
+
77
+ const display = dropdown.querySelector("#dropdown_trigger_custom_display");
78
+ if (!display) return;
79
+
80
+ const nameEl = display.querySelector("#dropdown-avatar-name");
81
+ if (nameEl) nameEl.textContent = option.label;
82
+
83
+ const avatarEl = display.querySelector("#dropdown-avatar").querySelector(".avatar_wrapper");
84
+ const initials = (option.label[0] + option.label.split(" ").pop()[0]).toUpperCase();
85
+ if (avatarEl) {
86
+ avatarEl.dataset.name = option.label;
87
+ avatarEl.setAttribute("data-initials", initials);
88
+ }
89
+ const badgeEl = display.querySelector("#dropdown-avatar-status");
90
+ const variant = option.status === "Online" ? "success" : option.status === "Offline" ? "neutral" : "warning";
91
+ if (badgeEl) {
92
+ badgeEl.querySelector("span").textContent = option.status;
93
+ badgeEl.className = 'pb_badge_kit_' + variant;
94
+ }
95
+ });
96
+ </script>
@@ -1,4 +1,6 @@
1
- Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected. The component passed to custom_display will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
1
+ Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected. Pass in any combination of kits to create a custom display. When a user clicks on an option, the kits passed into `custom_display` will display as the selected option.
2
+
3
+ Make use of a script to help set the custom_display with the correct value. By using the pb:dropdown:selected event listener, you can target the kits with a querySelector and update them dynamically with the values needed to match the selected option. Make sure to add an ID to the kits being passed in.
2
4
 
3
5
  The `placeholder` prop can also be used to customize the placeholder text for the default `dropdown/dropdown_trigger`.
4
6
 
@@ -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'
@@ -0,0 +1 @@
1
+ <%= pb_rails("file_upload", props: {id: "error", error: raw(pb_rails("icon", props: { icon: "warning" }) + " Please upload a valid file")}) %>
@@ -0,0 +1,41 @@
1
+ import React, { useState } from 'react'
2
+ import FileUpload from '../_file_upload'
3
+ import List from '../../pb_list/_list'
4
+ import ListItem from '../../pb_list/_list_item'
5
+ import Icon from '../../pb_icon/_icon'
6
+
7
+ const AcceptedFilesList = ({ files }) => (
8
+ <List>
9
+ {files.map((file) => (
10
+ <ListItem key={file.name}>{file.name}</ListItem>
11
+ ))}
12
+ </List>
13
+ )
14
+
15
+ const FileUploadError = (props) => {
16
+ const [filesToUpload, setFilesToUpload] = useState([])
17
+
18
+ const handleOnFilesAccepted = (files) => {
19
+ setFilesToUpload([...filesToUpload, ...files])
20
+ }
21
+
22
+ const error = (<>
23
+ <Icon icon="warning" /> Please upload a valid file
24
+ </>)
25
+
26
+ return (
27
+ <div>
28
+ <AcceptedFilesList
29
+ files={filesToUpload}
30
+ {...props}
31
+ />
32
+ <FileUpload
33
+ error={error}
34
+ onFilesAccepted={handleOnFilesAccepted}
35
+ {...props}
36
+ />
37
+ </div>
38
+ )
39
+ }
40
+
41
+ export default FileUploadError
@@ -3,6 +3,7 @@ examples:
3
3
  rails:
4
4
  - file_upload_default: File Upload
5
5
  - file_upload_custom: Custom
6
+ - file_upload_error: Error
6
7
 
7
8
  react:
8
9
  - file_upload_default: Default List of files to upload
@@ -10,3 +11,4 @@ examples:
10
11
  - file_upload_custom_message: Add a custom message
11
12
  - file_upload_custom_description: Add your one accepted files description
12
13
  - file_upload_max_size: Set a file size limit
14
+ - file_upload_error: Error
@@ -3,3 +3,4 @@ export { default as FileUploadAccept } from './_file_upload_accept.jsx'
3
3
  export { default as FileUploadCustomMessage } from './_file_upload_custom_message.jsx'
4
4
  export { default as FileUploadCustomDescription } from './_file_upload_custom_description.jsx'
5
5
  export { default as FileUploadMaxSize } from './_file_upload_max_size.jsx'
6
+ export { default as FileUploadError } from './_file_upload_error.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,