@behivetech/molecules.file-dropzone 0.2.4 → 0.2.5
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/README.md +1 -1
- package/dist/index.cjs +2 -120
- package/dist/index.js +1 -132
- package/docs.json +1 -1
- package/file-dropzone.tsx +1 -1
- package/package.json +12 -8
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A drag-and-drop target with a click-to-browse fallback that reports the chosen `File` objects through `onFiles` — no upload, preview or validation of its own.
|
|
4
4
|
|
|
5
|
-
Docs: https://
|
|
5
|
+
Docs: https://platform.behivetech.com/behivetech/molecules/file-dropzone
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
6
|
var __export = (target, all) => {
|
|
12
7
|
for (var name in all)
|
|
13
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -20,77 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
15
|
}
|
|
21
16
|
return to;
|
|
22
17
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
19
|
|
|
33
|
-
// ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
34
|
-
var require_classnames = __commonJS({
|
|
35
|
-
"../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports2, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
(function() {
|
|
38
|
-
"use strict";
|
|
39
|
-
var hasOwn = {}.hasOwnProperty;
|
|
40
|
-
function classNames() {
|
|
41
|
-
var classes = "";
|
|
42
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
43
|
-
var arg = arguments[i];
|
|
44
|
-
if (arg) {
|
|
45
|
-
classes = appendClass(classes, parseValue(arg));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return classes;
|
|
49
|
-
}
|
|
50
|
-
function parseValue(arg) {
|
|
51
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
52
|
-
return arg;
|
|
53
|
-
}
|
|
54
|
-
if (typeof arg !== "object") {
|
|
55
|
-
return "";
|
|
56
|
-
}
|
|
57
|
-
if (Array.isArray(arg)) {
|
|
58
|
-
return classNames.apply(null, arg);
|
|
59
|
-
}
|
|
60
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
61
|
-
return arg.toString();
|
|
62
|
-
}
|
|
63
|
-
var classes = "";
|
|
64
|
-
for (var key in arg) {
|
|
65
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
66
|
-
classes = appendClass(classes, key);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return classes;
|
|
70
|
-
}
|
|
71
|
-
function appendClass(value, newClass) {
|
|
72
|
-
if (!newClass) {
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
if (value) {
|
|
76
|
-
return value + " " + newClass;
|
|
77
|
-
}
|
|
78
|
-
return value + newClass;
|
|
79
|
-
}
|
|
80
|
-
if (typeof module2 !== "undefined" && module2.exports) {
|
|
81
|
-
classNames.default = classNames;
|
|
82
|
-
module2.exports = classNames;
|
|
83
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
84
|
-
define("classnames", [], function() {
|
|
85
|
-
return classNames;
|
|
86
|
-
});
|
|
87
|
-
} else {
|
|
88
|
-
window.classNames = classNames;
|
|
89
|
-
}
|
|
90
|
-
})();
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
20
|
// index.ts
|
|
95
21
|
var index_exports = {};
|
|
96
22
|
__export(index_exports, {
|
|
@@ -100,42 +26,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
100
26
|
|
|
101
27
|
// file-dropzone.tsx
|
|
102
28
|
var import_react = require("react");
|
|
103
|
-
|
|
104
|
-
// ../../../../packages/registry/class-names/dist/index.js
|
|
105
|
-
var import_classnames = __toESM(require_classnames(), 1);
|
|
106
|
-
var getClassName = ({
|
|
107
|
-
className,
|
|
108
|
-
modifiers = {},
|
|
109
|
-
rootClass,
|
|
110
|
-
styles = {}
|
|
111
|
-
}) => {
|
|
112
|
-
function getModifiers() {
|
|
113
|
-
const updatedModifiers = {};
|
|
114
|
-
const modifierKeys = Object.keys(modifiers);
|
|
115
|
-
if (modifierKeys.length) {
|
|
116
|
-
modifierKeys.forEach((modKey) => {
|
|
117
|
-
const classKey = `${rootClass}--${modKey}`;
|
|
118
|
-
const newClassName = styles[classKey] || classKey;
|
|
119
|
-
updatedModifiers[newClassName] = modifiers[modKey] ?? false;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
return updatedModifiers;
|
|
123
|
-
}
|
|
124
|
-
function getChildClass(childClassName) {
|
|
125
|
-
const classKey = `${rootClass}__${childClassName}`;
|
|
126
|
-
return styles[classKey] || classKey;
|
|
127
|
-
}
|
|
128
|
-
function getRootStyles() {
|
|
129
|
-
return (0, import_classnames.default)(
|
|
130
|
-
className,
|
|
131
|
-
{
|
|
132
|
-
...getModifiers()
|
|
133
|
-
},
|
|
134
|
-
styles[rootClass] || rootClass
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
return [getRootStyles(), getChildClass];
|
|
138
|
-
};
|
|
29
|
+
var import_get_class_name = require("@behivetech/get-class-name");
|
|
139
30
|
|
|
140
31
|
// file-dropzone.module.scss
|
|
141
32
|
var file_dropzone_module_default = {
|
|
@@ -154,7 +45,7 @@ var FileDropzone = ({
|
|
|
154
45
|
}) => {
|
|
155
46
|
const [isDragging, setIsDragging] = (0, import_react.useState)(false);
|
|
156
47
|
const inputRef = (0, import_react.useRef)(null);
|
|
157
|
-
const [rootClass] = getClassName({
|
|
48
|
+
const [rootClass] = (0, import_get_class_name.getClassName)({
|
|
158
49
|
className,
|
|
159
50
|
rootClass: "BHT__FileDropzone",
|
|
160
51
|
modifiers: { dragging: isDragging },
|
|
@@ -213,12 +104,3 @@ var FileDropzone = ({
|
|
|
213
104
|
0 && (module.exports = {
|
|
214
105
|
FileDropzone
|
|
215
106
|
});
|
|
216
|
-
/*! Bundled license information:
|
|
217
|
-
|
|
218
|
-
classnames/index.js:
|
|
219
|
-
(*!
|
|
220
|
-
Copyright (c) 2018 Jed Watson.
|
|
221
|
-
Licensed under the MIT License (MIT), see
|
|
222
|
-
http://jedwatson.github.io/classnames
|
|
223
|
-
*)
|
|
224
|
-
*/
|
package/dist/index.js
CHANGED
|
@@ -1,128 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
28
|
-
var require_classnames = __commonJS({
|
|
29
|
-
"../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
(function() {
|
|
32
|
-
"use strict";
|
|
33
|
-
var hasOwn = {}.hasOwnProperty;
|
|
34
|
-
function classNames() {
|
|
35
|
-
var classes = "";
|
|
36
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
37
|
-
var arg = arguments[i];
|
|
38
|
-
if (arg) {
|
|
39
|
-
classes = appendClass(classes, parseValue(arg));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return classes;
|
|
43
|
-
}
|
|
44
|
-
function parseValue(arg) {
|
|
45
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
46
|
-
return arg;
|
|
47
|
-
}
|
|
48
|
-
if (typeof arg !== "object") {
|
|
49
|
-
return "";
|
|
50
|
-
}
|
|
51
|
-
if (Array.isArray(arg)) {
|
|
52
|
-
return classNames.apply(null, arg);
|
|
53
|
-
}
|
|
54
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
55
|
-
return arg.toString();
|
|
56
|
-
}
|
|
57
|
-
var classes = "";
|
|
58
|
-
for (var key in arg) {
|
|
59
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
60
|
-
classes = appendClass(classes, key);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return classes;
|
|
64
|
-
}
|
|
65
|
-
function appendClass(value, newClass) {
|
|
66
|
-
if (!newClass) {
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
if (value) {
|
|
70
|
-
return value + " " + newClass;
|
|
71
|
-
}
|
|
72
|
-
return value + newClass;
|
|
73
|
-
}
|
|
74
|
-
if (typeof module !== "undefined" && module.exports) {
|
|
75
|
-
classNames.default = classNames;
|
|
76
|
-
module.exports = classNames;
|
|
77
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
78
|
-
define("classnames", [], function() {
|
|
79
|
-
return classNames;
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
window.classNames = classNames;
|
|
83
|
-
}
|
|
84
|
-
})();
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
1
|
// file-dropzone.tsx
|
|
89
2
|
import { useRef, useState } from "react";
|
|
90
|
-
|
|
91
|
-
// ../../../../packages/registry/class-names/dist/index.js
|
|
92
|
-
var import_classnames = __toESM(require_classnames(), 1);
|
|
93
|
-
var getClassName = ({
|
|
94
|
-
className,
|
|
95
|
-
modifiers = {},
|
|
96
|
-
rootClass,
|
|
97
|
-
styles = {}
|
|
98
|
-
}) => {
|
|
99
|
-
function getModifiers() {
|
|
100
|
-
const updatedModifiers = {};
|
|
101
|
-
const modifierKeys = Object.keys(modifiers);
|
|
102
|
-
if (modifierKeys.length) {
|
|
103
|
-
modifierKeys.forEach((modKey) => {
|
|
104
|
-
const classKey = `${rootClass}--${modKey}`;
|
|
105
|
-
const newClassName = styles[classKey] || classKey;
|
|
106
|
-
updatedModifiers[newClassName] = modifiers[modKey] ?? false;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return updatedModifiers;
|
|
110
|
-
}
|
|
111
|
-
function getChildClass(childClassName) {
|
|
112
|
-
const classKey = `${rootClass}__${childClassName}`;
|
|
113
|
-
return styles[classKey] || classKey;
|
|
114
|
-
}
|
|
115
|
-
function getRootStyles() {
|
|
116
|
-
return (0, import_classnames.default)(
|
|
117
|
-
className,
|
|
118
|
-
{
|
|
119
|
-
...getModifiers()
|
|
120
|
-
},
|
|
121
|
-
styles[rootClass] || rootClass
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
return [getRootStyles(), getChildClass];
|
|
125
|
-
};
|
|
3
|
+
import { getClassName } from "@behivetech/get-class-name";
|
|
126
4
|
|
|
127
5
|
// file-dropzone.module.scss
|
|
128
6
|
var file_dropzone_module_default = {
|
|
@@ -199,12 +77,3 @@ var FileDropzone = ({
|
|
|
199
77
|
export {
|
|
200
78
|
FileDropzone
|
|
201
79
|
};
|
|
202
|
-
/*! Bundled license information:
|
|
203
|
-
|
|
204
|
-
classnames/index.js:
|
|
205
|
-
(*!
|
|
206
|
-
Copyright (c) 2018 Jed Watson.
|
|
207
|
-
Licensed under the MIT License (MIT), see
|
|
208
|
-
http://jedwatson.github.io/classnames
|
|
209
|
-
*)
|
|
210
|
-
*/
|
package/docs.json
CHANGED
package/file-dropzone.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef, useState, type DragEvent, type ReactNode } from "react";
|
|
2
|
-
import { getClassName } from "@
|
|
2
|
+
import { getClassName } from "@behivetech/get-class-name";
|
|
3
3
|
import styles from "./file-dropzone.module.scss";
|
|
4
4
|
|
|
5
5
|
export interface FileDropzoneProps {
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behivetech/molecules.file-dropzone",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A drag-and-drop target with a click-to-browse fallback that reports the chosen `File` objects through `onFiles` — no upload, preview or validation of its own.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"types": "./dist/index.d.ts",
|
|
@@ -26,30 +29,31 @@
|
|
|
26
29
|
"status": "stable",
|
|
27
30
|
"tags": []
|
|
28
31
|
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@behivetech/get-class-name": "0.1.0"
|
|
34
|
+
},
|
|
29
35
|
"peerDependencies": {
|
|
30
36
|
"react": "^19.2.7",
|
|
31
37
|
"react-dom": "^19.2.7"
|
|
32
38
|
},
|
|
33
39
|
"devDependencies": {
|
|
40
|
+
"@bht-component-registry/env": "0.1.0",
|
|
34
41
|
"@types/react": "19.2.17",
|
|
35
42
|
"@types/react-dom": "19.2.3",
|
|
36
43
|
"eslint": "^9.39.5",
|
|
37
44
|
"tsup": "^8.5.1",
|
|
38
45
|
"typescript": "^6.0.3",
|
|
39
|
-
"vitest": "^4.1.10"
|
|
40
|
-
"@bht-component-registry/class-names": "0.0.6",
|
|
41
|
-
"@bht-component-registry/env": "0.1.0"
|
|
46
|
+
"vitest": "^4.1.10"
|
|
42
47
|
},
|
|
43
48
|
"repository": {
|
|
44
49
|
"type": "git",
|
|
45
50
|
"url": "https://github.com/behivetech/bht-galaxy.git",
|
|
46
51
|
"directory": "registry/behivetech/molecules/file-dropzone"
|
|
47
52
|
},
|
|
48
|
-
"homepage": "https://
|
|
53
|
+
"homepage": "https://platform.behivetech.com/behivetech/molecules/file-dropzone",
|
|
49
54
|
"publishConfig": {
|
|
50
|
-
"registry": "https://
|
|
51
|
-
"access": "public"
|
|
52
|
-
"provenance": true
|
|
55
|
+
"registry": "https://npm.pkg.github.com",
|
|
56
|
+
"access": "public"
|
|
53
57
|
},
|
|
54
58
|
"scripts": {
|
|
55
59
|
"build": "tsup && bht-registry-docgen",
|