playbook_ui 15.4.0 → 15.5.0.pre.alpha.PLAY2581aggressivevalidation12651
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/_advanced_table.scss +96 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.jsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +21 -8
- data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +6 -2
- data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +3 -0
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +24 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.html.erb +9 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.jsx +24 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_rails.md +1 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_react.md +1 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +1 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +2 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +2 -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 +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +25 -11
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +44 -3
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +20 -13
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +6 -4
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +17 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.jsx +43 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_date_range_inline/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +6 -4
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +2 -3
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +11 -5
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.test.js +26 -9
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.html.erb +12 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/{_date_stacked_not_current_year.jsx → _date_stacked_current_year.jsx} +6 -5
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +156 -6
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +8 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +180 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +22 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +77 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +32 -14
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_alignment.jsx +2 -1
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_default.jsx +2 -1
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_orientation.jsx +2 -1
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_size.jsx +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +31 -9
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +12 -5
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.jsx +1 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +4 -1
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +1 -1
- data/app/pb_kits/playbook/pb_nav/_item.tsx +18 -4
- data/app/pb_kits/playbook/pb_nav/_nav.scss +30 -5
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +192 -0
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.html.erb +21 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.jsx +113 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.html.erb +30 -0
- data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.jsx +117 -0
- data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_nav/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +6 -4
- data/app/pb_kits/playbook/pb_nav/item.rb +11 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_non_clickable.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.html.erb +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.md +11 -0
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.md +2 -2
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +32 -9
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +4 -1
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.scss +384 -262
- data/app/pb_kits/playbook/pb_progress_step/docs/_description.md +1 -5
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.html.erb +14 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.jsx +29 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.md +3 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.jsx +31 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.md +1 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.html.erb +4 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.jsx +14 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.md +3 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.md +3 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.html.erb +1 -7
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_progress_step/progress_step.test.js +41 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +3 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +3 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +4 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +2 -1
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +1 -1
- data/app/pb_kits/playbook/utilities/_truncate.scss +2 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
- data/dist/chunks/_typeahead-DrZthFaf.js +6 -0
- data/dist/chunks/lib-CgpqUb6l.js +29 -0
- data/dist/chunks/vendor.js +37 -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 +48 -12
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.html.erb +0 -5
- data/dist/chunks/_line_graph-r__oOO2H.js +0 -1
- data/dist/chunks/_typeahead-B7c52zVj.js +0 -6
- data/dist/chunks/_weekday_stacked-DgiIj2w3.js +0 -37
- data/dist/chunks/componentRegistry-DzmmLR2x.js +0 -1
- data/dist/chunks/lib-CRUXizZe.js +0 -29
- data/dist/chunks/pb_form_validation-CywJN0ej.js +0 -1
- data/dist/playbook-doc.js +0 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Pass in `show_current_year` to show this date's current year.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Pass in `showCurrentYear` to show this date's current year.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
examples:
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
rails:
|
|
4
4
|
- date_time_default: Default
|
|
5
5
|
- date_time_align: Alignment
|
|
6
6
|
- date_time_size: Size
|
|
7
|
+
- date_time_show_current_year: Show Current Year
|
|
7
8
|
|
|
8
9
|
react:
|
|
9
10
|
- date_time_default: Default
|
|
10
11
|
- date_time_align: Alignment
|
|
11
12
|
- date_time_size: Size
|
|
13
|
+
- date_time_show_current_year: Show Current Year
|
|
12
14
|
|
|
13
15
|
swift:
|
|
14
16
|
- date_time_default_swift: Default
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as DateTimeDefault } from './_date_time_default.jsx'
|
|
2
2
|
export { default as DateTimeAlign } from './_date_time_align.jsx'
|
|
3
3
|
export { default as DateTimeSize } from './_date_time_size.jsx'
|
|
4
|
+
export { default as DateTimeShowCurrentYear } from './_date_time_show_current_year.jsx'
|
|
@@ -17,6 +17,7 @@ type DateTimeStackedProps = {
|
|
|
17
17
|
datetime: Date,
|
|
18
18
|
dark: boolean,
|
|
19
19
|
timeZone?: string,
|
|
20
|
+
showCurrentYear?: boolean,
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
@@ -28,6 +29,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
28
29
|
dark,
|
|
29
30
|
htmlOptions = {},
|
|
30
31
|
timeZone = 'America/New_York',
|
|
32
|
+
showCurrentYear = false,
|
|
31
33
|
} = props
|
|
32
34
|
|
|
33
35
|
const classes = buildCss('pb_date_time_stacked_kit', globalProps(props))
|
|
@@ -46,6 +48,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
46
48
|
bold
|
|
47
49
|
dark={dark}
|
|
48
50
|
date={date || datetime}
|
|
51
|
+
showCurrentYear={showCurrentYear}
|
|
49
52
|
/>
|
|
50
53
|
</FlexItem>
|
|
51
54
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<%= pb_content_tag do %>
|
|
1
|
+
<%= pb_content_tag do %>
|
|
2
2
|
|
|
3
3
|
<%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %>
|
|
4
4
|
<%= pb_rails("body", props: {classname: "flex-item"}) do %>
|
|
5
|
-
<%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark }) %>
|
|
5
|
+
<%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark, show_current_year: object.show_current_year }) %>
|
|
6
6
|
<% end %>
|
|
7
7
|
<%= pb_rails("section_separator", props: { orientation: "vertical", classname: "date-time-padding" }) %>
|
|
8
8
|
<%= pb_rails("body", props: {classname: "flex-item"}) do %>
|
|
@@ -41,3 +41,36 @@ test('renders time in timezone', () => {
|
|
|
41
41
|
const kit = renderKit(DateTimeStacked, props)
|
|
42
42
|
expect(kit).toHaveTextContent(`${monthDayYear}11:00aMDT`)
|
|
43
43
|
})
|
|
44
|
+
|
|
45
|
+
test('renders current year when showCurrentYear is true', () => {
|
|
46
|
+
const currentYearDate = new Date()
|
|
47
|
+
const currentYear = currentYearDate.getFullYear()
|
|
48
|
+
|
|
49
|
+
const kit = renderKit(DateTimeStacked, {
|
|
50
|
+
data: { testid: 'datetimestacked-current-year' },
|
|
51
|
+
datetime: currentYearDate,
|
|
52
|
+
dark: false,
|
|
53
|
+
showCurrentYear: true,
|
|
54
|
+
})
|
|
55
|
+
expect(kit).toHaveTextContent(currentYear.toString())
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('hides current year by default', () => {
|
|
59
|
+
const currentYearDate = new Date()
|
|
60
|
+
const currentYear = currentYearDate.getFullYear()
|
|
61
|
+
|
|
62
|
+
const kit = renderKit(DateTimeStacked, {
|
|
63
|
+
data: { testid: 'datetimestacked-hide-year' },
|
|
64
|
+
datetime: currentYearDate,
|
|
65
|
+
dark: false,
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const yearElement = kit.querySelector('.pb_caption_kit_xs')
|
|
69
|
+
|
|
70
|
+
if (yearElement) {
|
|
71
|
+
expect(yearElement.textContent).not.toBe(currentYear.toString())
|
|
72
|
+
} else {
|
|
73
|
+
|
|
74
|
+
expect(yearElement).toBeNull()
|
|
75
|
+
}
|
|
76
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import DateTimeStacked from '../_date_time_stacked'
|
|
4
|
+
|
|
5
|
+
const DateTimeStackedShowCurrentYear = (props) => (
|
|
6
|
+
<div>
|
|
7
|
+
<DateTimeStacked
|
|
8
|
+
datetime={new Date()}
|
|
9
|
+
showCurrentYear
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
<br />
|
|
13
|
+
<DateTimeStacked
|
|
14
|
+
datetime={new Date()}
|
|
15
|
+
showCurrentYear
|
|
16
|
+
timeZone="America/Denver"
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default DateTimeStackedShowCurrentYear;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
By default, the Date Time Stacked kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
|
|
@@ -2,9 +2,11 @@ examples:
|
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
4
|
- date_time_stacked_default: Default
|
|
5
|
-
|
|
5
|
+
- date_time_stacked_show_current_year: Show Current Year
|
|
6
|
+
|
|
6
7
|
react:
|
|
7
8
|
- date_time_stacked_default: Default
|
|
9
|
+
- date_time_stacked_show_current_year: Show Current Year
|
|
8
10
|
|
|
9
11
|
swift:
|
|
10
12
|
- date_time_stacked_default_swift: Default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= pb_rails("button", props: { text: "Open Complex Dialog", data:{"open-dialog": "dialog-complex"} }) %>
|
|
2
2
|
|
|
3
3
|
<%= pb_rails("dialog", props: { id:"dialog-complex", size: "lg", full_height: true }) do %>
|
|
4
|
-
|
|
4
|
+
<%= pb_form_with(scope: :example, method: :get, url: "", options: { remote: true }) do |form| %>
|
|
5
5
|
<%= pb_rails("dialog/dialog_header", props: { id: "dialog-complex" } ) do %>
|
|
6
6
|
<%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %>
|
|
7
7
|
<% end %>
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
|
|
14
14
|
<% end %>
|
|
15
15
|
<%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-complex"}) %>
|
|
16
|
-
|
|
16
|
+
<% end %>
|
|
17
17
|
<% end %>
|
|
@@ -39,6 +39,59 @@ const reducer = (state: InitialStateType, action: ActionType) => {
|
|
|
39
39
|
|
|
40
40
|
return { ...state, items: newItems };
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
// Used only when enableCrossContainerPreview is true
|
|
44
|
+
case "REORDER_ITEMS_CROSS_CONTAINER": {
|
|
45
|
+
const { dragId, targetId, newContainer } = action.payload;
|
|
46
|
+
const newItems = [...state.items];
|
|
47
|
+
const draggedItem = newItems.find((item) => item && item.id === dragId);
|
|
48
|
+
|
|
49
|
+
if (!draggedItem) return state;
|
|
50
|
+
|
|
51
|
+
const draggedIndex = newItems.indexOf(draggedItem);
|
|
52
|
+
const targetIndex = newItems.findIndex(
|
|
53
|
+
(item) => item && item.id === targetId
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (draggedIndex === -1 || targetIndex === -1) return state;
|
|
57
|
+
|
|
58
|
+
const updatedItem = { ...draggedItem, container: newContainer };
|
|
59
|
+
newItems.splice(draggedIndex, 1);
|
|
60
|
+
newItems.splice(targetIndex, 0, updatedItem);
|
|
61
|
+
|
|
62
|
+
return { ...state, items: newItems };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Used only when enableCrossContainerPreview is true
|
|
66
|
+
case "MOVE_TO_CONTAINER_END": {
|
|
67
|
+
const { dragId, newContainer } = action.payload;
|
|
68
|
+
const newItems = [...state.items];
|
|
69
|
+
const draggedItem = newItems.find((item) => item && item.id === dragId);
|
|
70
|
+
|
|
71
|
+
if (!draggedItem) return state;
|
|
72
|
+
|
|
73
|
+
const draggedIndex = newItems.indexOf(draggedItem);
|
|
74
|
+
if (draggedIndex === -1) return state;
|
|
75
|
+
|
|
76
|
+
const updatedItem = { ...draggedItem, container: newContainer };
|
|
77
|
+
|
|
78
|
+
// Remove from current position
|
|
79
|
+
newItems.splice(draggedIndex, 1);
|
|
80
|
+
|
|
81
|
+
// Insert at end of target container
|
|
82
|
+
const lastIndexInContainer = newItems
|
|
83
|
+
.map((item) => item && item.container)
|
|
84
|
+
.lastIndexOf(newContainer);
|
|
85
|
+
|
|
86
|
+
if (lastIndexInContainer === -1) {
|
|
87
|
+
newItems.push(updatedItem);
|
|
88
|
+
} else {
|
|
89
|
+
newItems.splice(lastIndexInContainer + 1, 0, updatedItem);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { ...state, items: newItems };
|
|
93
|
+
}
|
|
94
|
+
|
|
42
95
|
default:
|
|
43
96
|
return state;
|
|
44
97
|
}
|
|
@@ -61,7 +114,9 @@ export const DraggableProvider = ({
|
|
|
61
114
|
onDrop,
|
|
62
115
|
onDragOver,
|
|
63
116
|
dropZone = { type: 'ghost', color: 'neutral', direction: 'vertical' },
|
|
64
|
-
providerId = 'default', // fallback provided for backward compatibility
|
|
117
|
+
providerId = 'default', // fallback provided for backward compatibility
|
|
118
|
+
// Opt-in flag for cross-container preview
|
|
119
|
+
enableCrossContainerPreview = false,
|
|
65
120
|
}: DraggableProviderType) => {
|
|
66
121
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
67
122
|
|
|
@@ -103,17 +158,74 @@ export const DraggableProvider = ({
|
|
|
103
158
|
if (state.dragData.originId !== providerId) return; // Ignore drag events from other providers
|
|
104
159
|
|
|
105
160
|
if (state.dragData.id !== id) {
|
|
106
|
-
|
|
107
|
-
|
|
161
|
+
if (enableCrossContainerPreview) {
|
|
162
|
+
// Used only when enableCrossContainerPreview is true
|
|
163
|
+
const draggedItem = state.items.find(
|
|
164
|
+
(item) => item && item.id === state.dragData.id
|
|
165
|
+
);
|
|
166
|
+
const currentContainer =
|
|
167
|
+
draggedItem && draggedItem.container
|
|
168
|
+
? draggedItem.container
|
|
169
|
+
: state.dragData.initialGroup;
|
|
170
|
+
|
|
171
|
+
const isCrossContainer =
|
|
172
|
+
currentContainer !== container &&
|
|
173
|
+
(currentContainer !== undefined || container !== undefined);
|
|
174
|
+
|
|
175
|
+
if (isCrossContainer) {
|
|
176
|
+
dispatch({
|
|
177
|
+
type: "REORDER_ITEMS_CROSS_CONTAINER",
|
|
178
|
+
payload: {
|
|
179
|
+
dragId: state.dragData.id,
|
|
180
|
+
targetId: id,
|
|
181
|
+
newContainer: container,
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
// Same container: keep original behavior
|
|
186
|
+
dispatch({
|
|
187
|
+
type: "REORDER_ITEMS",
|
|
188
|
+
payload: { dragId: state.dragData.id, targetId: id },
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
// Original behavior (no preview across containers)
|
|
193
|
+
dispatch({type: "REORDER_ITEMS", payload: { dragId: state.dragData.id, targetId: id }});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
dispatch({type: "SET_DRAG_DATA",payload: {id: state.dragData.id, initialGroup: container, originId: providerId}});
|
|
108
197
|
}
|
|
109
198
|
if (onDragEnter) onDragEnter(id, container);
|
|
110
199
|
};
|
|
111
200
|
|
|
112
201
|
const handleDragEnd = () => {
|
|
202
|
+
const draggedItemId = state.dragData.id;
|
|
203
|
+
const originalContainer = state.dragData.initialGroup;
|
|
204
|
+
|
|
113
205
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
|
114
206
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
|
115
207
|
dispatch({ type: 'SET_DRAG_DATA', payload: { id: "", initialGroup: "", originId: "" } });
|
|
116
|
-
if (onDragEnd)
|
|
208
|
+
if (onDragEnd) {
|
|
209
|
+
if (!enableCrossContainerPreview) {
|
|
210
|
+
onDragEnd();
|
|
211
|
+
} else {
|
|
212
|
+
const draggedItem = state.items.find(item => item && item.id === draggedItemId);
|
|
213
|
+
const finalContainer = draggedItem ? draggedItem.container : originalContainer;
|
|
214
|
+
|
|
215
|
+
const itemsInContainer = state.items.filter(item => item && item.container === finalContainer);
|
|
216
|
+
const indexInContainer = itemsInContainer.findIndex(item => item && item.id === draggedItemId);
|
|
217
|
+
const itemAbove = indexInContainer > 0 ? itemsInContainer[indexInContainer - 1] : null;
|
|
218
|
+
const itemBelow = indexInContainer < itemsInContainer.length - 1 ? itemsInContainer[indexInContainer + 1] : null;
|
|
219
|
+
|
|
220
|
+
onDragEnd(
|
|
221
|
+
draggedItemId,
|
|
222
|
+
finalContainer,
|
|
223
|
+
originalContainer,
|
|
224
|
+
itemAbove,
|
|
225
|
+
itemBelow
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
117
229
|
};
|
|
118
230
|
|
|
119
231
|
const changeCategory = (itemId: string, container: string) => {
|
|
@@ -123,10 +235,34 @@ export const DraggableProvider = ({
|
|
|
123
235
|
const handleDrop = (container: string) => {
|
|
124
236
|
if (state.dragData.originId !== providerId) return; // Ignore drop events from other providers
|
|
125
237
|
|
|
238
|
+
const draggedItemId = state.dragData.id;
|
|
239
|
+
const originalContainer = state.dragData.initialGroup;
|
|
240
|
+
|
|
126
241
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
|
127
242
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
|
128
243
|
changeCategory(state.dragData.id, container);
|
|
129
|
-
if (onDrop)
|
|
244
|
+
if (onDrop) {
|
|
245
|
+
if (!enableCrossContainerPreview) {
|
|
246
|
+
onDrop(container);
|
|
247
|
+
} else {
|
|
248
|
+
const draggedItem = state.items.find(item => item && item.id === draggedItemId);
|
|
249
|
+
const updatedItem = draggedItem ? { ...draggedItem, container } : null;
|
|
250
|
+
|
|
251
|
+
const itemsInContainer = state.items.filter(item => item && item.container === container);
|
|
252
|
+
const indexInContainer = itemsInContainer.findIndex(item => item && item.id === draggedItemId);
|
|
253
|
+
const itemAbove = indexInContainer > 0 ? itemsInContainer[indexInContainer - 1] : null;
|
|
254
|
+
const itemBelow = indexInContainer < itemsInContainer.length - 1 ? itemsInContainer[indexInContainer + 1] : null;
|
|
255
|
+
|
|
256
|
+
onDrop(
|
|
257
|
+
draggedItemId,
|
|
258
|
+
container,
|
|
259
|
+
originalContainer,
|
|
260
|
+
updatedItem,
|
|
261
|
+
itemAbove,
|
|
262
|
+
itemBelow
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
130
266
|
};
|
|
131
267
|
|
|
132
268
|
const handleDragOver = (e: Event, container: string) => {
|
|
@@ -134,6 +270,20 @@ export const DraggableProvider = ({
|
|
|
134
270
|
|
|
135
271
|
e.preventDefault();
|
|
136
272
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: container });
|
|
273
|
+
|
|
274
|
+
if (enableCrossContainerPreview && state.dragData.id) {
|
|
275
|
+
// Only when enableCrossContainerPreview is true: when hovering over a different container, move item to end
|
|
276
|
+
const draggedItem = state.items.find(
|
|
277
|
+
(item) => item && item.id === state.dragData.id
|
|
278
|
+
);
|
|
279
|
+
if (draggedItem && draggedItem.container !== container) {
|
|
280
|
+
dispatch({
|
|
281
|
+
type: "MOVE_TO_CONTAINER_END",
|
|
282
|
+
payload: { dragId: state.dragData.id, newContainer: container },
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
137
287
|
if (onDragOver) onDragOver(e, container);
|
|
138
288
|
};
|
|
139
289
|
|
|
@@ -157,4 +307,4 @@ export const DraggableProvider = ({
|
|
|
157
307
|
return (
|
|
158
308
|
<DragContext.Provider value={contextValue}>{children}</DragContext.Provider>
|
|
159
309
|
);
|
|
160
|
-
};
|
|
310
|
+
};
|
|
@@ -18,8 +18,12 @@ export type ActionType =
|
|
|
18
18
|
} }
|
|
19
19
|
| { type: 'SET_IS_DRAGGING'; payload: string }
|
|
20
20
|
| { type: 'SET_ACTIVE_CONTAINER'; payload: string }
|
|
21
|
+
| { type: 'SET_CROSS_CONTAINER_PREVIEW'; payload: boolean }
|
|
21
22
|
| { type: 'CHANGE_CATEGORY'; payload: { itemId: string; container: string } }
|
|
22
|
-
| { type: 'REORDER_ITEMS'; payload: { dragId: string; targetId: string } }
|
|
23
|
+
| { type: 'REORDER_ITEMS'; payload: { dragId: string; targetId: string } }
|
|
24
|
+
| { type: 'REORDER_ITEMS_CROSS_CONTAINER'; payload: { dragId: string; targetId: string; newContainer: string } }
|
|
25
|
+
| { type: 'MOVE_TO_CONTAINER_END'; payload: { dragId: string; newContainer: string } }
|
|
26
|
+
| { type: 'RESET_DRAG_CONTAINER'; payload: { itemId: string; originalContainer: string } };
|
|
23
27
|
|
|
24
28
|
export interface DropZoneConfig {
|
|
25
29
|
type?: 'ghost' | 'outline' | 'shadow' | 'line';
|
|
@@ -33,9 +37,10 @@ export type ActionType =
|
|
|
33
37
|
onReorder: (items: ItemType[]) => void;
|
|
34
38
|
onDragStart?: (id: string, container: string) => void;
|
|
35
39
|
onDragEnter?: (id: string, container: string) => void;
|
|
36
|
-
onDragEnd?: () => void;
|
|
37
|
-
onDrop?: (
|
|
40
|
+
onDragEnd?: (...args: any[]) => void;
|
|
41
|
+
onDrop?: (...args: any[]) => void;
|
|
38
42
|
onDragOver?: (e: Event, container: string) => void;
|
|
39
43
|
dropZone?: DropZoneConfig | string; // Can accept string for backward compatibility
|
|
40
44
|
providerId?: string;
|
|
45
|
+
enableCrossContainerPreview?: boolean;
|
|
41
46
|
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
|
|
3
|
+
import Flex from '../../pb_flex/_flex'
|
|
4
|
+
import Draggable from '../../pb_draggable/_draggable'
|
|
5
|
+
import { DraggableProvider } from '../../pb_draggable/context'
|
|
6
|
+
import Badge from '../../pb_badge/_badge'
|
|
7
|
+
import Title from '../../pb_title/_title'
|
|
8
|
+
import Caption from '../../pb_caption/_caption'
|
|
9
|
+
import Card from '../../pb_card/_card'
|
|
10
|
+
import FlexItem from '../../pb_flex/_flex_item'
|
|
11
|
+
import Avatar from '../../pb_avatar/_avatar'
|
|
12
|
+
import Body from '../../pb_body/_body'
|
|
13
|
+
|
|
14
|
+
// Initial groups to drag between
|
|
15
|
+
const containers = ["To Do", "In Progress", "Done"];
|
|
16
|
+
|
|
17
|
+
// Initial items to be dragged
|
|
18
|
+
const data = [
|
|
19
|
+
{
|
|
20
|
+
id: "11",
|
|
21
|
+
container: "To Do",
|
|
22
|
+
title: "Task 1",
|
|
23
|
+
description: "Bug fixes",
|
|
24
|
+
assignee_name: "Terry Miles",
|
|
25
|
+
assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "12",
|
|
29
|
+
container: "To Do",
|
|
30
|
+
title: "Task 2",
|
|
31
|
+
description: "Documentation",
|
|
32
|
+
assignee_name: "Sophia Miles",
|
|
33
|
+
assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "13",
|
|
37
|
+
container: "In Progress",
|
|
38
|
+
title: "Task 3",
|
|
39
|
+
description: "Add a variant",
|
|
40
|
+
assignee_name: "Alice Jones",
|
|
41
|
+
assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "14",
|
|
45
|
+
container: "To Do",
|
|
46
|
+
title: "Task 4",
|
|
47
|
+
description: "Add jest tests",
|
|
48
|
+
assignee_name: "Mike James",
|
|
49
|
+
assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "15",
|
|
53
|
+
container: "Done",
|
|
54
|
+
title: "Task 5",
|
|
55
|
+
description: "Alpha testing",
|
|
56
|
+
assignee_name: "James Guy",
|
|
57
|
+
assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "16",
|
|
61
|
+
container: "In Progress",
|
|
62
|
+
title: "Task 6",
|
|
63
|
+
description: "Release",
|
|
64
|
+
assignee_name: "Sally Jones",
|
|
65
|
+
assignee_img: "https://randomuser.me/api/portraits/women/28.jpg",
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const DraggableMultipleContainersDropzone = (props) => {
|
|
70
|
+
const [initialState, setInitialState] = useState(data);
|
|
71
|
+
|
|
72
|
+
const badgeProperties = (container) => {
|
|
73
|
+
switch (container) {
|
|
74
|
+
case "To Do":
|
|
75
|
+
return { text: "queue", color: "warning" };
|
|
76
|
+
case "In Progress":
|
|
77
|
+
return { text: "progress", color: "primary" };
|
|
78
|
+
default:
|
|
79
|
+
return { text: "done", color: "success" };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<DraggableProvider
|
|
85
|
+
dropZone={{type: "outline"}}
|
|
86
|
+
enableCrossContainerPreview
|
|
87
|
+
initialItems={data}
|
|
88
|
+
onDragEnd={(draggedItemId, finalContainer, originalContainer, itemAbove, itemBelow) => {
|
|
89
|
+
console.log(`Dragged Item ID: ${draggedItemId}`);
|
|
90
|
+
console.log(`Final Container: ${finalContainer}`);
|
|
91
|
+
console.log(`Original Container: ${originalContainer}`);
|
|
92
|
+
console.log('Item Above:', itemAbove);
|
|
93
|
+
console.log('Item Below:', itemBelow);
|
|
94
|
+
}}
|
|
95
|
+
onDrop={(draggedItemId, droppedContainer, originalContainer, item, itemAbove, itemBelow) => {
|
|
96
|
+
console.log(`Dragged Item ID: ${draggedItemId}`);
|
|
97
|
+
console.log(`Dropped Container: ${droppedContainer}`);
|
|
98
|
+
console.log(`Original Container: ${originalContainer}`);
|
|
99
|
+
console.log('Dropped Item:', item);
|
|
100
|
+
console.log('Item Above:', itemAbove);
|
|
101
|
+
console.log('Item Below:', itemBelow);
|
|
102
|
+
}}
|
|
103
|
+
onReorder={(items) => setInitialState(items)}
|
|
104
|
+
>
|
|
105
|
+
<Flex
|
|
106
|
+
justifyContent="center"
|
|
107
|
+
{...props}
|
|
108
|
+
>
|
|
109
|
+
{containers?.map((container) => (
|
|
110
|
+
<Draggable.Container
|
|
111
|
+
container={container}
|
|
112
|
+
htmlOptions={{style:{ width: "200px", height: "70vh"}}}
|
|
113
|
+
key={container}
|
|
114
|
+
padding="sm"
|
|
115
|
+
>
|
|
116
|
+
<Caption textAlign="center">{container}</Caption>
|
|
117
|
+
<Flex
|
|
118
|
+
alignItems="stretch"
|
|
119
|
+
gap="sm"
|
|
120
|
+
orientation="column"
|
|
121
|
+
>
|
|
122
|
+
{initialState
|
|
123
|
+
.filter((item) => item.container === container)
|
|
124
|
+
.map(
|
|
125
|
+
({
|
|
126
|
+
assignee_img,
|
|
127
|
+
assignee_name,
|
|
128
|
+
description,
|
|
129
|
+
id,
|
|
130
|
+
title,
|
|
131
|
+
}) => (
|
|
132
|
+
<Draggable.Item
|
|
133
|
+
container={container}
|
|
134
|
+
dragId={id}
|
|
135
|
+
key={id}
|
|
136
|
+
>
|
|
137
|
+
<Card
|
|
138
|
+
padding="sm"
|
|
139
|
+
{...props}
|
|
140
|
+
>
|
|
141
|
+
<Flex justify="between">
|
|
142
|
+
<FlexItem>
|
|
143
|
+
<Flex>
|
|
144
|
+
<Avatar
|
|
145
|
+
imageUrl={assignee_img}
|
|
146
|
+
name={assignee_name}
|
|
147
|
+
size="xxs"
|
|
148
|
+
/>
|
|
149
|
+
<Title paddingLeft="xs"
|
|
150
|
+
size={4}
|
|
151
|
+
text={title}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
</Flex>
|
|
155
|
+
</FlexItem>
|
|
156
|
+
<Badge
|
|
157
|
+
marginLeft="sm"
|
|
158
|
+
rounded
|
|
159
|
+
text={badgeProperties(container).text}
|
|
160
|
+
variant={badgeProperties(container).color}
|
|
161
|
+
{...props}
|
|
162
|
+
/>
|
|
163
|
+
</Flex>
|
|
164
|
+
<Body paddingTop="xs"
|
|
165
|
+
text={description}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
</Card>
|
|
169
|
+
</Draggable.Item>
|
|
170
|
+
)
|
|
171
|
+
)}
|
|
172
|
+
</Flex>
|
|
173
|
+
</Draggable.Container>
|
|
174
|
+
))}
|
|
175
|
+
</Flex>
|
|
176
|
+
</DraggableProvider>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export default DraggableMultipleContainersDropzone;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The multiple container functionality also supports customized dropzone styling as shown here.
|
|
2
|
+
|
|
3
|
+
In addition to this, the `enableCrossContainerPreview` prop can be used on the `DraggableProvider` as shown here to enable dropzone preview for cross-container dragging.
|
|
4
|
+
|
|
5
|
+
With `enableCrossContainerPreview`, the `onDrop` and `onDragEnd` event listeners will also provide several arguments to allow developers more context from the drag event.
|
|
6
|
+
|
|
7
|
+
The `onDrop` callback is triggered when an item is successfully dropped into a container. It provides the following arguments:
|
|
8
|
+
|
|
9
|
+
- `draggedItemId` - The ID of the item that was dragged
|
|
10
|
+
- `droppedContainer` - The container where the item was dropped
|
|
11
|
+
- `originalContainer` - The container where the drag started
|
|
12
|
+
- `item` - The complete item object with all properties (including the updated container)
|
|
13
|
+
- `itemAbove` - The item directly above the dropped item in the final position (null if at the top)
|
|
14
|
+
- `itemBelow` - The item directly below the dropped item in the final position (null if at the bottom)
|
|
15
|
+
|
|
16
|
+
The `onDragEnd` callback is triggered when a drag operation ends, whether it was dropped or cancelled. It provides the following arguments:
|
|
17
|
+
|
|
18
|
+
- `draggedItemId` - The ID of the item that was dragged
|
|
19
|
+
- `finalContainer` - The container where the item ended up (could be same as original if drag was cancelled)
|
|
20
|
+
- `originalContainer` - The container where the drag started
|
|
21
|
+
- `itemAbove` - The item directly above the dragged item in the final position (null if at the top)
|
|
22
|
+
- `itemBelow` - The item directly below the dragged item in the final position (null if at the bottom)
|
|
@@ -5,11 +5,12 @@ examples:
|
|
|
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
|
-
- draggable_multiple_containers: Dragging Across Multiple Containers
|
|
9
8
|
- draggable_drop_zones: Draggable Drop Zones
|
|
10
9
|
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
|
11
10
|
- draggable_drop_zones_line: Draggable Drop Zones Line
|
|
12
11
|
- draggable_event_listeners: Draggable Event Listeners
|
|
12
|
+
- draggable_multiple_containers: Dragging Across Multiple Containers
|
|
13
|
+
- draggable_multiple_containers_dropzone: Dragging Across Multiple Containers with Dropzones
|
|
13
14
|
|
|
14
15
|
rails:
|
|
15
16
|
- draggable_default: Default
|
|
@@ -17,8 +18,8 @@ examples:
|
|
|
17
18
|
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
|
18
19
|
- draggable_with_cards: Draggable with Cards
|
|
19
20
|
- draggable_with_table: Draggable with Table
|
|
20
|
-
- draggable_multiple_containers: Dragging Across Multiple Containers
|
|
21
21
|
- draggable_drop_zones: Draggable Drop Zones
|
|
22
22
|
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
|
23
23
|
- draggable_drop_zones_line: Draggable Drop Zones Line
|
|
24
24
|
- draggable_event_listeners: Draggable Event Listeners
|
|
25
|
+
- draggable_multiple_containers: Dragging Across Multiple Containers
|
|
@@ -7,4 +7,5 @@ export { default as DraggableWithTable } from './_draggable_with_table.jsx'
|
|
|
7
7
|
export { default as DraggableDropZones } from './_draggable_drop_zones.jsx'
|
|
8
8
|
export { default as DraggableDropZonesColors } from './_draggable_drop_zones_colors.jsx'
|
|
9
9
|
export { default as DraggableDropZonesLine } from './_draggable_drop_zones_line.jsx'
|
|
10
|
-
export { default as DraggableEventListeners } from './_draggable_event_listeners.jsx'
|
|
10
|
+
export { default as DraggableEventListeners } from './_draggable_event_listeners.jsx'
|
|
11
|
+
export { default as DraggableMultipleContainersDropzone } from './_draggable_multiple_containers_dropzone.jsx'
|