playbook_ui 14.16.0.pre.rc.6 → 14.17.0.pre.alpha.PBNTR766tablenestedcollapsiblerowsborderdoubling7192
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/Utilities/types.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +104 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +168 -85
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +19 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
- data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +138 -5
- data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +6 -4
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +91 -24
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +35 -28
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +181 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +99 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.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_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 +9 -6
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +71 -3
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +12 -2
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +65 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +3 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +67 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +67 -0
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.scss +8 -1
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +10 -4
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +49 -24
- data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +4 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_click.jsx +13 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +23 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +28 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +97 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +71 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_multi_level_select/index.js +105 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +10 -0
- data/app/pb_kits/playbook/pb_nav/_nav.scss +5 -0
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +24 -0
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +76 -0
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb +19 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
- data/app/pb_kits/playbook/pb_user/_user.tsx +78 -13
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.html.erb +22 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +40 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_rails.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_react.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/user.html.erb +28 -12
- data/app/pb_kits/playbook/pb_user/user.rb +17 -1
- data/app/pb_kits/playbook/pb_user/user.test.js +182 -1
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
- data/app/pb_kits/playbook/tokens/_colors.scss +1 -4
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/app/pb_kits/playbook/utilities/object.test.js +287 -1
- data/app/pb_kits/playbook/utilities/object.ts +171 -3
- data/app/pb_kits/playbook/utilities/text.ts +1 -1
- data/dist/chunks/_typeahead-HqfDnjRe.js +22 -0
- data/dist/chunks/_weekday_stacked-DVQITtQ9.js +45 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-BvDxpfs-.js → pb_form_validation-BvNy9Bd6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/multi_level_select_field.rb +2 -0
- data/lib/playbook/kit_base.rb +4 -4
- data/lib/playbook/version.rb +2 -2
- metadata +53 -21
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/dist/chunks/_typeahead-CRAPc8k-.js +0 -22
- data/dist/chunks/_weekday_stacked-T0kFfioG.js +0 -45
- data/dist/chunks/lib-BeKPJYlk.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
- /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
@@ -174,6 +174,21 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
174
174
|
yearInput.value = fp.currentYear?.toString()
|
175
175
|
}
|
176
176
|
|
177
|
+
const handleDatePickerChange = (fp: Instance, selectedDates: Date[]) => {
|
178
|
+
const inputEl = fp.input
|
179
|
+
|
180
|
+
if (inputEl) {
|
181
|
+
const inlineDatePickerElem = inputEl.closest('.inline-date-picker')
|
182
|
+
if (inlineDatePickerElem) {
|
183
|
+
if (selectedDates && selectedDates.length > 0) {
|
184
|
+
inlineDatePickerElem.classList.add('show-angle-down-icon')
|
185
|
+
} else {
|
186
|
+
inlineDatePickerElem.classList.remove('show-angle-down-icon')
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
177
192
|
// ===========================================================
|
178
193
|
// | Flatpickr initializer w/ config |
|
179
194
|
// ===========================================================
|
@@ -204,6 +219,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
204
219
|
onClose(selectedDates, dateStr)
|
205
220
|
}],
|
206
221
|
onChange: [(selectedDates, dateStr, fp) => {
|
222
|
+
handleDatePickerChange(fp, selectedDates)
|
207
223
|
yearChangeHook(fp)
|
208
224
|
onChange(dateStr, selectedDates)
|
209
225
|
}],
|
@@ -4,14 +4,3 @@
|
|
4
4
|
inline: true,
|
5
5
|
picker_id: "date-picker-inline"
|
6
6
|
}) %>
|
7
|
-
|
8
|
-
<%= javascript_tag do %>
|
9
|
-
window.addEventListener("DOMContentLoaded", (event) => {
|
10
|
-
const fpInline = document.querySelector("#date-picker-inline")._flatpickr
|
11
|
-
<!-- Display the angle-down icon when a date has been selected -->
|
12
|
-
const showAngleDownHandler = () => {
|
13
|
-
document.querySelector('.inline-date-picker').classList.add('show-angle-down-icon')
|
14
|
-
}
|
15
|
-
fpInline.config.onChange.push(showAngleDownHandler)
|
16
|
-
})
|
17
|
-
<% end %>
|
@@ -3,19 +3,12 @@ import React from 'react'
|
|
3
3
|
import DatePicker from '../_date_picker'
|
4
4
|
|
5
5
|
const DatePickerInline = (props) => {
|
6
|
-
const showAngleDownHandler = (dateSelected) => {
|
7
|
-
if (dateSelected) {
|
8
|
-
document.querySelector('.inline-date-picker').classList.add('show-angle-down-icon')
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
6
|
return (
|
13
7
|
<div>
|
14
8
|
<DatePicker
|
15
9
|
className="inline-date-picker"
|
16
10
|
hideIcon
|
17
11
|
inLine
|
18
|
-
onChange={showAngleDownHandler}
|
19
12
|
pickerId="date-picker-inline"
|
20
13
|
{...props}
|
21
14
|
/>
|
@@ -14,12 +14,12 @@
|
|
14
14
|
opacity: 1;
|
15
15
|
}
|
16
16
|
&:not(:hover) {
|
17
|
-
|
17
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
18
18
|
svg {
|
19
19
|
display: none;
|
20
20
|
}
|
21
21
|
}
|
22
|
-
|
22
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
23
23
|
svg {
|
24
24
|
color: $slate;
|
25
25
|
display: inline-block;
|
@@ -33,12 +33,12 @@
|
|
33
33
|
[class^="pb_text_input_kit"] .text_input_wrapper .flatpickr-wrapper .text_input .placeholder {
|
34
34
|
color: $primary;
|
35
35
|
}
|
36
|
-
|
36
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
37
37
|
svg {
|
38
38
|
display: none;
|
39
39
|
}
|
40
40
|
}
|
41
|
-
|
41
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
42
42
|
svg {
|
43
43
|
display: inline-block;
|
44
44
|
color: $primary;
|
@@ -47,32 +47,34 @@
|
|
47
47
|
}
|
48
48
|
&.show-angle-down-icon {
|
49
49
|
&:not(:hover) {
|
50
|
-
|
50
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
51
51
|
svg {
|
52
52
|
display: inline-block;
|
53
53
|
color: $text_lt_light;
|
54
54
|
}
|
55
55
|
}
|
56
|
-
|
56
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
57
57
|
svg {
|
58
58
|
display: none;
|
59
59
|
}
|
60
60
|
}
|
61
61
|
}
|
62
|
-
|
62
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
63
63
|
svg {
|
64
64
|
display: none;
|
65
65
|
}
|
66
66
|
}
|
67
|
-
|
67
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
68
68
|
svg {
|
69
69
|
display: inline-block;
|
70
70
|
color: $primary;
|
71
71
|
}
|
72
72
|
}
|
73
73
|
}
|
74
|
-
|
75
|
-
|
74
|
+
.date_picker_input.flatpickr-input,
|
75
|
+
.date_picker_input.flatpickr-input .active,
|
76
|
+
.text_input.flatpickr-input,
|
77
|
+
.text_input.flatpickr-input .active {
|
76
78
|
border: none;
|
77
79
|
padding: 5px 5px 5px 10px;
|
78
80
|
background-color: #FFF;
|
@@ -82,8 +84,8 @@
|
|
82
84
|
box-shadow: none;
|
83
85
|
}
|
84
86
|
}
|
85
|
-
|
86
|
-
|
87
|
+
.date-picker-inline-angle-down.cal_icon_wrapper,
|
88
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
87
89
|
height: 33px;
|
88
90
|
border: none;
|
89
91
|
}
|
@@ -96,12 +98,12 @@
|
|
96
98
|
[class^=pb_date_picker_kit].dark {
|
97
99
|
&.inline-date-picker {
|
98
100
|
&:not(:hover) {
|
99
|
-
|
101
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
100
102
|
svg {
|
101
103
|
display: none;
|
102
104
|
}
|
103
105
|
}
|
104
|
-
|
106
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
105
107
|
svg {
|
106
108
|
display: inline-block;
|
107
109
|
color: $white;
|
@@ -115,12 +117,12 @@
|
|
115
117
|
[class^="pb_text_input_kit"] .text_input_wrapper .flatpickr-wrapper .text_input .placeholder {
|
116
118
|
color: $white;
|
117
119
|
}
|
118
|
-
|
120
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
119
121
|
svg {
|
120
122
|
display: none;
|
121
123
|
}
|
122
124
|
}
|
123
|
-
|
125
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
124
126
|
svg {
|
125
127
|
display: inline-block;
|
126
128
|
color: $white;
|
@@ -129,32 +131,34 @@
|
|
129
131
|
}
|
130
132
|
&.show-angle-down-icon {
|
131
133
|
&:not(:hover) {
|
132
|
-
|
134
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
133
135
|
svg {
|
134
136
|
display: inline-block;
|
135
137
|
color: $white;
|
136
138
|
}
|
137
139
|
}
|
138
|
-
|
140
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
139
141
|
svg {
|
140
142
|
display: none;
|
141
143
|
}
|
142
144
|
}
|
143
145
|
}
|
144
|
-
|
146
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
145
147
|
svg {
|
146
148
|
display: none;
|
147
149
|
}
|
148
150
|
}
|
149
|
-
|
151
|
+
.date-picker-inline-angle-down.cal_icon_wrapper {
|
150
152
|
svg {
|
151
153
|
display: inline-block;
|
152
154
|
color: $white;
|
153
155
|
}
|
154
156
|
}
|
155
157
|
}
|
156
|
-
|
157
|
-
|
158
|
+
.date_picker_input.flatpickr-input,
|
159
|
+
.date_picker_input.flatpickr-input .active,
|
160
|
+
.text_input.flatpickr-input,
|
161
|
+
.text_input.flatpickr-input .active {
|
158
162
|
background-color: rgba($white,.10);
|
159
163
|
border: none;
|
160
164
|
padding: 5px 5px 5px 10px;
|
@@ -164,8 +168,8 @@
|
|
164
168
|
box-shadow: none;
|
165
169
|
}
|
166
170
|
}
|
167
|
-
|
168
|
-
|
171
|
+
.date-picker-inline-angle-down.cal_icon_wrapper,
|
172
|
+
.date-picker-inline-icon-plus.cal_icon_wrapper {
|
169
173
|
height: 33px;
|
170
174
|
border: none;
|
171
175
|
}
|
@@ -62,7 +62,7 @@ describe("DateRangeInline Kit", () => {
|
|
62
62
|
)
|
63
63
|
|
64
64
|
const kit = screen.getByTestId(testId)
|
65
|
-
const arrow = kit.querySelector('.
|
65
|
+
const arrow = kit.querySelector('.pb_custom_icon')
|
66
66
|
expect(arrow).toBeInTheDocument()
|
67
67
|
})
|
68
68
|
|
@@ -93,7 +93,7 @@ describe("DateRangeInline Kit", () => {
|
|
93
93
|
)
|
94
94
|
|
95
95
|
const kit = screen.getByTestId(testId)
|
96
|
-
const calendar = kit.querySelector('.
|
96
|
+
const calendar = kit.querySelector('.pb_custom_icon')
|
97
97
|
expect(calendar).toBeInTheDocument()
|
98
98
|
})
|
99
99
|
|
@@ -58,7 +58,7 @@ describe("DateRangeStacked Kit", () => {
|
|
58
58
|
)
|
59
59
|
|
60
60
|
const kit = screen.getByTestId(testId)
|
61
|
-
const arrowicon = kit.querySelector('.
|
61
|
+
const arrowicon = kit.querySelector('.pb_custom_icon')
|
62
62
|
expect(arrowicon).toBeInTheDocument()
|
63
63
|
})
|
64
64
|
|
@@ -1,11 +1,144 @@
|
|
1
1
|
@import "../tokens/colors";
|
2
2
|
@import "../tokens/opacity";
|
3
|
+
@import "../tokens/border_radius";
|
3
4
|
|
4
5
|
.pb_draggable_container {
|
5
|
-
.
|
6
|
-
|
6
|
+
.pb_draggable_item {
|
7
|
+
&:hover {
|
8
|
+
cursor: grab;
|
9
|
+
}
|
10
|
+
|
11
|
+
&.is_dragging {
|
12
|
+
position: relative;
|
13
|
+
|
14
|
+
// Ghost variant - show the item at 50% opacity. Default behavior.
|
15
|
+
&.drop_zone_ghost {
|
16
|
+
opacity: $opacity_4;
|
17
|
+
}
|
18
|
+
|
19
|
+
// Outline variant
|
20
|
+
&.drop_zone_outline {
|
21
|
+
// Create a container for the outline
|
22
|
+
position: relative;
|
23
|
+
|
24
|
+
// Make content invisible
|
25
|
+
& > * {
|
26
|
+
opacity: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
// Add outline
|
30
|
+
&::before {
|
31
|
+
content: '';
|
32
|
+
position: absolute;
|
33
|
+
top: 0;
|
34
|
+
left: 0;
|
35
|
+
width: 100%;
|
36
|
+
height: 100%;
|
37
|
+
border: 2px dashed $neutral;
|
38
|
+
border-radius: $border_radius_sm;
|
39
|
+
box-sizing: border-box;
|
40
|
+
z-index: 10;
|
41
|
+
pointer-events: none;
|
42
|
+
}
|
43
|
+
|
44
|
+
// Apply color variants to the ::before element
|
45
|
+
&.drop_zone_color_primary::before { border-color: $primary; }
|
46
|
+
&.drop_zone_color_purple::before { border-color: $purple; }
|
47
|
+
}
|
48
|
+
|
49
|
+
// Shadow variant
|
50
|
+
&.drop_zone_shadow {
|
51
|
+
// Create a container for the shadow
|
52
|
+
position: relative;
|
53
|
+
|
54
|
+
// Make content invisible
|
55
|
+
& > * {
|
56
|
+
opacity: 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
// Add shadow background
|
60
|
+
&::before {
|
61
|
+
content: '';
|
62
|
+
position: absolute;
|
63
|
+
top: 0;
|
64
|
+
left: 0;
|
65
|
+
width: 100%;
|
66
|
+
height: 100%;
|
67
|
+
background-color: rgba($neutral, $opacity_5);
|
68
|
+
border-radius: $border_radius_sm;
|
69
|
+
z-index: 10;
|
70
|
+
pointer-events: none;
|
71
|
+
}
|
72
|
+
|
73
|
+
// Apply rgba color variants to the ::before element
|
74
|
+
&.drop_zone_color_primary::before { background-color: rgba($primary, $opacity_5); }
|
75
|
+
&.drop_zone_color_purple::before { background-color: rgba($purple, $opacity_5); }
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
// Line default - Vertical orientation (horizontal line for draggable items in vertical layout)
|
80
|
+
&.line_vertical {
|
81
|
+
.pb_draggable_item {
|
82
|
+
position: relative;
|
83
|
+
&.drop_zone_line {
|
84
|
+
// Hide the original content to show the line only (held draggable item should not take up space in drop zone)
|
85
|
+
position: relative;
|
86
|
+
z-index: 2;
|
87
|
+
& > * {
|
88
|
+
opacity: 0;
|
89
|
+
}
|
90
|
+
height: 4px;
|
91
|
+
// Style for horizontal line (default)
|
92
|
+
&::before {
|
93
|
+
content: '';
|
94
|
+
position: absolute;
|
95
|
+
left: 0;
|
96
|
+
top: 0;
|
97
|
+
width: 100%;
|
98
|
+
height: 4px;
|
99
|
+
background-color: $neutral;
|
100
|
+
border-radius: $border_radius_rounded;
|
101
|
+
z-index: 10;
|
102
|
+
pointer-events: none;
|
103
|
+
transform: translateY(-50%);
|
104
|
+
}
|
105
|
+
// Apply color variants to the ::before element
|
106
|
+
&.drop_zone_color_primary::before { background-color: $primary; }
|
107
|
+
&.drop_zone_color_purple::before { background-color: $purple; }
|
108
|
+
}
|
109
|
+
}
|
7
110
|
}
|
8
|
-
|
9
|
-
|
111
|
+
// Line variant - Horizontal orientation (vertical line for draggable items in horizontal layout)
|
112
|
+
&.line_horizontal {
|
113
|
+
.pb_draggable_item {
|
114
|
+
position: relative;
|
115
|
+
&.drop_zone_line {
|
116
|
+
position: relative;
|
117
|
+
z-index: 2;
|
118
|
+
& > * {
|
119
|
+
opacity: 0;
|
120
|
+
}
|
121
|
+
width: 4px;
|
122
|
+
height: auto;
|
123
|
+
// Style for vertical line
|
124
|
+
&::before {
|
125
|
+
content: '';
|
126
|
+
position: absolute;
|
127
|
+
left: 0;
|
128
|
+
top: 0;
|
129
|
+
width: 4px;
|
130
|
+
height: 100%;
|
131
|
+
background-color: $neutral;
|
132
|
+
border-radius: $border_radius_rounded;
|
133
|
+
z-index: 10;
|
134
|
+
pointer-events: none;
|
135
|
+
transform: translateX(-50%);
|
136
|
+
}
|
137
|
+
|
138
|
+
// Apply color variants to the ::before element
|
139
|
+
&.drop_zone_color_primary::before { background-color: $primary; }
|
140
|
+
&.drop_zone_color_purple::before { background-color: $purple; }
|
141
|
+
}
|
142
|
+
}
|
10
143
|
}
|
11
|
-
}
|
144
|
+
}
|
@@ -10,6 +10,8 @@ type DraggableProps = {
|
|
10
10
|
className?: string;
|
11
11
|
children?: React.ReactNode;
|
12
12
|
data?: { [key: string]: string };
|
13
|
+
dropZone?: 'ghost' | 'outline' | 'shadow' | 'line';
|
14
|
+
dropZoneColor?: 'primary' | 'neutral' | 'purple';
|
13
15
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
14
16
|
id?: string;
|
15
17
|
};
|
@@ -24,7 +26,6 @@ const Draggable = (props: DraggableProps) => {
|
|
24
26
|
id,
|
25
27
|
} = props;
|
26
28
|
|
27
|
-
|
28
29
|
const ariaProps = buildAriaProps(aria);
|
29
30
|
const dataProps = buildDataProps(data);
|
30
31
|
const htmlProps = buildHtmlProps(htmlOptions);
|
@@ -36,10 +37,11 @@ const Draggable = (props: DraggableProps) => {
|
|
36
37
|
);
|
37
38
|
|
38
39
|
return (
|
39
|
-
<div
|
40
|
-
{...
|
40
|
+
<div
|
41
|
+
{...ariaProps}
|
42
|
+
{...dataProps}
|
41
43
|
{...htmlProps}
|
42
|
-
className={classes}
|
44
|
+
className={classes}
|
43
45
|
id={id}
|
44
46
|
>
|
45
47
|
{children}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import React, { createContext, useReducer, useContext, useEffect, useMemo } from "react";
|
1
|
+
import React, { createContext, useReducer, useContext, useEffect, useMemo, useRef, useState } from "react";
|
2
2
|
import { InitialStateType, ActionType, DraggableProviderType } from "./types";
|
3
3
|
|
4
4
|
const initialState: InitialStateType = {
|
5
5
|
items: [],
|
6
6
|
dragData: { id: "", initialGroup: "" },
|
7
7
|
isDragging: "",
|
8
|
-
activeContainer: ""
|
8
|
+
activeContainer: "",
|
9
9
|
};
|
10
10
|
|
11
11
|
const reducer = (state: InitialStateType, action: ActionType) => {
|
@@ -31,9 +31,23 @@ const reducer = (state: InitialStateType, action: ActionType) => {
|
|
31
31
|
const { dragId, targetId } = action.payload;
|
32
32
|
const newItems = [...state.items];
|
33
33
|
const draggedItem = newItems.find(item => item.id === dragId);
|
34
|
-
const
|
34
|
+
const targetItem = newItems.find(item => item.id === targetId);
|
35
|
+
|
36
|
+
if (!draggedItem || !targetItem || draggedItem.container !== targetItem.container) {
|
37
|
+
return state;
|
38
|
+
}
|
39
|
+
|
40
|
+
if (dragId === targetId) {
|
41
|
+
return state;
|
42
|
+
}
|
43
|
+
|
44
|
+
const draggedIndex = newItems.findIndex(item => item.id === dragId);
|
35
45
|
const targetIndex = newItems.findIndex(item => item.id === targetId);
|
36
46
|
|
47
|
+
if (draggedIndex === -1 || targetIndex === -1) {
|
48
|
+
return state;
|
49
|
+
}
|
50
|
+
|
37
51
|
newItems.splice(draggedIndex, 1);
|
38
52
|
newItems.splice(targetIndex, 0, draggedItem);
|
39
53
|
|
@@ -48,77 +62,130 @@ const reducer = (state: InitialStateType, action: ActionType) => {
|
|
48
62
|
const DragContext = createContext<any>({});
|
49
63
|
|
50
64
|
export const DraggableContext = () => {
|
51
|
-
|
65
|
+
const context = useContext(DragContext);
|
66
|
+
if (context === undefined) {
|
67
|
+
throw new Error('DraggableContext must be used within a DraggableProvider');
|
68
|
+
}
|
69
|
+
return context;
|
52
70
|
};
|
53
71
|
|
54
|
-
export const DraggableProvider = ({
|
55
|
-
children,
|
56
|
-
initialItems,
|
72
|
+
export const DraggableProvider = ({
|
73
|
+
children,
|
74
|
+
initialItems,
|
57
75
|
onReorder,
|
58
|
-
onDragStart,
|
59
|
-
onDragEnter,
|
60
|
-
onDragEnd,
|
61
|
-
onDrop,
|
62
|
-
onDragOver
|
76
|
+
onDragStart,
|
77
|
+
onDragEnter,
|
78
|
+
onDragEnd,
|
79
|
+
onDrop,
|
80
|
+
onDragOver,
|
81
|
+
dropZone = { type: 'ghost', color: 'neutral', direction: 'vertical' }
|
63
82
|
}: DraggableProviderType) => {
|
64
83
|
const [state, dispatch] = useReducer(reducer, initialState);
|
84
|
+
|
85
|
+
// Store initial items in a ref to use if needed (for consistency when needed in future updates)
|
86
|
+
const initialItemsRef = useRef(initialItems);
|
87
|
+
const [isDragging, setIsDragging] = useState(false);
|
88
|
+
|
89
|
+
// Parse dropZone prop - handle both string format (backward compatibility) and object format
|
90
|
+
let dropZoneType = 'ghost';
|
91
|
+
let dropZoneColor = 'neutral';
|
92
|
+
let dropZoneDirection = 'vertical';
|
93
|
+
|
94
|
+
if (typeof dropZone === 'string') {
|
95
|
+
// Legacy format - just the type is provided as a string
|
96
|
+
dropZoneType = dropZone;
|
97
|
+
} else {
|
98
|
+
// New object format
|
99
|
+
dropZoneType = dropZone.type || 'ghost';
|
100
|
+
// Line default is set to primary. Other types default to neutral.
|
101
|
+
dropZoneColor = dropZone.type === 'line' ? (dropZone.color || 'primary') : (dropZone.color || 'neutral');
|
102
|
+
|
103
|
+
// Only use direction if the type is 'line'
|
104
|
+
if (dropZoneType === 'line') {
|
105
|
+
dropZoneDirection = dropZone.direction || 'vertical';
|
106
|
+
}
|
107
|
+
}
|
65
108
|
|
66
109
|
useEffect(() => {
|
67
110
|
dispatch({ type: 'SET_ITEMS', payload: initialItems });
|
111
|
+
initialItemsRef.current = initialItems;
|
68
112
|
}, [initialItems]);
|
69
113
|
|
70
114
|
useEffect(() => {
|
71
|
-
onReorder
|
72
|
-
|
115
|
+
if (onReorder) {
|
116
|
+
onReorder(state.items);
|
117
|
+
}
|
118
|
+
}, [state.items, onReorder]);
|
73
119
|
|
74
120
|
const handleDragStart = (id: string, container: string) => {
|
75
|
-
|
121
|
+
setIsDragging(true);
|
122
|
+
dispatch({ type: 'SET_DRAG_DATA', payload: { id, initialGroup: container } });
|
76
123
|
dispatch({ type: 'SET_IS_DRAGGING', payload: id });
|
124
|
+
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: container });
|
77
125
|
if (onDragStart) onDragStart(id, container);
|
78
126
|
};
|
79
127
|
|
80
128
|
const handleDragEnter = (id: string, container: string) => {
|
81
|
-
if (
|
82
|
-
|
83
|
-
|
129
|
+
if (!isDragging || container !== state.activeContainer) return;
|
130
|
+
|
131
|
+
if (state.dragData.id === id) return;
|
132
|
+
|
133
|
+
const draggedItem = state.items.find(item => item.id === state.dragData.id);
|
134
|
+
const targetItem = state.items.find(item => item.id === id);
|
135
|
+
|
136
|
+
if (!draggedItem || !targetItem || draggedItem.container !== targetItem.container) {
|
137
|
+
return;
|
84
138
|
}
|
139
|
+
|
140
|
+
dispatch({ type: 'REORDER_ITEMS', payload: { dragId: state.dragData.id, targetId: id } });
|
141
|
+
|
85
142
|
if (onDragEnter) onDragEnter(id, container);
|
86
143
|
};
|
87
144
|
|
88
145
|
const handleDragEnd = () => {
|
146
|
+
setIsDragging(false);
|
89
147
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
90
148
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
91
149
|
if (onDragEnd) onDragEnd();
|
92
150
|
};
|
93
151
|
|
94
|
-
const changeCategory = (itemId: string, container: string) => {
|
95
|
-
dispatch({ type: 'CHANGE_CATEGORY', payload: { itemId, container } });
|
96
|
-
};
|
97
|
-
|
98
152
|
const handleDrop = (container: string) => {
|
153
|
+
const draggedItem = state.items.find(item => item.id === state.dragData.id);
|
154
|
+
|
155
|
+
if (draggedItem && draggedItem.container !== container) {
|
156
|
+
dispatch({ type: 'CHANGE_CATEGORY', payload: { itemId: state.dragData.id, container } });
|
157
|
+
}
|
158
|
+
|
99
159
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
100
160
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
101
|
-
|
161
|
+
|
162
|
+
setIsDragging(false);
|
102
163
|
if (onDrop) onDrop(container);
|
103
164
|
};
|
104
165
|
|
105
166
|
const handleDragOver = (e: Event, container: string) => {
|
106
167
|
e.preventDefault();
|
168
|
+
e.stopPropagation();
|
107
169
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: container });
|
108
170
|
if (onDragOver) onDragOver(e, container);
|
109
171
|
};
|
110
172
|
|
173
|
+
// Include direction in contextValue only if type is 'line'
|
111
174
|
const contextValue = useMemo(() => ({
|
112
175
|
items: state.items,
|
113
176
|
dragData: state.dragData,
|
114
177
|
isDragging: state.isDragging,
|
115
178
|
activeContainer: state.activeContainer,
|
179
|
+
dropZone: dropZoneType,
|
180
|
+
dropZoneColor,
|
181
|
+
// Only include direction when type is 'line'
|
182
|
+
...(dropZoneType === 'line' ? { direction: dropZoneDirection } : {}),
|
116
183
|
handleDragStart,
|
117
184
|
handleDragEnter,
|
118
185
|
handleDragEnd,
|
119
186
|
handleDrop,
|
120
187
|
handleDragOver
|
121
|
-
}), [state]);
|
188
|
+
}), [state, dropZoneType, dropZoneColor, dropZoneDirection, handleDragStart, handleDragEnter, handleDragEnd, handleDrop, handleDragOver]);
|
122
189
|
|
123
190
|
return (
|
124
191
|
<DragContext.Provider value={contextValue}>{children}</DragContext.Provider>
|