playbook_ui 14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448 → 14.7.0.pre.alpha.spacingquickchange4482

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.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_card/docs/_card_light.md +1 -1
  3. data/app/pb_kits/playbook/pb_date/_date.scss +3 -0
  4. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.html.erb +26 -0
  5. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.md +7 -0
  6. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +38 -0
  7. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -0
  8. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +19 -0
  9. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +6 -0
  10. data/app/pb_kits/playbook/pb_draggable/draggable.html.erb +3 -0
  11. data/app/pb_kits/playbook/pb_draggable/draggable.rb +18 -0
  12. data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +3 -0
  13. data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +15 -0
  14. data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +7 -0
  15. data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +18 -0
  16. data/app/pb_kits/playbook/pb_draggable/index.js +125 -0
  17. data/dist/chunks/{_typeahead-CFuWkfWK.js → _typeahead-DhLic2Fe.js} +1 -1
  18. data/dist/chunks/{_weekday_stacked-OvN7ix-I.js → _weekday_stacked-Mx8TYP5I.js} +1 -1
  19. data/dist/chunks/vendor.js +1 -1
  20. data/dist/menu.yml +1 -1
  21. data/dist/playbook-doc.js +1 -1
  22. data/dist/playbook-rails-react-bindings.js +1 -1
  23. data/dist/playbook-rails.js +1 -1
  24. data/dist/playbook.css +1 -1
  25. data/lib/playbook/version.rb +1 -1
  26. metadata +16 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af27bbc68c5af9c78ae2a7ea4b8fec2f9dc7226d41a138c38ada6b3cb5e8b03b
4
- data.tar.gz: 33704917fbbfc70e3ba6f1e5193085237b8ed7fd1c85e776dbbbacd3e3423e90
3
+ metadata.gz: eb4670689518bf254b63ee24477971a5e2c1666b7f452199ad898551857bd62a
4
+ data.tar.gz: d334c3d12c391703d725f9a608c454087732ed3beda3cdca6e5b0bbb000dde49
5
5
  SHA512:
6
- metadata.gz: edebbf85a4e8f8d4b87614225aaf4a0fa565739709ecd8b2b9bbe032e606184e4ef855d34a7e714d8ca5bf0afffa5ed2a5d9ae3f086b001c59c4e0726adaf434
7
- data.tar.gz: 1ea48f5e83772d3f33682e8456fc1250a3fe4eeaf5d75937fe1d608578f52a53968f2c47976267f3ddbe9a0b7a02d7ee5b5e66d66d7a4ca387cc81a94b620e0d
6
+ metadata.gz: '05496ee6555f50603e6fec1676da0f40c0fc2de7d90869409cd06b2de2d7e7a70896d6129480363fc6f908b22e6413406bbe29177a468480daca64af5f0fae5d'
7
+ data.tar.gz: bb61330ca3b6dc7340b0773eb0fcb3c7ad5312413c61d82f0ef6b070e7b8db8c044ec504c6ad67358135c8b16888c7615da8793114c715e4da8482879ccee752
@@ -1 +1 @@
1
- Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">visual guidelines.</a>
1
+ Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">visual guidelines.</a>
@@ -28,5 +28,8 @@
28
28
  [class^=pb_title_kit] {
29
29
  color: $text_dk_default !important;
30
30
  }
31
+ [class^=pb_body_kit], [class^=pb_caption_kit] {
32
+ color: $text_dk_light !important;
33
+ }
31
34
  }
32
35
  }
@@ -0,0 +1,26 @@
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 %>
@@ -0,0 +1,7 @@
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`.
@@ -0,0 +1,38 @@
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 %>
@@ -0,0 +1,19 @@
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 %>
@@ -8,4 +8,10 @@ examples:
8
8
  - draggable_with_cards: Draggable with Cards
9
9
  - draggable_multiple_containers: Dragging Across Multiple Containers
10
10
 
11
+ rails:
12
+ - draggable_default_rails: Default
13
+ - draggable_with_list_rails: Draggable with List Kit
14
+ - draggable_with_cards_rails: Draggable with Cards
15
+
16
+
11
17
 
@@ -0,0 +1,3 @@
1
+ <%= pb_content_tag do %>
2
+ <%= content.presence %>
3
+ <% end %>
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,3 @@
1
+ <%= pb_content_tag do %>
2
+ <%= content.presence %>
3
+ <% end %>
@@ -0,0 +1,15 @@
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
@@ -0,0 +1,7 @@
1
+ <%= pb_content_tag(:div, {
2
+ id: "item_#{object.drag_id}",
3
+ draggable: true
4
+ }) do %>
5
+ <%= content.presence %>
6
+ <% end %>
7
+
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,125 @@
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
+ }