playbook_ui 14.18.0.pre.alpha.revert4567revert4553PLAY2056ATcolbordercolors7469 → 14.18.0.pre.rc.0
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/Components/RegularTableView.tsx +3 -23
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +3 -67
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +19 -29
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +143 -365
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -14
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +2 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +2 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -10
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +2 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.html.erb +2 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +2 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +1 -39
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +0 -4
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +1 -9
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +0 -14
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +45 -19
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_copy_button/index.js +20 -46
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +0 -12
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -12
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +1 -50
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +1 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md +0 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.md +1 -5
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +0 -10
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -10
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_dialog/index.js +14 -106
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +1 -9
- data/app/pb_kits/playbook/pb_draggable/index.js +142 -139
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +1 -4
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +3 -23
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +5 -15
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +6 -39
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +1 -70
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -29
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +118 -322
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +43 -74
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +4 -21
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +22 -83
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +7 -39
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +7 -1
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -5
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +1 -39
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +0 -13
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +1 -8
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +0 -19
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_popover/index.ts +1 -13
- data/app/pb_kits/playbook/pb_popover/popover.rb +0 -2
- data/app/pb_kits/playbook/pb_select/docs/_select_error.jsx +2 -7
- data/app/pb_kits/playbook/pb_table/_table.tsx +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +1 -3
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +5 -13
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +1 -9
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +1 -8
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.jsx +1 -7
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.jsx +2 -6
- data/dist/chunks/_typeahead-C2GOKWtm.js +22 -0
- data/dist/chunks/_weekday_stacked-CFGTPT0O.js +45 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-BWjy4bFn.js → pb_form_validation-BvNy9Bd6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-doc.js +1 -19
- 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 +2 -2
- metadata +8 -71
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +0 -58
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.jsx +0 -66
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +0 -10
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +0 -58
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +0 -64
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +0 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +0 -97
- data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +0 -53
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +0 -38
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.html.erb +0 -28
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.jsx +0 -42
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.md +0 -1
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +0 -54
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +0 -3
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.html.erb +0 -14
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.md +0 -3
- data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +0 -45
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +0 -34
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.md +0 -14
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +0 -20
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +0 -14
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +0 -117
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +0 -9
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.html.erb +0 -43
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.html.erb +0 -55
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_rails.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.html.erb +0 -42
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.html.erb +0 -41
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +0 -30
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +0 -85
- data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +0 -79
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +0 -52
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +0 -110
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +0 -63
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +0 -3
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +0 -49
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +0 -81
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +0 -39
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +0 -40
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +0 -5
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.html.erb +0 -10
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.jsx +0 -20
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.md +0 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.html.erb +0 -46
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.md +0 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +0 -94
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +0 -1
- data/dist/chunks/_typeahead-D8CsVBZO.js +0 -22
- data/dist/chunks/_weekday_stacked-D3oLTSkH.js +0 -45
- data/dist/chunks/lib-BmTAc7Nc.js +0 -29
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_drop_zones_react.md → _draggable_drop_zones.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_drop_zones_colors_react.md → _draggable_drop_zones_colors.md} +0 -0
@@ -1,26 +1,24 @@
|
|
1
1
|
import PbEnhancedElement from "../pb_enhanced_element";
|
2
2
|
|
3
|
-
const DRAGGABLE_SELECTOR
|
3
|
+
const DRAGGABLE_SELECTOR = "[data-pb-draggable]";
|
4
4
|
const DRAGGABLE_CONTAINER = ".pb_draggable_container";
|
5
|
-
const NEEDS_CLONE = ["shadow", "outline"]; // clone only for these types
|
6
5
|
|
7
6
|
export default class PbDraggable extends PbEnhancedElement {
|
8
|
-
static get selector() {
|
7
|
+
static get selector() {
|
8
|
+
return DRAGGABLE_SELECTOR;
|
9
|
+
}
|
9
10
|
|
10
11
|
connect() {
|
11
12
|
this.state = {
|
12
|
-
items:
|
13
|
-
dragData:
|
14
|
-
isDragging:
|
15
|
-
activeContainer: ""
|
13
|
+
items: [],
|
14
|
+
dragData: { id: "", initialGroup: "" },
|
15
|
+
isDragging: "",
|
16
|
+
activeContainer: ""
|
16
17
|
};
|
17
18
|
|
18
|
-
this.draggedItem
|
19
|
+
this.draggedItem = null;
|
19
20
|
this.draggedItemId = null;
|
20
|
-
this.dragGhost = null;
|
21
21
|
this.hasMultipleContainers = false;
|
22
|
-
this.dragZoneType = "";
|
23
|
-
this.dragZoneColor = "";
|
24
22
|
|
25
23
|
document.addEventListener("DOMContentLoaded", () => this.bindEventListeners());
|
26
24
|
}
|
@@ -28,12 +26,13 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
28
26
|
setState(newState) {
|
29
27
|
this.state = { ...this.state, ...newState };
|
30
28
|
if (newState.items) {
|
31
|
-
|
29
|
+
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
32
30
|
detail: {
|
33
31
|
reorderedItems: this.state.items,
|
34
|
-
containerId:
|
35
|
-
}
|
36
|
-
})
|
32
|
+
containerId: this.element.querySelector(DRAGGABLE_CONTAINER).id
|
33
|
+
}
|
34
|
+
});
|
35
|
+
this.element.dispatchEvent(customEvent);
|
37
36
|
}
|
38
37
|
}
|
39
38
|
|
@@ -44,100 +43,71 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
44
43
|
|
45
44
|
// Needed to prevent images within draggable items from being independently draggable
|
46
45
|
// Needed if using Image kit in draggable items
|
47
|
-
this.element.querySelectorAll(".pb_draggable_item img")
|
48
|
-
|
49
|
-
|
50
|
-
this.element.querySelectorAll(".pb_draggable_item")
|
51
|
-
.forEach(item => {
|
52
|
-
item.addEventListener("dragstart", this.handleDragStart.bind(this));
|
53
|
-
item.addEventListener("dragend", this.handleDragEnd.bind(this));
|
54
|
-
item.addEventListener("dragenter", this.handleDragEnter.bind(this));
|
55
|
-
});
|
46
|
+
this.element.querySelectorAll(".pb_draggable_item img").forEach(img => {
|
47
|
+
img.setAttribute("draggable", "false");
|
48
|
+
});
|
56
49
|
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
this.element.querySelectorAll(".pb_draggable_item").forEach(item => {
|
51
|
+
item.addEventListener("dragstart", this.handleDragStart.bind(this));
|
52
|
+
item.addEventListener("dragend", this.handleDragEnd.bind(this));
|
53
|
+
item.addEventListener("dragenter", this.handleDragEnter.bind(this));
|
54
|
+
});
|
55
|
+
|
56
|
+
containers.forEach(container => {
|
57
|
+
container.addEventListener("dragover", this.handleDragOver.bind(this));
|
58
|
+
container.addEventListener("drop", this.handleDrop.bind(this));
|
60
59
|
});
|
61
60
|
}
|
62
61
|
|
63
|
-
/* ---------------- DRAG START ---------------- */
|
64
62
|
handleDragStart(event) {
|
65
63
|
// Needed to prevent images within draggable items from being independently draggable
|
66
64
|
// Needed if using Image kit in draggable items
|
67
|
-
if (event.target.tagName.toLowerCase() ===
|
65
|
+
if (event.target.tagName.toLowerCase() === 'img') {
|
68
66
|
event.preventDefault();
|
69
67
|
return;
|
70
68
|
}
|
71
69
|
|
72
|
-
const container
|
73
|
-
this.draggedItem
|
70
|
+
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
71
|
+
this.draggedItem = event.target;
|
74
72
|
this.draggedItemId = event.target.id;
|
75
|
-
this.dragZoneType = this.element.dataset.dropZoneType || "";
|
76
|
-
this.dragZoneColor = this.element.dataset.dropZoneColor || "";
|
77
73
|
|
78
74
|
this.setState({
|
79
|
-
dragData:
|
80
|
-
isDragging: this.draggedItemId
|
75
|
+
dragData: { id: this.draggedItemId, initialGroup: container.id },
|
76
|
+
isDragging: this.draggedItemId
|
81
77
|
});
|
82
78
|
|
83
|
-
|
84
|
-
"is_dragging",
|
85
|
-
`drop_zone_${this.dragZoneType}`,
|
86
|
-
`drop_zone_color_${this.dragZoneColor}`,
|
87
|
-
);
|
88
|
-
|
79
|
+
event.target.classList.add("is_dragging");
|
89
80
|
if (event.dataTransfer) {
|
90
|
-
event.dataTransfer.effectAllowed =
|
91
|
-
event.dataTransfer.setData(
|
92
|
-
|
93
|
-
/* ---------- custom ghost clone (shadow + outline only) ---------- */
|
94
|
-
if (NEEDS_CLONE.includes(this.dragZoneType)) {
|
95
|
-
const ghost = this.draggedItem.cloneNode(true);
|
96
|
-
ghost.classList.remove(
|
97
|
-
"is_dragging",
|
98
|
-
`drop_zone_${this.dragZoneType}`,
|
99
|
-
`drop_zone_color_${this.dragZoneColor}`,
|
100
|
-
);
|
101
|
-
const { width, height } = this.draggedItem.getBoundingClientRect();
|
102
|
-
Object.assign(ghost.style, {
|
103
|
-
border: "none",
|
104
|
-
width: `${width}px`,
|
105
|
-
height: `${height}px`,
|
106
|
-
position: "absolute",
|
107
|
-
top: "-9999px",
|
108
|
-
left: "-9999px",
|
109
|
-
boxSizing: "border-box",
|
110
|
-
zIndex: "9999",
|
111
|
-
});
|
112
|
-
document.body.appendChild(ghost);
|
113
|
-
this.dragGhost = ghost;
|
114
|
-
event.dataTransfer.setDragImage(ghost, width / 2, height / 2);
|
115
|
-
}
|
116
|
-
/* ---------------------------------------------------------------- */
|
81
|
+
event.dataTransfer.effectAllowed = 'move';
|
82
|
+
event.dataTransfer.setData('text/plain', this.draggedItemId);
|
117
83
|
}
|
118
84
|
|
119
|
-
|
85
|
+
setTimeout(() => {
|
86
|
+
event.target.style.opacity = '0.5';
|
87
|
+
}, 0);
|
120
88
|
}
|
121
89
|
|
122
|
-
/* ---------------- DRAG ENTER ---------------- */
|
123
90
|
handleDragEnter(event) {
|
124
91
|
if (!this.draggedItem || event.target === this.draggedItem) return;
|
125
|
-
|
126
|
-
|
127
|
-
|
92
|
+
|
93
|
+
if (this.hasMultipleContainers) {
|
94
|
+
this.handleMultiContainerDragEnter(event);
|
95
|
+
} else {
|
96
|
+
this.handleSingleContainerDragEnter(event);
|
97
|
+
}
|
128
98
|
}
|
129
99
|
|
130
100
|
handleSingleContainerDragEnter(event) {
|
131
|
-
const targetItem = event.target.closest(
|
132
|
-
// If we're entering a container directly or there's no target item
|
101
|
+
const targetItem = event.target.closest('.pb_draggable_item');
|
133
102
|
if (!targetItem) return;
|
134
103
|
|
135
104
|
const container = targetItem.parentNode;
|
136
|
-
const items
|
137
|
-
const fromIdx = items.indexOf(this.draggedItem);
|
138
|
-
const toIdx = items.indexOf(targetItem);
|
105
|
+
const items = Array.from(container.children);
|
139
106
|
|
140
|
-
|
107
|
+
const draggedIndex = items.indexOf(this.draggedItem);
|
108
|
+
const targetIndex = items.indexOf(targetItem);
|
109
|
+
|
110
|
+
if (draggedIndex > targetIndex) {
|
141
111
|
container.insertBefore(this.draggedItem, targetItem);
|
142
112
|
} else {
|
143
113
|
container.insertBefore(this.draggedItem, targetItem.nextSibling);
|
@@ -146,113 +116,146 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
146
116
|
|
147
117
|
handleMultiContainerDragEnter(event) {
|
148
118
|
const targetContainer = event.target.closest(DRAGGABLE_CONTAINER);
|
149
|
-
const targetItem
|
119
|
+
const targetItem = event.target.closest('.pb_draggable_item');
|
120
|
+
|
150
121
|
if (!targetContainer) return;
|
151
122
|
|
123
|
+
// If we're entering a container directly or there's no target item
|
152
124
|
if (!targetItem) {
|
153
|
-
const
|
154
|
-
|
155
|
-
|
156
|
-
|
125
|
+
const lastItem = targetContainer.querySelector('.pb_draggable_item:last-child');
|
126
|
+
if (lastItem) {
|
127
|
+
targetContainer.insertBefore(this.draggedItem, lastItem.nextSibling);
|
128
|
+
} else {
|
129
|
+
targetContainer.appendChild(this.draggedItem);
|
130
|
+
}
|
157
131
|
return;
|
158
132
|
}
|
159
133
|
|
160
|
-
const
|
161
|
-
|
134
|
+
const container = targetItem.parentNode;
|
135
|
+
const items = Array.from(container.children);
|
136
|
+
|
137
|
+
const newItems = [...items].map(item => ({
|
138
|
+
id: item.id,
|
139
|
+
container: container.id
|
140
|
+
}));
|
141
|
+
|
142
|
+
this.setState({ items: newItems });
|
162
143
|
|
163
|
-
const
|
164
|
-
|
144
|
+
const rect = targetItem.getBoundingClientRect();
|
145
|
+
const middleY = rect.top + rect.height / 2;
|
165
146
|
|
166
|
-
if (event.clientY <
|
167
|
-
|
147
|
+
if (event.clientY < middleY) {
|
148
|
+
container.insertBefore(this.draggedItem, targetItem);
|
168
149
|
} else {
|
169
|
-
|
150
|
+
container.insertBefore(this.draggedItem, targetItem.nextSibling);
|
170
151
|
}
|
171
152
|
}
|
172
153
|
|
173
|
-
/* ---------------- DRAG OVER ---------------- */
|
174
154
|
handleDragOver(event) {
|
175
155
|
event.preventDefault();
|
176
156
|
event.stopPropagation();
|
177
|
-
|
178
|
-
|
179
|
-
|
157
|
+
|
158
|
+
if (this.hasMultipleContainers) {
|
159
|
+
this.handleMultiContainerDragOver(event);
|
160
|
+
} else {
|
161
|
+
this.handleSingleContainerDragOver(event);
|
162
|
+
}
|
180
163
|
}
|
181
164
|
|
182
165
|
handleSingleContainerDragOver(event) {
|
183
166
|
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
184
|
-
if (container)
|
167
|
+
if (container) {
|
168
|
+
container.classList.add("active_container");
|
169
|
+
}
|
185
170
|
}
|
186
171
|
|
187
172
|
handleMultiContainerDragOver(event) {
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
173
|
+
let container;
|
174
|
+
if (event.target.matches(DRAGGABLE_CONTAINER)) {
|
175
|
+
container = event.target;
|
176
|
+
} else {
|
177
|
+
container = event.target.closest(DRAGGABLE_CONTAINER);
|
178
|
+
}
|
179
|
+
|
180
|
+
if (container) {
|
181
|
+
this.setState({ activeContainer: container.id });
|
182
|
+
container.classList.add("active_container");
|
183
|
+
|
184
|
+
// If dragging over empty container or below last item
|
185
|
+
const lastItem = container.querySelector('.pb_draggable_item:last-child');
|
186
|
+
if (!lastItem || (lastItem && event.clientY > lastItem.getBoundingClientRect().bottom)) {
|
187
|
+
if (this.draggedItem && this.draggedItem.parentNode !== container) {
|
188
|
+
container.appendChild(this.draggedItem);
|
189
|
+
}
|
200
190
|
}
|
201
191
|
}
|
202
192
|
}
|
203
193
|
|
204
|
-
/* ---------------- DROP ---------------- */
|
205
194
|
handleDrop(event) {
|
206
195
|
event.preventDefault();
|
207
196
|
event.stopPropagation();
|
208
197
|
|
209
|
-
|
210
|
-
|
211
|
-
|
198
|
+
let container;
|
199
|
+
if (event.target.matches(DRAGGABLE_CONTAINER)) {
|
200
|
+
container = event.target;
|
201
|
+
} else {
|
202
|
+
container = event.target.closest(DRAGGABLE_CONTAINER);
|
203
|
+
}
|
204
|
+
|
212
205
|
if (!container || !this.draggedItem) return;
|
213
206
|
|
214
207
|
container.classList.remove("active_container");
|
215
|
-
this.draggedItem.style.opacity =
|
208
|
+
this.draggedItem.style.opacity = '1';
|
216
209
|
|
217
210
|
// Handle empty containers
|
218
|
-
if (this.hasMultipleContainers && !container.querySelector(
|
211
|
+
if (this.hasMultipleContainers && !container.querySelector('.pb_draggable_item')) {
|
219
212
|
container.appendChild(this.draggedItem);
|
220
213
|
}
|
221
214
|
|
222
215
|
// Updated order of items as an array of item IDs
|
223
|
-
const reorderedItems = Array.from(
|
224
|
-
.
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
detail: { reorderedItems, containerId: container.id },
|
216
|
+
const reorderedItems = Array.from(
|
217
|
+
this.element.querySelectorAll('.pb_draggable_item')
|
218
|
+
).map(item => ({
|
219
|
+
id: item.id,
|
220
|
+
container: item.closest(DRAGGABLE_CONTAINER).id
|
229
221
|
}));
|
230
222
|
|
231
|
-
|
232
|
-
|
223
|
+
// Store reordered items in a data attribute on the container
|
224
|
+
container.setAttribute("data-reordered-items", JSON.stringify(reorderedItems));
|
225
|
+
|
226
|
+
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
227
|
+
detail: {
|
228
|
+
reorderedItems,
|
229
|
+
containerId: container.id,
|
230
|
+
}
|
231
|
+
});
|
232
|
+
|
233
|
+
this.element.dispatchEvent(customEvent);
|
234
|
+
|
235
|
+
this.setState({
|
236
|
+
items: reorderedItems,
|
237
|
+
isDragging: "",
|
238
|
+
activeContainer: ""
|
239
|
+
});
|
240
|
+
|
241
|
+
this.draggedItem = null;
|
233
242
|
this.draggedItemId = null;
|
234
243
|
}
|
235
244
|
|
236
|
-
/* ---------------- DRAG END ---------------- */
|
237
245
|
handleDragEnd(event) {
|
238
|
-
event.target.classList.remove(
|
239
|
-
|
240
|
-
`drop_zone_${this.dragZoneType}`,
|
241
|
-
`drop_zone_color_${this.dragZoneColor}`,
|
242
|
-
);
|
243
|
-
event.target.style.opacity = "1";
|
244
|
-
|
245
|
-
if (this.dragGhost) {
|
246
|
-
document.body.removeChild(this.dragGhost);
|
247
|
-
this.dragGhost = null;
|
248
|
-
}
|
249
|
-
|
250
|
-
this.setState({ isDragging: "", activeContainer: "" });
|
246
|
+
event.target.classList.remove("is_dragging");
|
247
|
+
event.target.style.opacity = '1';
|
251
248
|
|
252
|
-
this.
|
253
|
-
|
249
|
+
this.setState({
|
250
|
+
isDragging: "",
|
251
|
+
activeContainer: ""
|
252
|
+
});
|
254
253
|
|
255
|
-
this.draggedItem
|
254
|
+
this.draggedItem = null;
|
256
255
|
this.draggedItemId = null;
|
256
|
+
|
257
|
+
this.element.querySelectorAll(DRAGGABLE_CONTAINER).forEach(container => {
|
258
|
+
container.classList.remove("active_container");
|
259
|
+
});
|
257
260
|
}
|
258
261
|
}
|
@@ -1,12 +1,9 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
2
|
import Dropdown from '../../pb_dropdown/_dropdown'
|
3
|
-
import Icon from '../../pb_icon/_icon'
|
4
3
|
|
5
4
|
const DropdownError = (props) => {
|
6
5
|
const [selectedOption, setSelectedOption] = useState()
|
7
|
-
const error = selectedOption?.value ? null :
|
8
|
-
<Icon icon="warning" /> Please make a valid selection
|
9
|
-
</>)
|
6
|
+
const error = selectedOption?.value ? null : "Please make a valid selection"
|
10
7
|
const options = [
|
11
8
|
{
|
12
9
|
label: "United States",
|
@@ -22,7 +22,7 @@ type DropdownOptionProps = {
|
|
22
22
|
data?: { [key: string]: string };
|
23
23
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
24
24
|
id?: string;
|
25
|
-
key?: string
|
25
|
+
key?: string;
|
26
26
|
option?: GenericObject;
|
27
27
|
padding?: string;
|
28
28
|
} & GlobalProps;
|
@@ -85,19 +85,11 @@
|
|
85
85
|
.text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .text_input {
|
86
86
|
border-bottom-right-radius: 0;
|
87
87
|
border-top-right-radius: 0;
|
88
|
-
border-right-
|
88
|
+
border-right-width: 0;
|
89
89
|
}
|
90
|
-
[class^=pb_text_input_kit] .text_input_wrapper input:focus,
|
91
|
-
[class^=pb_text_input_kit] .text_input_wrapper .text_input:focus {
|
92
|
-
border-right-color: $primary;
|
93
|
-
}
|
94
|
-
[class^=pb_text_input_kit].error .text_input_wrapper input,
|
95
|
-
[class^=pb_text_input_kit].error .text_input_wrapper .text_input {
|
96
|
-
border-right-color: $error;
|
97
|
-
}
|
98
90
|
}
|
99
91
|
|
100
|
-
& > [class^=pb_phone_number_input]:not(:first-child)
|
92
|
+
& > [class^=pb_phone_number_input]:not(:first-child) {
|
101
93
|
.text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .text_input {
|
102
94
|
border-bottom-left-radius: 0;
|
103
95
|
border-top-left-radius: 0;
|
@@ -115,16 +107,8 @@
|
|
115
107
|
.text_input {
|
116
108
|
border-bottom-right-radius: 0;
|
117
109
|
border-top-right-radius: 0;
|
118
|
-
border-right
|
110
|
+
border-right: none;
|
119
111
|
}
|
120
|
-
[class^=pb_text_input_kit] .text_input_wrapper input:focus,
|
121
|
-
[class^=pb_text_input_kit] .text_input_wrapper .text_input:focus {
|
122
|
-
border-right-color: $primary;
|
123
|
-
}
|
124
|
-
[class^=pb_text_input_kit].error .text_input_wrapper input,
|
125
|
-
[class^=pb_text_input_kit].error .text_input_wrapper .text_input {
|
126
|
-
border-right-color: $error;
|
127
|
-
}
|
128
112
|
}
|
129
113
|
|
130
114
|
&[class*=rails] > [class^=pb_date_picker_kit] {
|
@@ -243,8 +227,4 @@
|
|
243
227
|
padding-left: calc(var(--iti-flag-width) + 1px);
|
244
228
|
}
|
245
229
|
}
|
246
|
-
|
247
|
-
&:has(> [class^="pb_select"]):has(> .pb_passphrase) [class^="pb_select"] {
|
248
|
-
align-self: baseline;
|
249
|
-
}
|
250
230
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
<div>
|
2
|
+
|
2
3
|
<%= pb_rails("form_group") do %>
|
3
4
|
<%= pb_rails("text_input", props: { placeholder: "Enter Artist Name" }) %>
|
4
5
|
<%= pb_rails("select", props: {
|
@@ -16,6 +17,8 @@
|
|
16
17
|
]
|
17
18
|
}) %>
|
18
19
|
<% end %>
|
20
|
+
<br>
|
21
|
+
<br>
|
19
22
|
<%= pb_rails("form_group") do %>
|
20
23
|
<%= pb_rails("select", props: {
|
21
24
|
blank_selection: "Phone",
|
@@ -29,17 +32,4 @@
|
|
29
32
|
id: "phone"
|
30
33
|
}) %>
|
31
34
|
<% end %>
|
32
|
-
|
33
|
-
<%= pb_rails("phone_number_input", props: {
|
34
|
-
id: "phone2"
|
35
|
-
}) %>
|
36
|
-
<%= pb_rails("select", props: {
|
37
|
-
blank_selection: "Phone",
|
38
|
-
options: [
|
39
|
-
{ value: "Cell" },
|
40
|
-
{ value: "Work" },
|
41
|
-
{ value: "Home" },
|
42
|
-
]
|
43
|
-
}) %>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
35
|
+
</div>
|
@@ -1,16 +1,11 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react'
|
2
2
|
|
3
3
|
import FormGroup from '../_form_group'
|
4
4
|
import PhoneNumberInput from '../../pb_phone_number_input/_phone_number_input'
|
5
5
|
import Select from '../../pb_select/_select'
|
6
6
|
import TextInput from '../../pb_text_input/_text_input'
|
7
|
-
import Flex from '../../pb_flex/_flex'
|
8
|
-
import Passphrase from '../../pb_passphrase/_passphrase'
|
9
7
|
|
10
8
|
const FormGroupSelect = (props) => {
|
11
|
-
const [input, setInput] = useState("");
|
12
|
-
const handleChange = (e) => setInput(e.target.value);
|
13
|
-
|
14
9
|
const options = [
|
15
10
|
{ value: 'Country' },
|
16
11
|
{ value: 'Pop' },
|
@@ -30,10 +25,7 @@ const FormGroupSelect = (props) => {
|
|
30
25
|
]
|
31
26
|
|
32
27
|
return (
|
33
|
-
<
|
34
|
-
orientation="column"
|
35
|
-
rowGap="md"
|
36
|
-
>
|
28
|
+
<div>
|
37
29
|
<FormGroup>
|
38
30
|
<TextInput
|
39
31
|
placeholder="Enter Artist Name"
|
@@ -45,43 +37,18 @@ const FormGroupSelect = (props) => {
|
|
45
37
|
{...props}
|
46
38
|
/>
|
47
39
|
</FormGroup>
|
40
|
+
<br />
|
41
|
+
<br />
|
48
42
|
<FormGroup>
|
49
43
|
<Select
|
50
44
|
blankSelection="Phone"
|
51
45
|
options={phoneOptions}
|
52
|
-
|
53
|
-
/>
|
46
|
+
/>
|
54
47
|
<PhoneNumberInput
|
55
48
|
id='default'
|
56
|
-
{...props}
|
57
49
|
/>
|
58
50
|
</FormGroup>
|
59
|
-
|
60
|
-
<PhoneNumberInput
|
61
|
-
id='default-2'
|
62
|
-
{...props}
|
63
|
-
/>
|
64
|
-
<Select
|
65
|
-
blankSelection="Phone"
|
66
|
-
options={phoneOptions}
|
67
|
-
{...props}
|
68
|
-
/>
|
69
|
-
</FormGroup>
|
70
|
-
<FormGroup>
|
71
|
-
<Select
|
72
|
-
blankSelection="Phone"
|
73
|
-
options={phoneOptions}
|
74
|
-
{...props}
|
75
|
-
/>
|
76
|
-
<Passphrase
|
77
|
-
id="my-passphrase"
|
78
|
-
label=""
|
79
|
-
onChange={handleChange}
|
80
|
-
value={input}
|
81
|
-
{...props}
|
82
|
-
/>
|
83
|
-
</FormGroup>
|
84
|
-
</Flex>
|
51
|
+
</div>
|
85
52
|
)
|
86
53
|
}
|
87
54
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
export { default as GaugeDefault } from './_gauge_default.jsx'
|
2
|
-
export { default as GaugePbStyles } from './_gauge_pb_styles.jsx'
|
3
2
|
export { default as GaugeDisableAnimation } from './_gauge_disable_animation.jsx'
|
4
3
|
export { default as GaugeFullCircle } from './_gauge_full_circle.jsx'
|
5
4
|
export { default as GaugeHeight } from './_gauge_height.jsx'
|