playbook_ui 14.12.0.pre.alpha.PBNTR779railsdraggablecrosscontainer5863 → 14.12.0.pre.alpha.PBNTR8335906
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/Components/TableHeaderCell.tsx +10 -3
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ActionBarAnimationHelper.ts +26 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +6 -6
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +34 -21
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.scss +2 -1
- data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +15 -0
- data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +28 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +5 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +3 -3
- data/app/pb_kits/playbook/pb_copy_button/index.js +47 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +5 -1
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +0 -2
- data/app/pb_kits/playbook/pb_draggable/index.js +16 -88
- 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 -11
- data/app/pb_kits/playbook/pb_link/_link.tsx +18 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_target.html.erb +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_target.jsx +29 -0
- data/app/pb_kits/playbook/pb_link/docs/example.yml +5 -3
- data/app/pb_kits/playbook/pb_link/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_link/link.html.erb +1 -1
- data/app/pb_kits/playbook/pb_link/link.rb +6 -0
- data/app/pb_kits/playbook/pb_link/link.test.jsx +30 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tooltip.html.erb +6 -6
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +45 -27
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +5 -1
- data/dist/chunks/{_typeahead-W0hatdPs.js → _typeahead-CkemExmL.js} +1 -1
- data/dist/chunks/_weekday_stacked-CtSzPEH0.js +45 -0
- data/dist/chunks/{lib-kMuhBuU7.js → lib-DjpLC8uO.js} +1 -1
- data/dist/chunks/{pb_form_validation-DBJ0wZuS.js → pb_form_validation-S56UaHZl.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- 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 +1 -1
- metadata +14 -12
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.html.erb +0 -193
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +0 -1
- 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/dist/chunks/_weekday_stacked-C98LOqgG.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cf75667a14a1b95b256c86ea1eaf7a60a5d7ceaf90cc8c5a46431a53953a38a
|
4
|
+
data.tar.gz: 547d77e91c2b02c0f5f76bbe4b0425b467d2f5a6dedd405b43ab823de2072e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72370309aa5412ddfbf7cbc16c1c21b12d01462dd13124b55cbf72f83e5d73e89168bd3e3736adc3770b9f7973de51c7d1a83aef7ca9cc258985eeba09ef7cfb
|
7
|
+
data.tar.gz: 6fa47007e8a6bf5761db259053351149175fb86b0dc1a2cc3bd5be752bf78acc203d1a9ad63db47f0cdefa24da22819330db2918c535e763ee4905d9313de19f
|
@@ -39,8 +39,15 @@ export const TableHeaderCell = ({
|
|
39
39
|
sortIcon,
|
40
40
|
table
|
41
41
|
}: TableHeaderCellProps) => {
|
42
|
-
const {
|
43
|
-
|
42
|
+
const {
|
43
|
+
sortControl,
|
44
|
+
responsive,
|
45
|
+
selectableRows,
|
46
|
+
hasAnySubRows,
|
47
|
+
showActionsBar,
|
48
|
+
inlineRowLoading,
|
49
|
+
isActionBarVisible,
|
50
|
+
} = useContext(AdvancedTableContext);
|
44
51
|
|
45
52
|
type justifyTypes = "none" | "center" | "start" | "end" | "between" | "around" | "evenly"
|
46
53
|
|
@@ -65,7 +72,7 @@ export const TableHeaderCell = ({
|
|
65
72
|
|
66
73
|
const cellClassName = classnames(
|
67
74
|
"table-header-cells",
|
68
|
-
`${showActionsBar && "header-cells-with-actions"}`,
|
75
|
+
`${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
|
69
76
|
`${isChrome() ? "chrome-styles" : ""}`,
|
70
77
|
`${enableSorting ? "table-header-cells-active" : ""}`,
|
71
78
|
{ "pinned-left": responsive === "scroll" && isPinnedLeft },
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export const showActionBar = (elem: HTMLElement) => {
|
2
|
+
elem.style.display = "block";
|
3
|
+
const height = elem.scrollHeight + "px";
|
4
|
+
elem.style.height = height;
|
5
|
+
elem.classList.add("is-visible");
|
6
|
+
elem.style.overflow = "hidden";
|
7
|
+
|
8
|
+
window.setTimeout(() => {
|
9
|
+
if (elem.classList.contains("is-visible")) {
|
10
|
+
elem.style.height = "";
|
11
|
+
elem.style.overflow = "visible";
|
12
|
+
}
|
13
|
+
}, 300);
|
14
|
+
};
|
15
|
+
|
16
|
+
export const hideActionBar = (elem: HTMLElement) => {
|
17
|
+
elem.style.height = elem.scrollHeight + "px";
|
18
|
+
elem.offsetHeight;
|
19
|
+
window.setTimeout(() => {
|
20
|
+
elem.style.height = "0";
|
21
|
+
elem.style.overflow = "hidden";
|
22
|
+
}, 10);
|
23
|
+
window.setTimeout(() => {
|
24
|
+
elem.classList.remove("is-visible");
|
25
|
+
}, 300);
|
26
|
+
};
|
@@ -31,12 +31,12 @@
|
|
31
31
|
width: 100%;
|
32
32
|
}
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
.row-selection-actions-card {
|
35
|
+
border-bottom-right-radius: 0px !important;
|
36
|
+
border-bottom-left-radius: 0px !important;
|
37
|
+
border-bottom-color: transparent;
|
38
|
+
transition: height 300ms ease;
|
39
|
+
}
|
40
40
|
.table-header-cells:first-child {
|
41
41
|
min-width: 180px;
|
42
42
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useEffect, useCallback } from "react"
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from "react"
|
2
2
|
import classnames from "classnames"
|
3
3
|
|
4
4
|
import { GenericObject } from "../types"
|
@@ -27,6 +27,7 @@ import FlexItem from "../pb_flex/_flex_item"
|
|
27
27
|
import AdvancedTableContext from "./Context/AdvancedTableContext"
|
28
28
|
|
29
29
|
import { updateExpandAndCollapseState } from "./Utilities/ExpansionControlHelpers"
|
30
|
+
import { showActionBar, hideActionBar } from "./Utilities/ActionBarAnimationHelper"
|
30
31
|
|
31
32
|
import { CustomCell } from "./Components/CustomCell"
|
32
33
|
import { TableHeader } from "./SubKits/TableHeader"
|
@@ -295,6 +296,20 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
295
296
|
const onPageChange = (page: number) => {
|
296
297
|
table.setPageIndex(page - 1)
|
297
298
|
}
|
299
|
+
//When to show the actions bar as a whole
|
300
|
+
const isActionBarVisible = selectableRows && showActionsBar && selectedRowsLength > 0
|
301
|
+
|
302
|
+
//Ref and useEffect for animating the actions bar
|
303
|
+
const cardRef = useRef(null);
|
304
|
+
useEffect(() => {
|
305
|
+
if (cardRef.current) {
|
306
|
+
if (isActionBarVisible) {
|
307
|
+
showActionBar(cardRef.current);
|
308
|
+
} else {
|
309
|
+
hideActionBar(cardRef.current);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
}, [isActionBarVisible]);
|
298
313
|
|
299
314
|
return (
|
300
315
|
<div {...ariaProps}
|
@@ -311,6 +326,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
311
326
|
expandedControl,
|
312
327
|
handleExpandOrCollapse,
|
313
328
|
inlineRowLoading,
|
329
|
+
isActionBarVisible,
|
314
330
|
loading,
|
315
331
|
responsive,
|
316
332
|
setExpanded,
|
@@ -333,27 +349,24 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
333
349
|
total={table.getPageCount()}
|
334
350
|
/>
|
335
351
|
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
352
|
+
<Card
|
353
|
+
borderNone={!isActionBarVisible}
|
354
|
+
className={`${isActionBarVisible && "show-action-card row-selection-actions-card"}`}
|
355
|
+
htmlOptions={{ ref: cardRef as any }}
|
356
|
+
padding={`${isActionBarVisible ? "xs" : "none"}`}
|
357
|
+
>
|
358
|
+
<Flex alignItems="center"
|
359
|
+
justify="between"
|
360
|
+
>
|
361
|
+
<Caption color="light"
|
362
|
+
paddingLeft="xs"
|
363
|
+
size="xs"
|
340
364
|
>
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
size="xs"
|
347
|
-
>
|
348
|
-
{selectedRowsLength} Selected
|
349
|
-
</Caption>
|
350
|
-
<FlexItem>
|
351
|
-
{actions}
|
352
|
-
</FlexItem>
|
353
|
-
</Flex>
|
354
|
-
</Card>
|
355
|
-
)
|
356
|
-
}
|
365
|
+
{selectedRowsLength} Selected
|
366
|
+
</Caption>
|
367
|
+
<FlexItem>{actions}</FlexItem>
|
368
|
+
</Flex>
|
369
|
+
</Card>
|
357
370
|
<Table
|
358
371
|
className={`${loading ? "content-loading" : ""}`}
|
359
372
|
dark={dark}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= pb_content_tag do %>
|
2
|
+
<%= pb_rails("button", props: { icon: "copy" }) do %>
|
3
|
+
<%= object.text %>
|
4
|
+
<% end %>
|
5
|
+
<% if object.id %>
|
6
|
+
<%= pb_rails("tooltip", props: {
|
7
|
+
trigger_element_selector: "##{object.id}",
|
8
|
+
position: object.tooltip_position,
|
9
|
+
tooltip_id: "#{object.id}_tooltip",
|
10
|
+
trigger_method: "click"
|
11
|
+
}) do %>
|
12
|
+
<%= object.tooltip_text %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbCopyButton
|
5
|
+
class CopyButton < ::Playbook::KitBase
|
6
|
+
prop :text
|
7
|
+
prop :tooltip_position,
|
8
|
+
type: Playbook::Props::Enum,
|
9
|
+
values: %w[top right bottom left],
|
10
|
+
default: "top"
|
11
|
+
prop :tooltip_text, type: Playbook::Props::String,
|
12
|
+
default: "Copied!"
|
13
|
+
prop :value
|
14
|
+
prop :from
|
15
|
+
|
16
|
+
def classname
|
17
|
+
generate_classname("pb_copy_button_kit")
|
18
|
+
end
|
19
|
+
|
20
|
+
def data
|
21
|
+
Hash(values[:data]).merge(
|
22
|
+
"copy-value": value,
|
23
|
+
"from": from
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<%= pb_rails("copy_button", props: { id: "default-copy-button", text: "Copy Text", value: "Playbook makes it easy to support bleeding edge, or legacy systems. Use Playbook’s 200+ components and end-to-end design language to create simple, intuitive and beautiful experiences with ease." } ) %>
|
2
|
+
<%= pb_rails("textarea", props: { margin_top: "xs", placeholder: "Copy and paste here" }) %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%= pb_rails("body", props: { id: "body", text: "Copy this body text!"}) %>
|
2
|
+
<%= pb_rails("copy_button", props: { text: "Copy Body text", from: "body", id: "copy-body-button" }) %>
|
3
|
+
<%= pb_rails("text_input", props: { margin_top: "xs", placeholder: "Copy and paste here" }) %>
|
4
|
+
<%= pb_rails("copy_button", props: { text: "Copy Text Input", from: "copy-input", id: "copy-input-button" }) %>
|
5
|
+
<%= pb_rails("text_input", props: { margin_top: "xs", id: "copy-input" , value: "Copy and paste here" }) %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element"
|
2
|
+
|
3
|
+
export default class PbCopyButton extends PbEnhancedElement {
|
4
|
+
static get selector() {
|
5
|
+
return '.pb_copy_button_kit'
|
6
|
+
}
|
7
|
+
|
8
|
+
connect() {
|
9
|
+
this.handleClick = this.handleClick.bind(this)
|
10
|
+
this.button = this.element.querySelector('button')
|
11
|
+
if (this.button) {
|
12
|
+
this.button.addEventListener('click', this.handleClick)
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
disconnect() {
|
17
|
+
if (this.button) {
|
18
|
+
this.button.removeEventListener('click', this.handleClick)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
handleClick() {
|
23
|
+
const fromId = this.element.getAttribute('data-from')
|
24
|
+
if (fromId) {
|
25
|
+
const fromElement = document.querySelector(`#${fromId}`)
|
26
|
+
if (fromElement) {
|
27
|
+
let contentToCopy = ''
|
28
|
+
if (fromElement.tagName.toLowerCase() === 'input') {
|
29
|
+
contentToCopy = fromElement.value
|
30
|
+
} else {
|
31
|
+
contentToCopy = fromElement.innerText
|
32
|
+
}
|
33
|
+
navigator.clipboard.writeText(contentToCopy)
|
34
|
+
.catch(err => console.error('Failed to copy text', err))
|
35
|
+
return
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
const textToCopy = this.element.getAttribute('data-copy-value')
|
40
|
+
if (textToCopy) {
|
41
|
+
navigator.clipboard.writeText(textToCopy)
|
42
|
+
.catch(err => console.error('Failed to copy text', err))
|
43
|
+
} else {
|
44
|
+
console.warn('No data-copy-value attribute found or data-from element')
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
@@ -1,14 +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_multiple_containers_rails: Dragging Across Multiple Containers
|
14
16
|
|
17
|
+
|
18
|
+
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
|
3
|
-
<% end %>
|
2
|
+
<%= content.presence %>
|
3
|
+
<% end %>
|
@@ -9,32 +9,11 @@ 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
|
-
|
22
14
|
document.addEventListener("DOMContentLoaded", () => this.bindEventListeners());
|
23
15
|
}
|
24
16
|
|
25
|
-
setState(newState) {
|
26
|
-
this.state = { ...this.state, ...newState };
|
27
|
-
if (newState.items) {
|
28
|
-
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
29
|
-
detail: {
|
30
|
-
reorderedItems: this.state.items,
|
31
|
-
containerId: this.element.querySelector(DRAGGABLE_CONTAINER).id
|
32
|
-
}
|
33
|
-
});
|
34
|
-
this.element.dispatchEvent(customEvent);
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
17
|
bindEventListeners() {
|
39
18
|
// Needed to prevent images within draggable items from being independently draggable
|
40
19
|
// Needed if using Image kit in draggable items
|
@@ -48,11 +27,11 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
48
27
|
item.addEventListener("dragenter", this.handleDragEnter.bind(this));
|
49
28
|
});
|
50
29
|
|
51
|
-
const
|
52
|
-
|
30
|
+
const container = this.element.querySelector(DRAGGABLE_CONTAINER);
|
31
|
+
if (container) {
|
53
32
|
container.addEventListener("dragover", this.handleDragOver.bind(this));
|
54
33
|
container.addEventListener("drop", this.handleDrop.bind(this));
|
55
|
-
}
|
34
|
+
}
|
56
35
|
}
|
57
36
|
|
58
37
|
handleDragStart(event) {
|
@@ -62,17 +41,11 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
62
41
|
event.preventDefault();
|
63
42
|
return;
|
64
43
|
}
|
65
|
-
|
66
|
-
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
44
|
+
|
67
45
|
this.draggedItem = event.target;
|
68
46
|
this.draggedItemId = event.target.id;
|
69
|
-
|
70
|
-
this.setState({
|
71
|
-
dragData: { id: this.draggedItemId, initialGroup: container.id },
|
72
|
-
isDragging: this.draggedItemId
|
73
|
-
});
|
74
|
-
|
75
47
|
event.target.classList.add("is_dragging");
|
48
|
+
|
76
49
|
if (event.dataTransfer) {
|
77
50
|
event.dataTransfer.effectAllowed = 'move';
|
78
51
|
event.dataTransfer.setData('text/plain', this.draggedItemId);
|
@@ -91,14 +64,6 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
91
64
|
|
92
65
|
const container = targetItem.parentNode;
|
93
66
|
const items = Array.from(container.children);
|
94
|
-
|
95
|
-
const newItems = [...items].map(item => ({
|
96
|
-
id: item.id,
|
97
|
-
container: container.id
|
98
|
-
}));
|
99
|
-
|
100
|
-
this.setState({ items: newItems });
|
101
|
-
|
102
67
|
const draggedIndex = items.indexOf(this.draggedItem);
|
103
68
|
const targetIndex = items.indexOf(targetItem);
|
104
69
|
|
@@ -111,82 +76,45 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
111
76
|
|
112
77
|
handleDragOver(event) {
|
113
78
|
event.preventDefault();
|
114
|
-
event.
|
115
|
-
|
116
|
-
let container;
|
117
|
-
if (event.target.matches(DRAGGABLE_CONTAINER)) {
|
118
|
-
container = event.target;
|
119
|
-
} else {
|
120
|
-
container = event.target.closest(DRAGGABLE_CONTAINER);
|
121
|
-
}
|
79
|
+
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
122
80
|
|
123
81
|
if (container) {
|
124
|
-
this.setState({ activeContainer: container.id });
|
125
82
|
container.classList.add("active_container");
|
126
83
|
}
|
127
84
|
}
|
128
85
|
|
129
86
|
handleDrop(event) {
|
130
87
|
event.preventDefault();
|
131
|
-
event.
|
132
|
-
|
133
|
-
let container;
|
134
|
-
|
135
|
-
if (event.target.matches(DRAGGABLE_CONTAINER)) {
|
136
|
-
container = event.target;
|
137
|
-
} else {
|
138
|
-
container = event.target.closest(DRAGGABLE_CONTAINER);
|
139
|
-
}
|
140
|
-
|
88
|
+
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
141
89
|
if (!container || !this.draggedItem) return;
|
142
|
-
|
90
|
+
|
143
91
|
container.classList.remove("active_container");
|
144
92
|
this.draggedItem.style.opacity = '1';
|
145
|
-
|
146
|
-
// Handle empty containers
|
147
|
-
if (!container.querySelector('.pb_draggable_item')) {
|
148
|
-
container.appendChild(this.draggedItem);
|
149
|
-
}
|
150
|
-
|
93
|
+
|
151
94
|
// Updated order of items as an array of item IDs
|
152
|
-
const reorderedItems = Array.from(
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
container: item.closest(DRAGGABLE_CONTAINER).id
|
157
|
-
}));
|
158
|
-
|
95
|
+
const reorderedItems = Array.from(container.children)
|
96
|
+
.filter(item => item.classList.contains("pb_draggable_item"))
|
97
|
+
.map(item => item.id.replace("item_", ""));
|
98
|
+
|
159
99
|
// Store reordered items in a data attribute on the container
|
160
100
|
container.setAttribute("data-reordered-items", JSON.stringify(reorderedItems));
|
161
|
-
|
101
|
+
|
162
102
|
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
163
103
|
detail: {
|
164
104
|
reorderedItems,
|
165
105
|
containerId: container.id,
|
166
106
|
}
|
167
107
|
});
|
168
|
-
|
169
108
|
this.element.dispatchEvent(customEvent);
|
170
|
-
|
171
|
-
this.setState({
|
172
|
-
items: reorderedItems, // Changed from reorderedItems to items to match setState
|
173
|
-
isDragging: "",
|
174
|
-
activeContainer: ""
|
175
|
-
});
|
176
|
-
|
109
|
+
|
177
110
|
this.draggedItem = null;
|
178
111
|
this.draggedItemId = null;
|
179
112
|
}
|
113
|
+
|
180
114
|
|
181
115
|
handleDragEnd(event) {
|
182
116
|
event.target.classList.remove("is_dragging");
|
183
117
|
event.target.style.opacity = '1';
|
184
|
-
|
185
|
-
this.setState({
|
186
|
-
isDragging: "",
|
187
|
-
activeContainer: ""
|
188
|
-
});
|
189
|
-
|
190
118
|
this.draggedItem = null;
|
191
119
|
this.draggedItemId = null;
|
192
120
|
|
@@ -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,14 +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
|
-
str.split(" ").map(&:capitalize).join(" ")
|
58
|
-
end
|
59
|
-
|
60
51
|
def city_emphasis_props
|
61
52
|
{
|
62
53
|
address_house_style: address_house_style,
|