@m4l/components 0.0.0 → 0.0.3
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/dist/commonjs.js +5 -0
- package/dist/components/FormActions/index.d.ts +3 -0
- package/dist/components/FormActions/index.js +41 -0
- package/dist/components/FormActions/styles.d.ts +2 -0
- package/dist/components/FormActions/types.d.ts +7 -0
- package/dist/components/ModalDialog/components/Header/index.d.ts +3 -0
- package/dist/components/ModalDialog/components/Header/types.d.ts +9 -0
- package/dist/components/ModalDialog/index.d.ts +2 -0
- package/dist/components/ModalDialog/index.js +174 -0
- package/dist/components/ModalDialog/styles.d.ts +9 -0
- package/dist/components/ModalDialog/types.d.ts +5 -0
- package/dist/components/Resizeable/index.d.ts +3 -0
- package/dist/components/Resizeable/index.js +92 -0
- package/dist/components/Resizeable/styles.d.ts +5 -0
- package/dist/components/Resizeable/types.d.ts +8 -0
- package/dist/components/SplitLayout/index.d.ts +3 -0
- package/dist/components/SplitLayout/index.js +130 -0
- package/dist/components/SplitLayout/styles.d.ts +4 -0
- package/dist/components/SplitLayout/types.d.ts +9 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/mui_extended/MenuActions/styles.d.ts +2 -2
- package/dist/contexts/ModalContext/components/ContentConfirm/index.d.ts +3 -0
- package/dist/contexts/ModalContext/components/ContentConfirm/styles.d.ts +6 -0
- package/dist/contexts/ModalContext/components/ContentConfirm/types.d.ts +8 -0
- package/dist/contexts/ModalContext/index.d.ts +5 -0
- package/dist/contexts/ModalContext/index.js +162 -0
- package/dist/contexts/ModalContext/types.d.ts +42 -0
- package/dist/contexts/index.d.ts +2 -0
- package/dist/hooks/useModal/index.d.ts +1 -0
- package/dist/hooks/useModal/index.js +4 -0
- package/dist/hooks/useResponsive.d.ts +8 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +22 -6
- package/dist/prop-types.js +1 -0
- package/dist/react-draggable.js +1435 -0
- package/dist/react-resizable.js +594 -0
- package/dist/react-splitter-layout.js +165 -0
- package/dist/react.js +2 -0
- package/dist/vendor.js +44 -0
- package/package.json +11 -2
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { g as getDefaultExportFromCjs } from "./commonjs.js";
|
|
2
|
+
import require$$1 from "prop-types";
|
|
3
|
+
import require$$0 from "react";
|
|
4
|
+
var lib = { exports: {} };
|
|
5
|
+
(function(module, exports) {
|
|
6
|
+
!function(e, t) {
|
|
7
|
+
module.exports = t(require$$1, require$$0);
|
|
8
|
+
}(window, function(e, t) {
|
|
9
|
+
return function(e2) {
|
|
10
|
+
var t2 = {};
|
|
11
|
+
function n(o) {
|
|
12
|
+
if (t2[o])
|
|
13
|
+
return t2[o].exports;
|
|
14
|
+
var r = t2[o] = { i: o, l: false, exports: {} };
|
|
15
|
+
return e2[o].call(r.exports, r, r.exports, n), r.l = true, r.exports;
|
|
16
|
+
}
|
|
17
|
+
return n.m = e2, n.c = t2, n.d = function(e3, t3, o) {
|
|
18
|
+
n.o(e3, t3) || Object.defineProperty(e3, t3, { enumerable: true, get: o });
|
|
19
|
+
}, n.r = function(e3) {
|
|
20
|
+
typeof Symbol != "undefined" && Symbol.toStringTag && Object.defineProperty(e3, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e3, "__esModule", { value: true });
|
|
21
|
+
}, n.t = function(e3, t3) {
|
|
22
|
+
if (1 & t3 && (e3 = n(e3)), 8 & t3)
|
|
23
|
+
return e3;
|
|
24
|
+
if (4 & t3 && typeof e3 == "object" && e3 && e3.__esModule)
|
|
25
|
+
return e3;
|
|
26
|
+
var o = /* @__PURE__ */ Object.create(null);
|
|
27
|
+
if (n.r(o), Object.defineProperty(o, "default", { enumerable: true, value: e3 }), 2 & t3 && typeof e3 != "string")
|
|
28
|
+
for (var r in e3)
|
|
29
|
+
n.d(o, r, function(t4) {
|
|
30
|
+
return e3[t4];
|
|
31
|
+
}.bind(null, r));
|
|
32
|
+
return o;
|
|
33
|
+
}, n.n = function(e3) {
|
|
34
|
+
var t3 = e3 && e3.__esModule ? function() {
|
|
35
|
+
return e3.default;
|
|
36
|
+
} : function() {
|
|
37
|
+
return e3;
|
|
38
|
+
};
|
|
39
|
+
return n.d(t3, "a", t3), t3;
|
|
40
|
+
}, n.o = function(e3, t3) {
|
|
41
|
+
return Object.prototype.hasOwnProperty.call(e3, t3);
|
|
42
|
+
}, n.p = "", n(n.s = 2);
|
|
43
|
+
}([function(t2, n) {
|
|
44
|
+
t2.exports = e;
|
|
45
|
+
}, function(e2, n) {
|
|
46
|
+
e2.exports = t;
|
|
47
|
+
}, function(e2, t2, n) {
|
|
48
|
+
e2.exports = n(3);
|
|
49
|
+
}, function(e2, t2, n) {
|
|
50
|
+
n.r(t2);
|
|
51
|
+
var o = n(1), r = n.n(o), i = n(0), a = n.n(i);
|
|
52
|
+
function s(e3) {
|
|
53
|
+
var t3 = e3.size || 0, n2 = e3.percentage ? "%" : "px", o2 = "layout-pane", i2 = {};
|
|
54
|
+
return e3.primary ? o2 += " layout-pane-primary" : e3.vertical ? i2.height = "".concat(t3).concat(n2) : i2.width = "".concat(t3).concat(n2), r.a.createElement("div", { className: o2, style: i2 }, e3.children);
|
|
55
|
+
}
|
|
56
|
+
s.propTypes = { vertical: a.a.bool, primary: a.a.bool, size: a.a.number, percentage: a.a.bool, children: a.a.oneOfType([a.a.arrayOf(a.a.node), a.a.node]) }, s.defaultProps = { vertical: false, primary: false, size: 0, percentage: false, children: [] };
|
|
57
|
+
var c = s;
|
|
58
|
+
function l(e3) {
|
|
59
|
+
return (l = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e4) {
|
|
60
|
+
return typeof e4;
|
|
61
|
+
} : function(e4) {
|
|
62
|
+
return e4 && typeof Symbol == "function" && e4.constructor === Symbol && e4 !== Symbol.prototype ? "symbol" : typeof e4;
|
|
63
|
+
})(e3);
|
|
64
|
+
}
|
|
65
|
+
function u(e3, t3) {
|
|
66
|
+
for (var n2 = 0; n2 < t3.length; n2++) {
|
|
67
|
+
var o2 = t3[n2];
|
|
68
|
+
o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e3, o2.key, o2);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function p(e3) {
|
|
72
|
+
return (p = Object.setPrototypeOf ? Object.getPrototypeOf : function(e4) {
|
|
73
|
+
return e4.__proto__ || Object.getPrototypeOf(e4);
|
|
74
|
+
})(e3);
|
|
75
|
+
}
|
|
76
|
+
function d(e3, t3) {
|
|
77
|
+
return (d = Object.setPrototypeOf || function(e4, t4) {
|
|
78
|
+
return e4.__proto__ = t4, e4;
|
|
79
|
+
})(e3, t3);
|
|
80
|
+
}
|
|
81
|
+
function h(e3) {
|
|
82
|
+
if (e3 === void 0)
|
|
83
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
84
|
+
return e3;
|
|
85
|
+
}
|
|
86
|
+
function f() {
|
|
87
|
+
if (document.body.createTextRange) {
|
|
88
|
+
var e3 = document.body.createTextRange();
|
|
89
|
+
e3.collapse(), e3.select();
|
|
90
|
+
} else
|
|
91
|
+
window.getSelection ? window.getSelection().empty ? window.getSelection().empty() : window.getSelection().removeAllRanges && window.getSelection().removeAllRanges() : document.selection && document.selection.empty();
|
|
92
|
+
}
|
|
93
|
+
var y = function(e3) {
|
|
94
|
+
function t3(e4) {
|
|
95
|
+
var n3, o3, r2;
|
|
96
|
+
return function(e5, t4) {
|
|
97
|
+
if (!(e5 instanceof t4))
|
|
98
|
+
throw new TypeError("Cannot call a class as a function");
|
|
99
|
+
}(this, t3), o3 = this, (n3 = !(r2 = p(t3).call(this, e4)) || l(r2) !== "object" && typeof r2 != "function" ? h(o3) : r2).handleResize = n3.handleResize.bind(h(h(n3))), n3.handleMouseMove = n3.handleMouseMove.bind(h(h(n3))), n3.handleMouseUp = n3.handleMouseUp.bind(h(h(n3))), n3.handleTouchMove = n3.handleTouchMove.bind(h(h(n3))), n3.handleSplitterMouseDown = n3.handleSplitterMouseDown.bind(h(h(n3))), n3.state = { secondaryPaneSize: 0, resizing: false }, n3;
|
|
100
|
+
}
|
|
101
|
+
var n2, o2;
|
|
102
|
+
return function(e4, t4) {
|
|
103
|
+
if (typeof t4 != "function" && t4 !== null)
|
|
104
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
105
|
+
e4.prototype = Object.create(t4 && t4.prototype, { constructor: { value: e4, writable: true, configurable: true } }), t4 && d(e4, t4);
|
|
106
|
+
}(t3, r.a.Component), n2 = t3, (o2 = [{ key: "componentDidMount", value: function() {
|
|
107
|
+
var e4;
|
|
108
|
+
if (window.addEventListener("resize", this.handleResize), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchend", this.handleMouseUp), document.addEventListener("touchmove", this.handleTouchMove), this.props.secondaryInitialSize !== void 0)
|
|
109
|
+
e4 = this.props.secondaryInitialSize;
|
|
110
|
+
else {
|
|
111
|
+
var t4, n3 = this.container.getBoundingClientRect();
|
|
112
|
+
t4 = this.splitter ? this.splitter.getBoundingClientRect() : { width: 4, height: 4 }, e4 = this.getSecondaryPaneSize(n3, t4, { left: n3.left + (n3.width - t4.width) / 2, top: n3.top + (n3.height - t4.height) / 2 }, false);
|
|
113
|
+
}
|
|
114
|
+
this.setState({ secondaryPaneSize: e4 });
|
|
115
|
+
} }, { key: "componentDidUpdate", value: function(e4, t4) {
|
|
116
|
+
t4.secondaryPaneSize !== this.state.secondaryPaneSize && this.props.onSecondaryPaneSizeChange && this.props.onSecondaryPaneSizeChange(this.state.secondaryPaneSize), t4.resizing !== this.state.resizing && (this.state.resizing ? this.props.onDragStart && this.props.onDragStart() : this.props.onDragEnd && this.props.onDragEnd());
|
|
117
|
+
} }, { key: "componentWillUnmount", value: function() {
|
|
118
|
+
window.removeEventListener("resize", this.handleResize), document.removeEventListener("mouseup", this.handleMouseUp), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("touchend", this.handleMouseUp), document.removeEventListener("touchmove", this.handleTouchMove);
|
|
119
|
+
} }, { key: "getSecondaryPaneSize", value: function(e4, t4, n3, o3) {
|
|
120
|
+
var r2, i2, a2, s2;
|
|
121
|
+
this.props.vertical ? (r2 = e4.height, i2 = t4.height, a2 = n3.top - e4.top) : (r2 = e4.width, i2 = t4.width, a2 = n3.left - e4.left), o3 && (a2 -= i2 / 2), a2 < 0 ? a2 = 0 : a2 > r2 - i2 && (a2 = r2 - i2);
|
|
122
|
+
var c2 = r2 - i2 - (s2 = this.props.primaryIndex === 1 ? a2 : r2 - i2 - a2);
|
|
123
|
+
return this.props.percentage && (s2 = 100 * s2 / r2, c2 = 100 * c2 / r2, i2 = 100 * i2 / r2, r2 = 100), c2 < this.props.primaryMinSize ? s2 = Math.max(s2 - (this.props.primaryMinSize - c2), 0) : s2 < this.props.secondaryMinSize && (s2 = Math.min(r2 - i2 - this.props.primaryMinSize, this.props.secondaryMinSize)), s2;
|
|
124
|
+
} }, { key: "handleResize", value: function() {
|
|
125
|
+
if (this.splitter && !this.props.percentage) {
|
|
126
|
+
var e4 = this.container.getBoundingClientRect(), t4 = this.splitter.getBoundingClientRect(), n3 = this.getSecondaryPaneSize(e4, t4, { left: t4.left, top: t4.top }, false);
|
|
127
|
+
this.setState({ secondaryPaneSize: n3 });
|
|
128
|
+
}
|
|
129
|
+
} }, { key: "handleMouseMove", value: function(e4) {
|
|
130
|
+
if (this.state.resizing) {
|
|
131
|
+
var t4 = this.container.getBoundingClientRect(), n3 = this.splitter.getBoundingClientRect(), o3 = this.getSecondaryPaneSize(t4, n3, { left: e4.clientX, top: e4.clientY }, true);
|
|
132
|
+
f(), this.setState({ secondaryPaneSize: o3 });
|
|
133
|
+
}
|
|
134
|
+
} }, { key: "handleTouchMove", value: function(e4) {
|
|
135
|
+
this.handleMouseMove(e4.changedTouches[0]);
|
|
136
|
+
} }, { key: "handleSplitterMouseDown", value: function() {
|
|
137
|
+
f(), this.setState({ resizing: true });
|
|
138
|
+
} }, { key: "handleMouseUp", value: function() {
|
|
139
|
+
this.setState(function(e4) {
|
|
140
|
+
return e4.resizing ? { resizing: false } : null;
|
|
141
|
+
});
|
|
142
|
+
} }, { key: "render", value: function() {
|
|
143
|
+
var e4 = this, t4 = "splitter-layout";
|
|
144
|
+
this.props.customClassName && (t4 += " ".concat(this.props.customClassName)), this.props.vertical && (t4 += " splitter-layout-vertical"), this.state.resizing && (t4 += " layout-changing");
|
|
145
|
+
var n3 = r.a.Children.toArray(this.props.children).slice(0, 2);
|
|
146
|
+
n3.length === 0 && n3.push(r.a.createElement("div", null));
|
|
147
|
+
for (var o3 = [], i2 = this.props.primaryIndex !== 0 && this.props.primaryIndex !== 1 ? 0 : this.props.primaryIndex, a2 = 0; a2 < n3.length; ++a2) {
|
|
148
|
+
var s2 = true, l2 = null;
|
|
149
|
+
n3.length > 1 && a2 !== i2 && (s2 = false, l2 = this.state.secondaryPaneSize), o3.push(r.a.createElement(c, { vertical: this.props.vertical, percentage: this.props.percentage, primary: s2, size: l2 }, n3[a2]));
|
|
150
|
+
}
|
|
151
|
+
return r.a.createElement("div", { className: t4, ref: function(t5) {
|
|
152
|
+
e4.container = t5;
|
|
153
|
+
} }, o3[0], o3.length > 1 && r.a.createElement("div", { role: "separator", className: "layout-splitter", ref: function(t5) {
|
|
154
|
+
e4.splitter = t5;
|
|
155
|
+
}, onMouseDown: this.handleSplitterMouseDown, onTouchStart: this.handleSplitterMouseDown }), o3.length > 1 && o3[1]);
|
|
156
|
+
} }]) && u(n2.prototype, o2), t3;
|
|
157
|
+
}();
|
|
158
|
+
y.propTypes = { customClassName: a.a.string, vertical: a.a.bool, percentage: a.a.bool, primaryIndex: a.a.number, primaryMinSize: a.a.number, secondaryInitialSize: a.a.number, secondaryMinSize: a.a.number, onDragStart: a.a.func, onDragEnd: a.a.func, onSecondaryPaneSizeChange: a.a.func, children: a.a.arrayOf(a.a.node) }, y.defaultProps = { customClassName: "", vertical: false, percentage: false, primaryIndex: 0, primaryMinSize: 0, secondaryInitialSize: void 0, secondaryMinSize: 0, onDragStart: null, onDragEnd: null, onSecondaryPaneSizeChange: null, children: [] };
|
|
159
|
+
var m = y;
|
|
160
|
+
t2.default = m;
|
|
161
|
+
}]);
|
|
162
|
+
});
|
|
163
|
+
})(lib);
|
|
164
|
+
const SplitterLayout = /* @__PURE__ */ getDefaultExportFromCjs(lib.exports);
|
|
165
|
+
export { SplitterLayout as S };
|
package/dist/react.js
ADDED
package/dist/vendor.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import "@mui/material/Box";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "./components/mui_extended/MenuPopover/index.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import "@m4l/core";
|
|
6
|
+
import "@mui/material";
|
|
7
|
+
import "react-router-dom";
|
|
8
|
+
import "./components/mui_extended/MenuActions/index.js";
|
|
9
|
+
import { useTheme } from "@mui/material/styles";
|
|
10
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
11
|
+
import "./components/FormActions/index.js";
|
|
12
|
+
import "./react-draggable.js";
|
|
13
|
+
import "./contexts/ModalContext/index.js";
|
|
14
|
+
import "./components/ModalDialog/index.js";
|
|
15
|
+
import "./components/Resizeable/index.js";
|
|
16
|
+
import "./react-splitter-layout.js";
|
|
17
|
+
import "./components/SplitLayout/index.js";
|
|
18
|
+
import "./components/mui_extended/BoxIcon/index.js";
|
|
19
|
+
import "./components/mui_extended/Breadcrumbs/index.js";
|
|
20
|
+
import "./hooks/useModal/index.js";
|
|
21
|
+
function useResponsive(query, key, start, end) {
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const mediaUp = useMediaQuery(theme.breakpoints.up(key));
|
|
24
|
+
const mediaDown = useMediaQuery(theme.breakpoints.down(key));
|
|
25
|
+
const mediaBetween = useMediaQuery(theme.breakpoints.between(start, end));
|
|
26
|
+
const mediaOnly = useMediaQuery(theme.breakpoints.only(key));
|
|
27
|
+
if (query === "up") {
|
|
28
|
+
return mediaUp;
|
|
29
|
+
}
|
|
30
|
+
if (query === "down") {
|
|
31
|
+
return mediaDown;
|
|
32
|
+
}
|
|
33
|
+
if (query === "between") {
|
|
34
|
+
return mediaBetween;
|
|
35
|
+
}
|
|
36
|
+
if (query === "only") {
|
|
37
|
+
return mediaOnly;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function useResponsiveDesktop() {
|
|
41
|
+
const isDesktop = useResponsive("up", "sm");
|
|
42
|
+
return isDesktop;
|
|
43
|
+
}
|
|
44
|
+
export { useResponsiveDesktop as u };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@m4l/core": "^0.0.26",
|
|
22
22
|
"@mui/material": "^5.8.7",
|
|
23
|
+
"prop-types": "^15.8.1",
|
|
23
24
|
"react": "^17.0.0 || 18.x",
|
|
24
25
|
"react-dom": "^18.0.0",
|
|
25
|
-
"react-router-dom":"^6.3.0"
|
|
26
|
+
"react-router-dom": "^6.3.0",
|
|
27
|
+
"clsx": "^1.2.1"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
30
|
"@emotion/styled": "^11.9.3",
|
|
@@ -34,9 +36,12 @@
|
|
|
34
36
|
"@types/node": "^17.0.40",
|
|
35
37
|
"@types/react": "^18.0.0",
|
|
36
38
|
"@types/react-dom": "^18.0.0",
|
|
39
|
+
"@types/react-resizable": "^3.0.1",
|
|
40
|
+
"@types/react-splitter-layout": "^3.0.2",
|
|
37
41
|
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
38
42
|
"@typescript-eslint/parser": "^5.27.1",
|
|
39
43
|
"@vitejs/plugin-react": "^1.3.2",
|
|
44
|
+
"clsx": "^1.2.1",
|
|
40
45
|
"eslint": "^8.17.0",
|
|
41
46
|
"eslint-config-prettier": "^8.5.0",
|
|
42
47
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
@@ -47,6 +52,10 @@
|
|
|
47
52
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
48
53
|
"eslint-plugin-unused-imports": "^2.0.0",
|
|
49
54
|
"prettier": "^2.6.2",
|
|
55
|
+
"prop-types": "^15.8.1",
|
|
56
|
+
"react-draggable": "^4.4.5",
|
|
57
|
+
"react-resizable": "^3.0.4",
|
|
58
|
+
"react-splitter-layout": "^4.0.0",
|
|
50
59
|
"rollup-plugin-terser": "^7.0.2",
|
|
51
60
|
"typescript": "^4.6.3",
|
|
52
61
|
"vite": "^2.9.9",
|