playbook_ui 16.3.0.pre.alpha.PLAY2867nokogiriupdate14992 → 16.3.0.pre.alpha.fixdatepickermonthsdropdownreset14888
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/Hooks/useTableState.ts +2 -5
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -35
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -4
- data/app/pb_kits/playbook/pb_dropdown/index.js +0 -161
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +0 -4
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +0 -3
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -7
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -7
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -11
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowModelUtils.ts +0 -100
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.jsx +0 -175
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.md +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.html.erb +0 -224
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.md +0 -7
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.html.erb +0 -46
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.jsx +0 -42
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_rails.md +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_react.md +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f5c3e22d3872b4b287c759a888ebc1b7d3ee7b9eeeb50d1262033cdb041231b
|
|
4
|
+
data.tar.gz: 7e6dca0282b5a4cb6faf9b9e30916259cf976d44b2bd283d689c0378738e881a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6d79cf66190fe54c8d4c53d72b7afbc5cc37ffde9212d51ad9492c0d1ee52e294aeb9f7386f701d34f5a63a1a97282cbcaf56a65e1e0543ee7968fbd47b8487
|
|
7
|
+
data.tar.gz: 33fdb0d49f3577c1d2002b104e4df03e64c7ebe032e8b7f5c511c438e6fb1b9dec79c4fa3ee51c65638930ea5a2e98ee6af99d49c32c4def1d7c98f352454a69
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
import { GenericObject } from "../../types";
|
|
13
13
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
14
14
|
import { createCellFunction } from "../Utilities/CellRendererUtils";
|
|
15
|
-
import { getParentOnlySortedRowModel } from "../Utilities/RowModelUtils";
|
|
16
15
|
|
|
17
16
|
interface UseTableStateProps {
|
|
18
17
|
tableData: GenericObject[];
|
|
@@ -37,7 +36,6 @@ interface UseTableStateProps {
|
|
|
37
36
|
columnVisibilityControl?: GenericObject;
|
|
38
37
|
rowStyling?: GenericObject;
|
|
39
38
|
inlineRowLoading?: boolean;
|
|
40
|
-
sortParentOnly?: boolean;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
export function useTableState({
|
|
@@ -57,8 +55,7 @@ export function useTableState({
|
|
|
57
55
|
columnVisibilityControl,
|
|
58
56
|
pinnedRows,
|
|
59
57
|
rowStyling,
|
|
60
|
-
inlineRowLoading = false
|
|
61
|
-
sortParentOnly = false
|
|
58
|
+
inlineRowLoading = false
|
|
62
59
|
}: UseTableStateProps) {
|
|
63
60
|
|
|
64
61
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
|
@@ -193,7 +190,7 @@ export function useTableState({
|
|
|
193
190
|
getSubRows: (row: GenericObject) => row.children,
|
|
194
191
|
getCoreRowModel: getCoreRowModel(),
|
|
195
192
|
getExpandedRowModel: getExpandedRowModel(),
|
|
196
|
-
getSortedRowModel:
|
|
193
|
+
getSortedRowModel: getSortedRowModel(),
|
|
197
194
|
enableSortingRemoval: enableSortingRemoval,
|
|
198
195
|
sortDescFirst: true,
|
|
199
196
|
onRowSelectionChange: setRowSelection,
|
|
@@ -66,7 +66,6 @@ type AdvancedTableProps = {
|
|
|
66
66
|
showActionsBar?: boolean,
|
|
67
67
|
persistToggleExpansionButton?: boolean,
|
|
68
68
|
sortControl?: GenericObject
|
|
69
|
-
sortParentOnly?: boolean
|
|
70
69
|
tableData: GenericObject[]
|
|
71
70
|
tableOptions?: GenericObject
|
|
72
71
|
tableProps?: GenericObject
|
|
@@ -115,7 +114,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
115
114
|
selectableRows,
|
|
116
115
|
persistToggleExpansionButton = false,
|
|
117
116
|
sortControl,
|
|
118
|
-
sortParentOnly = false,
|
|
119
117
|
stickyLeftColumn,
|
|
120
118
|
tableData,
|
|
121
119
|
tableOptions,
|
|
@@ -161,8 +159,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
161
159
|
columnVisibilityControl,
|
|
162
160
|
pinnedRows,
|
|
163
161
|
rowStyling,
|
|
164
|
-
inlineRowLoading
|
|
165
|
-
sortParentOnly
|
|
162
|
+
inlineRowLoading
|
|
166
163
|
});
|
|
167
164
|
|
|
168
165
|
// Initialize table actions
|
|
@@ -495,41 +495,7 @@ test("sort button exists and sorts column data", () => {
|
|
|
495
495
|
|
|
496
496
|
const row2 = kit.getElementsByTagName('tr')[2]
|
|
497
497
|
expect(row2.id).toBe("0-0-0-row")
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
test("sortParentOnly sorts only parent rows and keeps children grouped under parent", () => {
|
|
501
|
-
render(
|
|
502
|
-
<AdvancedTable
|
|
503
|
-
columnDefinitions={columnDefinitions}
|
|
504
|
-
data={{ testid: testId }}
|
|
505
|
-
sortParentOnly
|
|
506
|
-
tableData={MOCK_DATA}
|
|
507
|
-
>
|
|
508
|
-
<AdvancedTable.Header enableSorting />
|
|
509
|
-
<AdvancedTable.Body />
|
|
510
|
-
</AdvancedTable>
|
|
511
|
-
)
|
|
512
|
-
|
|
513
|
-
const kit = screen.getByTestId(testId)
|
|
514
|
-
const sortButton = kit.querySelector(".header-sort-button.pb_th_link")
|
|
515
|
-
expect(sortButton).toBeInTheDocument()
|
|
516
|
-
|
|
517
|
-
const tbody = kit.querySelector('tbody')
|
|
518
|
-
const rowsBefore = tbody.getElementsByTagName('tr')
|
|
519
|
-
expect(rowsBefore[0]).toHaveTextContent('2021')
|
|
520
|
-
|
|
521
|
-
sortButton.click()
|
|
522
|
-
|
|
523
|
-
const rowsAfter = tbody.getElementsByTagName('tr')
|
|
524
|
-
expect(rowsAfter[0]).toHaveTextContent('2022')
|
|
525
|
-
|
|
526
|
-
const expandButton = kit.querySelector(".gray-icon.expand-toggle-icon")
|
|
527
|
-
expandButton.click()
|
|
528
|
-
|
|
529
|
-
const rowsExpanded = tbody.getElementsByTagName('tr')
|
|
530
|
-
expect(rowsExpanded.length).toBeGreaterThan(1)
|
|
531
|
-
expect(rowsExpanded[1]).toHaveTextContent('Q1')
|
|
532
|
-
})
|
|
498
|
+
})
|
|
533
499
|
|
|
534
500
|
test("Generates Table.Header default + custom classname", () => {
|
|
535
501
|
render(
|
|
@@ -39,7 +39,6 @@ examples:
|
|
|
39
39
|
- advanced_table_sort_per_column: Enable Sort By Column
|
|
40
40
|
- advanced_table_sort_per_column_for_multi_column: Enable Sort By Column (Multi-Column)
|
|
41
41
|
- advanced_table_custom_sort: Custom Sort
|
|
42
|
-
- advanced_table_sort_parent_only: Sort Parent Only
|
|
43
42
|
- advanced_table_expanded_control: Expanded Control
|
|
44
43
|
- advanced_table_expand_by_depth: Expand by Depth
|
|
45
44
|
- advanced_table_subrow_headers: SubRow Headers
|
|
@@ -49,5 +49,4 @@ export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_
|
|
|
49
49
|
export { default as AdvancedTableColumnStylingBackground } from './_advanced_table_column_styling_background.jsx'
|
|
50
50
|
export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
|
|
51
51
|
export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
|
|
52
|
-
export { default as AdvancedTableCascadeCollapse } from './_advanced_table_cascade_collapse.jsx'
|
|
53
|
-
export { default as AdvancedTableSortParentOnly } from './_advanced_table_sort_parent_only.jsx'
|
|
52
|
+
export { default as AdvancedTableCascadeCollapse } from './_advanced_table_cascade_collapse.jsx'
|
|
@@ -33,7 +33,6 @@ examples:
|
|
|
33
33
|
- dropdown_quickpick_with_date_pickers_rails: Quick Pick with Date Pickers
|
|
34
34
|
- dropdown_quickpick_with_date_pickers_default_rails: Quick Pick with Date Pickers (Default Value)
|
|
35
35
|
- dropdown_required_indicator: Required Indicator
|
|
36
|
-
- dropdown_custom_event_type: Custom Event Type
|
|
37
36
|
|
|
38
37
|
react:
|
|
39
38
|
- dropdown_default: Default
|
|
@@ -55,8 +55,6 @@ module Playbook
|
|
|
55
55
|
default: false
|
|
56
56
|
prop :required_indicator, type: Playbook::Props::Boolean,
|
|
57
57
|
default: false
|
|
58
|
-
prop :custom_event_type, type: Playbook::Props::String,
|
|
59
|
-
default: ""
|
|
60
58
|
|
|
61
59
|
def data
|
|
62
60
|
Hash(prop(:data)).merge(
|
|
@@ -69,8 +67,7 @@ module Playbook
|
|
|
69
67
|
start_date_id: variant == "quickpick" ? start_date_id : nil,
|
|
70
68
|
end_date_id: variant == "quickpick" ? end_date_id : nil,
|
|
71
69
|
controls_start_id: variant == "quickpick" && controls_start_id.present? ? controls_start_id : nil,
|
|
72
|
-
controls_end_id: variant == "quickpick" && controls_end_id.present? ? controls_end_id : nil
|
|
73
|
-
custom_event_type: custom_event_type.presence
|
|
70
|
+
controls_end_id: variant == "quickpick" && controls_end_id.present? ? controls_end_id : nil
|
|
74
71
|
).compact
|
|
75
72
|
end
|
|
76
73
|
|
|
@@ -95,25 +95,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
95
95
|
this.clearBtn.addEventListener("click", this.clearBtnHandler);
|
|
96
96
|
}
|
|
97
97
|
this.updateClearButton();
|
|
98
|
-
|
|
99
|
-
// Listen for clear and select events from external source
|
|
100
|
-
this.handleClearEventBound = this.handleClearEvent.bind(this);
|
|
101
|
-
document.addEventListener("pb:dropdown:clear", this.handleClearEventBound);
|
|
102
|
-
this.handleSelectEventBound = this.handleSelectEvent.bind(this);
|
|
103
|
-
document.addEventListener("pb:dropdown:select", this.handleSelectEventBound);
|
|
104
|
-
|
|
105
|
-
// Listen for custom_event_type to clear on custom events
|
|
106
|
-
const customEventTypeString = this.element.dataset.customEventType;
|
|
107
|
-
if (customEventTypeString) {
|
|
108
|
-
this.customClearEventTypes = customEventTypeString
|
|
109
|
-
.split(",")
|
|
110
|
-
.map((e) => e.trim())
|
|
111
|
-
.filter(Boolean);
|
|
112
|
-
this.handleCustomClearBound = this.handleCustomClearEvent.bind(this);
|
|
113
|
-
this.customClearEventTypes.forEach((eventType) => {
|
|
114
|
-
document.addEventListener(eventType, this.handleCustomClearBound);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
98
|
}
|
|
118
99
|
|
|
119
100
|
disconnect() {
|
|
@@ -165,19 +146,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
165
146
|
if (this.clearBtn && this.clearBtnHandler) {
|
|
166
147
|
this.clearBtn.removeEventListener('click', this.clearBtnHandler)
|
|
167
148
|
}
|
|
168
|
-
|
|
169
|
-
// Clean up external clear/select listeners
|
|
170
|
-
if (this.handleClearEventBound) {
|
|
171
|
-
document.removeEventListener("pb:dropdown:clear", this.handleClearEventBound)
|
|
172
|
-
}
|
|
173
|
-
if (this.handleSelectEventBound) {
|
|
174
|
-
document.removeEventListener("pb:dropdown:select", this.handleSelectEventBound)
|
|
175
|
-
}
|
|
176
|
-
if (this.customClearEventTypes && this.handleCustomClearBound) {
|
|
177
|
-
this.customClearEventTypes.forEach((eventType) => {
|
|
178
|
-
document.removeEventListener(eventType, this.handleCustomClearBound)
|
|
179
|
-
})
|
|
180
|
-
}
|
|
181
149
|
}
|
|
182
150
|
|
|
183
151
|
updateClearButton() {
|
|
@@ -386,135 +354,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
386
354
|
}
|
|
387
355
|
}
|
|
388
356
|
|
|
389
|
-
// ----- External events handling section -----
|
|
390
|
-
// Handles pb:dropdown:clear - clear this dropdown when event.detail.dropdownId matches.
|
|
391
|
-
handleClearEvent(event) {
|
|
392
|
-
const targetId = event.detail?.dropdownId;
|
|
393
|
-
if (targetId && this.element.id === targetId) {
|
|
394
|
-
this.clearSelection();
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// Handles custom_event_type events (e.g. turbo:submit-end) - clear when detail.dropdownId matches or is omitted.
|
|
399
|
-
handleCustomClearEvent(event) {
|
|
400
|
-
const targetId = event.detail?.dropdownId;
|
|
401
|
-
if (targetId == null || this.element.id === targetId) {
|
|
402
|
-
this.clearSelection();
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// Handles pb:dropdown:select - set dropdown selection by option id(s).
|
|
407
|
-
// Single: detail: { dropdownId, optionId }. Multi: detail: { dropdownId, optionIds: ['id1', 'id2'] }.
|
|
408
|
-
handleSelectEvent(event) {
|
|
409
|
-
const targetId = event.detail?.dropdownId;
|
|
410
|
-
if (!targetId || this.element.id !== targetId) return;
|
|
411
|
-
|
|
412
|
-
const optionId = event.detail?.optionId;
|
|
413
|
-
const optionIds = event.detail?.optionIds;
|
|
414
|
-
if (optionId != null) {
|
|
415
|
-
this.setSelectionByOptionId(optionId);
|
|
416
|
-
} else if (Array.isArray(optionIds)) {
|
|
417
|
-
this.setSelectionByOptionIds(optionIds);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// Set single-select dropdown to the option with the given id. No-op if id not found.
|
|
422
|
-
setSelectionByOptionId(optionId) {
|
|
423
|
-
if (this.isMultiSelect) return;
|
|
424
|
-
const hiddenInput = this.baseInput;
|
|
425
|
-
const optionEls = Array.from(this.element.querySelectorAll(OPTION_SELECTOR));
|
|
426
|
-
const selectedOption = optionEls.find((opt) => {
|
|
427
|
-
try {
|
|
428
|
-
return JSON.parse(opt.dataset.dropdownOptionLabel).id === optionId;
|
|
429
|
-
} catch {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
if (!selectedOption) return;
|
|
434
|
-
|
|
435
|
-
optionEls.forEach((opt) => opt.classList.remove("pb_dropdown_option_selected"));
|
|
436
|
-
selectedOption.classList.add("pb_dropdown_option_selected");
|
|
437
|
-
if (hiddenInput) hiddenInput.value = optionId;
|
|
438
|
-
const optionData = JSON.parse(selectedOption.dataset.dropdownOptionLabel);
|
|
439
|
-
const customDisplayElement = this.element.querySelector(
|
|
440
|
-
'[data-dropdown-trigger-custom-display]',
|
|
441
|
-
);
|
|
442
|
-
if (customDisplayElement) {
|
|
443
|
-
this.setTriggerElementText("");
|
|
444
|
-
customDisplayElement.style.display = "block";
|
|
445
|
-
customDisplayElement.style.paddingRight = "8px";
|
|
446
|
-
} else {
|
|
447
|
-
this.setTriggerElementText(optionData.label);
|
|
448
|
-
}
|
|
449
|
-
if (this.searchInput) {
|
|
450
|
-
this.searchInput.value = optionData.label;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
if (optionData.formatted_start_date && optionData.formatted_end_date) {
|
|
454
|
-
const startDateId = this.element.dataset.startDateId;
|
|
455
|
-
const endDateId = this.element.dataset.endDateId;
|
|
456
|
-
const controlsStartId = this.element.dataset.controlsStartId;
|
|
457
|
-
const controlsEndId = this.element.dataset.controlsEndId;
|
|
458
|
-
if (startDateId) {
|
|
459
|
-
const startDateInput = document.getElementById(startDateId);
|
|
460
|
-
if (startDateInput) startDateInput.value = optionData.formatted_start_date;
|
|
461
|
-
}
|
|
462
|
-
if (endDateId) {
|
|
463
|
-
const endDateInput = document.getElementById(endDateId);
|
|
464
|
-
if (endDateInput) endDateInput.value = optionData.formatted_end_date;
|
|
465
|
-
}
|
|
466
|
-
const syncDatePickers = () => {
|
|
467
|
-
if (controlsStartId) {
|
|
468
|
-
const startPicker = document.querySelector(`#${CSS.escape(controlsStartId)}`)?._flatpickr;
|
|
469
|
-
if (startPicker) startPicker.setDate(optionData.formatted_start_date, true, "m/d/Y");
|
|
470
|
-
}
|
|
471
|
-
if (controlsEndId) {
|
|
472
|
-
const endPicker = document.querySelector(`#${CSS.escape(controlsEndId)}`)?._flatpickr;
|
|
473
|
-
if (endPicker) endPicker.setDate(optionData.formatted_end_date, true, "m/d/Y");
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
syncDatePickers();
|
|
477
|
-
setTimeout(syncDatePickers, 100);
|
|
478
|
-
setTimeout(syncDatePickers, 300);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
this.updateClearButton();
|
|
482
|
-
this.emitSelectionChange();
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// Set multi-select dropdown to the options with the given ids. Invalid ids are skipped.
|
|
486
|
-
setSelectionByOptionIds(optionIds) {
|
|
487
|
-
if (!this.isMultiSelect || !optionIds.length) return;
|
|
488
|
-
const optionEls = Array.from(this.element.querySelectorAll(OPTION_SELECTOR));
|
|
489
|
-
this.selectedOptions.clear();
|
|
490
|
-
optionEls.forEach((opt) => {
|
|
491
|
-
opt.classList.remove("pb_dropdown_option_selected");
|
|
492
|
-
opt.style.display = "";
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
optionIds.forEach((id) => {
|
|
496
|
-
const opt = optionEls.find((o) => {
|
|
497
|
-
try {
|
|
498
|
-
return JSON.parse(o.dataset.dropdownOptionLabel).id === id;
|
|
499
|
-
} catch {
|
|
500
|
-
return false;
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
if (opt) {
|
|
504
|
-
const raw = opt.dataset.dropdownOptionLabel;
|
|
505
|
-
this.selectedOptions.add(raw);
|
|
506
|
-
opt.style.display = "none";
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
|
|
510
|
-
this.updatePills();
|
|
511
|
-
this.updateClearButton();
|
|
512
|
-
this.adjustDropdownHeight();
|
|
513
|
-
this.syncHiddenInputs();
|
|
514
|
-
this.emitSelectionChange();
|
|
515
|
-
}
|
|
516
|
-
// ----- End External events handling section -----
|
|
517
|
-
|
|
518
357
|
isClickOutside(event) {
|
|
519
358
|
const label = event.target.closest(LABEL_SELECTOR);
|
|
520
359
|
if (label && this.element.contains(label)) return false;
|
|
@@ -26,7 +26,6 @@ type FixedConfirmationToastProps = {
|
|
|
26
26
|
icon?: string,
|
|
27
27
|
id?: string;
|
|
28
28
|
multiLine?: boolean;
|
|
29
|
-
navMarginTop?: boolean;
|
|
30
29
|
onClose?: VoidCallback;
|
|
31
30
|
open?: boolean;
|
|
32
31
|
status?: "success" | "error" | "neutral" | "tip";
|
|
@@ -48,7 +47,6 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
|
|
|
48
47
|
htmlOptions = {},
|
|
49
48
|
icon,
|
|
50
49
|
multiLine = false,
|
|
51
|
-
navMarginTop = false,
|
|
52
50
|
onClose = () => undefined,
|
|
53
51
|
open = true,
|
|
54
52
|
status = "neutral",
|
|
@@ -63,7 +61,6 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
|
|
|
63
61
|
const css = classnames(
|
|
64
62
|
`pb_fixed_confirmation_toast_kit_${status}${multiLine ? '_multi_line' : ''}`,
|
|
65
63
|
{ [`positioned_toast ${vertical} ${horizontal}`]: vertical && horizontal },
|
|
66
|
-
{ [`nav_margin_top`]: navMarginTop },
|
|
67
64
|
`${iconClass}`,
|
|
68
65
|
globalProps(props, { zIndex }),
|
|
69
66
|
className
|
|
@@ -2,7 +2,6 @@ examples:
|
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
4
|
- fixed_confirmation_toast_default: Default
|
|
5
|
-
- fixed_confirmation_toast_nav_margin: Nav Margin Top
|
|
6
5
|
- fixed_confirmation_toast_multi_line: Multi Line
|
|
7
6
|
- fixed_confirmation_toast_close: Click to Close
|
|
8
7
|
- fixed_confirmation_toast_positions: Click to Show Positions
|
|
@@ -13,7 +12,6 @@ examples:
|
|
|
13
12
|
|
|
14
13
|
react:
|
|
15
14
|
- fixed_confirmation_toast_default: Default
|
|
16
|
-
- fixed_confirmation_toast_nav_margin: Nav Margin Top
|
|
17
15
|
- fixed_confirmation_toast_multi_line: Multi Line
|
|
18
16
|
- fixed_confirmation_toast_close: Click to Close
|
|
19
17
|
- fixed_confirmation_toast_positions: Click to Show Positions
|
|
@@ -5,5 +5,4 @@ export { default as FixedConfirmationToastPositions } from './_fixed_confirmatio
|
|
|
5
5
|
export { default as FixedConfirmationToastAutoClose } from './_fixed_confirmation_toast_auto_close.jsx'
|
|
6
6
|
export { default as FixedConfirmationToastChildren } from './_fixed_confirmation_toast_children.jsx'
|
|
7
7
|
export { default as FixedConfirmationToastCustomIcon } from './_fixed_confirmation_toast_custom_icon.jsx'
|
|
8
|
-
export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
|
|
9
|
-
export { default as FixedConfirmationToastNavMargin } from './_fixed_confirmation_toast_nav_margin.jsx'
|
|
8
|
+
export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
|
|
@@ -21,8 +21,6 @@ module Playbook
|
|
|
21
21
|
default: nil
|
|
22
22
|
prop :auto_close, type: Playbook::Props::Number
|
|
23
23
|
prop :icon, type: Playbook::Props::String
|
|
24
|
-
prop :nav_margin_top, type: Playbook::Props::Boolean,
|
|
25
|
-
default: false
|
|
26
24
|
|
|
27
25
|
def show_text?
|
|
28
26
|
text.present?
|
|
@@ -48,10 +46,6 @@ module Playbook
|
|
|
48
46
|
Hash(prop(:data)).merge(auto_close_attribute)
|
|
49
47
|
end
|
|
50
48
|
|
|
51
|
-
def nav_margin_top_class
|
|
52
|
-
nav_margin_top.present? ? " nav_margin_top" : ""
|
|
53
|
-
end
|
|
54
|
-
|
|
55
49
|
def icon_value
|
|
56
50
|
icon || case status
|
|
57
51
|
when "success"
|
|
@@ -71,7 +65,7 @@ module Playbook
|
|
|
71
65
|
|
|
72
66
|
def classname
|
|
73
67
|
default_z_index = z_index.present? ? "" : " z_index_max"
|
|
74
|
-
generate_classname("pb_fixed_confirmation_toast_kit", status, multi_line_class) + close_class + position_class + icon_class +
|
|
68
|
+
generate_classname("pb_fixed_confirmation_toast_kit", status, multi_line_class) + close_class + position_class + icon_class + default_z_index
|
|
75
69
|
end
|
|
76
70
|
end
|
|
77
71
|
end
|
|
@@ -112,13 +112,7 @@ module Playbook
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def render_svg
|
|
115
|
-
|
|
116
|
-
content = if source.to_s.include?("://")
|
|
117
|
-
URI.open(source, "User-Agent" => "Playbook-Icon-Kit/1.0 (https://github.com/powerhome/playbook)", &:read) # rubocop:disable Security/Open
|
|
118
|
-
else
|
|
119
|
-
URI.open(source, &:read) # rubocop:disable Security/Open
|
|
120
|
-
end
|
|
121
|
-
doc = Nokogiri::XML(content)
|
|
115
|
+
doc = Nokogiri::XML(URI.open(asset_path || icon || custom_icon)) # rubocop:disable Security/Open
|
|
122
116
|
svg = doc.at_css("svg")
|
|
123
117
|
return "" unless svg
|
|
124
118
|
|