@chayns-components/swipeable-wrapper 5.0.0-beta.1003 → 5.0.0-beta.1005

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.
Files changed (20) hide show
  1. package/lib/cjs/components/swipeable-wrapper/SwipeableWrapper.js +20 -20
  2. package/lib/cjs/components/swipeable-wrapper/SwipeableWrapper.js.map +1 -1
  3. package/lib/cjs/components/swipeable-wrapper/SwipeableWrapper.styles.js +2 -2
  4. package/lib/cjs/components/swipeable-wrapper/SwipeableWrapper.styles.js.map +1 -1
  5. package/lib/cjs/components/swipeable-wrapper/swipeable-action/SwipeableAction.js +11 -11
  6. package/lib/cjs/components/swipeable-wrapper/swipeable-action/SwipeableAction.js.map +1 -1
  7. package/lib/cjs/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.js +2 -2
  8. package/lib/cjs/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.js.map +1 -1
  9. package/lib/esm/components/swipeable-wrapper/SwipeableWrapper.js +1 -1
  10. package/lib/esm/components/swipeable-wrapper/SwipeableWrapper.js.map +1 -1
  11. package/lib/esm/components/swipeable-wrapper/SwipeableWrapper.styles.js +1 -1
  12. package/lib/esm/components/swipeable-wrapper/SwipeableWrapper.styles.js.map +1 -1
  13. package/lib/esm/components/swipeable-wrapper/swipeable-action/SwipeableAction.js +1 -1
  14. package/lib/esm/components/swipeable-wrapper/swipeable-action/SwipeableAction.js.map +1 -1
  15. package/lib/esm/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.js +1 -1
  16. package/lib/esm/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.js.map +1 -1
  17. package/lib/types/components/swipeable-wrapper/SwipeableWrapper.styles.d.ts +2 -263
  18. package/lib/types/components/swipeable-wrapper/swipeable-action/SwipeableAction.d.ts +1 -1
  19. package/lib/types/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.d.ts +2 -263
  20. package/package.json +4 -4
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _chaynsApi = require("chayns-api");
8
- var _framerMotion = require("framer-motion");
9
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = require("motion/react");
9
+ var _react2 = _interopRequireWildcard(require("react"));
10
10
  var _threshold = require("../../utils/threshold");
11
11
  var _SwipeableAction = _interopRequireWildcard(require("./swipeable-action/SwipeableAction"));
12
12
  var _SwipeableWrapper = require("./SwipeableWrapper.styles");
