playbook_ui 11.16.0 → 11.17.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e30317c6abf3a057219669c5c7adab53460641afbbff126d729e4f0d1c6d3d87
|
4
|
+
data.tar.gz: d4c0d860a57a34ef50fdd7df5dca5f04b7634ee4298ddbb22f821b1ee4f13781
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9a433cbb717a4f6c08aac8c75ef0a6ab4b68c23e3c36c7ab0ee06887ada621855b7721697b094820cd6485115fc2b8f04c1b3e9338a5807e0010734c8c6d963
|
7
|
+
data.tar.gz: 194614449c6010f2d43b323440bd822c68ac37a171cbbecc1c20fc8ee6e24eba02c017568c77890f5b141afe1957776d9891cb5f58f7ddd01dfb0f174900e524
|
@@ -1,19 +1,25 @@
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
1
2
|
// @flow
|
2
3
|
|
3
|
-
import React from
|
4
|
-
import ReactDOM from
|
4
|
+
import React, {useEffect} from "react";
|
5
|
+
import ReactDOM from "react-dom";
|
5
6
|
|
6
7
|
import {
|
7
8
|
Popper,
|
8
9
|
Manager as PopperManager,
|
9
10
|
PopperProps,
|
10
11
|
Reference as PopperReference,
|
11
|
-
} from
|
12
|
+
} from "react-popper";
|
12
13
|
|
13
|
-
import {
|
14
|
+
import {
|
15
|
+
buildAriaProps,
|
16
|
+
buildCss,
|
17
|
+
buildDataProps,
|
18
|
+
noop,
|
19
|
+
} from "../utilities/props";
|
14
20
|
|
15
|
-
import classnames from
|
16
|
-
import { globalProps } from
|
21
|
+
import classnames from "classnames";
|
22
|
+
import { globalProps } from "../utilities/globalProps";
|
17
23
|
|
18
24
|
type PbPopoverProps = {
|
19
25
|
aria?: object,
|
@@ -25,7 +31,7 @@ type PbPopoverProps = {
|
|
25
31
|
reference: PopperReference,
|
26
32
|
show?: boolean,
|
27
33
|
shouldClosePopover?: () => boolean,
|
28
|
-
} & PopperProps
|
34
|
+
} & PopperProps;
|
29
35
|
|
30
36
|
// Prop enabled default modifiers here
|
31
37
|
// https://popper.js.org/docs/v2/modifiers
|
@@ -34,17 +40,17 @@ const POPOVER_MODIFIERS = {
|
|
34
40
|
offset: {
|
35
41
|
//https://popper.js.org/docs/v2/modifiers/offset/
|
36
42
|
enabled: true,
|
37
|
-
name:
|
43
|
+
name: "offset",
|
38
44
|
options: {
|
39
45
|
offset: [0, 20],
|
40
46
|
},
|
41
|
-
phase:
|
47
|
+
phase: "main",
|
42
48
|
},
|
43
|
-
}
|
49
|
+
};
|
44
50
|
|
45
51
|
const popoverModifiers = ({ modifiers, offset }) => {
|
46
|
-
return offset ? modifiers.concat([POPOVER_MODIFIERS.offset]) : modifiers
|
47
|
-
}
|
52
|
+
return offset ? modifiers.concat([POPOVER_MODIFIERS.offset]) : modifiers;
|
53
|
+
};
|
48
54
|
|
49
55
|
const Popover = (props: PbPopoverProps) => {
|
50
56
|
const {
|
@@ -62,11 +68,14 @@ const Popover = (props: PbPopoverProps) => {
|
|
62
68
|
maxWidth,
|
63
69
|
minHeight,
|
64
70
|
minWidth,
|
65
|
-
} = props
|
66
|
-
|
67
|
-
const popoverSpacing =
|
68
|
-
|
69
|
-
|
71
|
+
} = props;
|
72
|
+
|
73
|
+
const popoverSpacing =
|
74
|
+
globalProps(props).includes("dark") || !globalProps(props)
|
75
|
+
? "p_sm"
|
76
|
+
: globalProps(props);
|
77
|
+
const overflowHandling = maxHeight || maxWidth ? "overflow_handling" : "";
|
78
|
+
const zIndexStyle = zIndex ? { zIndex: zIndex } : {};
|
70
79
|
const widthHeightStyles = () => {
|
71
80
|
return Object.assign(
|
72
81
|
{},
|
@@ -74,15 +83,15 @@ const Popover = (props: PbPopoverProps) => {
|
|
74
83
|
maxWidth ? { maxWidth: maxWidth } : {},
|
75
84
|
minHeight ? { minHeight: minHeight } : {},
|
76
85
|
minWidth ? { minWidth: minWidth } : {}
|
77
|
-
)
|
78
|
-
}
|
79
|
-
const ariaProps = buildAriaProps(aria)
|
80
|
-
const dataProps = buildDataProps(data)
|
86
|
+
);
|
87
|
+
};
|
88
|
+
const ariaProps = buildAriaProps(aria);
|
89
|
+
const dataProps = buildDataProps(data);
|
81
90
|
const classes = classnames(
|
82
|
-
buildCss(
|
91
|
+
buildCss("pb_popover_kit"),
|
83
92
|
globalProps(props),
|
84
93
|
className
|
85
|
-
)
|
94
|
+
);
|
86
95
|
|
87
96
|
return (
|
88
97
|
<Popper
|
@@ -99,20 +108,14 @@ const Popover = (props: PbPopoverProps) => {
|
|
99
108
|
data-placement={placement}
|
100
109
|
id={id}
|
101
110
|
ref={ref}
|
102
|
-
style={Object.assign(
|
103
|
-
{},
|
104
|
-
style,
|
105
|
-
zIndexStyle
|
106
|
-
)}
|
111
|
+
style={Object.assign({}, style, zIndexStyle)}
|
107
112
|
>
|
108
113
|
<div
|
109
|
-
className={classnames(
|
110
|
-
`${buildCss('pb_popover_tooltip')} show`
|
111
|
-
)}
|
114
|
+
className={classnames(`${buildCss("pb_popover_tooltip")} show`)}
|
112
115
|
>
|
113
116
|
<div
|
114
117
|
className={classnames(
|
115
|
-
|
118
|
+
"pb_popover_body",
|
116
119
|
popoverSpacing,
|
117
120
|
overflowHandling
|
118
121
|
)}
|
@@ -122,25 +125,33 @@ const Popover = (props: PbPopoverProps) => {
|
|
122
125
|
</div>
|
123
126
|
</div>
|
124
127
|
</div>
|
125
|
-
)
|
128
|
+
);
|
126
129
|
}}
|
127
130
|
</Popper>
|
128
|
-
)
|
129
|
-
}
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
131
|
+
);
|
132
|
+
};
|
133
|
+
|
134
|
+
const PbReactPopover = (props: PbPopoverProps) => {
|
135
|
+
const {
|
136
|
+
className,
|
137
|
+
children,
|
138
|
+
modifiers = [],
|
139
|
+
offset = false,
|
140
|
+
placement = "left",
|
141
|
+
portal = "body",
|
142
|
+
reference,
|
143
|
+
referenceElement,
|
144
|
+
show = false,
|
145
|
+
usePortal = true,
|
146
|
+
zIndex,
|
147
|
+
maxHeight,
|
148
|
+
maxWidth,
|
149
|
+
minHeight,
|
150
|
+
minWidth,
|
151
|
+
} = props;
|
152
|
+
|
153
|
+
useEffect(() => {
|
154
|
+
const { closeOnClick, shouldClosePopover = noop } = props
|
144
155
|
|
145
156
|
if (!closeOnClick) return
|
146
157
|
|
@@ -151,87 +162,66 @@ export default class PbReactPopover extends React.Component<PbPopoverProps> {
|
|
151
162
|
target.closest('.pb_popover_reference_wrapper') !== null
|
152
163
|
|
153
164
|
switch (closeOnClick) {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
165
|
+
case 'outside':
|
166
|
+
if (!targetIsPopover || targetIsReference) {
|
167
|
+
shouldClosePopover(true)
|
168
|
+
}
|
169
|
+
break
|
170
|
+
case 'inside':
|
171
|
+
if (targetIsPopover || targetIsReference) {
|
172
|
+
shouldClosePopover(true)
|
173
|
+
}
|
174
|
+
break
|
175
|
+
case 'any':
|
161
176
|
shouldClosePopover(true)
|
162
|
-
|
163
|
-
break
|
164
|
-
case 'any':
|
165
|
-
shouldClosePopover(true)
|
166
|
-
break
|
177
|
+
break
|
167
178
|
}
|
168
|
-
})
|
169
|
-
}
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
return (
|
211
|
-
<PopperManager>
|
212
|
-
<If condition={reference && !referenceElement}>
|
213
|
-
<PopperReference>
|
214
|
-
{({ ref }) => (
|
215
|
-
<span
|
216
|
-
className="pb_popover_reference_wrapper"
|
217
|
-
ref={ref}
|
218
|
-
>
|
219
|
-
<reference.type {...reference.props} />
|
220
|
-
</span>
|
221
|
-
)}
|
222
|
-
</PopperReference>
|
223
|
-
</If>
|
224
|
-
<If condition={show}>
|
225
|
-
<If condition={usePortal}>
|
226
|
-
{ReactDOM.createPortal(
|
227
|
-
popoverComponent,
|
228
|
-
document.querySelector(portal)
|
229
|
-
)}
|
230
|
-
<Else />
|
231
|
-
{popoverComponent}
|
232
|
-
</If>
|
179
|
+
}, { capture: true })
|
180
|
+
}, [])
|
181
|
+
|
182
|
+
const popoverComponent = (
|
183
|
+
<Popover
|
184
|
+
className={className}
|
185
|
+
maxHeight={maxHeight}
|
186
|
+
maxWidth={maxWidth}
|
187
|
+
minHeight={minHeight}
|
188
|
+
minWidth={minWidth}
|
189
|
+
modifiers={modifiers}
|
190
|
+
offset={offset}
|
191
|
+
placement={placement}
|
192
|
+
referenceElement={referenceElement}
|
193
|
+
zIndex={zIndex}
|
194
|
+
{...props}
|
195
|
+
>
|
196
|
+
{children}
|
197
|
+
</Popover>
|
198
|
+
);
|
199
|
+
|
200
|
+
return (
|
201
|
+
<PopperManager>
|
202
|
+
<If condition={reference && !referenceElement}>
|
203
|
+
<PopperReference>
|
204
|
+
{({ ref }) => (
|
205
|
+
<span className="pb_popover_reference_wrapper"
|
206
|
+
ref={ref}
|
207
|
+
>
|
208
|
+
<reference.type {...reference.props} />
|
209
|
+
</span>
|
210
|
+
)}
|
211
|
+
</PopperReference>
|
212
|
+
</If>
|
213
|
+
<If condition={show}>
|
214
|
+
<If condition={usePortal}>
|
215
|
+
{ReactDOM.createPortal(
|
216
|
+
popoverComponent,
|
217
|
+
document.querySelector(portal)
|
218
|
+
)}
|
219
|
+
<Else />
|
220
|
+
{popoverComponent}
|
233
221
|
</If>
|
234
|
-
</
|
235
|
-
|
236
|
-
|
237
|
-
}
|
222
|
+
</If>
|
223
|
+
</PopperManager>
|
224
|
+
);
|
225
|
+
};
|
226
|
+
|
227
|
+
export default PbReactPopover;
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-01-
|
12
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|