playbook_ui 12.35.0.pre.alpha.iconpocwebfonts1023 → 12.36.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f37e0af8c1e76bc928e58612e41499b306f81bbde1935ff1175750d099e17d9c
4
- data.tar.gz: 8e71ee2f5da0e0c3656d4da4577a5d1252941192902587d416afc3610b37c225
3
+ metadata.gz: c0a98a2809eb8f345dd7c46ebb952d03d2e5fdc357804e70e344546ab013b8a0
4
+ data.tar.gz: e72f1812fd7f819375cc1788d6eabb2a280bd392a3fb46e2af4b1d8ce022fbd7
5
5
  SHA512:
6
- metadata.gz: 3198daf878227a793bbee0e9c41e1a3451e5d9e9cdc25c9f5cd78d81aaa0135b314d54c020fcbfbb6ff6296331e31c12e1618ec4b432d36e505c7823aef6e1b2
7
- data.tar.gz: afb451764ee139fd5b42152d275d689fc26cc0d158f49ef123cd8f42c99f1cccabbf63271cc8b9b0f1a117fb3a25088f5b83ccd95e53d4dc374534920f2d91cb
6
+ metadata.gz: ce9e6790efcab2fce2080635bdd3331f7a9ae8af497756d5a2c6111a57ac859ce4a73d567f0c51123dcc271ee46f1b2ebc2e02e1af28bed233f860c93850a973
7
+ data.tar.gz: d6d7bcb5b2684b64a05806680f5c9129082888394d2036ef53866121a68622d3a0a01803287b08881836186983fe9f5e4641225333a36bcfbb69fad597829683
@@ -114,5 +114,3 @@
114
114
  @import './utilities/hover';
115
115
 
116
116
  @import 'pb_multi_level_select/multi_level_select';
