pebble-web 2.18.0-alpha.0 → 2.18.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.
@@ -1,5 +1,4 @@
1
- import { TransitionState } from "react-spring";
2
- export declare type TransitionPhase = TransitionState["phase"];
1
+ import { State } from "react-spring";
3
2
  export declare const animationConfig: {
4
3
  from: {
5
4
  opacity: number;
@@ -14,11 +13,7 @@ export declare const animationConfig: {
14
13
  transform: string;
15
14
  pointerEvents: string;
16
15
  };
17
- config: (_show: boolean, _index: number, state: TransitionPhase) => {
16
+ config: (_a: boolean, motion: State) => {
18
17
  duration: number;
19
18
  };
20
19
  };
21
- export declare type AnimationStyle = {
22
- opacity: number;
23
- transform: string;
24
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pebble-web",
3
- "version": "2.18.0-alpha.0",
3
+ "version": "2.18.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": "^9.7.4",
40
+ "react-spring": "^8.0.27",
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.18.0-alpha.0"
47
+ "pebble-shared": "^2.18.0"
48
48
  },
49
49
  "greenkeeper": {
50
50
  "ignore": [
51
51
  "rheostat"
52
52
  ]
53
53
  },
54
- "gitHead": "eaa5929a264358381b79fbf6f045799fb5da1ee9"
54
+ "gitHead": "e2964db9563088aa2562132283f3973e01d447a3"
55
55
  }
package/src/.DS_Store CHANGED
Binary file
@@ -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/renderprops.cjs";
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: transitionStyles.transform.to(
107
- t => `${style.transform || ""} ${t || ""}`
108
- ),
106
+ transform: `${style.transform || ""} ${
107
+ transitionStyles.transform || ""
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
- <animated.div
116
+ <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
- </animated.div>
126
+ </div>
127
127
  );
128
128
  }}
129
129
  </Popper>
@@ -1,11 +1,10 @@
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 } from "emotion";
4
+ import { cx, css } 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";
9
8
 
10
9
  class Modal extends React.PureComponent<ModalProps> {
11
10
  private node = isBrowser ? document.createElement("div") : null;
@@ -42,21 +41,23 @@ class Modal extends React.PureComponent<ModalProps> {
42
41
  // tslint:disable-next-line:jsx-wrap-multiline
43
42
  <MountTransition visible={visible}>
44
43
  {transitionStyles => (
45
- <animated.div
44
+ <div
46
45
  style={{
47
46
  opacity: transitionStyles.opacity
48
47
  }}
49
48
  className={cx(modalContainer, backDropClassName)}
50
49
  >
51
- <animated.div
52
- style={{
53
- transform: transitionStyles.transform
54
- }}
55
- className={modalClassName}
50
+ <div
51
+ className={cx(
52
+ css({
53
+ transform: transitionStyles.transform
54
+ }),
55
+ modalClassName
56
+ )}
56
57
  >
57
58
  {children}
58
- </animated.div>
59
- </animated.div>
59
+ </div>
60
+ </div>
60
61
  )}
61
62
  </MountTransition>,
62
63
  node as NonNullable<typeof node>
@@ -6,7 +6,6 @@ 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";
10
9
 
11
10
  export default class PebblePopper extends React.PureComponent<
12
11
  PopperProps,
@@ -72,16 +71,16 @@ export default class PebblePopper extends React.PureComponent<
72
71
  ...style,
73
72
  ...transitionStyles,
74
73
  backgroundColor: popperBackgroundColor,
75
- transform: transitionStyles.transform.to(
76
- t => `${style.transform || ""} ${t || ""}`
77
- ),
74
+ transform: `${style.transform || ""} ${
75
+ transitionStyles.transform || ""
76
+ }`,
78
77
  transformOrigin: `${arrowProps.style.left || 0}px ${
79
78
  arrowProps.style.top || 0
80
79
  }px`
81
80
  };
82
81
 
83
82
  return (
84
- <animated.div
83
+ <div
85
84
  className={cx(popperStyle, popperClassName)}
86
85
  ref={ref}
87
86
  style={wrapperStyle}
@@ -102,7 +101,7 @@ export default class PebblePopper extends React.PureComponent<
102
101
  >
103
102
 
104
103
  </div>
105
- </animated.div>
104
+ </div>
106
105
  );
107
106
  }}
108
107
  </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/renderprops.cjs";
9
9
  import Ink from "react-ink";
10
10
  import { css, cx } from "emotion";
11
11
  import { disableScrollY } from "../theme/styles";
@@ -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/renderprops.cjs";
11
11
  import { cx } from "emotion";
12
12
  import mitt from "mitt";
13
13
  import { animationConfig } from "../utils/animation";
@@ -188,8 +188,9 @@ class Toast extends React.PureComponent<ToastProps, ToastState> {
188
188
  }}
189
189
  config={animationConfig.config}
190
190
  >
191
- {(styles, show) =>
192
- show && (
191
+ {show =>
192
+ show &&
193
+ (styles => (
193
194
  <animated.div
194
195
  className={cx(toastWrapper, this.props.className)}
195
196
  style={{
@@ -201,7 +202,7 @@ class Toast extends React.PureComponent<ToastProps, ToastState> {
201
202
  <i className={iconClass} />
202
203
  {this.state.text}
203
204
  </animated.div>
204
- )
205
+ ))
205
206
  }
206
207
  </Transition>
207
208
  );
@@ -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/renderprops.cjs";
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} native>
125
125
  {transitionStyles => (
126
126
  <animated.div
127
127
  style={transitionStyles}
@@ -142,7 +142,7 @@ exports[`Component: Popper snapshot 1`] = `
142
142
  "pointerEvents": "none",
143
143
  "position": "absolute",
144
144
  "top": 0,
145
- "transform": " scale(0.95)",
145
+ "transform": " scale(0.95)",
146
146
  "transformOrigin": "0px 0px",
147
147
  }
