playbook_ui 14.18.1.pre.rc.0 → 14.19.0.pre.rc.0
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_draggable/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +1 -9
- data/app/pb_kits/playbook/pb_draggable/index.js +142 -139
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +18 -22
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +0 -13
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +0 -19
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_popover/index.ts +1 -13
- data/app/pb_kits/playbook/pb_popover/popover.rb +0 -2
- data/dist/chunks/{_typeahead-D8CsVBZO.js → _typeahead-BX8IifKY.js} +2 -2
- data/dist/chunks/{_weekday_stacked-CHQsoCdP.js → _weekday_stacked-DfMD7HJz.js} +1 -1
- data/dist/chunks/{lib-BmTAc7Nc.js → lib-96_ZmvAo.js} +1 -1
- data/dist/chunks/{pb_form_validation-BWjy4bFn.js → pb_form_validation-Vv2TqXVC.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +8 -21
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.html.erb +0 -43
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.html.erb +0 -55
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_rails.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.html.erb +0 -41
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +0 -52
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +0 -110
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.html.erb +0 -10
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.jsx +0 -20
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.md +0 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.html.erb +0 -46
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.md +0 -1
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_drop_zones_react.md → _draggable_drop_zones.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_drop_zones_colors_react.md → _draggable_drop_zones_colors.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae9d27af86020c669d4402b35b61ee356de6cb7a61fdbb177eac964f2765822
|
4
|
+
data.tar.gz: f8e3d579c5e3b29639a3b56a09c3e8e20f48a9089ab4c6a1d6cb3302ecf0119b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b142aba7e0202847db31c8e74164ba49ff77382f5ea97e173af29a3c115627b092b2872d9e82898b32432dbec1fb8b5c82dcc523ded9bea8f93f37b0ffb95fb
|
7
|
+
data.tar.gz: 94c8ff54d18937587afe9fa0ef51e0805686f133e2b230ca0628078cd4b26a19ca4564cb7359a37ada021c884990f16c0bf2940a07d8876386252e2cdb80829a
|
@@ -17,6 +17,5 @@ examples:
|
|
17
17
|
- draggable_with_cards: Draggable with Cards
|
18
18
|
- draggable_with_table: Draggable with Table
|
19
19
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
20
|
-
- draggable_drop_zones: Draggable Drop Zones
|
21
|
-
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
22
20
|
- draggable_event_listeners: Draggable Event Listeners
|
21
|
+
|
@@ -5,17 +5,9 @@ module Playbook
|
|
5
5
|
class Draggable < ::Playbook::KitBase
|
6
6
|
prop :initial_items, type: Playbook::Props::Array,
|
7
7
|
default: []
|
8
|
-
prop :drop_zone_type, type: Playbook::Props::Enum,
|
9
|
-
values: %w[ghost shadow outline line],
|
10
|
-
default: "ghost"
|
11
|
-
prop :drop_zone_color, type: Playbook::Props::Enum,
|
12
|
-
values: %w[neutral primary purple],
|
13
|
-
default: "neutral"
|
14
8
|
|
15
9
|
def data
|
16
|
-
Hash(prop(:data)).merge(pb_draggable: true
|
17
|
-
drop_zone_type: drop_zone_type,
|
18
|
-
drop_zone_color: drop_zone_color)
|
10
|
+
Hash(prop(:data)).merge(pb_draggable: true)
|
19
11
|
end
|
20
12
|
|
21
13
|
def classname
|
@@ -1,26 +1,24 @@
|
|
1
1
|
import PbEnhancedElement from "../pb_enhanced_element";
|
2
2
|
|
3
|
-
const DRAGGABLE_SELECTOR
|
3
|
+
const DRAGGABLE_SELECTOR = "[data-pb-draggable]";
|
4
4
|
const DRAGGABLE_CONTAINER = ".pb_draggable_container";
|
5
|
-
const NEEDS_CLONE = ["shadow", "outline"]; // clone only for these types
|
6
5
|
|
7
6
|
export default class PbDraggable extends PbEnhancedElement {
|
8
|
-
static get selector() {
|
7
|
+
static get selector() {
|
8
|
+
return DRAGGABLE_SELECTOR;
|
9
|
+
}
|
9
10
|
|
10
11
|
connect() {
|
11
12
|
this.state = {
|
12
|
-
items:
|
13
|
-
dragData:
|
14
|
-
isDragging:
|
15
|
-
activeContainer: ""
|
13
|
+
items: [],
|
14
|
+
dragData: { id: "", initialGroup: "" },
|
15
|
+
isDragging: "",
|
16
|
+
activeContainer: ""
|
16
17
|
};
|
17
18
|
|
18
|
-
this.draggedItem
|
19
|
+
this.draggedItem = null;
|
19
20
|
this.draggedItemId = null;
|
20
|
-
this.dragGhost = null;
|
21
21
|
this.hasMultipleContainers = false;
|
22
|
-
this.dragZoneType = "";
|
23
|
-
this.dragZoneColor = "";
|
24
22
|
|
25
23
|
document.addEventListener("DOMContentLoaded", () => this.bindEventListeners());
|
26
24
|
}
|
@@ -28,12 +26,13 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
28
26
|
setState(newState) {
|
29
27
|
this.state = { ...this.state, ...newState };
|
30
28
|
if (newState.items) {
|
31
|
-
|
29
|
+
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
32
30
|
detail: {
|
33
31
|
reorderedItems: this.state.items,
|
34
|
-
containerId:
|
35
|
-
}
|
36
|
-
})
|
32
|
+
containerId: this.element.querySelector(DRAGGABLE_CONTAINER).id
|
33
|
+
}
|
34
|
+
});
|
35
|
+
this.element.dispatchEvent(customEvent);
|
37
36
|
}
|
38
37
|
}
|
39
38
|
|
@@ -44,100 +43,71 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
44
43
|
|
45
44
|
// Needed to prevent images within draggable items from being independently draggable
|
46
45
|
// Needed if using Image kit in draggable items
|
47
|
-
this.element.querySelectorAll(".pb_draggable_item img")
|
48
|
-
|
49
|
-
|
50
|
-
this.element.querySelectorAll(".pb_draggable_item")
|
51
|
-
.forEach(item => {
|
52
|
-
item.addEventListener("dragstart", this.handleDragStart.bind(this));
|
53
|
-
item.addEventListener("dragend", this.handleDragEnd.bind(this));
|
54
|
-
item.addEventListener("dragenter", this.handleDragEnter.bind(this));
|
55
|
-
});
|
46
|
+
this.element.querySelectorAll(".pb_draggable_item img").forEach(img => {
|
47
|
+
img.setAttribute("draggable", "false");
|
48
|
+
});
|
56
49
|
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
this.element.querySelectorAll(".pb_draggable_item").forEach(item => {
|
51
|
+
item.addEventListener("dragstart", this.handleDragStart.bind(this));
|
52
|
+
item.addEventListener("dragend", this.handleDragEnd.bind(this));
|
53
|
+
item.addEventListener("dragenter", this.handleDragEnter.bind(this));
|
54
|
+
});
|
55
|
+
|
56
|
+
containers.forEach(container => {
|
57
|
+
container.addEventListener("dragover", this.handleDragOver.bind(this));
|
58
|
+
container.addEventListener("drop", this.handleDrop.bind(this));
|
60
59
|
});
|
61
60
|
}
|
62
61
|
|
63
|
-
/* ---------------- DRAG START ---------------- */
|
64
62
|
handleDragStart(event) {
|
65
63
|
// Needed to prevent images within draggable items from being independently draggable
|
66
64
|
// Needed if using Image kit in draggable items
|
67
|
-
if (event.target.tagName.toLowerCase() ===
|
65
|
+
if (event.target.tagName.toLowerCase() === 'img') {
|
68
66
|
event.preventDefault();
|
69
67
|
return;
|
70
68
|
}
|
71
69
|
|
72
|
-
const container
|
73
|
-
this.draggedItem
|
70
|
+
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
71
|
+
this.draggedItem = event.target;
|
74
72
|
this.draggedItemId = event.target.id;
|
75
|
-
this.dragZoneType = this.element.dataset.dropZoneType || "";
|
76
|
-
this.dragZoneColor = this.element.dataset.dropZoneColor || "";
|
77
73
|
|
78
74
|
this.setState({
|
79
|
-
dragData:
|
80
|
-
isDragging: this.draggedItemId
|
75
|
+
dragData: { id: this.draggedItemId, initialGroup: container.id },
|
76
|
+
isDragging: this.draggedItemId
|
81
77
|
});
|
82
78
|
|
83
|
-
|
84
|
-
"is_dragging",
|
85
|
-
`drop_zone_${this.dragZoneType}`,
|
86
|
-
`drop_zone_color_${this.dragZoneColor}`,
|
87
|
-
);
|
88
|
-
|
79
|
+
event.target.classList.add("is_dragging");
|
89
80
|
if (event.dataTransfer) {
|
90
|
-
event.dataTransfer.effectAllowed =
|
91
|
-
event.dataTransfer.setData(
|
92
|
-
|
93
|
-
/* ---------- custom ghost clone (shadow + outline only) ---------- */
|
94
|
-
if (NEEDS_CLONE.includes(this.dragZoneType)) {
|
95
|
-
const ghost = this.draggedItem.cloneNode(true);
|
96
|
-
ghost.classList.remove(
|
97
|
-
"is_dragging",
|
98
|
-
`drop_zone_${this.dragZoneType}`,
|
99
|
-
`drop_zone_color_${this.dragZoneColor}`,
|
100
|
-
);
|
101
|
-
const { width, height } = this.draggedItem.getBoundingClientRect();
|
102
|
-
Object.assign(ghost.style, {
|
103
|
-
border: "none",
|
104
|
-
width: `${width}px`,
|
105
|
-
height: `${height}px`,
|
106
|
-
position: "absolute",
|
107
|
-
top: "-9999px",
|
108
|
-
left: "-9999px",
|
109
|
-
boxSizing: "border-box",
|
110
|
-
zIndex: "9999",
|
111
|
-
});
|
112
|
-
document.body.appendChild(ghost);
|
113
|
-
this.dragGhost = ghost;
|
114
|
-
event.dataTransfer.setDragImage(ghost, width / 2, height / 2);
|
115
|
-
}
|
116
|
-
/* ---------------------------------------------------------------- */
|
81
|
+
event.dataTransfer.effectAllowed = 'move';
|
82
|
+
event.dataTransfer.setData('text/plain', this.draggedItemId);
|
117
83
|
}
|
118
84
|
|
119
|
-
|
85
|
+
setTimeout(() => {
|
86
|
+
event.target.style.opacity = '0.5';
|
87
|
+
}, 0);
|
120
88
|
}
|
121
89
|
|
122
|
-
/* ---------------- DRAG ENTER ---------------- */
|
123
90
|
handleDragEnter(event) {
|
124
91
|
if (!this.draggedItem || event.target === this.draggedItem) return;
|
125
|
-
|
126
|
-
|
127
|
-
|
92
|
+
|
93
|
+
if (this.hasMultipleContainers) {
|
94
|
+
this.handleMultiContainerDragEnter(event);
|
95
|
+
} else {
|
96
|
+
this.handleSingleContainerDragEnter(event);
|
97
|
+
}
|
128
98
|
}
|
129
99
|
|
130
100
|
handleSingleContainerDragEnter(event) {
|
131
|
-
const targetItem = event.target.closest(
|
132
|
-
// If we're entering a container directly or there's no target item
|
101
|
+
const targetItem = event.target.closest('.pb_draggable_item');
|
133
102
|
if (!targetItem) return;
|
134
103
|
|
135
104
|
const container = targetItem.parentNode;
|
136
|
-
const items
|
137
|
-
const fromIdx = items.indexOf(this.draggedItem);
|
138
|
-
const toIdx = items.indexOf(targetItem);
|
105
|
+
const items = Array.from(container.children);
|
139
106
|
|
140
|
-
|
107
|
+
const draggedIndex = items.indexOf(this.draggedItem);
|
108
|
+
const targetIndex = items.indexOf(targetItem);
|
109
|
+
|
110
|
+
if (draggedIndex > targetIndex) {
|
141
111
|
container.insertBefore(this.draggedItem, targetItem);
|
142
112
|
} else {
|
143
113
|
container.insertBefore(this.draggedItem, targetItem.nextSibling);
|
@@ -146,113 +116,146 @@ export default class PbDraggable extends PbEnhancedElement {
|
|
146
116
|
|
147
117
|
handleMultiContainerDragEnter(event) {
|
148
118
|
const targetContainer = event.target.closest(DRAGGABLE_CONTAINER);
|
149
|
-
const targetItem
|
119
|
+
const targetItem = event.target.closest('.pb_draggable_item');
|
120
|
+
|
150
121
|
if (!targetContainer) return;
|
151
122
|
|
123
|
+
// If we're entering a container directly or there's no target item
|
152
124
|
if (!targetItem) {
|
153
|
-
const
|
154
|
-
|
155
|
-
|
156
|
-
|
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
|
+
}
|
157
131
|
return;
|
158
132
|
}
|
159
133
|
|
160
|
-
const
|
161
|
-
|
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 });
|
162
143
|
|
163
|
-
const
|
164
|
-
|
144
|
+
const rect = targetItem.getBoundingClientRect();
|
145
|
+
const middleY = rect.top + rect.height / 2;
|
165
146
|
|
166
|
-
if (event.clientY <
|
167
|
-
|
147
|
+
if (event.clientY < middleY) {
|
148
|
+
container.insertBefore(this.draggedItem, targetItem);
|
168
149
|
} else {
|
169
|
-
|
150
|
+
container.insertBefore(this.draggedItem, targetItem.nextSibling);
|
170
151
|
}
|
171
152
|
}
|
172
153
|
|
173
|
-
/* ---------------- DRAG OVER ---------------- */
|
174
154
|
handleDragOver(event) {
|
175
155
|
event.preventDefault();
|
176
156
|
event.stopPropagation();
|
177
|
-
|
178
|
-
|
179
|
-
|
157
|
+
|
158
|
+
if (this.hasMultipleContainers) {
|
159
|
+
this.handleMultiContainerDragOver(event);
|
160
|
+
} else {
|
161
|
+
this.handleSingleContainerDragOver(event);
|
162
|
+
}
|
180
163
|
}
|
181
164
|
|
182
165
|
handleSingleContainerDragOver(event) {
|
183
166
|
const container = event.target.closest(DRAGGABLE_CONTAINER);
|
184
|
-
if (container)
|
167
|
+
if (container) {
|
168
|
+
container.classList.add("active_container");
|
169
|
+
}
|
185
170
|
}
|
186
171
|
|
187
172
|
handleMultiContainerDragOver(event) {
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
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
|
+
|
180
|
+
if (container) {
|
181
|
+
this.setState({ activeContainer: container.id });
|
182
|
+
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
|
+
}
|
200
190
|
}
|
201
191
|
}
|
202
192
|
}
|
203
193
|
|
204
|
-
/* ---------------- DROP ---------------- */
|
205
194
|
handleDrop(event) {
|
206
195
|
event.preventDefault();
|
207
196
|
event.stopPropagation();
|
208
197
|
|
209
|
-
|
210
|
-
|
211
|
-
|
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
|
+
|
212
205
|
if (!container || !this.draggedItem) return;
|
213
206
|
|
214
207
|
container.classList.remove("active_container");
|
215
|
-
this.draggedItem.style.opacity =
|
208
|
+
this.draggedItem.style.opacity = '1';
|
216
209
|
|
217
210
|
// Handle empty containers
|
218
|
-
if (this.hasMultipleContainers && !container.querySelector(
|
211
|
+
if (this.hasMultipleContainers && !container.querySelector('.pb_draggable_item')) {
|
219
212
|
container.appendChild(this.draggedItem);
|
220
213
|
}
|
221
214
|
|
222
215
|
// Updated order of items as an array of item IDs
|
223
|
-
const reorderedItems = Array.from(
|
224
|
-
.
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
detail: { reorderedItems, containerId: container.id },
|
216
|
+
const reorderedItems = Array.from(
|
217
|
+
this.element.querySelectorAll('.pb_draggable_item')
|
218
|
+
).map(item => ({
|
219
|
+
id: item.id,
|
220
|
+
container: item.closest(DRAGGABLE_CONTAINER).id
|
229
221
|
}));
|
230
222
|
|
231
|
-
|
232
|
-
|
223
|
+
// Store reordered items in a data attribute on the container
|
224
|
+
container.setAttribute("data-reordered-items", JSON.stringify(reorderedItems));
|
225
|
+
|
226
|
+
const customEvent = new CustomEvent('pb-draggable-reorder', {
|
227
|
+
detail: {
|
228
|
+
reorderedItems,
|
229
|
+
containerId: container.id,
|
230
|
+
}
|
231
|
+
});
|
232
|
+
|
233
|
+
this.element.dispatchEvent(customEvent);
|
234
|
+
|
235
|
+
this.setState({
|
236
|
+
items: reorderedItems,
|
237
|
+
isDragging: "",
|
238
|
+
activeContainer: ""
|
239
|
+
});
|
240
|
+
|
241
|
+
this.draggedItem = null;
|
233
242
|
this.draggedItemId = null;
|
234
243
|
}
|
235
244
|
|
236
|
-
/* ---------------- DRAG END ---------------- */
|
237
245
|
handleDragEnd(event) {
|
238
|
-
event.target.classList.remove(
|
239
|
-
|
240
|
-
`drop_zone_${this.dragZoneType}`,
|
241
|
-
`drop_zone_color_${this.dragZoneColor}`,
|
242
|
-
);
|
243
|
-
event.target.style.opacity = "1";
|
244
|
-
|
245
|
-
if (this.dragGhost) {
|
246
|
-
document.body.removeChild(this.dragGhost);
|
247
|
-
this.dragGhost = null;
|
248
|
-
}
|
249
|
-
|
250
|
-
this.setState({ isDragging: "", activeContainer: "" });
|
246
|
+
event.target.classList.remove("is_dragging");
|
247
|
+
event.target.style.opacity = '1';
|
251
248
|
|
252
|
-
this.
|
253
|
-
|
249
|
+
this.setState({
|
250
|
+
isDragging: "",
|
251
|
+
activeContainer: ""
|
252
|
+
});
|
254
253
|
|
255
|
-
this.draggedItem
|
254
|
+
this.draggedItem = null;
|
256
255
|
this.draggedItemId = null;
|
256
|
+
|
257
|
+
this.element.querySelectorAll(DRAGGABLE_CONTAINER).forEach(container => {
|
258
|
+
container.classList.remove("active_container");
|
259
|
+
});
|
257
260
|
}
|
258
261
|
}
|
@@ -23,39 +23,35 @@
|
|
23
23
|
@mixin error-state-right-side-select-kit {
|
24
24
|
&:has(.pb_text_input_kit:not(.error)):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper.error),
|
25
25
|
&:has(.pb_text_input_kit.error):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper) {
|
26
|
-
|
27
|
-
align-items: flex-start;
|
26
|
+
align-items: flex-start;
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
.pb_select_kit_wrapper {
|
29
|
+
padding-top: $space_md;
|
30
|
+
margin-top: 2px;
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
}
|
32
|
+
.pb_select_kit_caret {
|
33
|
+
padding-top: $space_md;
|
36
34
|
}
|
35
|
+
}
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
.pb_select_kit_wrapper.error {
|
38
|
+
padding-top: $space_md;
|
39
|
+
margin-top: 2px;
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
}
|
41
|
+
.pb_select_kit_caret {
|
42
|
+
padding-top: $space_xl;
|
45
43
|
}
|
46
44
|
}
|
47
45
|
}
|
48
46
|
}
|
49
47
|
|
50
48
|
@mixin error-state-left-side-select-kit {
|
51
|
-
&:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_text_input_kit.error) {
|
52
|
-
|
53
|
-
align-items: flex-start;
|
49
|
+
&:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_phone_number_input):has(.pb_text_input_kit.error) {
|
50
|
+
align-items: flex-start;
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
52
|
+
.pb_text_input_kit.error {
|
53
|
+
padding-top: $space_md;
|
54
|
+
margin-top: 2px;
|
59
55
|
}
|
60
56
|
}
|
61
|
-
}
|
57
|
+
}
|
@@ -4,4 +4,3 @@ export { default as LineGraphLegendPosition } from './_line_graph_legend_positio
|
|
4
4
|
export { default as LineGraphLegendNonclickable } from './_line_graph_legend_nonclickable.jsx'
|
5
5
|
export { default as LineGraphHeight } from './_line_graph_height.jsx'
|
6
6
|
export { default as LineGraphColors } from './_line_graph_colors.jsx'
|
7
|
-
export { default as LineGraphPbStyles } from './_line_graph_pb_styles.jsx'
|
@@ -39,9 +39,6 @@ $flag-min-resolution: 192dpi;
|
|
39
39
|
color: $charcoal;
|
40
40
|
}
|
41
41
|
|
42
|
-
.iti__country-list {
|
43
|
-
min-width: $dropdown-min-width;
|
44
|
-
}
|
45
42
|
// iti-spacer-horizontal's default is 8px, or $space_xs
|
46
43
|
.iti__country-list .iti__flag, .iti__country-name {
|
47
44
|
margin-right: $space_xs;
|
@@ -230,16 +227,6 @@ $flag-min-resolution: 192dpi;
|
|
230
227
|
.iti__dropdown-content {
|
231
228
|
border-radius: $space_xs;
|
232
229
|
border: 1px solid $border_dark !important;
|
233
|
-
.iti__search-input {
|
234
|
-
background-color: $bg_dark_card;
|
235
|
-
&:hover {
|
236
|
-
background-color: $bg_dark_card;
|
237
|
-
}
|
238
|
-
&:active,
|
239
|
-
&:focus {
|
240
|
-
background-color: $card_dark;
|
241
|
-
}
|
242
|
-
}
|
243
230
|
}
|
244
231
|
|
245
232
|
.iti__divider {
|
@@ -37,7 +37,6 @@ type PhoneNumberInputProps = {
|
|
37
37
|
required?: boolean,
|
38
38
|
value?: string,
|
39
39
|
formatAsYouType?: boolean,
|
40
|
-
countrySearch?: boolean,
|
41
40
|
}
|
42
41
|
|
43
42
|
enum ValidationError {
|
@@ -92,7 +91,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
92
91
|
preferredCountries = [],
|
93
92
|
value = "",
|
94
93
|
formatAsYouType = false,
|
95
|
-
countrySearch = false,
|
96
94
|
} = props
|
97
95
|
|
98
96
|
const ariaProps = buildAriaProps(aria)
|
@@ -244,7 +242,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
244
242
|
autoInsertDialCode: false,
|
245
243
|
initialCountry: initialCountry || fallbackCountry,
|
246
244
|
onlyCountries,
|
247
|
-
countrySearch:
|
245
|
+
countrySearch: false,
|
248
246
|
fixDropdownWidth: false,
|
249
247
|
formatAsYouType: formatAsYouType,
|
250
248
|
hiddenInput: hiddenInputs ? () => ({
|
@@ -9,7 +9,6 @@ examples:
|
|
9
9
|
- phone_number_input_clear_field: Clearing the Input Field
|
10
10
|
- phone_number_input_access_input_element: Accessing the Input Element
|
11
11
|
- phone_number_input_format: Format as You Type
|
12
|
-
- phone_number_input_country_search: Country Search
|
13
12
|
|
14
13
|
rails:
|
15
14
|
- phone_number_input_default: Default
|
@@ -19,5 +18,4 @@ examples:
|
|
19
18
|
- phone_number_input_validation: Form Validation
|
20
19
|
- phone_number_input_format: Format as You Type
|
21
20
|
- phone_number_input_hidden_inputs: Hidden Inputs
|
22
|
-
- phone_number_input_country_search: Country Search
|
23
21
|
|
@@ -6,4 +6,3 @@ export { default as PhoneNumberInputValidation } from './_phone_number_input_val
|
|
6
6
|
export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
|
7
7
|
export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
|
8
8
|
export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
|
9
|
-
export { default as PhoneNumberInputCountrySearch } from './_phone_number_input_country_search'
|
@@ -25,8 +25,6 @@ module Playbook
|
|
25
25
|
default: false
|
26
26
|
prop :hidden_inputs, type: Playbook::Props::Boolean,
|
27
27
|
default: false
|
28
|
-
prop :country_search, type: Playbook::Props::Boolean,
|
29
|
-
default: false
|
30
28
|
|
31
29
|
def classname
|
32
30
|
generate_classname("pb_phone_number_input")
|
@@ -47,7 +45,6 @@ module Playbook
|
|
47
45
|
preferredCountries: preferred_countries,
|
48
46
|
required: required,
|
49
47
|
value: value,
|
50
|
-
countrySearch: country_search,
|
51
48
|
}
|
52
49
|
end
|
53
50
|
end
|
@@ -139,22 +139,3 @@ test("should format phone number as '555-555-5555' with formatAsYouType and 'us'
|
|
139
139
|
|
140
140
|
expect(input.value).toBe("555-555-5555");
|
141
141
|
});
|
142
|
-
|
143
|
-
test("should pass countrySearch prop to component", () => {
|
144
|
-
window.intlTelInput = jest.fn(() => ({
|
145
|
-
getSelectedCountryData: jest.fn(() => ({})),
|
146
|
-
isValidNumber: jest.fn(() => true),
|
147
|
-
getValidationError: jest.fn(() => 0),
|
148
|
-
}));
|
149
|
-
|
150
|
-
const props = {
|
151
|
-
id: testId,
|
152
|
-
countrySearch: true,
|
153
|
-
data: { testid: 'phone-input-with-search' }
|
154
|
-
};
|
155
|
-
|
156
|
-
render(<PhoneNumberInput {...props} />);
|
157
|
-
|
158
|
-
const wrapper = screen.getByTestId('phone-input-with-search');
|
159
|
-
expect(wrapper).toBeInTheDocument();
|
160
|
-
});
|