playbook_ui 11.15.0 → 11.16.0.pre.alpha.reactupgrade1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d042b0ab3d8b097bd1fcf548916bcf509dbe7d2ba6992997d581dcc37b52f6fd
|
4
|
+
data.tar.gz: 569c342ad86165547fcd18928e2c17c493492f1f32a9dca6644ad60c6ee259f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f767315ad846a1277a8226a025c64c30bf24743657314979117872662eee3c24b9647edd3e7ffb4d4dad6655a748f9832206c08745e62417084e1462863e1a9d
|
7
|
+
data.tar.gz: 3694adfc7dc8c7b49911b8935b308ca67daeb9de57a6b30a45ce806e97c64449cd3d5896a7b10d54c801899cb1bd98863170a269ebe187588ca81aad8052ace2
|
@@ -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.16.0.pre.alpha.reactupgrade1
|
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:
|
12
|
+
date: 2023-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -2359,9 +2359,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2359
2359
|
version: '0'
|
2360
2360
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2361
2361
|
requirements:
|
2362
|
-
- - "
|
2362
|
+
- - ">"
|
2363
2363
|
- !ruby/object:Gem::Version
|
2364
|
-
version:
|
2364
|
+
version: 1.3.1
|
2365
2365
|
requirements: []
|
2366
2366
|
rubygems_version: 3.3.7
|
2367
2367
|
signing_key:
|