148
148
  }
@@ -1,36 +1,29 @@
1
1
  import * as React from "react";
2
- import { Transition, UseTransitionProps, SpringValues } from "react-spring";
3
2
  import {
4
- animationConfig,
5
- TransitionPhase,
6
- AnimationStyle
7
- } from "../../utils/animation";
3
+ State,
4
+ Transition,
5
+ TransitionProps
6
+ } from "react-spring/renderprops.cjs";
7
+ import { animationConfig } from "../../utils/animation";
8
+ import { Omit } from "utility-types";
8
9
 
9
- interface MountTransitionProps extends UseTransitionProps<boolean> {
10
+ interface MountTransitionProps
11
+ extends Omit<Omit<TransitionProps<boolean>, "items">, "children"> {
10
12
  visible: boolean;
11
13
  children: (
12
- params: SpringValues<AnimationStyle>,
13
- state: TransitionPhase,
14
+ params: React.CSSProperties,
15
+ state: State,
14
16
  index: number
15
17
  ) => React.ReactNode;
16
18
  }
17
19
 
18
20
  const MountTransition: React.FunctionComponent<MountTransitionProps> = props => {
19
21
  return (
20
- <Transition
21
- // @ts-expect-error
22
- items={props.visible}
23
- {...animationConfig}
24
- {...props}
25
- >
26
- {(styles, show, { phase }, index) => {
27
- if (!show) return null;
28
- return props.children(
29
- styles as SpringValues<AnimationStyle>,
30
- phase,
31
- index
32
- );
33
- }}
22
+ <Transition items={props.visible} {...animationConfig} {...props}>
23
+ {(show, state, index) =>
24
+ show &&
25
+ (styles => props.children(styles as React.CSSProperties, state, index))
26
+ }
34
27
  </Transition>
35
28
  );
36
29
  };
@@ -1,18 +1,9 @@
1
- import { TransitionState } from "react-spring";
2
-
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"];
1
+ import { State } from "react-spring";
6
2
 
7
3
  export const animationConfig = {
8
4
  from: { opacity: 0, transform: "scale(0.95)" },
9
5
  enter: { opacity: 1, transform: "scale(1)" },
10
6
  leave: { opacity: 0, transform: "scale(0.95)", pointerEvents: "none" },
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;
7
+ config: (_a: boolean, motion: State) =>
8
+ motion === "leave" ? { duration: 80 } : { duration: 200 }
18
9
  };