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: cffd8ae39a8b80f013b9bc0fca179e7cdd94be62b1bfcba8a786984fbe6bb15a
4
- data.tar.gz: 320820bff742b9b95b6d0867f81782eb6d20edee840ca1e65bd9ecc9fc96d805
3
+ metadata.gz: d042b0ab3d8b097bd1fcf548916bcf509dbe7d2ba6992997d581dcc37b52f6fd
4
+ data.tar.gz: 569c342ad86165547fcd18928e2c17c493492f1f32a9dca6644ad60c6ee259f9
5
5
  SHA512:
6
- metadata.gz: 612b82bdc76521177c494de8203d6a64147a8dc2e6863ad0f28edef9eece3c410236ffa234220ed8c1d0ad69c5b857b8023fa2bf6d0680fec24054f8acd4bbde
7
- data.tar.gz: 24e96215afa640ea123786fb2a3656a91e5bff64e3a49b17598034230949be6b1e6671270cb1dee78edaf3563dee09dd09d5f1a7f6f5c9e1b7ba0c80173f5472
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 'react'
4
- import ReactDOM from 'react-dom'
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 'react-popper'
12
+ } from "react-popper";
12
13
 
13
- import { buildAriaProps, buildCss, buildDataProps, noop } from '../utilities/props'
14
+ import {
15
+ buildAriaProps,
16
+ buildCss,
17
+ buildDataProps,
18
+ noop,
19
+ } from "../utilities/props";
14
20
 
15
- import classnames from 'classnames'
16
- import { globalProps } from '../utilities/globalProps'
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: 'offset',
43
+ name: "offset",
38
44
  options: {
39
45
  offset: [0, 20],
40
46
  },
41
- phase: 'main',
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 = globalProps(props).includes('dark') || !globalProps(props) ? 'p_sm' : globalProps(props)
68
- const overflowHandling = maxHeight || maxWidth ? 'overflow_handling' : ''
69
- const zIndexStyle = zIndex ? { zIndex: zIndex } : {}
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('pb_popover_kit'),
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
- 'pb_popover_body',
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
- export default class PbReactPopover extends React.Component<PbPopoverProps> {
132
- static defaultProps = {
133
- modifiers: [],
134
- offset: false,
135
- placement: 'left',
136
- portal: 'body',
137
- show: false,
138
- shouldClosePopover: noop,
139
- usePortal: true,
140
- }
141
-
142
- componentDidMount() {
143
- const { closeOnClick, shouldClosePopover } = this.props
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
- case 'outside':
155
- if (!targetIsPopover || targetIsReference) {
156
- shouldClosePopover(true)
157
- }
158
- break
159
- case 'inside':
160
- if (targetIsPopover || targetIsReference) {
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
- props: PbPopoverProps
172
-
173
- render() {
174
- const {
175
- className,
176
- children,
177
- modifiers,
178
- offset,
179
- placement,
180
- portal,
181
- reference,
182
- referenceElement,
183
- show,
184
- usePortal,
185
- zIndex,
186
- maxHeight,
187
- maxWidth,
188
- minHeight,
189
- minWidth,
190
- } = this.props
191
-
192
- const popoverComponent = (
193
- <Popover
194
- {...this.props}
195
- className={className}
196
- maxHeight={maxHeight}
197
- maxWidth={maxWidth}
198
- minHeight={minHeight}
199
- minWidth={minWidth}
200
- modifiers={modifiers}
201
- offset={offset}
202
- placement={placement}
203
- referenceElement={referenceElement}
204
- zIndex={zIndex}
205
- >
206
- {children}
207
- </Popover>
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
- </PopperManager>
235
- )
236
- }
237
- }
222
+ </If>
223
+ </PopperManager>
224
+ );
225
+ };
226
+
227
+ export default PbReactPopover;
@@ -31,7 +31,7 @@ const PopoverClose = (props) => {
31
31
  }
32
32
 
33
33
  const handleAnyTogglePopover = () => {
34
- setAnyShowPopover(!showOutsidePopover)
34
+ setAnyShowPopover(!showAnyPopover)
35
35
  }
36
36
 
37
37
  const insidePopoverTrigger = (
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "11.14.0"
5
- VERSION = "11.15.0"
4
+ PREVIOUS_VERSION = "11.15.0"
5
+ VERSION = "11.16.0.pre.alpha.reactupgrade1"
6
6
  end
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.15.0
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: 2022-12-19 00:00:00.000000000 Z
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: '0'
2364
+ version: 1.3.1
2365
2365
  requirements: []
2366
2366
  rubygems_version: 3.3.7
2367
2367
  signing_key: