playbook_ui_docs 13.27.0 → 13.28.0.pre.alpha.PBNTR297gradientoverlay3029
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/docs/_advanced_table_beta_subrow_headers.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.html.erb +46 -66
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +8 -29
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.md +3 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.html.erb +13 -33
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +48 -67
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.md +3 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +0 -20
- data/app/pb_kits/playbook/pb_avatar/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +2 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/{_bar_graph_custom.html.erb → _bar_graph_custom_rails.html.erb} +3 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.md +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +20 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +41 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +72 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +19 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +73 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default_swift.md +61 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_props_swift.md +11 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold_swift.md +32 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default_swift.md +17 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year_swift.md +19 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_props_swift.md +10 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_reversed_swift.md +17 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_alignment_swift.md +39 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default_swift.md +39 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_props_swift.md +15 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size_swift.md +78 -0
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +53 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +159 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +121 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -0
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +3 -3
- 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.html.erb → _dropdown_subcomponent_structure_rails.html.erb} +3 -3
- 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.jsx +6 -3
- 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.html.erb → _dropdown_with_custom_display_rails.html.erb} +11 -6
- 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.jsx +5 -2
- 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.html.erb → _dropdown_with_custom_options_rails.html.erb} +16 -11
- 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.html.erb +3 -3
- 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.jsx +5 -2
- 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.html.erb → _dropdown_with_custom_trigger_rails.html.erb} +16 -11
- 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.html.erb +3 -3
- 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_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children_swift.md +23 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close_swift.md +7 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default_swift.md +9 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_dismiss_with_timer_swift.md +22 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_swift.md +9 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions_swift.md +62 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +9 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +11 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.jsx +40 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +7 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.jsx +36 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.md +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_pill/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.jsx +33 -32
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.jsx +33 -33
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.jsx +51 -50
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.html.erb +54 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.jsx +37 -38
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.html.erb +53 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_row.html.erb → _table_outer_padding.html.erb} +7 -7
- data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.jsx +76 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +9 -9
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/dist/app/components/playbook/pb_docs/kit_example.html.erb +3 -3
- data/dist/menu.yml +9 -4
- data/dist/playbook-doc.js +10 -10
- metadata +68 -14
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.html.erb +0 -63
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.html.erb +0 -52
- /data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_column.html.erb → _table_alignment_column_rails.html.erb} +0 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { SelectableList, Draggable, DraggableProvider } from "../../";
|
3
|
+
|
4
|
+
// Initial items to be dragged
|
5
|
+
const data = [
|
6
|
+
{
|
7
|
+
id: "1",
|
8
|
+
text: "Task 1",
|
9
|
+
},
|
10
|
+
{
|
11
|
+
id: "2",
|
12
|
+
text: "Task 2",
|
13
|
+
},
|
14
|
+
{
|
15
|
+
id: "3",
|
16
|
+
text: "Task 3",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
id: "4",
|
20
|
+
text: "Task 4",
|
21
|
+
},
|
22
|
+
];
|
23
|
+
|
24
|
+
const DraggableDefault = (props) => {
|
25
|
+
const [initialState, setInitialState] = useState(data);
|
26
|
+
|
27
|
+
return (
|
28
|
+
<DraggableProvider initialItems={data}
|
29
|
+
onChange={(items) => setInitialState(items)}
|
30
|
+
>
|
31
|
+
<Draggable
|
32
|
+
{...props}
|
33
|
+
>
|
34
|
+
<Draggable.Container>
|
35
|
+
<SelectableList variant="checkbox">
|
36
|
+
{initialState.map(({ id, text }) => (
|
37
|
+
<Draggable.Item id={id}
|
38
|
+
key={id}
|
39
|
+
>
|
40
|
+
<SelectableList.Item label={text}
|
41
|
+
name={id}
|
42
|
+
value={id}
|
43
|
+
/>
|
44
|
+
</Draggable.Item>
|
45
|
+
))}
|
46
|
+
</SelectableList>
|
47
|
+
</Draggable.Container>
|
48
|
+
</Draggable>
|
49
|
+
</DraggableProvider>
|
50
|
+
);
|
51
|
+
};
|
52
|
+
|
53
|
+
export default DraggableDefault;
|
@@ -0,0 +1,159 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import {
|
3
|
+
Flex,
|
4
|
+
Caption,
|
5
|
+
Card,
|
6
|
+
FlexItem,
|
7
|
+
Badge,
|
8
|
+
Avatar,
|
9
|
+
Title,
|
10
|
+
Body,
|
11
|
+
Draggable,
|
12
|
+
DraggableProvider,
|
13
|
+
} from "../../";
|
14
|
+
|
15
|
+
// Initial groups to drag between
|
16
|
+
const containers = ["To Do", "In Progress", "Done"];
|
17
|
+
|
18
|
+
// Initial items to be dragged
|
19
|
+
const data = [
|
20
|
+
{
|
21
|
+
id: "1",
|
22
|
+
container: "To Do",
|
23
|
+
title: "Task 1",
|
24
|
+
description: "Bug fixes",
|
25
|
+
assignee_name: "Terry Miles",
|
26
|
+
assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
id: "2",
|
30
|
+
container: "To Do",
|
31
|
+
title: "Task 2",
|
32
|
+
description: "Documentation",
|
33
|
+
assignee_name: "Sophia Miles",
|
34
|
+
assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
id: "3",
|
38
|
+
container: "In Progress",
|
39
|
+
title: "Task 3",
|
40
|
+
description: "Add a variant",
|
41
|
+
assignee_name: "Alice Jones",
|
42
|
+
assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
|
43
|
+
},
|
44
|
+
{
|
45
|
+
id: "4",
|
46
|
+
container: "To Do",
|
47
|
+
title: "Task 4",
|
48
|
+
description: "Add jest tests",
|
49
|
+
assignee_name: "Mike James",
|
50
|
+
assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
id: "5",
|
54
|
+
container: "Done",
|
55
|
+
title: "Task 5",
|
56
|
+
description: "Alpha testing",
|
57
|
+
assignee_name: "James Guy",
|
58
|
+
assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
|
59
|
+
},
|
60
|
+
{
|
61
|
+
id: "6",
|
62
|
+
container: "In Progress",
|
63
|
+
title: "Task 6",
|
64
|
+
description: "Release",
|
65
|
+
assignee_name: "Sally Jones",
|
66
|
+
assignee_img: "https://randomuser.me/api/portraits/women/28.jpg",
|
67
|
+
},
|
68
|
+
];
|
69
|
+
|
70
|
+
const DraggableMultipleContainer = (props) => {
|
71
|
+
const [initialState, setInitialState] = useState(data);
|
72
|
+
|
73
|
+
const badgeProperties = (container) => {
|
74
|
+
switch (container) {
|
75
|
+
case "To Do":
|
76
|
+
return { text: "queue", color: "warning" };
|
77
|
+
case "In Progress":
|
78
|
+
return { text: "progress", color: "primary" };
|
79
|
+
default:
|
80
|
+
return { text: "done", color: "success" };
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
return (
|
85
|
+
<DraggableProvider initialItems={data}
|
86
|
+
onChange={(items) => setInitialState(items)}
|
87
|
+
>
|
88
|
+
<Draggable
|
89
|
+
display="flex"
|
90
|
+
justifyContent="center"
|
91
|
+
{...props}
|
92
|
+
>
|
93
|
+
{containers?.map((container) => (
|
94
|
+
<Draggable.Container
|
95
|
+
container={container}
|
96
|
+
key={container}
|
97
|
+
padding="sm"
|
98
|
+
>
|
99
|
+
<Caption textAlign="center">{container}</Caption>
|
100
|
+
<Flex
|
101
|
+
alignItems="stretch"
|
102
|
+
orientation="column"
|
103
|
+
>
|
104
|
+
{initialState
|
105
|
+
.filter((item) => item.container === container)
|
106
|
+
.map(
|
107
|
+
({
|
108
|
+
assignee_img,
|
109
|
+
assignee_name,
|
110
|
+
description,
|
111
|
+
id,
|
112
|
+
title,
|
113
|
+
}) => (
|
114
|
+
<Draggable.Item
|
115
|
+
container={container}
|
116
|
+
id={id}
|
117
|
+
key={id}
|
118
|
+
>
|
119
|
+
<Card
|
120
|
+
marginBottom="sm"
|
121
|
+
padding="sm"
|
122
|
+
>
|
123
|
+
<Flex justify="between">
|
124
|
+
<FlexItem>
|
125
|
+
<Flex>
|
126
|
+
<Avatar
|
127
|
+
imageUrl={assignee_img}
|
128
|
+
name={assignee_name}
|
129
|
+
size="xxs"
|
130
|
+
/>
|
131
|
+
<Title paddingLeft="xs"
|
132
|
+
size={4}
|
133
|
+
text={title}
|
134
|
+
/>
|
135
|
+
</Flex>
|
136
|
+
</FlexItem>
|
137
|
+
<Badge
|
138
|
+
marginLeft="sm"
|
139
|
+
rounded
|
140
|
+
text={badgeProperties(container).text}
|
141
|
+
variant={badgeProperties(container).color}
|
142
|
+
/>
|
143
|
+
</Flex>
|
144
|
+
<Body paddingTop="xs"
|
145
|
+
text={description}
|
146
|
+
/>
|
147
|
+
</Card>
|
148
|
+
</Draggable.Item>
|
149
|
+
)
|
150
|
+
)}
|
151
|
+
</Flex>
|
152
|
+
</Draggable.Container>
|
153
|
+
))}
|
154
|
+
</Draggable>
|
155
|
+
</DraggableProvider>
|
156
|
+
);
|
157
|
+
};
|
158
|
+
|
159
|
+
export default DraggableMultipleContainer;
|
@@ -0,0 +1,121 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import {
|
3
|
+
Flex,
|
4
|
+
Badge,
|
5
|
+
Title,
|
6
|
+
Icon,
|
7
|
+
Draggable,
|
8
|
+
DraggableProvider,
|
9
|
+
Card,
|
10
|
+
Caption,
|
11
|
+
} from "../../";
|
12
|
+
|
13
|
+
// Initial items to be dragged
|
14
|
+
const data = [
|
15
|
+
{
|
16
|
+
id: "1",
|
17
|
+
text: "Joe Black",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
id: "2",
|
21
|
+
text: "Nancy White",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
id: "3",
|
25
|
+
text: "Bill Green",
|
26
|
+
},
|
27
|
+
];
|
28
|
+
|
29
|
+
const DraggableWithCards = (props) => {
|
30
|
+
const [initialState, setInitialState] = useState(data);
|
31
|
+
|
32
|
+
return (
|
33
|
+
<DraggableProvider
|
34
|
+
initialItems={data}
|
35
|
+
onChange={(items) => setInitialState(items)}
|
36
|
+
>
|
37
|
+
<Draggable {...props}>
|
38
|
+
<Draggable.Container>
|
39
|
+
{initialState.map(({ id, text }) => (
|
40
|
+
<Draggable.Item id={id}
|
41
|
+
key={id}
|
42
|
+
>
|
43
|
+
<Card
|
44
|
+
highlight={{ position: "side", color: "primary" }}
|
45
|
+
marginBottom="xs"
|
46
|
+
>
|
47
|
+
<Flex alignItems="stretch"
|
48
|
+
flexDirection="column"
|
49
|
+
>
|
50
|
+
<Flex gap="xs">
|
51
|
+
<Title size={4}
|
52
|
+
text={text}
|
53
|
+
/>
|
54
|
+
<Badge
|
55
|
+
text="35-12345"
|
56
|
+
variant="primary"
|
57
|
+
/>
|
58
|
+
</Flex>
|
59
|
+
|
60
|
+
<Flex
|
61
|
+
gap="sm"
|
62
|
+
spacing="between"
|
63
|
+
>
|
64
|
+
<Caption
|
65
|
+
size="xs"
|
66
|
+
text="8:00A"
|
67
|
+
/>
|
68
|
+
<Flex gap="xxs">
|
69
|
+
<Caption
|
70
|
+
size="xs"
|
71
|
+
text="Township Name"
|
72
|
+
/>
|
73
|
+
<Caption size="xs"
|
74
|
+
text="•"
|
75
|
+
/>
|
76
|
+
<Caption size="xs"
|
77
|
+
text="90210"
|
78
|
+
/>
|
79
|
+
</Flex>
|
80
|
+
</Flex>
|
81
|
+
|
82
|
+
<Flex gap="xxs"
|
83
|
+
spacing="between"
|
84
|
+
>
|
85
|
+
<Flex gap="xxs">
|
86
|
+
<Caption color="error"
|
87
|
+
size="xs"
|
88
|
+
>
|
89
|
+
<Icon icon="house-circle-exclamation" />
|
90
|
+
</Caption>
|
91
|
+
<Caption color="success"
|
92
|
+
size="xs">
|
93
|
+
<Icon icon="file-circle-check" />
|
94
|
+
</Caption>
|
95
|
+
</Flex>
|
96
|
+
<Flex>
|
97
|
+
<Badge rounded
|
98
|
+
text="Schedule QA"
|
99
|
+
variant="warning"
|
100
|
+
/>
|
101
|
+
<Badge rounded
|
102
|
+
text="Flex"
|
103
|
+
variant="primary"
|
104
|
+
/>
|
105
|
+
<Badge rounded
|
106
|
+
text="R99"
|
107
|
+
variant="primary"
|
108
|
+
/>
|
109
|
+
</Flex>
|
110
|
+
</Flex>
|
111
|
+
</Flex>
|
112
|
+
</Card>
|
113
|
+
</Draggable.Item>
|
114
|
+
))}
|
115
|
+
</Draggable.Container>
|
116
|
+
</Draggable>
|
117
|
+
</DraggableProvider>
|
118
|
+
);
|
119
|
+
};
|
120
|
+
|
121
|
+
export default DraggableWithCards;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: 'United States' },
|
4
|
-
{ label: 'Canada', value: 'Canada' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan' },
|
3
|
+
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
+
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
+
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -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.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: 'United States' },
|
4
|
-
{ label: 'Canada', value: 'Canada' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan' },
|
3
|
+
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
+
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
+
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -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
|
import React, { useState } from 'react'
|
2
|
-
import { Dropdown, User, FlexItem, Badge, Avatar } from '../../'
|
2
|
+
import { Dropdown, User, Flex, FlexItem, Badge, Avatar } from '../../'
|
3
3
|
|
4
4
|
const DropdownWithCustomDisplay = (props) => {
|
5
5
|
const [selectedOption, setSelectedOption] = useState();
|
@@ -69,7 +69,10 @@ const DropdownWithCustomDisplay = (props) => {
|
|
69
69
|
<Dropdown.Option key={option.id}
|
70
70
|
option={option}
|
71
71
|
>
|
72
|
-
|
72
|
+
<Flex
|
73
|
+
align="center"
|
74
|
+
justify="between"
|
75
|
+
>
|
73
76
|
<FlexItem>
|
74
77
|
<User
|
75
78
|
align="left"
|
@@ -93,7 +96,7 @@ const DropdownWithCustomDisplay = (props) => {
|
|
93
96
|
}`}
|
94
97
|
/>
|
95
98
|
</FlexItem>
|
96
|
-
|
99
|
+
</Flex>
|
97
100
|
</Dropdown.Option>
|
98
101
|
))}
|
99
102
|
</Dropdown>
|
@@ -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`.
|
@@ -48,12 +48,17 @@
|
|
48
48
|
<%= pb_rails("dropdown/dropdown_container") do %>
|
49
49
|
<% options.each do |option| %>
|
50
50
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
<%= pb_rails("flex", props: {
|
52
|
+
align: "center",
|
53
|
+
justify: "between",
|
54
|
+
}) do %>
|
55
|
+
<%= pb_rails("flex/flex_item") do %>
|
56
|
+
<%= pb_rails("user", props: {name: option[:label], align:"left", avatar: true, orientation:"horizontal", territory:option[:territory], title: option[:title]}) %>
|
57
|
+
<% end %>
|
58
|
+
<%= pb_rails("flex/flex_item") do %>
|
59
|
+
<%= pb_rails("badge", props: {rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
|
60
|
+
<% end %>
|
61
|
+
<% end %>
|
57
62
|
<% end %>
|
58
63
|
<% end %>
|
59
64
|
<% end %>
|
@@ -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.
|
@@ -38,7 +38,10 @@ const DropdownWithCustomOptions = (props) => {
|
|
38
38
|
<Dropdown.Option key={option.id}
|
39
39
|
option={option}
|
40
40
|
>
|
41
|
-
|
41
|
+
<Flex
|
42
|
+
align="center"
|
43
|
+
justify="between"
|
44
|
+
>
|
42
45
|
<FlexItem>
|
43
46
|
<Flex>
|
44
47
|
<Icon icon={option.icon}
|
@@ -52,7 +55,7 @@ const DropdownWithCustomOptions = (props) => {
|
|
52
55
|
text={option.areaCode}
|
53
56
|
/>
|
54
57
|
</FlexItem>
|
55
|
-
|
58
|
+
</Flex>
|
56
59
|
</Dropdown.Option>
|
57
60
|
))}
|
58
61
|
</Dropdown>
|
@@ -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.
|
@@ -5,21 +5,21 @@
|
|
5
5
|
value: "United States",
|
6
6
|
areaCode: "+1",
|
7
7
|
icon: "🇺🇸",
|
8
|
-
id: "
|
8
|
+
id: "us"
|
9
9
|
},
|
10
10
|
{
|
11
11
|
label: "Canada",
|
12
12
|
value: "Canada",
|
13
13
|
areaCode: "+1",
|
14
14
|
icon: "🇨🇦",
|
15
|
-
id: "
|
15
|
+
id: "ca"
|
16
16
|
},
|
17
17
|
{
|
18
18
|
label: "Pakistan",
|
19
19
|
value: "Pakistan",
|
20
20
|
areaCode: "+92",
|
21
21
|
icon: "🇵🇰",
|
22
|
-
id: "
|
22
|
+
id: "pk"
|
23
23
|
}
|
24
24
|
]
|
25
25
|
|
@@ -30,14 +30,19 @@
|
|
30
30
|
<%= pb_rails("dropdown/dropdown_container") do %>
|
31
31
|
<% options.each do |option| %>
|
32
32
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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 %>
|
41
46
|
<% end %>
|
42
47
|
<% end %>
|
43
48
|
<% end %>
|
@@ -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,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: 'United States' },
|
4
|
-
{ label: 'Canada', value: 'Canada' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan' },
|
3
|
+
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
+
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
+
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -1 +1 @@
|
|
1
|
-
By default,
|
1
|
+
By default, dropdown option paddingX is set to `sm` and paddingY is set to `xs`, but this padding can be overridden using our global padding props. In this example we are setting the option padding to `sm` all around.
|
@@ -51,7 +51,10 @@ const [selectedOption, setSelectedOption] = useState();
|
|
51
51
|
<Dropdown.Option key={option.id}
|
52
52
|
option={option}
|
53
53
|
>
|
54
|
-
|
54
|
+
<Flex
|
55
|
+
align="center"
|
56
|
+
justify="between"
|
57
|
+
>
|
55
58
|
<FlexItem>
|
56
59
|
<Flex>
|
57
60
|
<Icon icon={option.icon}
|
@@ -65,7 +68,7 @@ const [selectedOption, setSelectedOption] = useState();
|
|
65
68
|
text={option.areaCode}
|
66
69
|
/>
|
67
70
|
</FlexItem>
|
68
|
-
|
71
|
+
</Flex>
|
69
72
|
</Dropdown.Option>
|
70
73
|
))}
|
71
74
|
</Dropdown.Container>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Optionally replace the default trigger's select element by passing child components directly to the `Dropdown.Trigger`.
|
@@ -5,21 +5,21 @@
|
|
5
5
|
value: "United States",
|
6
6
|
areaCode: "+1",
|
7
7
|
icon: "🇺🇸",
|
8
|
-
id: "
|
8
|
+
id: "us"
|
9
9
|
},
|
10
10
|
{
|
11
11
|
label: "Canada",
|
12
12
|
value: "Canada",
|
13
13
|
areaCode: "+1",
|
14
14
|
icon: "🇨🇦",
|
15
|
-
id: "
|
15
|
+
id: "ca"
|
16
16
|
},
|
17
17
|
{
|
18
18
|
label: "Pakistan",
|
19
19
|
value: "Pakistan",
|
20
20
|
areaCode: "+92",
|
21
21
|
icon: "🇵🇰",
|
22
|
-
id: "
|
22
|
+
id: "pk"
|
23
23
|
}
|
24
24
|
]
|
25
25
|
|
@@ -32,15 +32,20 @@
|
|
32
32
|
<%= pb_rails("dropdown/dropdown_container", props:{max_width:"xs"}) do %>
|
33
33
|
<% options.each do |option| %>
|
34
34
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
35
|
+
<%= pb_rails("flex", props: {
|
36
|
+
align: "center",
|
37
|
+
justify: "between",
|
38
|
+
}) do %>
|
35
39
|
<%= pb_rails("flex/flex_item") do %>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
<%= pb_rails("flex") do %>
|
41
|
+
<%= pb_rails("icon", props: {icon: option[:icon]}) %>
|
42
|
+
<%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<%= pb_rails("flex/flex_item") do %>
|
46
|
+
<%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
44
49
|
<% end %>
|
45
50
|
<% end %>
|
46
51
|
<% end %>
|