Skip to content

Commit ff62702

Browse files
committed
add "powered by" footer and credits prop
1 parent 91adef8 commit ff62702

12 files changed

Lines changed: 135 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 4.23.0
4+
5+
- Add "powered by" footer and [credits prop](https://pqina.nl/filepond/docs/patterns/api/filepond-instance/#disabling-credits).
6+
7+
38
## 4.22.1
49

510
- Fix problem with locale files.

dist/filepond.css

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* FilePond 4.22.1
2+
* FilePond 4.23.0
33
* Licensed under MIT, https://opensource.org/licenses/MIT/
44
* Please visit https://pqina.nl/filepond/ for details.
55
*/
@@ -925,3 +925,21 @@
925925
margin-top: 1em;
926926
margin-bottom: 1em;
927927
}
928+
929+
.filepond--root .filepond--credits {
930+
position: absolute;
931+
right: 0;
932+
opacity: 0.175;
933+
line-height: 0.85;
934+
font-size: 11px;
935+
color: inherit;
936+
text-decoration: none;
937+
z-index: 3;
938+
bottom: -14px;
939+
}
940+
941+
.filepond--root .filepond--credits[style] {
942+
top: 0;
943+
bottom: auto;
944+
margin-top: 14px;
945+
}

dist/filepond.esm.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* FilePond 4.22.1
2+
* FilePond 4.23.0
33
* Licensed under MIT, https://opensource.org/licenses/MIT/
44
* Please visit https://pqina.nl/filepond/ for details.
55
*/
@@ -2023,7 +2023,10 @@ const defaultOptions = {
20232023
styleButtonRemoveItemAlign: [false, Type.BOOLEAN],
20242024

20252025
// custom initial files array
2026-
files: [[], Type.ARRAY]
2026+
files: [[], Type.ARRAY],
2027+
2028+
// show support by displaying credits
2029+
credits: [['https://pqina.nl/', 'Powered by PQINA'], Type.ARRAY]
20272030
};
20282031

20292032
const getItemByQuery = (items, query) => {
@@ -6044,11 +6047,12 @@ const write$3 = ({ root, props }) => {
60446047

60456048
const panel = createView({
60466049
name: 'panel',
6050+
read: ({ root, props }) => (props.heightCurrent = root.ref.bottom.translateY),
60476051
write: write$3,
60486052
create: create$6,
60496053
ignoreRect: true,
60506054
mixins: {
6051-
apis: ['height', 'scalable']
6055+
apis: ['height', 'heightCurrent', 'scalable']
60526056
}
60536057
});
60546058

@@ -8171,6 +8175,22 @@ const create$e = ({ root, props }) => {
81718175
root.element.addEventListener('touchmove', prevent, { passive: false });
81728176
root.element.addEventListener('gesturestart', prevent);
81738177
}
8178+
8179+
// add credits
8180+
const credits = root.query('GET_CREDITS');
8181+
const hasCredits = credits.length === 2;
8182+
if (hasCredits) {
8183+
const frag = document.createElement('a');
8184+
frag.className = 'filepond--credits';
8185+
frag.setAttribute('aria-hidden', 'true');
8186+
frag.href = credits[0];
8187+
frag.tabindex = -1;
8188+
frag.target = '_blank';
8189+
frag.rel = 'noopener noreferrer';
8190+
frag.textContent = credits[1];
8191+
root.element.appendChild(frag);
8192+
root.ref.credits = frag;
8193+
}
81748194
};
81758195

81768196
const write$9 = ({ root, props, actions }) => {
@@ -8398,6 +8418,10 @@ const write$9 = ({ root, props, actions }) => {
83988418
// set container bounds (so pushes siblings downwards)
83998419
root.height = Math.max(labelHeight, boundsHeight - itemMargin);
84008420
}
8421+
8422+
// move credits to bottom
8423+
if (root.ref.credits && panel.heightCurrent)
8424+
root.ref.credits.style.transform = `translateY(${panel.heightCurrent}px)`;
84018425
};
84028426

84038427
const calculateListItemMargin = root => {

dist/filepond.esm.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/filepond.js

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* FilePond 4.22.1
2+
* FilePond 4.23.0
33
* Licensed under MIT, https://opensource.org/licenses/MIT/
44
* Please visit https://pqina.nl/filepond/ for details.
55
*/
@@ -4063,7 +4063,10 @@
40634063
styleButtonRemoveItemAlign: [false, Type.BOOLEAN],
40644064

40654065
// custom initial files array
4066-
files: [[], Type.ARRAY]
4066+
files: [[], Type.ARRAY],
4067+
4068+
// show support by displaying credits
4069+
credits: [['https://pqina.nl/', 'Powered by PQINA'], Type.ARRAY]
40674070
};
40684071

40694072
var getItemByQuery = function getItemByQuery(items, query) {
@@ -8731,11 +8734,16 @@
87318734

87328735
var panel = createView({
87338736
name: 'panel',
8737+
read: function read(_ref3) {
8738+
var root = _ref3.root,
8739+
props = _ref3.props;
8740+
return (props.heightCurrent = root.ref.bottom.translateY);
8741+
},
87348742
write: write$3,
87358743
create: create$6,
87368744
ignoreRect: true,
87378745
mixins: {
8738-
apis: ['height', 'scalable']
8746+
apis: ['height', 'heightCurrent', 'scalable']
87398747
}
87408748
});
87418749

@@ -11090,6 +11098,22 @@
1109011098
root.element.addEventListener('touchmove', prevent, { passive: false });
1109111099
root.element.addEventListener('gesturestart', prevent);
1109211100
}
11101+
11102+
// add credits
11103+
var credits = root.query('GET_CREDITS');
11104+
var hasCredits = credits.length === 2;
11105+
if (hasCredits) {
11106+
var frag = document.createElement('a');
11107+
frag.className = 'filepond--credits';
11108+
frag.setAttribute('aria-hidden', 'true');
11109+
frag.href = credits[0];
11110+
frag.tabindex = -1;
11111+
frag.target = '_blank';
11112+
frag.rel = 'noopener noreferrer';
11113+
frag.textContent = credits[1];
11114+
root.element.appendChild(frag);
11115+
root.ref.credits = frag;
11116+
}
1109311117
};
1109411118

