playbook_ui 14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 → 14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_card/docs/_card_light.md +1 -1
- data/app/pb_kits/playbook/pb_date/_date.scss +0 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +1 -17
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +175 -88
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +47 -79
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +16 -20
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +1 -43
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +2 -6
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +3 -5
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_timeline/timeline.rb +1 -11
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +4 -4
- data/app/pb_kits/playbook/utilities/_hover.scss +27 -40
- data/app/pb_kits/playbook/utilities/globalProps.ts +3 -5
- data/dist/chunks/_typeahead-CFuWkfWK.js +22 -0
- data/dist/chunks/_weekday_stacked-OvN7ix-I.js +45 -0
- data/dist/chunks/{lib-BC6ESsxG.js → lib-D-mTv-kp.js} +1 -1
- data/dist/chunks/{pb_form_validation-B_Z9rEbg.js → pb_form_validation-BkWGwJsl.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +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/hover.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -25
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.html.erb +0 -42
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.jsx +0 -44
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.html.erb +0 -26
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +0 -38
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_draggable/draggable.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +0 -15
- data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +0 -7
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/index.js +0 -125
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +0 -94
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +0 -180
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +0 -1
- data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +0 -79
- data/dist/chunks/_typeahead-CEqbLlRy.js +0 -22
- data/dist/chunks/_weekday_stacked-BiF9GqI1.js +0 -45
data/lib/playbook/hover.rb
CHANGED
@@ -50,7 +50,7 @@ module Playbook
|
|
50
50
|
if responsive
|
51
51
|
value.each do |key, val|
|
52
52
|
if %i[background color].include?(key)
|
53
|
-
css += "#{prefix}_#{key}
|
53
|
+
css += "#{prefix}_#{key}_#{val} " if hover_attributes.include?(key.to_s)
|
54
54
|
elsif hover_attributes.include?(key.to_s) && send("hover_#{key}_values").include?(val.to_s)
|
55
55
|
css += "#{prefix}_#{key}_#{val} "
|
56
56
|
end
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.7.0.pre.alpha.
|
4
|
+
version: 14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-11-
|
12
|
+
date: 2024-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -881,9 +881,6 @@ files:
|
|
881
881
|
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.html.erb
|
882
882
|
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.jsx
|
883
883
|
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.md
|
884
|
-
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.html.erb
|
885
|
-
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.jsx
|
886
|
-
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.md
|
887
884
|
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.html.erb
|
888
885
|
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md
|
889
886
|
- app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.html.erb
|
@@ -1101,29 +1098,17 @@ files:
|
|
1101
1098
|
- app/pb_kits/playbook/pb_draggable/context/types.ts
|
1102
1099
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx
|
1103
1100
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md
|
1104
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.html.erb
|
1105
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.md
|
1106
1101
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx
|
1107
1102
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.md
|
1108
1103
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx
|
1109
1104
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md
|
1110
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb
|
1111
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md
|
1112
1105
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx
|
1113
1106
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md
|
1114
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb
|
1115
1107
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
|
1116
1108
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md
|
1117
1109
|
- app/pb_kits/playbook/pb_draggable/docs/example.yml
|
1118
1110
|
- app/pb_kits/playbook/pb_draggable/docs/index.js
|
1119
|
-
- app/pb_kits/playbook/pb_draggable/draggable.html.erb
|
1120
|
-
- app/pb_kits/playbook/pb_draggable/draggable.rb
|
1121
1111
|
- app/pb_kits/playbook/pb_draggable/draggable.test.jsx
|
1122
|
-
- app/pb_kits/playbook/pb_draggable/draggable_container.html.erb
|
1123
|
-
- app/pb_kits/playbook/pb_draggable/draggable_container.rb
|
1124
|
-
- app/pb_kits/playbook/pb_draggable/draggable_item.html.erb
|
1125
|
-
- app/pb_kits/playbook/pb_draggable/draggable_item.rb
|
1126
|
-
- app/pb_kits/playbook/pb_draggable/index.js
|
1127
1112
|
- app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx
|
1128
1113
|
- app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx
|
1129
1114
|
- app/pb_kits/playbook/pb_drawer/_close_icon.tsx
|
@@ -2785,9 +2770,6 @@ files:
|
|
2785
2770
|
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.html.erb
|
2786
2771
|
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.jsx
|
2787
2772
|
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md
|
2788
|
-
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb
|
2789
|
-
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx
|
2790
|
-
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md
|
2791
2773
|
- app/pb_kits/playbook/pb_timeline/docs/example.yml
|
2792
2774
|
- app/pb_kits/playbook/pb_timeline/docs/index.js
|
2793
2775
|
- app/pb_kits/playbook/pb_timeline/item.html.erb
|
@@ -3163,18 +3145,17 @@ files:
|
|
3163
3145
|
- app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js
|
3164
3146
|
- app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js
|
3165
3147
|
- app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js
|
3166
|
-
- app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
|
3167
3148
|
- app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js
|
3168
3149
|
- app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js
|
3169
3150
|
- app/pb_kits/playbook/utilities/test/globalProps/order.test.js
|
3170
3151
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
3171
3152
|
- app/pb_kits/playbook/utilities/text.ts
|
3172
3153
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
3173
|
-
- dist/chunks/_typeahead-
|
3174
|
-
- dist/chunks/_weekday_stacked-
|
3154
|
+
- dist/chunks/_typeahead-CFuWkfWK.js
|
3155
|
+
- dist/chunks/_weekday_stacked-OvN7ix-I.js
|
3175
3156
|
- dist/chunks/lazysizes-B7xYodB-.js
|
3176
|
-
- dist/chunks/lib-
|
3177
|
-
- dist/chunks/pb_form_validation-
|
3157
|
+
- dist/chunks/lib-D-mTv-kp.js
|
3158
|
+
- dist/chunks/pb_form_validation-BkWGwJsl.js
|
3178
3159
|
- dist/chunks/vendor.js
|
3179
3160
|
- dist/menu.yml
|
3180
3161
|
- dist/playbook-doc.js
|
@@ -1,42 +0,0 @@
|
|
1
|
-
<%= pb_rails("date_picker", props: {
|
2
|
-
allow_input: true,
|
3
|
-
default_date: "This month",
|
4
|
-
end_date_id: "quick-pick-end-date",
|
5
|
-
end_date_name: "quick-pick-end-date",
|
6
|
-
mode: "range",
|
7
|
-
picker_id: "quick-pick-default-date",
|
8
|
-
placeholder: "mm/dd/yyyy to mm/dd/yyyy",
|
9
|
-
selection_type: "quickpick",
|
10
|
-
start_date_id: "quick-pick-start-date",
|
11
|
-
start_date_name: "quick-pick-start-date"
|
12
|
-
}) %>
|
13
|
-
|
14
|
-
<%= pb_rails("date_picker", props: {
|
15
|
-
allow_input: true,
|
16
|
-
custom_quick_pick_dates: {
|
17
|
-
dates: [
|
18
|
-
{
|
19
|
-
label: "Last 15 months",
|
20
|
-
value: {
|
21
|
-
timePeriod: "months",
|
22
|
-
amount: 15,
|
23
|
-
},
|
24
|
-
},
|
25
|
-
{
|
26
|
-
label: "First Week of June 2022",
|
27
|
-
value: ["06/01/2022", "06/07/2022"],
|
28
|
-
},
|
29
|
-
],
|
30
|
-
},
|
31
|
-
default_date: "First Week of June 2022",
|
32
|
-
end_date_id: "quick-pick-end-date",
|
33
|
-
end_date_name: "quick-pick-end-date",
|
34
|
-
label: "Custom Date Picker",
|
35
|
-
mode: "range",
|
36
|
-
picker_id: "custom-quick-pick-default-date",
|
37
|
-
placeholder: "mm/dd/yyyy to mm/dd/yyyy",
|
38
|
-
selection_type: "quickpick",
|
39
|
-
start_date_id: "quick-pick-start-date",
|
40
|
-
start_date_name: "quick-pick-start-date"
|
41
|
-
}) %>
|
42
|
-
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import DatePicker from "../_date_picker"
|
3
|
-
|
4
|
-
const DatePickerQuickPickDefaultDate = (props) => (
|
5
|
-
<>
|
6
|
-
<DatePicker
|
7
|
-
allowInput
|
8
|
-
defaultDate="This month"
|
9
|
-
mode="range"
|
10
|
-
pickerId="quick-pick-default-date"
|
11
|
-
placeholder="mm/dd/yyyy to mm/dd/yyyy"
|
12
|
-
selectionType="quickpick"
|
13
|
-
{...props}
|
14
|
-
/>
|
15
|
-
|
16
|
-
<DatePicker
|
17
|
-
allowInput
|
18
|
-
customQuickPickDates={{
|
19
|
-
dates: [
|
20
|
-
{
|
21
|
-
label: "Last 15 months",
|
22
|
-
value: {
|
23
|
-
timePeriod: "months",
|
24
|
-
amount: 15,
|
25
|
-
},
|
26
|
-
},
|
27
|
-
{
|
28
|
-
label: "First Week of June 2022",
|
29
|
-
value: ["06/01/2022", "06/07/2022"],
|
30
|
-
},
|
31
|
-
],
|
32
|
-
}}
|
33
|
-
defaultDate="First Week of June 2022"
|
34
|
-
label="Custom Date Picker"
|
35
|
-
mode="range"
|
36
|
-
pickerId="custom-quick-pick-default-date"
|
37
|
-
placeholder="mm/dd/yyyy to mm/dd/yyyy"
|
38
|
-
selectionType="quickpick"
|
39
|
-
{...props}
|
40
|
-
/>
|
41
|
-
</>
|
42
|
-
)
|
43
|
-
|
44
|
-
export default DatePickerQuickPickDefaultDate
|
@@ -1 +0,0 @@
|
|
1
|
-
To set a default value using Quick Pick, use the `defaultDate` or `default_date` prop. This prop should match one of the labels displayed in the UI of the dropdown menu.
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<% initial_items = [
|
2
|
-
{
|
3
|
-
id: "1",
|
4
|
-
url: "https://unsplash.it/500/400/?image=633",
|
5
|
-
},
|
6
|
-
{
|
7
|
-
id: "2",
|
8
|
-
url: "https://unsplash.it/500/400/?image=634",
|
9
|
-
},
|
10
|
-
{
|
11
|
-
id: "3",
|
12
|
-
url: "https://unsplash.it/500/400/?image=637",
|
13
|
-
},
|
14
|
-
] %>
|
15
|
-
|
16
|
-
<%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
|
17
|
-
<%= pb_rails("draggable/draggable_container") do %>
|
18
|
-
<%= pb_rails("flex") do %>
|
19
|
-
<% initial_items.each do |item| %>
|
20
|
-
<%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
|
21
|
-
<%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url], margin: "xs" }) %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
<% end %>
|
25
|
-
<% end %>
|
26
|
-
<% end %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
The `draggable` kit gives you a full subcomponent structure that allows it to be used with almost any kit.
|
2
|
-
|
3
|
-
`initial_items` is a REQUIRED prop, which is the array of objects that contains data for the the draggable items.
|
4
|
-
|
5
|
-
`draggable/draggable_container` = This specifies the container within which items can be dropped.
|
6
|
-
|
7
|
-
`draggable/draggable_item` = This specifies the items that can be dragged and dropped. `drag_id` is a REQUIRED prop for draggable_item and must match the id on the items within `initial_items`.
|
@@ -1,38 +0,0 @@
|
|
1
|
-
<% initial_items = [
|
2
|
-
{ id: "21", name: "Joe Black" },
|
3
|
-
{ id: "22", name: "Nancy White" },
|
4
|
-
{ id: "23", name: "Bill Green" },
|
5
|
-
] %>
|
6
|
-
|
7
|
-
<%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
|
8
|
-
<%= pb_rails("draggable/draggable_container") do %>
|
9
|
-
<% initial_items.each do |item| %>
|
10
|
-
<%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
|
11
|
-
<%= pb_rails("card", props: {highlight: {position: "side", color:"primary"}, margin_bottom: "xs", padding: "xs"}) do %>
|
12
|
-
<%= pb_rails("flex", props:{align_items: "stretch", flex_direction:"column"}) do %>
|
13
|
-
<%= pb_rails("flex", props:{gap: "xs"}) do %>
|
14
|
-
<%= pb_rails("title", props: { text: item[:name], tag: "h4", size: 4 }) %>
|
15
|
-
<%= pb_rails("badge", props: {text:"35-12345" ,variant: "primary"}) %>
|
16
|
-
<% end %>
|
17
|
-
<%= pb_rails("caption", props: { size: "xs", text: "8:00A • Township Name • 90210" }) %>
|
18
|
-
<%= pb_rails("flex", props:{gap: "xxs", spacing:"between"}) do %>
|
19
|
-
<%= pb_rails("flex", props:{gap: "xxs"}) do %>
|
20
|
-
<%= pb_rails("caption", props: { size: "xs" , color: "error" }) do %>
|
21
|
-
<%= pb_rails("icon", props: { icon: "house-circle-exclamation", fixed_width: true }) %>
|
22
|
-
<% end %>
|
23
|
-
<%= pb_rails("caption", props: { size: "xs" , color: "success" }) do %>
|
24
|
-
<%= pb_rails("icon", props: { icon: "file-circle-check", fixed_width: true }) %>
|
25
|
-
<% end %>
|
26
|
-
<% end %>
|
27
|
-
<%= pb_rails("flex") do %>
|
28
|
-
<%= pb_rails("badge", props: {text:"Schedule QA" ,variant: "warning", rounded: true}) %>
|
29
|
-
<%= pb_rails("badge", props: {text:"Flex" ,variant: "primary", rounded: true}) %>
|
30
|
-
<%= pb_rails("badge", props: {text:"R99" ,variant: "primary", rounded: true}) %>
|
31
|
-
<% end %>
|
32
|
-
<% end %>
|
33
|
-
<% end %>
|
34
|
-
<% end %>
|
35
|
-
<% end %>
|
36
|
-
<% end %>
|
37
|
-
<% end %>
|
38
|
-
<% end %>
|
File without changes
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<% initial_items = [
|
2
|
-
{ id: "31", name: "Philadelphia" },
|
3
|
-
{ id: "32", name: "New Jersey" },
|
4
|
-
{ id: "33", name: "Maryland" },
|
5
|
-
{ id: "34", name: "Connecticut" },
|
6
|
-
|
7
|
-
] %>
|
8
|
-
|
9
|
-
<%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
|
10
|
-
<%= pb_rails("draggable/draggable_container") do %>
|
11
|
-
<%= pb_rails("list", props: {ordered: false}) do %>
|
12
|
-
<% initial_items.each do |item| %>
|
13
|
-
<%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
|
14
|
-
<%= pb_rails("list/item") do %><%= item[:name] %><% end %>
|
15
|
-
<% end %>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbDraggable
|
5
|
-
class Draggable < ::Playbook::KitBase
|
6
|
-
prop :initial_items, type: Playbook::Props::Array,
|
7
|
-
default: []
|
8
|
-
|
9
|
-
def data
|
10
|
-
Hash(prop(:data)).merge(pb_draggable: true)
|
11
|
-
end
|
12
|
-
|
13
|
-
def classname
|
14
|
-
generate_classname("pb_draggable")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbDraggable
|
5
|
-
class DraggableContainer < ::Playbook::KitBase
|
6
|
-
def data
|
7
|
-
Hash(prop(:data)).merge(pb_draggable_container: true)
|
8
|
-
end
|
9
|
-
|
10
|
-
def classname
|
11
|
-
generate_classname("pb_draggable_container")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbDraggable
|
5
|
-
class DraggableItem < ::Playbook::KitBase
|
6
|
-
prop :drag_id, type: Playbook::Props::String,
|
7
|
-
default: ""
|
8
|
-
|
9
|
-
def data
|
10
|
-
Hash(prop(:data)).merge(pb_draggable_item: true)
|
11
|
-
end
|
12
|
-
|
13
|
-
def classname
|
14
|
-
generate_classname("pb_draggable_item")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element";
|
2
|
-
|
3
|
-
const DRAGGABLE_SELECTOR = "[data-pb-draggable]";
|
4
|
-
const DRAGGABLE_CONTAINER = ".pb_draggable_container";
|
5
|
-
|
6
|
-
export default class PbDraggable extends PbEnhancedElement {
|
7
|
-
static get selector() {
|
8
|
-
return DRAGGABLE_SELECTOR;
|
9
|
-
}
|
10
|
-
|
11
|
-
connect() {
|
12
|
-
this.draggedItem = null;
|
13
|
-
this.draggedItemId = null;
|
14
|
-
document.addEventListener("DOMContentLoaded", () => this.bindEventListeners());
|
15
|
-
}
|
16
|
-
|
17
|
-
bindEventListeners() {
|
18
|
-
// Needed to prevent images within draggable items from being independently draggable
|
19
|
-
// Needed if using Image kit in draggable items
|
20
|
-
this.element.querySelectorAll(".pb_draggable_item img").forEach(img => {
|
21
|
-
img.setAttribute("draggable", "false");
|
22
|
-
});
|
23
|
-
|
24
|
-
this.element.querySelectorAll(".pb_draggable_item").forEach(item => {
|
25
|
-
item.addEventListener("dragstart", this.handleDragStart.bind(this));
|
26
|
-
item.addEventListener("dragend", this.handleDragEnd.bind(this));
|
27
|
-
item.addEventListener("dragenter", this.handleDragEnter.bind(this));
|
28
|
-
});
|
29
|
-
|
30
|
-
const container = this.element.querySelector(DRAGGABLE_CONTAINER);
|
31
|
-
if (container) {
|
32
|
-
container.addEventListener("dragover", this.handleDragOver.bind(this));
|
33
|
-
container.addEventListener("drop", this.handleDrop.bind(this));
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
handleDragStart(event) {
|
38
|
-
// Needed to prevent images within draggable items from being independently draggable
|
39
|
-
// Needed if using Image kit in draggable items
|
40
|
-
if (event.target.tagName.toLowerCase() === 'img') {
|
41
|
-
event.preventDefault();
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
|
45
|
-
this.draggedItem = event.target;
|
46
|
-
this.draggedItemId = event.target.id;
|
47
|
-
event.target.classList.add("is_dragging");
|
48
|
-
|
49
|
-
if (event.dataTransfer) {
|
50
|
-
event.dataTransfer.effectAllowed = 'move';
|
51
|
-
event.dataTransfer.setData('text/plain', this.draggedItemId);
|
52
|
-
}
|
53
|
-
|
54
|
-
setTimeout(() => {
|
55
|
-
event.target.style.opacity = '0.5';
|
56
|
-
}, 0);
|
57
|
-
}
|
58
|
-
|
59
|
-
handleDragEnter(event) {
|
60
|
-
if (!this.draggedItem || event.target === this.draggedItem) return;
|
61
|
-
|
62
|
-
const targetItem = event.target.closest('.pb_draggable_item');
|
63
|
-
if (!targetItem) return;
|
64
|
-
|
65
|
-
const container = targetItem.parentNode;
|
66
|
-
const items = Array.from(container.children);
|
67
|
-
const draggedIndex = items.indexOf(this.draggedItem);
|
68
|
-
const targetIndex = items.indexOf(targetItem);
|
69
|
-
|
70
|
-
if (draggedIndex > targetIndex) {
|
71
|
-
container.insertBefore(this.draggedItem, targetItem);
|
72
|
-
} else {
|
73
|
-
container.insertBefore(this.draggedItem, targetItem.nextSibling);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
handleDragOver(event) {
|
78
|
-
event.preventDefault();
|
79
|
-
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
80
|
-
|
81
|
-
if (container) {
|
82
|
-
container.classList.add("active_container");
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
handleDrop(event) {
|
87
|
-
event.preventDefault();
|
88
|
-
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
89
|
-
if (!container || !this.draggedItem) return;
|
90
|
-
|
91
|
-
container.classList.remove("active_container");
|
92
|
-
this.draggedItem.style.opacity = '1';
|
93
|
-
|
94
|
-
// Updated order of items as an array of item IDs
|
95
|
-
const reorderedItems = Array.from(container.children)
|
96
|
-
.filter(item => item.classList.contains("pb_draggable_item"))
|
97
|
-
.map(item => item.id.replace("item_", ""));
|
98
|
-
|
99
|
-
// Store reordered items in a data attribute on the container
|
100
|
-
container.setAttribute("data-reordered-items", JSON.stringify(reorderedItems));
|
101
|
-
|
102
|
-
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
103
|
-
detail: {
|
104
|
-
reorderedItems,
|
105
|
-
containerId: container.id,
|
106
|
-
}
|
107
|
-
});
|
108
|
-
this.element.dispatchEvent(customEvent);
|
109
|
-
|
110
|
-
this.draggedItem = null;
|
111
|
-
this.draggedItemId = null;
|
112
|
-
}
|
113
|
-
|
114
|
-
|
115
|
-
handleDragEnd(event) {
|
116
|
-
event.target.classList.remove("is_dragging");
|
117
|
-
event.target.style.opacity = '1';
|
118
|
-
this.draggedItem = null;
|
119
|
-
this.draggedItemId = null;
|
120
|
-
|
121
|
-
this.element.querySelectorAll(DRAGGABLE_CONTAINER).forEach(container => {
|
122
|
-
container.classList.remove("active_container");
|
123
|
-
});
|
124
|
-
}
|
125
|
-
}
|
@@ -1,94 +0,0 @@
|
|
1
|
-
<%= pb_rails("flex", props: { justify: "evenly" }) do %>
|
2
|
-
<%= pb_rails("flex/flex_item") do %>
|
3
|
-
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "xs"}) do %>
|
4
|
-
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
5
|
-
<%= pb_rails("body", props: {
|
6
|
-
text: "Conversation started",
|
7
|
-
color: "light"
|
8
|
-
}) %>
|
9
|
-
<% end %>
|
10
|
-
<%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
|
11
|
-
<%= pb_rails("body", props: {
|
12
|
-
text: "Trip #12422",
|
13
|
-
color: "light"
|
14
|
-
}) %>
|
15
|
-
<% end %>
|
16
|
-
<%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
|
17
|
-
<%= pb_rails("body", props: {
|
18
|
-
text: "Refund issue #12422",
|
19
|
-
color: "light"
|
20
|
-
}) %>
|
21
|
-
<% end %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
|
25
|
-
<%= pb_rails("flex/flex_item") do %>
|
26
|
-
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "sm"}) do %>
|
27
|
-
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
28
|
-
<%= pb_rails("body", props: {
|
29
|
-
text: "Conversation started",
|
30
|
-
color: "light"
|
31
|
-
}) %>
|
32
|
-
<% end %>
|
33
|
-
<%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
|
34
|
-
<%= pb_rails("body", props: {
|
35
|
-
text: "Trip #12422",
|
36
|
-
color: "light"
|
37
|
-
}) %>
|
38
|
-
<% end %>
|
39
|
-
<%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
|
40
|
-
<%= pb_rails("body", props: {
|
41
|
-
text: "Refund issue #12422",
|
42
|
-
color: "light"
|
43
|
-
}) %>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
46
|
-
<% end %>
|
47
|
-
|
48
|
-
<%= pb_rails("flex/flex_item") do %>
|
49
|
-
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "md"}) do %>
|
50
|
-
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
51
|
-
<%= pb_rails("body", props: {
|
52
|
-
text: "Conversation started",
|
53
|
-
color: "light"
|
54
|
-
}) %>
|
55
|
-
<% end %>
|
56
|
-
<%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
|
57
|
-
<%= pb_rails("body", props: {
|
58
|
-
text: "Trip #12422",
|
59
|
-
color: "light"
|
60
|
-
}) %>
|
61
|
-
<% end %>
|
62
|
-
<%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
|
63
|
-
<%= pb_rails("body", props: {
|
64
|
-
text: "Refund issue #12422",
|
65
|
-
color: "light"
|
66
|
-
}) %>
|
67
|
-
<% end %>
|
68
|
-
<% end %>
|
69
|
-
<% end %>
|
70
|
-
|
71
|
-
<%= pb_rails("flex/flex_item") do %>
|
72
|
-
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "lg"}) do %>
|
73
|
-
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
74
|
-
<%= pb_rails("body", props: {
|
75
|
-
text: "Conversation started",
|
76
|
-
color: "light"
|
77
|
-
}) %>
|
78
|
-
<% end %>
|
79
|
-
<%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted"}) do %>
|
80
|
-
<%= pb_rails("body", props: {
|
81
|
-
text: "Trip #12422",
|
82
|
-
color: "light"
|
83
|
-
}) %>
|
84
|
-
<% end %>
|
85
|
-
<%= pb_rails("timeline/item", props: {icon: "credit-card", icon_color: "red"}) do %>
|
86
|
-
<%= pb_rails("body", props: {
|
87
|
-
text: "Refund issue #12422",
|
88
|
-
color: "light"
|
89
|
-
}) %>
|
90
|
-
<% end %>
|
91
|
-
<% end %>
|
92
|
-
<% end %>
|
93
|
-
<% end %>
|
94
|
-
|