playbook_ui 15.5.0.pre.alpha.draggablefix12589 → 15.5.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/_advanced_table.scss +6 -96
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +1 -2
- 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 +1 -3
- 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 +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +58 -0
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +8 -21
- data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +2 -6
- data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +0 -3
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +0 -24
- 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 +2 -1
- 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 +0 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +0 -10
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +0 -10
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +0 -7
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +0 -7
- data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -44
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +0 -3
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +0 -1
- data/app/pb_kits/playbook/pb_date_time/date_time.rb +0 -1
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_date_time/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +0 -3
- 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 +0 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +0 -33
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +0 -1
- 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 +6 -156
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +3 -8
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +1 -77
- data/app/pb_kits/playbook/pb_dropdown/index.js +13 -31
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_alignment.jsx +1 -2
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_default.jsx +1 -2
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_orientation.jsx +1 -2
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_size.jsx +1 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +1 -4
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +1 -3
- 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_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 +2 -1
- 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_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 +2 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +1 -3
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +1 -2
- 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 +1 -2
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +1 -2
- 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_inner_sizes.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +1 -2
- 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 +1 -3
- 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 +1 -2
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +1 -3
- 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_legend_position.html.erb +1 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +1 -4
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.scss +262 -384
- data/app/pb_kits/playbook/pb_progress_step/docs/_description.md +5 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.html.erb +1 -4
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.jsx +3 -14
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.html.erb +7 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_progress_step/progress_step.test.js +0 -41
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +1 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +61 -8
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default_rails.md +7 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +10 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline_rails.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +19 -11
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +5 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky_rails.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +16 -7
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +1 -3
- data/app/pb_kits/playbook/pb_table/_table.tsx +26 -28
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +0 -49
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +1 -4
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -4
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +1 -2
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +1 -1
- data/app/pb_kits/playbook/utilities/_truncate.scss +0 -2
- data/app/pb_kits/playbook/utilities/globalProps.ts +8 -26
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +0 -18
- data/dist/chunks/_line_graph-eQNOB_GQ.js +1 -0
- data/dist/chunks/_typeahead-vbfetkuE.js +24 -0
- data/dist/chunks/_weekday_stacked-CvJHyUq6.js +37 -0
- data/dist/chunks/componentRegistry-DzmmLR2x.js +1 -0
- data/dist/chunks/lib-BCrK6CFU.js +29 -0
- data/dist/chunks/pb_form_validation-Cj4vdjWI.js +1 -0
- data/dist/chunks/vendor.js +1 -37
- data/dist/playbook-doc.js +1 -0
- 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 +13 -36
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.html.erb +0 -9
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.jsx +0 -24
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_rails.md +0 -1
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_react.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +0 -1
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +0 -14
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +0 -1
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +0 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +0 -22
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +0 -180
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +0 -20
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.md +0 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.md +0 -11
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.md +0 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.md +0 -1
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.md +0 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.html.erb +0 -14
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.jsx +0 -29
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.md +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.jsx +0 -31
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.md +0 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.md +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.md +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.md +0 -1
- data/dist/chunks/_typeahead-DUmTKJUc.js +0 -6
- data/dist/chunks/lib-CgpqUb6l.js +0 -29
|
@@ -16,7 +16,6 @@ module Playbook
|
|
|
16
16
|
prop :dark, type: Playbook::Props::Boolean, default: false
|
|
17
17
|
prop :show_icon, type: Playbook::Props::Boolean, default: false
|
|
18
18
|
prop :show_day_of_week, type: Playbook::Props::Boolean, default: false
|
|
19
|
-
prop :show_current_year, type: Playbook::Props::Boolean, default: false
|
|
20
19
|
|
|
21
20
|
def classname
|
|
22
21
|
generate_classname("pb_date_time_kit", align)
|
|
@@ -1,16 +1,14 @@
|
|
|
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
|
|
8
7
|
|
|
9
8
|
react:
|
|
10
9
|
- date_time_default: Default
|
|
11
10
|
- date_time_align: Alignment
|
|
12
11
|
- date_time_size: Size
|
|
13
|
-
- date_time_show_current_year: Show Current Year
|
|
14
12
|
|
|
15
13
|
swift:
|
|
16
14
|
- date_time_default_swift: Default
|
|
@@ -1,4 +1,3 @@
|
|
|
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,7 +17,6 @@ type DateTimeStackedProps = {
|
|
|
17
17
|
datetime: Date,
|
|
18
18
|
dark: boolean,
|
|
19
19
|
timeZone?: string,
|
|
20
|
-
showCurrentYear?: boolean,
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
@@ -29,7 +28,6 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
29
28
|
dark,
|
|
30
29
|
htmlOptions = {},
|
|
31
30
|
timeZone = 'America/New_York',
|
|
32
|
-
showCurrentYear = false,
|
|
33
31
|
} = props
|
|
34
32
|
|
|
35
33
|
const classes = buildCss('pb_date_time_stacked_kit', globalProps(props))
|
|
@@ -48,7 +46,6 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
48
46
|
bold
|
|
49
47
|
dark={dark}
|
|
50
48
|
date={date || datetime}
|
|
51
|
-
showCurrentYear={showCurrentYear}
|
|
52
49
|
/>
|
|
53
50
|
</FlexItem>
|
|
54
51
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
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 }) %>
|
|
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,36 +41,3 @@ 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
|
-
})
|
|
@@ -2,11 +2,9 @@ examples:
|
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
4
|
- date_time_stacked_default: Default
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
7
6
|
react:
|
|
8
7
|
- date_time_stacked_default: Default
|
|
9
|
-
- date_time_stacked_show_current_year: Show Current Year
|
|
10
8
|
|
|
11
9
|
swift:
|
|
12
10
|
- 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
|
+
<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
|
+
</form>
|
|
17
17
|
<% end %>
|
|
@@ -39,59 +39,6 @@ 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
|
-
|
|
95
42
|
default:
|
|
96
43
|
return state;
|
|
97
44
|
}
|
|
@@ -114,9 +61,7 @@ export const DraggableProvider = ({
|
|
|
114
61
|
onDrop,
|
|
115
62
|
onDragOver,
|
|
116
63
|
dropZone = { type: 'ghost', color: 'neutral', direction: 'vertical' },
|
|
117
|
-
providerId = 'default', // fallback provided for backward compatibility
|
|
118
|
-
// Opt-in flag for cross-container preview
|
|
119
|
-
enableCrossContainerPreview = false,
|
|
64
|
+
providerId = 'default', // fallback provided for backward compatibility, so this does not become a required prop
|
|
120
65
|
}: DraggableProviderType) => {
|
|
121
66
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
122
67
|
|
|
@@ -158,74 +103,17 @@ export const DraggableProvider = ({
|
|
|
158
103
|
if (state.dragData.originId !== providerId) return; // Ignore drag events from other providers
|
|
159
104
|
|
|
160
105
|
if (state.dragData.id !== id) {
|
|
161
|
-
|
|
162
|
-
|
|
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}});
|
|
106
|
+
dispatch({ type: 'REORDER_ITEMS', payload: { dragId: state.dragData.id, targetId: id } });
|
|
107
|
+
dispatch({ type: 'SET_DRAG_DATA', payload: { id: state.dragData.id, initialGroup: container, originId: providerId } });
|
|
197
108
|
}
|
|
198
109
|
if (onDragEnter) onDragEnter(id, container);
|
|
199
110
|
};
|
|
200
111
|
|
|
201
112
|
const handleDragEnd = () => {
|
|
202
|
-
const draggedItemId = state.dragData.id;
|
|
203
|
-
const originalContainer = state.dragData.initialGroup;
|
|
204
|
-
|
|
205
113
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
|
206
114
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
|
207
115
|
dispatch({ type: 'SET_DRAG_DATA', payload: { id: "", initialGroup: "", originId: "" } });
|
|
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
|
-
}
|
|
116
|
+
if (onDragEnd) onDragEnd();
|
|
229
117
|
};
|
|
230
118
|
|
|
231
119
|
const changeCategory = (itemId: string, container: string) => {
|
|
@@ -235,34 +123,10 @@ export const DraggableProvider = ({
|
|
|
235
123
|
const handleDrop = (container: string) => {
|
|
236
124
|
if (state.dragData.originId !== providerId) return; // Ignore drop events from other providers
|
|
237
125
|
|
|
238
|
-
const draggedItemId = state.dragData.id;
|
|
239
|
-
const originalContainer = state.dragData.initialGroup;
|
|
240
|
-
|
|
241
126
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
|
242
127
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
|
243
128
|
changeCategory(state.dragData.id, container);
|
|
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
|
-
}
|
|
129
|
+
if (onDrop) onDrop(container);
|
|
266
130
|
};
|
|
267
131
|
|
|
268
132
|
const handleDragOver = (e: Event, container: string) => {
|
|
@@ -270,20 +134,6 @@ export const DraggableProvider = ({
|
|
|
270
134
|
|
|
271
135
|
e.preventDefault();
|
|
272
136
|
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
|
-
|
|
287
137
|
if (onDragOver) onDragOver(e, container);
|
|
288
138
|
};
|
|
289
139
|
|
|
@@ -307,4 +157,4 @@ export const DraggableProvider = ({
|
|
|
307
157
|
return (
|
|
308
158
|
<DragContext.Provider value={contextValue}>{children}</DragContext.Provider>
|
|
309
159
|
);
|
|
310
|
-
};
|
|
160
|
+
};
|
|
@@ -18,12 +18,8 @@ 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 }
|
|
22
21
|
| { type: 'CHANGE_CATEGORY'; payload: { itemId: string; container: 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 } };
|
|
22
|
+
| { type: 'REORDER_ITEMS'; payload: { dragId: string; targetId: string } };
|
|
27
23
|
|
|
28
24
|
export interface DropZoneConfig {
|
|
29
25
|
type?: 'ghost' | 'outline' | 'shadow' | 'line';
|
|
@@ -37,10 +33,9 @@ export type ActionType =
|
|
|
37
33
|
onReorder: (items: ItemType[]) => void;
|
|
38
34
|
onDragStart?: (id: string, container: string) => void;
|
|
39
35
|
onDragEnter?: (id: string, container: string) => void;
|
|
40
|
-
onDragEnd?: (
|
|
41
|
-
onDrop?: (
|
|
36
|
+
onDragEnd?: () => void;
|
|
37
|
+
onDrop?: (container: string) => void;
|
|
42
38
|
onDragOver?: (e: Event, container: string) => void;
|
|
43
39
|
dropZone?: DropZoneConfig | string; // Can accept string for backward compatibility
|
|
44
40
|
providerId?: string;
|
|
45
|
-
enableCrossContainerPreview?: boolean;
|
|
46
41
|
}
|
|
@@ -5,12 +5,11 @@ 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
|
|
8
9
|
- draggable_drop_zones: Draggable Drop Zones
|
|
9
10
|
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
|
10
11
|
- draggable_drop_zones_line: Draggable Drop Zones Line
|
|
11
12
|
- 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
|
|
14
13
|
|
|
15
14
|
rails:
|
|
16
15
|
- draggable_default: Default
|
|
@@ -18,8 +17,8 @@ examples:
|
|
|
18
17
|
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
|
19
18
|
- draggable_with_cards: Draggable with Cards
|
|
20
19
|
- 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,5 +7,4 @@ 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'
|
|
11
|
-
export { default as DraggableMultipleContainersDropzone } from './_draggable_multiple_containers_dropzone.jsx'
|
|
10
|
+
export { default as DraggableEventListeners } from './_draggable_event_listeners.jsx'
|
|
@@ -255,80 +255,4 @@ test("line dropZone with horizontal direction applies 'line_horizontal' class to
|
|
|
255
255
|
const container = kit.querySelector(".pb_draggable_container");
|
|
256
256
|
|
|
257
257
|
expect(container).toHaveClass("line_horizontal");
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
// Cross-container drag tests
|
|
261
|
-
const multiContainerData = [
|
|
262
|
-
{ id: "1", container: "To Do", text: "Task 1" },
|
|
263
|
-
{ id: "2", container: "To Do", text: "Task 2" },
|
|
264
|
-
{ id: "3", container: "In Progress", text: "Task 3" },
|
|
265
|
-
{ id: "4", container: "Done", text: "Task 4" },
|
|
266
|
-
];
|
|
267
|
-
|
|
268
|
-
const containers = ["To Do", "In Progress", "Done"];
|
|
269
|
-
|
|
270
|
-
const DraggableMultipleContainers = () => {
|
|
271
|
-
const [initialState, setInitialState] = useState(multiContainerData);
|
|
272
|
-
|
|
273
|
-
return (
|
|
274
|
-
<div data-testid={testId}>
|
|
275
|
-
<DraggableProvider
|
|
276
|
-
dropZone={{ type: "outline" }}
|
|
277
|
-
initialItems={multiContainerData}
|
|
278
|
-
onReorder={(items) => setInitialState(items)}
|
|
279
|
-
>
|
|
280
|
-
{containers.map((container) => (
|
|
281
|
-
<Draggable.Container
|
|
282
|
-
container={container}
|
|
283
|
-
data={{testid:`container-${container}`}}
|
|
284
|
-
key={container}
|
|
285
|
-
>
|
|
286
|
-
{initialState
|
|
287
|
-
.filter((item) => item.container === container)
|
|
288
|
-
.map(({ id, text }) => (
|
|
289
|
-
<Draggable.Item
|
|
290
|
-
container={container}
|
|
291
|
-
data-testid={`item-${id}`}
|
|
292
|
-
dragId={id}
|
|
293
|
-
key={id}
|
|
294
|
-
>
|
|
295
|
-
{text}
|
|
296
|
-
</Draggable.Item>
|
|
297
|
-
))}
|
|
298
|
-
</Draggable.Container>
|
|
299
|
-
))}
|
|
300
|
-
</DraggableProvider>
|
|
301
|
-
</div>
|
|
302
|
-
);
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
test("renders multiple containers with correct items", () => {
|
|
306
|
-
render(<DraggableMultipleContainers />);
|
|
307
|
-
|
|
308
|
-
const kit = screen.getByTestId(testId);
|
|
309
|
-
expect(kit).toBeInTheDocument();
|
|
310
|
-
|
|
311
|
-
containers.forEach((container) => {
|
|
312
|
-
const containerEl = kit.querySelector(`[data-testid="container-${container}"]`);
|
|
313
|
-
expect(containerEl).toBeInTheDocument();
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// Check items are in correct containers
|
|
317
|
-
expect(screen.getByText("Task 1")).toBeInTheDocument();
|
|
318
|
-
expect(screen.getByText("Task 2")).toBeInTheDocument();
|
|
319
|
-
expect(screen.getByText("Task 3")).toBeInTheDocument();
|
|
320
|
-
expect(screen.getByText("Task 4")).toBeInTheDocument();
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
test("items have correct container association", () => {
|
|
324
|
-
const { container } = render(<DraggableMultipleContainers />);
|
|
325
|
-
|
|
326
|
-
// items rendered within their respective containers
|
|
327
|
-
const todoContainer = container.querySelector('[data-testid="container-To Do"]');
|
|
328
|
-
const inProgressContainer = container.querySelector('[data-testid="container-In Progress"]');
|
|
329
|
-
const doneContainer = container.querySelector('[data-testid="container-Done"]');
|
|
330
|
-
|
|
331
|
-
expect(todoContainer.querySelectorAll('.pb_draggable_item')).toHaveLength(2);
|
|
332
|
-
expect(inProgressContainer.querySelectorAll('.pb_draggable_item')).toHaveLength(1);
|
|
333
|
-
expect(doneContainer.querySelectorAll('.pb_draggable_item')).toHaveLength(1);
|
|
334
|
-
})
|
|
258
|
+
});
|
|
@@ -33,8 +33,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
33
33
|
this.formPillProps = this.element.dataset.formPillProps
|
|
34
34
|
? JSON.parse(this.element.dataset.formPillProps)
|
|
35
35
|
: {};
|
|
36
|
-
const baseInput = this.element.querySelector(DROPDOWN_INPUT);
|
|
37
|
-
this.wasOriginallyRequired = baseInput && baseInput.hasAttribute("required");
|
|
38
36
|
this.setDefaultValue();
|
|
39
37
|
this.bindEventListeners();
|
|
40
38
|
this.bindSearchInput();
|
|
@@ -358,6 +356,17 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
358
356
|
}
|
|
359
357
|
|
|
360
358
|
clearFormValidation(input) {
|
|
359
|
+
if (input.checkValidity()) {
|
|
360
|
+
const dropdownWrapperElement = input.closest(".dropdown_wrapper");
|
|
361
|
+
dropdownWrapperElement.classList.remove("error");
|
|
362
|
+
|
|
363
|
+
const errorLabelElement = dropdownWrapperElement.querySelector(
|
|
364
|
+
".pb_body_kit_negative"
|
|
365
|
+
);
|
|
366
|
+
if (errorLabelElement) {
|
|
367
|
+
errorLabelElement.remove();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
361
370
|
if (this.isMultiSelect) {
|
|
362
371
|
if (this.selectedOptions.size > 0) {
|
|
363
372
|
const dropdownWrapperElement = input.closest(".dropdown_wrapper");
|
|
@@ -368,19 +377,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
368
377
|
if (errorLabelElement) {
|
|
369
378
|
errorLabelElement.remove();
|
|
370
379
|
}
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
if (input.checkValidity()) {
|
|
376
|
-
const dropdownWrapperElement = input.closest(".dropdown_wrapper");
|
|
377
|
-
dropdownWrapperElement.classList.remove("error");
|
|
378
|
-
|
|
379
|
-
const errorLabelElement = dropdownWrapperElement.querySelector(
|
|
380
|
-
".pb_body_kit_negative"
|
|
381
|
-
);
|
|
382
|
-
if (errorLabelElement) {
|
|
383
|
-
errorLabelElement.remove();
|
|
384
380
|
}
|
|
385
381
|
}
|
|
386
382
|
}
|
|
@@ -589,9 +585,7 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
589
585
|
// for multi_select, for each selectedOption, create a hidden input
|
|
590
586
|
const name = baseInput.getAttribute("name");
|
|
591
587
|
this.selectedOptions.forEach((raw) => {
|
|
592
|
-
const
|
|
593
|
-
// Use id if available, otherwise fall back to value
|
|
594
|
-
const id = optionData.id || optionData.value;
|
|
588
|
+
const id = JSON.parse(raw).id;
|
|
595
589
|
const inp = document.createElement("input");
|
|
596
590
|
inp.type = "hidden";
|
|
597
591
|
inp.name = name;
|
|
@@ -599,19 +593,7 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
599
593
|
inp.dataset.generated = "true";
|
|
600
594
|
baseInput.insertAdjacentElement("afterend", inp);
|
|
601
595
|
});
|
|
602
|
-
|
|
603
|
-
// For multi-select, remove required from base input when there are selections
|
|
604
|
-
// The generated inputs handle the form submission with actual values
|
|
605
|
-
// Restore required attribute when there are no selections (if it was originally required)
|
|
606
|
-
if (this.selectedOptions.size > 0) {
|
|
607
|
-
baseInput.value = "";
|
|
608
|
-
baseInput.removeAttribute("required");
|
|
609
|
-
} else {
|
|
610
|
-
baseInput.value = "";
|
|
611
|
-
if (this.wasOriginallyRequired) {
|
|
612
|
-
baseInput.setAttribute("required", "");
|
|
613
|
-
}
|
|
614
|
-
}
|
|
596
|
+
baseInput.value = "";
|
|
615
597
|
}
|
|
616
598
|
|
|
617
599
|
handleBackspaceClear() {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import Card from '
|
|
3
|
-
import Caption from '../../pb_caption/_caption'
|
|
4
|
-
import FormPill from '../_form_pill'
|
|
5
|
-
import Typeahead from '../../pb_typeahead/_typeahead'
|
|
2
|
+
import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
|
|
6
3
|
|
|
7
4
|
const names = [
|
|
8
5
|
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. Once 'highcharts' and 'highcharts-react-official are installed into your repo, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
|
|
1
|
+
This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo. Once done, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
|
|
4
2
|
|
|
5
3
|
See the [highcharts API docs](https://api.highcharts.com/highcharts/) for a comprehensive look at what is possible.
|