playbook_ui 14.17.0 → 14.18.0.pre.alpha.play2034zonesandcolors7407
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 +23 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +67 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +29 -19
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +67 -128
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +9 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.jsx +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +3 -0
- 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 +1 -2
- 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 +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +7 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +97 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
- data/app/pb_kits/playbook/pb_background/_background.tsx +5 -3
- data/app/pb_kits/playbook/pb_background/background.test.js +5 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- 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/circleChartTheme.ts +53 -0
- 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_pb_styles.jsx +38 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
- 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 +2 -3
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +39 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +4 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +9 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +14 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.html.erb +28 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.jsx +42 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.md +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +19 -45
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +54 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +3 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.html.erb +14 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.md +3 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_copy_button/index.js +46 -20
- data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +45 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +4 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +10 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +2 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +117 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +9 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_dialog/index.js +106 -14
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.html.erb +43 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.html.erb +55 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_rails.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_react.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_react.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.html.erb +42 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +12 -7
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +9 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +68 -0
- data/app/pb_kits/playbook/pb_draggable/index.js +139 -142
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +4 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +23 -3
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +39 -6
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +85 -0
- data/app/pb_kits/playbook/pb_layout/_layout.scss +70 -1
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +29 -2
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +322 -118
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +74 -43
- data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +79 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +21 -4
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +83 -22
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +39 -7
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +49 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +81 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +8 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_error.jsx +7 -2
- 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 +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
- data/app/pb_kits/playbook/pb_table/table.rb +13 -1
- data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +13 -5
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +9 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +94 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +1 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +8 -1
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.jsx +7 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.jsx +6 -2
- data/dist/chunks/_typeahead-CvkGr9xV.js +22 -0
- data/dist/chunks/_weekday_stacked-B-ran-L1.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-yWHJ_8mm.js +29 -0
- data/dist/chunks/{pb_form_validation-BiHyZedy.js → pb_form_validation-CFPfX89U.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-doc.js +19 -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 +2 -2
- metadata +74 -21
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +0 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +0 -1
- data/dist/chunks/_typeahead-CPM091Hj.js +0 -22
- data/dist/chunks/_weekday_stacked-BzIANIYX.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-Bg2KFzpz.js +0 -29
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
When using the "line" style, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" style and does not affect other drop zone styles. The default `color` for "line" is "primary" and "purple" is the only alternative color option.
|
2
|
+
|
3
|
+
The length of the line is calculated based off of the width (for "vertical") or height (for "horizontal") of the parent container holding the draggable items.
|
4
|
+
|
5
|
+
Additionally, if the parent container of the `DraggableProvider`/`DraggableContainer` (or a subcontainer within) does not have a set height (for "vertical") or width (for "horizontal"), like the [Draggable Drop Zones doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones) does, elements on the page may jump up (for "vertical") or to the left (for "horizontal") when an item is actively being dragged. To prevent this, give a parent element a fixed height (for "vertical") or width (for "horizontal") as demonstrated in this doc example.
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The Draggable kit lets you customize the style of drop zones that appear when dragging an item.
|
2
|
+
|
3
|
+
By default, drop zones are in the "ghost" style, but you can also choose from "shadow," "outline," and "line."
|
4
|
+
|
5
|
+
When using the "line" type, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" type and does not affect other drop zone styles. For more on the "line" style in particular, check out the [Draggable Drop Zones Line doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones-line).
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<% initial_items = [
|
2
|
+
{
|
3
|
+
id: "100",
|
4
|
+
url: "https://unsplash.it/500/400/?image=638",
|
5
|
+
},
|
6
|
+
{
|
7
|
+
id: "200",
|
8
|
+
url: "https://unsplash.it/500/400/?image=639",
|
9
|
+
},
|
10
|
+
{
|
11
|
+
id: "300",
|
12
|
+
url: "https://unsplash.it/500/400/?image=640",
|
13
|
+
},
|
14
|
+
] %>
|
15
|
+
|
16
|
+
<%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
|
17
|
+
<%= pb_rails("draggable/draggable_container") do %>
|
18
|
+
<%= pb_rails("flex") do %>
|
19
|
+
<% initial_items.each do |item| %>
|
20
|
+
<%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
|
21
|
+
<%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url], margin: "xs" }) %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<script>
|
29
|
+
const itemIds = ["item_100", "item_200", "item_300"];
|
30
|
+
|
31
|
+
itemIds.forEach((id) => {
|
32
|
+
const element = document.getElementById(id);
|
33
|
+
if (element) {
|
34
|
+
element.addEventListener("dragstart", (event) => {
|
35
|
+
console.log(`${id} drag start!`);
|
36
|
+
});
|
37
|
+
element.addEventListener("dragend", (event) => {
|
38
|
+
console.log(`${id} drag end!`);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
});
|
42
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
You can add drag event listeners for `drag`, `dragend`, `dragenter`, `dragleave`, `dragover`, `dragstart`, and `drop`.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
|
3
3
|
import Flex from '../../pb_flex/_flex'
|
4
|
-
import { DraggableProvider } from '
|
4
|
+
import { DraggableProvider } from '../context'
|
5
5
|
import Avatar from '../../pb_avatar/_avatar'
|
6
6
|
import Body from '../../pb_body/_body'
|
7
7
|
import Table from '../../pb_table/_table'
|
@@ -2,4 +2,6 @@ The draggable kit can also be used in conjunction with the table kit to create d
|
|
2
2
|
|
3
3
|
- Wrap the Table with the `DraggableProvider` and manage state as shown.
|
4
4
|
- use the `draggableContainer` prop on the Table.Body to designate it as the Draggable Container
|
5
|
-
- use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
|
5
|
+
- use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
|
6
|
+
|
7
|
+
We recommending using the default `dropZone type` with the Table kit.
|
@@ -4,14 +4,19 @@ examples:
|
|
4
4
|
- draggable_with_list: Draggable with List Kit
|
5
5
|
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
6
6
|
- draggable_with_cards: Draggable with Cards
|
7
|
-
-
|
7
|
+
- draggable_with_table: Draggable with Table
|
8
8
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
9
|
+
- draggable_drop_zones: Draggable Drop Zones
|
10
|
+
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
11
|
+
- draggable_drop_zones_line: Draggable Drop Zones Line
|
9
12
|
|
10
13
|
rails:
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
14
|
-
-
|
14
|
+
- draggable_default: Default
|
15
|
+
- draggable_with_list: Draggable with List Kit
|
16
|
+
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
17
|
+
- draggable_with_cards: Draggable with Cards
|
15
18
|
- draggable_with_table: Draggable with Table
|
16
|
-
-
|
17
|
-
|
19
|
+
- draggable_multiple_containers: Dragging Across Multiple Containers
|
20
|
+
- draggable_drop_zones: Draggable Drop Zones
|
21
|
+
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
22
|
+
- draggable_event_listeners: Draggable Event Listeners
|
@@ -3,4 +3,7 @@ export { default as DraggableWithCards } from './_draggable_with_cards.jsx'
|
|
3
3
|
export { default as DraggableWithList } from './_draggable_with_list.jsx'
|
4
4
|
export { default as DraggableWithSelectableList } from './_draggable_with_selectable_list.jsx'
|
5
5
|
export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
|
6
|
-
export { default as
|
6
|
+
export { default as DraggableWithTable } from './_draggable_with_table.jsx'
|
7
|
+
export { default as DraggableDropZones } from './_draggable_drop_zones.jsx'
|
8
|
+
export { default as DraggableDropZonesColors } from './_draggable_drop_zones_colors.jsx'
|
9
|
+
export { default as DraggableDropZonesLine } from './_draggable_drop_zones_line.jsx'
|
@@ -5,9 +5,17 @@ module Playbook
|
|
5
5
|
class Draggable < ::Playbook::KitBase
|
6
6
|
prop :initial_items, type: Playbook::Props::Array,
|
7
7
|
default: []
|
8
|
+
prop :drop_zone_type, type: Playbook::Props::Enum,
|
9
|
+
values: %w[ghost shadow outline line],
|
10
|
+
default: "ghost"
|
11
|
+
prop :drop_zone_color, type: Playbook::Props::Enum,
|
12
|
+
values: %w[neutral primary purple],
|
13
|
+
default: "neutral"
|
8
14
|
|
9
15
|
def data
|
10
|
-
Hash(prop(:data)).merge(pb_draggable: true
|
16
|
+
Hash(prop(:data)).merge(pb_draggable: true,
|
17
|
+
drop_zone_type: drop_zone_type,
|
18
|
+
drop_zone_color: drop_zone_color)
|
11
19
|
end
|
12
20
|
|
13
21
|
def classname
|
@@ -128,6 +128,58 @@ const DraggableKitWithCard = () => {
|
|
128
128
|
);
|
129
129
|
};
|
130
130
|
|
131
|
+
const DraggableWithLineVertical = () => {
|
132
|
+
const [initialState, setInitialState] = useState(data);
|
133
|
+
return (
|
134
|
+
<div data-testid={testId}>
|
135
|
+
<DraggableProvider
|
136
|
+
dropZone={{ type: "line" }}
|
137
|
+
initialItems={data}
|
138
|
+
onReorder={(items) => setInitialState(items)}
|
139
|
+
>
|
140
|
+
<Draggable>
|
141
|
+
<Draggable.Container>
|
142
|
+
{initialState.map(({ id, text }) => (
|
143
|
+
<Draggable.Item
|
144
|
+
dragId={id}
|
145
|
+
key={id}
|
146
|
+
>
|
147
|
+
{text}
|
148
|
+
</Draggable.Item>
|
149
|
+
))}
|
150
|
+
</Draggable.Container>
|
151
|
+
</Draggable>
|
152
|
+
</DraggableProvider>
|
153
|
+
</div>
|
154
|
+
);
|
155
|
+
};
|
156
|
+
|
157
|
+
const DraggableWithLineHorizontal = () => {
|
158
|
+
const [initialState, setInitialState] = useState(data);
|
159
|
+
return (
|
160
|
+
<div data-testid={testId}>
|
161
|
+
<DraggableProvider
|
162
|
+
dropZone={{ type: "line", direction: "horizontal" }}
|
163
|
+
initialItems={data}
|
164
|
+
onReorder={(items) => setInitialState(items)}
|
165
|
+
>
|
166
|
+
<Draggable>
|
167
|
+
<Draggable.Container>
|
168
|
+
{initialState.map(({ id, text }) => (
|
169
|
+
<Draggable.Item
|
170
|
+
dragId={id}
|
171
|
+
key={id}
|
172
|
+
>
|
173
|
+
{text}
|
174
|
+
</Draggable.Item>
|
175
|
+
))}
|
176
|
+
</Draggable.Container>
|
177
|
+
</Draggable>
|
178
|
+
</DraggableProvider>
|
179
|
+
</div>
|
180
|
+
);
|
181
|
+
};
|
182
|
+
|
131
183
|
test("generated default kit and classname", () => {
|
132
184
|
render(<DefaultDraggableKit />);
|
133
185
|
const kit = screen.getByTestId(testId);
|
@@ -188,3 +240,19 @@ test("generated dragHandle with Card", () => {
|
|
188
240
|
const dragHandle = card.querySelector(".pb_custom_icon");
|
189
241
|
expect(dragHandle).toBeInTheDocument();
|
190
242
|
});
|
243
|
+
|
244
|
+
test("line dropZone with default direction applies 'line_vertical' class to container", () => {
|
245
|
+
render(<DraggableWithLineVertical />);
|
246
|
+
const kit = screen.getByTestId(testId);
|
247
|
+
const container = kit.querySelector(".pb_draggable_container");
|
248
|
+
|
249
|
+
expect(container).toHaveClass("line_vertical");
|
250
|
+
});
|
251
|
+
|
252
|
+
test("line dropZone with horizontal direction applies 'line_horizontal' class to container", () => {
|
253
|
+
render(<DraggableWithLineHorizontal />);
|
254
|
+
const kit = screen.getByTestId(testId);
|
255
|
+
const container = kit.querySelector(".pb_draggable_container");
|
256
|
+
|
257
|
+
expect(container).toHaveClass("line_horizontal");
|
258
|
+
});
|
@@ -1,24 +1,26 @@
|
|
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
|
5
6
|
|
6
7
|
export default class PbDraggable extends PbEnhancedElement {
|
7
|
-
static get selector() {
|
8
|
-
return DRAGGABLE_SELECTOR;
|
9
|
-
}
|
8
|
+
static get selector() { return DRAGGABLE_SELECTOR; }
|
10
9
|
|
11
10
|
connect() {
|
12
11
|
this.state = {
|
13
|
-
items:
|
14
|
-
dragData:
|
15
|
-
isDragging:
|
16
|
-
activeContainer: ""
|
12
|
+
items: [],
|
13
|
+
dragData: { id: "", initialGroup: "" },
|
14
|
+
isDragging: "",
|
15
|
+
activeContainer: "",
|
17
16
|
};
|
18
17
|
|
19
|
-
this.draggedItem
|
18
|
+
this.draggedItem = null;
|
20
19
|
this.draggedItemId = null;
|
20
|
+
this.dragGhost = null;
|
21
21
|
this.hasMultipleContainers = false;
|
22
|
+
this.dragZoneType = "";
|
23
|
+
this.dragZoneColor = "";
|
22
24
|
|
23
25
|
document.addEventListener("DOMContentLoaded", () => this.bindEventListeners());
|
24
26
|
}
|
@@ -26,13 +28,12 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
26
28
|
setState(newState) {
|
27
29
|
this.state = { ...this.state, ...newState };
|
28
30
|
if (newState.items) {
|
29
|
-
|
31
|
+
this.element.dispatchEvent(new CustomEvent("pb-draggable-reorder", {
|
30
32
|
detail: {
|
31
33
|
reorderedItems: this.state.items,
|
32
|
-
containerId:
|
33
|
-
}
|
34
|
-
});
|
35
|
-
this.element.dispatchEvent(customEvent);
|
34
|
+
containerId: this.element.querySelector(DRAGGABLE_CONTAINER).id,
|
35
|
+
},
|
36
|
+
}));
|
36
37
|
}
|
37
38
|
}
|
38
39
|
|
@@ -43,71 +44,100 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
43
44
|
|
44
45
|
// Needed to prevent images within draggable items from being independently draggable
|
45
46
|
// Needed if using Image kit in draggable items
|
46
|
-
this.element.querySelectorAll(".pb_draggable_item img")
|
47
|
-
img.setAttribute("draggable", "false");
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
this.element.querySelectorAll(".pb_draggable_item img")
|
48
|
+
.forEach(img => img.setAttribute("draggable", "false"));
|
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
|
+
});
|
55
56
|
|
56
|
-
containers.forEach(
|
57
|
-
|
58
|
-
|
57
|
+
containers.forEach(c => {
|
58
|
+
c.addEventListener("dragover", this.handleDragOver.bind(this));
|
59
|
+
c.addEventListener("drop", this.handleDrop.bind(this));
|
59
60
|
});
|
60
61
|
}
|
61
62
|
|
63
|
+
/* ---------------- DRAG START ---------------- */
|
62
64
|
handleDragStart(event) {
|
63
65
|
// Needed to prevent images within draggable items from being independently draggable
|
64
66
|
// Needed if using Image kit in draggable items
|
65
|
-
if (event.target.tagName.toLowerCase() ===
|
67
|
+
if (event.target.tagName.toLowerCase() === "img") {
|
66
68
|
event.preventDefault();
|
67
69
|
return;
|
68
70
|
}
|
69
71
|
|
70
|
-
const container
|
71
|
-
this.draggedItem
|
72
|
+
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
73
|
+
this.draggedItem = event.target;
|
72
74
|
this.draggedItemId = event.target.id;
|
75
|
+
this.dragZoneType = this.element.dataset.dropZoneType || "";
|
76
|
+
this.dragZoneColor = this.element.dataset.dropZoneColor || "";
|
73
77
|
|
74
78
|
this.setState({
|
75
|
-
dragData:
|
76
|
-
isDragging: this.draggedItemId
|
79
|
+
dragData: { id: this.draggedItemId, initialGroup: container.id },
|
80
|
+
isDragging: this.draggedItemId,
|
77
81
|
});
|
78
82
|
|
79
|
-
|
83
|
+
this.draggedItem.classList.add(
|
84
|
+
"is_dragging",
|
85
|
+
`drop_zone_${this.dragZoneType}`,
|
86
|
+
`drop_zone_color_${this.dragZoneColor}`,
|
87
|
+
);
|
88
|
+
|
80
89
|
if (event.dataTransfer) {
|
81
|
-
event.dataTransfer.effectAllowed =
|
82
|
-
event.dataTransfer.setData(
|
90
|
+
event.dataTransfer.effectAllowed = "move";
|
91
|
+
event.dataTransfer.setData("text/plain", this.draggedItemId);
|
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
|
+
/* ---------------------------------------------------------------- */
|
83
117
|
}
|
84
118
|
|
85
|
-
|
86
|
-
event.target.style.opacity = '0.5';
|
87
|
-
}, 0);
|
119
|
+
requestAnimationFrame(() => (event.target.style.opacity = "0.5"));
|
88
120
|
}
|
89
121
|
|
122
|
+
/* ---------------- DRAG ENTER ---------------- */
|
90
123
|
handleDragEnter(event) {
|
91
124
|
if (!this.draggedItem || event.target === this.draggedItem) return;
|
92
|
-
|
93
|
-
|
94
|
-
this.
|
95
|
-
} else {
|
96
|
-
this.handleSingleContainerDragEnter(event);
|
97
|
-
}
|
125
|
+
this.hasMultipleContainers
|
126
|
+
? this.handleMultiContainerDragEnter(event)
|
127
|
+
: this.handleSingleContainerDragEnter(event);
|
98
128
|
}
|
99
129
|
|
100
130
|
handleSingleContainerDragEnter(event) {
|
101
|
-
const targetItem = event.target.closest(
|
131
|
+
const targetItem = event.target.closest(".pb_draggable_item");
|
132
|
+
// If we're entering a container directly or there's no target item
|
102
133
|
if (!targetItem) return;
|
103
134
|
|
104
135
|
const container = targetItem.parentNode;
|
105
|
-
const items
|
136
|
+
const items = Array.from(container.children);
|
137
|
+
const fromIdx = items.indexOf(this.draggedItem);
|
138
|
+
const toIdx = items.indexOf(targetItem);
|
106
139
|
|
107
|
-
|
108
|
-
const targetIndex = items.indexOf(targetItem);
|
109
|
-
|
110
|
-
if (draggedIndex > targetIndex) {
|
140
|
+
if (fromIdx > toIdx) {
|
111
141
|
container.insertBefore(this.draggedItem, targetItem);
|
112
142
|
} else {
|
113
143
|
container.insertBefore(this.draggedItem, targetItem.nextSibling);
|
@@ -116,146 +146,113 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
116
146
|
|
117
147
|
handleMultiContainerDragEnter(event) {
|
118
148
|
const targetContainer = event.target.closest(DRAGGABLE_CONTAINER);
|
119
|
-
const targetItem
|
120
|
-
|
149
|
+
const targetItem = event.target.closest(".pb_draggable_item");
|
121
150
|
if (!targetContainer) return;
|
122
151
|
|
123
|
-
// If we're entering a container directly or there's no target item
|
124
152
|
if (!targetItem) {
|
125
|
-
const
|
126
|
-
|
127
|
-
targetContainer.insertBefore(this.draggedItem,
|
128
|
-
|
129
|
-
targetContainer.appendChild(this.draggedItem);
|
130
|
-
}
|
153
|
+
const last = targetContainer.querySelector(".pb_draggable_item:last-child");
|
154
|
+
last
|
155
|
+
? targetContainer.insertBefore(this.draggedItem, last.nextSibling)
|
156
|
+
: targetContainer.appendChild(this.draggedItem);
|
131
157
|
return;
|
132
158
|
}
|
133
159
|
|
134
|
-
const
|
135
|
-
|
136
|
-
|
137
|
-
const newItems = [...items].map(item => ({
|
138
|
-
id: item.id,
|
139
|
-
container: container.id
|
140
|
-
}));
|
141
|
-
|
142
|
-
this.setState({ items: newItems });
|
160
|
+
const items = Array.from(targetContainer.children);
|
161
|
+
this.setState({ items: items.map(i => ({ id: i.id, container: targetContainer.id })) });
|
143
162
|
|
144
|
-
const
|
145
|
-
|
163
|
+
const midY = targetItem.getBoundingClientRect().top +
|
164
|
+
targetItem.getBoundingClientRect().height / 2;
|
146
165
|
|
147
|
-
if (event.clientY <
|
148
|
-
|
166
|
+
if (event.clientY < midY) {
|
167
|
+
targetContainer.insertBefore(this.draggedItem, targetItem);
|
149
168
|
} else {
|
150
|
-
|
169
|
+
targetContainer.insertBefore(this.draggedItem, targetItem.nextSibling);
|
151
170
|
}
|
152
171
|
}
|
153
172
|
|
173
|
+
/* ---------------- DRAG OVER ---------------- */
|
154
174
|
handleDragOver(event) {
|
155
175
|
event.preventDefault();
|
156
176
|
event.stopPropagation();
|
157
|
-
|
158
|
-
|
159
|
-
this.
|
160
|
-
} else {
|
161
|
-
this.handleSingleContainerDragOver(event);
|
162
|
-
}
|
177
|
+
this.hasMultipleContainers
|
178
|
+
? this.handleMultiContainerDragOver(event)
|
179
|
+
: this.handleSingleContainerDragOver(event);
|
163
180
|
}
|
164
181
|
|
165
182
|
handleSingleContainerDragOver(event) {
|
166
183
|
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
167
|
-
if (container)
|
168
|
-
container.classList.add("active_container");
|
169
|
-
}
|
184
|
+
if (container) container.classList.add("active_container");
|
170
185
|
}
|
171
186
|
|
172
187
|
handleMultiContainerDragOver(event) {
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
}
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
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
|
-
}
|
188
|
+
const container = event.target.matches(DRAGGABLE_CONTAINER)
|
189
|
+
? event.target
|
190
|
+
: event.target.closest(DRAGGABLE_CONTAINER);
|
191
|
+
if (!container) return;
|
192
|
+
|
193
|
+
this.setState({ activeContainer: container.id });
|
194
|
+
container.classList.add("active_container");
|
195
|
+
|
196
|
+
const last = container.querySelector(".pb_draggable_item:last-child");
|
197
|
+
if (!last || event.clientY > last.getBoundingClientRect().bottom) {
|
198
|
+
if (this.draggedItem && this.draggedItem.parentNode !== container) {
|
199
|
+
container.appendChild(this.draggedItem);
|
190
200
|
}
|
191
201
|
}
|
192
202
|
}
|
193
203
|
|
204
|
+
/* ---------------- DROP ---------------- */
|
194
205
|
handleDrop(event) {
|
195
206
|
event.preventDefault();
|
196
207
|
event.stopPropagation();
|
197
208
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
} else {
|
202
|
-
container = event.target.closest(DRAGGABLE_CONTAINER);
|
203
|
-
}
|
204
|
-
|
209
|
+
const container = event.target.matches(DRAGGABLE_CONTAINER)
|
210
|
+
? event.target
|
211
|
+
: event.target.closest(DRAGGABLE_CONTAINER);
|
205
212
|
if (!container || !this.draggedItem) return;
|
206
213
|
|
207
214
|
container.classList.remove("active_container");
|
208
|
-
this.draggedItem.style.opacity =
|
215
|
+
this.draggedItem.style.opacity = "1";
|
209
216
|
|
210
217
|
// Handle empty containers
|
211
|
-
if (this.hasMultipleContainers && !container.querySelector(
|
218
|
+
if (this.hasMultipleContainers && !container.querySelector(".pb_draggable_item")) {
|
212
219
|
container.appendChild(this.draggedItem);
|
213
220
|
}
|
214
221
|
|
215
222
|
// Updated order of items as an array of item IDs
|
216
|
-
const reorderedItems = Array.from(
|
217
|
-
|
218
|
-
).map(item => ({
|
219
|
-
id: item.id,
|
220
|
-
container: item.closest(DRAGGABLE_CONTAINER).id
|
221
|
-
}));
|
222
|
-
|
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);
|
223
|
+
const reorderedItems = Array.from(this.element.querySelectorAll(".pb_draggable_item"))
|
224
|
+
.map(i => ({ id: i.id, container: i.closest(DRAGGABLE_CONTAINER).id }));
|
234
225
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
});
|
226
|
+
container.dataset.reorderedItems = JSON.stringify(reorderedItems);
|
227
|
+
this.element.dispatchEvent(new CustomEvent("pb-draggable-reorder", {
|
228
|
+
detail: { reorderedItems, containerId: container.id },
|
229
|
+
}));
|
240
230
|
|
241
|
-
this.
|
231
|
+
this.setState({ items: reorderedItems, isDragging: "", activeContainer: "" });
|
232
|
+
this.draggedItem = null;
|
242
233
|
this.draggedItemId = null;
|
243
234
|
}
|
244
235
|
|
236
|
+
/* ---------------- DRAG END ---------------- */
|
245
237
|
handleDragEnd(event) {
|
246
|
-
event.target.classList.remove(
|
247
|
-
|
238
|
+
event.target.classList.remove(
|
239
|
+
"is_dragging",
|
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
|
+
}
|
248
249
|
|
249
|
-
this.setState({
|
250
|
-
isDragging: "",
|
251
|
-
activeContainer: ""
|
252
|
-
});
|
250
|
+
this.setState({ isDragging: "", activeContainer: "" });
|
253
251
|
|
254
|
-
this.
|
255
|
-
|
252
|
+
this.element.querySelectorAll(DRAGGABLE_CONTAINER)
|
253
|
+
.forEach(c => c.classList.remove("active_container"));
|
256
254
|
|
257
|
-
this.
|
258
|
-
|
259
|
-
});
|
255
|
+
this.draggedItem = null;
|
256
|
+
this.draggedItemId = null;
|
260
257
|
}
|
261
258
|
}
|
@@ -31,7 +31,7 @@ const DraggableContainer = (props: DraggableContainerProps) => {
|
|
31
31
|
} = contextValues;
|
32
32
|
|
33
33
|
// Only get direction if dropZone is 'line'
|
34
|
-
const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') :
|
34
|
+
const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') : null;
|
35
35
|
|
36
36
|
const ariaProps = buildAriaProps(aria);
|
37
37
|
const dataProps = buildDataProps(data);
|
@@ -41,8 +41,9 @@ const DraggableContainer = (props: DraggableContainerProps) => {
|
|
41
41
|
const classes = classnames(
|
42
42
|
buildCss("pb_draggable_container"),
|
43
43
|
`${activeContainer === container ? "active" : ""}`,
|
44
|
-
//
|
45
|
-
|
44
|
+
// Line variant gets line_{direction} classname on container no matter what
|
45
|
+
dropZone === 'line' && direction === 'vertical' ? 'line_vertical' : '',
|
46
|
+
dropZone === 'line' && direction === 'horizontal' ? 'line_horizontal' : '',
|
46
47
|
globalProps(props),
|
47
48
|
className
|
48
49
|
);
|
@@ -1,9 +1,12 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
2
|
import Dropdown from '../../pb_dropdown/_dropdown'
|
3
|
+
import Icon from '../../pb_icon/_icon'
|
3
4
|
|
4
5
|
const DropdownError = (props) => {
|
5
6
|
const [selectedOption, setSelectedOption] = useState()
|
6
|
-
const error = selectedOption?.value ? null :
|
7
|
+
const error = selectedOption?.value ? null : (<>
|
8
|
+
<Icon icon="warning" /> Please make a valid selection
|
9
|
+
</>)
|
7
10
|
const options = [
|
8
11
|
{
|
9
12
|
label: "United States",
|