quix-ui 1.2.9 → 1.3.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.
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
declare function useWindowEvent(type: keyof WindowEventMap, listener: () => void, options: any): void;
|
|
2
|
+
export { useWindowEvent };
|
|
3
|
+
declare function useViewportSize(): {
|
|
2
4
|
width: number;
|
|
3
5
|
height: number;
|
|
4
|
-
}
|
|
5
|
-
export
|
|
6
|
-
size: {
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
};
|
|
10
|
-
constructor();
|
|
11
|
-
resizeWindow(): void;
|
|
12
|
-
update(): {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
}[];
|
|
16
|
-
destroy(): void;
|
|
17
|
-
}
|
|
18
|
-
export declare const useWindowSize: WindowSize;
|
|
6
|
+
};
|
|
7
|
+
export { useViewportSize };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { jsx as jsx$1, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import * as React3 from 'react';
|
|
3
|
-
import { forwardRef, useContext } from 'react';
|
|
4
|
-
import { useViewportSize } from '@mantine/hooks';
|
|
3
|
+
import { forwardRef, useContext, useState, useCallback, useEffect } from 'react';
|
|
5
4
|
|
|
5
|
+
function _arrayLikeToArray(r, a) {
|
|
6
|
+
(null == a || a > r.length) && (a = r.length);
|
|
7
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
8
|
+
return n;
|
|
9
|
+
}
|
|
10
|
+
function _arrayWithHoles(r) {
|
|
11
|
+
if (Array.isArray(r)) return r;
|
|
12
|
+
}
|
|
6
13
|
function _defineProperty(e, r, t) {
|
|
7
14
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
8
15
|
value: t,
|
|
@@ -11,6 +18,33 @@ function _defineProperty(e, r, t) {
|
|
|
11
18
|
writable: true
|
|
12
19
|
}) : e[r] = t, e;
|
|
13
20
|
}
|
|
21
|
+
function _iterableToArrayLimit(r, l) {
|
|
22
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
23
|
+
if (null != t) {
|
|
24
|
+
var e,
|
|
25
|
+
n,
|
|
26
|
+
i,
|
|
27
|
+
u,
|
|
28
|
+
a = [],
|
|
29
|
+
f = true,
|
|
30
|
+
o = false;
|
|
31
|
+
try {
|
|
32
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
33
|
+
} catch (r) {
|
|
34
|
+
o = true, n = r;
|
|
35
|
+
} finally {
|
|
36
|
+
try {
|
|
37
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
38
|
+
} finally {
|
|
39
|
+
if (o) throw n;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return a;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function _nonIterableRest() {
|
|
46
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
47
|
+
}
|
|
14
48
|
function ownKeys(e, r) {
|
|
15
49
|
var t = Object.keys(e);
|
|
16
50
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -32,6 +66,9 @@ function _objectSpread2(e) {
|
|
|
32
66
|
}
|
|
33
67
|
return e;
|
|
34
68
|
}
|
|
69
|
+
function _slicedToArray(r, e) {
|
|
70
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
71
|
+
}
|
|
35
72
|
function _taggedTemplateLiteral(e, t) {
|
|
36
73
|
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
37
74
|
raw: {
|
|
@@ -53,6 +90,13 @@ function _toPropertyKey(t) {
|
|
|
53
90
|
var i = _toPrimitive(t, "string");
|
|
54
91
|
return "symbol" == typeof i ? i : i + "";
|
|
55
92
|
}
|
|
93
|
+
function _unsupportedIterableToArray(r, a) {
|
|
94
|
+
if (r) {
|
|
95
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
96
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
97
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
56
100
|
|
|
57
101
|
function styleInject(css, ref) {
|
|
58
102
|
if ( ref === void 0 ) ref = {};
|
|
@@ -3936,6 +3980,37 @@ keyframes`
|
|
|
3936
3980
|
}
|
|
3937
3981
|
`;
|
|
3938
3982
|
|
|
3983
|
+
function useWindowEvent(type, listener, options) {
|
|
3984
|
+
useEffect(function () {
|
|
3985
|
+
window.addEventListener(type, listener, options);
|
|
3986
|
+
return function () {
|
|
3987
|
+
return window.removeEventListener(type, listener, options);
|
|
3988
|
+
};
|
|
3989
|
+
}, [type, listener]);
|
|
3990
|
+
}
|
|
3991
|
+
var eventListerOptions = {
|
|
3992
|
+
passive: true
|
|
3993
|
+
};
|
|
3994
|
+
function useViewportSize() {
|
|
3995
|
+
var _useState = useState({
|
|
3996
|
+
width: 0,
|
|
3997
|
+
height: 0
|
|
3998
|
+
}),
|
|
3999
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4000
|
+
windowSize = _useState2[0],
|
|
4001
|
+
setWindowSize = _useState2[1];
|
|
4002
|
+
var setSize = useCallback(function () {
|
|
4003
|
+
setWindowSize({
|
|
4004
|
+
width: window.innerWidth || 0,
|
|
4005
|
+
height: window.innerHeight || 0
|
|
4006
|
+
});
|
|
4007
|
+
}, []);
|
|
4008
|
+
useWindowEvent("resize", setSize, eventListerOptions);
|
|
4009
|
+
useWindowEvent("orientationchange", setSize, eventListerOptions);
|
|
4010
|
+
useEffect(setSize, []);
|
|
4011
|
+
return windowSize;
|
|
4012
|
+
}
|
|
4013
|
+
|
|
3939
4014
|
var _templateObject, _templateObject2, _templateObject3;
|
|
3940
4015
|
function Layout(props) {
|
|
3941
4016
|
var _header$height, _header$height2, _sideMenu$width$table, _sideMenu$width, _sideMenu$width$deskt, _sideMenu$width2, _sideMenu$width$deskt2, _sideMenu$width3;
|
|
@@ -4095,3 +4170,26 @@ function Layout(props) {
|
|
|
4095
4170
|
}
|
|
4096
4171
|
|
|
4097
4172
|
export { Buttons, FlexView, Layout };
|
|
4173
|
+
header.children && (header === null || header === void 0 ? void 0 : header.children())
|
|
4174
|
+
}), sideMenu && SideMenu({
|
|
4175
|
+
sideMenu: sideMenu,
|
|
4176
|
+
top: ((_header$height = header === null || header === void 0 ? void 0 : header.height) !== null && _header$height !== void 0 ? _header$height : 80) + 20
|
|
4177
|
+
}), jsxRuntime.jsx(Content, {
|
|
4178
|
+
style: {
|
|
4179
|
+
position: 'absolute',
|
|
4180
|
+
left: size.width < 450 ? 0 : size.width < 850 ? sideMenu === null || sideMenu === void 0 ? void 0 : sideMenu.width.tablet : size.width > 850 ? sideMenu === null || sideMenu === void 0 ? void 0 : sideMenu.width.desktop : 300,
|
|
4181
|
+
top: ((_header$height2 = header === null || header === void 0 ? void 0 : header.height) !== null && _header$height2 !== void 0 ? _header$height2 : 80) + 20,
|
|
4182
|
+
padding: 10,
|
|
4183
|
+
height: Number(size.height) - (Number(header === null || header === void 0 ? void 0 : header.height) + 70),
|
|
4184
|
+
margin: 5,
|
|
4185
|
+
zIndex: 10,
|
|
4186
|
+
width: size.width - ((size.width < 450 ? Number(0) : size.width < 850 ? Number((_sideMenu$width$table = sideMenu === null || sideMenu === void 0 || (_sideMenu$width = sideMenu.width) === null || _sideMenu$width === void 0 ? void 0 : _sideMenu$width.tablet) !== null && _sideMenu$width$table !== void 0 ? _sideMenu$width$table : 60) : size.width > 850 ? Number((_sideMenu$width$deskt = sideMenu === null || sideMenu === void 0 || (_sideMenu$width2 = sideMenu.width) === null || _sideMenu$width2 === void 0 ? void 0 : _sideMenu$width2.desktop) !== null && _sideMenu$width$deskt !== void 0 ? _sideMenu$width$deskt : 300) : Number((_sideMenu$width$deskt2 = sideMenu === null || sideMenu === void 0 || (_sideMenu$width3 = sideMenu.width) === null || _sideMenu$width3 === void 0 ? void 0 : _sideMenu$width3.desktop) !== null && _sideMenu$width$deskt2 !== void 0 ? _sideMenu$width$deskt2 : 300)) + 30)
|
|
4187
|
+
},
|
|
4188
|
+
children: content && content()
|
|
4189
|
+
})]
|
|
4190
|
+
});
|
|
4191
|
+
}
|
|
4192
|
+
|
|
4193
|
+
exports.Buttons = Buttons;
|
|
4194
|
+
exports.FlexView = FlexView;
|
|
4195
|
+
exports.Layout = Layout;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quix-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "This is a react component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "vite build",
|
|
14
|
-
"rollup": " rimraf dist && rollup -c",
|
|
14
|
+
"rollup": " rimraf dist && rollup -c -w",
|
|
15
15
|
"test": "jest --watchAll --verbose",
|
|
16
16
|
"ui": "storybook dev -p 6006",
|
|
17
17
|
"build-storybook": "storybook build",
|