117
-
118
-
@@ -21,13 +21,17 @@ const dialogHelper = () => {
21
21
 
22
22
  // Close dialog box on outside click
23
23
  dialogs.forEach((dialogElement) => {
24
- dialogElement.addEventListener("click", (event) => {
24
+ dialogElement.addEventListener("mousedown", (event) => {
25
25
  const dialogParentDataset = dialogElement.parentElement.dataset
26
26
  if (dialogParentDataset.overlayClick === "overlay_close") return
27
27
 
28
- const clickedOutsideDialogBox = event.target.classList.contains("pb_dialog_rails")
28
+ const dialogModal = event.target.getBoundingClientRect()
29
+ const clickedOutsideDialogModal = event.clientX < dialogModal.left ||
30
+ event.clientX > dialogModal.right ||
31
+ event.clientY < dialogModal.top ||
32
+ event.clientY > dialogModal.bottom
29
33
 
30
- if (clickedOutsideDialogBox) {
34
+ if (clickedOutsideDialogModal) {
31
35
  dialogElement.close()
32
36
  event.stopPropagation()
33
37
  }
@@ -9,7 +9,6 @@ examples:
9
9
  - icon_sizes: Icon Sizes
10
10
  - icon_custom: Icon Custom
11
11
  - icon_fa_kit: Icon with FontAwesome Kit
12
- - icon_font: Bring Your Own Icon Font
13
12
 
14
13
  react:
15
14
  - icon_default: Icon Default
@@ -2,28 +2,14 @@
2
2
  <%= object.render_svg(object.custom_icon) %>
3
3
  <% elsif object.valid_emoji(object.icon) %>
4
4
  <span class="pb_icon_kit_emoji"><%= object.icon.html_safe %></span>
5
- <% elsif object.font_family.present? %>
6
- <%= content_tag(:i, nil,
7
- id: object.id,
8
- data: object.data,
9
- class: object.icon_font_classname,
10
- style:
11
- "font-family: #{object.font_family.to_s};font-size: #{object.size.to_s.match?(/x/) ? object.size.to_s.gsub(/x/, '').to_i : object.size.to_s}em;"
12
- ) %>
13
- <%= content_tag(:span, nil,
14
- aria: { label: "#{object.icon} icon" }.merge(object.aria),
15
- hidden: true
16
- ) %>
17
5
  <% else %>
18
6
  <%= content_tag(:i, nil,
19
7
  id: object.id,
20
8
  data: object.data,
21
- class: object.classname,
9
+ class: object.classname
22
10
  ) %>
23
11
  <%= content_tag(:span, nil,
24
12
  aria: { label: "#{object.icon} icon" }.merge(object.aria),
25
13
  hidden: true
26
14
  ) %>
27
15
  <% end %>
28
-
29
-
@@ -15,8 +15,6 @@ module Playbook
15
15
  values: ["horizontal", "vertical", "both", nil],
16
16
  default: nil
17
17
  prop :icon
18
- prop :font_family, type: Playbook::Props::String,
19
- default: nil
20
18
  prop :custom_icon, type: Playbook::Props::String,
21
19
  default: nil
22
20
  prop :inverse, type: Playbook::Props::Boolean,
@@ -39,8 +37,6 @@ module Playbook
39
37
  default: "far"
40
38
  prop :spin, type: Playbook::Props::Boolean,
41
39
  default: false
42
- prop :prefix, type: Playbook::Props::String,
43
- default: "fa"
44
40
 
45
41
  def valid_emoji(icon)
46
42
  emoji_regex = /\p{Emoji}/
@@ -66,24 +62,6 @@ module Playbook
66
62
  )
67
63
  end
68
64
 
69
- def icon_font_classname
70
- generate_classname(
71
- "pb_icon_kit",
72
- icon_class,
73
- border_class,
74
- fixed_width_class,
75
- flip_class,
76
- inverse_class,
77
- list_item_class,
78
- pull_class,
79
- pulse_class,
80
- rotation_class,
81
- size_class,
82
- spin_class,
83
- separator: " "
84
- )
85
- end
86
-
87
65
  def custom_icon_classname
88
66
  generate_classname(
89
67
  "pb_icon_kit",
@@ -123,7 +101,7 @@ module Playbook
123
101
  end
124
102
 
125
103
  def icon_class
126
- icon ? "#{prefix}-#{icon}" : nil
104
+ icon ? "fa-#{icon}" : nil
127
105
  end
128
106
 
129
107
  def inverse_class
@@ -158,7 +136,7 @@ module Playbook
158
136
  end
159
137
 
160
138
  def size_class
161
- size ? "#{prefix}-#{size}" : nil
139
+ size ? "fa-#{size}" : nil
162
140
  end
163
141
 
164
142
  def font_style_class
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from "react";
1
+ import React, { useEffect, useState } from "react";
2
2
  import ReactDOM from "react-dom";
3
3
  import {
4
4
  Popper,
@@ -17,6 +17,7 @@ import {
17
17
 
18
18
  import classnames from "classnames";
19
19
  import { globalProps, GlobalProps } from "../utilities/globalProps";
20
+ import _uniqueId from 'lodash/uniqueId';
20
21
 
21
22
  type PbPopoverProps = {
22
23
  aria?: { [key: string]: string };
@@ -72,6 +73,7 @@ const Popover = (props: PbPopoverProps) => {
72
73
  maxWidth,
73
74
  minHeight,
74
75
  minWidth,
76
+ targetId,
75
77
  } = props;
76
78
 
77
79
  const popoverSpacing =
@@ -123,6 +125,7 @@ const Popover = (props: PbPopoverProps) => {
123
125
  popoverSpacing,
124
126
  overflowHandling
125
127
  )}
128
+ id={targetId}
126
129
  style={widthHeightStyles()}
127
130
  >
128
131
  {children}
@@ -136,6 +139,7 @@ const Popover = (props: PbPopoverProps) => {
136
139
  };
137
140
 
138
141
  const PbReactPopover = (props: PbPopoverProps) => {
142
+ const [targetId] = useState(_uniqueId('id-'))
139
143
  const {
140
144
  className,
141
145
  children,
@@ -163,25 +167,27 @@ const PbReactPopover = (props: PbPopoverProps) => {
163
167
  "click",
164
168
  ({ target }) => {
165
169
  const targetIsPopover =
166
- (target as HTMLElement).closest("[class^=pb_popover_tooltip]") !==
170
+ (target as HTMLElement).closest("#" + targetId) !==
167
171
  null;
168
172
  const targetIsReference =
169
- (target as HTMLElement).closest(".pb_popover_reference_wrapper") !==
173
+ (target as HTMLElement).closest("#reference-" + targetId) !==
170
174
  null;
171
175
 
172
176
  switch (closeOnClick) {
173
177
  case "outside":
174
- if (!targetIsPopover || targetIsReference) {
178
+ if (!targetIsPopover && !targetIsReference) {
175
179
  shouldClosePopover(true);
176
180
  }
177
181
  break;
178
182
  case "inside":
179
- if (targetIsPopover || targetIsReference) {
183
+ if (targetIsPopover) {
180
184
  shouldClosePopover(true);
181
185
  }
182
186
  break;
183
187
  case "any":
184
- shouldClosePopover(true);
188
+ if (targetIsPopover || !targetIsPopover && !targetIsReference) {
189
+ shouldClosePopover(true);
190
+ }
185
191
  break;
186
192
  }
187
193
  },
@@ -200,6 +206,7 @@ const PbReactPopover = (props: PbPopoverProps) => {
200
206
  offset={offset}
201
207
  placement={placement}
202
208
  referenceElement={referenceElement}
209
+ targetId={targetId}
203
210
  zIndex={zIndex}
204
211
  {...props}
205
212
  >
@@ -214,6 +221,7 @@ const PbReactPopover = (props: PbPopoverProps) => {
214
221
  <PopperReference>
215
222
  {({ ref }) => (
216
223
  <span
224
+ id={"reference-" + targetId}
217
225
  className="pb_popover_reference_wrapper"
218
226
  ref={ref}>
219
227
  <reference.type {...reference.props} />
@@ -24,6 +24,7 @@ const PopoverClose = (props) => {
24
24
 
25
25
  const handleOutsideTogglePopover = () => {
26
26
  setOutsideShowPopover(!showOutsidePopover)
27
+ setAnyShowPopover(false)
27
28
  }
28
29
 
29
30
  const handleAnyShouldClosePopover = (shouldClosePopover) => {
@@ -32,6 +33,7 @@ const PopoverClose = (props) => {
32
33
 
33
34
  const handleAnyTogglePopover = () => {
34
35
  setAnyShowPopover(!showAnyPopover)
36
+ setOutsideShowPopover(false)
35
37
  }
36
38
 
37
39
  const insidePopoverTrigger = (
@@ -49,13 +49,16 @@ export default class PbPopover extends PbEnhancedElement {
49
49
  checkCloseTooltip() {
50
50
  document.querySelector('body').addEventListener('click', ({ target } ) => {
51
51
  const isTooltipElement = (target as HTMLElement).closest(`#${this.tooltipId}`) !== null
52
+ const isTriggerElement = (target as HTMLElement).closest(`#${this.triggerElementId}`) !== null
52
53
 
53
54
  switch (this.closeOnClick) {
54
55
  case 'any':
55
- this.hideTooltip()
56
+ if (isTooltipElement || !isTooltipElement && !isTriggerElement) {
57
+ this.hideTooltip()
58
+ }
56
59
  break
57
60
  case 'outside':
58
- if (!isTooltipElement) {
61
+ if (!isTooltipElement && !isTriggerElement) {
59
62
  this.hideTooltip()
60
63
  }
61
64
  break