yet-another-react-lightbox 2.2.6 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,11 +43,12 @@ export const usePointerSwipe = (subscribeSensors, isSwipeValid, containerWidth,
43
43
  if (pointer) {
44
44
  const isCurrentPointer = activePointer.current === event.pointerId;
45
45
  if (event.buttons === 0) {
46
- if (isCurrentPointer && offset.current > 0) {
47
- onSwipeCancel(offset.current);
48
- offset.current = 0;
46
+ if (isCurrentPointer && offset.current !== 0) {
47
+ onPointerUp(event);
48
+ }
49
+ else {
50
+ clearPointer(pointer);
49
51
  }
50
- clearPointer(pointer);
51
52
  return;
52
53
  }
53
54
  const deltaX = event.clientX - pointer.clientX;
@@ -140,6 +140,13 @@ export const ZoomContainer = ({ slide, offset, rect, render, carousel, animation
140
140
  }
141
141
  }
142
142
  }, [offset, zoom, maxZoom, isMinZoom, isMaxZoom, setIsMinZoom, setIsMaxZoom]);
143
+ const onZoomCallback = useEventCallback(() => {
144
+ var _a;
145
+ if (offset === 0) {
146
+ (_a = on.zoom) === null || _a === void 0 ? void 0 : _a.call(on, zoom);
147
+ }
148
+ });
149
+ useLayoutEffect(onZoomCallback, [zoom, onZoomCallback]);
143
150
  const translateCoordinates = React.useCallback((event) => {
144
151
  if (controllerRef.current) {
145
152
  const { pageX, pageY } = event;
@@ -49,5 +49,8 @@ declare module "../../types" {
49
49
  /** render custom Zoom out icon */
50
50
  iconZoomOut?: () => React.ReactNode;
51
51
  }
52
+ interface Callbacks {
53
+ zoom?: (level: number) => void;
54
+ }
52
55
  }
53
56
  export default Zoom;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "2.2.6",
3
+ "version": "2.3.0",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
9
10
  "exports": {
10
11
  ".": "./dist/index.js",
11
12
  "./core": "./dist/core/index.js",
@@ -21,7 +22,6 @@
21
22
  "./plugins/zoom": "./dist/plugins/zoom/index.js",
22
23
  "./styles.css": "./dist/styles.css"
23
24
  },
24
- "types": "dist/index.d.ts",
25
25
  "typesVersions": {
26
26
  "*": {
27
27
  "*": [
@@ -73,64 +73,17 @@
73
73
  "engines": {
74
74
  "node": ">=14"
75
75
  },
76
- "scripts": {
77
- "prepare": "husky install",
78
- "clean": "rimraf dist",
79
- "build": "npm-run-all clean build:scss build:css build:js build:dts",
80
- "build:js": "tsc -p tsconfig.build.js.json",
81
- "build:dts": "tsc -p tsconfig.build.dts.json",
82
- "build:css": "postcss src/*.css src/**/*.css --base src -d dist -u autoprefixer --no-map",
83
- "build:scss": "sass src --no-source-map",
84
- "start": "npm-run-all clean --parallel \"build:* -- -w\"",
85
- "lint": "eslint .",
86
- "test": "jest"
87
- },
88
76
  "peerDependencies": {
89
77
  "react": ">=16.8.0",
90
78
  "react-dom": ">=16.8.0"
91
79
  },
92
- "devDependencies": {
93
- "@commitlint/cli": "^17.4.0",
94
- "@commitlint/config-conventional": "^17.4.0",
95
- "@semantic-release/changelog": "^6.0.2",
96
- "@semantic-release/github": "^8.0.7",
97
- "@testing-library/jest-dom": "^5.16.5",
98
- "@testing-library/react": "^13.4.0",
99
- "@testing-library/user-event": "^14.4.3",
100
- "@types/jest": "^29.2.5",
101
- "@types/react": "^18.0.26",
102
- "@types/react-dom": "^18.0.10",
103
- "@typescript-eslint/eslint-plugin": "^5.48.0",
104
- "@typescript-eslint/parser": "^5.48.0",
105
- "autoprefixer": "^10.4.13",
106
- "eslint": "^8.31.0",
107
- "eslint-config-airbnb": "^19.0.4",
108
- "eslint-config-airbnb-typescript": "^17.0.0",
109
- "eslint-config-prettier": "^8.6.0",
110
- "eslint-plugin-import": "^2.26.0",
111
- "eslint-plugin-jsx-a11y": "^6.6.1",
112
- "eslint-plugin-prettier": "^4.2.1",
113
- "eslint-plugin-react": "^7.31.11",
114
- "eslint-plugin-react-hooks": "^4.6.0",
115
- "husky": "^8.0.3",
116
- "jest": "^29.3.1",
117
- "jest-environment-jsdom": "^29.3.1",
118
- "lint-staged": "^13.1.0",
119
- "npm-run-all": "^4.1.5",
120
- "postcss": "^8.4.21",
121
- "postcss-cli": "^10.1.0",
122
- "prettier": "^2.8.2",
123
- "react": "^18.2.0",
124
- "react-dom": "^18.2.0",
125
- "rimraf": "^3.0.2",
126
- "sass": "^1.57.1",
127
- "ts-jest": "^29.0.3",
128
- "typescript": "^4.9.4"
129
- },
130
80
  "keywords": [
131
81
  "react",
132
82
  "image",
83
+ "photo",
133
84
  "lightbox",
134
- "react lightbox"
85
+ "react lightbox",
86
+ "react image lightbox",
87
+ "react photo lightbox"
135
88
  ]
136
89
  }