1109511119
var write$9 = function write(_ref3) {
@@ -11333,6 +11357,11 @@
1133311357
// set container bounds (so pushes siblings downwards)
1133411358
root.height = Math.max(labelHeight, boundsHeight - itemMargin);
1133511359
}
11360+
11361+
// move credits to bottom
11362+
if (root.ref.credits && panel.heightCurrent)
11363+
root.ref.credits.style.transform =
11364+
'translateY(' + panel.heightCurrent + 'px)';
1133611365
};
1133711366

1133811367
var calculateListItemMargin = function calculateListItemMargin(root) {

dist/filepond.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/filepond.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "filepond",
3-
"version": "4.22.1",
3+
"version": "4.23.0",
44
"description": "FilePond, Where files go to stretch their bits.",
55
"license": "MIT",
66
"author": {

src/css/root.scss

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,26 @@
6565
}
6666

6767
.filepond--list-scroller {
68-
margin-top:1em;
69-
margin-bottom:1em;
68+
margin-top: 1em;
69+
margin-bottom: 1em;
70+
}
71+
72+
.filepond--credits {
73+
position: absolute;
74+
right: 0;
75+
opacity: 0.175;
76+
line-height: .85;
77+
font-size: 11px;
78+
color: inherit;
79+
text-decoration: none;
80+
z-index: 3;
81+
bottom: -14px;
82+
}
83+
84+
.filepond--credits[style] {
85+
top: 0;
86+
bottom: auto;
87+
margin-top: 14px;
7088
}
7189

7290
}

src/js/app/options.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,8 @@ export const defaultOptions = {
186186
styleButtonRemoveItemAlign: [false, Type.BOOLEAN],
187187

188188
// custom initial files array
189-
files: [[], Type.ARRAY]
189+
files: [[], Type.ARRAY],
190+
191+
// show support by displaying credits
192+
credits: [['https://pqina.nl/', 'Powered by PQINA'], Type.ARRAY]
190193
};

0 commit comments

Comments
 (0)