playbook_ui_docs 14.12.0.pre.rc.10 → 14.12.0.pre.rc.12
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +50 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx +60 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +78 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx +53 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.jsx +52 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_no_subrows.json +42 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_with_id.json +299 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +6 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames.html.erb +13 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails.md +3 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +38 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -45
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +9 -16
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +44 -19
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +21 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +16 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +2 -19
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +3 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +8 -3
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +4 -1
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +4 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +47 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +46 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask_rails.md +3 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +19 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +27 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/dist/playbook-doc.js +1 -1
- metadata +26 -3
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible.md → _table_with_collapsible_react.md} +0 -0
@@ -0,0 +1,299 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"year": "2021",
|
4
|
+
"id": "1",
|
5
|
+
"quarter": null,
|
6
|
+
"month": null,
|
7
|
+
"day": null,
|
8
|
+
"newEnrollments": "20",
|
9
|
+
"scheduledMeetings": "10",
|
10
|
+
"attendanceRate": "51%",
|
11
|
+
"completedClasses": "3",
|
12
|
+
"classCompletionRate": "33%",
|
13
|
+
"graduatedStudents": "19",
|
14
|
+
"children": [
|
15
|
+
{
|
16
|
+
"year": "2021",
|
17
|
+
"id": "2",
|
18
|
+
"quarter": "Q1",
|
19
|
+
"month": null,
|
20
|
+
"day": null,
|
21
|
+
"newEnrollments": "2",
|
22
|
+
"scheduledMeetings": "35",
|
23
|
+
"attendanceRate": "32%",
|
24
|
+
"completedClasses": "15",
|
25
|
+
"classCompletionRate": "52%",
|
26
|
+
"graduatedStudents": "36",
|
27
|
+
"children": [
|
28
|
+
{
|
29
|
+
"year": "2021",
|
30
|
+
"id": "3",
|
31
|
+
"quarter": "Q1",
|
32
|
+
"month": "January",
|
33
|
+
"day": null,
|
34
|
+
"newEnrollments": "16",
|
35
|
+
"scheduledMeetings": "20",
|
36
|
+
"attendanceRate": "11%",
|
37
|
+
"completedClasses": "13",
|
38
|
+
"classCompletionRate": "47%",
|
39
|
+
"graduatedStudents": "28",
|
40
|
+
"children": [
|
41
|
+
{
|
42
|
+
"year": "2021",
|
43
|
+
"id": "4",
|
44
|
+
"quarter": "Q1",
|
45
|
+
"month": "January",
|
46
|
+
"day": "10",
|
47
|
+
"newEnrollments": "34",
|
48
|
+
"scheduledMeetings": "28",
|
49
|
+
"attendanceRate": "97%",
|
50
|
+
"completedClasses": "20",
|
51
|
+
"classCompletionRate": "15%",
|
52
|
+
"graduatedStudents": "17"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"year": "2021",
|
56
|
+
"id": "5",
|
57
|
+
"quarter": "Q1",
|
58
|
+
"month": "January",
|
59
|
+
"day": "20",
|
60
|
+
"newEnrollments": "43",
|
61
|
+
"scheduledMeetings": "23",
|
62
|
+
"attendanceRate": "66%",
|
63
|
+
"completedClasses": "26",
|
64
|
+
"classCompletionRate": "47%",
|
65
|
+
"graduatedStudents": "9"
|
66
|
+
}
|
67
|
+
]
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"year": "2021",
|
71
|
+
"id": "6",
|
72
|
+
"quarter": "Q1",
|
73
|
+
"month": "February",
|
74
|
+
"day": null,
|
75
|
+
"newEnrollments": "20",
|
76
|
+
"scheduledMeetings": "41",
|
77
|
+
"attendanceRate": "95%",
|
78
|
+
"completedClasses": "26",
|
79
|
+
"classCompletionRate": "83%",
|
80
|
+
"graduatedStudents": "43",
|
81
|
+
"children": [
|
82
|
+
{
|
83
|
+
"year": "2021",
|
84
|
+
"id": "7",
|
85
|
+
"quarter": "Q1",
|
86
|
+
"month": "February",
|
87
|
+
"day": "15",
|
88
|
+
"newEnrollments": "19",
|
89
|
+
"scheduledMeetings": "35",
|
90
|
+
"attendanceRate": "69%",
|
91
|
+
"completedClasses": "8",
|
92
|
+
"classCompletionRate": "75%",
|
93
|
+
"graduatedStudents": "23"
|
94
|
+
}
|
95
|
+
]
|
96
|
+
}
|
97
|
+
]
|
98
|
+
}
|
99
|
+
]
|
100
|
+
},
|
101
|
+
{
|
102
|
+
"year": "2022",
|
103
|
+
"id": "8",
|
104
|
+
"quarter": null,
|
105
|
+
"month": null,
|
106
|
+
"day": null,
|
107
|
+
"newEnrollments": "25",
|
108
|
+
"scheduledMeetings": "17",
|
109
|
+
"attendanceRate": "75%",
|
110
|
+
"completedClasses": "5",
|
111
|
+
"classCompletionRate": "45%",
|
112
|
+
"graduatedStudents": "32",
|
113
|
+
"children": [
|
114
|
+
{
|
115
|
+
"year": "2022",
|
116
|
+
"id": "9",
|
117
|
+
"quarter": "Q1",
|
118
|
+
"month": null,
|
119
|
+
"day": null,
|
120
|
+
"newEnrollments": "2",
|
121
|
+
"scheduledMeetings": "35",
|
122
|
+
"attendanceRate": "32%",
|
123
|
+
"completedClasses": "15",
|
124
|
+
"classCompletionRate": "52%",
|
125
|
+
"graduatedStudents": "36",
|
126
|
+
"children": [
|
127
|
+
{
|
128
|
+
"year": "2022",
|
129
|
+
"id": "10",
|
130
|
+
"quarter": "Q1",
|
131
|
+
"month": "January",
|
132
|
+
"day": null,
|
133
|
+
"newEnrollments": "16",
|
134
|
+
"scheduledMeetings": "20",
|
135
|
+
"attendanceRate": "11%",
|
136
|
+
"completedClasses": "13",
|
137
|
+
"classCompletionRate": "47%",
|
138
|
+
"graduatedStudents": "28",
|
139
|
+
"children": [
|
140
|
+
{
|
141
|
+
"year": "2022",
|
142
|
+
"id": "11",
|
143
|
+
"quarter": "Q1",
|
144
|
+
"month": "January",
|
145
|
+
"day": "15",
|
146
|
+
"newEnrollments": "34",
|
147
|
+
"scheduledMeetings": "28",
|
148
|
+
"attendanceRate": "97%",
|
149
|
+
"completedClasses": "20",
|
150
|
+
"classCompletionRate": "15%",
|
151
|
+
"graduatedStudents": "17"
|
152
|
+
},
|
153
|
+
{
|
154
|
+
"year": "2022",
|
155
|
+
"id": "12",
|
156
|
+
"quarter": "Q1",
|
157
|
+
"month": "January",
|
158
|
+
"day": "25",
|
159
|
+
"newEnrollments": "43",
|
160
|
+
"scheduledMeetings": "23",
|
161
|
+
"attendanceRate": "66%",
|
162
|
+
"completedClasses": "26",
|
163
|
+
"classCompletionRate": "47%",
|
164
|
+
"graduatedStudents": "9"
|
165
|
+
}
|
166
|
+
]
|
167
|
+
},
|
168
|
+
{
|
169
|
+
"year": "2022",
|
170
|
+
"id": "13",
|
171
|
+
"quarter": "Q1",
|
172
|
+
"month": "May",
|
173
|
+
"day": null,
|
174
|
+
"newEnrollments": "20",
|
175
|
+
"scheduledMeetings": "41",
|
176
|
+
"attendanceRate": "95%",
|
177
|
+
"completedClasses": "26",
|
178
|
+
"classCompletionRate": "83%",
|
179
|
+
"graduatedStudents": "43",
|
180
|
+
"children": [
|
181
|
+
{
|
182
|
+
"year": "2022",
|
183
|
+
"id": "14",
|
184
|
+
"quarter": "Q1",
|
185
|
+
"month": "May",
|
186
|
+
"day": "2",
|
187
|
+
"newEnrollments": "19",
|
188
|
+
"scheduledMeetings": "35",
|
189
|
+
"attendanceRate": "69%",
|
190
|
+
"completedClasses": "8",
|
191
|
+
"classCompletionRate": "75%",
|
192
|
+
"graduatedStudents": "23"
|
193
|
+
}
|
194
|
+
]
|
195
|
+
}
|
196
|
+
]
|
197
|
+
}
|
198
|
+
]
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"year": "2023",
|
202
|
+
"id": "15",
|
203
|
+
"quarter": null,
|
204
|
+
"month": null,
|
205
|
+
"day": null,
|
206
|
+
"newEnrollments": "10",
|
207
|
+
"scheduledMeetings": "15",
|
208
|
+
"attendanceRate": "65%",
|
209
|
+
"completedClasses": "4",
|
210
|
+
"classCompletionRate": "49%",
|
211
|
+
"graduatedStudents": "29",
|
212
|
+
"children": [
|
213
|
+
{
|
214
|
+
"year": "2023",
|
215
|
+
"id": "16",
|
216
|
+
"quarter": "Q1",
|
217
|
+
"month": null,
|
218
|
+
"day": null,
|
219
|
+
"newEnrollments": "2",
|
220
|
+
"scheduledMeetings": "35",
|
221
|
+
"attendanceRate": "32%",
|
222
|
+
"completedClasses": "15",
|
223
|
+
"classCompletionRate": "52%",
|
224
|
+
"graduatedStudents": "36",
|
225
|
+
"children": [
|
226
|
+
{
|
227
|
+
"year": "2023",
|
228
|
+
"id": "17",
|
229
|
+
"quarter": "Q1",
|
230
|
+
"month": "March",
|
231
|
+
"day": null,
|
232
|
+
"newEnrollments": "16",
|
233
|
+
"scheduledMeetings": "20",
|
234
|
+
"attendanceRate": "11%",
|
235
|
+
"completedClasses": "13",
|
236
|
+
"classCompletionRate": "47%",
|
237
|
+
"graduatedStudents": "28",
|
238
|
+
"children": [
|
239
|
+
{
|
240
|
+
"year": "2023",
|
241
|
+
"id": "18",
|
242
|
+
"quarter": "Q1",
|
243
|
+
"month": "March",
|
244
|
+
"day": "10",
|
245
|
+
"newEnrollments": "34",
|
246
|
+
"scheduledMeetings": "28",
|
247
|
+
"attendanceRate": "97%",
|
248
|
+
"completedClasses": "20",
|
249
|
+
"classCompletionRate": "15%",
|
250
|
+
"graduatedStudents": "17"
|
251
|
+
},
|
252
|
+
{
|
253
|
+
"year": "2023",
|
254
|
+
"id": "19",
|
255
|
+
"quarter": "Q1",
|
256
|
+
"month": "March",
|
257
|
+
"day": "11",
|
258
|
+
"newEnrollments": "43",
|
259
|
+
"scheduledMeetings": "23",
|
260
|
+
"attendanceRate": "66%",
|
261
|
+
"completedClasses": "26",
|
262
|
+
"classCompletionRate": "47%",
|
263
|
+
"graduatedStudents": "9"
|
264
|
+
}
|
265
|
+
]
|
266
|
+
},
|
267
|
+
{
|
268
|
+
"year": "2023",
|
269
|
+
"id": "20",
|
270
|
+
"quarter": "Q1",
|
271
|
+
"month": "April",
|
272
|
+
"day": null,
|
273
|
+
"newEnrollments": "20",
|
274
|
+
"scheduledMeetings": "41",
|
275
|
+
"attendanceRate": "95%",
|
276
|
+
"completedClasses": "26",
|
277
|
+
"classCompletionRate": "83%",
|
278
|
+
"graduatedStudents": "43",
|
279
|
+
"children": [
|
280
|
+
{
|
281
|
+
"year": "2023",
|
282
|
+
"id": "21",
|
283
|
+
"quarter": "Q1",
|
284
|
+
"month": "April",
|
285
|
+
"day": "15",
|
286
|
+
"newEnrollments": "19",
|
287
|
+
"scheduledMeetings": "35",
|
288
|
+
"attendanceRate": "69%",
|
289
|
+
"completedClasses": "8",
|
290
|
+
"classCompletionRate": "75%",
|
291
|
+
"graduatedStudents": "23"
|
292
|
+
}
|
293
|
+
]
|
294
|
+
}
|
295
|
+
]
|
296
|
+
}
|
297
|
+
]
|
298
|
+
}
|
299
|
+
]
|
@@ -27,3 +27,8 @@ examples:
|
|
27
27
|
- advanced_table_pagination_with_props: Pagination Props
|
28
28
|
- advanced_table_column_headers: Multi-Header Columns
|
29
29
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
30
|
+
# - advanced_table_no_subrows: Table with No Subrows
|
31
|
+
- advanced_table_selectable_rows: Selectable Rows
|
32
|
+
- advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
33
|
+
- advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
|
34
|
+
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
@@ -13,4 +13,9 @@ export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cel
|
|
13
13
|
export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
|
14
14
|
export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
|
15
15
|
export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
|
16
|
-
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
16
|
+
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
17
|
+
export { default as AdvancedTableSelectableRows } from './_advanced_table_selectable_rows.jsx'
|
18
|
+
export { default as AdvancedTableSelectableRowsNoSubrows } from './_advanced_table_selectable_rows_no_subrows.jsx'
|
19
|
+
export { default as AdvancedTableNoSubrows } from './_advanced_table_no_subrows.jsx'
|
20
|
+
export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_selectable_rows_header.jsx'
|
21
|
+
export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= pb_rails("date_picker", props: { picker_id: "date-picker-turbo-frames", custom_event_type: "datePickerLoader" }) %>
|
2
|
+
<%= pb_rails("button", props: { id: "date-picker-loader", text: "Click Event Simulation" }) %>
|
3
|
+
|
4
|
+
<script>
|
5
|
+
document.getElementById("date-picker-loader").addEventListener("click", () => {
|
6
|
+
window.document.dispatchEvent(
|
7
|
+
new CustomEvent("datePickerLoader", {
|
8
|
+
bubbles: true,
|
9
|
+
})
|
10
|
+
)
|
11
|
+
console.log("Event 'datePickerLoader' dispatched - in a real implementation, this event would trigger the date picker's reinitialization through the custom_event_type prop connection")
|
12
|
+
})
|
13
|
+
</script>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
The `custom_event_type` prop allows you to specify a custom event that will trigger the date picker's initialization, in addition to the default initialization on `DOMContentLoaded`. This is particularly useful in dynamic contexts like Turbo Frame updates where you need to reinitialize the date picker after new content loads. For Turbo integration, use `custom_event_type: "turbo:before-render"` to ensure the date picker properly reinitializes after Turbo navigation events.
|
2
|
+
|
3
|
+
In this example, we demonstrate the setup pattern by connecting a button to dispatch a "datePickerLoader" event - while the date picker's event listener is properly configured through the `custom_event_type` prop, this demo only logs the event dispatch to the console to illustrate the connection structure.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
import { Button, Drawer, Flex } from "playbook-ui"
|
3
|
+
|
4
|
+
const useDrawer = (visible = false) => {
|
5
|
+
const [opened, setOpened] = useState(visible)
|
6
|
+
const toggle = () => setOpened(!opened)
|
7
|
+
|
8
|
+
return [opened, toggle]
|
9
|
+
}
|
10
|
+
|
11
|
+
const DrawerBehavior = () => {
|
12
|
+
const [drawerOpen, toggleDrawerOpen] = useDrawer()
|
13
|
+
|
14
|
+
return (
|
15
|
+
<>
|
16
|
+
<Flex wrap>
|
17
|
+
<Button id='sm'
|
18
|
+
marginRight='md'
|
19
|
+
onClick={toggleDrawerOpen}
|
20
|
+
>
|
21
|
+
{"Push Behavior"}
|
22
|
+
</Button>
|
23
|
+
</Flex>
|
24
|
+
<Flex>
|
25
|
+
<Drawer
|
26
|
+
behavior={"push"}
|
27
|
+
onClose={toggleDrawerOpen}
|
28
|
+
opened={drawerOpen}
|
29
|
+
size={"lg"}
|
30
|
+
>
|
31
|
+
Test me (Push Behavior)
|
32
|
+
</Drawer>
|
33
|
+
</Flex>
|
34
|
+
</>
|
35
|
+
)
|
36
|
+
}
|
37
|
+
|
38
|
+
export default DrawerBehavior
|
@@ -6,19 +6,15 @@ const DrawerBorders = () => {
|
|
6
6
|
const [openedBRightDrawer, setOpenedBRightDrawer] = useState(false);
|
7
7
|
const [openedBLeftDrawer, setOpenedBLeftDrawer] = useState(false);
|
8
8
|
const [openedBFullDrawer, setOpenedBFullDrawer] = useState(false);
|
9
|
-
const [openedBDefaultDrawer, setOpenedBDefaultDrawer] = useState(false);
|
10
|
-
const [openedBRoundedDrawer, setOpenedBRoundedDrawer] = useState(false);
|
11
9
|
|
12
10
|
// Toggle functions for each drawer
|
13
11
|
const toggleBRightDrawer = () => setOpenedBRightDrawer(!openedBRightDrawer);
|
14
12
|
const toggleBLeftDrawer = () => setOpenedBLeftDrawer(!openedBLeftDrawer);
|
15
13
|
const toggleBFullDrawer = () => setOpenedBFullDrawer(!openedBFullDrawer);
|
16
|
-
const toggleBDefaultDrawer = () => setOpenedBDefaultDrawer(!openedBDefaultDrawer);
|
17
|
-
const toggleBRoundedDrawer = () => setOpenedBRoundedDrawer(!openedBRoundedDrawer);
|
18
14
|
|
19
15
|
return (
|
20
16
|
<>
|
21
|
-
<Flex
|
17
|
+
<Flex
|
22
18
|
wrap
|
23
19
|
>
|
24
20
|
<Button marginRight="md"
|
@@ -36,23 +32,12 @@ const DrawerBorders = () => {
|
|
36
32
|
>
|
37
33
|
Drawer with border full
|
38
34
|
</Button>
|
39
|
-
<Button marginRight="md"
|
40
|
-
onClick={toggleBDefaultDrawer}
|
41
|
-
>
|
42
|
-
Default Drawer
|
43
|
-
</Button>
|
44
|
-
<Button marginRight="md"
|
45
|
-
onClick={toggleBRoundedDrawer}
|
46
|
-
>
|
47
|
-
Rounded Drawer
|
48
|
-
</Button>
|
49
35
|
</Flex>
|
50
36
|
|
51
37
|
{/* Drawers for each size */}
|
52
38
|
<Drawer
|
53
39
|
behavior="float"
|
54
40
|
border="right"
|
55
|
-
fullHeight
|
56
41
|
onClose={toggleBRightDrawer}
|
57
42
|
opened={openedBRightDrawer}
|
58
43
|
overlay={false}
|
@@ -64,11 +49,10 @@ const DrawerBorders = () => {
|
|
64
49
|
<Drawer
|
65
50
|
behavior="float"
|
66
51
|
border="left"
|
67
|
-
fullHeight
|
68
52
|
onClose={toggleBLeftDrawer}
|
69
53
|
opened={openedBLeftDrawer}
|
70
54
|
overlay={false}
|
71
|
-
placement="
|
55
|
+
placement="left"
|
72
56
|
size="lg"
|
73
57
|
>
|
74
58
|
This is a Drawer with border left
|
@@ -76,40 +60,14 @@ const DrawerBorders = () => {
|
|
76
60
|
<Drawer
|
77
61
|
behavior="float"
|
78
62
|
border="full"
|
79
|
-
fullHeight
|
80
63
|
onClose={toggleBFullDrawer}
|
81
64
|
opened={openedBFullDrawer}
|
82
65
|
overlay={false}
|
83
|
-
placement="
|
66
|
+
placement="left"
|
84
67
|
size="lg"
|
85
68
|
>
|
86
69
|
This is a Drawer with border full
|
87
70
|
</Drawer>
|
88
|
-
<Drawer
|
89
|
-
behavior="float"
|
90
|
-
fullHeight
|
91
|
-
onClose={toggleBDefaultDrawer}
|
92
|
-
opened={openedBDefaultDrawer}
|
93
|
-
overlay={false}
|
94
|
-
placement="right"
|
95
|
-
size="lg"
|
96
|
-
>
|
97
|
-
This is a Default Drawer
|
98
|
-
</Drawer>
|
99
|
-
<Drawer
|
100
|
-
behavior="float"
|
101
|
-
borderRadius="rounded"
|
102
|
-
fullHeight
|
103
|
-
onClose={toggleBRoundedDrawer}
|
104
|
-
opened={openedBRoundedDrawer}
|
105
|
-
overlay={false}
|
106
|
-
placement="right"
|
107
|
-
size="lg"
|
108
|
-
>
|
109
|
-
<div style={{ paddingTop: '100px', paddingLeft: '12px' }}>
|
110
|
-
This is a Rounded Drawer
|
111
|
-
</div>
|
112
|
-
</Drawer>
|
113
71
|
</>
|
114
72
|
);
|
115
73
|
};
|
@@ -9,8 +9,8 @@ const useDrawer = (visible = false) => {
|
|
9
9
|
};
|
10
10
|
|
11
11
|
const DrawerDefault = () => {
|
12
|
-
const [
|
13
|
-
const [
|
12
|
+
const [drawerLeftOpen, toggleDrawerLeftOpen] = useDrawer();
|
13
|
+
const [drawerRightOpen, toggleDrawerRightOpen ] = useDrawer();
|
14
14
|
|
15
15
|
return (
|
16
16
|
<>
|
@@ -18,13 +18,13 @@ const DrawerDefault = () => {
|
|
18
18
|
<Button
|
19
19
|
id="sm"
|
20
20
|
marginRight="md"
|
21
|
-
onClick={
|
21
|
+
onClick={toggleDrawerLeftOpen}
|
22
22
|
>
|
23
23
|
{"Left Drawer"}
|
24
24
|
</Button>
|
25
25
|
<Button
|
26
26
|
marginRight="xl"
|
27
|
-
onClick={
|
27
|
+
onClick={toggleDrawerRightOpen}
|
28
28
|
>
|
29
29
|
{"Right Drawer"}
|
30
30
|
</Button>
|
@@ -32,12 +32,8 @@ const DrawerDefault = () => {
|
|
32
32
|
<Flex>
|
33
33
|
{/* Left Drawer */}
|
34
34
|
<Drawer
|
35
|
-
|
36
|
-
|
37
|
-
onClose={toggleHeaderSeparatorDrawer}
|
38
|
-
opened={headerSeparatorDrawerOpened}
|
39
|
-
overlay
|
40
|
-
placement={"left"}
|
35
|
+
onClose={toggleDrawerLeftOpen}
|
36
|
+
opened={drawerLeftOpen}
|
41
37
|
size={"lg"}
|
42
38
|
>
|
43
39
|
Test me (Left Drawer)
|
@@ -45,11 +41,8 @@ const DrawerDefault = () => {
|
|
45
41
|
|
46
42
|
{/* Right Drawer */}
|
47
43
|
<Drawer
|
48
|
-
|
49
|
-
|
50
|
-
onClose={toggleBothSeparatorsDrawer}
|
51
|
-
opened={bothSeparatorsDrawerOpened}
|
52
|
-
overlay
|
44
|
+
onClose={toggleDrawerRightOpen}
|
45
|
+
opened={drawerRightOpen}
|
53
46
|
placement={"right"}
|
54
47
|
size={"lg"}
|
55
48
|
>
|
@@ -60,4 +53,4 @@ const DrawerDefault = () => {
|
|
60
53
|
);
|
61
54
|
};
|
62
55
|
|
63
|
-
export default DrawerDefault;
|
56
|
+
export default DrawerDefault;
|
@@ -1,31 +1,56 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { Button, Drawer, Icon,
|
1
|
+
import React, { useState, useEffect } from "react"
|
2
|
+
import { Button, Drawer, Icon, Nav, NavItem } from "playbook-ui"
|
3
3
|
|
4
4
|
const DrawerMenu = () => {
|
5
|
+
const [isSmallScreen, setIsSmallScreen] = useState(false)
|
6
|
+
|
7
|
+
useEffect(() => {
|
8
|
+
const mediaQuery = window.matchMedia("(max-width: 600px)")
|
9
|
+
setIsSmallScreen(mediaQuery.matches)
|
10
|
+
const handler = (e) => setIsSmallScreen(e.matches)
|
11
|
+
mediaQuery.addEventListener('change', handler)
|
12
|
+
return () => mediaQuery.removeEventListener('change', handler)
|
13
|
+
}, [])
|
5
14
|
|
6
15
|
return (
|
7
|
-
|
8
|
-
<Button id=
|
9
|
-
padding=
|
16
|
+
<div>
|
17
|
+
<Button id='menuButton'
|
18
|
+
padding='xs'
|
10
19
|
>
|
11
|
-
<Icon icon=
|
12
|
-
size=
|
20
|
+
<Icon icon='bars'
|
21
|
+
size='2x'
|
13
22
|
/>
|
14
23
|
</Button>
|
15
24
|
<Drawer
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
placement="left"
|
21
|
-
size="lg"
|
25
|
+
breakpoint="md"
|
26
|
+
placement='bottom'
|
27
|
+
size='full'
|
28
|
+
triggerId='menuButton'
|
22
29
|
withinElement
|
23
30
|
>
|
24
|
-
<
|
25
|
-
|
31
|
+
<Nav
|
32
|
+
highlight={false}
|
33
|
+
link='#'
|
34
|
+
orientation={isSmallScreen ? 'vertical' : 'horizontal'}
|
35
|
+
padding={isSmallScreen ? 'none' : 'sm'}
|
36
|
+
>
|
37
|
+
<NavItem link='#'
|
38
|
+
text='About'
|
39
|
+
/>
|
40
|
+
<NavItem active
|
41
|
+
link='#'
|
42
|
+
text='Case Studies'
|
43
|
+
/>
|
44
|
+
<NavItem link='#'
|
45
|
+
text='Service'
|
46
|
+
/>
|
47
|
+
<NavItem link='#'
|
48
|
+
text='Contacts'
|
49
|
+
/>
|
50
|
+
</Nav>
|
26
51
|
</Drawer>
|
27
|
-
|
28
|
-
)
|
29
|
-
}
|
52
|
+
</div>
|
53
|
+
)
|
54
|
+
}
|
30
55
|
|
31
|
-
export default DrawerMenu
|
56
|
+
export default DrawerMenu
|
@@ -1,6 +1,24 @@
|
|
1
|
-
|
1
|
+
The Drawer component can be used to create responsive navigation menus and sidebars. It provides flexible options for controlling when and how the drawer appears based on screen size.
|
2
|
+
|
3
|
+
### Within Element
|
4
|
+
The `withinElement` prop allows you to render the drawer within its parent container:
|
5
|
+
- The drawer will be positioned relative to its parent element
|
6
|
+
- Useful for creating nested navigation structures
|
7
|
+
- This must be used in conjunction with the `triggerId` prop
|
8
|
+
|
9
|
+
This provides a clean way to create responsive navigation patterns that adapt to different screen sizes while maintaining a consistent user experience.
|
10
|
+
|
11
|
+
### Trigger Id
|
12
|
+
The `triggerId` prop allows you to connect an element to control the drawer:
|
13
|
+
- The specified element will toggle the drawer open/closed
|
14
|
+
- The element is automatically hidden when the drawer is opened via breakpoint
|
15
|
+
- The element reappears when the drawer is closed via breakpoint
|
16
|
+
|
17
|
+
### Breakpoint
|
18
|
+
Use the `breakpoint` prop to control when the drawer automatically opens or closes based on screen size. For example, setting `breakpoint="md"` will:
|
19
|
+
- Close the drawer on screens smaller than the medium breakpoint (992px)
|
20
|
+
- Automatically open the drawer on screens larger than or equal to the medium breakpoint
|
21
|
+
|
2
22
|
|
3
|
-
Set a menu button with the `menuButtonID` props. When the Drawer is open, the menu button will be hidden. But when your Brakpoint closes the drawer, you can toggle the Drawer open/close with your menu butotn.
|
4
23
|
|
5
|
-
Also use the `withinElement` props to have the Drawer open within a specific element, instead of the default behavior of it taking up the entire screen size.
|
6
24
|
|