react-image-gallery 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +9 -4
- package/build/image-gallery.es.js +1 -0
- package/build/image-gallery.umd.js +1 -0
- package/package.json +62 -44
- package/styles/css/image-gallery.css +1 -1
- package/styles/scss/image-gallery.scss +81 -20
- package/.eslintrc.json +0 -47
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -39
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/eslint.yml +0 -56
- package/babel.config.js +0 -3
- package/jest.config.js +0 -16
- package/src/components/ImageGallery.jsx +0 -1727
- package/src/components/ImageGallery.test.jsx +0 -22
- package/src/components/Item.jsx +0 -75
- package/src/components/SVG.jsx +0 -59
- package/src/components/SwipeWrapper.jsx +0 -37
- package/src/components/controls/Fullscreen.jsx +0 -25
- package/src/components/controls/LeftNav.jsx +0 -26
- package/src/components/controls/PlayPause.jsx +0 -25
- package/src/components/controls/RightNav.jsx +0 -26
- package/webpack.build.js +0 -171
- package/webpack.config.js +0 -52
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
@use "sass:color";
|
|
2
|
+
|
|
1
3
|
$ig-small-screen: 768px !default;
|
|
2
4
|
$ig-xsmall-screen: 480px !default;
|
|
3
5
|
$ig-white: #fff !default;
|
|
4
6
|
$ig-black: #000 !default;
|
|
5
7
|
$ig-blue: #337ab7 !default;
|
|
6
|
-
$ig-background-black: rgba(0, 0, 0, .4) !default;
|
|
8
|
+
$ig-background-black: rgba(0, 0, 0, 0.4) !default;
|
|
7
9
|
$ig-transparent: rgba(0, 0, 0, 0) !default;
|
|
8
|
-
$ig-shadow: 0 2px 2px
|
|
10
|
+
$ig-shadow: 0 2px 2px color.adjust($ig-black, $lightness: 10%);
|
|
9
11
|
|
|
10
12
|
@mixin vendor-prefix($name, $value) {
|
|
11
|
-
@each $vendor in (
|
|
13
|
+
@each $vendor in ("-webkit-", "-moz-", "-ms-", "-o-", "") {
|
|
12
14
|
#{$vendor}#{$name}: #{$value};
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -16,7 +18,7 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
16
18
|
// SVG ICON STYLES
|
|
17
19
|
.image-gallery-icon {
|
|
18
20
|
color: $ig-white;
|
|
19
|
-
transition: all .3s ease-out;
|
|
21
|
+
transition: all 0.3s ease-out;
|
|
20
22
|
appearance: none;
|
|
21
23
|
background-color: transparent;
|
|
22
24
|
border: 0;
|
|
@@ -86,6 +88,46 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
86
88
|
left: 0;
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
.image-gallery-top-nav,
|
|
92
|
+
.image-gallery-bottom-nav {
|
|
93
|
+
padding: 10px 10px;
|
|
94
|
+
left: 50%;
|
|
95
|
+
transform: translateX(-50%);
|
|
96
|
+
|
|
97
|
+
.image-gallery-svg {
|
|
98
|
+
height: 120px;
|
|
99
|
+
width: 90px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (max-width: $ig-small-screen) {
|
|
103
|
+
.image-gallery-svg {
|
|
104
|
+
height: 72px;
|
|
105
|
+
width: 48px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (max-width: $ig-xsmall-screen) {
|
|
110
|
+
.image-gallery-svg {
|
|
111
|
+
height: 48px;
|
|
112
|
+
width: 36px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&[disabled] {
|
|
117
|
+
cursor: disabled;
|
|
118
|
+
opacity: 0.6;
|
|
119
|
+
pointer-events: none;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.image-gallery-top-nav {
|
|
124
|
+
top: 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.image-gallery-bottom-nav {
|
|
128
|
+
bottom: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
89
131
|
.image-gallery-left-nav,
|
|
90
132
|
.image-gallery-right-nav {
|
|
91
133
|
padding: 50px 10px;
|
|
@@ -113,7 +155,7 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
113
155
|
|
|
114
156
|
&[disabled] {
|
|
115
157
|
cursor: disabled;
|
|
116
|
-
opacity: .6;
|
|
158
|
+
opacity: 0.6;
|
|
117
159
|
pointer-events: none;
|
|
118
160
|
}
|
|
119
161
|
}
|
|
@@ -128,7 +170,7 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
128
170
|
// End of Icon styles
|
|
129
171
|
|
|
130
172
|
.image-gallery {
|
|
131
|
-
@include vendor-prefix(
|
|
173
|
+
@include vendor-prefix("user-select", none);
|
|
132
174
|
-webkit-tap-highlight-color: $ig-transparent;
|
|
133
175
|
position: relative;
|
|
134
176
|
|
|
@@ -194,6 +236,7 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
194
236
|
position: relative;
|
|
195
237
|
white-space: nowrap;
|
|
196
238
|
text-align: center;
|
|
239
|
+
touch-action: none; // prevent scrolling when touching gallery
|
|
197
240
|
}
|
|
198
241
|
|
|
199
242
|
.image-gallery-slide {
|
|
@@ -223,10 +266,9 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
223
266
|
|
|
224
267
|
@media (max-width: $ig-small-screen) {
|
|
225
268
|
bottom: 45px;
|
|
226
|
-
font-size: .8em;
|
|
269
|
+
font-size: 0.8em;
|
|
227
270
|
padding: 8px 15px;
|
|
228
271
|
}
|
|
229
|
-
|
|
230
272
|
}
|
|
231
273
|
}
|
|
232
274
|
|
|
@@ -256,7 +298,7 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
256
298
|
margin: 0 5px;
|
|
257
299
|
outline: none;
|
|
258
300
|
padding: 5px;
|
|
259
|
-
transition: all .2s ease-out;
|
|
301
|
+
transition: all 0.2s ease-out;
|
|
260
302
|
|
|
261
303
|
@media (max-width: $ig-small-screen) {
|
|
262
304
|
margin: 0 3px;
|
|
@@ -290,6 +332,29 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
290
332
|
}
|
|
291
333
|
}
|
|
292
334
|
}
|
|
335
|
+
|
|
336
|
+
&.image-gallery-bullets-vertical {
|
|
337
|
+
left: 20px;
|
|
338
|
+
right: auto;
|
|
339
|
+
bottom: auto;
|
|
340
|
+
width: auto;
|
|
341
|
+
top: 50%;
|
|
342
|
+
transform: translateY(-50%);
|
|
343
|
+
|
|
344
|
+
.image-gallery-bullet {
|
|
345
|
+
display: block;
|
|
346
|
+
margin: 12px 0;
|
|
347
|
+
|
|
348
|
+
@media (max-width: $ig-small-screen) {
|
|
349
|
+
margin: 6px 0px;
|
|
350
|
+
padding: 3px;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
@media (max-width: $ig-xsmall-screen) {
|
|
354
|
+
padding: 2.7px;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
293
358
|
}
|
|
294
359
|
|
|
295
360
|
.image-gallery-thumbnails-wrapper {
|
|
@@ -333,9 +398,7 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
333
398
|
margin-left: 0;
|
|
334
399
|
margin-top: 2px;
|
|
335
400
|
}
|
|
336
|
-
|
|
337
401
|
}
|
|
338
|
-
|
|
339
402
|
}
|
|
340
403
|
}
|
|
341
404
|
|
|
@@ -362,13 +425,12 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
362
425
|
text-align: center;
|
|
363
426
|
white-space: nowrap;
|
|
364
427
|
}
|
|
365
|
-
|
|
366
428
|
}
|
|
367
429
|
|
|
368
430
|
.image-gallery-thumbnail {
|
|
369
431
|
display: inline-block;
|
|
370
432
|
border: 4px solid transparent;
|
|
371
|
-
transition: border .3s ease-out;
|
|
433
|
+
transition: border 0.3s ease-out;
|
|
372
434
|
width: 100px;
|
|
373
435
|
background: transparent;
|
|
374
436
|
padding: 0;
|
|
@@ -413,7 +475,6 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
413
475
|
}
|
|
414
476
|
}
|
|
415
477
|
}
|
|
416
|
-
|
|
417
478
|
}
|
|
418
479
|
|
|
419
480
|
.image-gallery-thumbnail-label {
|
|
@@ -430,9 +491,9 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
430
491
|
white-space: normal;
|
|
431
492
|
width: 100%;
|
|
432
493
|
|
|
433
|
-
@media(max-width: $ig-small-screen) {
|
|
434
|
-
font-size: .8em;
|
|
435
|
-
line-height: .8em;
|
|
494
|
+
@media (max-width: $ig-small-screen) {
|
|
495
|
+
font-size: 0.8em;
|
|
496
|
+
line-height: 0.8em;
|
|
436
497
|
}
|
|
437
498
|
}
|
|
438
499
|
|
|
@@ -446,8 +507,8 @@ $ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
|
446
507
|
top: 0;
|
|
447
508
|
z-index: 4;
|
|
448
509
|
|
|
449
|
-
@media(max-width: $ig-small-screen) {
|
|
450
|
-
font-size: .8em;
|
|
510
|
+
@media (max-width: $ig-small-screen) {
|
|
511
|
+
font-size: 0.8em;
|
|
451
512
|
padding: 5px 10px;
|
|
452
513
|
}
|
|
453
|
-
}
|
|
514
|
+
}
|
package/.eslintrc.json
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:react/recommended",
|
|
9
|
-
"plugin:prettier/recommended", // Enable eslint-plugin-prettier and eslint-config-prettier
|
|
10
|
-
"plugin:import/errors", // Enable eslint-plugin-import
|
|
11
|
-
"plugin:import/warnings",
|
|
12
|
-
"plugin:jsx-a11y/recommended", // Enable eslint-plugin-jsx-a11y
|
|
13
|
-
"plugin:react-hooks/recommended",
|
|
14
|
-
"plugin:jest/recommended"
|
|
15
|
-
],
|
|
16
|
-
"parser": "babel-eslint",
|
|
17
|
-
"parserOptions": {
|
|
18
|
-
"ecmaFeatures": {
|
|
19
|
-
"jsx": true
|
|
20
|
-
},
|
|
21
|
-
"ecmaVersion": 12,
|
|
22
|
-
"sourceType": "module"
|
|
23
|
-
},
|
|
24
|
-
"plugins": ["react", "jest"],
|
|
25
|
-
"rules": {
|
|
26
|
-
"react/display-name": "off"
|
|
27
|
-
},
|
|
28
|
-
"settings": {
|
|
29
|
-
"react": {
|
|
30
|
-
"version": "detect"
|
|
31
|
-
},
|
|
32
|
-
"import/resolver": {
|
|
33
|
-
"alias": {
|
|
34
|
-
"map": [["src", "./src"]],
|
|
35
|
-
"extensions": [".ts", ".js", ".jsx", ".json"]
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"overrides": [
|
|
40
|
-
{
|
|
41
|
-
"files": ["*.js", "*.jsx"],
|
|
42
|
-
"rules": {
|
|
43
|
-
"prettier/prettier": ["error", { "trailingComma": "es5" }]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Create a report to help us improve
|
|
4
|
-
title: ''
|
|
5
|
-
labels: ''
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Checklist before opening an issue**\
|
|
11
|
-
Lots of issues are opened that are unrelated to this package, please take a moment to ensure the issue is not on your end 🙏.
|
|
12
|
-
- [ ] Did you try google?
|
|
13
|
-
- [ ] Did you search for previous Issues in this repo?
|
|
14
|
-
|
|
15
|
-
**Describe the bug**\
|
|
16
|
-
A clear and concise description of what the bug is.
|
|
17
|
-
|
|
18
|
-
**Image Gallery Version**\
|
|
19
|
-
What version of `react-image-gallery` are you using?
|
|
20
|
-
|
|
21
|
-
**To Reproduce**\
|
|
22
|
-
Steps to reproduce the behavior:
|
|
23
|
-
1. Go to '...'
|
|
24
|
-
2. Click on '....'
|
|
25
|
-
3. Scroll down to '....'
|
|
26
|
-
4. See error
|
|
27
|
-
|
|
28
|
-
**Expected behavior**\
|
|
29
|
-
A clear and concise description of what you expected to happen.
|
|
30
|
-
|
|
31
|
-
**Screenshots**\
|
|
32
|
-
If applicable, add screenshots to help explain your problem.
|
|
33
|
-
|
|
34
|
-
**Client info (please complete the following information):**\
|
|
35
|
-
- OS: [e.g. iOS]
|
|
36
|
-
- Browser: [e.g. chrome, safari]
|
|
37
|
-
|
|
38
|
-
**Additional context**\
|
|
39
|
-
Add any other context about the problem here.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Feature request
|
|
3
|
-
about: Suggest an idea for this project
|
|
4
|
-
title: ''
|
|
5
|
-
labels: ''
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Is your feature request related to a problem? Please describe.**
|
|
11
|
-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
-
|
|
13
|
-
**Describe the solution you'd like**
|
|
14
|
-
A clear and concise description of what you want to happen.
|
|
15
|
-
|
|
16
|
-
**Describe alternatives you've considered**
|
|
17
|
-
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
-
|
|
19
|
-
**Additional context**
|
|
20
|
-
Add any other context or screenshots about the feature request here.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
-
# They are provided by a third-party and are governed by
|
|
3
|
-
# separate terms of service, privacy policy, and support
|
|
4
|
-
# documentation.
|
|
5
|
-
# ESLint is a tool for identifying and reporting on patterns
|
|
6
|
-
# found in ECMAScript/JavaScript code.
|
|
7
|
-
# More details at https://github.com/eslint/eslint
|
|
8
|
-
# and https://eslint.org
|
|
9
|
-
|
|
10
|
-
name: workflow
|
|
11
|
-
|
|
12
|
-
on:
|
|
13
|
-
push:
|
|
14
|
-
branches: ["master"]
|
|
15
|
-
pull_request:
|
|
16
|
-
# The branches below must be a subset of the branches above
|
|
17
|
-
branches: ["master"]
|
|
18
|
-
schedule:
|
|
19
|
-
- cron: "35 15 * * 3"
|
|
20
|
-
|
|
21
|
-
jobs:
|
|
22
|
-
eslint:
|
|
23
|
-
name: Eslint
|
|
24
|
-
runs-on: ubuntu-latest
|
|
25
|
-
permissions:
|
|
26
|
-
contents: read
|
|
27
|
-
security-events: write
|
|
28
|
-
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
|
29
|
-
steps:
|
|
30
|
-
- name: Checkout code
|
|
31
|
-
uses: actions/checkout@v3
|
|
32
|
-
|
|
33
|
-
- name: Install Packages
|
|
34
|
-
run: yarn
|
|
35
|
-
|
|
36
|
-
- name: Run ESLint
|
|
37
|
-
run: yarn lint
|
|
38
|
-
continue-on-error: false
|
|
39
|
-
|
|
40
|
-
jest:
|
|
41
|
-
name: Jest
|
|
42
|
-
runs-on: ubuntu-latest
|
|
43
|
-
permissions:
|
|
44
|
-
contents: read
|
|
45
|
-
security-events: write
|
|
46
|
-
actions: read
|
|
47
|
-
steps:
|
|
48
|
-
- name: Checkout code
|
|
49
|
-
uses: actions/checkout@v3
|
|
50
|
-
|
|
51
|
-
- name: Install Packages
|
|
52
|
-
run: yarn
|
|
53
|
-
|
|
54
|
-
- name: Run Jest
|
|
55
|
-
run: yarn jest
|
|
56
|
-
continue-on-error: false
|
package/babel.config.js
DELETED
package/jest.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
testEnvironment: "jsdom", // Use jsdom environment for DOM-related tests
|
|
5
|
-
roots: ["./src"], // The root directory for running tests
|
|
6
|
-
transform: {
|
|
7
|
-
"^.+\\.(js|jsx)$": "babel-jest",
|
|
8
|
-
},
|
|
9
|
-
testMatch: ["**/__tests__/**/*.js?(x)", "**/?(*.)+(spec|test).js?(x)"], // File patterns for test files
|
|
10
|
-
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], // Setup file to extend Jest with RTL matchers
|
|
11
|
-
moduleNameMapper: {
|
|
12
|
-
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
|
|
13
|
-
"^src/(.*)$": path.resolve(__dirname, "src/$1"), // Add the moduleNameMapper for your alias
|
|
14
|
-
},
|
|
15
|
-
transformIgnorePatterns: ["/node_modules/(?!(lodash-es)/)"],
|
|
16
|
-
};
|