quix-ui 1.2.7 → 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,7 +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,
|
|
3
|
+
import { forwardRef, useContext, useState, useCallback, useEffect } from 'react';
|
|
4
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
|
+
}
|
|
5
13
|
function _defineProperty(e, r, t) {
|
|
6
14
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
7
15
|
value: t,
|
|
@@ -10,6 +18,33 @@ function _defineProperty(e, r, t) {
|
|
|
10
18
|
writable: true
|
|
11
19
|
}) : e[r] = t, e;
|
|
12
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
|
+
}
|
|
13
48
|
function ownKeys(e, r) {
|
|
14
49
|
var t = Object.keys(e);
|
|
15
50
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -31,6 +66,9 @@ function _objectSpread2(e) {
|
|
|
31
66
|
}
|
|
32
67
|
return e;
|
|
33
68
|
}
|
|
69
|
+
function _slicedToArray(r, e) {
|
|
70
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
71
|
+
}
|
|
34
72
|
function _taggedTemplateLiteral(e, t) {
|
|
35
73
|
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
36
74
|
raw: {
|
|
@@ -52,6 +90,13 @@ function _toPropertyKey(t) {
|
|
|
52
90
|
var i = _toPrimitive(t, "string");
|
|
53
91
|
return "symbol" == typeof i ? i : i + "";
|
|
54
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
|
+
}
|
|
55
100
|
|
|
56
101
|
function styleInject(css, ref) {
|
|
57
102
|
if ( ref === void 0 ) ref = {};
|
|
@@ -3936,22 +3981,29 @@ keyframes`
|
|
|
3936
3981
|
`;
|
|
3937
3982
|
|
|
3938
3983
|
function useWindowEvent(type, listener, options) {
|
|
3939
|
-
useEffect(()
|
|
3984
|
+
useEffect(function () {
|
|
3940
3985
|
window.addEventListener(type, listener, options);
|
|
3941
|
-
return ()
|
|
3986
|
+
return function () {
|
|
3987
|
+
return window.removeEventListener(type, listener, options);
|
|
3988
|
+
};
|
|
3942
3989
|
}, [type, listener]);
|
|
3943
3990
|
}
|
|
3944
|
-
|
|
3945
|
-
const eventListerOptions = {
|
|
3991
|
+
var eventListerOptions = {
|
|
3946
3992
|
passive: true
|
|
3947
3993
|
};
|
|
3948
3994
|
function useViewportSize() {
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
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
|
+
});
|
|
3955
4007
|
}, []);
|
|
3956
4008
|
useWindowEvent("resize", setSize, eventListerOptions);
|
|
3957
4009
|
useWindowEvent("orientationchange", setSize, eventListerOptions);
|
|
@@ -4017,10 +4069,10 @@ function Layout(props) {
|
|
|
4017
4069
|
children: bottomNode(menuItemStyle)
|
|
4018
4070
|
})
|
|
4019
4071
|
})]
|
|
4020
|
-
});
|
|
4072
|
+
}, 'aside');
|
|
4021
4073
|
}
|
|
4022
4074
|
function MenuItem(_ref) {
|
|
4023
|
-
var _menuItemsDynamicStyl, _menuItemsDynamicStyl2, _menuItemsDynamicStyl3, _menuItemsDynamicStyl4, _menuItemsDynamicStyl5, _menuItemsDynamicStyl6, _menuItemStyle$style, _menuItemStyle$style2, _menuItemStyle$width3, _menuItemStyle$width4, _menuItemStyle$width5;
|
|
4075
|
+
var _menuItemsDynamicStyl, _menuItemsDynamicStyl2, _menuItemsDynamicStyl3, _menuItemsDynamicStyl4, _menuItemsDynamicStyl5, _menuItemsDynamicStyl6, _menuItemStyle$style, _menuItemStyle$style2, _menuItemStyle$width3, _menuItemStyle$width4, _menuItemStyle$width5, _menuItemStyle$width6;
|
|
4024
4076
|
var item = _ref.item,
|
|
4025
4077
|
ElementType = _ref.ElementType,
|
|
4026
4078
|
menuItemsDynamicStyle = _ref.menuItemsDynamicStyle,
|
|
@@ -4073,7 +4125,7 @@ function Layout(props) {
|
|
|
4073
4125
|
transition: '0.2s all',
|
|
4074
4126
|
justifyContent: windowWidth > 850 ? menuItemStyle === null || menuItemStyle === void 0 || (_menuItemStyle$style = menuItemStyle.style) === null || _menuItemStyle$style === void 0 ? void 0 : _menuItemStyle$style.justifyContent : 'center',
|
|
4075
4127
|
borderRadius: windowWidth > 850 ? menuItemStyle === null || menuItemStyle === void 0 || (_menuItemStyle$style2 = menuItemStyle.style) === null || _menuItemStyle$style2 === void 0 ? void 0 : _menuItemStyle$style2.borderRadius : 2,
|
|
4076
|
-
width: windowWidth
|
|
4128
|
+
width: windowWidth < 450 ? menuItemStyle === null || menuItemStyle === void 0 || (_menuItemStyle$width3 = menuItemStyle.width) === null || _menuItemStyle$width3 === void 0 ? void 0 : _menuItemStyle$width3.mobile : windowWidth > 450 && windowWidth < 850 ? menuItemStyle === null || menuItemStyle === void 0 || (_menuItemStyle$width4 = menuItemStyle.width) === null || _menuItemStyle$width4 === void 0 ? void 0 : _menuItemStyle$width4.tablet : windowWidth > 850 ? menuItemStyle === null || menuItemStyle === void 0 || (_menuItemStyle$width5 = menuItemStyle.width) === null || _menuItemStyle$width5 === void 0 ? void 0 : _menuItemStyle$width5.desktop : menuItemStyle === null || menuItemStyle === void 0 || (_menuItemStyle$width6 = menuItemStyle.width) === null || _menuItemStyle$width6 === void 0 ? void 0 : _menuItemStyle$width6.desktop
|
|
4077
4129
|
}, menuItemStyle === null || menuItemStyle === void 0 ? void 0 : menuItemStyle.style),
|
|
4078
4130
|
children: [item.icon && item.icon.position === 'left' && item.icon.component, windowWidth > 850 && jsx$1("p", {
|
|
4079
4131
|
className: " quix_menuItem_label ",
|
|
@@ -4085,7 +4137,7 @@ function Layout(props) {
|
|
|
4085
4137
|
}), item.icon && item.icon.position === 'right' && item.icon.component]
|
|
4086
4138
|
})
|
|
4087
4139
|
}, item.label)
|
|
4088
|
-
});
|
|
4140
|
+
}, item.label);
|
|
4089
4141
|
}
|
|
4090
4142
|
// console.log( (size.width) - ((size.width < 450 ? Number(sideMenu?.width.mobile) : size.width < 850 ? Number(sideMenu?.width.tablet) : size.width > 850 ? Number(sideMenu?.width.desktop) : Number(sideMenu?.width.desktop)) + 30))
|
|
4091
4143
|
return jsxs(LayoutSection, {
|
|
@@ -4118,3 +4170,26 @@ function Layout(props) {
|
|
|
4118
4170
|
}
|
|
4119
4171
|
|
|
4120
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",
|