playbook_ui 14.13.0.pre.alpha.play1884progresspill6064 → 14.13.0.pre.rc.0
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/_playbook.scss +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +4 -11
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +10 -71
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +21 -37
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/index.js +6 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +5 -8
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +0 -9
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +7 -11
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +7 -6
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +3 -9
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +2 -6
- data/app/pb_kits/playbook/pb_button/button.rb +1 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +4 -14
- data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +1 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +5 -13
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +5 -2
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +0 -5
- data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +0 -4
- data/app/pb_kits/playbook/pb_draggable/index.js +15 -151
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +6 -1
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +5 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js +5 -7
- data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +6 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +7 -11
- data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +2 -13
- data/app/pb_kits/playbook/pb_icon/icon.html.erb +6 -2
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +2 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +0 -3
- data/app/pb_kits/playbook/pb_layout/body.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/footer.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/header.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/item.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/layout.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +5 -1
- data/app/pb_kits/playbook/pb_legend/legend.html.erb +6 -1
- data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +6 -7
- data/app/pb_kits/playbook/pb_link/_link.tsx +0 -18
- data/app/pb_kits/playbook/pb_link/docs/example.yml +3 -5
- data/app/pb_kits/playbook/pb_link/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_link/link.html.erb +1 -1
- data/app/pb_kits/playbook/pb_link/link.rb +0 -6
- data/app/pb_kits/playbook/pb_link/link.test.jsx +0 -30
- data/app/pb_kits/playbook/pb_message/message.html.erb +6 -1
- data/app/pb_kits/playbook/pb_message/message_mention.html.erb +6 -1
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss +1 -2
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.jsx +0 -7
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tooltip.html.erb +6 -6
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb +9 -6
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx +9 -6
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +0 -26
- data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +0 -25
- data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +0 -25
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +1 -1
- data/app/pb_kits/playbook/pb_text_input/index.js +83 -52
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +27 -45
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +1 -5
- data/app/pb_kits/playbook/pb_user/_user.tsx +0 -3
- data/app/pb_kits/playbook/pb_user/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_user/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -1
- data/app/pb_kits/playbook/pb_user/user.rb +0 -1
- data/app/pb_kits/playbook/pb_user/user.test.js +0 -14
- data/dist/chunks/_typeahead-BWwaAo_0.js +36 -0
- data/dist/chunks/_weekday_stacked-zyBCd1s8.js +45 -0
- data/dist/chunks/{lib-DjpLC8uO.js → lib-kMuhBuU7.js} +1 -1
- data/dist/chunks/{pb_form_validation-S56UaHZl.js → pb_form_validation-DBJ0wZuS.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +0 -6
- 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/version.rb +2 -2
- metadata +7 -43
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ActionBarAnimationHelper.ts +0 -26
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +0 -3
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.scss +0 -4
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +0 -92
- data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +0 -15
- data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +0 -28
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +0 -64
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +0 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +0 -21
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +0 -5
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +0 -45
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md +0 -1
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -8
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_copy_button/index.js +0 -47
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.html.erb +0 -99
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +0 -61
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +0 -58
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +0 -3
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +0 -11
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +0 -22
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +0 -1
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +0 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb +0 -27
- data/app/pb_kits/playbook/pb_link/docs/_link_target.html.erb +0 -15
- data/app/pb_kits/playbook/pb_link/docs/_link_target.jsx +0 -29
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.html.erb +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.jsx +0 -88
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.md +0 -1
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.html.erb +0 -42
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.jsx +0 -59
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.md +0 -2
- data/dist/chunks/_typeahead-btjo1UN5.js +0 -36
- data/dist/chunks/_weekday_stacked-TIh9nTmZ.js +0 -45
- /data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/{_fixed_confirmation_toast_auto_close_react.md → _fixed_confirmation_toast_auto_close.md} +0 -0
@@ -14,7 +14,6 @@ type PbDateProps = {
|
|
14
14
|
alignment?: "left" | "center" | "right";
|
15
15
|
aria?: { [key: string]: string };
|
16
16
|
className?: string;
|
17
|
-
dark?: boolean;
|
18
17
|
data?: { [key: string]: string };
|
19
18
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
20
19
|
id?: string;
|
@@ -30,7 +29,6 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
30
29
|
aria = {},
|
31
30
|
alignment = "left",
|
32
31
|
className,
|
33
|
-
dark = false,
|
34
32
|
data = {},
|
35
33
|
htmlOptions = {},
|
36
34
|
id,
|
@@ -58,7 +56,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
58
56
|
);
|
59
57
|
|
60
58
|
return (
|
61
|
-
<div
|
59
|
+
<div
|
62
60
|
{...ariaProps}
|
63
61
|
{...dataProps}
|
64
62
|
{...htmlProps}
|
@@ -95,9 +93,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
95
93
|
</>
|
96
94
|
: size == "md" || size == "lg"
|
97
95
|
? (
|
98
|
-
<Title
|
99
|
-
dark={dark}
|
100
|
-
size={4}
|
96
|
+
<Title size={4}
|
101
97
|
tag="h4"
|
102
98
|
>
|
103
99
|
{showIcon && (
|
@@ -131,7 +127,6 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
131
127
|
<>
|
132
128
|
{showIcon && (
|
133
129
|
<Caption className="pb_icon_kit_container"
|
134
|
-
dark={dark}
|
135
130
|
tag="span"
|
136
131
|
>
|
137
132
|
<Icon fixedWidth
|
@@ -143,20 +138,15 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
143
138
|
|
144
139
|
{showDayOfWeek && (
|
145
140
|
<>
|
146
|
-
<Caption
|
147
|
-
tag="div">
|
148
|
-
{weekday}
|
149
|
-
</Caption>
|
141
|
+
<Caption tag="div">{weekday}</Caption>
|
150
142
|
<Caption color="light"
|
151
|
-
dark={dark}
|
152
143
|
tag="div"
|
153
144
|
text=" • "
|
154
145
|
/>
|
155
146
|
</>
|
156
147
|
)}
|
157
148
|
|
158
|
-
<Caption
|
159
|
-
tag="span">
|
149
|
+
<Caption tag="span">
|
160
150
|
{month} {day}
|
161
151
|
{currentYear != year && <>{`, ${year}`}</>}
|
162
152
|
</Caption>
|
@@ -18,7 +18,7 @@ const DateDefault = (props) => {
|
|
18
18
|
value={"2012-08-03"}
|
19
19
|
{...props}
|
20
20
|
/>
|
21
|
-
<Caption
|
21
|
+
<Caption>{"(Hyphenated Date)"}</Caption>
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<br />
|
@@ -56,7 +56,6 @@ const DateDefault = (props) => {
|
|
56
56
|
<Title
|
57
57
|
size={4}
|
58
58
|
text={"(Hyphenated Date)"}
|
59
|
-
{...props}
|
60
59
|
/>
|
61
60
|
</div>
|
62
61
|
|
@@ -4,8 +4,7 @@ import { Caption, Date as FormattedDate, Title } from 'playbook-ui'
|
|
4
4
|
const DateUnstyled = (props) => {
|
5
5
|
return (
|
6
6
|
<>
|
7
|
-
<Caption
|
8
|
-
size="xs"
|
7
|
+
<Caption size="xs"
|
9
8
|
text="Basic unstyled example"
|
10
9
|
/>
|
11
10
|
<FormattedDate
|
@@ -16,14 +15,10 @@ const DateUnstyled = (props) => {
|
|
16
15
|
|
17
16
|
<br />
|
18
17
|
|
19
|
-
<Caption
|
20
|
-
|
21
|
-
size="xs"
|
18
|
+
<Caption size="xs"
|
22
19
|
text="Example with wrapping typography kit"
|
23
20
|
/>
|
24
|
-
<Title {
|
25
|
-
size={1}
|
26
|
-
>
|
21
|
+
<Title size={1}>
|
27
22
|
<FormattedDate
|
28
23
|
unstyled
|
29
24
|
value={new Date('25 Dec 1995')}
|
@@ -33,13 +28,10 @@ const DateUnstyled = (props) => {
|
|
33
28
|
|
34
29
|
<br />
|
35
30
|
|
36
|
-
<Caption
|
37
|
-
size="xs"
|
31
|
+
<Caption size="xs"
|
38
32
|
text="Example with icon + subcaption"
|
39
33
|
/>
|
40
|
-
<Caption
|
41
|
-
size="xs"
|
42
|
-
>
|
34
|
+
<Caption size="xs">
|
43
35
|
<FormattedDate
|
44
36
|
showDayOfWeek
|
45
37
|
showIcon
|
@@ -1,15 +1,18 @@
|
|
1
1
|
examples:
|
2
|
+
|
3
|
+
|
2
4
|
react:
|
3
5
|
- draggable_default: Default
|
4
6
|
- draggable_with_list: Draggable with List Kit
|
5
7
|
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
6
8
|
- draggable_with_cards: Draggable with Cards
|
7
9
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
10
|
+
|
8
11
|
rails:
|
9
12
|
- draggable_default_rails: Default
|
10
13
|
- draggable_with_list_rails: Draggable with List Kit
|
11
14
|
- draggable_with_selectable_list_rails: Draggable with SelectableList Kit
|
12
15
|
- draggable_with_cards_rails: Draggable with Cards
|
13
|
-
- draggable_with_table: Draggable with Table
|
14
|
-
- draggable_multiple_containers_rails: Dragging Across Multiple Containers
|
15
16
|
|
17
|
+
|
18
|
+
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= pb_content_tag
|
1
|
+
<%= pb_content_tag do %>
|
2
2
|
<%= content.presence %>
|
3
|
-
<% end %>
|
3
|
+
<% end %>
|
@@ -3,11 +3,6 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbDraggable
|
5
5
|
class DraggableContainer < ::Playbook::KitBase
|
6
|
-
prop :tag, type: Playbook::Props::String,
|
7
|
-
default: "div"
|
8
|
-
prop :container, type: Playbook::Props::String,
|
9
|
-
default: ""
|
10
|
-
|
11
6
|
def data
|
12
7
|
Hash(prop(:data)).merge(pb_draggable_container: true)
|
13
8
|
end
|
@@ -5,10 +5,6 @@ module Playbook
|
|
5
5
|
class DraggableItem < ::Playbook::KitBase
|
6
6
|
prop :drag_id, type: Playbook::Props::String,
|
7
7
|
default: ""
|
8
|
-
prop :tag, type: Playbook::Props::String,
|
9
|
-
default: "div"
|
10
|
-
prop :container, type: Playbook::Props::String,
|
11
|
-
default: ""
|
12
8
|
|
13
9
|
def data
|
14
10
|
Hash(prop(:data)).merge(pb_draggable_item: true)
|
@@ -9,38 +9,12 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
connect() {
|
12
|
-
this.state = {
|
13
|
-
items: [],
|
14
|
-
dragData: { id: "", initialGroup: "" },
|
15
|
-
isDragging: "",
|
16
|
-
activeContainer: ""
|
17
|
-
};
|
18
|
-
|
19
12
|
this.draggedItem = null;
|
20
13
|
this.draggedItemId = null;
|
21
|
-
this.hasMultipleContainers = false;
|
22
|
-
|
23
14
|
document.addEventListener("DOMContentLoaded", () => this.bindEventListeners());
|
24
15
|
}
|
25
16
|
|
26
|
-
setState(newState) {
|
27
|
-
this.state = { ...this.state, ...newState };
|
28
|
-
if (newState.items) {
|
29
|
-
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
30
|
-
detail: {
|
31
|
-
reorderedItems: this.state.items,
|
32
|
-
containerId: this.element.querySelector(DRAGGABLE_CONTAINER).id
|
33
|
-
}
|
34
|
-
});
|
35
|
-
this.element.dispatchEvent(customEvent);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
17
|
bindEventListeners() {
|
40
|
-
// Check for multiple containers
|
41
|
-
const containers = this.element.querySelectorAll(DRAGGABLE_CONTAINER);
|
42
|
-
this.hasMultipleContainers = containers.length > 1;
|
43
|
-
|
44
18
|
// Needed to prevent images within draggable items from being independently draggable
|
45
19
|
// Needed if using Image kit in draggable items
|
46
20
|
this.element.querySelectorAll(".pb_draggable_item img").forEach(img => {
|
@@ -53,10 +27,11 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
53
27
|
item.addEventListener("dragenter", this.handleDragEnter.bind(this));
|
54
28
|
});
|
55
29
|
|
56
|
-
|
30
|
+
const container = this.element.querySelector(DRAGGABLE_CONTAINER);
|
31
|
+
if (container) {
|
57
32
|
container.addEventListener("dragover", this.handleDragOver.bind(this));
|
58
33
|
container.addEventListener("drop", this.handleDrop.bind(this));
|
59
|
-
}
|
34
|
+
}
|
60
35
|
}
|
61
36
|
|
62
37
|
handleDragStart(event) {
|
@@ -66,17 +41,11 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
66
41
|
event.preventDefault();
|
67
42
|
return;
|
68
43
|
}
|
69
|
-
|
70
|
-
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
44
|
+
|
71
45
|
this.draggedItem = event.target;
|
72
46
|
this.draggedItemId = event.target.id;
|
73
|
-
|
74
|
-
this.setState({
|
75
|
-
dragData: { id: this.draggedItemId, initialGroup: container.id },
|
76
|
-
isDragging: this.draggedItemId
|
77
|
-
});
|
78
|
-
|
79
47
|
event.target.classList.add("is_dragging");
|
48
|
+
|
80
49
|
if (event.dataTransfer) {
|
81
50
|
event.dataTransfer.effectAllowed = 'move';
|
82
51
|
event.dataTransfer.setData('text/plain', this.draggedItemId);
|
@@ -90,20 +59,11 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
90
59
|
handleDragEnter(event) {
|
91
60
|
if (!this.draggedItem || event.target === this.draggedItem) return;
|
92
61
|
|
93
|
-
if (this.hasMultipleContainers) {
|
94
|
-
this.handleMultiContainerDragEnter(event);
|
95
|
-
} else {
|
96
|
-
this.handleSingleContainerDragEnter(event);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
handleSingleContainerDragEnter(event) {
|
101
62
|
const targetItem = event.target.closest('.pb_draggable_item');
|
102
63
|
if (!targetItem) return;
|
103
64
|
|
104
65
|
const container = targetItem.parentNode;
|
105
66
|
const items = Array.from(container.children);
|
106
|
-
|
107
67
|
const draggedIndex = items.indexOf(this.draggedItem);
|
108
68
|
const targetIndex = items.indexOf(targetItem);
|
109
69
|
|
@@ -114,143 +74,47 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
114
74
|
}
|
115
75
|
}
|
116
76
|
|
117
|
-
handleMultiContainerDragEnter(event) {
|
118
|
-
const targetContainer = event.target.closest(DRAGGABLE_CONTAINER);
|
119
|
-
const targetItem = event.target.closest('.pb_draggable_item');
|
120
|
-
|
121
|
-
if (!targetContainer) return;
|
122
|
-
|
123
|
-
// If we're entering a container directly or there's no target item
|
124
|
-
if (!targetItem) {
|
125
|
-
const lastItem = targetContainer.querySelector('.pb_draggable_item:last-child');
|
126
|
-
if (lastItem) {
|
127
|
-
targetContainer.insertBefore(this.draggedItem, lastItem.nextSibling);
|
128
|
-
} else {
|
129
|
-
targetContainer.appendChild(this.draggedItem);
|
130
|
-
}
|
131
|
-
return;
|
132
|
-
}
|
133
|
-
|
134
|
-
const container = targetItem.parentNode;
|
135
|
-
const items = Array.from(container.children);
|
136
|
-
|
137
|
-
const newItems = [...items].map(item => ({
|
138
|
-
id: item.id,
|
139
|
-
container: container.id
|
140
|
-
}));
|
141
|
-
|
142
|
-
this.setState({ items: newItems });
|
143
|
-
|
144
|
-
const rect = targetItem.getBoundingClientRect();
|
145
|
-
const middleY = rect.top + rect.height / 2;
|
146
|
-
|
147
|
-
if (event.clientY < middleY) {
|
148
|
-
container.insertBefore(this.draggedItem, targetItem);
|
149
|
-
} else {
|
150
|
-
container.insertBefore(this.draggedItem, targetItem.nextSibling);
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
77
|
handleDragOver(event) {
|
155
78
|
event.preventDefault();
|
156
|
-
event.stopPropagation();
|
157
|
-
|
158
|
-
if (this.hasMultipleContainers) {
|
159
|
-
this.handleMultiContainerDragOver(event);
|
160
|
-
} else {
|
161
|
-
this.handleSingleContainerDragOver(event);
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
handleSingleContainerDragOver(event) {
|
166
79
|
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
167
|
-
if (container) {
|
168
|
-
container.classList.add("active_container");
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
handleMultiContainerDragOver(event) {
|
173
|
-
let container;
|
174
|
-
if (event.target.matches(DRAGGABLE_CONTAINER)) {
|
175
|
-
container = event.target;
|
176
|
-
} else {
|
177
|
-
container = event.target.closest(DRAGGABLE_CONTAINER);
|
178
|
-
}
|
179
80
|
|
180
81
|
if (container) {
|
181
|
-
this.setState({ activeContainer: container.id });
|
182
82
|
container.classList.add("active_container");
|
183
|
-
|
184
|
-
// If dragging over empty container or below last item
|
185
|
-
const lastItem = container.querySelector('.pb_draggable_item:last-child');
|
186
|
-
if (!lastItem || (lastItem && event.clientY > lastItem.getBoundingClientRect().bottom)) {
|
187
|
-
if (this.draggedItem && this.draggedItem.parentNode !== container) {
|
188
|
-
container.appendChild(this.draggedItem);
|
189
|
-
}
|
190
|
-
}
|
191
83
|
}
|
192
84
|
}
|
193
85
|
|
194
86
|
handleDrop(event) {
|
195
87
|
event.preventDefault();
|
196
|
-
event.
|
197
|
-
|
198
|
-
let container;
|
199
|
-
if (event.target.matches(DRAGGABLE_CONTAINER)) {
|
200
|
-
container = event.target;
|
201
|
-
} else {
|
202
|
-
container = event.target.closest(DRAGGABLE_CONTAINER);
|
203
|
-
}
|
204
|
-
|
88
|
+
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
205
89
|
if (!container || !this.draggedItem) return;
|
206
|
-
|
90
|
+
|
207
91
|
container.classList.remove("active_container");
|
208
92
|
this.draggedItem.style.opacity = '1';
|
209
|
-
|
210
|
-
// Handle empty containers
|
211
|
-
if (this.hasMultipleContainers && !container.querySelector('.pb_draggable_item')) {
|
212
|
-
container.appendChild(this.draggedItem);
|
213
|
-
}
|
214
|
-
|
93
|
+
|
215
94
|
// Updated order of items as an array of item IDs
|
216
|
-
const reorderedItems = Array.from(
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
container: item.closest(DRAGGABLE_CONTAINER).id
|
221
|
-
}));
|
222
|
-
|
95
|
+
const reorderedItems = Array.from(container.children)
|
96
|
+
.filter(item => item.classList.contains("pb_draggable_item"))
|
97
|
+
.map(item => item.id.replace("item_", ""));
|
98
|
+
|
223
99
|
// Store reordered items in a data attribute on the container
|
224
100
|
container.setAttribute("data-reordered-items", JSON.stringify(reorderedItems));
|
225
|
-
|
101
|
+
|
226
102
|
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
227
103
|
detail: {
|
228
104
|
reorderedItems,
|
229
105
|
containerId: container.id,
|
230
106
|
}
|
231
107
|
});
|
232
|
-
|
233
108
|
this.element.dispatchEvent(customEvent);
|
234
|
-
|
235
|
-
this.setState({
|
236
|
-
items: reorderedItems,
|
237
|
-
isDragging: "",
|
238
|
-
activeContainer: ""
|
239
|
-
});
|
240
|
-
|
109
|
+
|
241
110
|
this.draggedItem = null;
|
242
111
|
this.draggedItemId = null;
|
243
112
|
}
|
113
|
+
|
244
114
|
|
245
115
|
handleDragEnd(event) {
|
246
116
|
event.target.classList.remove("is_dragging");
|
247
117
|
event.target.style.opacity = '1';
|
248
|
-
|
249
|
-
this.setState({
|
250
|
-
isDragging: "",
|
251
|
-
activeContainer: ""
|
252
|
-
});
|
253
|
-
|
254
118
|
this.draggedItem = null;
|
255
119
|
this.draggedItemId = null;
|
256
120
|
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag("div",
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("form_group", props: {cursor: "pointer", full_width: object.full_width}) do %>
|
3
8
|
<label
|
4
9
|
for="upload-<%= object.id %>"
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options) do %>
|
2
6
|
<%= object.wrapper do %>
|
3
7
|
<%= pb_rails("flex", props: { orientation: "row", padding_right: "lg", vertical: "center" }) do %>
|
4
8
|
<% if (object.template != "sort_only") %>
|
@@ -5,7 +5,6 @@ examples:
|
|
5
5
|
- fixed_confirmation_toast_multi_line: Multi Line
|
6
6
|
- fixed_confirmation_toast_close: Click to Close
|
7
7
|
- fixed_confirmation_toast_positions: Click to Show Positions
|
8
|
-
- fixed_confirmation_toast_auto_close: Click to Show Auto Close
|
9
8
|
- fixed_confirmation_toast_children: Children
|
10
9
|
- fixed_confirmation_toast_custom_icon: Custom Icon
|
11
10
|
|
@@ -2,18 +2,16 @@ import PbEnhancedElement from '../pb_enhanced_element'
|
|
2
2
|
|
3
3
|
export default class PbFixedConfirmationToast extends PbEnhancedElement {
|
4
4
|
static get selector() {
|
5
|
-
return '
|
5
|
+
return '.remove_toast'
|
6
6
|
}
|
7
7
|
|
8
8
|
connect() {
|
9
9
|
this.self = this.element
|
10
10
|
this.autoCloseToast(this.self)
|
11
11
|
|
12
|
-
|
13
|
-
this.self
|
14
|
-
|
15
|
-
})
|
16
|
-
}
|
12
|
+
this.self.addEventListener('click', () => {
|
13
|
+
this.removeToast(this.self)
|
14
|
+
})
|
17
15
|
}
|
18
16
|
|
19
17
|
removeToast(elem) {
|
@@ -34,4 +32,4 @@ export default class PbFixedConfirmationToast extends PbEnhancedElement {
|
|
34
32
|
}, autoCloseIntValue)
|
35
33
|
}
|
36
34
|
}
|
37
|
-
}
|
35
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
|
2
2
|
<% if object.name.present? %>
|
3
3
|
<%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xxs" }) %>
|
4
4
|
<% if object.truncate %>
|
@@ -18,7 +18,6 @@ type HomeAddressStreetProps = {
|
|
18
18
|
className?: string,
|
19
19
|
data?: { [key: string]: string },
|
20
20
|
dark?: boolean,
|
21
|
-
preserveCase?: boolean,
|
22
21
|
emphasis: "street" | "city" | "none",
|
23
22
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
24
23
|
homeId: string,
|
@@ -44,7 +43,6 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
44
43
|
htmlOptions = {},
|
45
44
|
homeId,
|
46
45
|
homeUrl,
|
47
|
-
preserveCase = false,
|
48
46
|
target,
|
49
47
|
newWindow,
|
50
48
|
houseStyle,
|
@@ -79,8 +77,6 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
79
77
|
return null
|
80
78
|
}
|
81
79
|
|
82
|
-
const formatStreetAdr = (address: string): string => preserveCase ? address : titleize(address)
|
83
|
-
|
84
80
|
return (
|
85
81
|
<div
|
86
82
|
className={classes(className, dark)}
|
@@ -95,7 +91,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
95
91
|
dark={dark}
|
96
92
|
size={4}
|
97
93
|
>
|
98
|
-
{joinPresent([
|
94
|
+
{joinPresent([titleize(address), houseStyle], ' · ')}
|
99
95
|
</Title>
|
100
96
|
<Title
|
101
97
|
className="pb_home_address_street_address"
|
@@ -105,14 +101,14 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
105
101
|
{titleize(addressCont)}
|
106
102
|
</Title>
|
107
103
|
<Body color="light">
|
108
|
-
{`${titleize(city)}, ${state
|
104
|
+
{`${titleize(city)}, ${state} ${zipcode}`}
|
109
105
|
</Body>
|
110
106
|
</div>
|
111
107
|
}
|
112
108
|
{emphasis == 'city' &&
|
113
109
|
<div>
|
114
110
|
<Body color="light">
|
115
|
-
{joinPresent([
|
111
|
+
{joinPresent([titleize(address), houseStyle], ' · ')}
|
116
112
|
</Body>
|
117
113
|
<Body color="light">{titleize(addressCont)}</Body>
|
118
114
|
<div>
|
@@ -122,7 +118,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
122
118
|
size={4}
|
123
119
|
tag="span"
|
124
120
|
>
|
125
|
-
{`${titleize(city)}, ${state
|
121
|
+
{`${titleize(city)}, ${state}`}
|
126
122
|
</Title>
|
127
123
|
<Body
|
128
124
|
color="light"
|
@@ -136,15 +132,15 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
136
132
|
{emphasis == 'none' &&
|
137
133
|
<div>
|
138
134
|
<Body dark={dark}>
|
139
|
-
{joinPresent([
|
135
|
+
{joinPresent([titleize(address), houseStyle], ' · ')}
|
140
136
|
</Body>
|
141
|
-
<Body dark={dark}>{
|
137
|
+
<Body dark={dark}>{titleize(addressCont)}</Body>
|
142
138
|
<div>
|
143
139
|
<Body
|
144
140
|
color="light"
|
145
141
|
dark={dark}
|
146
142
|
>
|
147
|
-
{`${titleize(city)}, ${state
|
143
|
+
{`${titleize(city)}, ${state} ${zipcode}`}
|
148
144
|
</Body>
|
149
145
|
</div>
|
150
146
|
</div>
|
@@ -5,14 +5,12 @@ examples:
|
|
5
5
|
- home_address_street_emphasis: Emphasis
|
6
6
|
- home_address_street_modified: Modified
|
7
7
|
- home_address_street_link: Link
|
8
|
-
- home_address_street_formatting: Formatting
|
9
8
|
|
10
9
|
react:
|
11
10
|
- home_address_street_default: Default
|
12
11
|
- home_address_street_emphasis: Emphasis
|
13
12
|
- home_address_street_modified: Modified
|
14
13
|
- home_address_street_link: Link
|
15
|
-
- home_address_street_formatting: Formatting
|
16
14
|
|
17
15
|
swift:
|
18
16
|
- home_address_street_default_swift: Default
|
@@ -2,4 +2,3 @@ export { default as HomeAddressStreetDefault } from './_home_address_street_defa
|
|
2
2
|
export { default as HomeAddressStreetEmphasis } from './_home_address_street_emphasis.jsx'
|
3
3
|
export { default as HomeAddressStreetModified } from './_home_address_street_modified.jsx'
|
4
4
|
export { default as HomeAddressStreetLink } from './_home_address_street_link.jsx'
|
5
|
-
export { default as HomeAddressStreetFormatting } from './_home_address_street_formatting.jsx'
|
@@ -18,7 +18,6 @@ module Playbook
|
|
18
18
|
prop :state
|
19
19
|
prop :zipcode
|
20
20
|
prop :territory
|
21
|
-
prop :preserve_case, default: false
|
22
21
|
prop :dark, type: Playbook::Props::Boolean, default: false
|
23
22
|
|
24
23
|
def classname
|
@@ -30,7 +29,7 @@ module Playbook
|
|
30
29
|
end
|
31
30
|
|
32
31
|
def city_state
|
33
|
-
[city&.titleize, state
|
32
|
+
[city&.titleize, state].join(", ")
|
34
33
|
end
|
35
34
|
|
36
35
|
def zip
|
@@ -38,7 +37,7 @@ module Playbook
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def address_house_style
|
41
|
-
[
|
40
|
+
[address&.titleize, house_style].join(separator)
|
42
41
|
end
|
43
42
|
|
44
43
|
def address_house_style2
|
@@ -49,16 +48,6 @@ module Playbook
|
|
49
48
|
house_style ? " \u00b7 " : ""
|
50
49
|
end
|
51
50
|
|
52
|
-
def format_street_address
|
53
|
-
preserve_case ? address : custom_titleize(address)
|
54
|
-
end
|
55
|
-
|
56
|
-
def custom_titleize(str)
|
57
|
-
return "" if str.nil?
|
58
|
-
|
59
|
-
str.split(" ").map(&:capitalize).join(" ")
|
60
|
-
end
|
61
|
-
|
62
51
|
def city_emphasis_props
|
63
52
|
{
|
64
53
|
address_house_style: address_house_style,
|
@@ -5,8 +5,12 @@
|
|
5
5
|
<%= object.icon.html_safe %>
|
6
6
|
</span>
|
7
7
|
<% else %>
|
8
|
-
<%=
|
9
|
-
|
8
|
+
<%= content_tag(:i, nil,
|
9
|
+
id: object.id,
|
10
|
+
data: object.data,
|
11
|
+
class: object.classname,
|
12
|
+
**combined_html_options
|
13
|
+
) %>
|
10
14
|
<%= content_tag(:span, nil,
|
11
15
|
aria: { label: "#{object.icon} icon" }.merge(object.aria),
|
12
16
|
hidden: true
|