playbook_ui 15.5.0.pre.alpha.draggablefix12589 → 15.5.0.pre.alpha.typeaheadfix12605

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9048fda164619db498afb925949d4d2d56e2c273fcb753e7d43a504fe4c9e5a5
4
- data.tar.gz: ff6ed156a4e852bcae45701f34feba01cdfa6f4e7a58b86181d76271781a5dd3
3
+ metadata.gz: 55ff4c659b41354c334f4269d707a68355d197f2107bd6ad30538c3db3a79a9e
4
+ data.tar.gz: 88be26fddd7ab5bb775fcb638bde6adabb5e9a8114dfdf91a9996e465bcf9034
5
5
  SHA512:
6
- metadata.gz: 1bda0b34988a106ead207cc8fd705876f3550ebd6bc42c261da82f2be82a0f85fbe2398b9a345ce308840f052846be435f46a975a50e27fe7a4a939f3d27dacb
7
- data.tar.gz: db28214d63307ebeae96aefbb6db9ad6376cd84ba3606d09deac5507a0c41c39146b3ca0fe23976551e95376d96d6de979e5428585dbde764594db0279827855
6
+ metadata.gz: e514df0fe3dd24face52c69bde8fe96fbbc2631b9e2d7e0d884ebc37415dc2b5dc0582b9603a6ddc6f06dd2751f30a312d7f2ad3f487f82d42d8a482ed4858b4
7
+ data.tar.gz: dd28cc4eb240e9036eeedc425360e4a1931b425d27d8514702d377ff58e30a3af3f66a85a22c06ce599bc92e47e18fb8d69ef12027020f19b71155e08f818172
@@ -1,3 +1,24 @@
1
+ <%
2
+ options = [
3
+ {
4
+ label: "United States",
5
+ value: "unitedStates",
6
+ id: "us"
7
+ },
8
+ {
9
+ label: "United Kingdom",
10
+ value: "unitedKingdom",
11
+ id: "gb"
12
+ },
13
+ {
14
+ label: "Pakistan",
15
+ value: "pakistan",
16
+ id: "pk"
17
+ }
18
+ ]
19
+ %>
20
+
21
+
1
22
  <%= pb_rails("button", props: { text: "Open Complex Dialog", data:{"open-dialog": "dialog-complex"} }) %>
2
23
 
3
24
  <%= pb_rails("dialog", props: { id:"dialog-complex", size: "lg", full_height: true }) do %>
@@ -10,6 +31,16 @@
10
31
  <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
11
32
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
12
33
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
34
+ <%= pb_rails("dropdown", props: {options: options, autocomplete: true}) %>
35
+ <%= pb_rails("typeahead", props: {
36
+ id: "typeahead-default",
37
+ placeholder: "Select one...",
38
+ options: options,
39
+ name: :foo,
40
+ margin_top: "sm",
41
+ is_multi: false
42
+ })
43
+ %>
13
44
 
14
45
  <% end %>
15
46
  <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-complex"}) %>
@@ -143,25 +143,30 @@ export default class PbDialog extends PbEnhancedElement {
143
143
 
144
144
  // Close dialog box on outside click
145
145
  dialogs.forEach((dialogElement) => {
146
- const originalMousedownHandler = dialogElement._outsideClickHandler
147
- if (originalMousedownHandler) dialogElement.removeEventListener("mousedown", originalMousedownHandler)
146
+ const originalClickHandler = dialogElement._outsideClickHandler
147
+ if (originalClickHandler) dialogElement.removeEventListener("click", originalClickHandler)
148
+
148
149
  dialogElement._outsideClickHandler = (event) => {
149
150
  const dialogParentDataset = dialogElement.parentElement.dataset
150
151
  if (dialogParentDataset.overlayClick === "overlay_close") return
151
152
 
152
- const dialogModal = event.target.getBoundingClientRect()
153
- const clickedOutsideDialogModal = event.clientX < dialogModal.left ||
154
- event.clientX > dialogModal.right ||
155
- event.clientY < dialogModal.top ||
156
- event.clientY > dialogModal.bottom
157
-
158
- if (clickedOutsideDialogModal) {
153
+ // Get the dialog's bounding box (the actual content area)
154
+ const rect = dialogElement.getBoundingClientRect()
155
+ const clickedInDialog = (
156
+ event.clientX >= rect.left &&
157
+ event.clientX <= rect.right &&
158
+ event.clientY >= rect.top &&
159
+ event.clientY <= rect.bottom
160
+ )
161
+
162
+ // Only close if clicked outside the dialog content (on the backdrop)
163
+ if (!clickedInDialog) {
159
164
  dialogElement.close()
160
165
  event.stopPropagation()
161
166
  }
162
167
  }
163
168
 
164
- dialogElement.addEventListener("mousedown", dialogElement._outsideClickHandler);
169
+ dialogElement.addEventListener("click", dialogElement._outsideClickHandler);
165
170
  })
166
171
  }
167
172
  }
@@ -1,6 +1,8 @@
1
1
  The multiple container functionality also supports customized dropzone styling as shown here.
2
2
 
3
- In addition to this, the `onDrop` and `onDragEnd` event listeners provide several arguments to allow developers more context from the drag event.
3
+ In addition to this, the `enableCrossContainerPreview` prop can be used on the `DraggableProvider` as shown here to enable dropzone preview for cross-container dragging.
4
+
5
+ With `enableCrossContainerPreview`, the `onDrop` and `onDragEnd` event listeners will also provide several arguments to allow developers more context from the drag event.
4
6
 
5
7
  The `onDrop` callback is triggered when an item is successfully dropped into a container. It provides the following arguments:
6
8
 
@@ -7,18 +7,29 @@ type ClearContainerProps = {
7
7
  id: string,
8
8
  },
9
9
  clearValue: () => void,
10
+ innerProps?: any,
10
11
  }
11
12
 
12
- const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
13
- const { selectProps, clearValue } = props
13
+ const ClearContainer = (props: ClearContainerProps | any): React.ReactElement => {
14
+ const { selectProps, clearValue, innerProps } = props
14
15
  useEffect(() => {
15
16
  document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
16
17
  }, [clearValue, selectProps.id])
17
18
 
19
+ // To stop this from bubbling up when inside a dialog or other modal
20
+ const handleMouseDown = (event: React.MouseEvent) => {
21
+ event.stopPropagation()
22
+ innerProps?.onMouseDown?.(event)
23
+ }
24
+
18
25
  return (
19
26
  <components.ClearIndicator
20
27
  className="clear_indicator"
21
28
  {...props}
29
+ innerProps={{
30
+ ...innerProps,
31
+ onMouseDown: handleMouseDown,
32
+ }}
22
33
  />
23
34
  )
24
35
  }