@limetech/lime-elements 37.9.0 → 37.10.1
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/CHANGELOG.md +17 -0
- package/dist/cjs/{_arrayIncludesWith-29083f83.js → _arrayIncludesWith-8705cfc6.js} +4 -4
- package/dist/cjs/{_arrayIncludesWith-29083f83.js.map → _arrayIncludesWith-8705cfc6.js.map} +1 -1
- package/dist/cjs/_baseForOwn-fc9c8906.js +56 -0
- package/dist/cjs/_baseForOwn-fc9c8906.js.map +1 -0
- package/dist/cjs/{isEqual-d2a13a24.js → _baseIsEqual-2b4442b5.js} +1 -34
- package/dist/cjs/_baseIsEqual-2b4442b5.js.map +1 -0
- package/dist/cjs/{pickBy-3ef47bf2.js → _baseIteratee-5f8a72f6.js} +16 -313
- package/dist/cjs/_baseIteratee-5f8a72f6.js.map +1 -0
- package/dist/cjs/file-metadata-f259bba5.js +396 -0
- package/dist/cjs/file-metadata-f259bba5.js.map +1 -0
- package/dist/cjs/isEqual-a3bb68c4.js +39 -0
- package/dist/cjs/isEqual-a3bb68c4.js.map +1 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +2 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-dialog.cjs.entry.js +2 -1
- package/dist/cjs/limel-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-file-dropzone.cjs.entry.js +255 -0
- package/dist/cjs/limel-file-dropzone.cjs.entry.js.map +1 -0
- package/dist/cjs/limel-file.cjs.entry.js +6 -391
- package/dist/cjs/limel-file.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +27 -73
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-tab-bar.cjs.entry.js +6 -5
- package/dist/cjs/limel-tab-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +8 -6
- package/dist/cjs/limel-table.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pickBy-1e9455c7.js +311 -0
- package/dist/cjs/pickBy-1e9455c7.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/file/file.js +3 -3
- package/dist/collection/components/file/file.js.map +1 -1
- package/dist/collection/components/file-dropzone/file-dropzone.css +59 -0
- package/dist/collection/components/file-dropzone/file-dropzone.js +217 -0
- package/dist/collection/components/file-dropzone/file-dropzone.js.map +1 -0
- package/dist/collection/components/picker/picker.js +1 -1
- package/dist/collection/components/picker/searcher.types.js.map +1 -1
- package/dist/collection/global/shared-types/file.types.js.map +1 -0
- package/dist/collection/interface.js +1 -1
- package/dist/collection/interface.js.map +1 -1
- package/dist/collection/{components/file → util}/file-metadata.js +4 -4
- package/dist/collection/util/file-metadata.js.map +1 -0
- package/dist/collection/util/files.js +37 -0
- package/dist/collection/util/files.js.map +1 -0
- package/dist/esm/{_arrayIncludesWith-969bccda.js → _arrayIncludesWith-8b8a8b46.js} +2 -2
- package/dist/esm/{_arrayIncludesWith-969bccda.js.map → _arrayIncludesWith-8b8a8b46.js.map} +1 -1
- package/dist/esm/_baseForOwn-3dd6837f.js +54 -0
- package/dist/esm/_baseForOwn-3dd6837f.js.map +1 -0
- package/dist/esm/{isEqual-c5a636a4.js → _baseIsEqual-633b7929.js} +2 -34
- package/dist/esm/_baseIsEqual-633b7929.js.map +1 -0
- package/dist/esm/{pickBy-d359eb12.js → _baseIteratee-2b2723f9.js} +7 -304
- package/dist/esm/_baseIteratee-2b2723f9.js.map +1 -0
- package/dist/esm/file-metadata-9a4780e2.js +391 -0
- package/dist/esm/file-metadata-9a4780e2.js.map +1 -0
- package/dist/esm/isEqual-d8fb9edc.js +37 -0
- package/dist/esm/isEqual-d8fb9edc.js.map +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +2 -1
- package/dist/esm/limel-chip_2.entry.js.map +1 -1
- package/dist/esm/limel-dialog.entry.js +2 -1
- package/dist/esm/limel-dialog.entry.js.map +1 -1
- package/dist/esm/limel-file-dropzone.entry.js +251 -0
- package/dist/esm/limel-file-dropzone.entry.js.map +1 -0
- package/dist/esm/limel-file.entry.js +2 -387
- package/dist/esm/limel-file.entry.js.map +1 -1
- package/dist/esm/limel-form.entry.js +6 -52
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/esm/limel-tab-bar.entry.js +3 -2
- package/dist/esm/limel-tab-bar.entry.js.map +1 -1
- package/dist/esm/limel-table.entry.js +8 -6
- package/dist/esm/limel-table.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pickBy-240917e2.js +306 -0
- package/dist/esm/pickBy-240917e2.js.map +1 -0
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/p-0c24c682.entry.js +2 -0
- package/dist/lime-elements/p-0c24c682.entry.js.map +1 -0
- package/dist/lime-elements/p-2e9fe8fd.js +2 -0
- package/dist/lime-elements/p-2e9fe8fd.js.map +1 -0
- package/dist/lime-elements/p-4cd3360b.entry.js +2 -0
- package/dist/lime-elements/p-4cd3360b.entry.js.map +1 -0
- package/dist/lime-elements/p-51ec4f02.js +2 -0
- package/dist/lime-elements/p-51ec4f02.js.map +1 -0
- package/dist/lime-elements/p-5def744e.js +2 -0
- package/dist/lime-elements/p-5def744e.js.map +1 -0
- package/dist/lime-elements/{p-b51fd0c7.entry.js → p-862f048d.entry.js} +15 -15
- package/dist/lime-elements/{p-b51fd0c7.entry.js.map → p-862f048d.entry.js.map} +1 -1
- package/dist/lime-elements/p-8bc1584b.js +2 -0
- package/dist/lime-elements/p-8bc1584b.js.map +1 -0
- package/dist/lime-elements/{p-a88039bf.entry.js → p-a20848fc.entry.js} +5 -5
- package/dist/lime-elements/p-a20848fc.entry.js.map +1 -0
- package/dist/lime-elements/p-aaf6dada.entry.js +2 -0
- package/dist/lime-elements/{p-1c67a941.entry.js.map → p-aaf6dada.entry.js.map} +1 -1
- package/dist/lime-elements/{p-82077942.entry.js → p-b2439774.entry.js} +2 -2
- package/dist/lime-elements/p-c5db5254.entry.js +2 -0
- package/dist/lime-elements/{p-fb54539a.entry.js.map → p-c5db5254.entry.js.map} +1 -1
- package/dist/lime-elements/{p-ade76f1d.js → p-cb91d37d.js} +2 -2
- package/dist/lime-elements/p-cb91d37d.js.map +1 -0
- package/dist/lime-elements/p-ce1c1f74.js +2 -0
- package/dist/lime-elements/p-ce1c1f74.js.map +1 -0
- package/dist/lime-elements/{p-fa607ed3.js → p-f4d83226.js} +2 -2
- package/dist/types/components/file/file.d.ts +1 -1
- package/dist/types/components/file-dropzone/file-dropzone.d.ts +71 -0
- package/dist/types/components/picker/searcher.types.d.ts +1 -1
- package/dist/types/components.d.ts +114 -2
- package/dist/types/interface.d.ts +1 -1
- package/dist/types/{components/file → util}/file-metadata.d.ts +1 -1
- package/dist/types/util/files.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cjs/isEqual-d2a13a24.js.map +0 -1
- package/dist/cjs/pickBy-3ef47bf2.js.map +0 -1
- package/dist/collection/components/file/file-metadata.js.map +0 -1
- package/dist/collection/components/file/file.types.js.map +0 -1
- package/dist/esm/isEqual-c5a636a4.js.map +0 -1
- package/dist/esm/pickBy-d359eb12.js.map +0 -1
- package/dist/lime-elements/p-1c67a941.entry.js +0 -2
- package/dist/lime-elements/p-a88039bf.entry.js.map +0 -1
- package/dist/lime-elements/p-ad8cb388.js +0 -2
- package/dist/lime-elements/p-ad8cb388.js.map +0 -1
- package/dist/lime-elements/p-ade76f1d.js.map +0 -1
- package/dist/lime-elements/p-b106a23e.entry.js +0 -2
- package/dist/lime-elements/p-b106a23e.entry.js.map +0 -1
- package/dist/lime-elements/p-fb54539a.entry.js +0 -2
- /package/dist/collection/{components/file → global/shared-types}/file.types.js +0 -0
- /package/dist/lime-elements/{p-82077942.entry.js.map → p-b2439774.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-fa607ed3.js.map → p-f4d83226.js.map} +0 -0
- /package/dist/types/{components/file → global/shared-types}/file.types.d.ts +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-232e9616.js';
|
|
2
|
+
import { g as getFileIcon, a as getFileExtensionTitle, b as getFileColor, c as getFileBackgroundColor } from './file-metadata-9a4780e2.js';
|
|
3
|
+
import { b as baseForOwn } from './_baseForOwn-3dd6837f.js';
|
|
4
|
+
import { b as isArrayLike } from './isArrayLike-385e0f31.js';
|
|
5
|
+
import { b as baseIteratee } from './_baseIteratee-2b2723f9.js';
|
|
6
|
+
import { i as isArray } from './isArray-80298bc7.js';
|
|
7
|
+
import './get-icon-props-0b65f85e.js';
|
|
8
|
+
import './_baseIsEqual-633b7929.js';
|
|
9
|
+
import './eq-c1c7f528.js';
|
|
10
|
+
import './isObject-c74e273c.js';
|
|
11
|
+
import './_getNative-93d6bfe9.js';
|
|
12
|
+
import './isObjectLike-38996507.js';
|
|
13
|
+
import './isSymbol-5bf20921.js';
|
|
14
|
+
import './identity-87aa3962.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A specialized version of `baseAggregator` for arrays.
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
* @param {Array} [array] The array to iterate over.
|
|
21
|
+
* @param {Function} setter The function to set `accumulator` values.
|
|
22
|
+
* @param {Function} iteratee The iteratee to transform keys.
|
|
23
|
+
* @param {Object} accumulator The initial aggregated object.
|
|
24
|
+
* @returns {Function} Returns `accumulator`.
|
|
25
|
+
*/
|
|
26
|
+
function arrayAggregator(array, setter, iteratee, accumulator) {
|
|
27
|
+
var index = -1,
|
|
28
|
+
length = array == null ? 0 : array.length;
|
|
29
|
+
|
|
30
|
+
while (++index < length) {
|
|
31
|
+
var value = array[index];
|
|
32
|
+
setter(accumulator, value, iteratee(value), array);
|
|
33
|
+
}
|
|
34
|
+
return accumulator;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates a `baseEach` or `baseEachRight` function.
|
|
39
|
+
*
|
|
40
|
+
* @private
|
|
41
|
+
* @param {Function} eachFunc The function to iterate over a collection.
|
|
42
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
43
|
+
* @returns {Function} Returns the new base function.
|
|
44
|
+
*/
|
|
45
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
46
|
+
return function(collection, iteratee) {
|
|
47
|
+
if (collection == null) {
|
|
48
|
+
return collection;
|
|
49
|
+
}
|
|
50
|
+
if (!isArrayLike(collection)) {
|
|
51
|
+
return eachFunc(collection, iteratee);
|
|
52
|
+
}
|
|
53
|
+
var length = collection.length,
|
|
54
|
+
index = fromRight ? length : -1,
|
|
55
|
+
iterable = Object(collection);
|
|
56
|
+
|
|
57
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
58
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return collection;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
71
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
72
|
+
* @returns {Array|Object} Returns `collection`.
|
|
73
|
+
*/
|
|
74
|
+
var baseEach = createBaseEach(baseForOwn);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
|
78
|
+
* by `iteratee` and values set by `setter`.
|
|
79
|
+
*
|
|
80
|
+
* @private
|
|
81
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
82
|
+
* @param {Function} setter The function to set `accumulator` values.
|
|
83
|
+
* @param {Function} iteratee The iteratee to transform keys.
|
|
84
|
+
* @param {Object} accumulator The initial aggregated object.
|
|
85
|
+
* @returns {Function} Returns `accumulator`.
|
|
86
|
+
*/
|
|
87
|
+
function baseAggregator(collection, setter, iteratee, accumulator) {
|
|
88
|
+
baseEach(collection, function(value, key, collection) {
|
|
89
|
+
setter(accumulator, value, iteratee(value), collection);
|
|
90
|
+
});
|
|
91
|
+
return accumulator;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Creates a function like `_.groupBy`.
|
|
96
|
+
*
|
|
97
|
+
* @private
|
|
98
|
+
* @param {Function} setter The function to set accumulator values.
|
|
99
|
+
* @param {Function} [initializer] The accumulator object initializer.
|
|
100
|
+
* @returns {Function} Returns the new aggregator function.
|
|
101
|
+
*/
|
|
102
|
+
function createAggregator(setter, initializer) {
|
|
103
|
+
return function(collection, iteratee) {
|
|
104
|
+
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
|
105
|
+
accumulator = initializer ? initializer() : {};
|
|
106
|
+
|
|
107
|
+
return func(collection, setter, baseIteratee(iteratee), accumulator);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creates an array of elements split into two groups, the first of which
|
|
113
|
+
* contains elements `predicate` returns truthy for, the second of which
|
|
114
|
+
* contains elements `predicate` returns falsey for. The predicate is
|
|
115
|
+
* invoked with one argument: (value).
|
|
116
|
+
*
|
|
117
|
+
* @static
|
|
118
|
+
* @memberOf _
|
|
119
|
+
* @since 3.0.0
|
|
120
|
+
* @category Collection
|
|
121
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
122
|
+
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
123
|
+
* @returns {Array} Returns the array of grouped elements.
|
|
124
|
+
* @example
|
|
125
|
+
*
|
|
126
|
+
* var users = [
|
|
127
|
+
* { 'user': 'barney', 'age': 36, 'active': false },
|
|
128
|
+
* { 'user': 'fred', 'age': 40, 'active': true },
|
|
129
|
+
* { 'user': 'pebbles', 'age': 1, 'active': false }
|
|
130
|
+
* ];
|
|
131
|
+
*
|
|
132
|
+
* _.partition(users, function(o) { return o.active; });
|
|
133
|
+
* // => objects for [['fred'], ['barney', 'pebbles']]
|
|
134
|
+
*
|
|
135
|
+
* // The `_.matches` iteratee shorthand.
|
|
136
|
+
* _.partition(users, { 'age': 1, 'active': false });
|
|
137
|
+
* // => objects for [['pebbles'], ['barney', 'fred']]
|
|
138
|
+
*
|
|
139
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
|
140
|
+
* _.partition(users, ['active', false]);
|
|
141
|
+
* // => objects for [['barney', 'pebbles'], ['fred']]
|
|
142
|
+
*
|
|
143
|
+
* // The `_.property` iteratee shorthand.
|
|
144
|
+
* _.partition(users, 'active');
|
|
145
|
+
* // => objects for [['fred'], ['barney', 'pebbles']]
|
|
146
|
+
*/
|
|
147
|
+
var partition = createAggregator(function(result, value, key) {
|
|
148
|
+
result[key ? 0 : 1].push(value);
|
|
149
|
+
}, function() { return [[], []]; });
|
|
150
|
+
|
|
151
|
+
function createFileInfo(file) {
|
|
152
|
+
const limeFile = {
|
|
153
|
+
id: crypto.randomUUID(),
|
|
154
|
+
filename: file.name,
|
|
155
|
+
contentType: file.type,
|
|
156
|
+
size: file.size,
|
|
157
|
+
fileContent: file,
|
|
158
|
+
};
|
|
159
|
+
limeFile.icon = {
|
|
160
|
+
name: getFileIcon(limeFile),
|
|
161
|
+
title: getFileExtensionTitle(limeFile),
|
|
162
|
+
color: getFileColor(limeFile),
|
|
163
|
+
backgroundColor: getFileBackgroundColor(limeFile),
|
|
164
|
+
};
|
|
165
|
+
return limeFile;
|
|
166
|
+
}
|
|
167
|
+
function isTypeAccepted(file, accept) {
|
|
168
|
+
if (accept === undefined || accept === '*') {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
const acceptList = accept.split(',').map((raw) => raw.trim());
|
|
172
|
+
return acceptList.some((acceptedType) => {
|
|
173
|
+
if (acceptedType === file.contentType) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
if (acceptedType.endsWith('/*')) {
|
|
177
|
+
const baseType = acceptedType.split('/')[0];
|
|
178
|
+
return file.contentType.startsWith(`${baseType}/`);
|
|
179
|
+
}
|
|
180
|
+
if (acceptedType.startsWith('.')) {
|
|
181
|
+
const fileType = acceptedType.split('.')[1];
|
|
182
|
+
return file.contentType.endsWith(`/${fileType}`);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const fileDropzoneCss = ":host(limel-file-dropzone){display:grid;position:relative}.has-file-to-drop{animation:display-drop-zone 0.6s ease forwards;box-sizing:border-box;isolation:isolate;z-index:1;position:absolute;inset:0.25rem;overflow:hidden;display:flex;justify-content:center;align-items:center;gap:0.5rem;color:rgb(var(--contrast-700));border:0.125rem dashed rgb(var(--color-cyan-light));border-radius:0.75rem}.text-helpertext{display:flex;flex-direction:column;justify-content:center;align-items:flex-start}.icon{width:clamp(2rem, 5vh, 7rem)}.text{font-size:clamp(1rem, 2vh, 1.75rem)}.helper-text{font-size:clamp(0.75rem, 1.5vh, 1rem)}@keyframes display-drop-zone{0%{background-color:rgb(var(--contrast-1100), 0);backdrop-filter:blur(0);-webkit-backdrop-filter:blur(0);scale:0.9;opacity:0}50%{scale:1;opacity:1}100%{background-color:rgb(var(--contrast-1100), 0.8);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem)}}";
|
|
188
|
+
|
|
189
|
+
const FileDropzone = class {
|
|
190
|
+
constructor(hostRef) {
|
|
191
|
+
registerInstance(this, hostRef);
|
|
192
|
+
this.filesSelected = createEvent(this, "filesSelected", 7);
|
|
193
|
+
this.filesRejected = createEvent(this, "filesRejected", 7);
|
|
194
|
+
this.renderOnDragLayout = () => {
|
|
195
|
+
if (!this.hasFileToDrop) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
return (h("div", { class: "has-file-to-drop" }, h("limel-icon", { class: "icon", name: "upload_2" }), h("div", { class: "text-helpertext" }, this.renderText(), this.renderHelperText())));
|
|
199
|
+
};
|
|
200
|
+
this.renderText = () => {
|
|
201
|
+
if (!this.text) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
return h("span", { class: "text" }, this.text);
|
|
205
|
+
};
|
|
206
|
+
this.renderHelperText = () => {
|
|
207
|
+
if (!this.helperText) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
return h("span", { class: "helper-text" }, this.helperText);
|
|
211
|
+
};
|
|
212
|
+
this.handleDrop = (event) => {
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
event.preventDefault();
|
|
215
|
+
this.hasFileToDrop = false;
|
|
216
|
+
if (this.disabled) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const files = Array.from(event.dataTransfer.files);
|
|
220
|
+
const fileInfos = files.map(createFileInfo);
|
|
221
|
+
const [acceptedFileInfos, rejectedFileInfos] = partition(fileInfos, (file) => isTypeAccepted(file, this.accept));
|
|
222
|
+
if (acceptedFileInfos.length > 0) {
|
|
223
|
+
this.filesSelected.emit(acceptedFileInfos);
|
|
224
|
+
}
|
|
225
|
+
if (rejectedFileInfos.length > 0) {
|
|
226
|
+
this.filesRejected.emit(rejectedFileInfos);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
this.handleDragOver = (event) => {
|
|
230
|
+
this.hasFileToDrop = true;
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
};
|
|
233
|
+
this.handleDragLeave = (event) => {
|
|
234
|
+
this.hasFileToDrop = false;
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
};
|
|
237
|
+
this.accept = '*';
|
|
238
|
+
this.disabled = false;
|
|
239
|
+
this.text = undefined;
|
|
240
|
+
this.helperText = '';
|
|
241
|
+
this.hasFileToDrop = false;
|
|
242
|
+
}
|
|
243
|
+
render() {
|
|
244
|
+
return (h(Host, { onDrop: this.handleDrop, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave }, h("slot", null), this.renderOnDragLayout()));
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
FileDropzone.style = fileDropzoneCss;
|
|
248
|
+
|
|
249
|
+
export { FileDropzone as limel_file_dropzone };
|
|
250
|
+
|
|
251
|
+
//# sourceMappingURL=limel-file-dropzone.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"limel-file-dropzone.entry.js","mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE;AAC/D,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;AAChD;AACA,EAAE,OAAO,EAAE,KAAK,GAAG,MAAM,EAAE;AAC3B,IAAI,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AAC7B,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AACvD,GAAG;AACH,EAAE,OAAO,WAAW,CAAC;AACrB;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE;AAC7C,EAAE,OAAO,SAAS,UAAU,EAAE,QAAQ,EAAE;AACxC,IAAI,IAAI,UAAU,IAAI,IAAI,EAAE;AAC5B,MAAM,OAAO,UAAU,CAAC;AACxB,KAAK;AACL,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;AAClC,MAAM,OAAO,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC5C,KAAK;AACL,IAAI,IAAI,MAAM,GAAG,UAAU,CAAC,MAAM;AAClC,QAAQ,KA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B,WAAW,EAAE,IAAI,CAAC,eAAe,IAEjC,eAAQ,EACP,IAAI,CAAC,kBAAkB,EAAE,CACvB,EACT;GACL;;;;;;","names":[],"sources":["./node_modules/lodash-es/_arrayAggregator.js","./node_modules/lodash-es/_createBaseEach.js","./node_modules/lodash-es/_baseEach.js","./node_modules/lodash-es/_baseAggregator.js","./node_modules/lodash-es/_createAggregator.js","./node_modules/lodash-es/partition.js","./src/util/files.ts","./src/components/file-dropzone/file-dropzone.scss?tag=limel-file-dropzone&encapsulation=shadow","./src/components/file-dropzone/file-dropzone.tsx"],"sourcesContent":["/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n}\n\nexport default arrayAggregator;\n","import isArrayLike from './isArrayLike.js';\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nexport default createBaseEach;\n","import baseForOwn from './_baseForOwn.js';\nimport createBaseEach from './_createBaseEach.js';\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nexport default baseEach;\n","import baseEach from './_baseEach.js';\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n}\n\nexport default baseAggregator;\n","import arrayAggregator from './_arrayAggregator.js';\nimport baseAggregator from './_baseAggregator.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, baseIteratee(iteratee, 2), accumulator);\n };\n}\n\nexport default createAggregator;\n","import createAggregator from './_createAggregator.js';\n\n/**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\nvar partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n}, function() { return [[], []]; });\n\nexport default partition;\n","import { FileInfo } from '../global/shared-types/file.types';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from './file-metadata';\n\nexport function createFileInfo(file: File): FileInfo {\n const limeFile: FileInfo = {\n id: crypto.randomUUID(),\n filename: file.name,\n contentType: file.type,\n size: file.size,\n fileContent: file,\n };\n limeFile.icon = {\n name: getFileIcon(limeFile),\n title: getFileExtensionTitle(limeFile),\n color: getFileColor(limeFile),\n backgroundColor: getFileBackgroundColor(limeFile),\n };\n\n return limeFile;\n}\n\nexport function isTypeAccepted(file: FileInfo, accept?: string): boolean {\n if (accept === undefined || accept === '*') {\n return true;\n }\n\n const acceptList = accept.split(',').map((raw) => raw.trim());\n\n return acceptList.some((acceptedType: string) => {\n if (acceptedType === file.contentType) {\n return true;\n }\n\n if (acceptedType.endsWith('/*')) {\n const baseType = acceptedType.split('/')[0];\n\n return file.contentType.startsWith(`${baseType}/`);\n }\n\n if (acceptedType.startsWith('.')) {\n const fileType = acceptedType.split('.')[1];\n\n return file.contentType.endsWith(`/${fileType}`);\n }\n });\n}\n",":host(limel-file-dropzone) {\n display: grid;\n position: relative;\n}\n\n.has-file-to-drop {\n animation: display-drop-zone 0.6s ease forwards;\n\n box-sizing: border-box;\n isolation: isolate;\n z-index: 1;\n position: absolute;\n inset: 0.25rem;\n\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0.5rem;\n\n color: rgb(var(--contrast-700));\n\n border: 0.125rem dashed rgb(var(--color-cyan-light));\n border-radius: 0.75rem;\n}\n\n.text-helpertext {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n}\n\n.icon {\n width: clamp(2rem, 5vh, 7rem);\n}\n\n.text {\n font-size: clamp(1rem, 2vh, 1.75rem);\n}\n\n.helper-text {\n font-size: clamp(0.75rem, 1.5vh, 1rem);\n}\n\n@keyframes display-drop-zone {\n 0% {\n background-color: rgb(var(--contrast-1100), 0);\n backdrop-filter: blur(0);\n -webkit-backdrop-filter: blur(0);\n scale: 0.9;\n opacity: 0;\n }\n\n 50% {\n scale: 1;\n opacity: 1;\n }\n\n 100% {\n background-color: rgb(var(--contrast-1100), 0.8);\n backdrop-filter: blur(0.25rem);\n -webkit-backdrop-filter: blur(0.25rem);\n }\n}\n","import {\n Component,\n h,\n Event,\n EventEmitter,\n Host,\n Prop,\n State,\n} from '@stencil/core';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { createFileInfo, isTypeAccepted } from '../../util/files';\nimport { partition } from 'lodash-es';\n\n/**\n * This component enables you to seamlessly convert any region of the user interface into\n * a file dropzone area, just by wrapping it inside the `limel-file-dropzone`.\n *\n * The file dropzone can then be used to allow end-users to upload files\n * by dragging and dropping them into the specified area, for example to trigger an upload process.\n *\n * After receiving the files, the component emits a `filesSelected` event. For unsupported\n * files (specified with the `accept` prop) a `filesRejected` event will be emitted.\n *\n * The event detail would be an array of `FileInfo` objects,\n * each representing a file dropped into the dropzone.\n *\n * @exampleComponent limel-example-file-dropzone\n * @exampleComponent limel-example-file-dropzone-type-filtering\n * @private\n */\n@Component({\n tag: 'limel-file-dropzone',\n shadow: true,\n styleUrl: 'file-dropzone.scss',\n})\nexport class FileDropzone {\n /**\n * Specifies the types of files that the dropzone will accept. By default, all file types are accepted.\n *\n * For media files, formats can be specified using: `audio/*`, `video/*`, `image/*`.\n * Unique file type specifiers can also be used, for example: `.jpg`, `.pdf`.\n * A comma-separated list of file extensions or MIME types is also acceptable, e.g., `image/png, image/jpeg` or\n * `.png, .jpg, .jpeg`.\n *\n * @see [HTML attribute: accept](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) for more\n * details.\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Set to `true` to disable the file dropzone.\n */\n @Prop()\n public disabled: boolean = false;\n\n /**\n * Is displayed when the user is dragging a file over the dropzone.\n * A suitable text could for instance be \"Drop your files here\".\n */\n @Prop()\n public text: string;\n\n /**\n * Is displayed to provide supplementary information to the end users,\n * for instance, which filetypes or file sizes are accepted.\n */\n @Prop()\n public helperText?: string = '';\n\n /**\n * Sets to true when there is a file to drop\n */\n @State()\n private hasFileToDrop: boolean = false;\n\n /**\n * Emitted when files are selected\n */\n @Event()\n filesSelected: EventEmitter<FileInfo[]>;\n\n /**\n * Emitted when files are selected but do not conform with the `accept` property specifications.\n * This can happen when the file types or formats of the selected files are not among the ones allowed by the dropzone,\n * as defined by the `accept` property.\n *\n * @see `accept` for details on how to specify acceptable file types.\n */\n @Event()\n filesRejected: EventEmitter<FileInfo[]>;\n\n public render() {\n return (\n <Host\n onDrop={this.handleDrop}\n onDragOver={this.handleDragOver}\n onDragLeave={this.handleDragLeave}\n >\n <slot />\n {this.renderOnDragLayout()}\n </Host>\n );\n }\n\n private renderOnDragLayout = () => {\n if (!this.hasFileToDrop) {\n return;\n }\n\n return (\n <div class=\"has-file-to-drop\">\n <limel-icon class=\"icon\" name=\"upload_2\" />\n <div class=\"text-helpertext\">\n {this.renderText()}\n {this.renderHelperText()}\n </div>\n </div>\n );\n };\n\n private renderText = () => {\n if (!this.text) {\n return;\n }\n\n return <span class=\"text\">{this.text}</span>;\n };\n\n private renderHelperText = () => {\n if (!this.helperText) {\n return;\n }\n\n return <span class=\"helper-text\">{this.helperText}</span>;\n };\n\n private handleDrop = (event: DragEvent) => {\n event.stopPropagation();\n event.preventDefault();\n this.hasFileToDrop = false;\n\n if (this.disabled) {\n return;\n }\n\n const files: File[] = Array.from(event.dataTransfer.files);\n const fileInfos: FileInfo[] = files.map(createFileInfo);\n\n const [acceptedFileInfos, rejectedFileInfos] = partition(\n fileInfos,\n (file) => isTypeAccepted(file, this.accept),\n );\n\n if (acceptedFileInfos.length > 0) {\n this.filesSelected.emit(acceptedFileInfos);\n }\n\n if (rejectedFileInfos.length > 0) {\n this.filesRejected.emit(rejectedFileInfos);\n }\n };\n\n private handleDragOver = (event: DragEvent) => {\n this.hasFileToDrop = true;\n event.preventDefault();\n };\n\n private handleDragLeave = (event: DragEvent) => {\n this.hasFileToDrop = false;\n event.preventDefault();\n };\n}\n"],"version":3}
|