pebble-web 2.22.1 → 2.24.0-alpha.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.
- package/dist/components/shared/MountTransition.d.ts +4 -4
- package/dist/pebble-web.dev.js +37 -35
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +21 -16
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +20 -15
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +36 -34
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +31 -29
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +30 -28
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +3330 -1832
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +3341 -1843
- package/dist/pebble-web.umd.js.map +1 -1
- package/dist/utils/animation.d.ts +6 -18
- package/package.json +4 -4
- package/src/components/DropDown.tsx +6 -6
- package/src/components/Modal.tsx +10 -11
- package/src/components/Popper.tsx +6 -5
- package/src/components/Sidebar.tsx +1 -1
- package/src/components/Toast.tsx +4 -5
- package/src/components/TypeAhead.tsx +2 -2
- package/src/components/__tests__/__snapshots__/popper.test.tsx.snap +1 -1
- package/src/components/shared/MountTransition.tsx +25 -14
- package/src/utils/animation.ts +13 -4
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
enter: {
|
|
8
|
-
opacity: number;
|
|
9
|
-
transform: string;
|
|
10
|
-
};
|
|
11
|
-
leave: {
|
|
12
|
-
opacity: number;
|
|
13
|
-
transform: string;
|
|
14
|
-
pointerEvents: string;
|
|
15
|
-
};
|
|
16
|
-
config: (_a: boolean, motion: State) => {
|
|
17
|
-
duration: number;
|
|
18
|
-
};
|
|
1
|
+
import { TransitionState, UseTransitionProps } from "react-spring";
|
|
2
|
+
export declare type TransitionPhase = TransitionState["phase"];
|
|
3
|
+
export declare const animationConfig: UseTransitionProps;
|
|
4
|
+
export declare type AnimationStyle = {
|
|
5
|
+
opacity: number;
|
|
6
|
+
transform: string;
|
|
19
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pebble-web",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0-alpha.0",
|
|
4
4
|
"author": "ritz078 <rkritesh078@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/pebble-web.js",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"react-calendar": "^2.19.2",
|
|
38
38
|
"react-ink": "^6.4.0",
|
|
39
39
|
"react-popper": "^1.3.6",
|
|
40
|
-
"react-spring": "^
|
|
40
|
+
"react-spring": "^9.7.4",
|
|
41
41
|
"rheostat": "2.2.0",
|
|
42
42
|
"rifm": "^0.12.0",
|
|
43
43
|
"scroll-into-view-if-needed": "^2.2.25",
|
|
44
44
|
"utility-types": "^3.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"pebble-shared": "^2.
|
|
47
|
+
"pebble-shared": "^2.24.0-alpha.0"
|
|
48
48
|
},
|
|
49
49
|
"greenkeeper": {
|
|
50
50
|
"ignore": [
|
|
51
51
|
"rheostat"
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3c63cc4d331e373b77fd1691b9e907ab1c967dee"
|
|
55
55
|
}
|
|
@@ -4,7 +4,7 @@ import { DropDownButton } from "./Button";
|
|
|
4
4
|
import { dropDownStyle, wrapperStyle } from "./styles/Dropdown.styles";
|
|
5
5
|
import { cx } from "emotion";
|
|
6
6
|
import OutsideClick from "./OutsideClick";
|
|
7
|
-
import { animated } from "react-spring
|
|
7
|
+
import { animated } from "react-spring";
|
|
8
8
|
import MountTransition from "./shared/MountTransition";
|
|
9
9
|
import { Manager, Reference, Popper } from "react-popper";
|
|
10
10
|
import { colors } from "pebble-shared";
|
|
@@ -103,9 +103,9 @@ class DropDown extends React.PureComponent<DropdownProps, DropdownState> {
|
|
|
103
103
|
...style,
|
|
104
104
|
...transitionStyles,
|
|
105
105
|
backgroundColor: colors.white.base,
|
|
106
|
-
transform:
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
transform: transitionStyles.transform.to(
|
|
107
|
+
t => `${style.transform || ""} ${t || ""}`
|
|
108
|
+
),
|
|
109
109
|
transformOrigin: `${arrowProps.style.left || 0}px ${
|
|
110
110
|
arrowProps.style.top || 0
|
|
111
111
|
}px`,
|
|
@@ -113,7 +113,7 @@ class DropDown extends React.PureComponent<DropdownProps, DropdownState> {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
return (
|
|
116
|
-
<div
|
|
116
|
+
<animated.div
|
|
117
117
|
className={cx(dropDownStyle, dropDownClassName)}
|
|
118
118
|
ref={ref}
|
|
119
119
|
style={popperWrapperStyle}
|
|
@@ -123,7 +123,7 @@ class DropDown extends React.PureComponent<DropdownProps, DropdownState> {
|
|
|
123
123
|
toggle: this.toggleDropdown,
|
|
124
124
|
isOpen: _isDropDownOpen
|
|
125
125
|
})}
|
|
126
|
-
</div>
|
|
126
|
+
</animated.div>
|
|
127
127
|
);
|
|
128
128
|
}}
|
|
129
129
|
</Popper>
|
package/src/components/Modal.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { ModalProps } from "./typings/Modal";
|
|
3
3
|
import { modalContainer } from "./styles/Modal.styles";
|
|
4
|
-
import { cx
|
|
4
|
+
import { cx } from "emotion";
|
|
5
5
|
import isBrowser from "is-in-browser";
|
|
6
6
|
import * as ReactDOM from "react-dom";
|
|
7
7
|
import MountTransition from "./shared/MountTransition";
|
|
8
|
+
import { animated } from "react-spring";
|
|
8
9
|
|
|
9
10
|
class Modal extends React.PureComponent<ModalProps> {
|
|
10
11
|
private node = isBrowser ? document.createElement("div") : null;
|
|
@@ -41,23 +42,21 @@ class Modal extends React.PureComponent<ModalProps> {
|
|
|
41
42
|
// tslint:disable-next-line:jsx-wrap-multiline
|
|
42
43
|
<MountTransition visible={visible}>
|
|
43
44
|
{transitionStyles => (
|
|
44
|
-
<div
|
|
45
|
+
<animated.div
|
|
45
46
|
style={{
|
|
46
47
|
opacity: transitionStyles.opacity
|
|
47
48
|
}}
|
|
48
49
|
className={cx(modalContainer, backDropClassName)}
|
|
49
50
|
>
|
|
50
|
-
<div
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
modalClassName
|
|
56
|
-
)}
|
|
51
|
+
<animated.div
|
|
52
|
+
style={{
|
|
53
|
+
transform: transitionStyles.transform
|
|
54
|
+
}}
|
|
55
|
+
className={modalClassName}
|
|
57
56
|
>
|
|
58
57
|
{children}
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
58
|
+
</animated.div>
|
|
59
|
+
</animated.div>
|
|
61
60
|
)}
|
|
62
61
|
</MountTransition>,
|
|
63
62
|
node as NonNullable<typeof node>
|
|
@@ -6,6 +6,7 @@ import { colors } from "pebble-shared";
|
|
|
6
6
|
import { cx } from "emotion";
|
|
7
7
|
import OutsideClick from "./OutsideClick";
|
|
8
8
|
import MountTransition from "./shared/MountTransition";
|
|
9
|
+
import { animated } from "react-spring";
|
|
9
10
|
|
|
10
11
|
export default class PebblePopper extends React.PureComponent<
|
|
11
12
|
PopperProps,
|
|
@@ -71,16 +72,16 @@ export default class PebblePopper extends React.PureComponent<
|
|
|
71
72
|
...style,
|
|
72
73
|
...transitionStyles,
|
|
73
74
|
backgroundColor: popperBackgroundColor,
|
|
74
|
-
transform:
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
transform: transitionStyles.transform.to(
|
|
76
|
+
t => `${style.transform || ""} ${t || ""}`
|
|
77
|
+
),
|
|
77
78
|
transformOrigin: `${arrowProps.style.left || 0}px ${
|
|
78
79
|
arrowProps.style.top || 0
|
|
79
80
|
}px`
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
return (
|
|
83
|
-
<div
|
|
84
|
+
<animated.div
|
|
84
85
|
className={cx(popperStyle, popperClassName)}
|
|
85
86
|
ref={ref}
|
|
86
87
|
style={wrapperStyle}
|
|
@@ -101,7 +102,7 @@ export default class PebblePopper extends React.PureComponent<
|
|
|
101
102
|
>
|
|
102
103
|
▶
|
|
103
104
|
</div>
|
|
104
|
-
</div>
|
|
105
|
+
</animated.div>
|
|
105
106
|
);
|
|
106
107
|
}}
|
|
107
108
|
</Popper>
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
sidebarWrapperStyle
|
|
6
6
|
} from "./styles/Sidebar.styles";
|
|
7
7
|
import { SidebarProps } from "./typings/Sidebar";
|
|
8
|
-
import { animated } from "react-spring
|
|
8
|
+
import { animated } from "react-spring";
|
|
9
9
|
import Ink from "react-ink";
|
|
10
10
|
import { css, cx } from "emotion";
|
|
11
11
|
import { disableScrollY } from "../theme/styles";
|
package/src/components/Toast.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ToastType,
|
|
8
8
|
ToastPosition
|
|
9
9
|
} from "./typings/Toast";
|
|
10
|
-
import { Transition, animated } from "react-spring
|
|
10
|
+
import { Transition, animated } from "react-spring";
|
|
11
11
|
import { cx } from "emotion";
|
|
12
12
|
import mitt from "mitt";
|
|
13
13
|
import { animationConfig } from "../utils/animation";
|
|
@@ -188,9 +188,8 @@ class Toast extends React.PureComponent<ToastProps, ToastState> {
|
|
|
188
188
|
}}
|
|
189
189
|
config={animationConfig.config}
|
|
190
190
|
>
|
|
191
|
-
{show =>
|
|
192
|
-
show &&
|
|
193
|
-
(styles => (
|
|
191
|
+
{(styles, show) =>
|
|
192
|
+
show && (
|
|
194
193
|
<animated.div
|
|
195
194
|
className={cx(toastWrapper, this.props.className)}
|
|
196
195
|
style={{
|
|
@@ -202,7 +201,7 @@ class Toast extends React.PureComponent<ToastProps, ToastState> {
|
|
|
202
201
|
<i className={iconClass} />
|
|
203
202
|
{this.state.text}
|
|
204
203
|
</animated.div>
|
|
205
|
-
)
|
|
204
|
+
)
|
|
206
205
|
}
|
|
207
206
|
</Transition>
|
|
208
207
|
);
|
|
@@ -10,7 +10,7 @@ import Input from "./Input";
|
|
|
10
10
|
import { optionsWrapper, wrapper } from "./styles/TypeAhead.styles";
|
|
11
11
|
import OutsideClick from "./OutsideClick";
|
|
12
12
|
import OptionGroupRadio from "./OptionGroupRadio";
|
|
13
|
-
import { animated } from "react-spring
|
|
13
|
+
import { animated } from "react-spring";
|
|
14
14
|
import MountTransition from "./shared/MountTransition";
|
|
15
15
|
|
|
16
16
|
function defaultSearchBox<OptionType>(
|
|
@@ -121,7 +121,7 @@ export default class TypeAhead<OptionType> extends React.PureComponent<
|
|
|
121
121
|
this.props
|
|
122
122
|
)}
|
|
123
123
|
|
|
124
|
-
<MountTransition visible={showSuggestions}
|
|
124
|
+
<MountTransition visible={showSuggestions}>
|
|
125
125
|
{transitionStyles => (
|
|
126
126
|
<animated.div
|
|
127
127
|
style={transitionStyles}
|
|
@@ -1,29 +1,40 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import {
|
|
3
|
-
State,
|
|
4
3
|
Transition,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
UseTransitionProps,
|
|
5
|
+
SpringValues,
|
|
6
|
+
TransitionComponentProps
|
|
7
|
+
} from "react-spring";
|
|
8
|
+
import {
|
|
9
|
+
animationConfig,
|
|
10
|
+
TransitionPhase,
|
|
11
|
+
AnimationStyle
|
|
12
|
+
} from "../../utils/animation";
|
|
9
13
|
|
|
10
|
-
interface MountTransitionProps
|
|
11
|
-
extends Omit<Omit<TransitionProps<boolean>, "items">, "children"> {
|
|
14
|
+
interface MountTransitionProps extends UseTransitionProps<boolean> {
|
|
12
15
|
visible: boolean;
|
|
13
16
|
children: (
|
|
14
|
-
params:
|
|
15
|
-
state:
|
|
17
|
+
params: SpringValues<AnimationStyle>,
|
|
18
|
+
state: TransitionPhase,
|
|
16
19
|
index: number
|
|
17
20
|
) => React.ReactNode;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
const MountTransition: React.FunctionComponent<MountTransitionProps> = props => {
|
|
21
24
|
return (
|
|
22
|
-
<Transition
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
<Transition<boolean, TransitionComponentProps<boolean>>
|
|
26
|
+
items={props.visible}
|
|
27
|
+
{...animationConfig}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
{(styles, show, { phase }, index) => {
|
|
31
|
+
if (!show) return null;
|
|
32
|
+
return props.children(
|
|
33
|
+
styles as SpringValues<AnimationStyle>,
|
|
34
|
+
phase,
|
|
35
|
+
index
|
|
36
|
+
);
|
|
37
|
+
}}
|
|
27
38
|
</Transition>
|
|
28
39
|
);
|
|
29
40
|
};
|
package/src/utils/animation.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransitionState, UseTransitionProps } from "react-spring";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// TransitionPhase enum is not exported by react-spring package
|
|
4
|
+
// so we alias it as a type here
|
|
5
|
+
export type TransitionPhase = TransitionState["phase"];
|
|
6
|
+
|
|
7
|
+
export const animationConfig: UseTransitionProps = {
|
|
4
8
|
from: { opacity: 0, transform: "scale(0.95)" },
|
|
5
9
|
enter: { opacity: 1, transform: "scale(1)" },
|
|
6
10
|
leave: { opacity: 0, transform: "scale(0.95)", pointerEvents: "none" },
|
|
7
|
-
config: (
|
|
8
|
-
|
|
11
|
+
config: (_show: boolean, _index: number, state: TransitionPhase) =>
|
|
12
|
+
state === "leave" ? { duration: 80 } : { duration: 200 }
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type AnimationStyle = {
|
|
16
|
+
opacity: number;
|
|
17
|
+
transform: string;
|
|
9
18
|
};
|