playbook_ui 13.27.0.pre.alpha.PLAY1342DRYcontenttagRailssimplekits2896 → 13.27.0.pre.alpha.testingcollapsible2912
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +5 -1
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +6 -1
- data/app/pb_kits/playbook/pb_badge/badge.html.erb +6 -1
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +6 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +19 -10
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.html.erb +23 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +76 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_collapsible/index.js +16 -6
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +6 -1
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +5 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.md +6 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +6 -1
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +6 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_label_pill/label_pill.html.erb +6 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_message/message_mention.html.erb +6 -6
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +6 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -1
- data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +6 -1
- data/app/pb_kits/playbook/pb_person/person.html.erb +6 -1
- data/app/pb_kits/playbook/pb_person_contact/person_contact.html.erb +6 -1
- data/app/pb_kits/playbook/pb_pill/pill.html.erb +6 -1
- data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +6 -1
- data/app/pb_kits/playbook/pb_source/source.html.erb +5 -1
- data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +5 -1
- data/app/pb_kits/playbook/pb_stat_value/stat_value.html.erb +5 -1
- data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timeline/timeline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +6 -1
- data/app/pb_kits/playbook/pb_title_count/title_count.html.erb +6 -1
- data/app/pb_kits/playbook/pb_title_detail/title_detail.html.erb +5 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +6 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-rails.js +2 -2
- data/lib/playbook/kit_base.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +12 -6
- /data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_subcomponent_structure.html.erb → _dropdown_subcomponent_structure_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_display.html.erb → _dropdown_with_custom_display_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_options.html.erb → _dropdown_with_custom_options_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_trigger.html.erb → _dropdown_with_custom_trigger_rails.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 139239375cde8415b10b6381e0d294df8666584609ff6c16002aab7f8cb2d5fa
|
4
|
+
data.tar.gz: 870ef281c575c7e7c752df452e3c368a197f0adfdbd9a7659259a7b713d4772d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 031cc99959af36b9584cf2a68cd7e0dd69fa59908292e5c7865d9d44329ca6955c1968fa3000b724aef7e6416fcb67f08a3dea5542a88d99234e0d79176b0345
|
7
|
+
data.tar.gz: 6614ed6e1c90b0d1c9e404952b1ef22759bd710389a156e821c796b550fca8bcb680615ddb2ee723ab7dc1f0a6c48af5ebfb5c43f58c7b67ce073a4c48defb5c
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id) do %>
|
2
6
|
<%= pb_rails("table", props: { size: "sm", tag:"div", data_table: true, number_spacing:"tabular", responsive:"none" }) do %>
|
3
7
|
<% if content.present? %>
|
4
8
|
<% content.presence %>
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id) do %>
|
2
6
|
<%= pb_rails("table/table_row", props: {tag:"div"}) do %>
|
3
7
|
<% object.column_definitions.each_with_index do |item, index| %>
|
4
8
|
<%= pb_rails("table/table_header", props: { tag:"div", id:item[:accessor], classname:object.th_classname}) do %>
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id) do %>
|
2
6
|
<% object.column_definitions.each_with_index do |column, index| %>
|
3
7
|
<%= pb_rails("table/table_cell", props: { tag:"div", classname:object.td_classname}) do %>
|
4
8
|
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end" }) do %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<% if object.tooltip_text.present? %>
|
3
8
|
<%= pb_rails("tooltip", props: {
|
4
9
|
trigger_element_id: object.tooltip_id,
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("button", props: {type: object.type, link: object.link, new_window:object.new_window, variant: object.variant, disabled: object.disabled, dark: object.dark}) do %>
|
3
8
|
<%= pb_rails("icon", props: {icon: object.icon, fixed_width: true, dark: object.dark}) %>
|
4
9
|
<% end %>
|
@@ -52,12 +52,15 @@ const Collapsible = ({
|
|
52
52
|
if (CollapsibleParent.length !== 2) {
|
53
53
|
throw new Error('Collapsible requires <CollapsibleMain> and <CollapsibleContent> to function properly.')
|
54
54
|
}
|
55
|
+
const FirstChild = CollapsibleParent[0]
|
56
|
+
const SecondChild = CollapsibleParent[1]
|
55
57
|
|
56
|
-
const Main =
|
57
|
-
const Content =
|
58
|
+
const Main = FirstChild.type === CollapsibleMain ? FirstChild : null
|
59
|
+
const Content = SecondChild.type === CollapsibleContent ? SecondChild : null
|
58
60
|
|
59
|
-
|
60
|
-
const { children:
|
61
|
+
|
62
|
+
const { children: mainChildren = null, ...mainProps } = Main ? Main.props : {}
|
63
|
+
const { children: contentChildren = null, ...contentProps } = Content ? Content.props : {}
|
61
64
|
const ariaProps = buildAriaProps(aria)
|
62
65
|
const dataProps = buildDataProps(data)
|
63
66
|
const htmlProps = buildHtmlProps(htmlOptions)
|
@@ -75,13 +78,19 @@ const Collapsible = ({
|
|
75
78
|
className={classes}
|
76
79
|
id={id}
|
77
80
|
>
|
78
|
-
|
79
|
-
{
|
80
|
-
|
81
|
+
{Main ? (
|
82
|
+
<CollapsibleMain {...mainProps}>
|
83
|
+
{mainChildren}
|
84
|
+
</CollapsibleMain>
|
85
|
+
) : (
|
86
|
+
FirstChild
|
87
|
+
)}
|
81
88
|
|
82
|
-
|
83
|
-
{
|
84
|
-
|
89
|
+
{Content && (
|
90
|
+
<CollapsibleContent {...contentProps}>
|
91
|
+
{contentChildren}
|
92
|
+
</CollapsibleContent>
|
93
|
+
)}
|
85
94
|
</div>
|
86
95
|
</CollapsibleContext.Provider>
|
87
96
|
)
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
aria: object.aria,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
|
3
8
|
<%= pb_rails("flex", props: {vertical: "center", spacing: "between", cursor: "pointer"}) do %>
|
4
9
|
<%= pb_rails("flex/flex_item") do %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= pb_rails("collapsible", props: { name: "default-example" }) do %>
|
2
|
+
<%= pb_rails("background", props: { background_color: "white", position: "sticky", top: "0", cursor:"pointer", data: {"collapsible-main": "true"} }) do %>
|
3
|
+
<%= pb_rails("flex", props: {align:"center", gap:"sm", justify:"between"}) do %>
|
4
|
+
<%= pb_rails("title", props: { text: "Custom Main Section", tag: "h4", size: 4 }) %>
|
5
|
+
<%= pb_rails("icon_circle", props: {
|
6
|
+
icon: "check",
|
7
|
+
size: "xs"
|
8
|
+
}) %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<%= pb_rails("flex", props: { align: "center", justify: "between" }) do %>
|
12
|
+
<% end %>
|
13
|
+
<%= pb_rails("collapsible/collapsible_content", props: { padding: "none" }) do %>
|
14
|
+
<%= pb_rails("list", props: {ordered: false, dark: false, borderless: false}) do %>
|
15
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
16
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
17
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
18
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
19
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Collapsible, useCollapsible, Background, Flex, Title, IconCircle, List, ListItem } from '../..'
|
3
|
+
|
4
|
+
const CollapsibleCustomMain = () => {
|
5
|
+
const [isCollapsed, setIsCollapsed] = useCollapsible(true)
|
6
|
+
|
7
|
+
return (
|
8
|
+
<>
|
9
|
+
<Collapsible
|
10
|
+
collapsed={isCollapsed}
|
11
|
+
>
|
12
|
+
<Background
|
13
|
+
backgroundColor="white"
|
14
|
+
cursor="pointer"
|
15
|
+
htmlOptions={{onClick:() => setIsCollapsed(!isCollapsed)}}
|
16
|
+
position="sticky"
|
17
|
+
top="0"
|
18
|
+
>
|
19
|
+
<Flex
|
20
|
+
align="center"
|
21
|
+
gap="sm"
|
22
|
+
justify="between"
|
23
|
+
>
|
24
|
+
<Title
|
25
|
+
size={4}
|
26
|
+
text="Custom Main Section"
|
27
|
+
/>
|
28
|
+
<IconCircle
|
29
|
+
icon="check"
|
30
|
+
size="xs"
|
31
|
+
/>
|
32
|
+
</Flex>
|
33
|
+
</Background>
|
34
|
+
<Collapsible.Content padding="none">
|
35
|
+
<div>
|
36
|
+
<List>
|
37
|
+
<ListItem
|
38
|
+
align="stretch"
|
39
|
+
flexDirection="column"
|
40
|
+
>
|
41
|
+
Checklist item
|
42
|
+
</ListItem>
|
43
|
+
<ListItem
|
44
|
+
align="stretch"
|
45
|
+
flexDirection="column"
|
46
|
+
>
|
47
|
+
Checklist item
|
48
|
+
</ListItem>
|
49
|
+
<ListItem
|
50
|
+
align="stretch"
|
51
|
+
flexDirection="column"
|
52
|
+
>
|
53
|
+
Checklist item
|
54
|
+
</ListItem>
|
55
|
+
<ListItem
|
56
|
+
align="stretch"
|
57
|
+
flexDirection="column"
|
58
|
+
>
|
59
|
+
Checklist item
|
60
|
+
</ListItem>
|
61
|
+
<ListItem
|
62
|
+
align="stretch"
|
63
|
+
flexDirection="column"
|
64
|
+
>
|
65
|
+
Checklist item
|
66
|
+
</ListItem>
|
67
|
+
</List>
|
68
|
+
</div>
|
69
|
+
</Collapsible.Content>
|
70
|
+
</Collapsible>
|
71
|
+
|
72
|
+
</>
|
73
|
+
)
|
74
|
+
}
|
75
|
+
|
76
|
+
export default CollapsibleCustomMain
|
@@ -7,6 +7,7 @@ examples:
|
|
7
7
|
- collapsible_icons: Custom Icons
|
8
8
|
- collapsible_external_controls: Toggle Collapsible With External Controls
|
9
9
|
- collapsible_external_controls_multiple: Toggle All Collapsibles With One Control
|
10
|
+
- collapsible_custom_main: Custom Main
|
10
11
|
|
11
12
|
react:
|
12
13
|
- collapsible_default: Default
|
@@ -14,6 +15,8 @@ examples:
|
|
14
15
|
- collapsible_color: Icon Color
|
15
16
|
- collapsible_icons: Custom Icons
|
16
17
|
- collapsible_state: useCollapsible Hook
|
18
|
+
- collapsible_custom_main: Custom Main
|
19
|
+
|
17
20
|
|
18
21
|
swift:
|
19
22
|
- collapsible_default_swift: Default
|
@@ -2,4 +2,5 @@ export { default as CollapsibleDefault } from './_collapsible_default.jsx'
|
|
2
2
|
export { default as CollapsibleSize } from './_collapsible_size.jsx'
|
3
3
|
export { default as CollapsibleColor } from './_collapsible_color.jsx'
|
4
4
|
export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
|
5
|
-
export {default as CollapsibleState } from './_collapsible_state.jsx'
|
5
|
+
export { default as CollapsibleState } from './_collapsible_state.jsx'
|
6
|
+
export { default as CollapsibleCustomMain } from './_collapsible_custom_main.jsx'
|
@@ -75,13 +75,23 @@ export default class PbCollapsible extends PbEnhancedElement {
|
|
75
75
|
this.displayUpArrow()
|
76
76
|
}
|
77
77
|
|
78
|
+
toggleArrows(showDownArrow) {
|
79
|
+
const downArrow = this.element.querySelector(DOWN_ARROW_SELECTOR);
|
80
|
+
const upArrow = this.element.querySelector(UP_ARROW_SELECTOR);
|
81
|
+
|
82
|
+
if (downArrow) {
|
83
|
+
downArrow.style.display = showDownArrow ? 'inline-block' : 'none';
|
84
|
+
}
|
85
|
+
if (upArrow) {
|
86
|
+
upArrow.style.display = showDownArrow ? 'none' : 'inline-block';
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
78
90
|
displayDownArrow() {
|
79
|
-
this.
|
80
|
-
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'none'
|
91
|
+
this.toggleArrows(true);
|
81
92
|
}
|
82
|
-
|
93
|
+
|
83
94
|
displayUpArrow() {
|
84
|
-
this.
|
85
|
-
|
86
|
-
}
|
95
|
+
this.toggleArrows(false);
|
96
|
+
}
|
87
97
|
}
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("caption", props: object.caption_props) %>
|
3
8
|
|
4
9
|
<div class=<%= "pb_currency_wrapper#{object.variant_class || object.emphasized_class}" %>>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<% if object.stat_label.present? %>
|
3
8
|
<%= pb_rails("body", props: { color: "light", text: object.stat_label } ) %>
|
4
9
|
<% end %>
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options) do %>
|
2
6
|
<div class="pb_date_range_inline_wrapper">
|
3
7
|
<% if object.icon == true %>
|
4
8
|
<%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, color: object.icon_color, text: pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true, size: object.size, classname: "pb_date_range_inline_icon" }) }) %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
aria: object.aria,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
|
3
8
|
<%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %>
|
4
9
|
<%= pb_rails("body", props: {classname: "flex-item"}) do %>
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options) do %>
|
2
6
|
<%= pb_rails("title", props: { text: object.day_month, size: 4, dark: object.dark }) %>
|
3
7
|
<%= pb_rails("body", props: { text: object.year, size: 4, color: "light", dark: object.dark }) %>
|
4
8
|
<% end %>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
This kit's `options` prop requires an array of objects, each of which will be used as the selectable options within the dropdown. Each option object can support any number of key-value pairs, but each must contain `label` and `value`.
|
@@ -1,7 +1,6 @@
|
|
1
|
-
The dropdown
|
1
|
+
The dropdown is built using all of the following subcomponents:
|
2
2
|
|
3
|
-
`Dropdown.
|
4
|
-
`Dropdown.Container
|
5
|
-
`Dropdown.Option`
|
6
|
-
|
7
|
-
See the code snippet below for a visual on how to use the kit with subcomponents. Each subcomponent allows for GlobalProps in addition to any subcomponent specfic props.
|
3
|
+
`Dropdown.Trigger` is the UI component that users interact with to toggle the dropdown.
|
4
|
+
`Dropdown.Container` is the floating container that wraps the list of dropdown options.
|
5
|
+
`Dropdown.Option` renders options that are passed to the container.
|
6
|
+
Each of these subcomponents can be altered using global props and/or their respective props. See doc examples below for more information on each.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
The dropdown is built using all of the following required subcomponents:
|
2
|
+
|
3
|
+
`dropdown/dropdown_trigger` is the UI component that users interact with to toggle the dropdown.
|
4
|
+
`dropdown/dropdown_container` is the floating container that wraps the list of dropdown options.
|
5
|
+
`dropdown/dropdown_option` renders options that are passed to the container.
|
6
|
+
Each of these subcomponents can be altered using global props and/or their respective props. See doc examples below for more information on each.
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
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.
|
2
2
|
|
3
|
-
The `placeholder` prop can also be used to customize the placeholder text for the default Trigger
|
3
|
+
The `placeholder` prop can also be used to customize the placeholder text for the default `Dropdown.Trigger`.
|
4
4
|
|
5
|
-
The `onSelect` prop
|
5
|
+
The `onSelect` prop returns the selected option as an object to be utilized by the dev. In this example we are using the `onSelect` to set a state with the selected option and using it to customize the `customDisplay`.
|
@@ -0,0 +1,5 @@
|
|
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.
|
2
|
+
|
3
|
+
The `placeholder` prop can also be used to customize the placeholder text for the default `dropdown/dropdown_trigger`.
|
4
|
+
|
5
|
+
The dropdown follows the typical rails pattern of utilizing hidden inputs for form submission. The hidden input value is the selected options' id.
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
`Dropdown.Option` subcomponent accepts any child components to customize the options' contents and display. By default, options are Body kit text that is set by the `label` value from the `option` object.
|
@@ -0,0 +1 @@
|
|
1
|
+
`dropdown/dropdown_option` subcomponent accepts any child components to customize the options' contents and display. By default, options are Body kit text that is set by the `label` value from the `option` object.
|
@@ -1 +1 @@
|
|
1
|
-
By default,
|
1
|
+
By default, dropdown option padding is set to `xs`, but this padding can be overridden using our global prop spacing token. In this example we are increasing the option padding to `sm`.
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Optionally replace the default trigger's select element by passing child components directly to the `Dropdown.Trigger`.
|
@@ -0,0 +1 @@
|
|
1
|
+
Optionally replace the default trigger's select element by passing child components directly to the `dropdown/dropdown_trigger`.
|
@@ -1 +1 @@
|
|
1
|
-
The
|
1
|
+
The top-level Dropdown component optionally accepts any string through a `label` prop to produce a label above your trigger element.
|
@@ -1,12 +1,12 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- dropdown_default: Default
|
4
|
-
-
|
4
|
+
- dropdown_subcomponent_structure_rails: Subcomponent Structure
|
5
5
|
- dropdown_with_label: With Label
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
- dropdown_with_custom_padding: Custom Padding
|
6
|
+
- dropdown_with_custom_options_rails: Custom Options
|
7
|
+
- dropdown_with_custom_display_rails: Custom Display
|
8
|
+
- dropdown_with_custom_trigger_rails: Custom Trigger
|
9
|
+
- dropdown_with_custom_padding: Custom Option Padding
|
10
10
|
|
11
11
|
react:
|
12
12
|
- dropdown_default: Default
|
@@ -15,7 +15,7 @@ examples:
|
|
15
15
|
- dropdown_with_custom_options: Custom Options
|
16
16
|
- dropdown_with_custom_display: Custom Display
|
17
17
|
- dropdown_with_custom_trigger: Custom Trigger
|
18
|
-
- dropdown_with_custom_padding: Custom Padding
|
18
|
+
- dropdown_with_custom_padding: Custom Option Padding
|
19
19
|
# - dropdown_with_autocomplete: Autocomplete
|
20
20
|
# - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
|
21
21
|
# - dropdown_with_external_control: useDropdown Hook
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
|
3
8
|
|
4
9
|
<% if content %>
|
@@ -1,3 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("icon", props: { dark: object.dark, icon: object.icon, fixed_width: true }) %>
|
3
8
|
<% end %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
|
3
8
|
<%= pb_rails("icon", props: { icon: object.icon, fixed_width: true }) %>
|
4
9
|
<%= object.text %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("caption", props: { text: object.label, classname: "pb_label_pill_label"}) %>
|
3
8
|
<%= pb_rails("pill", props: { text: object.pill_value, variant: object.variant, classname: "pb_label_pill_pill" }) %>
|
4
9
|
<% end %>
|