playbook_ui_docs 15.4.0.pre.rc.2 → 15.4.0.pre.rc.3
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_with_custom_header_multi_header.jsx +16 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.html.erb +104 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.jsx +38 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.md +14 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.jsx +18 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.md +4 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.jsx +18 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.jsx +19 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.jsx +38 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.md +14 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +15 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.html.erb +9 -8
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions.html.erb +11 -10
- data/dist/playbook-doc.js +1 -1
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 633d736578c91f6476350ae6ea9443ec55d8ef3d0f43699834e72ade09fcc84a
|
|
4
|
+
data.tar.gz: dae6c8416b48eb063403aac233dc45002e9cd2d2b84b9df3da559841e72fe163
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b93c3ec5eac035f4d521f88ce23a50bc240eda6ce89019a60cf19261c410d4003298e76221822b5ed4a3d0fbb369f49787a60fd145cada6d24f3d74c1fa88744
|
|
7
|
+
data.tar.gz: 063d1adb4f740a2b2efadea68c6fdee1654aeb34bec31376c9a07eda8faa11685a5a9d648d51dc76167b98502be04c9b8b9bf1a402359e5751d401364010f9c1
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx
CHANGED
|
@@ -76,6 +76,22 @@ const columnDefinitions = [
|
|
|
76
76
|
{
|
|
77
77
|
label: "Attendance",
|
|
78
78
|
id: "attendance",
|
|
79
|
+
header: () => (
|
|
80
|
+
<Flex alignItems="center"
|
|
81
|
+
justifyContent="center"
|
|
82
|
+
>
|
|
83
|
+
<Caption marginRight="xs">Attendance</Caption>
|
|
84
|
+
<Tooltip placement="top"
|
|
85
|
+
text="Whoa. I'm a Tooltip Too!"
|
|
86
|
+
zIndex={10}
|
|
87
|
+
>
|
|
88
|
+
<Icon cursor="pointer"
|
|
89
|
+
icon="info"
|
|
90
|
+
size="xs"
|
|
91
|
+
/>
|
|
92
|
+
</Tooltip>
|
|
93
|
+
</Flex>
|
|
94
|
+
),
|
|
79
95
|
columns: [
|
|
80
96
|
{
|
|
81
97
|
accessor: "attendanceRate",
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<%
|
|
2
|
+
column_definitions = [
|
|
3
|
+
{
|
|
4
|
+
accessor: "year",
|
|
5
|
+
label: "Year",
|
|
6
|
+
id: "year",
|
|
7
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: "Enrollment Data",
|
|
11
|
+
id: "enrollmentData",
|
|
12
|
+
header: ->(cell, label) {
|
|
13
|
+
capture do
|
|
14
|
+
pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
|
|
15
|
+
pb_rails("caption", props: { margin_right: "xs", text: "Enrollment Data" }) +
|
|
16
|
+
pb_rails("icon", props: { id: "tooltip-interact-multi", icon: "info", size: "xs", cursor: "pointer" }) +
|
|
17
|
+
pb_rails("tooltip", props: {
|
|
18
|
+
trigger_element_id: "tooltip-interact-multi",
|
|
19
|
+
tooltip_id: "example-custom-tooltip-multi",
|
|
20
|
+
position: "top",
|
|
21
|
+
z_index: "10"
|
|
22
|
+
}) do
|
|
23
|
+
"Whoa. I'm a Tooltip"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
},
|
|
28
|
+
columns: [
|
|
29
|
+
{
|
|
30
|
+
label: "Enrollment Stats",
|
|
31
|
+
id: "enrollmentStats",
|
|
32
|
+
columns: [
|
|
33
|
+
{
|
|
34
|
+
accessor: "newEnrollments",
|
|
35
|
+
id: "newEnrollments",
|
|
36
|
+
label: "New Enrollments",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
accessor: "scheduledMeetings",
|
|
40
|
+
id: "scheduledMeetings",
|
|
41
|
+
label: "Scheduled Meetings",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Performance Data",
|
|
49
|
+
id: "performanceData",
|
|
50
|
+
columns: [
|
|
51
|
+
{
|
|
52
|
+
label: "Completion Metrics",
|
|
53
|
+
id: "completionMetrics",
|
|
54
|
+
columns: [
|
|
55
|
+
{
|
|
56
|
+
accessor: "completedClasses",
|
|
57
|
+
id: "completedClasses",
|
|
58
|
+
label: "Completed Classes",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
accessor: "classCompletionRate",
|
|
62
|
+
id: "classCompletionRate",
|
|
63
|
+
label: "Class Completion Rate",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Attendance",
|
|
69
|
+
id: "attendance",
|
|
70
|
+
header: ->(cell, label) {
|
|
71
|
+
capture do
|
|
72
|
+
pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
|
|
73
|
+
pb_rails("caption", props: { margin_right: "xs", text: "Attendance" }) +
|
|
74
|
+
pb_rails("icon", props: { id: "tooltip-interact-multi-2", icon: "info", size: "xs", cursor: "pointer" }) +
|
|
75
|
+
pb_rails("tooltip", props: {
|
|
76
|
+
trigger_element_id: "tooltip-interact-multi-2",
|
|
77
|
+
tooltip_id: "example-custom-tooltip-multi-2",
|
|
78
|
+
position: "top",
|
|
79
|
+
z_index: "10"
|
|
80
|
+
}) do
|
|
81
|
+
"Whoa. I'm a Tooltip Too!"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
},
|
|
86
|
+
columns: [
|
|
87
|
+
{
|
|
88
|
+
accessor: "attendanceRate",
|
|
89
|
+
id: "attendanceRate",
|
|
90
|
+
label: "Attendance Rate",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
accessor: "scheduledMeetings",
|
|
94
|
+
id: "scheduledMeetings",
|
|
95
|
+
label: "Scheduled Meetings",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
%>
|
|
103
|
+
|
|
104
|
+
<%= pb_rails("advanced_table", props: { id: "custom_header_multi_header_table", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The optional `header` item within `column_definitions` can also be used with multi headers as seen here.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
capture do
|
|
13
13
|
pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
|
|
14
14
|
pb_rails("caption", props: { margin_right: "xs", text: "New Enrollments" }) +
|
|
15
|
-
pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs" }) +
|
|
15
|
+
pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs", cursor: "pointer" }) +
|
|
16
16
|
pb_rails("tooltip", props: {
|
|
17
17
|
trigger_element_id: "tooltip-interact",
|
|
18
18
|
tooltip_id: "example-custom-tooltip",
|
|
@@ -11,6 +11,7 @@ examples:
|
|
|
11
11
|
- advanced_table_responsive: Responsive Tables
|
|
12
12
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
|
13
13
|
- advanced_table_with_custom_header_rails: Custom Header Cell
|
|
14
|
+
- advanced_table_with_custom_header_multi_header_rails: Custom Header with Multiple Headers
|
|
14
15
|
- advanced_table_column_headers: Multi-Header Columns
|
|
15
16
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
|
16
17
|
- advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dropdown from "../../pb_dropdown/_dropdown";
|
|
3
|
+
import DatePicker from "../../pb_date_picker/_date_picker";
|
|
4
|
+
|
|
5
|
+
const DatePickerAndDropdownRange = (props) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<Dropdown
|
|
9
|
+
controlsEndId="end-date-picker1"
|
|
10
|
+
controlsStartId="start-date-picker1"
|
|
11
|
+
id="dropdown-as-quickpick"
|
|
12
|
+
label="Date Range"
|
|
13
|
+
marginBottom="sm"
|
|
14
|
+
placeholder="Select a Date Range"
|
|
15
|
+
variant="quickpick"
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<DatePicker
|
|
20
|
+
label="Start Date"
|
|
21
|
+
pickerId="start-date-picker1"
|
|
22
|
+
placeholder="Select a Start Date"
|
|
23
|
+
syncStartWith="dropdown-as-quickpick"
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<DatePicker
|
|
28
|
+
label="End Date"
|
|
29
|
+
pickerId="end-date-picker1"
|
|
30
|
+
placeholder="Select an End Date"
|
|
31
|
+
syncEndWith="dropdown-as-quickpick"
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default DatePickerAndDropdownRange;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
You can link a Dropdown (`quickpick` variant) to standard DatePickers using the following props:
|
|
2
|
+
|
|
3
|
+
**For the Dropdown**:
|
|
4
|
+
`controlsStartId`: ID of the DatePicker that should receive the start date.
|
|
5
|
+
|
|
6
|
+
`controlsEndId`: ID of the DatePicker that should receive the end date.
|
|
7
|
+
|
|
8
|
+
When a quickpick option like “This Year” is selected, it automatically populates the linked start and end inputs.
|
|
9
|
+
|
|
10
|
+
**For the Start/End DatePickers**:
|
|
11
|
+
`syncStartWith`: ID of the quickpick this start date is synced to.
|
|
12
|
+
`syncEndWith`: ID of the quickpick this end date is synced to.
|
|
13
|
+
|
|
14
|
+
When a user manually edits the start or end date, it clears the selected quickpick to prevent conflicting values.
|
|
@@ -48,7 +48,8 @@ examples:
|
|
|
48
48
|
- date_picker_quick_pick_custom: Custom Quick Pick Dates
|
|
49
49
|
- date_picker_quick_pick_custom_override: Custom Quick Pick Dates (append to defaults)
|
|
50
50
|
- date_picker_quick_pick_default_date: Range (Quick Pick w/ Default Date)
|
|
51
|
-
- date_picker_range_pattern: Range with 2 Date Pickers and a Quick Pick
|
|
51
|
+
# - date_picker_range_pattern: Range with 2 Date Pickers and a Quick Pick
|
|
52
|
+
- date_picker_and_dropdown_range: Range with Dropdown and 2 Date Pickers
|
|
52
53
|
- date_picker_format: Format
|
|
53
54
|
- date_picker_disabled: Disabled Dates
|
|
54
55
|
- date_picker_min_max: Min Max
|
|
@@ -26,4 +26,5 @@ export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
|
|
|
26
26
|
export { default as DatePickerQuickPickCustom } from './_date_picker_quick_pick_custom'
|
|
27
27
|
export { default as DatePickerQuickPickCustomOverride } from './_date_picker_quick_pick_custom_override'
|
|
28
28
|
export { default as DatePickerQuickPickDefaultDate } from './_date_picker_quick_pick_default_date'
|
|
29
|
-
export { default as DatePickerRangePattern } from './_date_picker_range_pattern'
|
|
29
|
+
export { default as DatePickerRangePattern } from './_date_picker_range_pattern'
|
|
30
|
+
export { default as DatePickerAndDropdownRange } from './_date_picker_and_dropdown_range.jsx'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Dropdown from '../../pb_dropdown/_dropdown'
|
|
3
|
+
|
|
4
|
+
const DropdownQuickpick = (props) => {
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<Dropdown
|
|
9
|
+
label="Date Range"
|
|
10
|
+
onSelect={(selectedItem) => console.log(selectedItem)}
|
|
11
|
+
variant="quickpick"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default DropdownQuickpick
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Dropdown from '../../pb_dropdown/_dropdown'
|
|
3
|
+
|
|
4
|
+
const DropdownQuickpickDefaultDates = (props) => {
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<Dropdown
|
|
9
|
+
defaultValue="This Year"
|
|
10
|
+
label="Date Range"
|
|
11
|
+
variant="quickpick"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default DropdownQuickpickDefaultDates
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
To set a default value for the Dropdown, you can use the label of the range you want set as default, for example "This Year", "Today", etc.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Dropdown from '../../pb_dropdown/_dropdown'
|
|
3
|
+
|
|
4
|
+
const DropdownQuickpickRangeEnd = (props) => {
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<Dropdown
|
|
9
|
+
label="Date Range"
|
|
10
|
+
onSelect={(selectedItem) => console.log(selectedItem)}
|
|
11
|
+
rangeEndsToday
|
|
12
|
+
variant="quickpick"
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default DropdownQuickpickRangeEnd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The optional `rangeEndsToday` prop can be used with the quickpick variant to set end date on all ranges that start with 'this' to today's date. For instance, by default 'This Year' will set end day to 12/31/(current year), but if `rangeEndsToday` prop is used, end date on that range will be today's date.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dropdown from "../../pb_dropdown/_dropdown";
|
|
3
|
+
import DatePicker from "../../pb_date_picker/_date_picker";
|
|
4
|
+
|
|
5
|
+
const DropdownQuickpickWithDatePickers = (props) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<Dropdown
|
|
9
|
+
controlsEndId="end-date-picker"
|
|
10
|
+
controlsStartId="start-date-picker"
|
|
11
|
+
id="dropdown-quickpick"
|
|
12
|
+
label="Range"
|
|
13
|
+
marginBottom="sm"
|
|
14
|
+
placeholder="Select a Date Range"
|
|
15
|
+
variant="quickpick"
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<DatePicker
|
|
20
|
+
label="Start Date"
|
|
21
|
+
pickerId="start-date-picker"
|
|
22
|
+
placeholder="Select a Start Date"
|
|
23
|
+
syncStartWith="dropdown-quickpick"
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<DatePicker
|
|
28
|
+
label="End Date"
|
|
29
|
+
pickerId="end-date-picker"
|
|
30
|
+
placeholder="Select an End Date"
|
|
31
|
+
syncEndWith="dropdown-quickpick"
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default DropdownQuickpickWithDatePickers;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
You can link a Dropdown (`quickpick` variant) to standard DatePickers using the following props:
|
|
2
|
+
|
|
3
|
+
**For the Dropdown**:
|
|
4
|
+
`controlsStartId`: ID of the DatePicker that should receive the start date.
|
|
5
|
+
|
|
6
|
+
`controlsEndId`: ID of the DatePicker that should receive the end date.
|
|
7
|
+
|
|
8
|
+
When a quickpick option like “This Year” is selected, it automatically populates the linked start and end inputs.
|
|
9
|
+
|
|
10
|
+
**For the Start/End DatePickers**:
|
|
11
|
+
`syncStartWith`: ID of the quickpick this start date is synced to.
|
|
12
|
+
`syncEndWith`: ID of the quickpick this end date is synced to.
|
|
13
|
+
|
|
14
|
+
When a user manually edits the start or end date, it clears the selected quickpick to prevent conflicting values.
|
|
@@ -49,4 +49,9 @@ examples:
|
|
|
49
49
|
- dropdown_clear_selection: Clear Selection
|
|
50
50
|
- dropdown_separators_hidden: Separators Hidden
|
|
51
51
|
- dropdown_with_external_control: useDropdown Hook
|
|
52
|
+
- dropdown_quickpick: Quick Pick Variant
|
|
53
|
+
- dropdown_quickpick_range_end: Quick Pick Variant (Range Ends Today)
|
|
54
|
+
- dropdown_quickpick_default_dates: Quick Pick Variant (Default Dates)
|
|
55
|
+
- dropdown_quickpick_with_date_pickers: Quick Pick Variant with Date Pickers
|
|
56
|
+
|
|
52
57
|
|
|
@@ -22,4 +22,8 @@ export { default as DropdownMultiSelectWithDefault } from './_dropdown_multi_sel
|
|
|
22
22
|
export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
|
|
23
23
|
export {default as DropdownWithCustomIconOptions} from './_dropdown_with_custom_icon_options.jsx'
|
|
24
24
|
export {default as DropdownWithCustomRadioOptions} from './_dropdown_with_custom_radio_options.jsx'
|
|
25
|
-
export {default as DropdownWithCustomActiveStyleOptions} from './_dropdown_with_custom_active_style_options.jsx'
|
|
25
|
+
export {default as DropdownWithCustomActiveStyleOptions} from './_dropdown_with_custom_active_style_options.jsx'
|
|
26
|
+
export { default as DropdownQuickpick } from './_dropdown_quickpick.jsx'
|
|
27
|
+
export { default as DropdownQuickpickRangeEnd } from './_dropdown_quickpick_range_end.jsx'
|
|
28
|
+
export { default as DropdownQuickpickDefaultDates } from './_dropdown_quickpick_default_dates.jsx'
|
|
29
|
+
export { default as DropdownQuickpickWithDatePickers } from './_dropdown_quickpick_with_date_pickers.jsx'
|
|
@@ -22,13 +22,27 @@
|
|
|
22
22
|
}) %>
|
|
23
23
|
|
|
24
24
|
<script>
|
|
25
|
+
// Hide toasts immediately
|
|
26
|
+
const hideAutoToasts = () => {
|
|
27
|
+
const toastAuto = document.getElementById('toast-auto-close');
|
|
28
|
+
const toastAutoCloseable = document.getElementById('toast-auto-close-closeable');
|
|
29
|
+
if (toastAuto) toastAuto.style.display = 'none';
|
|
30
|
+
if (toastAutoCloseable) toastAutoCloseable.style.display = 'none';
|
|
31
|
+
}
|
|
32
|
+
hideAutoToasts();
|
|
33
|
+
|
|
34
|
+
// Handle various page load/restore events
|
|
35
|
+
window.addEventListener('pageshow', hideAutoToasts)
|
|
36
|
+
document.addEventListener('turbolinks:load', hideAutoToasts)
|
|
37
|
+
document.addEventListener('turbo:load', hideAutoToasts)
|
|
38
|
+
|
|
25
39
|
document.addEventListener('DOMContentLoaded', () => {
|
|
26
40
|
// Initialize toast elements and buttons
|
|
27
41
|
const toasts = {
|
|
28
42
|
'#toast-auto-close': document.querySelector("#toast-auto-close"),
|
|
29
43
|
'#toast-auto-close-closeable': document.querySelector("#toast-auto-close-closeable")
|
|
30
44
|
}
|
|
31
|
-
|
|
45
|
+
|
|
32
46
|
const buttons = {
|
|
33
47
|
'#toast-auto-close': document.querySelector("button[data-toast='#toast-auto-close']"),
|
|
34
48
|
'#toast-auto-close-closeable': document.querySelector("button[data-toast='#toast-auto-close-closeable']")
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
horizontal: "center"
|
|
25
25
|
}) %>
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
<script type="text/javascript">
|
|
29
28
|
const multitoasts = document.querySelectorAll(".multitoast-to-hide")
|
|
30
29
|
const multibuttons = document.querySelectorAll("button[data-multitoast]")
|
|
@@ -35,6 +34,15 @@
|
|
|
35
34
|
})
|
|
36
35
|
}
|
|
37
36
|
|
|
37
|
+
// Hide toasts immediately
|
|
38
|
+
hideMultiToasts()
|
|
39
|
+
|
|
40
|
+
// Handle various page load/restore events
|
|
41
|
+
window.addEventListener('pageshow', hideMultiToasts)
|
|
42
|
+
document.addEventListener('DOMContentLoaded', hideMultiToasts)
|
|
43
|
+
document.addEventListener('turbolinks:load', hideMultiToasts)
|
|
44
|
+
document.addEventListener('turbo:load', hideMultiToasts)
|
|
45
|
+
|
|
38
46
|
multibuttons.forEach((button) => {
|
|
39
47
|
button.onclick = () => {
|
|
40
48
|
hideMultiToasts()
|
|
@@ -46,10 +54,3 @@
|
|
|
46
54
|
}
|
|
47
55
|
})
|
|
48
56
|
</script>
|
|
49
|
-
|
|
50
|
-
<!-- hiding toast on page load -->
|
|
51
|
-
<style>
|
|
52
|
-
#toast-long, #toast-short {
|
|
53
|
-
display: none;
|
|
54
|
-
}
|
|
55
|
-
</style>
|
|
@@ -69,27 +69,28 @@
|
|
|
69
69
|
const toasts = document.querySelectorAll(".toast-to-hide")
|
|
70
70
|
const buttons = document.querySelectorAll("button[data-toast]")
|
|
71
71
|
|
|
72
|
-
const
|
|
72
|
+
const hidePositionToasts = () => {
|
|
73
73
|
toasts.forEach((toast) => {
|
|
74
74
|
toast.style.display = "none"
|
|
75
75
|
})
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
// Hide toasts immediately
|
|
79
|
+
hidePositionToasts()
|
|
80
|
+
|
|
81
|
+
// Handle various page load/restore events
|
|
82
|
+
window.addEventListener('pageshow', hidePositionToasts)
|
|
83
|
+
document.addEventListener('DOMContentLoaded', hidePositionToasts)
|
|
84
|
+
document.addEventListener('turbolinks:load', hidePositionToasts)
|
|
85
|
+
document.addEventListener('turbo:load', hidePositionToasts)
|
|
86
|
+
|
|
78
87
|
buttons.forEach((button) => {
|
|
79
88
|
button.onclick = () => {
|
|
80
|
-
|
|
89
|
+
hidePositionToasts()
|
|
81
90
|
let toast = document.querySelector(button.getAttribute("data-toast"))
|
|
82
|
-
|
|
83
91
|
if (toast) {
|
|
84
92
|
toast.style.display = "flex"
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
})
|
|
88
96
|
</script>
|
|
89
|
-
|
|
90
|
-
<!-- hiding toast on page load -->
|
|
91
|
-
<style>
|
|
92
|
-
#toast-top-center, #toast-top-right, #toast-top-left, #toast-bottom-center, #toast-bottom-right, #toast-bottom-left {
|
|
93
|
-
display: none;
|
|
94
|
-
}
|
|
95
|
-
</style>
|