@@ -18,34 +18,34 @@ const SwipeableWrapper = ({
18
18
  rightActions = [],
19
19
  shouldUseOpacityAnimation
20
20
  }) => {
21
- const [leftThreshold, setLeftThreshold] = (0, _react.useState)((0, _threshold.calcThreshold)({
21
+ const [leftThreshold, setLeftThreshold] = (0, _react2.useState)((0, _threshold.calcThreshold)({
22
22
  actionCount: leftActions.length,
23
23
  direction: 'left',
24
24
  width: window.innerWidth
25
25
  }));
26
- const [rightThreshold, setRightThreshold] = (0, _react.useState)((0, _threshold.calcThreshold)({
26
+ const [rightThreshold, setRightThreshold] = (0, _react2.useState)((0, _threshold.calcThreshold)({
27
27
  actionCount: rightActions.length,
28
28
  direction: 'right',
29
29
  width: window.innerWidth
30
30
  }));
31
- const swipeableWrapperRef = (0, _react.useRef)(null);
32
- const listItemXOffset = (0, _framerMotion.useMotionValue)(0);
33
- const close = (0, _react.useCallback)(() => {
34
- void (0, _framerMotion.animate)(listItemXOffset, 0);
31
+ const swipeableWrapperRef = (0, _react2.useRef)(null);
32
+ const listItemXOffset = (0, _react.useMotionValue)(0);
33
+ const close = (0, _react2.useCallback)(() => {
34
+ void (0, _react.animate)(listItemXOffset, 0);
35
35
  }, [listItemXOffset]);
36
- const open = (0, _react.useCallback)(direction => {
36
+ const open = (0, _react2.useCallback)(direction => {
37
37
  switch (direction) {
38
38
  case 'left':
39
- void (0, _framerMotion.animate)(listItemXOffset, _SwipeableAction.SWIPEABLE_ACTION_WIDTH * leftActions.length);
39
+ void (0, _react.animate)(listItemXOffset, _SwipeableAction.SWIPEABLE_ACTION_WIDTH * leftActions.length);
40
40
  break;
41
41
  case 'right':
42
- void (0, _framerMotion.animate)(listItemXOffset, -_SwipeableAction.SWIPEABLE_ACTION_WIDTH * rightActions.length);
42
+ void (0, _react.animate)(listItemXOffset, -_SwipeableAction.SWIPEABLE_ACTION_WIDTH * rightActions.length);
43
43
  break;
44
44
  default:
45
45
  break;
46
46
  }
47
47
  }, [leftActions.length, listItemXOffset, rightActions.length]);
48
- (0, _react.useEffect)(() => {
48
+ (0, _react2.useEffect)(() => {
49
49
  var _swipeableWrapperRef$;
50
50
  const width = (_swipeableWrapperRef$ = swipeableWrapperRef.current) === null || _swipeableWrapperRef$ === void 0 || (_swipeableWrapperRef$ = _swipeableWrapperRef$.parentElement) === null || _swipeableWrapperRef$ === void 0 ? void 0 : _swipeableWrapperRef$.offsetWidth;
51
51
 
@@ -65,7 +65,7 @@ const SwipeableWrapper = ({
65
65
  }, [leftActions.length, rightActions.length]);
66
66
 
67
67
  // Close an opened menu when anything outside it is tapped
68
- (0, _react.useEffect)(() => {
68
+ (0, _react2.useEffect)(() => {
69
69
  function closeCallback(event) {
70
70
  var _swipeableWrapperRef$2;
71
71
  const eventTarget = event.target;
@@ -84,7 +84,7 @@ const SwipeableWrapper = ({
84
84
  }, [close]);
85
85
 
86
86
  // Vibrate when the threshold is passed
87
- (0, _react.useEffect)(() => listItemXOffset.onChange(newValue => {
87
+ (0, _react2.useEffect)(() => listItemXOffset.onChange(newValue => {
88
88
  const previous = listItemXOffset.getPrevious();
89
89
  if (!previous) {
90
90
  return;
@@ -98,14 +98,14 @@ const SwipeableWrapper = ({
98
98
  });
99
99
  }
100
100
  }), [leftThreshold, listItemXOffset, rightThreshold]);
101
- const handlePan = (0, _react.useCallback)((_, info) => {
101
+ const handlePan = (0, _react2.useCallback)((_, info) => {
102
102
  const currentXOffset = listItemXOffset.get();
103
103
  const dampingFactor = info.offset.x > 0 && leftActions.length > 0 || info.offset.x < 0 && rightActions.length > 0 || currentXOffset > 0 && info.delta.x < 0 || currentXOffset < 0 && info.delta.x > 0 ? 1 : 0.75 / (Math.abs(info.offset.x) / 9);
104
104
  if (Math.abs(info.offset.x) > 30 || currentXOffset > 0) {
105
105
  listItemXOffset.set(currentXOffset + info.delta.x * dampingFactor);
106
106
  }
107
107
  }, [leftActions.length, listItemXOffset, rightActions.length]);
108
- const handlePanEnd = (0, _react.useCallback)(() => {
108
+ const handlePanEnd = (0, _react2.useCallback)(() => {
109
109
  const offset = listItemXOffset.get();
110
110
  if (offset > leftThreshold) {
111
111
  var _leftActions$;
@@ -152,7 +152,7 @@ const SwipeableWrapper = ({
152
152
  }
153
153
  }
154
154
  }, [close, leftActions, leftThreshold, listItemXOffset, open, rightActions, rightThreshold]);
155
- const leftActionElements = (0, _react.useMemo)(() => Array.from(leftActions).reverse().map((item, index) => /*#__PURE__*/_react.default.createElement(_SwipeableAction.default, {
155
+ const leftActionElements = (0, _react2.useMemo)(() => Array.from(leftActions).reverse().map((item, index) => /*#__PURE__*/_react2.default.createElement(_SwipeableAction.default, {
156
156
  activationThreshold: leftThreshold,
157
157
  close: close,
158
158
  index: index,
@@ -163,7 +163,7 @@ const SwipeableWrapper = ({
163
163
  shouldUseOpacityAnimation: shouldUseOpacityAnimation,
164
164
  totalActionCount: leftActions.length
165
165
  })), [close, leftActions, leftThreshold, listItemXOffset, shouldUseOpacityAnimation]);
166
- const rightActionElements = (0, _react.useMemo)(() => rightActions.map((item, index) => /*#__PURE__*/_react.default.createElement(_SwipeableAction.default, {
166
+ const rightActionElements = (0, _react2.useMemo)(() => rightActions.map((item, index) => /*#__PURE__*/_react2.default.createElement(_SwipeableAction.default, {
167
167
  activationThreshold: rightThreshold,
168
168
  close: close,
169
169
  index: index,
@@ -174,14 +174,14 @@ const SwipeableWrapper = ({
174
174
  shouldUseOpacityAnimation: shouldUseOpacityAnimation,
175
175
  totalActionCount: rightActions.length
176
176
  })), [rightActions, rightThreshold, close, listItemXOffset, shouldUseOpacityAnimation]);
177
- return /*#__PURE__*/_react.default.createElement(_SwipeableWrapper.StyledMotionSwipeableWrapper, {
177
+ return /*#__PURE__*/_react2.default.createElement(_SwipeableWrapper.StyledMotionSwipeableWrapper, {
178
178
  onPan: handlePan,
179
179
  onPanEnd: handlePanEnd,
180
180
  ref: swipeableWrapperRef,
181
181
  style: {
182
182
  x: listItemXOffset
183
183
  }
184
- }, leftActionElements, /*#__PURE__*/_react.default.createElement(_SwipeableWrapper.StyledSwipeableWrapperContent, null, children), rightActionElements);
184
+ }, leftActionElements, /*#__PURE__*/_react2.default.createElement(_SwipeableWrapper.StyledSwipeableWrapperContent, null, children), rightActionElements);
185
185
  };
186
186
  SwipeableWrapper.displayName = 'SwipeableWrapper';
187
187
  var _default = exports.default = SwipeableWrapper;
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableWrapper.js","names":["_chaynsApi","require","_framerMotion","_react","_interopRequireWildcard","_threshold","_SwipeableAction","_SwipeableWrapper","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SwipeableWrapper","children","leftActions","rightActions","shouldUseOpacityAnimation","leftThreshold","setLeftThreshold","useState","calcThreshold","actionCount","length","direction","width","window","innerWidth","rightThreshold","setRightThreshold","swipeableWrapperRef","useRef","listItemXOffset","useMotionValue","close","useCallback","animate","open","SWIPEABLE_ACTION_WIDTH","useEffect","_swipeableWrapperRef$","current","parentElement","offsetWidth","closeCallback","event","_swipeableWrapperRef$2","eventTarget","target","contains","document","addEventListener","removeEventListener","onChange","newValue","previous","getPrevious","hasCrossedLeftThreshold","hasCrossedRightThreshold","vibrate","iOSFeedbackVibration","pattern","handlePan","_","info","currentXOffset","dampingFactor","offset","x","delta","Math","abs","handlePanEnd","_leftActions$","action","_rightActions","state","leftActionElements","useMemo","Array","from","reverse","map","item","index","createElement","activationThreshold","key","position","totalActionCount","rightActionElements","StyledMotionSwipeableWrapper","onPan","onPanEnd","ref","style","StyledSwipeableWrapperContent","displayName","_default","exports"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.tsx"],"sourcesContent":["import { vibrate } from 'chayns-api';\nimport { animate, PanInfo, useMotionValue } from 'framer-motion';\nimport React, {\n CSSProperties,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { calcThreshold } from '../../utils/threshold';\nimport SwipeableAction, { SWIPEABLE_ACTION_WIDTH } from './swipeable-action/SwipeableAction';\nimport {\n StyledMotionSwipeableWrapper,\n StyledSwipeableWrapperContent,\n} from './SwipeableWrapper.styles';\n\nexport type SwipeableActionItem = {\n action: VoidFunction;\n backgroundColor: CSSProperties['backgroundColor'];\n color: CSSProperties['color'];\n text?: ReactNode;\n icon: ReactNode;\n key: string;\n};\n\nexport type SwipeableWrapperProps = {\n /**\n * The content of the Swipeable item.\n */\n children: ReactNode;\n /**\n * The left-side actions, ordered from the left to the right.\n */\n leftActions?: SwipeableActionItem[];\n /**\n * The right-side actions, ordered from left to the right.\n */\n rightActions?: SwipeableActionItem[];\n /**\n * Whether the opacity should be animated when swiping in the actions.\n */\n shouldUseOpacityAnimation?: boolean;\n};\n\nconst SwipeableWrapper: FC<SwipeableWrapperProps> = ({\n children,\n leftActions = [],\n rightActions = [],\n shouldUseOpacityAnimation,\n}) => {\n const [leftThreshold, setLeftThreshold] = useState(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width: window.innerWidth,\n }),\n );\n\n const [rightThreshold, setRightThreshold] = useState(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width: window.innerWidth,\n }),\n );\n\n const swipeableWrapperRef = useRef<HTMLDivElement | null>(null);\n\n const listItemXOffset = useMotionValue(0);\n\n const close = useCallback(() => {\n void animate(listItemXOffset, 0);\n }, [listItemXOffset]);\n\n const open = useCallback(\n (direction: 'left' | 'right') => {\n switch (direction) {\n case 'left':\n void animate(listItemXOffset, SWIPEABLE_ACTION_WIDTH * leftActions.length);\n break;\n case 'right':\n void animate(listItemXOffset, -SWIPEABLE_ACTION_WIDTH * rightActions.length);\n break;\n default:\n break;\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n useEffect(() => {\n const width = swipeableWrapperRef.current?.parentElement?.offsetWidth;\n\n // This check was deliberately chosen because a width of 0 is also not permitted.\n if (width) {\n setLeftThreshold(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width,\n }),\n );\n\n setRightThreshold(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width,\n }),\n );\n }\n }, [leftActions.length, rightActions.length]);\n\n // Close an opened menu when anything outside it is tapped\n useEffect(() => {\n function closeCallback(event: MouseEvent | TouchEvent) {\n const eventTarget = event.target;\n\n // @ts-expect-error: Pretty sure that the event target is always a Node.\n if (eventTarget && !swipeableWrapperRef.current?.contains(eventTarget)) {\n close();\n }\n }\n\n document.addEventListener('mousedown', closeCallback);\n document.addEventListener('touchstart', closeCallback);\n\n return () => {\n document.removeEventListener('mousedown', closeCallback);\n document.removeEventListener('touchstart', closeCallback);\n };\n }, [close]);\n\n // Vibrate when the threshold is passed\n useEffect(\n () =>\n listItemXOffset.onChange((newValue: number) => {\n const previous = listItemXOffset.getPrevious();\n\n if (!previous) {\n return;\n }\n\n const hasCrossedLeftThreshold =\n (previous < leftThreshold && newValue >= leftThreshold) ||\n (previous > leftThreshold && newValue <= leftThreshold);\n\n const hasCrossedRightThreshold =\n (previous < rightThreshold && newValue >= rightThreshold) ||\n (previous > rightThreshold && newValue <= rightThreshold);\n\n if (hasCrossedLeftThreshold || hasCrossedRightThreshold) {\n void vibrate({ iOSFeedbackVibration: 6, pattern: [150] });\n }\n }),\n [leftThreshold, listItemXOffset, rightThreshold],\n );\n\n const handlePan = useCallback(\n (_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n const currentXOffset = listItemXOffset.get();\n\n const dampingFactor =\n (info.offset.x > 0 && leftActions.length > 0) ||\n (info.offset.x < 0 && rightActions.length > 0) ||\n (currentXOffset > 0 && info.delta.x < 0) ||\n (currentXOffset < 0 && info.delta.x > 0)\n ? 1\n : 0.75 / (Math.abs(info.offset.x) / 9);\n\n if (Math.abs(info.offset.x) > 30 || currentXOffset > 0) {\n listItemXOffset.set(currentXOffset + info.delta.x * dampingFactor);\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n const handlePanEnd = useCallback(() => {\n const offset = listItemXOffset.get();\n\n if (offset > leftThreshold) {\n leftActions[0]?.action();\n close();\n } else if (offset < rightThreshold) {\n rightActions[rightActions.length - 1]?.action();\n close();\n } else {\n let state: 'left-open' | 'right-open' | 'closed';\n\n if (offset > 2) {\n state = 'left-open';\n } else if (offset < -2) {\n state = 'right-open';\n } else {\n state = 'closed';\n }\n\n // eslint-disable-next-line default-case\n switch (state) {\n case 'left-open':\n if (offset < SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('left');\n }\n break;\n case 'right-open':\n if (offset > -SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('right');\n }\n break;\n case 'closed':\n if (offset > SWIPEABLE_ACTION_WIDTH) {\n open('left');\n } else if (offset < -SWIPEABLE_ACTION_WIDTH) {\n open('right');\n } else {\n close();\n }\n }\n }\n }, [close, leftActions, leftThreshold, listItemXOffset, open, rightActions, rightThreshold]);\n\n const leftActionElements = useMemo(\n () =>\n Array.from(leftActions)\n .reverse()\n .map((item, index) => (\n <SwipeableAction\n activationThreshold={leftThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"left\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={leftActions.length}\n />\n )),\n [close, leftActions, leftThreshold, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n const rightActionElements = useMemo(\n () =>\n rightActions.map((item, index) => (\n <SwipeableAction\n activationThreshold={rightThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"right\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={rightActions.length}\n />\n )),\n [rightActions, rightThreshold, close, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n return (\n <StyledMotionSwipeableWrapper\n onPan={handlePan}\n onPanEnd={handlePanEnd}\n ref={swipeableWrapperRef}\n style={{ x: listItemXOffset }}\n >\n {leftActionElements}\n <StyledSwipeableWrapperContent>{children}</StyledSwipeableWrapperContent>\n {rightActionElements}\n </StyledMotionSwipeableWrapper>\n );\n};\n\nSwipeableWrapper.displayName = 'SwipeableWrapper';\n\nexport default SwipeableWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAUA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAF,uBAAA,CAAAH,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAGmC,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,w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IACzBiE,KAAK,EAAE;MAAE3B,CAAC,EAAEpC;IAAgB;EAAE,GAE7B6C,kBAAkB,eACnBzF,MAAA,CAAAW,OAAA,CAAAsF,aAAA,CAAC7F,iBAAA,CAAAwG,6BAA6B,QAAElF,QAAwC,CAAC,EACxE4E,mBACyB,CAAC;AAEvC,CAAC;AAED7E,gBAAgB,CAACoF,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApG,OAAA,GAEnCc,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableWrapper.js","names":["_chaynsApi","require","_react","_react2","_interopRequireWildcard","_threshold","_SwipeableAction","_SwipeableWrapper","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SwipeableWrapper","children","leftActions","rightActions","shouldUseOpacityAnimation","leftThreshold","setLeftThreshold","useState","calcThreshold","actionCount","length","direction","width","window","innerWidth","rightThreshold","setRightThreshold","swipeableWrapperRef","useRef","listItemXOffset","useMotionValue","close","useCallback","animate","open","SWIPEABLE_ACTION_WIDTH","useEffect","_swipeableWrapperRef$","current","parentElement","offsetWidth","closeCallback","event","_swipeableWrapperRef$2","eventTarget","target","contains","document","addEventListener","removeEventListener","onChange","newValue","previous","getPrevious","hasCrossedLeftThreshold","hasCrossedRightThreshold","vibrate","iOSFeedbackVibration","pattern","handlePan","_","info","currentXOffset","dampingFactor","offset","x","delta","Math","abs","handlePanEnd","_leftActions$","action","_rightActions","state","leftActionElements","useMemo","Array","from","reverse","map","item","index","createElement","activationThreshold","key","position","totalActionCount","rightActionElements","StyledMotionSwipeableWrapper","onPan","onPanEnd","ref","style","StyledSwipeableWrapperContent","displayName","_default","exports"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.tsx"],"sourcesContent":["import { vibrate } from 'chayns-api';\nimport { animate, PanInfo, useMotionValue } from 'motion/react';\nimport React, {\n CSSProperties,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { calcThreshold } from '../../utils/threshold';\nimport SwipeableAction, { SWIPEABLE_ACTION_WIDTH } from './swipeable-action/SwipeableAction';\nimport {\n StyledMotionSwipeableWrapper,\n StyledSwipeableWrapperContent,\n} from './SwipeableWrapper.styles';\n\nexport type SwipeableActionItem = {\n action: VoidFunction;\n backgroundColor: CSSProperties['backgroundColor'];\n color: CSSProperties['color'];\n text?: ReactNode;\n icon: ReactNode;\n key: string;\n};\n\nexport type SwipeableWrapperProps = {\n /**\n * The content of the Swipeable item.\n */\n children: ReactNode;\n /**\n * The left-side actions, ordered from the left to the right.\n */\n leftActions?: SwipeableActionItem[];\n /**\n * The right-side actions, ordered from left to the right.\n */\n rightActions?: SwipeableActionItem[];\n /**\n * Whether the opacity should be animated when swiping in the actions.\n */\n shouldUseOpacityAnimation?: boolean;\n};\n\nconst SwipeableWrapper: FC<SwipeableWrapperProps> = ({\n children,\n leftActions = [],\n rightActions = [],\n shouldUseOpacityAnimation,\n}) => {\n const [leftThreshold, setLeftThreshold] = useState(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width: window.innerWidth,\n }),\n );\n\n const [rightThreshold, setRightThreshold] = useState(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width: window.innerWidth,\n }),\n );\n\n const swipeableWrapperRef = useRef<HTMLDivElement | null>(null);\n\n const listItemXOffset = useMotionValue(0);\n\n const close = useCallback(() => {\n void animate(listItemXOffset, 0);\n }, [listItemXOffset]);\n\n const open = useCallback(\n (direction: 'left' | 'right') => {\n switch (direction) {\n case 'left':\n void animate(listItemXOffset, SWIPEABLE_ACTION_WIDTH * leftActions.length);\n break;\n case 'right':\n void animate(listItemXOffset, -SWIPEABLE_ACTION_WIDTH * rightActions.length);\n break;\n default:\n break;\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n useEffect(() => {\n const width = swipeableWrapperRef.current?.parentElement?.offsetWidth;\n\n // This check was deliberately chosen because a width of 0 is also not permitted.\n if (width) {\n setLeftThreshold(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width,\n }),\n );\n\n setRightThreshold(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width,\n }),\n );\n }\n }, [leftActions.length, rightActions.length]);\n\n // Close an opened menu when anything outside it is tapped\n useEffect(() => {\n function closeCallback(event: MouseEvent | TouchEvent) {\n const eventTarget = event.target;\n\n // @ts-expect-error: Pretty sure that the event target is always a Node.\n if (eventTarget && !swipeableWrapperRef.current?.contains(eventTarget)) {\n close();\n }\n }\n\n document.addEventListener('mousedown', closeCallback);\n document.addEventListener('touchstart', closeCallback);\n\n return () => {\n document.removeEventListener('mousedown', closeCallback);\n document.removeEventListener('touchstart', closeCallback);\n };\n }, [close]);\n\n // Vibrate when the threshold is passed\n useEffect(\n () =>\n listItemXOffset.onChange((newValue: number) => {\n const previous = listItemXOffset.getPrevious();\n\n if (!previous) {\n return;\n }\n\n const hasCrossedLeftThreshold =\n (previous < leftThreshold && newValue >= leftThreshold) ||\n (previous > leftThreshold && newValue <= leftThreshold);\n\n const hasCrossedRightThreshold =\n (previous < rightThreshold && newValue >= rightThreshold) ||\n (previous > rightThreshold && newValue <= rightThreshold);\n\n if (hasCrossedLeftThreshold || hasCrossedRightThreshold) {\n void vibrate({ iOSFeedbackVibration: 6, pattern: [150] });\n }\n }),\n [leftThreshold, listItemXOffset, rightThreshold],\n );\n\n const handlePan = useCallback(\n (_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n const currentXOffset = listItemXOffset.get();\n\n const dampingFactor =\n (info.offset.x > 0 && leftActions.length > 0) ||\n (info.offset.x < 0 && rightActions.length > 0) ||\n (currentXOffset > 0 && info.delta.x < 0) ||\n (currentXOffset < 0 && info.delta.x > 0)\n ? 1\n : 0.75 / (Math.abs(info.offset.x) / 9);\n\n if (Math.abs(info.offset.x) > 30 || currentXOffset > 0) {\n listItemXOffset.set(currentXOffset + info.delta.x * dampingFactor);\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n const handlePanEnd = useCallback(() => {\n const offset = listItemXOffset.get();\n\n if (offset > leftThreshold) {\n leftActions[0]?.action();\n close();\n } else if (offset < rightThreshold) {\n rightActions[rightActions.length - 1]?.action();\n close();\n } else {\n let state: 'left-open' | 'right-open' | 'closed';\n\n if (offset > 2) {\n state = 'left-open';\n } else if (offset < -2) {\n state = 'right-open';\n } else {\n state = 'closed';\n }\n\n // eslint-disable-next-line default-case\n switch (state) {\n case 'left-open':\n if (offset < SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('left');\n }\n break;\n case 'right-open':\n if (offset > -SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('right');\n }\n break;\n case 'closed':\n if (offset > SWIPEABLE_ACTION_WIDTH) {\n open('left');\n } else if (offset < -SWIPEABLE_ACTION_WIDTH) {\n open('right');\n } else {\n close();\n }\n }\n }\n }, [close, leftActions, leftThreshold, listItemXOffset, open, rightActions, rightThreshold]);\n\n const leftActionElements = useMemo(\n () =>\n Array.from(leftActions)\n .reverse()\n .map((item, index) => (\n <SwipeableAction\n activationThreshold={leftThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"left\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={leftActions.length}\n />\n )),\n [close, leftActions, leftThreshold, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n const rightActionElements = useMemo(\n () =>\n rightActions.map((item, index) => (\n <SwipeableAction\n activationThreshold={rightThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"right\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={rightActions.length}\n />\n )),\n [rightActions, rightThreshold, close, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n return (\n <StyledMotionSwipeableWrapper\n onPan={handlePan}\n onPanEnd={handlePanEnd}\n ref={swipeableWrapperRef}\n style={{ x: listItemXOffset }}\n >\n {leftActionElements}\n <StyledSwipeableWrapperContent>{children}</StyledSwipeableWrapperContent>\n {rightActionElements}\n </StyledMotionSwipeableWrapper>\n );\n};\n\nSwipeableWrapper.displayName = 'SwipeableWrapper';\n\nexport default SwipeableWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,uBAAA,CAAAH,OAAA;AAUA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAF,uBAAA,CAAAH,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAGmC,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG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C;AAEvC,CAAC;AAED7E,gBAAgB,CAACoF,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApG,OAAA,GAEnCc,gBAAgB","ignoreList":[]}
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.StyledSwipeableWrapperContent = exports.StyledMotionSwipeableWrapper = void 0;
7
- var _framerMotion = require("framer-motion");
7
+ var _react = require("motion/react");
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const StyledMotionSwipeableWrapper = exports.StyledMotionSwipeableWrapper = (0, _styledComponents.default)(_framerMotion.motion.div)`
10
+ const StyledMotionSwipeableWrapper = exports.StyledMotionSwipeableWrapper = (0, _styledComponents.default)(_react.motion.div)`
11
11
  position: relative;
12
12
  touch-action: pan-y;
13
13
  user-select: none;
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableWrapper.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","e","__esModule","default","StyledMotionSwipeableWrapper","exports","styled","motion","div","StyledSwipeableWrapperContent"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\nexport const StyledMotionSwipeableWrapper = styled(motion.div)<FramerMotionBugFix>`\n position: relative;\n touch-action: pan-y;\n user-select: none;\n`;\n\nexport const StyledSwipeableWrapperContent = styled.div`\n width: 100%;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAG,IAAAE,yBAAM,EAACC,oBAAM,CAACC,GAAG,CAAqB;AAClF;AACA;AACA;AACA,CAAC;AAEM,MAAMC,6BAA6B,GAAAJ,OAAA,CAAAI,6BAAA,GAAGH,yBAAM,CAACE,GAAG;AACvD;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableWrapper.styles.js","names":["_react","require","_styledComponents","_interopRequireDefault","e","__esModule","default","StyledMotionSwipeableWrapper","exports","styled","motion","div","StyledSwipeableWrapperContent"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled from 'styled-components';\n\nexport const StyledMotionSwipeableWrapper = styled(motion.div)<FramerMotionBugFix>`\n position: relative;\n touch-action: pan-y;\n user-select: none;\n`;\n\nexport const StyledSwipeableWrapperContent = styled.div`\n width: 100%;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAG,IAAAE,yBAAM,EAACC,aAAM,CAACC,GAAG,CAAqB;AAClF;AACA;AACA;AACA,CAAC;AAEM,MAAMC,6BAA6B,GAAAJ,OAAA,CAAAI,6BAAA,GAAGH,yBAAM,CAACE,GAAG;AACvD;AACA,CAAC","ignoreList":[]}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.SWIPEABLE_ACTION_WIDTH = void 0;
7
- var _framerMotion = require("framer-motion");
8
- var _react = _interopRequireWildcard(require("react"));
7
+ var _react = require("motion/react");
8
+ var _react2 = _interopRequireWildcard(require("react"));
9
9
  var _SwipeableAction = require("./SwipeableAction.styles");
10
10
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
11
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -20,7 +20,7 @@ const SwipeableAction = ({
20
20
  shouldUseOpacityAnimation,
21
21
  totalActionCount
22
22
  }) => {
23
- const [pointerEvents, setPointerEvents] = _react.default.useState('none');
23
+ const [pointerEvents, setPointerEvents] = _react2.default.useState('none');
24
24
  const handleButtonClick = () => {
25
25
  item.action();
26
26
  close();
@@ -30,7 +30,7 @@ const SwipeableAction = ({
30
30
  * By default, the action sticks to the content of the swipeable item. This
31
31
  * makes it move outwards to reveal the inner items.
32
32
  */
33
- const actionOffset = (0, _framerMotion.useTransform)(listItemXOffset, newValue => {
33
+ const actionOffset = (0, _react.useTransform)(listItemXOffset, newValue => {
34
34
  const maxOffset = SWIPEABLE_ACTION_WIDTH * index;
35
35
  const fractionalOffset = -newValue / totalActionCount * index;
36
36
  switch (position) {
@@ -47,7 +47,7 @@ const SwipeableAction = ({
47
47
  * Brings the item in again if past the threshold. Only relevant for
48
48
  * outermost items.
49
49
  */
50
- const actionOverlayOffset = (0, _framerMotion.useSpring)(0, {
50
+ const actionOverlayOffset = (0, _react.useSpring)(0, {
51
51
  bounce: 0
52
52
  });
53
53
 
@@ -55,19 +55,19 @@ const SwipeableAction = ({
55
55
  * Combines the two values above to create the correct X transform that has
56
56
  * to be applied to the action.
57
57
  */
58
- const actionX = (0, _framerMotion.useTransform)([actionOffset, actionOverlayOffset], ([x, y]) => {
58
+ const actionX = (0, _react.useTransform)([actionOffset, actionOverlayOffset], ([x, y]) => {
59
59
  if (position === 'left') {
60
60
  return Math.min((x ?? 0) + (y ?? 0), 0);
61
61
  }
62
62
  return Math.max((x ?? 0) + (y ?? 0), 0);
63
63
  });
64
- const opacity = (0, _framerMotion.useTransform)(listItemXOffset, x => Math.max(0, Math.min(1, Math.abs(x) / 72)));
65
- (0, _framerMotion.useMotionValueEvent)(opacity, 'change', value => {
64
+ const opacity = (0, _react.useTransform)(listItemXOffset, x => Math.max(0, Math.min(1, Math.abs(x) / 72)));
65
+ (0, _react.useMotionValueEvent)(opacity, 'change', value => {
66
66
  setPointerEvents(value < 0.5 ? 'none' : 'auto');
67
67
  });
68
68
 
69
69
  // Animate to the middle after passing threshold if outermost item
70
- (0, _react.useEffect)(() => {
70
+ (0, _react2.useEffect)(() => {
71
71
  const isOuterMost = index === totalActionCount - 1;
72
72
  if (!isOuterMost) return undefined;
73
73
  return listItemXOffset.onChange(newValue => {
@@ -94,14 +94,14 @@ const SwipeableAction = ({
94
94
  }
95
95
  });
96
96
  }, [actionOverlayOffset, activationThreshold, index, listItemXOffset, position, totalActionCount]);
97
- return /*#__PURE__*/_react.default.createElement(_SwipeableAction.StyledMotionSwipeableAction, {
97
+ return /*#__PURE__*/_react2.default.createElement(_SwipeableAction.StyledMotionSwipeableAction, {
98
98
  $backgroundColor: item.backgroundColor,
99
99
  $position: position,
100
100
  style: {
101
101
  x: actionX,
102
102
  opacity: shouldUseOpacityAnimation ? opacity : 1
103
103
  }
104
- }, /*#__PURE__*/_react.default.createElement(_SwipeableAction.StyledSwipeableActionButton, {
104
+ }, /*#__PURE__*/_react2.default.createElement(_SwipeableAction.StyledSwipeableActionButton, {
105
105
  onClick: handleButtonClick,
106
106
  style: {
107
107
  pointerEvents
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableAction.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_SwipeableAction","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SWIPEABLE_ACTION_WIDTH","exports","SwipeableAction","activationThreshold","close","index","item","listItemXOffset","position","shouldUseOpacityAnimation","totalActionCount","pointerEvents","setPointerEvents","React","useState","handleButtonClick","action","actionOffset","useTransform","newValue","maxOffset","fractionalOffset","Math","max","min","actionOverlayOffset","useSpring","bounce","actionX","x","y","opacity","abs","useMotionValueEvent","value","useEffect","isOuterMost","undefined","onChange","lastValue","getPrevious","createElement","StyledMotionSwipeableAction","$backgroundColor","backgroundColor","$position","style","StyledSwipeableActionButton","onClick","$color","color","$width","icon","text","displayName","_default"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.tsx"],"sourcesContent":["import { MotionValue, useMotionValueEvent, useSpring, useTransform } from 'framer-motion';\nimport React, { FC, useEffect } from 'react';\nimport type { SwipeableActionItem } from '../SwipeableWrapper';\nimport { StyledMotionSwipeableAction, StyledSwipeableActionButton } from './SwipeableAction.styles';\n\nexport const SWIPEABLE_ACTION_WIDTH = 72;\n\nexport type SwipeableActionProps = {\n activationThreshold: number;\n close: VoidFunction;\n index: number;\n item: SwipeableActionItem;\n listItemXOffset: MotionValue<number>;\n position: 'left' | 'right';\n shouldUseOpacityAnimation?: boolean;\n totalActionCount: number;\n};\n\nconst SwipeableAction: FC<SwipeableActionProps> = ({\n activationThreshold,\n close,\n index,\n item,\n listItemXOffset,\n position,\n shouldUseOpacityAnimation,\n totalActionCount,\n}) => {\n const [pointerEvents, setPointerEvents] = React.useState<'auto' | 'none'>('none');\n\n const handleButtonClick = () => {\n item.action();\n close();\n };\n\n /**\n * By default, the action sticks to the content of the swipeable item. This\n * makes it move outwards to reveal the inner items.\n */\n const actionOffset = useTransform(listItemXOffset, (newValue) => {\n const maxOffset = SWIPEABLE_ACTION_WIDTH * index;\n const fractionalOffset = (-newValue / totalActionCount) * index;\n\n switch (position) {\n case 'left':\n return Math.max(-maxOffset, fractionalOffset);\n case 'right':\n return Math.min(maxOffset, fractionalOffset);\n default:\n return 0;\n }\n });\n\n /**\n * Brings the item in again if past the threshold. Only relevant for\n * outermost items.\n */\n const actionOverlayOffset = useSpring(0, {\n bounce: 0,\n }) as MotionValue<number>;\n\n /**\n * Combines the two values above to create the correct X transform that has\n * to be applied to the action.\n */\n const actionX = useTransform<number, number>([actionOffset, actionOverlayOffset], ([x, y]) => {\n if (position === 'left') {\n return Math.min((x ?? 0) + (y ?? 0), 0);\n }\n\n return Math.max((x ?? 0) + (y ?? 0), 0);\n });\n\n const opacity = useTransform(listItemXOffset, (x) =>\n Math.max(0, Math.min(1, Math.abs(x) / 72)),\n );\n\n useMotionValueEvent(opacity, 'change', (value) => {\n setPointerEvents(value < 0.5 ? 'none' : 'auto');\n });\n\n // Animate to the middle after passing threshold if outermost item\n useEffect(() => {\n const isOuterMost = index === totalActionCount - 1;\n\n if (!isOuterMost) return undefined;\n\n return listItemXOffset.onChange((newValue) => {\n const lastValue = listItemXOffset.getPrevious();\n\n if (!lastValue) {\n return;\n }\n\n // eslint-disable-next-line default-case\n switch (position) {\n case 'left':\n if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * index);\n } else if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n break;\n case 'right':\n if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * -1 * index);\n } else if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n }\n });\n }, [\n actionOverlayOffset,\n activationThreshold,\n index,\n listItemXOffset,\n position,\n totalActionCount,\n ]);\n\n return (\n <StyledMotionSwipeableAction\n $backgroundColor={item.backgroundColor}\n $position={position}\n style={{ x: actionX, opacity: shouldUseOpacityAnimation ? opacity : 1 }}\n >\n <StyledSwipeableActionButton\n onClick={handleButtonClick}\n style={{ pointerEvents }}\n $color={item.color}\n $width={`${SWIPEABLE_ACTION_WIDTH}px`}\n >\n {item.icon}\n {item.text}\n </StyledSwipeableActionButton>\n </StyledMotionSwipeableAction>\n );\n};\n\nSwipeableAction.displayName = 'SwipeableAction';\n\nexport default SwipeableAction;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,gBAAA,GAAAH,OAAA;AAAoG,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,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J,CAAC;AAEtC,CAAC;AAEDnD,eAAe,CAACoD,WAAW,GAAG,iBAAiB;AAAC,IAAAC,QAAA,GAAAtD,OAAA,CAAAf,OAAA,GAEjCgB,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableAction.js","names":["_react","require","_react2","_interopRequireWildcard","_SwipeableAction","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SWIPEABLE_ACTION_WIDTH","exports","SwipeableAction","activationThreshold","close","index","item","listItemXOffset","position","shouldUseOpacityAnimation","totalActionCount","pointerEvents","setPointerEvents","React","useState","handleButtonClick","action","actionOffset","useTransform","newValue","maxOffset","fractionalOffset","Math","max","min","actionOverlayOffset","useSpring","bounce","actionX","x","y","opacity","abs","useMotionValueEvent","value","useEffect","isOuterMost","undefined","onChange","lastValue","getPrevious","createElement","StyledMotionSwipeableAction","$backgroundColor","backgroundColor","$position","style","StyledSwipeableActionButton","onClick","$color","color","$width","icon","text","displayName","_default"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.tsx"],"sourcesContent":["import { MotionValue, useMotionValueEvent, useSpring, useTransform } from 'motion/react';\nimport React, { FC, useEffect } from 'react';\nimport type { SwipeableActionItem } from '../SwipeableWrapper';\nimport { StyledMotionSwipeableAction, StyledSwipeableActionButton } from './SwipeableAction.styles';\n\nexport const SWIPEABLE_ACTION_WIDTH = 72;\n\nexport type SwipeableActionProps = {\n activationThreshold: number;\n close: VoidFunction;\n index: number;\n item: SwipeableActionItem;\n listItemXOffset: MotionValue<number>;\n position: 'left' | 'right';\n shouldUseOpacityAnimation?: boolean;\n totalActionCount: number;\n};\n\nconst SwipeableAction: FC<SwipeableActionProps> = ({\n activationThreshold,\n close,\n index,\n item,\n listItemXOffset,\n position,\n shouldUseOpacityAnimation,\n totalActionCount,\n}) => {\n const [pointerEvents, setPointerEvents] = React.useState<'auto' | 'none'>('none');\n\n const handleButtonClick = () => {\n item.action();\n close();\n };\n\n /**\n * By default, the action sticks to the content of the swipeable item. This\n * makes it move outwards to reveal the inner items.\n */\n const actionOffset = useTransform(listItemXOffset, (newValue) => {\n const maxOffset = SWIPEABLE_ACTION_WIDTH * index;\n const fractionalOffset = (-newValue / totalActionCount) * index;\n\n switch (position) {\n case 'left':\n return Math.max(-maxOffset, fractionalOffset);\n case 'right':\n return Math.min(maxOffset, fractionalOffset);\n default:\n return 0;\n }\n });\n\n /**\n * Brings the item in again if past the threshold. Only relevant for\n * outermost items.\n */\n const actionOverlayOffset = useSpring(0, {\n bounce: 0,\n }) as MotionValue<number>;\n\n /**\n * Combines the two values above to create the correct X transform that has\n * to be applied to the action.\n */\n const actionX = useTransform<number, number>([actionOffset, actionOverlayOffset], ([x, y]) => {\n if (position === 'left') {\n return Math.min((x ?? 0) + (y ?? 0), 0);\n }\n\n return Math.max((x ?? 0) + (y ?? 0), 0);\n });\n\n const opacity = useTransform(listItemXOffset, (x) =>\n Math.max(0, Math.min(1, Math.abs(x) / 72)),\n );\n\n useMotionValueEvent(opacity, 'change', (value) => {\n setPointerEvents(value < 0.5 ? 'none' : 'auto');\n });\n\n // Animate to the middle after passing threshold if outermost item\n useEffect(() => {\n const isOuterMost = index === totalActionCount - 1;\n\n if (!isOuterMost) return undefined;\n\n return listItemXOffset.onChange((newValue) => {\n const lastValue = listItemXOffset.getPrevious();\n\n if (!lastValue) {\n return;\n }\n\n // eslint-disable-next-line default-case\n switch (position) {\n case 'left':\n if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * index);\n } else if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n break;\n case 'right':\n if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * -1 * index);\n } else if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n }\n });\n }, [\n actionOverlayOffset,\n activationThreshold,\n index,\n listItemXOffset,\n position,\n totalActionCount,\n ]);\n\n return (\n <StyledMotionSwipeableAction\n $backgroundColor={item.backgroundColor}\n $position={position}\n style={{ x: actionX, opacity: shouldUseOpacityAnimation ? opacity : 1 }}\n >\n <StyledSwipeableActionButton\n onClick={handleButtonClick}\n style={{ pointerEvents }}\n $color={item.color}\n $width={`${SWIPEABLE_ACTION_WIDTH}px`}\n >\n {item.icon}\n {item.text}\n </StyledSwipeableActionButton>\n </StyledMotionSwipeableAction>\n );\n};\n\nSwipeableAction.displayName = 'SwipeableAction';\n\nexport default SwipeableAction;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,gBAAA,GAAAH,OAAA;AAAoG,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CA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;IACzBsC,MAAM,EAAE3C,IAAI,CAAC4C,KAAM;IACnBC,MAAM,EAAE,GAAGnD,sBAAsB;EAAK,GAErCM,IAAI,CAAC8C,IAAI,EACT9C,IAAI,CAAC+C,IACmB,CACJ,CAAC;AAEtC,CAAC;AAEDnD,eAAe,CAACoD,WAAW,GAAG,iBAAiB;AAAC,IAAAC,QAAA,GAAAtD,OAAA,CAAAf,OAAA,GAEjCgB,eAAe","ignoreList":[]}
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.StyledSwipeableActionButton = exports.StyledMotionSwipeableAction = void 0;
7
- var _framerMotion = require("framer-motion");
7
+ var _react = require("motion/react");
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
10
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- const StyledMotionSwipeableAction = exports.StyledMotionSwipeableAction = (0, _styledComponents.default)(_framerMotion.motion.div)`
11
+ const StyledMotionSwipeableAction = exports.StyledMotionSwipeableAction = (0, _styledComponents.default)(_react.motion.div)`
12
12
  background-color: ${({
13
13
  $backgroundColor
14
14
  }) => $backgroundColor};
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableAction.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledMotionSwipeableAction","exports","styled","motion","div","$backgroundColor","$position","css","StyledSwipeableActionButton","button","$color","$width"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\n\ntype StyledSwipeableActionProps = {\n $position: 'left' | 'right';\n $backgroundColor: CSSProperties['backgroundColor'];\n};\n\nexport const StyledMotionSwipeableAction = styled(motion.div)<StyledSwipeableActionProps>`\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n display: flex;\n height: 100%;\n position: absolute;\n top: 0;\n width: 200vw;\n\n ${({ $position }) => {\n if ($position === 'left') {\n return css`\n justify-content: flex-end;\n right: 100%;\n `;\n }\n return css`\n justify-content: flex-start;\n left: 100%;\n `;\n }}\n`;\n\ntype StyledSwipeableActionButtonsProps = {\n $width: CSSProperties['width'];\n $color: CSSProperties['color'];\n};\n\nexport const StyledSwipeableActionButton = styled.button<StyledSwipeableActionButtonsProps>`\n align-items: center;\n appearance: none;\n background: none;\n box-shadow: none;\n color: ${({ $color }) => $color};\n display: flex;\n flex-direction: column;\n font-size: 88%;\n gap: 4px;\n height: 100%;\n justify-content: center;\n margin: 0;\n padding: 0;\n width: ${({ $width }) => $width};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAF,wBAAAE,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA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AAP,OAAA,CAAAO,2BAAA,GAAGN,yBAAM,CAACO,MAAyC;AAC3F;AACA;AACA;AACA;AACA,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AACnC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableAction.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledMotionSwipeableAction","exports","styled","motion","div","$backgroundColor","$position","css","StyledSwipeableActionButton","button","$color","$width"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\n\ntype StyledSwipeableActionProps = {\n $position: 'left' | 'right';\n $backgroundColor: CSSProperties['backgroundColor'];\n};\n\nexport const StyledMotionSwipeableAction = styled(motion.div)<StyledSwipeableActionProps>`\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n display: flex;\n height: 100%;\n position: absolute;\n top: 0;\n width: 200vw;\n\n ${({ $position }) => {\n if ($position === 'left') {\n return css`\n justify-content: flex-end;\n right: 100%;\n `;\n }\n return css`\n justify-content: flex-start;\n left: 100%;\n `;\n }}\n`;\n\ntype StyledSwipeableActionButtonsProps = {\n $width: CSSProperties['width'];\n $color: CSSProperties['color'];\n};\n\nexport const StyledSwipeableActionButton = styled.button<StyledSwipeableActionButtonsProps>`\n align-items: center;\n appearance: none;\n background: none;\n box-shadow: none;\n color: ${({ $color }) => $color};\n display: flex;\n flex-direction: column;\n font-size: 88%;\n gap: 4px;\n height: 100%;\n justify-content: center;\n margin: 0;\n padding: 0;\n width: ${({ $width }) => $width};\n`;\n"],"mappings":";;;;;;AAAA,I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CAACC,GAAG,CAA6B;AACzF,wBAAwB,CAAC;EAAEC;AAAiB,CAAC,KAAKA,gBAAgB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAU,CAAC,KAAK;EACjB,IAAIA,SAAS,KAAK,MAAM,EAAE;IACtB,OAAO,IAAAC,qBAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,OAAO,IAAAA,qBAAG;AAClB;AACA;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAOM,MAAMC,2BAA2B,GAAAP,OAAA,CAAAO,2BAAA,GAAGN,yBAAM,CAACO,MAAyC;AAC3F;AACA;AACA;AACA;AACA,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AACnC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { vibrate } from 'chayns-api';
2
- import { animate, useMotionValue } from 'framer-motion';
2
+ import { animate, useMotionValue } from 'motion/react';
3
3
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { calcThreshold } from '../../utils/threshold';
5
5
  import SwipeableAction, { SWIPEABLE_ACTION_WIDTH } from './swipeable-action/SwipeableAction';
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableWrapper.js","names":["vibrate","animate","useMotionValue","React","useCallback","useEffect","useMemo","useRef","useState","calcThreshold","SwipeableAction","SWIPEABLE_ACTION_WIDTH","StyledMotionSwipeableWrapper","StyledSwipeableWrapperContent","SwipeableWrapper","_ref","children","leftActions","rightActions","shouldUseOpacityAnimation","leftThreshold","setLeftThreshold","actionCount","length","direction","width","window","innerWidth","rightThreshold","setRightThreshold","swipeableWrapperRef","listItemXOffset","close","open","current","parentElement","offsetWidth","closeCallback","event","eventTarget","target","contains","document","addEventListener","removeEventListener","onChange","newValue","previous","getPrevious","hasCrossedLeftThreshold","hasCrossedRightThreshold","iOSFeedbackVibration","pattern","handlePan","_","info","currentXOffset","get","dampingFactor","offset","x","delta","Math","abs","set","handlePanEnd","action","state","leftActionElements","Array","from","reverse","map","item","index","createElement","activationThreshold","key","position","totalActionCount","rightActionElements","onPan","onPanEnd","ref","style","displayName"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.tsx"],"sourcesContent":["import { vibrate } from 'chayns-api';\nimport { animate, PanInfo, useMotionValue } from 'framer-motion';\nimport React, {\n CSSProperties,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { calcThreshold } from '../../utils/threshold';\nimport SwipeableAction, { SWIPEABLE_ACTION_WIDTH } from './swipeable-action/SwipeableAction';\nimport {\n StyledMotionSwipeableWrapper,\n StyledSwipeableWrapperContent,\n} from './SwipeableWrapper.styles';\n\nexport type SwipeableActionItem = {\n action: VoidFunction;\n backgroundColor: CSSProperties['backgroundColor'];\n color: CSSProperties['color'];\n text?: ReactNode;\n icon: ReactNode;\n key: string;\n};\n\nexport type SwipeableWrapperProps = {\n /**\n * The content of the Swipeable item.\n */\n children: ReactNode;\n /**\n * The left-side actions, ordered from the left to the right.\n */\n leftActions?: SwipeableActionItem[];\n /**\n * The right-side actions, ordered from left to the right.\n */\n rightActions?: SwipeableActionItem[];\n /**\n * Whether the opacity should be animated when swiping in the actions.\n */\n shouldUseOpacityAnimation?: boolean;\n};\n\nconst SwipeableWrapper: FC<SwipeableWrapperProps> = ({\n children,\n leftActions = [],\n rightActions = [],\n shouldUseOpacityAnimation,\n}) => {\n const [leftThreshold, setLeftThreshold] = useState(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width: window.innerWidth,\n }),\n );\n\n const [rightThreshold, setRightThreshold] = useState(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width: window.innerWidth,\n }),\n );\n\n const swipeableWrapperRef = useRef<HTMLDivElement | null>(null);\n\n const listItemXOffset = useMotionValue(0);\n\n const close = useCallback(() => {\n void animate(listItemXOffset, 0);\n }, [listItemXOffset]);\n\n const open = useCallback(\n (direction: 'left' | 'right') => {\n switch (direction) {\n case 'left':\n void animate(listItemXOffset, SWIPEABLE_ACTION_WIDTH * leftActions.length);\n break;\n case 'right':\n void animate(listItemXOffset, -SWIPEABLE_ACTION_WIDTH * rightActions.length);\n break;\n default:\n break;\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n useEffect(() => {\n const width = swipeableWrapperRef.current?.parentElement?.offsetWidth;\n\n // This check was deliberately chosen because a width of 0 is also not permitted.\n if (width) {\n setLeftThreshold(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width,\n }),\n );\n\n setRightThreshold(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width,\n }),\n );\n }\n }, [leftActions.length, rightActions.length]);\n\n // Close an opened menu when anything outside it is tapped\n useEffect(() => {\n function closeCallback(event: MouseEvent | TouchEvent) {\n const eventTarget = event.target;\n\n // @ts-expect-error: Pretty sure that the event target is always a Node.\n if (eventTarget && !swipeableWrapperRef.current?.contains(eventTarget)) {\n close();\n }\n }\n\n document.addEventListener('mousedown', closeCallback);\n document.addEventListener('touchstart', closeCallback);\n\n return () => {\n document.removeEventListener('mousedown', closeCallback);\n document.removeEventListener('touchstart', closeCallback);\n };\n }, [close]);\n\n // Vibrate when the threshold is passed\n useEffect(\n () =>\n listItemXOffset.onChange((newValue: number) => {\n const previous = listItemXOffset.getPrevious();\n\n if (!previous) {\n return;\n }\n\n const hasCrossedLeftThreshold =\n (previous < leftThreshold && newValue >= leftThreshold) ||\n (previous > leftThreshold && newValue <= leftThreshold);\n\n const hasCrossedRightThreshold =\n (previous < rightThreshold && newValue >= rightThreshold) ||\n (previous > rightThreshold && newValue <= rightThreshold);\n\n if (hasCrossedLeftThreshold || hasCrossedRightThreshold) {\n void vibrate({ iOSFeedbackVibration: 6, pattern: [150] });\n }\n }),\n [leftThreshold, listItemXOffset, rightThreshold],\n );\n\n const handlePan = useCallback(\n (_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n const currentXOffset = listItemXOffset.get();\n\n const dampingFactor =\n (info.offset.x > 0 && leftActions.length > 0) ||\n (info.offset.x < 0 && rightActions.length > 0) ||\n (currentXOffset > 0 && info.delta.x < 0) ||\n (currentXOffset < 0 && info.delta.x > 0)\n ? 1\n : 0.75 / (Math.abs(info.offset.x) / 9);\n\n if (Math.abs(info.offset.x) > 30 || currentXOffset > 0) {\n listItemXOffset.set(currentXOffset + info.delta.x * dampingFactor);\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n const handlePanEnd = useCallback(() => {\n const offset = listItemXOffset.get();\n\n if (offset > leftThreshold) {\n leftActions[0]?.action();\n close();\n } else if (offset < rightThreshold) {\n rightActions[rightActions.length - 1]?.action();\n close();\n } else {\n let state: 'left-open' | 'right-open' | 'closed';\n\n if (offset > 2) {\n state = 'left-open';\n } else if (offset < -2) {\n state = 'right-open';\n } else {\n state = 'closed';\n }\n\n // eslint-disable-next-line default-case\n switch (state) {\n case 'left-open':\n if (offset < SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('left');\n }\n break;\n case 'right-open':\n if (offset > -SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('right');\n }\n break;\n case 'closed':\n if (offset > SWIPEABLE_ACTION_WIDTH) {\n open('left');\n } else if (offset < -SWIPEABLE_ACTION_WIDTH) {\n open('right');\n } else {\n close();\n }\n }\n }\n }, [close, leftActions, leftThreshold, listItemXOffset, open, rightActions, rightThreshold]);\n\n const leftActionElements = useMemo(\n () =>\n Array.from(leftActions)\n .reverse()\n .map((item, index) => (\n <SwipeableAction\n activationThreshold={leftThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"left\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={leftActions.length}\n />\n )),\n [close, leftActions, leftThreshold, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n const rightActionElements = useMemo(\n () =>\n rightActions.map((item, index) => (\n <SwipeableAction\n activationThreshold={rightThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"right\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={rightActions.length}\n />\n )),\n [rightActions, rightThreshold, close, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n return (\n <StyledMotionSwipeableWrapper\n onPan={handlePan}\n onPanEnd={handlePanEnd}\n ref={swipeableWrapperRef}\n style={{ x: listItemXOffset }}\n >\n {leftActionElements}\n <StyledSwipeableWrapperContent>{children}</StyledSwipeableWrapperContent>\n {rightActionElements}\n </StyledMotionSwipeableWrapper>\n );\n};\n\nSwipeableWrapper.displayName = 'SwipeableWrapper';\n\nexport default SwipeableWrapper;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,OAAO,EAAWC,cAAc,QAAQ,eAAe;AAChE,OAAOC,KAAK,IAIRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,aAAa,QAAQ,uBAAuB;AACrD,OAAOC,eAAe,IAAIC,sBAAsB,QAAQ,oCAAoC;AAC5F,SACIC,4BAA4B,EAC5BC,6BAA6B,QAC1B,2BAA2B;AA8BlC,MAAMC,gBAA2C,GAAGC,IAAA,IAK9C;EAAA,IAL+C;IACjDC,QAAQ;IACRC,WAAW,GAAG,EAAE;IAChBC,YAAY,GAAG,EAAE;IACjBC;EACJ,CAAC,GAAAJ,IAAA;EACG,MAAM,CAACK,aAAa,EAAEC,gBAAgB,CAAC,GAAGb,QAAQ,CAC9CC,aAAa,CAAC;IACVa,WAAW,EAAEL,WAAW,CAACM,MAAM;IAC/BC,SAAS,EAAE,MAAM;IACjBC,KAAK,EAAEC,MAAM,CAACC;EAClB,CAAC,CACL,CAAC;EAED,MAAM,CAACC,cAAc,EAAEC,iBAAi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AAC;AAEvC,CAAC;AAEDlE,gBAAgB,CAACuE,WAAW,GAAG,kBAAkB;AAEjD,eAAevE,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableWrapper.js","names":["vibrate","animate","useMotionValue","React","useCallback","useEffect","useMemo","useRef","useState","calcThreshold","SwipeableAction","SWIPEABLE_ACTION_WIDTH","StyledMotionSwipeableWrapper","StyledSwipeableWrapperContent","SwipeableWrapper","_ref","children","leftActions","rightActions","shouldUseOpacityAnimation","leftThreshold","setLeftThreshold","actionCount","length","direction","width","window","innerWidth","rightThreshold","setRightThreshold","swipeableWrapperRef","listItemXOffset","close","open","current","parentElement","offsetWidth","closeCallback","event","eventTarget","target","contains","document","addEventListener","removeEventListener","onChange","newValue","previous","getPrevious","hasCrossedLeftThreshold","hasCrossedRightThreshold","iOSFeedbackVibration","pattern","handlePan","_","info","currentXOffset","get","dampingFactor","offset","x","delta","Math","abs","set","handlePanEnd","action","state","leftActionElements","Array","from","reverse","map","item","index","createElement","activationThreshold","key","position","totalActionCount","rightActionElements","onPan","onPanEnd","ref","style","displayName"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.tsx"],"sourcesContent":["import { vibrate } from 'chayns-api';\nimport { animate, PanInfo, useMotionValue } from 'motion/react';\nimport React, {\n CSSProperties,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { calcThreshold } from '../../utils/threshold';\nimport SwipeableAction, { SWIPEABLE_ACTION_WIDTH } from './swipeable-action/SwipeableAction';\nimport {\n StyledMotionSwipeableWrapper,\n StyledSwipeableWrapperContent,\n} from './SwipeableWrapper.styles';\n\nexport type SwipeableActionItem = {\n action: VoidFunction;\n backgroundColor: CSSProperties['backgroundColor'];\n color: CSSProperties['color'];\n text?: ReactNode;\n icon: ReactNode;\n key: string;\n};\n\nexport type SwipeableWrapperProps = {\n /**\n * The content of the Swipeable item.\n */\n children: ReactNode;\n /**\n * The left-side actions, ordered from the left to the right.\n */\n leftActions?: SwipeableActionItem[];\n /**\n * The right-side actions, ordered from left to the right.\n */\n rightActions?: SwipeableActionItem[];\n /**\n * Whether the opacity should be animated when swiping in the actions.\n */\n shouldUseOpacityAnimation?: boolean;\n};\n\nconst SwipeableWrapper: FC<SwipeableWrapperProps> = ({\n children,\n leftActions = [],\n rightActions = [],\n shouldUseOpacityAnimation,\n}) => {\n const [leftThreshold, setLeftThreshold] = useState(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width: window.innerWidth,\n }),\n );\n\n const [rightThreshold, setRightThreshold] = useState(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width: window.innerWidth,\n }),\n );\n\n const swipeableWrapperRef = useRef<HTMLDivElement | null>(null);\n\n const listItemXOffset = useMotionValue(0);\n\n const close = useCallback(() => {\n void animate(listItemXOffset, 0);\n }, [listItemXOffset]);\n\n const open = useCallback(\n (direction: 'left' | 'right') => {\n switch (direction) {\n case 'left':\n void animate(listItemXOffset, SWIPEABLE_ACTION_WIDTH * leftActions.length);\n break;\n case 'right':\n void animate(listItemXOffset, -SWIPEABLE_ACTION_WIDTH * rightActions.length);\n break;\n default:\n break;\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n useEffect(() => {\n const width = swipeableWrapperRef.current?.parentElement?.offsetWidth;\n\n // This check was deliberately chosen because a width of 0 is also not permitted.\n if (width) {\n setLeftThreshold(\n calcThreshold({\n actionCount: leftActions.length,\n direction: 'left',\n width,\n }),\n );\n\n setRightThreshold(\n calcThreshold({\n actionCount: rightActions.length,\n direction: 'right',\n width,\n }),\n );\n }\n }, [leftActions.length, rightActions.length]);\n\n // Close an opened menu when anything outside it is tapped\n useEffect(() => {\n function closeCallback(event: MouseEvent | TouchEvent) {\n const eventTarget = event.target;\n\n // @ts-expect-error: Pretty sure that the event target is always a Node.\n if (eventTarget && !swipeableWrapperRef.current?.contains(eventTarget)) {\n close();\n }\n }\n\n document.addEventListener('mousedown', closeCallback);\n document.addEventListener('touchstart', closeCallback);\n\n return () => {\n document.removeEventListener('mousedown', closeCallback);\n document.removeEventListener('touchstart', closeCallback);\n };\n }, [close]);\n\n // Vibrate when the threshold is passed\n useEffect(\n () =>\n listItemXOffset.onChange((newValue: number) => {\n const previous = listItemXOffset.getPrevious();\n\n if (!previous) {\n return;\n }\n\n const hasCrossedLeftThreshold =\n (previous < leftThreshold && newValue >= leftThreshold) ||\n (previous > leftThreshold && newValue <= leftThreshold);\n\n const hasCrossedRightThreshold =\n (previous < rightThreshold && newValue >= rightThreshold) ||\n (previous > rightThreshold && newValue <= rightThreshold);\n\n if (hasCrossedLeftThreshold || hasCrossedRightThreshold) {\n void vibrate({ iOSFeedbackVibration: 6, pattern: [150] });\n }\n }),\n [leftThreshold, listItemXOffset, rightThreshold],\n );\n\n const handlePan = useCallback(\n (_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n const currentXOffset = listItemXOffset.get();\n\n const dampingFactor =\n (info.offset.x > 0 && leftActions.length > 0) ||\n (info.offset.x < 0 && rightActions.length > 0) ||\n (currentXOffset > 0 && info.delta.x < 0) ||\n (currentXOffset < 0 && info.delta.x > 0)\n ? 1\n : 0.75 / (Math.abs(info.offset.x) / 9);\n\n if (Math.abs(info.offset.x) > 30 || currentXOffset > 0) {\n listItemXOffset.set(currentXOffset + info.delta.x * dampingFactor);\n }\n },\n [leftActions.length, listItemXOffset, rightActions.length],\n );\n\n const handlePanEnd = useCallback(() => {\n const offset = listItemXOffset.get();\n\n if (offset > leftThreshold) {\n leftActions[0]?.action();\n close();\n } else if (offset < rightThreshold) {\n rightActions[rightActions.length - 1]?.action();\n close();\n } else {\n let state: 'left-open' | 'right-open' | 'closed';\n\n if (offset > 2) {\n state = 'left-open';\n } else if (offset < -2) {\n state = 'right-open';\n } else {\n state = 'closed';\n }\n\n // eslint-disable-next-line default-case\n switch (state) {\n case 'left-open':\n if (offset < SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('left');\n }\n break;\n case 'right-open':\n if (offset > -SWIPEABLE_ACTION_WIDTH) {\n close();\n } else {\n open('right');\n }\n break;\n case 'closed':\n if (offset > SWIPEABLE_ACTION_WIDTH) {\n open('left');\n } else if (offset < -SWIPEABLE_ACTION_WIDTH) {\n open('right');\n } else {\n close();\n }\n }\n }\n }, [close, leftActions, leftThreshold, listItemXOffset, open, rightActions, rightThreshold]);\n\n const leftActionElements = useMemo(\n () =>\n Array.from(leftActions)\n .reverse()\n .map((item, index) => (\n <SwipeableAction\n activationThreshold={leftThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"left\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={leftActions.length}\n />\n )),\n [close, leftActions, leftThreshold, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n const rightActionElements = useMemo(\n () =>\n rightActions.map((item, index) => (\n <SwipeableAction\n activationThreshold={rightThreshold}\n close={close}\n index={index}\n item={item}\n key={item.key}\n listItemXOffset={listItemXOffset}\n position=\"right\"\n shouldUseOpacityAnimation={shouldUseOpacityAnimation}\n totalActionCount={rightActions.length}\n />\n )),\n [rightActions, rightThreshold, close, listItemXOffset, shouldUseOpacityAnimation],\n );\n\n return (\n <StyledMotionSwipeableWrapper\n onPan={handlePan}\n onPanEnd={handlePanEnd}\n ref={swipeableWrapperRef}\n style={{ x: listItemXOffset }}\n >\n {leftActionElements}\n <StyledSwipeableWrapperContent>{children}</StyledSwipeableWrapperContent>\n {rightActionElements}\n </StyledMotionSwipeableWrapper>\n );\n};\n\nSwipeableWrapper.displayName = 'SwipeableWrapper';\n\nexport default SwipeableWrapper;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,OAAO,EAAWC,cAAc,QAAQ,cAAc;AAC/D,OAAOC,KAAK,IAIRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,aAAa,QAAQ,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;IACjC+C,QAAQ,EAAC,OAAO;IAChB3D,yBAAyB,EAAEA,yBAA0B;IACrD4D,gBAAgB,EAAE7D,YAAY,CAACK;EAAO,CACzC,CACJ,CAAC,EACN,CAACL,YAAY,EAAEU,cAAc,EAAEI,KAAK,EAAED,eAAe,EAAEZ,yBAAyB,CACpF,CAAC;EAED,oBACIhB,KAAA,CAAAwE,aAAA,CAAC/D,4BAA4B;IACzBqE,KAAK,EAAE5B,SAAU;IACjB6B,QAAQ,EAAEjB,YAAa;IACvBkB,GAAG,EAAErD,mBAAoB;IACzBsD,KAAK,EAAE;MAAExB,CAAC,EAAE7B;IAAgB;EAAE,GAE7BqC,kBAAkB,eACnBjE,KAAA,CAAAwE,aAAA,CAAC9D,6BAA6B,QAAEG,QAAwC,CAAC,EACxEgE,mBACyB,CAAC;AAEvC,CAAC;AAEDlE,gBAAgB,CAACuE,WAAW,GAAG,kBAAkB;AAEjD,eAAevE,gBAAgB","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { motion } from 'framer-motion';
1
+ import { motion } from 'motion/react';
2
2
  import styled from 'styled-components';
3
3
  export const StyledMotionSwipeableWrapper = styled(motion.div)`
4
4
  position: relative;
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableWrapper.styles.js","names":["motion","styled","StyledMotionSwipeableWrapper","div","StyledSwipeableWrapperContent"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\nexport const StyledMotionSwipeableWrapper = styled(motion.div)<FramerMotionBugFix>`\n position: relative;\n touch-action: pan-y;\n user-select: none;\n`;\n\nexport const StyledSwipeableWrapperContent = styled.div`\n width: 100%;\n`;\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,eAAe;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,4BAA4B,GAAGD,MAAM,CAACD,MAAM,CAACG,GAAG,CAAqB;AAClF;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,6BAA6B,GAAGH,MAAM,CAACE,GAAG;AACvD;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableWrapper.styles.js","names":["motion","styled","StyledMotionSwipeableWrapper","div","StyledSwipeableWrapperContent"],"sources":["../../../../src/components/swipeable-wrapper/SwipeableWrapper.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled from 'styled-components';\n\nexport const StyledMotionSwipeableWrapper = styled(motion.div)<FramerMotionBugFix>`\n position: relative;\n touch-action: pan-y;\n user-select: none;\n`;\n\nexport const StyledSwipeableWrapperContent = styled.div`\n width: 100%;\n`;\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,4BAA4B,GAAGD,MAAM,CAACD,MAAM,CAACG,GAAG,CAAqB;AAClF;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,6BAA6B,GAAGH,MAAM,CAACE,GAAG;AACvD;AACA,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { useMotionValueEvent, useSpring, useTransform } from 'framer-motion';
1
+ import { useMotionValueEvent, useSpring, useTransform } from 'motion/react';
2
2
  import React, { useEffect } from 'react';
3
3
  import { StyledMotionSwipeableAction, StyledSwipeableActionButton } from './SwipeableAction.styles';
4
4
  export const SWIPEABLE_ACTION_WIDTH = 72;
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableAction.js","names":["useMotionValueEvent","useSpring","useTransform","React","useEffect","StyledMotionSwipeableAction","StyledSwipeableActionButton","SWIPEABLE_ACTION_WIDTH","SwipeableAction","_ref","activationThreshold","close","index","item","listItemXOffset","position","shouldUseOpacityAnimation","totalActionCount","pointerEvents","setPointerEvents","useState","handleButtonClick","action","actionOffset","newValue","maxOffset","fractionalOffset","Math","max","min","actionOverlayOffset","bounce","actionX","_ref2","x","y","opacity","abs","value","isOuterMost","undefined","onChange","lastValue","getPrevious","set","createElement","$backgroundColor","backgroundColor","$position","style","onClick","$color","color","$width","icon","text","displayName"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.tsx"],"sourcesContent":["import { MotionValue, useMotionValueEvent, useSpring, useTransform } from 'framer-motion';\nimport React, { FC, useEffect } from 'react';\nimport type { SwipeableActionItem } from '../SwipeableWrapper';\nimport { StyledMotionSwipeableAction, StyledSwipeableActionButton } from './SwipeableAction.styles';\n\nexport const SWIPEABLE_ACTION_WIDTH = 72;\n\nexport type SwipeableActionProps = {\n activationThreshold: number;\n close: VoidFunction;\n index: number;\n item: SwipeableActionItem;\n listItemXOffset: MotionValue<number>;\n position: 'left' | 'right';\n shouldUseOpacityAnimation?: boolean;\n totalActionCount: number;\n};\n\nconst SwipeableAction: FC<SwipeableActionProps> = ({\n activationThreshold,\n close,\n index,\n item,\n listItemXOffset,\n position,\n shouldUseOpacityAnimation,\n totalActionCount,\n}) => {\n const [pointerEvents, setPointerEvents] = React.useState<'auto' | 'none'>('none');\n\n const handleButtonClick = () => {\n item.action();\n close();\n };\n\n /**\n * By default, the action sticks to the content of the swipeable item. This\n * makes it move outwards to reveal the inner items.\n */\n const actionOffset = useTransform(listItemXOffset, (newValue) => {\n const maxOffset = SWIPEABLE_ACTION_WIDTH * index;\n const fractionalOffset = (-newValue / totalActionCount) * index;\n\n switch (position) {\n case 'left':\n return Math.max(-maxOffset, fractionalOffset);\n case 'right':\n return Math.min(maxOffset, fractionalOffset);\n default:\n return 0;\n }\n });\n\n /**\n * Brings the item in again if past the threshold. Only relevant for\n * outermost items.\n */\n const actionOverlayOffset = useSpring(0, {\n bounce: 0,\n }) as MotionValue<number>;\n\n /**\n * Combines the two values above to create the correct X transform that has\n * to be applied to the action.\n */\n const actionX = useTransform<number, number>([actionOffset, actionOverlayOffset], ([x, y]) => {\n if (position === 'left') {\n return Math.min((x ?? 0) + (y ?? 0), 0);\n }\n\n return Math.max((x ?? 0) + (y ?? 0), 0);\n });\n\n const opacity = useTransform(listItemXOffset, (x) =>\n Math.max(0, Math.min(1, Math.abs(x) / 72)),\n );\n\n useMotionValueEvent(opacity, 'change', (value) => {\n setPointerEvents(value < 0.5 ? 'none' : 'auto');\n });\n\n // Animate to the middle after passing threshold if outermost item\n useEffect(() => {\n const isOuterMost = index === totalActionCount - 1;\n\n if (!isOuterMost) return undefined;\n\n return listItemXOffset.onChange((newValue) => {\n const lastValue = listItemXOffset.getPrevious();\n\n if (!lastValue) {\n return;\n }\n\n // eslint-disable-next-line default-case\n switch (position) {\n case 'left':\n if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * index);\n } else if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n break;\n case 'right':\n if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * -1 * index);\n } else if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n }\n });\n }, [\n actionOverlayOffset,\n activationThreshold,\n index,\n listItemXOffset,\n position,\n totalActionCount,\n ]);\n\n return (\n <StyledMotionSwipeableAction\n $backgroundColor={item.backgroundColor}\n $position={position}\n style={{ x: actionX, opacity: shouldUseOpacityAnimation ? opacity : 1 }}\n >\n <StyledSwipeableActionButton\n onClick={handleButtonClick}\n style={{ pointerEvents }}\n $color={item.color}\n $width={`${SWIPEABLE_ACTION_WIDTH}px`}\n >\n {item.icon}\n {item.text}\n </StyledSwipeableActionButton>\n </StyledMotionSwipeableAction>\n );\n};\n\nSwipeableAction.displayName = 'SwipeableAction';\n\nexport default SwipeableAction;\n"],"mappings":"AAAA,SAAsBA,mBAAmB,EAAEC,SAAS,EAAEC,YAAY,QAAQ,eAAe;AACzF,OAAOC,KAAK,IAAQC,SAAS,QAAQ,OAAO;AAE5C,SA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CAAC,CAAC,CAAC;UAC9B;UACA;QACJ,KAAK,OAAO;UACR,IAAIpB,QAAQ,GAAGd,mBAAmB,IAAIgC,SAAS,IAAIhC,mBAAmB,EAAE;YACpEoB,mBAAmB,CAACc,GAAG,CAACrC,sBAAsB,GAAG,CAAC,CAAC,GAAGK,KAAK,CAAC;UAChE,CAAC,MAAM,IAAIY,QAAQ,GAAGd,mBAAmB,IAAIgC,SAAS,IAAIhC,mBAAmB,EAAE;YAC3EoB,mBAAmB,CAACc,GAAG,CAAC,CAAC,CAAC;UAC9B;MACR;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CACCd,mBAAmB,EACnBpB,mBAAmB,EACnBE,KAAK,EACLE,eAAe,EACfC,QAAQ,EACRE,gBAAgB,CACnB,CAAC;EAEF,oBACId,KAAA,CAAA0C,aAAA,CAACxC,2BAA2B;IACxByC,gBAAgB,EAAEjC,IAAI,CAACkC,eAAgB;IACvCC,SAAS,EAAEjC,QAAS;IACpBkC,KAAK,EAAE;MAAEf,CAAC,EAAEF,OAAO;MAAEI,OAAO,EAAEpB,yBAAyB,GAAGoB,OAAO,GAAG;IAAE;EAAE,gBAExEjC,KAAA,CAAA0C,aAAA,CAACvC,2BAA2B;IACxB4C,OAAO,EAAE7B,iBAAkB;IAC3B4B,KAAK,EAAE;MAAE/B;IAAc,CAAE;IACzBiC,MAAM,EAAEtC,IAAI,CAACuC,KAAM;IACnBC,MAAM,EAAE,GAAG9C,sBAAsB;EAAK,GAErCM,IAAI,CAACyC,IAAI,EACTzC,IAAI,CAAC0C,IACmB,CACJ,CAAC;AAEtC,CAAC;AAED/C,eAAe,CAACgD,WAAW,GAAG,iBAAiB;AAE/C,eAAehD,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableAction.js","names":["useMotionValueEvent","useSpring","useTransform","React","useEffect","StyledMotionSwipeableAction","StyledSwipeableActionButton","SWIPEABLE_ACTION_WIDTH","SwipeableAction","_ref","activationThreshold","close","index","item","listItemXOffset","position","shouldUseOpacityAnimation","totalActionCount","pointerEvents","setPointerEvents","useState","handleButtonClick","action","actionOffset","newValue","maxOffset","fractionalOffset","Math","max","min","actionOverlayOffset","bounce","actionX","_ref2","x","y","opacity","abs","value","isOuterMost","undefined","onChange","lastValue","getPrevious","set","createElement","$backgroundColor","backgroundColor","$position","style","onClick","$color","color","$width","icon","text","displayName"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.tsx"],"sourcesContent":["import { MotionValue, useMotionValueEvent, useSpring, useTransform } from 'motion/react';\nimport React, { FC, useEffect } from 'react';\nimport type { SwipeableActionItem } from '../SwipeableWrapper';\nimport { StyledMotionSwipeableAction, StyledSwipeableActionButton } from './SwipeableAction.styles';\n\nexport const SWIPEABLE_ACTION_WIDTH = 72;\n\nexport type SwipeableActionProps = {\n activationThreshold: number;\n close: VoidFunction;\n index: number;\n item: SwipeableActionItem;\n listItemXOffset: MotionValue<number>;\n position: 'left' | 'right';\n shouldUseOpacityAnimation?: boolean;\n totalActionCount: number;\n};\n\nconst SwipeableAction: FC<SwipeableActionProps> = ({\n activationThreshold,\n close,\n index,\n item,\n listItemXOffset,\n position,\n shouldUseOpacityAnimation,\n totalActionCount,\n}) => {\n const [pointerEvents, setPointerEvents] = React.useState<'auto' | 'none'>('none');\n\n const handleButtonClick = () => {\n item.action();\n close();\n };\n\n /**\n * By default, the action sticks to the content of the swipeable item. This\n * makes it move outwards to reveal the inner items.\n */\n const actionOffset = useTransform(listItemXOffset, (newValue) => {\n const maxOffset = SWIPEABLE_ACTION_WIDTH * index;\n const fractionalOffset = (-newValue / totalActionCount) * index;\n\n switch (position) {\n case 'left':\n return Math.max(-maxOffset, fractionalOffset);\n case 'right':\n return Math.min(maxOffset, fractionalOffset);\n default:\n return 0;\n }\n });\n\n /**\n * Brings the item in again if past the threshold. Only relevant for\n * outermost items.\n */\n const actionOverlayOffset = useSpring(0, {\n bounce: 0,\n }) as MotionValue<number>;\n\n /**\n * Combines the two values above to create the correct X transform that has\n * to be applied to the action.\n */\n const actionX = useTransform<number, number>([actionOffset, actionOverlayOffset], ([x, y]) => {\n if (position === 'left') {\n return Math.min((x ?? 0) + (y ?? 0), 0);\n }\n\n return Math.max((x ?? 0) + (y ?? 0), 0);\n });\n\n const opacity = useTransform(listItemXOffset, (x) =>\n Math.max(0, Math.min(1, Math.abs(x) / 72)),\n );\n\n useMotionValueEvent(opacity, 'change', (value) => {\n setPointerEvents(value < 0.5 ? 'none' : 'auto');\n });\n\n // Animate to the middle after passing threshold if outermost item\n useEffect(() => {\n const isOuterMost = index === totalActionCount - 1;\n\n if (!isOuterMost) return undefined;\n\n return listItemXOffset.onChange((newValue) => {\n const lastValue = listItemXOffset.getPrevious();\n\n if (!lastValue) {\n return;\n }\n\n // eslint-disable-next-line default-case\n switch (position) {\n case 'left':\n if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * index);\n } else if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n break;\n case 'right':\n if (newValue < activationThreshold && lastValue >= activationThreshold) {\n actionOverlayOffset.set(SWIPEABLE_ACTION_WIDTH * -1 * index);\n } else if (newValue > activationThreshold && lastValue <= activationThreshold) {\n actionOverlayOffset.set(0);\n }\n }\n });\n }, [\n actionOverlayOffset,\n activationThreshold,\n index,\n listItemXOffset,\n position,\n totalActionCount,\n ]);\n\n return (\n <StyledMotionSwipeableAction\n $backgroundColor={item.backgroundColor}\n $position={position}\n style={{ x: actionX, opacity: shouldUseOpacityAnimation ? opacity : 1 }}\n >\n <StyledSwipeableActionButton\n onClick={handleButtonClick}\n style={{ pointerEvents }}\n $color={item.color}\n $width={`${SWIPEABLE_ACTION_WIDTH}px`}\n >\n {item.icon}\n {item.text}\n </StyledSwipeableActionButton>\n </StyledMotionSwipeableAction>\n );\n};\n\nSwipeableAction.displayName = 'SwipeableAction';\n\nexport default SwipeableAction;\n"],"mappings":"AAAA,SAAsBA,mBA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
  import styled, { css } from 'styled-components';
3
3
  export const StyledMotionSwipeableAction = styled(motion.div)`
4
4
  background-color: ${_ref => {
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableAction.styles.js","names":["motion","styled","css","StyledMotionSwipeableAction","div","_ref","$backgroundColor","_ref2","$position","StyledSwipeableActionButton","button","_ref3","$color","_ref4","$width"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\n\ntype StyledSwipeableActionProps = {\n $position: 'left' | 'right';\n $backgroundColor: CSSProperties['backgroundColor'];\n};\n\nexport const StyledMotionSwipeableAction = styled(motion.div)<StyledSwipeableActionProps>`\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n display: flex;\n height: 100%;\n position: absolute;\n top: 0;\n width: 200vw;\n\n ${({ $position }) => {\n if ($position === 'left') {\n return css`\n justify-content: flex-end;\n right: 100%;\n `;\n }\n return css`\n justify-content: flex-start;\n left: 100%;\n `;\n }}\n`;\n\ntype StyledSwipeableActionButtonsProps = {\n $width: CSSProperties['width'];\n $color: CSSProperties['color'];\n};\n\nexport const StyledSwipeableActionButton = styled.button<StyledSwipeableActionButtonsProps>`\n align-items: center;\n appearance: none;\n background: none;\n box-shadow: none;\n color: ${({ $color }) => $color};\n display: flex;\n flex-direction: column;\n font-size: 88%;\n gap: 4px;\n height: 100%;\n justify-content: center;\n margin: 0;\n padding: 0;\n width: ${({ $width }) => $width};\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,eAAe;AAEtC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAO/C,OAAO,MAAMC,2BAA2B,GAAGF,MAAM,CAACD,MAAM,CAACI,GAAG,CAA6B;AACzF,wBAAwBC,IAAA;EAAA,IAAC;IAAEC;EAAiB,CAAC,GAAAD,IAAA;EAAA,OAAKC,gBAAgB;AAAA;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAA,IAAmB;EAAA,IAAlB;IAAEC;EAAU,CAAC,GAAAD,KAAA;EACZ,IAAIC,SAAS,KAAK,MAAM,EAAE;IACtB,OAAON,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,OAAOA,GAAG;AAClB;AACA;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAOD,OAAO,MAAMO,2BAA2B,GAAGR,MAAM,CAACS,MAAyC;AAC3F;AACA;AACA;AACA;AACA,aAAaC,KAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,KAAA;EAAA,OAAKC,MAAM;AAAA;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAaC,KAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,KAAA;EAAA,OAAKC,MAAM;AAAA;AACnC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SwipeableAction.styles.js","names":["motion","styled","css","StyledMotionSwipeableAction","div","_ref","$backgroundColor","_ref2","$position","StyledSwipeableActionButton","button","_ref3","$color","_ref4","$width"],"sources":["../../../../../src/components/swipeable-wrapper/swipeable-action/SwipeableAction.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\n\ntype StyledSwipeableActionProps = {\n $position: 'left' | 'right';\n $backgroundColor: CSSProperties['backgroundColor'];\n};\n\nexport const StyledMotionSwipeableAction = styled(motion.div)<StyledSwipeableActionProps>`\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n display: flex;\n height: 100%;\n position: absolute;\n top: 0;\n width: 200vw;\n\n ${({ $position }) => {\n if ($position === 'left') {\n return css`\n justify-content: flex-end;\n right: 100%;\n `;\n }\n return css`\n justify-content: flex-start;\n left: 100%;\n `;\n }}\n`;\n\ntype StyledSwipeableActionButtonsProps = {\n $width: CSSProperties['width'];\n $color: CSSProperties['color'];\n};\n\nexport const StyledSwipeableActionButton = styled.button<StyledSwipeableActionButtonsProps>`\n align-items: center;\n appearance: none;\n background: none;\n box-shadow: none;\n color: ${({ $color }) => $color};\n display: flex;\n flex-direction: column;\n font-size: 88%;\n gap: 4px;\n height: 100%;\n justify-content: center;\n margin: 0;\n padding: 0;\n width: ${({ $width }) => $width};\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AAErC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAO/C,OAAO,MAAMC,2BAA2B,GAAGF,MAAM,CAACD,MAAM,CAACI,GAAG,CAA6B;AACzF,wBAAwBC,IAAA;EAAA,IAAC;IAAEC;EAAiB,CAAC,GAAAD,IAAA;EAAA,OAAKC,gBAAgB;AAAA;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAA,IAAmB;EAAA,IAAlB;IAAEC;EAAU,CAAC,GAAAD,KAAA;EACZ,IAAIC,SAAS,KAAK,MAAM,EAAE;IACtB,OAAON,GAAG;AACtB;AACA;AACA,aAAa;EACL;EACA,OAAOA,GAAG;AAClB;AACA;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAOD,OAAO,MAAMO,2BAA2B,GAAGR,MAAM,CAACS,MAAyC;AAC3F;AACA;AACA;AACA;AACA,aAAaC,KAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,KAAA;EAAA,OAAKC,MAAM;AAAA;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAaC,KAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,KAAA;EAAA,OAAKC,MAAM;AAAA;AACnC,CAAC","ignoreList":[]}
@@ -1,267 +1,6 @@
1
- export declare const StyledMotionSwipeableWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<{
2
- title?: string | undefined;
3
- slot?: string | undefined;
4
- defaultChecked?: boolean | undefined;
5
- defaultValue?: string | number | readonly string[] | undefined;
6
- suppressContentEditableWarning?: boolean | undefined;
7
- suppressHydrationWarning?: boolean | undefined;
8
- accessKey?: string | undefined;
9
- autoCapitalize?: (string & {}) | "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined;
10
- autoFocus?: boolean | undefined;
11
- className?: string | undefined;
12
- contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
13
- contextMenu?: string | undefined;
14
- dir?: string | undefined;
15
- draggable?: (boolean | "true" | "false") | undefined;
16
- enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
17
- hidden?: boolean | undefined;
18
- id?: string | undefined;
19
- lang?: string | undefined;
20
- nonce?: string | undefined;
21
- spellCheck?: (boolean | "true" | "false") | undefined;
22
- tabIndex?: number | undefined;
23
- translate?: "yes" | "no" | undefined;
24
- radioGroup?: string | undefined;
25
- role?: import("react").AriaRole | undefined;
26
- about?: string | undefined;
27
- content?: string | undefined;
28
- datatype?: string | undefined;
29
- inlist?: any;
30
- prefix?: string | undefined;
31
- property?: string | undefined;
32
- rel?: string | undefined;
33
- resource?: string | undefined;
34
- rev?: string | undefined;
35
- typeof?: string | undefined;
36
- vocab?: string | undefined;
37
- autoCorrect?: string | undefined;
38
- autoSave?: string | undefined;
39
- color?: string | undefined;
40
- itemProp?: string | undefined;
41
- itemScope?: boolean | undefined;
42
- itemType?: string | undefined;
43
- itemID?: string | undefined;
44
- itemRef?: string | undefined;
45
- results?: number | undefined;
46
- security?: string | undefined;
47
- unselectable?: "off" | "on" | undefined;
48
- inputMode?: "text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
49
- is?: string | undefined;
50
- "aria-activedescendant"?: string | undefined;
51
- "aria-atomic"?: (boolean | "true" | "false") | undefined;
52
- "aria-autocomplete"?: "none" | "list" | "both" | "inline" | undefined;
53
- "aria-braillelabel"?: string | undefined;
54
- "aria-brailleroledescription"?: string | undefined;
55
- "aria-busy"?: (boolean | "true" | "false") | undefined;
56
- "aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
57
- "aria-colcount"?: number | undefined;
58
- "aria-colindex"?: number | undefined;
59
- "aria-colindextext"?: string | undefined;
60
- "aria-colspan"?: number | undefined;
61
- "aria-controls"?: string | undefined;
62
- "aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
63
- "aria-describedby"?: string | undefined;
64
- "aria-description"?: string | undefined;
65
- "aria-details"?: string | undefined;
66
- "aria-disabled"?: (boolean | "true" | "false") | undefined;
67
- "aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
68
- "aria-errormessage"?: string | undefined;
69
- "aria-expanded"?: (boolean | "true" | "false") | undefined;
70
- "aria-flowto"?: string | undefined;
71
- "aria-grabbed"?: (boolean | "true" | "false") | undefined;
72
- "aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
73
- "aria-hidden"?: (boolean | "true" | "false") | undefined;
74
- "aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
75
- "aria-keyshortcuts"?: string | undefined;
76
- "aria-label"?: string | undefined;
77
- "aria-labelledby"?: string | undefined;
78
- "aria-level"?: number | undefined;
79
- "aria-live"?: "off" | "assertive" | "polite" | undefined;
80
- "aria-modal"?: (boolean | "true" | "false") | undefined;
81
- "aria-multiline"?: (boolean | "true" | "false") | undefined;
82
- "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
83
- "aria-orientation"?: "horizontal" | "vertical" | undefined;
84
- "aria-owns"?: string | undefined;
85
- "aria-placeholder"?: string | undefined;
86
- "aria-posinset"?: number | undefined;
87
- "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
88
- "aria-readonly"?: (boolean | "true" | "false") | undefined;
89
- "aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
90
- "aria-required"?: (boolean | "true" | "false") | undefined;
91
- "aria-roledescription"?: string | undefined;
92
- "aria-rowcount"?: number | undefined;
93
- "aria-rowindex"?: number | undefined;
94
- "aria-rowindextext"?: string | undefined;
95
- "aria-rowspan"?: number | undefined;
96
- "aria-selected"?: (boolean | "true" | "false") | undefined;
97
- "aria-setsize"?: number | undefined;
98
- "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
99
- "aria-valuemax"?: number | undefined;
100
- "aria-valuemin"?: number | undefined;
101
- "aria-valuenow"?: number | undefined;
102
- "aria-valuetext"?: string | undefined;
103
- dangerouslySetInnerHTML?: {
104
- __html: string | TrustedHTML;
105
- } | undefined;
106
- onCopy?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
107
- onCopyCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
108
- onCut?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
109
- onCutCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
110
- onPaste?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
111
- onPasteCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
112
- onCompositionEnd?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
113
- onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
114
- onCompositionStart?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
115
- onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
116
- onCompositionUpdate?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
117
- onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
118
- onFocus?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
119
- onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
120
- onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
121
- onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
122
- onChange?: import("react").FormEventHandler<HTMLDivElement> | undefined;
123
- onChangeCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
124
- onBeforeInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
125
- onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
126
- onInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
127
- onInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
128
- onReset?: import("react").FormEventHandler<HTMLDivElement> | undefined;
129
- onResetCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
130
- onSubmit?: import("react").FormEventHandler<HTMLDivElement> | undefined;
131
- onSubmitCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
132
- onInvalid?: import("react").FormEventHandler<HTMLDivElement> | undefined;
133
- onInvalidCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
134
- onLoad?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
135
- onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
136
- onError?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
137
- onErrorCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
138
- onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
139
- onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
140
- onKeyPress?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
141
- onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
142
- onKeyUp?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
143
- onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
144
- onAbort?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
145
- onAbortCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
146
- onCanPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
147
- onCanPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
148
- onCanPlayThrough?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
149
- onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
150
- onDurationChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
151
- onDurationChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
152
- onEmptied?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
153
- onEmptiedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
154
- onEncrypted?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
155
- onEncryptedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
156
- onEnded?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
157
- onEndedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
158
- onLoadedData?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
159
- onLoadedDataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
160
- onLoadedMetadata?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
161
- onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
162
- onLoadStart?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
163
- onLoadStartCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
164
- onPause?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
165
- onPauseCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
166
- onPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
167
- onPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
168
- onPlaying?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
169
- onPlayingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
170
- onProgress?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
171
- onProgressCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
172
- onRateChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
173
- onRateChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
174
- onResize?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
175
- onResizeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
176
- onSeeked?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
177
- onSeekedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
178
- onSeeking?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
179
- onSeekingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
180
- onStalled?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
181
- onStalledCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
182
- onSuspend?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
183
- onSuspendCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
184
- onTimeUpdate?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
185
- onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
186
- onVolumeChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
187
- onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
188
- onWaiting?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
189
- onWaitingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
190
- onAuxClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
191
- onAuxClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
192
- onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
193
- onClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
194
- onContextMenu?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
195
- onContextMenuCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
196
- onDoubleClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
197
- onDoubleClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
198
- onDragCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
199
- onDragEndCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
200
- onDragEnter?: import("react").DragEventHandler<HTMLDivElement> | undefined;
201
- onDragEnterCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
202
- onDragExit?: import("react").DragEventHandler<HTMLDivElement> | undefined;
203
- onDragExitCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
204
- onDragLeave?: import("react").DragEventHandler<HTMLDivElement> | undefined;
205
- onDragLeaveCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
206
- onDragOver?: import("react").DragEventHandler<HTMLDivElement> | undefined;
207
- onDragOverCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
208
- onDragStartCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
209
- onDrop?: import("react").DragEventHandler<HTMLDivElement> | undefined;
210
- onDropCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
211
- onMouseDown?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
212
- onMouseDownCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
213
- onMouseEnter?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
214
- onMouseLeave?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
215
- onMouseMove?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
216
- onMouseMoveCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
217
- onMouseOut?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
218
- onMouseOutCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
219
- onMouseOver?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
220
- onMouseOverCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
221
- onMouseUp?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
222
- onMouseUpCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
223
- onSelect?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
224
- onSelectCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
225
- onTouchCancel?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
226
- onTouchCancelCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
227
- onTouchEnd?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
228
- onTouchEndCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
229
- onTouchMove?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
230
- onTouchMoveCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
231
- onTouchStart?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
232
- onTouchStartCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
233
- onPointerDown?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
234
- onPointerDownCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
235
- onPointerMove?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
236
- onPointerMoveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
237
- onPointerUp?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
238
- onPointerUpCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
239
- onPointerCancel?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
240
- onPointerCancelCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
241
- onPointerEnter?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
242
- onPointerLeave?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
243
- onPointerOver?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
244
- onPointerOverCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
245
- onPointerOut?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
246
- onPointerOutCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
247
- onGotPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
248
- onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
249
- onLostPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
250
- onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
251
- onScroll?: import("react").UIEventHandler<HTMLDivElement> | undefined;
252
- onScrollCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
253
- onWheel?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
254
- onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
255
- onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
256
- onAnimationEnd?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
257
- onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
258
- onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
259
- onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
260
- onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
261
- onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
262
- } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
1
+ export declare const StyledMotionSwipeableWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
263
2
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
264
3
  }, {
265
4
  theme: import("@chayns-components/core/lib/types/components/color-scheme-provider/ColorSchemeProvider").Theme;
266
- }>> & string & Omit<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
5
+ }>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
267
6
  export declare const StyledSwipeableWrapperContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,4 +1,4 @@
1
- import { MotionValue } from 'framer-motion';
1
+ import { MotionValue } from 'motion/react';
2
2
  import { FC } from 'react';
3
3
  import type { SwipeableActionItem } from '../SwipeableWrapper';
4
4
  export declare const SWIPEABLE_ACTION_WIDTH = 72;
@@ -3,270 +3,9 @@ type StyledSwipeableActionProps = {
3
3
  $position: 'left' | 'right';
4
4
  $backgroundColor: CSSProperties['backgroundColor'];
5
5
  };
6
- export declare const StyledMotionSwipeableAction: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<{
7
- title?: string | undefined;
8
- slot?: string | undefined;
9
- defaultChecked?: boolean | undefined;
10
- defaultValue?: string | number | readonly string[] | undefined;
11
- suppressContentEditableWarning?: boolean | undefined;
12
- suppressHydrationWarning?: boolean | undefined;
13
- accessKey?: string | undefined;
14
- autoCapitalize?: (string & {}) | "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined;
15
- autoFocus?: boolean | undefined;
16
- className?: string | undefined;
17
- contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
18
- contextMenu?: string | undefined;
19
- dir?: string | undefined;
20
- draggable?: (boolean | "true" | "false") | undefined;
21
- enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
22
- hidden?: boolean | undefined;
23
- id?: string | undefined;
24
- lang?: string | undefined;
25
- nonce?: string | undefined;
26
- spellCheck?: (boolean | "true" | "false") | undefined;
27
- tabIndex?: number | undefined;
28
- translate?: "yes" | "no" | undefined;
29
- radioGroup?: string | undefined;
30
- role?: import("react").AriaRole | undefined;
31
- about?: string | undefined;
32
- content?: string | undefined;
33
- datatype?: string | undefined;
34
- inlist?: any;
35
- prefix?: string | undefined;
36
- property?: string | undefined;
37
- rel?: string | undefined;
38
- resource?: string | undefined;
39
- rev?: string | undefined;
40
- typeof?: string | undefined;
41
- vocab?: string | undefined;
42
- autoCorrect?: string | undefined;
43
- autoSave?: string | undefined;
44
- color?: string | undefined;
45
- itemProp?: string | undefined;
46
- itemScope?: boolean | undefined;
47
- itemType?: string | undefined;
48
- itemID?: string | undefined;
49
- itemRef?: string | undefined;
50
- results?: number | undefined;
51
- security?: string | undefined;
52
- unselectable?: "off" | "on" | undefined;
53
- inputMode?: "text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
54
- is?: string | undefined;
55
- "aria-activedescendant"?: string | undefined;
56
- "aria-atomic"?: (boolean | "true" | "false") | undefined;
57
- "aria-autocomplete"?: "none" | "list" | "both" | "inline" | undefined;
58
- "aria-braillelabel"?: string | undefined;
59
- "aria-brailleroledescription"?: string | undefined;
60
- "aria-busy"?: (boolean | "true" | "false") | undefined;
61
- "aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
62
- "aria-colcount"?: number | undefined;
63
- "aria-colindex"?: number | undefined;
64
- "aria-colindextext"?: string | undefined;
65
- "aria-colspan"?: number | undefined;
66
- "aria-controls"?: string | undefined;
67
- "aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
68
- "aria-describedby"?: string | undefined;
69
- "aria-description"?: string | undefined;
70
- "aria-details"?: string | undefined;
71
- "aria-disabled"?: (boolean | "true" | "false") | undefined;
72
- "aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
73
- "aria-errormessage"?: string | undefined;
74
- "aria-expanded"?: (boolean | "true" | "false") | undefined;
75
- "aria-flowto"?: string | undefined;
76
- "aria-grabbed"?: (boolean | "true" | "false") | undefined;
77
- "aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
78
- "aria-hidden"?: (boolean | "true" | "false") | undefined;
79
- "aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
80
- "aria-keyshortcuts"?: string | undefined;
81
- "aria-label"?: string | undefined;
82
- "aria-labelledby"?: string | undefined;
83
- "aria-level"?: number | undefined;
84
- "aria-live"?: "off" | "assertive" | "polite" | undefined;
85
- "aria-modal"?: (boolean | "true" | "false") | undefined;
86
- "aria-multiline"?: (boolean | "true" | "false") | undefined;
87
- "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
88
- "aria-orientation"?: "horizontal" | "vertical" | undefined;
89
- "aria-owns"?: string | undefined;
90
- "aria-placeholder"?: string | undefined;
91
- "aria-posinset"?: number | undefined;
92
- "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
93
- "aria-readonly"?: (boolean | "true" | "false") | undefined;
94
- "aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
95
- "aria-required"?: (boolean | "true" | "false") | undefined;
96
- "aria-roledescription"?: string | undefined;
97
- "aria-rowcount"?: number | undefined;
98
- "aria-rowindex"?: number | undefined;
99
- "aria-rowindextext"?: string | undefined;
100
- "aria-rowspan"?: number | undefined;
101
- "aria-selected"?: (boolean | "true" | "false") | undefined;
102
- "aria-setsize"?: number | undefined;
103
- "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
104
- "aria-valuemax"?: number | undefined;
105
- "aria-valuemin"?: number | undefined;
106
- "aria-valuenow"?: number | undefined;
107
- "aria-valuetext"?: string | undefined;
108
- dangerouslySetInnerHTML?: {
109
- __html: string | TrustedHTML;
110
- } | undefined;
111
- onCopy?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
112
- onCopyCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
113
- onCut?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
114
- onCutCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
115
- onPaste?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
116
- onPasteCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
117
- onCompositionEnd?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
118
- onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
119
- onCompositionStart?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
120
- onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
121
- onCompositionUpdate?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
122
- onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
123
- onFocus?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
124
- onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
125
- onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
126
- onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
127
- onChange?: import("react").FormEventHandler<HTMLDivElement> | undefined;
128
- onChangeCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
129
- onBeforeInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
130
- onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
131
- onInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
132
- onInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
133
- onReset?: import("react").FormEventHandler<HTMLDivElement> | undefined;
134
- onResetCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
135
- onSubmit?: import("react").FormEventHandler<HTMLDivElement> | undefined;
136
- onSubmitCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
137
- onInvalid?: import("react").FormEventHandler<HTMLDivElement> | undefined;
138
- onInvalidCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
139
- onLoad?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
140
- onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
141
- onError?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
142
- onErrorCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
143
- onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
144
- onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
145
- onKeyPress?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
146
- onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
147
- onKeyUp?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
148
- onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
149
- onAbort?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
150
- onAbortCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
151
- onCanPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
152
- onCanPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
153
- onCanPlayThrough?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
154
- onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
155
- onDurationChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
156
- onDurationChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
157
- onEmptied?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
158
- onEmptiedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
159
- onEncrypted?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
160
- onEncryptedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
161
- onEnded?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
162
- onEndedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
163
- onLoadedData?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
164
- onLoadedDataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
165
- onLoadedMetadata?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
166
- onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
167
- onLoadStart?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
168
- onLoadStartCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
169
- onPause?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
170
- onPauseCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
171
- onPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
172
- onPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
173
- onPlaying?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
174
- onPlayingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
175
- onProgress?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
176
- onProgressCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
177
- onRateChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
178
- onRateChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
179
- onResize?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
180
- onResizeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
181
- onSeeked?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
182
- onSeekedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
183
- onSeeking?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
184
- onSeekingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
185
- onStalled?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
186
- onStalledCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
187
- onSuspend?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
188
- onSuspendCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
189
- onTimeUpdate?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
190
- onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
191
- onVolumeChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
192
- onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
193
- onWaiting?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
194
- onWaitingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
195
- onAuxClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
196
- onAuxClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
197
- onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
198
- onClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
199
- onContextMenu?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
200
- onContextMenuCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
201
- onDoubleClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
202
- onDoubleClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
203
- onDragCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
204
- onDragEndCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
205
- onDragEnter?: import("react").DragEventHandler<HTMLDivElement> | undefined;
206
- onDragEnterCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
207
- onDragExit?: import("react").DragEventHandler<HTMLDivElement> | undefined;
208
- onDragExitCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
209
- onDragLeave?: import("react").DragEventHandler<HTMLDivElement> | undefined;
210
- onDragLeaveCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
211
- onDragOver?: import("react").DragEventHandler<HTMLDivElement> | undefined;
212
- onDragOverCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
213
- onDragStartCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
214
- onDrop?: import("react").DragEventHandler<HTMLDivElement> | undefined;
215
- onDropCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
216
- onMouseDown?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
217
- onMouseDownCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
218
- onMouseEnter?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
219
- onMouseLeave?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
220
- onMouseMove?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
221
- onMouseMoveCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
222
- onMouseOut?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
223
- onMouseOutCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
224
- onMouseOver?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
225
- onMouseOverCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
226
- onMouseUp?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
227
- onMouseUpCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
228
- onSelect?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
229
- onSelectCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
230
- onTouchCancel?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
231
- onTouchCancelCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
232
- onTouchEnd?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
233
- onTouchEndCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
234
- onTouchMove?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
235
- onTouchMoveCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
236
- onTouchStart?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
237
- onTouchStartCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
238
- onPointerDown?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
239
- onPointerDownCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
240
- onPointerMove?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
241
- onPointerMoveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
242
- onPointerUp?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
243
- onPointerUpCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
244
- onPointerCancel?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
245
- onPointerCancelCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
246
- onPointerEnter?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
247
- onPointerLeave?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
248
- onPointerOver?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
249
- onPointerOverCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
250
- onPointerOut?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
251
- onPointerOutCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
252
- onGotPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
253
- onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
254
- onLostPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
255
- onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
256
- onScroll?: import("react").UIEventHandler<HTMLDivElement> | undefined;
257
- onScrollCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
258
- onWheel?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
259
- onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
260
- onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
261
- onAnimationEnd?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
262
- onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
263
- onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
264
- onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
265
- onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
266
- onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
267
- } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
6
+ export declare const StyledMotionSwipeableAction: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
268
7
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
269
- }, StyledSwipeableActionProps>> & string & Omit<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
8
+ }, StyledSwipeableActionProps>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
270
9
  type StyledSwipeableActionButtonsProps = {
271
10
  $width: CSSProperties['width'];
272
11
  $color: CSSProperties['color'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/swipeable-wrapper",
3
- "version": "5.0.0-beta.1003",
3
+ "version": "5.0.0-beta.1005",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -69,11 +69,11 @@
69
69
  "typescript": "^5.7.3"
70
70
  },
71
71
  "dependencies": {
72
- "@chayns-components/core": "^5.0.0-beta.1003"
72
+ "@chayns-components/core": "^5.0.0-beta.1005"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "chayns-api": ">=2.0.0",
76
- "framer-motion": ">=10.18.0",
76
+ "motion": ">=12.4.1",
77
77
  "react": ">=18.0.0",
78
78
  "react-dom": ">=18.0.0",
79
79
  "styled-components": ">=5.3.11"
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "afec8c706e8484aea963cb6da1759f7fb3b5539a"
84
+ "gitHead": "e9addebffb5f9ef1fb0f85ddfd9611ec4b422f55"
85
85
  }