playbook_ui 13.16.0.pre.alpha.powercentrainplaybookpt22125 → 13.17.0.pre.alpha.nodealphaupgrade2157
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/_reset.scss +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +292 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +3 -3
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +2 -3
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +2 -2
- data/app/pb_kits/playbook/pb_dashboard/commonSettings.js +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +5 -7
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +12 -14
- data/app/pb_kits/playbook/pb_popover/docs/_popover_actionable_content.html.erb +30 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_actionable_content.jsx +57 -0
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_popover/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_popover/popover.test.js +29 -31
- data/app/pb_kits/playbook/pb_table/_table.tsx +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_striped.html.erb +48 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_striped.jsx +58 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_striped.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +19 -0
- data/app/pb_kits/playbook/pb_table/table.rb +7 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +5 -0
- data/app/pb_kits/playbook/tokens/_typography.scss +10 -10
- data/dist/menu.yml +102 -3
- data/dist/playbook-rails.js +7 -7
- data/dist/reset.css +1 -2
- data/lib/playbook/version.rb +2 -2
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d229baf16d600479c55f9fc35e8b93b5978cba2506b23e883860ea2094294809
|
4
|
+
data.tar.gz: 0d23fa917195b34c496c19a7f7f741e4ffce3807706019805469d92ba728c015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d3610e3ec299cc4bc396ebe9d11169d3da50624aec176a2656bb846f426410027213461715d2cfd83f55f8e53b478c4f734e2115fe9265a4203046d6318358d
|
7
|
+
data.tar.gz: f91b7cfefcb02e1078a1ff1f607bb71b55a10460ec8b9707f0e740783aeb0e36d6c54b84538cfa4857ef8daa044f1045d7d2aded18e2e51877acc2542d1a815c
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, {useState} from "react";
|
2
2
|
import { render, screen } from "../utilities/test-utils";
|
3
3
|
|
4
4
|
import { AdvancedTable } from "../";
|
@@ -13,7 +13,25 @@ const MOCK_DATA = [
|
|
13
13
|
scheduledMeetings: "10",
|
14
14
|
children: [
|
15
15
|
{
|
16
|
-
year: "
|
16
|
+
year: "2021",
|
17
|
+
quarter: "Q1",
|
18
|
+
month: null,
|
19
|
+
day: null,
|
20
|
+
newEnrollments: "2",
|
21
|
+
scheduledMeetings: "35",
|
22
|
+
},
|
23
|
+
],
|
24
|
+
},
|
25
|
+
{
|
26
|
+
year: "2022",
|
27
|
+
quarter: null,
|
28
|
+
month: null,
|
29
|
+
day: null,
|
30
|
+
newEnrollments: "20",
|
31
|
+
scheduledMeetings: "10",
|
32
|
+
children: [
|
33
|
+
{
|
34
|
+
year: "2022",
|
17
35
|
quarter: "Q1",
|
18
36
|
month: null,
|
19
37
|
day: null,
|
@@ -40,9 +58,70 @@ const columnDefinitions = [
|
|
40
58
|
},
|
41
59
|
];
|
42
60
|
|
61
|
+
const subRowHeaders = ["Quarter"]
|
62
|
+
|
43
63
|
const testId = "advanced_table";
|
44
64
|
|
45
|
-
|
65
|
+
const AdvancedTableExpandControl = () => {
|
66
|
+
const [expanded, setExpanded] = useState({'0': true})
|
67
|
+
|
68
|
+
const expandedControl = {
|
69
|
+
value: expanded,
|
70
|
+
onChange: setExpanded,
|
71
|
+
}
|
72
|
+
|
73
|
+
return (
|
74
|
+
<div>
|
75
|
+
<AdvancedTable
|
76
|
+
columnDefinitions={columnDefinitions}
|
77
|
+
data={{ testid: testId }}
|
78
|
+
expandedControl={expandedControl}
|
79
|
+
tableData={MOCK_DATA}
|
80
|
+
/>
|
81
|
+
</div>
|
82
|
+
);
|
83
|
+
}
|
84
|
+
|
85
|
+
const AdvancedTableSortControl = () => {
|
86
|
+
const [isSortDesc, setIsSortDesc] = useState({desc: false})
|
87
|
+
|
88
|
+
const sortControl = {
|
89
|
+
value: isSortDesc,
|
90
|
+
onChange: setIsSortDesc,
|
91
|
+
}
|
92
|
+
|
93
|
+
return (
|
94
|
+
<div>
|
95
|
+
<AdvancedTable
|
96
|
+
columnDefinitions={columnDefinitions}
|
97
|
+
data={{testid: testId}}
|
98
|
+
sortControl={sortControl}
|
99
|
+
tableData={MOCK_DATA}
|
100
|
+
>
|
101
|
+
<AdvancedTable.Header enableSorting />
|
102
|
+
<AdvancedTable.Body />
|
103
|
+
</AdvancedTable>
|
104
|
+
</div>
|
105
|
+
);
|
106
|
+
}
|
107
|
+
|
108
|
+
const tableOptions = {
|
109
|
+
initialState: {
|
110
|
+
sorting: [
|
111
|
+
{
|
112
|
+
id: "year",
|
113
|
+
desc: true,
|
114
|
+
},
|
115
|
+
],
|
116
|
+
},
|
117
|
+
}
|
118
|
+
|
119
|
+
const tableProps = {
|
120
|
+
container: false,
|
121
|
+
sticky: true
|
122
|
+
}
|
123
|
+
|
124
|
+
test("Generates default kit and classname", () => {
|
46
125
|
render(
|
47
126
|
<AdvancedTable
|
48
127
|
columnDefinitions={columnDefinitions}
|
@@ -53,4 +132,214 @@ test("generated scaffold test", () => {
|
|
53
132
|
|
54
133
|
const kit = screen.getByTestId(testId);
|
55
134
|
expect(kit).toBeInTheDocument();
|
135
|
+
expect(kit).toHaveClass('pb_advanced_table')
|
136
|
+
});
|
137
|
+
|
138
|
+
test("Generates aria label", () => {
|
139
|
+
render(
|
140
|
+
<AdvancedTable
|
141
|
+
aria={{label:testId}}
|
142
|
+
columnDefinitions={columnDefinitions}
|
143
|
+
data={{ testid: testId }}
|
144
|
+
tableData={MOCK_DATA}
|
145
|
+
/>
|
146
|
+
);
|
147
|
+
|
148
|
+
const kit = screen.getByTestId(testId);
|
149
|
+
expect(kit).toHaveAttribute('aria-label', testId)
|
150
|
+
});
|
151
|
+
|
152
|
+
test("Row toggle button exists and toggles subrows open and closed", () => {
|
153
|
+
render(
|
154
|
+
<AdvancedTable
|
155
|
+
columnDefinitions={columnDefinitions}
|
156
|
+
data={{ testid: testId }}
|
157
|
+
tableData={MOCK_DATA}
|
158
|
+
/>
|
159
|
+
);
|
160
|
+
|
161
|
+
const kit = screen.getByTestId(testId);
|
162
|
+
const rowButton = kit.querySelector(".gray-icon.expand-toggle-icon")
|
163
|
+
expect(rowButton).toBeInTheDocument()
|
164
|
+
const subRow1 = kit.querySelector(".bg-white.depth-sub-row-1")
|
165
|
+
expect(subRow1).not.toBeInTheDocument()
|
166
|
+
rowButton.click()
|
167
|
+
const subRow = kit.querySelector(".bg-white.depth-sub-row-1")
|
168
|
+
expect(subRow).toBeInTheDocument()
|
169
|
+
});
|
170
|
+
|
171
|
+
test("toggleExpansionAll button exists and toggles subrows open and closed", () => {
|
172
|
+
render(
|
173
|
+
<AdvancedTable
|
174
|
+
columnDefinitions={columnDefinitions}
|
175
|
+
data={{ testid: testId }}
|
176
|
+
tableData={MOCK_DATA}
|
177
|
+
/>
|
178
|
+
);
|
179
|
+
|
180
|
+
const kit = screen.getByTestId(testId);
|
181
|
+
const toggleButton = kit.querySelector(".gray-icon.toggle-all-icon")
|
182
|
+
expect(toggleButton).toBeInTheDocument()
|
183
|
+
const subRow1 = kit.querySelector(".bg-white.depth-sub-row-1")
|
184
|
+
expect(subRow1).not.toBeInTheDocument()
|
185
|
+
toggleButton.click()
|
186
|
+
const subRow = kit.querySelector(".bg-white.depth-sub-row-1")
|
187
|
+
expect(subRow).toBeInTheDocument()
|
188
|
+
});
|
189
|
+
|
190
|
+
test("loading state + initialLoadingRowCount prop", () => {
|
191
|
+
render(
|
192
|
+
<AdvancedTable
|
193
|
+
columnDefinitions={columnDefinitions}
|
194
|
+
data={{ testid: testId }}
|
195
|
+
initialLoadingRowsCount={13}
|
196
|
+
loading
|
197
|
+
tableData={MOCK_DATA}
|
198
|
+
/>
|
199
|
+
);
|
200
|
+
|
201
|
+
const kit = screen.getByTestId(testId);
|
202
|
+
const table = kit.querySelector('table')
|
203
|
+
expect(table).toHaveClass('pb_table table-sm table-responsive-none table-card data_table ns_tabular content-loading')
|
204
|
+
|
205
|
+
const tableBody = kit.querySelector('tbody')
|
206
|
+
const tableRows = tableBody.getElementsByTagName('tr')
|
207
|
+
expect(tableRows).toHaveLength(13)
|
208
|
+
});
|
209
|
+
|
210
|
+
test("subRowHeaders are rendered", () => {
|
211
|
+
render(
|
212
|
+
<AdvancedTable
|
213
|
+
columnDefinitions={columnDefinitions}
|
214
|
+
data={{ testid: testId }}
|
215
|
+
tableData={MOCK_DATA}
|
216
|
+
>
|
217
|
+
<AdvancedTable.Header />
|
218
|
+
<AdvancedTable.Body subRowHeaders={subRowHeaders}/>
|
219
|
+
</AdvancedTable>
|
220
|
+
);
|
221
|
+
|
222
|
+
const kit = screen.getByTestId(testId);
|
223
|
+
|
224
|
+
const rowButton = kit.querySelector(".gray-icon.expand-toggle-icon")
|
225
|
+
rowButton.click()
|
226
|
+
|
227
|
+
const subRowHeader = kit.querySelector(".custom-row.bg-silver")
|
228
|
+
expect(subRowHeader).toBeInTheDocument()
|
229
|
+
});
|
230
|
+
|
231
|
+
test("expandControl prop works as expected", () => {
|
232
|
+
render (<AdvancedTableExpandControl/>)
|
233
|
+
|
234
|
+
const kit = screen.getByTestId(testId);
|
235
|
+
const subRow = kit.querySelector(".bg-white.depth-sub-row-1")
|
236
|
+
expect(subRow).toBeInTheDocument()
|
237
|
+
})
|
238
|
+
|
239
|
+
test("tableOptions prop functions as expected", () => {
|
240
|
+
render(
|
241
|
+
<AdvancedTable
|
242
|
+
columnDefinitions={columnDefinitions}
|
243
|
+
data={{ testid: testId }}
|
244
|
+
tableData={MOCK_DATA}
|
245
|
+
tableOptions={tableOptions}
|
246
|
+
/>
|
247
|
+
);
|
248
|
+
|
249
|
+
const kit = screen.getByTestId(testId);
|
250
|
+
const row1 = kit.getElementsByTagName('tr')[1]
|
251
|
+
|
252
|
+
expect(row1.id).toBe("1-1-0-row")
|
253
|
+
});
|
254
|
+
|
255
|
+
test("tableProps prop functions as expected", () => {
|
256
|
+
render(
|
257
|
+
<AdvancedTable
|
258
|
+
columnDefinitions={columnDefinitions}
|
259
|
+
data={{ testid: testId }}
|
260
|
+
tableData={MOCK_DATA}
|
261
|
+
tableProps={tableProps}
|
262
|
+
/>
|
263
|
+
);
|
264
|
+
|
265
|
+
const kit = screen.getByTestId(testId);
|
266
|
+
const table = kit.querySelector('table')
|
267
|
+
expect(table).toHaveClass("pb_table table-sm table-responsive-none data_table sticky-header ns_tabular")
|
56
268
|
});
|
269
|
+
|
270
|
+
test("enableExpansionIcon changes icon", () => {
|
271
|
+
render(
|
272
|
+
<AdvancedTable
|
273
|
+
columnDefinitions={columnDefinitions}
|
274
|
+
data={{ testid: testId }}
|
275
|
+
tableData={MOCK_DATA}
|
276
|
+
tableProps={tableProps}
|
277
|
+
toggleExpansionIcon= "chevron-up"
|
278
|
+
/>
|
279
|
+
);
|
280
|
+
|
281
|
+
const kit = screen.getByTestId(testId);
|
282
|
+
const tableHead = kit.querySelector('table')
|
283
|
+
const toggleIcon= tableHead.querySelector(".pb_icon_kit")
|
284
|
+
expect(toggleIcon).toHaveClass("fa-chevron-up")
|
285
|
+
});
|
286
|
+
|
287
|
+
test("sortIcon changes icon", () => {
|
288
|
+
render(
|
289
|
+
<AdvancedTable
|
290
|
+
columnDefinitions={columnDefinitions}
|
291
|
+
data={{ testid: testId }}
|
292
|
+
tableData={MOCK_DATA}
|
293
|
+
tableProps={tableProps}
|
294
|
+
>
|
295
|
+
<AdvancedTable.Header
|
296
|
+
enableSorting
|
297
|
+
sortIcon= {["chevron-up","chevron-down"]}
|
298
|
+
/>
|
299
|
+
<AdvancedTable.Body />
|
300
|
+
</AdvancedTable>
|
301
|
+
);
|
302
|
+
|
303
|
+
const kit = screen.getByTestId(testId);
|
304
|
+
const sortIcon = kit.querySelector('.sort-button-icon')
|
305
|
+
const icon= sortIcon.querySelector(".pb_icon_kit")
|
306
|
+
expect(icon).toHaveClass("fa-chevron-down")
|
307
|
+
});
|
308
|
+
|
309
|
+
test("Sort icon renders with enableSorting + sortControl works as expected", () => {
|
310
|
+
render (<AdvancedTableSortControl/>)
|
311
|
+
|
312
|
+
const kit = screen.getByTestId(testId);
|
313
|
+
const sortIcon = kit.querySelector(".sort-button-icon")
|
314
|
+
expect(sortIcon).toBeInTheDocument()
|
315
|
+
|
316
|
+
const row1 = kit.getElementsByTagName('tr')[1]
|
317
|
+
|
318
|
+
expect(row1.id).toBe("1-1-0-row")
|
319
|
+
})
|
320
|
+
|
321
|
+
test("sort button exists and sorts column data", () => {
|
322
|
+
render(
|
323
|
+
<AdvancedTable
|
324
|
+
columnDefinitions={columnDefinitions}
|
325
|
+
data={{ testid: testId }}
|
326
|
+
tableData={MOCK_DATA}
|
327
|
+
>
|
328
|
+
<AdvancedTable.Header enableSorting />
|
329
|
+
<AdvancedTable.Body />
|
330
|
+
</AdvancedTable>
|
331
|
+
);
|
332
|
+
|
333
|
+
const kit = screen.getByTestId(testId);
|
334
|
+
|
335
|
+
const sortButton= kit.querySelector(".pb_flex_kit_orientation_row_justify_content_between_align_items_top_spacing_none.pl_xxs.cursor_pointer.header-sort-button.pb_th_link")
|
336
|
+
expect(sortButton).toBeInTheDocument()
|
337
|
+
|
338
|
+
const row1 = kit.getElementsByTagName('tr')[1]
|
339
|
+
|
340
|
+
expect(row1.id).toBe("0-0-0-row")
|
341
|
+
sortButton.click()
|
342
|
+
|
343
|
+
const row2 = kit.getElementsByTagName('tr')[2]
|
344
|
+
expect(row2.id).toBe("0-0-0-row")
|
345
|
+
});
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
$pb_button_size: 40px;
|
11
11
|
$pb_button_v_padding: 7px;
|
12
|
-
$pb_button_h_padding:
|
12
|
+
$pb_button_h_padding: 34px;
|
13
13
|
$pb_button_hover_darken: 4%;
|
14
14
|
$pb_button_border_width: 0px;
|
15
15
|
|
@@ -27,13 +27,12 @@ $pb_button_border_width: 0px;
|
|
27
27
|
text-rendering: optimizeLegibility;
|
28
28
|
font-size: $font_small;
|
29
29
|
font-weight: $bold;
|
30
|
-
letter-spacing: $lspace_loose;
|
31
30
|
text-align: center;
|
32
31
|
vertical-align: middle;
|
33
32
|
text-transform: none;
|
34
33
|
border-width: $pb_button_border_width;
|
35
34
|
border-style: solid;
|
36
|
-
border-radius: $
|
35
|
+
border-radius: $border_rad_light;
|
37
36
|
min-height: $pb_button_size;
|
38
37
|
line-height: 1.5;
|
39
38
|
padding: $pb_button_v_padding $pb_button_h_padding;
|
@@ -53,7 +53,7 @@ const adjustAxisStyle = (axis) => {
|
|
53
53
|
/* Change axis label styles */
|
54
54
|
axis.labels.style.fontFamily = typography.font_family_base
|
55
55
|
axis.labels.style.color = colors.charcoal
|
56
|
-
axis.labels.style.fontWeight = typography.
|
56
|
+
axis.labels.style.fontWeight = typography.light
|
57
57
|
axis.labels.style.fontSize = typography.font_small
|
58
58
|
}
|
59
59
|
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb
CHANGED
@@ -3,12 +3,10 @@
|
|
3
3
|
<%= pb_rails("button", props: {html_type: "submit", text: "Save Phone Number"}) %>
|
4
4
|
</form>
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
document.addEventListener('
|
9
|
-
|
10
|
-
if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) e.preventDefault();
|
11
|
-
})
|
6
|
+
<%= javascript_tag do %>
|
7
|
+
document.addEventListener('DOMContentLoaded', function () {
|
8
|
+
document.querySelector('#example-form-validation').addEventListener('submit', function (e) {
|
9
|
+
if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) e.preventDefault();
|
12
10
|
})
|
13
|
-
|
11
|
+
})
|
14
12
|
<% end %>
|
@@ -171,29 +171,27 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
|
|
171
171
|
|
172
172
|
document.body.addEventListener(
|
173
173
|
"click",
|
174
|
-
(
|
174
|
+
(e: MouseEvent) => {
|
175
|
+
const target = e.target as HTMLElement
|
176
|
+
|
175
177
|
const targetIsPopover =
|
176
|
-
|
177
|
-
null;
|
178
|
+
target.closest("#" + targetId) !== null;
|
178
179
|
const targetIsReference =
|
179
|
-
|
180
|
-
|
180
|
+
target.closest("#reference-" + targetId) !== null;
|
181
|
+
|
182
|
+
const shouldClose = () => {
|
183
|
+
setTimeout(() => shouldClosePopover(true), 0);
|
184
|
+
}
|
181
185
|
|
182
186
|
switch (closeOnClick) {
|
183
187
|
case "outside":
|
184
|
-
if (!targetIsPopover && !targetIsReference)
|
185
|
-
shouldClosePopover(true);
|
186
|
-
}
|
188
|
+
if (!targetIsPopover && !targetIsReference) shouldClose();
|
187
189
|
break;
|
188
190
|
case "inside":
|
189
|
-
if (targetIsPopover)
|
190
|
-
shouldClosePopover(true);
|
191
|
-
}
|
191
|
+
if (targetIsPopover) shouldClose();
|
192
192
|
break;
|
193
193
|
case "any":
|
194
|
-
if (targetIsPopover || !targetIsPopover && !targetIsReference)
|
195
|
-
shouldClosePopover(true);
|
196
|
-
}
|
194
|
+
if (targetIsPopover || !targetIsPopover && !targetIsReference) shouldClose();
|
197
195
|
break;
|
198
196
|
}
|
199
197
|
},
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%= pb_rails("flex", props: {
|
2
|
+
dark: true,
|
3
|
+
orientation: "row",
|
4
|
+
vertical: "center"
|
5
|
+
}) do %>
|
6
|
+
<%= pb_rails("body", props: { text: "Click info for more details" }) %>
|
7
|
+
|
8
|
+
<%= pb_rails("circle_icon_button", props: {
|
9
|
+
variant: "secondary",
|
10
|
+
icon: "info",
|
11
|
+
id: "actionable-popover-1"
|
12
|
+
}) %>
|
13
|
+
<%= pb_rails("popover", props: {
|
14
|
+
close_on_click: "any",
|
15
|
+
trigger_element_id: "actionable-popover-1",
|
16
|
+
tooltip_id: "actionable-tooltip-1",
|
17
|
+
offset: true,
|
18
|
+
position: "top"
|
19
|
+
}) do %>
|
20
|
+
<%= pb_rails("button", props: { id: "actionable-tooltip-button", text: "Learn more" }) %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= javascript_tag do %>
|
25
|
+
document.addEventListener('DOMContentLoaded', function () {
|
26
|
+
document.querySelector('#actionable-tooltip-button').addEventListener('click', function (e) {
|
27
|
+
alert("Let's do this")
|
28
|
+
}, { once: true })
|
29
|
+
})
|
30
|
+
<% end %>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import {
|
3
|
+
Body,
|
4
|
+
Button,
|
5
|
+
CircleIconButton,
|
6
|
+
Flex,
|
7
|
+
PbReactPopover,
|
8
|
+
} from '../..'
|
9
|
+
|
10
|
+
const PopoverActionableContent = (props) => {
|
11
|
+
const [showPopover, setShowPopover] = useState(false)
|
12
|
+
|
13
|
+
const handleTogglePopover = () => {
|
14
|
+
setShowPopover(!showPopover)
|
15
|
+
}
|
16
|
+
|
17
|
+
const handleShouldClosePopover = (shouldClose) => {
|
18
|
+
setShowPopover(!shouldClose)
|
19
|
+
}
|
20
|
+
|
21
|
+
const popoverReference = (
|
22
|
+
<CircleIconButton
|
23
|
+
icon="info"
|
24
|
+
onClick={handleTogglePopover}
|
25
|
+
variant="secondary"
|
26
|
+
/>
|
27
|
+
)
|
28
|
+
|
29
|
+
return (
|
30
|
+
<Flex
|
31
|
+
orientation="row"
|
32
|
+
vertical="center"
|
33
|
+
{...props}
|
34
|
+
>
|
35
|
+
<Body text="Click info for more details" />
|
36
|
+
|
37
|
+
<PbReactPopover
|
38
|
+
closeOnClick="inside"
|
39
|
+
offset
|
40
|
+
placement="top"
|
41
|
+
reference={popoverReference}
|
42
|
+
shouldClosePopover={handleShouldClosePopover}
|
43
|
+
show={showPopover}
|
44
|
+
{...props}
|
45
|
+
>
|
46
|
+
<Body textAlign="center">
|
47
|
+
<Button
|
48
|
+
onClick={() => {alert("Let's do this!")}}
|
49
|
+
text="Learn More"
|
50
|
+
/>
|
51
|
+
</Body>
|
52
|
+
</PbReactPopover>
|
53
|
+
</Flex>
|
54
|
+
)
|
55
|
+
}
|
56
|
+
|
57
|
+
export default PopoverActionableContent
|
@@ -5,6 +5,7 @@ examples:
|
|
5
5
|
- popover_close: Close Options
|
6
6
|
- popover_z_index: Set Z-Index
|
7
7
|
- popover_scroll_height: Scroll and Height Settings
|
8
|
+
- popover_actionable_content: With Actionable Content
|
8
9
|
|
9
10
|
react:
|
10
11
|
- popover_default: Default
|
@@ -12,4 +13,4 @@ examples:
|
|
12
13
|
- popover_close: Close Options
|
13
14
|
- popover_z_index: Set Z-Index
|
14
15
|
- popover_scroll_height: Scroll and Height Settings
|
15
|
-
|
16
|
+
- popover_actionable_content: With Actionable Content
|
@@ -3,3 +3,4 @@ export { default as PopoverList } from './_popover_list.jsx'
|
|
3
3
|
export { default as PopoverClose } from './_popover_close.jsx'
|
4
4
|
export { default as PopoverZIndex } from './_popover_z_index.jsx'
|
5
5
|
export { default as PopoverScrollHeight } from './_popover_scroll_height.jsx'
|
6
|
+
export { default as PopoverActionableContent } from './_popover_actionable_content.jsx'
|